{"difficulty":1300,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"062a171cc3ea717ea95ede9d7a1c3a43","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#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\nusing namespace std;\n\npair co(ll n,ll aa,ll bb)\n{\n\tll i=0,a=max(aa,bb),b=min(aa,bb);\n\twhile(a*i<=n)\n\t{\n\t\tif((n-a*i)%b)i++;\n\t\telse return {true,i+(n-a*i)\/b};\n\t}\n\treturn {false,-1};\n}\n\nint main(int argc, char *argv[])\n{\n\t\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\tcout.tie(0);\n\t\n\tll n,i,a[3],x;\n\tpairp;\n\tcin>>n>>a[0]>>a[1]>>a[2];\n\tsort(a,a+3);\n\ti=n\/a[0]*a[0];\n\twhile(true)\n\t{\n\t\tp=co(n-a[0]*i,a[1],a[2]);\n\t\tif(p.first)\n\t\t{\n\t\t\tcout<\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\nusing namespace std;\n\ntypedef long long int ll;\n#define X first\n#define Y second\n#define mp make_pair\n\nconst int maxn = 1000 * 1000 + 10;\nconst ll base = 701;\nll h[maxn], b[maxn], Thash;\nstring s, t;\n\nll qhash(int l, int r)\n{\n return (h[r] - (h[l] * b[r - l]));\n}\n\nvoid input()\n{\n cin>>s>>t;\n b[0] = 1;\n for(int i = 1; i < maxn; i++)\n b[i] = b[i-1] * base;\n for(int i = 1; i <= s.length(); i++)\n h[i] = h[i-1] * base + s[i-1];\n for(int i = 1; i <= t.length(); i++)\n Thash = Thash * base + t[i-1];\n}\n\nint main()\n{\n input();\n vector ans;\n for(int i = 0; i < s.length(); i++)\n {\n ll res = qhash(0, i) * b[s.length() - i - 1] + qhash(i+1, s.length());\n if(res == Thash)\n ans.push_back(i+1);\n }\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\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 \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\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\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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\n\/\/BEGIN TEMPLATE HERE\n#define SIZE(X) ((int)(X.size()))\n#define LENGTH(X) ((int)(X.length()))\n\/\/END TEMPLATE HERE\n\nlong long x, y;\nint N;\n\nlong long sqr(long long x) {\n return x * x;\n}\n\nint main() {\n scanf(\"%d%I64d%I64d\", &N, &x, &y);\n int i;\n for (i = 0; i < N && i <= y; ++i) {\n if ((y - i) \/ (N - i) > 0 && i + sqr((y - i) \/ (N - i)) * (N - i - (y - i) % (N - i)) + sqr((y - i) \/ (N - i) + 1) * ((y - i) % (N - i)) >= x) {\n break;\n }\n }\n if (i < N) {\n for (int j = 0; j < i; ++j) printf(\"1\\n\");\n for (int j = 0; j < (N - i - (y - i) % (N - i)); ++j) printf(\"%I64d\\n\", (y - i) \/ (N - i));\n for (int j = 0; j < (y - i) % (N - i); ++j) printf(\"%I64d\\n\", (y - i) \/ (N - i) + 1);\n } else {\n printf(\"-1\\n\");\n }\n return 0;\n}\n\n","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"],"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":4} {"difficulty":1200,"lang":"GNU C++14","lang_cluster":"C++","src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\nusing namespace std;\n\ndouble Dis(double x1, int y1, double x2, double y2)\n{\n\treturn sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));\n}\n\nint main()\n{\n\tint n, vb, vs;\n\tcin >> n >> vb >> vs;\n\tint *stop = new int[n + 1];\n\tfor (int i = 1; i <= n; ++i)\n\t\tcin >> stop[i];\n\tint xu, yu;\n\tcin >> xu >> yu;\n\n\tint get_off{ 2 };\n\tif (vs >= vb)\n\t{\n\t\tif (vs == vb && yu == 0 && xu > stop[2])\n\t\t{\n\t\t\tdo { ++get_off; } while (stop[get_off] <= xu && get_off <= n);\n\t\t\t--get_off;\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t\tint cnt = 1;\n\t\tdouble min_time = 2000000000, min_su;\n\t\twhile (stop[cnt] < xu && cnt < n)\n\t\t{\n\t\t\t++cnt;\n\t\t\tdouble stu_univ = Dis(stop[cnt], 0, xu, yu);\n\t\t\tdouble time = stop[cnt] \/ vb + stu_univ \/ vs;\n\t\t\tif (time < min_time)\n\t\t\t{\n\t\t\t\tget_off = cnt;\n\t\t\t\tmin_time = time;\n\t\t\t\tmin_su = stu_univ;\n\t\t\t}\n\t\t\telse if (time == min_time && stu_univ < min_su)\n\t\t\t{\n\t\t\t\tget_off = cnt;\n\t\t\t\tmin_su = stu_univ;\n\t\t\t}\n\t\t}\n\t}\n\tcout << get_off << endl;\n\treturn 0;\n}","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"],"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<\n#include\n#define f first\n#define s second\nusing namespace std;\nint mark[2000+10][2000+10];\npaira[100000+10];\nint n,m,k;\nint size;\nifstream fin(\"input.txt\");\nofstream fout(\"output.txt\");\nint main()\n{\n\tfin>>n>>m>>k;\n\tfor(int i=1;i<=k;i++)\n\t{\n\t\tint v,c;\n\t\tfin>>v>>c;\n\t\/\/\tmark[v][c]=1;\n\t\ta[size]=make_pair(v,c);\n\t\tsize++;\n\t}\n\tfor(int i=0;i1&&mark[q-1][w]==0)\n\t\t{\n\t\t\t\/\/fout<1&&mark[q][w-1]==0)\n\t\t{\n\t\t\tfout<\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":6} {"difficulty":800,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"230a3c4d7090401e5fa3c6b9d994cdf2","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n int w;\r\n cout<<\"enter the wight\";\r\n cin>>w;\r\n if (w==1||w==2||w%2==1)\r\n cout<<\"no\";\r\n else\r\n cout<<\"yes\";\r\n\r\n return 0;\r\n}\r\n","description":"One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.","input_specification":"The first (and the only) input line contains integer number w (1\u2009\u2264\u2009w\u2009\u2264\u2009100) \u2014 the weight of the watermelon bought by the boys.","output_specification":"Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in the opposite case.","notes":"NoteFor example, the boys can divide the watermelon into two parts of 2 and 6 kilos respectively (another variant \u2014 two parts of 4 and 4 kilos).","sample_inputs":["8"],"sample_outputs":["YES"],"human_solution":"#include \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":7} {"difficulty":800,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"3714b7596a6b48ca5b7a346f60d90549","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n int n;\r\n cin >> n;\r\n int a[n];\r\n int b[n];\r\n int t[n];\r\n int j = 0;\r\n for (int i = 0; i < n; i++)\r\n {\r\n cin >> a[i];\r\n }\r\n for (int i = 0; i < n; i++)\r\n {\r\n cin >> b[i];\r\n }\r\n for (int i = 0; i < n; i++)\r\n {\r\n if (a[i] == b[i])\r\n {\r\n t[j] = 0;\r\n j++;\r\n }\r\n else\r\n {\r\n t[j] = 1;\r\n j++;\r\n }\r\n }\r\n for (j = 0; j < n; j++)\r\n {\r\n cout << t[j];\r\n }\r\n return 0;\r\n}","description":"Shapur was an extremely gifted student. He was great at everything including Combinatorics, Algebra, Number Theory, Geometry, Calculus, etc. He was not only smart but extraordinarily fast! He could manage to sum 1018 numbers in a single second.One day in 230 AD Shapur was trying to find out if any one can possibly do calculations faster than him. As a result he made a very great contest and asked every one to come and take part.In his contest he gave the contestants many different pairs of numbers. Each number is made from digits 0 or 1. The contestants should write a new number corresponding to the given pair of numbers. The rule is simple: The i-th digit of the answer is 1 if and only if the i-th digit of the two given numbers differ. In the other case the i-th digit of the answer is 0.Shapur made many numbers and first tried his own speed. He saw that he can perform these operations on numbers of length \u221e (length of a number is number of digits in it) in a glance! He always gives correct answers so he expects the contestants to give correct answers, too. He is a good fellow so he won't give anyone very big numbers and he always gives one person numbers of same length.Now you are going to take part in Shapur's contest. See if you are faster and more accurate.","input_specification":"There are two lines in each input. Each of them contains a single number. It is guaranteed that the numbers are made from 0 and 1 only and that their length is same. The numbers may start with 0. The length of each number doesn't exceed 100.","output_specification":"Write one line \u2014 the corresponding answer. Do not omit the leading 0s.","notes":null,"sample_inputs":["1010100\n0100101","000\n111","1110\n1010","01110\n01100"],"sample_outputs":["1110001","111","0100","00010"],"human_solution":"#include \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\r\n#include \r\nusing namespace std;\r\nint main(){\r\n int n =4;\r\nlong long int s[15];\r\n\r\n int count =0;\r\n for(int i=1;i<4;i++){\r\n cin >> s[i];\r\n sort(s,s+n);\r\n if(s[i]!=s[i-1]){\r\n count++;\r\n }\r\n }\r\n \r\n cout << n-count;\r\n \r\n return 0;\r\n \r\n}","description":"Valera the Horse is going to the party with friends. He has been following the fashion trends for a while, and he knows that it is very popular to wear all horseshoes of different color. Valera has got four horseshoes left from the last year, but maybe some of them have the same color. In this case he needs to go to the store and buy some few more horseshoes, not to lose face in front of his stylish comrades.Fortunately, the store sells horseshoes of all colors under the sun and Valera has enough money to buy any four of them. However, in order to save the money, he would like to spend as little money as possible, so you need to help Valera and determine what is the minimum number of horseshoes he needs to buy to wear four horseshoes of different colors to a party.","input_specification":"The first line contains four space-separated integers s1,\u2009s2,\u2009s3,\u2009s4 (1\u2009\u2264\u2009s1,\u2009s2,\u2009s3,\u2009s4\u2009\u2264\u2009109) \u2014 the colors of horseshoes Valera has. Consider all possible colors indexed with integers.","output_specification":"Print a single integer \u2014 the minimum number of horseshoes Valera needs to buy.","notes":null,"sample_inputs":["1 7 3 3","7 7 7 7"],"sample_outputs":["1","3"],"human_solution":"#include \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#include \r\n#define ll long long\r\n#define dd double\r\n#define N '\\n'\r\n#define ld long double\r\n#define sz(x) (int)((x).size())\r\n#define precise(x) cout << fixed << setprecision(x)\r\n#define el endl\r\n#define cin(vec) for(auto& i : vec) cin >> i\r\n#define all(x) x.begin(),x.end()\r\n#define FASTER ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);\r\nusing namespace std;\r\nll gcd(ll a, ll b)\r\n{\r\n while (b != 0)\r\n {\r\n ll a2 = a;\r\n a = b;\r\n b = a2 % b;\r\n }\r\n return a;\r\n \/\/**********************gcd************************\r\n}\r\nll lcm(ll a, ll b)\r\n{\r\n return a \/ gcd(a, b) * b;\r\n\/\/ *********************lcm**********************\r\n\r\n}\r\n\r\nbool is_prime_num(int x )\r\n{\r\n\r\n for(int i =2 ; i * i <= x ; i++)\r\n {\r\n if(x%i==0)\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\nvector generate_divisors(ll n)\r\n{\r\n vector v;\r\n ll i = 1;\r\n\r\n for (; i * i <= n; i++)\r\n {\r\n if (n % i == 0)\r\n {\r\n v.push_back(i);\r\n if (i != n \/ i)\r\n {\r\n v.push_back(n \/ i);\r\n }\r\n }\r\n }\r\n\r\n \/\/ If i * i equals n, add the last divisor only once\r\n if (i * i == n)\r\n {\r\n v.push_back(i);\r\n }\r\n\r\n return v;\r\n}\r\n\/*\r\nvectorpremution;\r\nint cnt_prime=0;\r\nbool is_visited[4];\r\nint n=4\r\nvoid get_prem(int i=0)\r\n{\r\n if(i==n)\r\n {\r\n cnt_prime++;\r\n return;\r\n }\r\n}\r\nfor(int j=0; j>n>>k;\r\n int low=0;\r\n int hight=n-1;\r\n int num=0;\r\n int mid=(low+hight)\/2;\r\n int mn=INT_MAX;\r\n while(low<=hight)\r\n {\r\n if(mid\/k<=n)\r\n {\r\n num=mid;\r\n low=mid+1;\r\n }\r\n else\r\n {\r\n hight=mid-1;\r\n }\r\n }\r\n\r\n cout<>n => x\/2^n\r\n\/\/x<\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<\r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef vector vi;\r\ntypedef pair pi;\r\n#define pb push_back\r\n#define F first\r\n#define S second\r\n#define S second\r\n#define rep(i , a , b) for(int i = a ;i< b ; i++)\r\n\r\nint main(){\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n cout.tie(NULL);\r\n int arr[5];\r\n rep(i ,0 , 5) cin >> arr[i];\r\n int a[arr[4]] = {0};\r\n rep(i , 0, 4){\r\n for(int j=arr[i] ; j < arr[4]; j+= arr[i]){\r\n a[j]++;\r\n }\r\n }\r\n int cnt = 0;\r\n rep(i , 0, arr[4]){\r\n if(arr[i] == 0) cnt++;\r\n }\r\n\r\n cout << cnt << endl;\r\n return 0;\r\n}","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"],"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":11} {"difficulty":1000,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"639b8b8d0dc42df46b139f0aeb3a7a0a","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\nusing namespace std;\r\n#define ll long long\r\n#define ld long double\r\n#define endl \"\\n\"\r\n#define FOCUS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\nusing namespace std;\r\nbool comp(string s,string h){\r\n\tif(s.size()!=h.size())return s.size()>s;\r\n int x=0,c=0;\r\n for(int i=0;ic)cout<<4;\r\n else cout<<7;\r\n return 0;\r\n\r\n\r\n}\r\n","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"],"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\"<\n#include \n#include \n#include \nusing namespace std;\n\nint main(void)\n{\n int n;\n double b;\n cin >> n >> b;\n vector v(n);\n double res = 0, m = 0;\n for (int i = 0; i != n; ++i)\n {\n cin >> v[i];\n res += v[i];\n }\n if (res \/ n > b)\n {\n cout << -1;\n return 0;\n }\n else\n res += b;\n\n res \/= n;\n\n for (int i = 0; i != n; ++i)\n printf(\"%.6f\\n\", res - v[i]);\n\n return 0;\n}","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"],"human_solution":"#include \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} {"difficulty":1300,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"6cfd3b0a403212ec68bac1667bce9ef1","execute_outcome":"WRONG_ANSWER","source_code":"#include \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 cnt;\nmap :: iterator it;\nint main()\n{\n int n;\n cin>>n;\n for(int i=0;i>s[i]>>a[i];\n int x=0;\n int ans = 0;\n \n for(int i=0;i 0)\n {\n x++;\n ans = max(ans,x);\n }\n else if(cnt[a[i]] == 0)\n {\n x--;\n ans = max(ans,x);\n }\n else \n {\n ans++;\n }\n }\n 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\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}","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"],"human_solution":"#include\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":15} {"difficulty":1100,"lang":"GNU C++","lang_cluster":"C++","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"WRONG_ANSWER","source_code":"#include \nusing namespace std;\nint main(){\n\tint a;\n\tcin>>a;\n\tif(a<=1)cout<<\"Wrong Answer on test 1\"<>c;\n\t\tint q=(i%3==0);\n\t\tif(a%3==1){\n\t\t\tif(i-a==1){\n\t\t\t\tq=0;\n\t\t\t}\n\t\t\tif(i-a==2){\n\t\t\t\tq=1;\n\t\t\t}\n\t\t}\n\t\tif(i==a)q=0;\n\t\tcout<\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":16} {"difficulty":800,"lang":"MS C++","lang_cluster":"C++","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"COMPILATION_ERROR","source_code":"#include \n#include \n#include \n#include \nusing namespace std;\n\nvoid main()\n{\n int n;scanf(\"%d\",&n);\n int M=1;\n int Bros=1;\n for(int q=0;q\n#include \n#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":17} {"difficulty":1000,"lang":"GNU C++0x","lang_cluster":"C++","src_uid":"88e6651e1b0481d711e89c8071be1edf","execute_outcome":"WRONG_ANSWER","source_code":"#include\nint main()\n{\n int a, x, y;\n scanf(\"%d\",&a);\n int i;\n for(i=1;i<=3;i++)\n {\n scanf(\"%d%d\",&x,&y);\n if(a==x) a = y;\n else if(a==y) a = x;\n }\n printf(\"%d\\n\",a);\n return 0;\n} ","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"],"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":18} {"difficulty":1100,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"8b6ae2190413b23f47e2958a7d4e7bc0","execute_outcome":"WRONG_ANSWER","source_code":"#include \nusing namespace std;\n#define fri(a, b) for (int i = a; i < b; i++)\nint main()\n{\n ios::sync_with_stdio(false);\n cin.tie(0);\n int count = 0;\n char s[8][8];\n fri(0, 8)\n {\n for (int j = 0; j < 8; j++)\n {\n cin >> s[i][j];\n }\n }\n fri(0, 8)\n {\n if (s[i][i] == 'B')\n {\n if (s[i + 1][i] == 'B')\n count++;\n if (s[i][i + 1] == 'B')\n count++;\n }\n }\n cout << count << endl;\n return 0;\n}\n\n\t\t \t \t\t \t\t\t\t\t\t \t\t \t","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"],"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":19} {"difficulty":1200,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"94a38067fc8dd8619fa6e5873ca60220","execute_outcome":"WRONG_ANSWER","source_code":"#include\nusing namespace std;\nint n,N[109];\nint main(int argc,char**argv)\n{\n scanf(\"%d\",&n);\n for(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 \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":20} {"difficulty":1100,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"9c90974a0bb860a5e180760042fd5045","execute_outcome":"WRONG_ANSWER","source_code":"#include\nusing namespace std;\nint main(){\n int r,c;\n string s;\n cin>>r>>c;\n vectorv;\n for(int i=0;i>s;\n v.push_back(s);\n }\n for(int i=0;i\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<\r\nusing namespace std;\r\nvoid solve(){\r\n int n,a,b;\r\n cin>>n>>a>>b;\r\n int n1;\r\n mapmp;\r\n for(int i=0;i>n1;\r\n mp[n1] = 1;\r\n }\r\n for(int i=0;i>n1;\r\n mp[n1] = 2;\r\n }\r\n for (auto i = mp.begin(); i != mp.end(); i++)\r\n cout<second<<\" \";\r\n cout<\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\r\nusing namespace std;\r\n#define ll long long\r\n#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\r\n#define endl '\\n'\r\n#define pb push_back\r\n\r\nint main()\r\n{\r\n faster; \r\n \/\/ int t;\r\n \/\/ cin >> t;\r\n \/\/ cin.ignore();\r\n \/\/ for(int testcase=1; testcase<=t; testcase++)\r\n \/\/ {\r\n \r\n\r\n \/\/ } \r\n\r\n int x1,y1,x2,y2;\r\n cin>>x1>>y1>>x2>>y2;\r\n\r\n int cnt = 0;\r\n int x = abs(x2-x1);\r\n int y = abs(y2-y1);\r\n\r\n if(x==y)\r\n {\r\n cnt = x;\r\n }\r\n else {\r\n x1 = abs(x2-x1);\r\n y1 = abs(x2-x1);\r\n\r\n if(y1!=y2)\r\n {\r\n cnt = x1+abs(y2-x1);\r\n }\r\n }\r\n cout<\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<\r\n\r\nusing namespace std;\r\n\r\nint main() {\r\n\tstring s,s1 = \"\";\r\n\tint lower = 0, upper = 0;\r\n\tcin >> s;\r\n\tfor (int i = 0; i < s.size(); i++) {\r\n\t\tif (isupper(s[i])) upper++;\r\n\t\telse lower++;\r\n\t}\r\n\tif (lower >= upper) {\r\n\t\tfor (int i = 0; i < s.size(); i++) {\r\n\t\t\ts1 += (char)tolower(s[i]);\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tfor (int i = 0; i < s.size(); i++) {\r\n\t\t\ts1 += (char)tolower(s[i]);\r\n\t\t}\r\n\t}\r\n\tcout << s1;\r\n\r\n}","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"],"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\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<\n#include \n#include \n#include \n#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#define REP(i, n) for(int i = 0; i < (n); ++i)\n#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)\n#define FORD(i, a, b) for(int i = (a); i >= (b); --i)\n\/\/#define FOREACH(it, c) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)\n#define ALL(c) (c).begin(), (c).end()\n#define FILL(a, b) memset(a, b, sizeof(a))\n#define mp(x, y) make_pair(x, y);\n#define pb push_back\n#define SZ(c) ((int)(c).size())\n#define X(p) p.first\n#define Y(p) p.second\n#define debug(x) cerr << #x << \" = \" << x << \"\\n\";\n\/\/#define debugv(v) cerr << #v << \" = \"; FOREACH(it, v) cerr << *it << \",\\n\";\n\ntypedef long long ll;\ntypedef long double ld;\ntypedef pair pii;\ntypedef pair pdd;\ntypedef vector VI;\ntypedef vector VII; \ntypedef vector VS;\n\nconst int inf = 1000000000;\nconst ll infll = ll(inf) * ll(inf);\nconst double PI = 4 * atan(1.0);\n\ntemplate string i2s(T x) { ostringstream ss; ss << x; return ss.str(); }\nint s2i(string s) { istringstream ss(s); int x; ss >> x; return x;}\nll s2ll(string s) { istringstream ss(s); ll x; ss >> x; return x;}\n\ninline double dist(double x1, double y1, double x2, double y2) { return sqrt(pow(x1-x2, 2) + pow(y1-y2, 2)); }\n\nint main() {\n\tint cnt[5001];\n\tFILL(cnt, 0);\n\tint n;\n\tcin >> n;\n\tint x;\n\tint ans = 0;\n\tREP(i, n) {\n\t\tcin >> x;\n\t\tif (x > n) ++ans;\n\t\tif (cnt[x]++) ++ans;\n\t}\n\tcout << ans << endl;\n\n\treturn 0;\n}\n","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"],"human_solution":"#include \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":26} {"difficulty":1200,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"WRONG_ANSWER","source_code":"#include \nusing namespace std;\n\n#define MAXN 100000\n#define MAXS 100\n\nchar flags[MAXN+1];\nchar a[MAXS+1], b[MAXS+1];\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\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","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"],"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":27} {"difficulty":1100,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"d1e381b72a6c09a0723cfe72c0917372","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\n \r\nusing namespace std;\r\n \r\nint main()\r\n{\r\n ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\n string a,b;\r\n int flag=0;\r\n map m,m1;\r\n cin>>a>>b;\r\n string s=\"\";\r\n for(int i=0;i\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":28} {"difficulty":1200,"lang":"GNU C++","lang_cluster":"C++","src_uid":"d90da1e932a6aa546bec4e1bd4b1fbec","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \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[a[i]][a[j]] && was[a[j]][a[k]] && was[a[k]][a[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","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"],"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 \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":29} {"difficulty":800,"lang":"GNU C++","lang_cluster":"C++","src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\n#include\nusing namespace std;\nint a[111];\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++)\n scanf(\"%d\",a+i);\n int ansx,ansy,ans=1e9;\n for(int i=1;i<=n;i++)\n for(int j=i+1;j<=n;j++)\n if(i!=j&&abs(a[i]-a[j])\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\r\n#include\r\n#include\r\n#include\r\n#include \"bits\/stdc++.h\"\r\nusing namespace std;\r\n#define dbg(...)\r\nusing ll = int64_t;\r\n#define space \" | \"\r\n\r\nint cal(int n){\r\n int bada = n\/2 +1;\r\n return bada*bada + (bada-1)*(bada-1);\r\n}\r\n\r\nvoid Solution(ll number) {\r\n \r\n int n;\r\n cin>>n;\r\n for (int i = 1; i < 100; i+=2)\r\n {\r\n if(n<=cal(i)){\r\n cout<sync_with_stdio(false);\r\n#ifndef ONLINE_JUDGE\r\n freopen(\"C:\\\\Users\\\\sethi\\\\Desktop\\\\Desktop\\\\competitive-programming\\\\input.txt\", \"r\", stdin);\r\n freopen(\"C:\\\\Users\\\\sethi\\\\Desktop\\\\Desktop\\\\competitive-programming\\\\output.txt\", \"w\", stdout);\r\n#endif\r\n cout << fixed << setprecision(12);\r\n ll tc=1; \r\n \/\/ cin >> tc; \r\n\tfor (ll i = 0; i < tc; i++)\r\n\t{\r\n\t\tSolution(i+1);\r\n\t}\r\n\t\r\n \r\n cerr << \"Time:\" << 1000 * ((double)clock()) \/ (double)CLOCKS_PER_SEC << \"ms\\n\";\r\n return 0;\r\n}\r\n","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"],"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\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)printf(\"Cerealguy\\n\");\r\n\telse printf(\"Fat Rat\\n\");\r\n\treturn 0;\r\n}","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"],"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":32} {"difficulty":2300,"lang":"GNU C++14","lang_cluster":"C++","src_uid":"1590da32b7e64d0462550923cce34355","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#include \nusing namespace std;\ntypedef long long LL;\nconst int maxn = 1e6+10;\nconst LL mod = 1e9+7;\n\nint n;\nstruct mmp{\n\tLL s;\n\tint to , cc;\n\tbool operator < (const mmp &op) const{\n\t\treturn s > op.s;\n\t}\n}gg;\nvector v[maxn];\nLL s[maxn] , ans;\n\nvoid dfs1(int x , int y)\n{\n\tif (v[x].size() == 1 && y != 0) return;\n\tfor (int i = 0 ; i < v[x].size() ; i++)\n\t{\n\t\tint to = v[x][i].to , cc = v[x][i].cc;\n\t\tif (to != y)\n\t\t{\n\t\t\tdfs1(to,x);\n\t\t\ts[to] += cc;\n\t\t\ts[x] += s[to];\n\t\t\tv[x][i].s = s[to];\n\t\t}\n\t}\n\tsort(v[x].begin(),v[x].end());\n}\n\nint dfs2(int x , int y , int p)\n{\n\tans += p;\n\tif (v[x].size() == 1 && y != 0) return p;\n\tfor (int i = 0 ; i < v[x].size() ; i++)\n\t{\n\t\tint to = v[x][i].to , cc = v[x][i].cc;\n\t\tif (to != y)\n\t\t{\n\t\t\tp += cc;\n\t\t\tp = dfs2(to,x,p);\n\t\t\tp += cc;\n\t\t}\n\t}\n\treturn p;\n}\n\nint main()\n{\n\tint i , j , x , y , z;\n\tcin >> n;\n\tfor (i = 1 ; i < n ; i++)\n\t{\n\t\tscanf(\"%d%d%d\",&x,&y,&z);\n\t\tgg.cc = z;\n\t\tgg.to = y;\n\t\tv[x].push_back(gg);\t\n\t\tgg.to = x;\n\t\tv[y].push_back(gg);\n\t}\n\tdfs1(1,0);\n\tdfs2(1,0,0);\n\tlong double sum = ans , div = n-1;\n\tprintf(\"%.10Lf\\n\",sum\/div);\n\treturn 0; \n}\n \t \t\t \t \t\t\t\t \t\t\t\t\t\t \t \t","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"],"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<\n#include \n#include \n\nusing namespace std;\n\nstring temp, N1, N2, res1, res2;\n\nint stoi(string s) {\n int res = 0;\n for(int i = 0;i>N1;\n N2 = N1;\n temp = N1;\n res1 = N1;\n res2 = N2;\n sort(N1.begin(),N1.end());\n \n do {\n sort(N2.begin(),N2.end());\n do {\n int sum = stoi(N1)+stoi(N2);\n int cnt = 0;\n while(sum) {\n int r = sum%10;\n if(r == 0) ++cnt;\n if(r != 0) break;\n sum\/=10;\n }\n if(cnt>res) {\n res = cnt;\n res1 = N1;\n res2 = N2;\n }\n }while(next_permutation(N2.begin(),N2.end()));\n }while(next_permutation(N1.begin(),N1.end()));\n cout<\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":34} {"difficulty":1900,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"4c2865e4742a29460ca64860740b84f4","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\n\r\nusing namespace std;\r\n\r\n#define F(i,a,b) for(int i = a; i < b; i++)\r\n#define FE(i,a,b) for(int i = a; i <= b; i++)\r\n#define FR(i,a,b) for(int i = a; i > b; i--)\r\n#define FRE(i,a,b) for(int i = a; i >= b; i--)\r\n#define ll long long \/\/data types used often, but you don't want to type them time by time\r\n#define ull unsigned long long\r\n#define ui unsigned int\r\n#define us unsigned short\r\n#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) \/\/ traverse an STL data structure\r\n#define ALL(c) (c).begin(),(c).end() \/\/handy for function like \"sort()\"\r\n#define IND(e, arr) find(begin(arr), end(arr), e) - begin(arr)\r\n#define IOS ios_base::sync_with_stdio(0); \/\/to synchronize the input of cin and scanf\r\n#define INF 1001001001\r\n#define PI 3.1415926535897932384626\r\n#define mp make_pair\r\n#define fi first\r\n#define se second\r\n#define pb push_back\r\n\r\ntypedef pair ii;\r\ntypedef vector vi;\r\ntypedef vector> vii;\r\ntypedef vector> vvi;\r\ntypedef vector vb;\r\n\r\nint dx[4] = {1,0,-1,0};\r\nint dy[4] = {0,1,0,-1};\r\n\r\ntypedef struct{\r\n int x;\r\n int y;\r\n} point;\r\n\r\ntypedef struct{\r\n point center;\r\n int radius;\r\n} circle;\r\n\r\ntypedef struct{\r\n point center;\r\n int inner, outer;\r\n} ring;\r\n\r\nint getSq(int x){\r\n return x*x;\r\n}\r\n\r\nbool circleIntersect(circle c1, circle c2){\r\n double dist = sqrt(getSq(c1.center.x-c2.center.x) + getSq(c1.center.y-c2.center.y));\r\n \/\/cout << dist << c1.radius << ' ' << c2.radius << endl;\r\n\r\n if(dist >= c1.radius + c2.radius){\r\n return false;\r\n }\r\n if(dist <= abs(c1.radius - c2.radius)){ \r\n return false;\r\n }\r\n if(dist == c1.radius + c2.radius){\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\nbool valid(circle c, ring r){\r\n return !circleIntersect(c, {r.center, r.inner}) && !circleIntersect(c, {r.center, r.outer});\r\n};\r\n\r\nint main(){\r\n ring r1, r2;\r\n cin >> r1.center.x >> r1.center.y >> r1.inner >> r1.outer;\r\n cin >> r2.center.x >> r2.center.y >> r2.inner >> r2.outer;\r\n\r\n int ans = 0;\r\n\r\n ans += valid({r1.center, r1.inner}, r2);\r\n ans += valid({r1.center, r1.outer}, r2);\r\n ans += valid({r2.center, r2.inner}, r1);\r\n ans += valid({r2.center, r2.outer}, r1);\r\n\r\n cout << ans << endl;\r\n\treturn 0;\r\n}\r\n","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"],"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":35} {"difficulty":2300,"lang":"MS C++","lang_cluster":"C++","src_uid":"52b13cca189853e6af02bea8d3d85276","execute_outcome":"WRONG_ANSWER","source_code":"#pragma comment(linker, \"\/STACK:32000000\")\n#define _CRT_SECURE_NO_DEPRECATE\n\n#include \"stdio.h\"\n#include \"math.h\"\n#include \"string.h\"\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define pi 3.1415926535897932384626433832795\n#define ALL(x) x.begin(), x.end()\n#define LL long long\n#define MP make_pair\n#define PB push_back\n#define SZ(x) ((int)x.size())\n#define SQR(x) ((x) * (x))\n#define SS stringstream\n#define CLR(a,b) memset(a, b, sizeof(a))\n#define CLR0(a) CLR(a,0)\n\n#define maxn 1500\n\nint n, m, k, q;\n\nmap names;\nint eu[maxn], ev[maxn];\n\n\nstruct group\n{\n set people;\n set keys;\n friend bool operator < (const group &a, const group &b)\n {\n if (a.people != b.people) return a.people < b.people;\n return a.keys < b.keys;\n }\n friend bool operator == (const group &a, const group &b)\n {\n return a.people == b.people && a.keys == b.keys;\n }\n void reset()\n {\n people.clear();\n keys.clear();\n }\n bool haskey(int x)\n {\n return keys.find(x) != keys.end();\n }\n};\n\nint getname(char *s)\n{\n if (names.find(string(s)) == names.end())\n {\n names[s] = q++;\n }\n return names[s];\n}\n\ngroup g[maxn];\nchar s[1000];\nint wh[maxn];\nbool f[maxn], dead[maxn];\n\nvector calc()\n{\n vector res;\n for (int i = 0; i < n; i++) g[i].reset();\n for (int i = 0; i < k; i++)\n {\n int room, cnt;\n scanf(\"%s%d%d\", s, &room, &cnt);\n room--;\n g[room].people.insert(getname(s));\n for (int j = 0; j < cnt; j++)\n {\n int x;\n scanf(\"%d\", &x);\n x--;\n g[room].keys.insert(x);\n }\n }\n for (int i = 0; i < n; i++) wh[i] = i;\n\n CLR(f, false);\n CLR(dead, false);\n bool ok = true;\n while (ok)\n {\n ok = false;\n for (int i = 0; i < m; i++) if (wh[eu[i]] != wh[ev[i]])\n {\n if (g[wh[eu[i]]].haskey(i) || g[wh[ev[i]]].haskey(i))\n {\n ok = true;\n \/\/f[i] = true;\n int g1 = wh[ev[i]];\n int g2 = wh[eu[i]];\n for (int j = 0; j < n; j++) if (wh[j] == g2) wh[j] = g1;\n dead[g2] = true;\n g[g1].keys.insert(ALL(g[g2].keys));\n g[g1].people.insert(ALL(g[g2].people));\n }\n }\n }\n for (int i = 0; i < n; i++) if (!dead[i]) res.PB(g[i]);\n sort(ALL(res));\n return res;\n}\n\nvoid solve() {\n scanf(\"%d%d%d\", &n, &m, &k);\n for (int i = 0; i < m; i++)\n {\n scanf(\"%d%d\", &eu[i], &ev[i]);\n eu[i]--;\n ev[i]--;\n }\n vector s1 = calc();\n vector s2 = calc();\n printf(\"%s\", s1 == s2 ? \"YES\" : \"NO\");\n}\n\nint main()\n{\n \/\/freopen(\"input.txt\", \"r\", stdin);\n \/\/freopen(\"output.txt\", \"w\", stdout);\n solve();\n return 0;\n}","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"],"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":36} {"difficulty":2400,"lang":"GNU C++14","lang_cluster":"C++","src_uid":"566adc43d2d6df257c26c5f5495a5745","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"\/\/By Tushar Gautam\n#pragma GCC optimize (\"-O2\")\n#include \nusing namespace std;\n#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)\n#define pb push_back\n#define mp make_pair\n#define fi first\n#define se second\n#define memreset(a) memset(a,0,sizeof(a))\n#define testcase(t) int t;cin>>t;while(t--)\n#define forstl(i,v) for(auto &i: v)\n#define forn(i,e) for(int i = 0; i < e; i++)\n#define forsn(i,s,e) for(int i = s; i < e; i++)\n#define rforn(i,s) for(int i = s; i >= 0; i--)\n#define rforsn(i,s,e) for(int i = s; i >= e; i--)\n#define leadzero(a) __builtin_clz(a) \/\/ count leading zeroes\n#define trailzero(a) __builtin_ctz(a) \/\/ count trailing zeroes\n#define bitcount(a) __builtin_popcount(a) \/\/ count set bits (add ll)\n#define ln \"\\n\"\n#define dbg2(x,y) cerr<<#x<<\" = \"< _it(_ss); err(_it, args); }\nvoid err(istream_iterator it) {}\ntemplate\nvoid err(istream_iterator it, T a, Args... args) {\n\tcerr << *it << \" = \" << a << endl;\n\terr(++it, args...);\n}\ntypedef long long int ll;\ntypedef long double ld;\ntypedef pair p64;\ntypedef pair p32;\ntypedef vector v64;\ntypedef vector v32; \ntypedef vector vv32;\ntypedef vector vv64;\ntypedef vector vp32;\ntypedef vector vvp32;\ntypedef map m32;\nconst int LIM = 1e5+5, MOD = 1e9+7;\nint c;\nstring b,n;\nint s2i(string p,int m){\n\tint i=0;\n\tll ans=0,pw10=1;\n\twhile(p[i]){\n\t\tans+=(p[i]-'0')*pw10;\n\t\tans%=m;\n\t\tpw10=pw10*10%m;\n\t\t++i;\n\t}\n\treturn ans;\n}\nint is_com[LIM];\nv32 pr;\nvoid sieve(){\n is_com[1]=1;\n forsn(i,2,LIM){\n if(!is_com[i]){\n pr.pb(i);\n for(int j=i;j M;\n\tforstl(it,pr){\n\t\twhile(n%it==0) M[it]++,n\/=it;\n\t}\n\tif(n!=1) M[n]++;\n\tint ph=1;\n\tforstl(it,M){\n\t\tph*=it.fi-1;\n\t\tforn(i,it.se-1){\n\t\t\tph*=it.fi;\n\t\t}\n\t}\n\treturn ph;\n}\nll powm(ll x,ll pw,ll MOD){ \/\/return x^pw % MOD\n\tll res=1;\n\twhile(pw){\n\t\tif(pw&1LL) res=((res*x))%MOD;\n\t\tpw>>=1;\n\t\tx=((x*x))%MOD;\n\t}\n\treturn res;\n}\nint main(){\n\tfastio;\n\tsieve();\n\tcin>>b>>n>>c;\n\tint ph=phi(c);\n\treverse(b.begin(),b.end());\n\treverse(n.begin(),n.end());\n\t\/\/ n-1\n\tint i=0;\n\twhile(n[i]){\n\t\tif(n[i]=='0') n[i]='9';\n\t\telse{\n\t\t\tn[i]--; break;\n\t\t}\n\t\t++i;\n\t}\n\tint bs=s2i(b,c);\n\tint pw=s2i(n,2*ph);\n\tll ans=powm(bs,pw%ph,c);\n\tbool yes=1;\n\tif(n.length()<31){\n\t\tint x =stoi(n);\n\t\tif(x\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\n#define ll long long\n#define endl \"\\n\"\nconst int MOD=1e9+7;\nusing namespace std;\nll dp[1000005];\nll ed1=0;\nll ed=0;\nint main()\n{\n ios::sync_with_stdio(0);\n cin.tie(0);\n ll n;\n cin>>n;\n dp[0]=0;\n for(ll i=1;i<=n;i++)\n {\n if(i%2==0)\n {\n dp[i]=dp[i-1]+ed1+1;\n ed=dp[i]-ed1;\n }else\n {\n dp[i]=dp[i-1]+ed+1;\n ed1=dp[i]-ed;\n }\n }\n\/\/ for(ll i=1;i<=n;i++)\n\/\/ {\n\/\/ cout<\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":38} {"difficulty":1700,"lang":"GNU C++14","lang_cluster":"C++","src_uid":"5ce8de80c6953cd1e6e6eefd9ad35f7e","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#define int long long\nusing namespace std;\n\n\nsigned main() {\n ios::sync_with_stdio(false);\n cin.tie(nullptr);\n #ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n string str;\n cin >> str;\n int sz = str.size();\n int a[sz+1], cnt[sz+1];\n cnt[0]=0;\n for(int i=0;i > s;\n int last=sz;\n int op[sz+1];\n memset(op, -1,sizeof(op));\n for(int i = 1; i <= sz; i++) {\n \tif(a[i]==1 || a[i]==3){\n \t\ts.push({a[i],i});\n \t}\n \telse if(a[i]-s.top().first==1) {\n op[i]=s.top().second;\n \t\ts.pop();\n last=i;\n \t}\n else{\n break;\n }\n }\n int mx=0, start=-1, end=-1;\n for(int i=1; i<=last; i++){\n if(op[i]==-1)\n continue;\n if(op[op[i]-1]!=-1)\n op[i]=op[op[i]-1];\n if(cnt[i]-cnt[op[i]-1] >= mx){\n start=op[i];\n end=i;\n mx=cnt[i]-cnt[op[i]-1];\n }\n }\n cout<\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#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define sz(c) ((int)(c).size())\n#define pb push_back\n#define mp make_pair\n\n#define REP(i, n) for (int (i) = 0; (i) < (n); ++(i))\n#define FOR(i, s, n) for (int (i) = (s); (i) < (n); ++(i))\n\nusing namespace std;\ntypedef double dbl;\n\nconst dbl pi = 3.1415926535897932384626433832795;\n\nstruct Pnt\n{\n Pnt() : x(0), y(0) {}\n Pnt( dbl x, dbl y ) : x(x), y(y) {}\n\n Pnt operator + ( Pnt const& p ) const { return Pnt(x + p.x, y + p.y); }\n Pnt operator - ( Pnt const& p ) const { return Pnt(x - p.x, y - p.y); }\n Pnt operator * ( dbl a ) const { return Pnt(x * a, y * a); }\n\n dbl operator * ( Pnt p ) const { return x * p.x + y * p.y; }\n dbl operator ^ ( Pnt p ) const { return x * p.y - y * p.x; }\n\n dbl angle() const { return atan2(y, x); }\n\n bool operator == ( Pnt p ) const\n {\n return mp(x, y) == mp(p.x, p.y);\n }\n\n void read() { scanf(\"%lf%lf\", &x, &y); }\n\n dbl x, y;\n};\n\nstruct Sect\n{\n Sect( Pnt a, Pnt b )\n : a(a)\n , b(b)\n {\n assert((a ^ b) >= 0);\n l = a.angle();\n }\n\n bool operator < ( Sect const& s ) const { return l + 1e-13 < s.l; }\n\n Pnt to() const { return b - a; }\n\n dbl l;\n Pnt a, b;\n};\n\ninline set::iterator next( set::iterator si, set& sects )\n{\n return (++si == sects.end()) ? sects.begin() : si;\n}\n\ninline set::iterator prev( set::iterator si, set& sects )\n{\n if (si == sects.begin())\n si = sects.end();\n return --si;\n}\n\nset::iterator getSect( Pnt p, set& sects )\n{\n set::iterator i = upper_bound(sects.begin(), sects.end(), Sect(p, p));\n if (i == sects.begin())\n i = sects.end();\n --i;\n assert((i->a ^ p) >= 0);\n assert((p ^ i->b) >= 0);\n return i;\n}\n\nint main()\n{\n\/\/ freopen(\"input.txt\", \"rt\", stdin);\n\/\/ freopen(\"output.txt\", \"wt\", stdout);\n\n long st = clock();\n\n int q;\n scanf(\"%d\", &q);\n \n q -= 3;\n assert(q > 0);\n\n Pnt origin;\n set sects;\n {\n Pnt p[3];\n REP(i, 3)\n {\n scanf(\"%*d\");\n p[i].read();\n origin = origin + p[i];\n }\n REP(i, 3)\n p[i] = p[i] * 3.0 - origin;\n\n\/\/ cerr << origin.x << \" \" << origin.y << \"\\n\";\n\/\/ REP(i, 3)\n\/\/ cerr << p[i].x << \" \" << p[i].y << \"\\n\";\n\n if ((p[0] ^ p[1]) < 0)\n swap(p[0], p[1]);\n assert((p[0] ^ p[1]) >= 0);\n assert((p[1] ^ p[2]) >= 0);\n assert((p[2] ^ p[0]) >= 0);\n REP(i, 3)\n sects.insert(Sect(p[i], p[(i + 1) % 3]));\n }\n\n REP(reqIt, q)\n {\n if (reqIt % 200 == 0 && clock() - st >= 1.8 * CLOCKS_PER_SEC)\n {\n printf(\"%d outputted\\n\", reqIt);\n return 0;\n }\n\n int req;\n scanf(\"%d\", &req);\n\n Pnt p;\n p.read();\n p = p * 3.0 - origin;\n\/\/ cerr << \"#\" << reqIt << \": \" << p.x << \" \" << p.y << \"\\n\";\n\n if (p == Pnt(0, 0))\n {\n if (req == 2)\n printf(\"YES\\n\");\n continue;\n }\n\n set::iterator si = getSect(p, sects);\n if (req == 1)\n {\n if (((p - si->a) ^ si->to()) <= 0)\n continue;\n\n set::iterator left = si;\n set::iterator prevl = prev(si, sects);\n set::iterator right = si;\n set::iterator nextr = next(si, sects);\n while (((left->a - p) ^ (prevl->a - p)) >= 0)\n {\n left = prevl;\n prevl = prev(prevl, sects);\n }\n while (((right->b - p) ^ (nextr->b - p)) <= 0)\n {\n right = nextr;\n nextr = next(nextr, sects);\n }\n Sect s1(left->a, p);\n Sect s2(p, right->b);\n\n bool run = true;\n for (set::iterator i = left; run; )\n {\n if (i == right)\n run = false;\n set::iterator toDelete = i;\n i = next(i, sects);\n sects.erase(toDelete);\n if (!run)\n break;\n }\n sects.insert(s1);\n sects.insert(s2);\n }\n else\n {\n printf(\"%s\\n\", (((p - si->a) ^ si->to()) > 0) ? \"NO\" : \"YES\");\n }\n }\n \n\n return 0;\n}\n","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"],"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":40} {"difficulty":2100,"lang":"GNU C++","lang_cluster":"C++","src_uid":"6e2a8aa58ed8cd308cb482e4c24cbbbb","execute_outcome":"WRONG_ANSWER","source_code":"#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 if (times[n] < 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 const double eps = 1e-12;\n vector point(3);\n\n while(true) {\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 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","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"],"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":41} {"difficulty":2400,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"788cb3da98fd4a56720f800588061b79","execute_outcome":"WRONG_ANSWER","source_code":"#include \nusing namespace std;\nconst int maxn = 210;\nconst int maxm = 1010;\nint a[maxn];\nint f[maxn][maxn][maxm];\nconst int MOD = 1e9 + 7;\nint n , m;\nvoid dp(){\n\tfor(int i = 0 ; i < n ; i ++){\n\t\tfor(int j = 0 ; j <= n ; j ++){\n\t\t\tint t = (a[i + 1] - a[i]) * j;\n\t\t\tfor(int k = 0 ; k <= m - t ; k ++){\n\t\t\t\t(f[i + 1][j][k + t] += f[i][j][k] * (j + 1) % MOD) %= MOD;\n\t\t\t\tif(j != n) (f[i + 1][j + 1][k + t] += f[i][j][k]) %= MOD;\n\t\t\t\tif(j != 0) (f[i + 1][j - 1][k + t] += f[i][j][k] * j % MOD) %= MOD;\n\t\t\t}\n\t\t}\n\t}\n}\nint main(int argc, char const *argv[])\n{\n\tcin >> n >> m;\n\tfor(int i = 1 ; i <= n ; i ++) cin >> a[i];\n\tsort(a + 1 , a + 1 + n);\n\tf[0][0][0] = 1;\n\tdp();\n\tlong long ans = 0;\n\tfor(int i = 0 ; i <= m ; i ++){\n\t\tans += f[n][0][i];\n\t\tans %= MOD;\n\t}\n\tcout << (ans) % MOD;\n\treturn 0;\n}","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"],"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<\nusing namespace std;\n\nconst int N = 1e3 + 5;\ndouble dp[N][N];\n\nauto recurse(int w, int b) -> double\n{\n if (w < 0 || b < 0)\n return 0., 0;\n\n if (dp[w][b] != -1.0)\n return dp[w][b];\n\n \/\/ drawing white mice directly\n auto ans = (1.0 * w) \/ (w + b);\n\n \/\/ win after next turn\n\n auto nxt_b = b - 1;\n\n auto other = (1.0 * b) \/ (w + b) * (1.0 * nxt_b) \/ (w + nxt_b);\n\n \/\/ black mice jumps out\n other *= 1.0 * (nxt_b - 1) \/ (w + nxt_b - 1) * recurse(w, nxt_b - 2) +\n 1.0 * w \/ (w + nxt_b - 1) * recurse(w - 1, nxt_b - 1);\n return dp[w][b] = ans + other;\n}\n\nauto solve() -> void\n{\n int w, b;\n cin >> w >> b;\n for (int i = 0; i <= w; ++i)\n for (int j = 0; j <= b; ++j)\n dp[i][j] = -1.0;\n\n for (int i = 0; i <= b; ++i)\n dp[0][i] = 0.0;\n for (int i = 1; i <= w; ++i)\n dp[i][0] = 1.0;\n\n cout << fixed << setprecision(9) << recurse(w, b) << endl;\n}\n\nauto main() -> int\n{\n ios_base::sync_with_stdio(false);\n cin.tie(0);\n int tc = 1;\n while (tc--)\n {\n solve();\n }\n\n return 0;\n}\n","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"],"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":43} {"difficulty":1900,"lang":"GNU C++","lang_cluster":"C++","src_uid":"899c5b77bfc0b4b99aff310741c9c0dd","execute_outcome":"WRONG_ANSWER","source_code":"\/*\n * b.cpp\n *\n *\/\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#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#define forn(i, n) for (int i = 0; i < (n); ++i)\n#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)\n\nint main(void) {\n\tint n, k, p, q;\n\tcin >> n >> k;\n\tp = n \/ k;\n\tvector prof(n);\n\tforn(i, n)\n\t\tcin >> prof[i];\n\tcin >> q;\n\tvector mark(n, false);\n\tdouble minProf = numeric_limits::max();\n\tdouble maxProf = 0;\n\n\tforn(i, q) {\n\t\tdouble average = 0;\n\t\tforn(j, p) {\n\t\t\tint index;\n\t\t\tcin >> index;\n\t\t\t--index;\n\t\t\tmark[index] = true;\n\t\t\taverage += prof[index];\n\t\t}\n\t\taverage \/= p;\n\t\tminProf = min(minProf, average);\n\t\tmaxProf = max(maxProf, average);\n\t}\n\n\tvector remaining;\n\tforn(i, n)\n\t\tif (not mark[i])\n\t\t\tremaining.push_back(prof[i]);\n\n\tint m = remaining.size();\n\tif (m >= p && m < k * p) {\n\t\tsort(remaining.begin(), remaining.end());\n\t\tdouble minMean = 0;\n\t\tdouble maxMean = 0;\n\t\tforn(i, p) {\n\t\t\tminMean += remaining[i];\n\t\t\tmaxMean += remaining[m - i - 1];\n\t\t}\n\t\tminMean \/= p;\n\t\tmaxMean \/= p;\n\t\tminProf = min(minProf, minMean);\n\t\tmaxProf = max(maxProf, maxMean);\n\t}\n\n\tprintf(\"%.10lf %.10lf\\n\", minProf, maxProf);\n\n\treturn 0;\n}\n","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"],"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":44} {"difficulty":2400,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"98489fe54488dcfb45f8ae7b5c473d88","execute_outcome":"WRONG_ANSWER","source_code":"#include \r\n#define ll long long\r\n#define MAXN 20\r\nusing namespace std;\r\nll dp[2*MAXN][MAXN],val[MAXN];\r\nint main()\r\n{\r\n ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);\r\n ll n;\r\n string s;\r\n cin >> n >> s;\r\n s=' '+s;\r\n val[n]=1;\r\n for (ll i=n-1;i>0;i--)\r\n val[i]=val[i+1]*10;\r\n for (ll i=1;i<=2*n;i++)\r\n {\r\n for (ll j=0;j<=n;j++)\r\n {\r\n if (j)\r\n dp[i][j]=max(dp[i][j],dp[i-1][j-1]+val[j]*(s[i]-'0'));\r\n if (j\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<\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#include\r\n#include\r\n#include\r\n#include\r\n#include\r\n#define deg(x) cerr<<#x<<\"=\"<=x;i--)\r\n#define mst(x) memset(x,0,sizeof(x));\r\n#define fi first\r\n#define se second\r\n#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);\r\n#define ok \"ok\"\r\n#define HH puts(\"\");\r\n#define ls rt<<1\r\n#define rs rt<<1|1\r\n#define pb(a,b) a.push_back(b);\r\n#define FIN freopen(\"1.in\",\"r\",stdin);\r\n#define FOUT freopen(\"1.out\",\"w\",stdout);\r\nusing namespace std;\r\ntypedef long long ll;typedef long long LL;\r\ntypedef pair pii;\r\ntypedef pair pll;\r\ntypedef pair pss;\r\ntypedef unsigned long long ull;\r\nconst ll mod=998244353;\r\nconst int inf=1e9+7;\r\nconst double eps=1e-8;\r\nll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return (r+m)%m;}\r\n\/\/const double pi=acos(-1);\r\n \r\nconst int maxn=45;\r\nint vis[55][55][55][4][4][4];\/\/\u00e6\u00a0\u0087\u00e8\u00ae\u00b0\u00e6\u0095\u00b0\u00e7\u00bb\u0084\u00ef\u00bc\u008c[A\u00e5\u009d\u0090\u00e6\u00a0\u0087][B\u00e5\u009d\u0090\u00e6\u00a0\u0087][C\u00e5\u009d\u0090\u00e6\u00a0\u0087][A\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081][B\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081][C\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081]\r\nint a[4][4];\r\nint ans=0;\r\n \r\nint dfs(int x1,int x2,int x3,int A,int B,int C){\r\n\t\/\/\u00e5\u008f\u0082\u00e6\u0095\u00b0\u00e5\u0090\u008cvis\u00ef\u00bc\u008c[A\u00e5\u009d\u0090\u00e6\u00a0\u0087][B\u00e5\u009d\u0090\u00e6\u00a0\u0087][C\u00e5\u009d\u0090\u00e6\u00a0\u0087][A\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081][B\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081][C\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081]\r\n if(vis[x1][x2][x3][A][B][C]) return 0;\r\n vis[x1][x2][x3][A][B][C]=1;\r\n int b[4]={x1,x2,x3};\/\/\u00e8\u00ae\u00b0\u00e5\u00bd\u0095\u00e6\u00af\u008f\u00e4\u00ba\u00ba\u00e5\u00bd\u0093\u00e5\u0089\u008d\u00e5\u009d\u0090\u00e6\u00a0\u0087\u00ef\u00bc\u008c\u00e5\u00bc\u0080\u00e4\u00b8\u00aa\u00e6\u0095\u00b0\u00e7\u00bb\u0084\u00e4\u00b8\u00bb\u00e8\u00a6\u0081\u00e6\u0098\u00af\u00e5\u00a5\u00bd\u00e9\u0081\u008d\u00e5\u008e\u0086\r\n int c[4]={A,B,C};\/\/\u00e6\u00af\u008f\u00e4\u00ba\u00ba\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00e7\u008a\u00b6\u00e6\u0080\u0081\u00ef\u00bc\u008c\u00e5\u0090\u008c\u00e6\u00a0\u00b7\u00e6\u0098\u00af\u00e6\u0096\u00b9\u00e4\u00be\u00bf\u00e9\u0081\u008d\u00e5\u008e\u0086\r\n int g[50]={0};\/\/\u00e5\u009d\u0090\u00e6\u00a0\u0087\u00e8\u00bd\u00b4\u00e7\u008a\u00b6\u00e6\u0080\u0081\u00ef\u00bc\u008cg[x]=i\u00e8\u00a1\u00a8\u00e7\u00a4\u00bax\u00e4\u00bd\u008d\u00e7\u00bd\u00ae\u00e4\u00b8\u008a\u00e7\u00ab\u0099\u00e7\u009d\u0080\u00e7\u00ac\u00aci\u00e4\u00b8\u00aa\u00e4\u00ba\u00ba\r\n\t\/\/\u00e5\u0085\u00b6\u00e5\u00ae\u009e\u00e5\u00af\u00b9\u00e4\u00ba\u008e\u00e5\u0090\u009e\u00e6\u008e\u0089\u00e7\u009a\u0084\u00e7\u008a\u00b6\u00e6\u0080\u0081\u00e5\u00ba\u0094\u00e8\u00af\u00a5\u00e9\u00a2\u009d\u00e5\u00a4\u0096\u00e5\u00bc\u0080\u00e4\u00b8\u00aa\u00e6\u0095\u00b0\u00e7\u00bb\u0084\u00ef\u00bc\u008c\u00e4\u00bd\u0086\u00e6\u0098\u00af\u00e6\u0088\u0091\u00e6\u0087\u0092\u00ef\u00bc\u008c\u00e6\u0089\u0080\u00e4\u00bb\u00a5\u00e6\u0088\u0091\u00e7\u0094\u00a8g[maxn+i]\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba\u00e7\u00ac\u00aci\u00e4\u00b8\u00aa\u00e4\u00ba\u00ba\u00e4\u00b8\u00be\u00e8\u00b5\u00b7\u00e7\u009a\u0084\u00e4\u00ba\u00ba\r\n\t\/\/\u00e4\u00b9\u009f\u00e5\u00b0\u00b1\u00e6\u0098\u00afg[maxn+i]=q\u00e8\u00a1\u00a8\u00e7\u00a4\u00ba\u00e7\u00ac\u00aci\u00e4\u00b8\u00aa\u00e4\u00ba\u00ba\u00e6\u00ad\u00a3\u00e5\u0090\u00ab\u00e7\u009d\u0080\u00e7\u00ac\u00acq\u00e4\u00b8\u00aa\u00e4\u00ba\u00ba\r\n\t\/\/g[x]\u00e4\u00b8\u00ba0\u00e8\u0087\u00aa\u00e7\u0084\u00b6\u00e6\u0098\u00af\u00e6\u00b2\u00a1\u00e4\u00ba\u00ba\u00e7\u00ab\u0099\/\u00e4\u00b8\u008d\u00e4\u00b8\u00be\r\n for(int i=0;i<3;i++) g[b[i]]=i;\r\n for(int i=0;i<3;i++){\r\n int t=b[i];\/\/\u00e6\u009e\u009a\u00e4\u00b8\u00be\u00e5\u00bd\u0093\u00e5\u0089\u008d\u00e5\u009d\u0090\u00e6\u00a0\u0087\r\n if(t0&&!g[j]){\r\n b[i]=j;c[i]^=1;\r\n dfs(b[0],b[1],b[2],c[0],c[1],c[2]);\r\n b[i]=t;c[i]^=1;\r\n }\r\n }\r\n }\r\n if(!(c[i]&2)&&!g[maxn+i]){\r\n for(int j=0;j<3;j++){\r\n int v=b[j];\r\n if(abs(t-v)!=1) continue;\r\n b[j]=maxn+i;c[i]^=2;\r\n dfs(b[0],b[1],b[2],c[0],c[1],c[2]);\r\n b[j]=v;c[i]^=2;\r\n }\r\n }\r\n if(g[maxn+i]){\r\n int k=g[maxn+i];\r\n for(int j=max(0,t-a[i][2]);j<=t+a[i][2];j++){\r\n if(j>0&&!g[j]){\r\n b[k]=j;\r\n dfs(b[0],b[1],b[2],c[0],c[1],c[2]);\r\n b[k]=maxn+i;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return 0;\r\n}\r\n \r\nint main()\r\n{\r\n fd(3)\r\n for(int j=0;j<3;j++)\r\n cin>>a[i][j];\r\n dfs(a[0][0],a[1][0],a[2][0],0,0,0);\r\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} {"difficulty":1600,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"a17bac596b1f060209534cbffdf0f40e","execute_outcome":"WRONG_ANSWER","source_code":"\/\/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 = 1e3 + 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 if ( check ( s[i][j] ) )\n V[i] += s[i][j], 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","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"],"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":47} {"difficulty":2300,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"aad7ebf4fa919fae78bfc878e47e483c","execute_outcome":"WRONG_ANSWER","source_code":"#include \nusing namespace std;\n\nint main(){\n\n\tios_base::sync_with_stdio(false);\n \tcin.tie(NULL);\n\n\tint n,m;\n\tcin>>n>>m;\n\tunsigned long long int countInt=0, countIr=0;\n\tif(2*n-1>=m)\n\t{\n\t\tif(m%2==1)\n\t\t{\n\t\t\tcountInt+=(m-1)\/2+1;\n\t\t\tif((m-1)%4==0)\n\t\t\t{\n\t\t\t\tcountInt+=(m-1)\/4;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcountInt+=((m-1)\/2-1)\/2;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcountInt+=m\/2;\n\t\t\tif(m%4==0)\n\t\t\t{\n\t\t\t\tcountInt+=m\/4;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcountInt+=(m\/2-1)\/2;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tcountInt+=n;\n\t\tif(m%2==1)\n\t\t{\n\t\t\tif(((m-1)\/2)%2==1)\n\t\t\t{\n\t\t\t\tcountInt+=n-max(1,(n-((m-1)\/2-1)\/2));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcountInt+=n-max(1,n-(m-1)\/4);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m\/2%2==1)\n\t\t\t{\n\t\t\t\tcountInt+=n-max(1,n-(m\/2-1)\/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcountInt+=n-max(1,n-m\/4);\n\t\t\t}\n\t\t\t\n\t\t}\t\n\t}\n\tfor(int b=1;b<=n;b++)\n\t{\n\t\tif(b*b<=m)\n\t\t{\n\t\t\tcountIr+=b*b-b;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint countk=b-ceil(sqrt(b*b-m));\n\t\t\tcountIr+=m-countk;\n\n\t\t}\n\t\t\n\t}\n\tcountIr*=2;\n\tcout< \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#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":48} {"difficulty":2700,"lang":"GNU C++","lang_cluster":"C++","src_uid":"ab410c6513a26ec3a41c63318dc38b78","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#include\n#include\n#include\n#include\n#include\n#include\n#include\n\nusing namespace std;\n\nconst double eps = 1e-8;\nconst int MaxN = 25, MaxSize = MaxN * MaxN;\n\nint N, M, SA, SB, tot;\nbool g[MaxN][MaxN];\nint deg[MaxN];\ndouble P[MaxN], ans[MaxSize];\n\nint lab(int a, int b) {\n return (a - 1) * N + (b - 1);\n}\n\nstruct Matrix {\n double a[MaxSize][MaxSize];\n void init() {\n for (int i = 0; i < tot; ++i)\n for (int j = 0; j <= tot; ++j) \n a[i][j] = 0;\n for (int i = 0; i < tot; ++i)\n a[i][i] = 1;\n a[lab(SA, SB)][tot] = 1;\n for (int i = 1; i <= N; ++i)\n for (int j = 1; j <= N; ++j) \n for (int ii = 1; ii <= N; ++ii)\n for (int jj = 1; jj <= N; ++jj) if (ii != jj && g[i][ii] && g[j][jj]) {\n double pi = (i == ii) * P[ii] + (i != ii) * (1 - P[ii]) \/ deg[ii];\n double pj = (j == jj) * P[jj] + (j != jj) * (1 - P[jj]) \/ deg[jj];\n int t1 = lab(i, j), t2 = lab(ii, jj);\n a[t1][t2] -= pi * pj;\n } \n } \n void elimiate() {\n int i, j, k, p;\n for (i = 0, j = 0; i < tot; ++i, ++j) {\n for (k = i; k < tot; ++k) if (fabs(a[k][j]) > eps) break;\n for (p = i; p <= tot; ++p) swap(a[i][p], a[k][p]);\n for (k = i + 1; k < tot; ++k) if (fabs(a[k][j]) > eps) {\n double t = a[k][j] \/ a[i][j];\n for (p = j; p <= tot; ++p) \n a[k][p] = a[k][p] - a[i][p] * t; \n }\n }\n } \n void solve() {\n for (int i = tot - 1; i >= 0; --i) {\n ans[i] = a[i][tot];\n for (int j = i + 1; j < tot; ++j)\n ans[i] -= ans[j] * a[i][j];\n ans[i] \/= a[i][i];\n }\n } \n}mat;\n\nint main() {\n\n scanf(\"%d%d%d%d\", &N, &M, &SA, &SB);\n tot = N * N;\n int x, y;\n memset(g, 0, sizeof(g));\n memset(deg, 0, sizeof(deg));\n for (int i = 1; i <= N; ++i) g[i][i] = true;\n for (int i = 0; i < M; ++i) {\n scanf(\"%d%d\", &x, &y);\n g[x][y] = g[y][x] = true;\n deg[x]++; deg[y]++;\n }\n for (int i = 1; i <= N; ++i) scanf(\"%lf\", P + i);\n mat.init();\n mat.elimiate();\n mat.solve();\n for (int i = 1; i < N; ++i) printf(\"%.8f \", ans[lab(i, i)]);\n printf(\"%.8f\\n\", ans[lab(N, N)]);\n\n return 0;\n\n}\n","description":"One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The museum has a specific shape: it consists of n rooms connected with m corridors so that one can access any room from any other one.After the two friends had a little walk around the museum, they decided to split and watch the pieces of art each of them found interesting. They agreed to meet in one of the rooms at six p.m. However, they forgot one quite essential thing: they didn't specify the place to meet and when the time came, they started to rush about the museum looking for each other (they couldn't call each other as roaming made a call's cost skyrocket).Yet, even despite the whole rush, they couldn't get enough of the pieces of art, that's why each of them has the following strategy: each minute he make a decision where to go \u2014 with probability pi he doesn't move to any other place during this minute (i.e. he stays in the room). With probability 1\u2009-\u2009pi he equiprobably choose one of the adjacent rooms and went there along the corridor. Here i is the ordinal number of the current room. Building was expensive in ancient times, that's why each corridor connected two different rooms, and any two rooms had no more than one corridor between them. The boys act simultaneously. As the corridors are dark, it is impossible to meet there; however, one can walk along the corridors in both directions (besides, the two boys can be going through the same corridor simultaneously without meeting). The boys act like that until they meet each other. More formally, the two friends meet when at some moment of time both of them decided to appear in the same room.For each room find the probability that the boys will meet there considering that at 6 p.m. they are positioned in rooms a and b correspondingly.","input_specification":"The first line contains four integers: n (1\u2009\u2264\u2009n\u2009\u2264\u200922), representing the numbers of rooms; m , representing the number of corridors; a,\u2009b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n), representing the numbers of Petya's and Vasya's starting rooms correspondingly. Next m lines contain pairs of numbers \u2014 the numbers of rooms connected by a corridor. Next n lines contain probabilities pi (0.01\u2009\u2264\u2009pi\u2009\u2264\u20090.99) with the accuracy of up to four digits after the decimal point \u2014 the probability to stay in room i. It is guaranteed that every room can be reached from every other room by corridors.","output_specification":"In the only line print n space-separated numbers, the i-th number should represent the probability that the friends meet in the i-th room with absolute or relative error of no more than 10\u2009-\u20096.","notes":"NoteIn the first sample the museum is symmetric. That means the probabilities to meet in rooms 1 and 2 are equal. And their sum equals to one. So, each probability equals 0.5.","sample_inputs":["2 1 1 2\n1 2\n0.5\n0.5","4 4 1 2\n1 2\n2 3\n3 4\n4 1\n0.5\n0.5\n0.5\n0.5"],"sample_outputs":["0.5000000000 0.5000000000","0.3333333333 0.3333333333 0.1666666667 0.1666666667"],"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 \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#pragma GCC optimize(\"Ofast\")\nusing namespace std;\n#define sync() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)\n#define fileIO() freopen(\"input.txt\", \"r\", stdin),freopen(\"output.txt\", \"w\", stdout)\n#define F first\n#define S second\n#define ers erase\n#define ins insert\n#define db pop_back\n#define pb push_back\n#define df pop_front\n#define pf push_front\n#define SZ(x) ((ll)x.size())\n#define sqr(x) (x)*(x)\n#define Blz(x) __builtin_clz(x)\n#define Brz(x) __builtin_ctz(x)\n#define Bones(x) __builtin_popcount(x)\n#define all(x) x.begin(),x.end()\n#define kill(x) return cout< plb;\ntypedef pair pll;\ntypedef string str;\ntypedef priority_queue maxheap;\ntypedef priority_queue,greater> minheap;\ntypedef priority_queue,greater> dEq;\nconst ll maxn=1e3+10, inf=2e9, mod=1e9+7; const ld pi=3.14159265359, eps=1e-9;\n\/\/\/**************************************\nll fac[maxn],inv[maxn];\nll mdc(ll n){\n while(n<0){n+=mod;}\n return n%mod;\n}\nll pwm(ll a,ll b){\n\tif(b==0){return 1;}\n\tif(b%2){return mdc(a*pwm(a,b-1));}\n\treturn pwm(mdc(a*a),b\/2);\n}\nll C(ll n,ll r){\n if(r>n){return 0;}\n\treturn mdc(mdc(fac[n]*inv[r])*inv[n-r]);\n}\n\/\/\/**************************************\nll n,m;\nbool is[maxn];\nll revc[maxn];\nld dp[maxn][maxn],pd[maxn][maxn];\nint main(){\n sync();\n \/\/\/**************************************\n\tfac[0]=inv[0]=1;\n\tfor(int i=1;i>n>>m;\n vector g[maxn];\n ll kl[maxn],po=0;\n ll k,jens=0;\n for(int i=1;i<=m;i++){\n cin>>k; jens+=k;\n for(int j=0;j>kl[po++]; g[i].pb(kl[po-1]); }\n }\n sort(kl,kl+jens,greater());\n ll h=kl[n-1]; \/\/dbg(h);\n\n ld fp=1; ll som=0,mos=0;\n for(int i=1;i<=m;i++){\n for(ll x:g[i]) is[i]|=(x==h), revc[i]+=(x>h);\n mos+=is[i];\n fp\/=C(SZ(g[i]),revc[i]);\n som+=revc[i];\n }\n for(int i=0;i<=m;i++) dp[i][0]=pd[i][0]=fp;\n for(int i=1;i<=m;i++)for(int j=1;j<=n;j++){\n dp[i][j]=dp[i-1][j];\n if(is[i]) dp[i][j]+=dp[i-1][j-1]*(revc[i]+1)\/(SZ(g[i])-revc[i]);\n tdbg(i,j,dp);\n }\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":50} {"difficulty":2600,"lang":"GNU C++14","lang_cluster":"C++","src_uid":"ba9c136f84375cd317f0f8b53e3939c7","execute_outcome":"WRONG_ANSWER","source_code":"#include\n\nusing namespace std;\nusing lint = long long int;\n\nconst int MAX_N = 2e5;\nconst int MAX_M = 3001;\nconst lint MOD = 998244353;\n\nlint dp1[MAX_M][MAX_M];\nlint dp2[MAX_M][MAX_M];\nint state[MAX_N];\nlint wi[MAX_N];\nlint SA, SB;\n\nlint pow(lint x, lint N) {\n\tlint ret = 1;\n\n\twhile (N) {\n\t\tif (N & 1) \n\t\t\t(ret *= x) %= MOD;\n\t\t(x *= x) %= MOD;\n\t\tN >>= 1;\n\t}\n\treturn ret;\n}\n\nlint inv(lint x) {\n\treturn pow(x, MOD-2);\n}\n\nlint solve1(int i, int j, int M) {\n\tif (dp1[i][j] != -1)\n\t\treturn dp1[i][j];\n\n\tlint &ret = dp1[i][j];\n\tret = 0;\n\n\n\tif (i+j == M)\n\t\treturn ret = 1;\n\t\n\tlint ri = SA + i, rj = SB - j;\n\t(ret += solve1(i+1, j, M) * (ri + 1) % MOD * inv(ri+rj) % MOD) %= MOD;\n\tif (SB-j-1 >= 0)\n\t\t(ret += solve1(i, j+1, M) * rj % MOD * inv(ri+rj) % MOD) %= MOD;\n\n\treturn ret;\n}\n\nlint solve2(int i, int j, int M) {\n\tif (dp2[i][j] != -1)\n\t\treturn dp2[i][j];\n\n\tlint &ret = dp2[i][j];\n\tret = 0;\n\n\tif (i+j == M)\n\t\treturn ret = 1;\n\n\tlint ri = SA + i, rj = SB - j;\n\t\n\tif (rj-1 >= 0) \n\t\t(ret += solve2(i, j+1, M) * (rj - 1) % MOD * inv(ri+rj) % MOD) %= MOD;\n\t(ret += solve2(i+1, j, M) * ri % MOD * inv(ri+rj) % MOD) %= MOD;\n\n\treturn ret;\n}\n\nint main(void) {\n\tios_base::sync_with_stdio(false), cin.tie(NULL);\n\tmemset(dp1, -1, sizeof dp1);\n\tmemset(dp2, -1, sizeof dp2);\n\n\tint N, M;\tcin >> N >> M;\n\n\tfor (int i = 0; i < N; i ++) \n\t\tcin >> state[i];\n\n\tfor (int i = 0; i < N; i ++) {\n\t\tcin >> wi[i];\n\n\t\t(state[i]?SA:SB) += wi[i];\n\t}\n\n\tfor (int i = 0; i < N; i ++) \n\t\tcout << (wi[i]*(state[i]?solve1(0, 0, M):solve2(0, 0, M)))%MOD << '\\n';\n}\n","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"],"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":51} {"difficulty":1600,"lang":"MS C++","lang_cluster":"C++","src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#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 i64;\n\nint main()\n{\n\tint n,tr,lie;\n\tcin >> n >> tr;\n\tlie=n-tr;\n\tint kolp=0,kolz=0;\n\tchar tmp,zn;\n\tint pip;\n\tvector< vector > zash(n);\n\tvector< vector > podozr(n);\n\tfor (int i=0;i saystrue(n,0);\n\tvector isbad(n,0);\n\tint bad=-1;\n\tbool waschange=true;\n\twhile (waschange)\n\t{\n\t\twaschange=false;\n\t\tif (kolz>tr)\n\t\t{\n\t\t\tfor (int i=0;itr || podozr[i].size()>lie)\n\t\t\t{\n\t\t\t\tbad=i;\n\t\t\t\tisbad[i]=1;\n\t\t\t\t\/*for (int j=0;jtr || zash[i].size()>lie)\n\t\t\t\t{\n\t\t\t\t\tisbad[i]=-1;\n\t\t\t\t\tfor (int j=0;j\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":52} {"difficulty":2400,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"c9274249c26b1a85c19ab70d91c1c3e0","execute_outcome":"WRONG_ANSWER","source_code":"#include\nusing namespace std;\n#define int long long\n#define f(i,j,k) for(register int i=j;i<=k;++i)\n#define g(i,j,k) for(register int i=j;i>=k;--i)\nint n,m,s,l;\ndouble f[606][303][2],g[606][303][2];\n\/\/f[j][k][t]\u00e8\u00a1\u00a8\u00e7\u00a4\u00bai\u00e6\u00ac\u00a1\u00e6\u0093\u008d\u00e4\u00bd\u009c\u00ef\u00bc\u008c\u00e6\u00b2\u00a1\u00e6\u009c\u0089\u00e9\u0080\u009a\u00e8\u00bf\u0087\u00e5\u008a\u00a0\u00e6\u00b3\u0095\u00e8\u00bf\u009b\u00e4\u00bd\u008d\u00e5\u0088\u00b0512\u00ef\u00bc\u008c\u00e6\u0095\u00b0\u00e5\u0080\u00bc\u00e6\u0098\u00afj\u00ef\u00bc\u008c\u00e4\u00b8\u0094\u00e5\u0090\u008e\u00e9\u009d\u00a2\u00e6\u009c\u0089k\u00e4\u00b8\u00aa\u00e8\u00bf\u009e\u00e7\u009d\u0080\u00e7\u009a\u0084t=0\/1\ninline int clac(int x){\n\tif(!x)return 0;\n\tint p=x&1,q=0;\n\tfor(;p==(x&1);x\/=2)++q;\n\treturn q;\n}\ninline int len(int x,int y=0){for(;x%2==0;x\/=2)++y;return y;}\nsigned main(){\n\tcin>>s>>n>>l;\n\tdouble p=0.01*l,q=0.01*(100-l);\n\tf[s&511][clac(s\/512)][s&512]=1;\n\tf(i,1,n){\n\t\tf(j,0,511)f(k,0,n+50)f(t,0,1){\n\t\t\tl=j*2;\n\t\t\tg[l&511][(t==(l&512))?k+1:1][(l>>9)&1]+=f[j][k][t]*p;\n\t\t\tl=j+1;\n\t\t\tif(l&512){\n\t\t\t\tif(t)g[l&511][k][0]+=f[j][k][t]*q;\n\t\t\t\telse g[l&511][1][1]+=f[j][k][t]*q;\n\t\t\t}else{\n\t\t\t\tg[l][k][t]+=f[j][k][t]*q;\n\t\t\t}\n\t\t}\n\t\tf(j,0,511)f(k,0,n+50)f(t,0,1)f[j][k][t]=g[j][k][t],g[j][k][t]=0;\n\t}\n\tdouble ans=0,x=0;\n\tf(j,0,511)f(k,0,n+50)f(t,0,1){\n\t\tx=j?len(j):((t?0:k)+9);\n\/\/\t\tif(f[j][k][t])cout<\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\n#define umap unordered_map\n#define uset unordered_set\n\n#define forn(i,n) for(int i=0;i<(int)n;i++)\n#define rforn(i,n) for(int i=(int)n;i>=0;i--)\n#define forin(i,x,y) for(ll i=x;i<=(ll)y;i++)\n#define fora(itr,ctr) for(auto itr=ctr.begin();itr!=ctr.end();itr++)\n\t\nusing namespace std;\nclock_t BT=clock();\nstringstream ss;\n\n#define ll long long\nconst ll MAX=1e5+1;\n\nbool solve (ll u1,ll u2,ll u3,ll v1,ll v2,ll v3) {\n\tu2-=u1,v2-=v1;\n\tll md=u3*u3+v3*v3;\n\tll u4=u3,v4=-v3;\n\t\n\tll x=u2*u4-v2*v4,y=u2*v4+v2*u4;\n\/\/\tcout<>u1>>v1>>u2>>v2>>u3>>v3;\n\tbool b=solve(u1,u2,u3,v1,v2,v3);\n\/\/\tcout<\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":54} {"difficulty":2600,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"cec0f6c267fa76191a3784b08e39acd6","execute_outcome":"WRONG_ANSWER","source_code":"#ifdef DEBUG\n#define _GLIBCXX_DEBUG\n#endif\n\/\/#pragma GCC optimize(\"O3\")\n#include \nusing namespace std;\ntypedef long double ld;\ntypedef long long ll;\nll n;\nint k;\nconst int maxN = 105;\nint a[maxN];\nconst int maxP = 6324554 + 100;\nll who[maxP];\nint cnt[maxP];\nint main() {\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n\/\/ freopen(\"input.txt\", \"r\", stdin);\n cin >> n;\n cin >> k;\n for (int i = 1; i <= k; i++) {\n cin >> a[i];\n if (a[i] == 1) {\n cout << 0;\n return 0;\n }\n }\n sort(a + 1, a + k + 1);\n reverse(a + 1, a + k + 1);\n ll l = 1;\n int sz = 0;\n while (l <= n) {\n who[++sz] = n \/ l;\n l = (n \/ (n \/ l)) + 1;\n }\n reverse(who + 1, who + sz + 1);\n assert(sz < maxP);\n cnt[sz] = 1;\n \/\/ -=\n for (int i = 1; i <= k; i++) {\n int ptr = 1;\n for (int j = 1; j <= sz; j++) {\n if (cnt[j] == 0) continue;\n if (who[j] < a[i]) continue;\n while (who[ptr + 1] * a[i] <= who[j]) ptr++;\n cnt[ptr] -= cnt[j];\n }\n }\n ll ans = 0;\n for (int i = 1; i <= sz; i++) {\n ans += who[i] * cnt[i];\n }\n cout << ans;\n return 0;\n}","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"],"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":55} {"difficulty":1600,"lang":"GNU C++17","lang_cluster":"C++","src_uid":"d37dde5841116352c9b37538631d0b15","execute_outcome":"COMPILATION_ERROR","source_code":"#include\r\nusing namespace std;\r\n\r\nint main(){\r\n int l, r, x, y; cin >> l >> r >> x >> y;\r\n int n = x * y;\r\n int ans = 0;\r\n set del;\r\n for (int i = 1; i < (int) sqrt(n) + 1; i++) { \r\n if (n % i == 0 and i * i != n) del.insert(i); del.insert(n \/ i);\r\n if (n % i == 0 and i * i == n) del.insert(i);\r\n }for (auto d : del) {\r\n if ( __gcd(d, n \/ d) == x and d * (n \/ d) \/ x == n and d >= l and d <= r and n \/ d >= l and n \/ d <= r) {\r\n ans++;\r\n }\r\n }cout << ans;\r\n}","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"],"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":56} {"difficulty":2400,"lang":"GNU C++","lang_cluster":"C++","src_uid":"ecda878d924325789dc05035e4f4bbe0","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n#include \n#include \n#include \n\n#define fii(x,y) for(int i=x;i VI;\ntypedef vector VVI;\ntypedef vector VVVI;\ntypedef vector VL;\ntypedef vector VVL;\ntypedef vector VD;\ntypedef vector VVD;\ntypedef vector VB;\ntypedef vector VVB;\ntypedef queue QI;\ntypedef pair PI;\ntypedef pair PT;\ntypedef queue QPI;\ntypedef priority_queue QPT;\ntypedef pair PD;\n\n\nint main()\n{\n int n;\n cin >> n;\n VL v (n);\n fi (n) cin >> v[i];\n sort(v.begin(),v.end());\n \n VL sum (n+1,0);\n fii (1,n+1) sum[i] = sum[i-1] + v[i-1];\n \n double ans = 0;\n int med = 0;\n int tam = 0;\n fi (n) \n {\n ll tmax = min(i, n-1-i);\n ll tmin = 0;\n while (tmax - tmin > 5)\n {\n ll v1 = (2 * tmin + tmax) \/ 3;\n ll v2 = (tmin + 2 * tmax) \/ 3;\n ll val1 = sum[i+1] - sum[i-v1] + sum[n] - sum[n-v1];\n ll val2 = sum[i+1] - sum[i-v2] + sum[n] - sum[n-v2];\n if (val1 > val2) tmax = v2;\n else tmin = v1;\n }\n fjj (tmin, tmax+1)\n {\n ll val = sum[i+1] - sum[i-j] + sum[n] - sum[n-j];\n double cand = double(val)\/double(2*j+1) - v[i];\n if (cand > ans)\n {\n ans = cand;\n med = i;\n tam = j;\n }\n }\n }\n cout << 2 * tam + 1 << endl;\n bool prim = true;\n fi(tam)\n {\n if (prim)\n prim = false;\n else\n cout << \" \";\n cout << v[med-tam+i];\n }\n \n if (prim)\n prim = false;\n else\n cout << \" \";\n cout << v[med];\n fi(tam)\n {\n cout << \" \" << v[n-tam+i];\n }\n cout << endl;\n}","description":"Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Find the non-empty subset (with repetition) with the maximum simple skewness.The mean of a collection is the average of its elements. The median of a collection is its middle element when all of its elements are sorted, or the average of its two middle elements if it has even size.","input_specification":"The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009200 000)\u00a0\u2014 the number of elements in the list. The second line contains n integers xi (0\u2009\u2264\u2009xi\u2009\u2264\u20091\u2009000\u2009000)\u00a0\u2014 the ith element of the list.","output_specification":"In the first line, print a single integer k\u00a0\u2014 the size of the subset. In the second line, print k integers\u00a0\u2014 the elements of the subset in any order. If there are multiple optimal subsets, print any.","notes":"NoteIn the first case, the optimal subset is , which has mean 5, median 2, and simple skewness of 5\u2009-\u20092\u2009=\u20093.In the second case, the optimal subset is . Note that repetition is allowed.In the last case, any subset has the same median and mean, so all have simple skewness of 0.","sample_inputs":["4\n1 2 3 12","4\n1 1 2 2","2\n1 2"],"sample_outputs":["3\n1 2 12","3\n1 1 2","2\n1 2"],"human_solution":"#include\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":57} {"difficulty":2500,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"f71d1ffcea72f5b72ead3c0bcfa323f2","execute_outcome":"WRONG_ANSWER","source_code":"#include\nusing namespace std;\n#define N 10\n\nint n,MAX;\nint a[N];\nstring command[N];\n\nstring ex(int id)\n{\n\tstring _=\"eax\";\n\t_[1]+=id;\n\treturn _;\n}\nbool dfs(int pos)\n{\n\tif(pos==MAX)\n\t{\n\t\tif(a[pos]!=n) return 0;\n\t\tcout<n) continue;\n\t\tcommand[pos]=\"lea \"+ex(pos+1)+\", [\"+(char)('0'+j)+\"*\"+ex(i)+\"]\";\n\t\tif(dfs(pos+1)) return 1;\n\t}\n\tfor(int i=0;i<=pos;i++)\n\tfor(int j=0;j<=pos;j++)\n\tfor(int k=1;k<=8;k<<=1)\n\t{\n\t\ta[pos+1]=a[i]+a[j]*k;\n\t\tif(a[pos+1]>n) continue;\n\t\tcommand[pos]=\"lea \"+ex(pos+1)+\", [\"+ex(i)+\" + \"+(char)('0'+k)+\"*\"+ex(j)+\"]\";\n\t\tif(dfs(pos+1)) return 1;\n\t}\n} \n\nint main()\n{\n\tios_base::sync_with_stdio(0);\n\t\n\tcin>>n;\n\ta[0]=1;\n\twhile(!dfs(0)) MAX++;\n\t\n\treturn 0;\n}","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]"],"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":58} {"difficulty":1600,"lang":"GNU C++11","lang_cluster":"C++","src_uid":"fbfc333ad4b0a750f654a00be84aea67","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nlong long bfs(int tren, vector> adj,int n){\n vector distancia(n,0);\n vector visitado(n,0);\n queue cola;\n cola.push(0);\n while(!cola.empty()){\n int v=cola.front();\n visitado[v]=1;\n cola.pop();\n if(v==n-1){\n return distancia[n-1];\n }\n for(int i=0;i> adj (n,vector(n,0));\n\tfor(long long i=0;ir2){\n\t resp=r1;\n\t }\n\t else{\n\t resp=r2;\n\t }\n\t}\n\tcout<\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]\r\nusing namespace std;\r\n#define endl '\\n'\r\n#define ll long long\r\nint main(){\r\n\tios::sync_with_stdio(0); cin.tie(0);\r\n\tint n;\r\n\tcin>>n;\r\n\tll cnt[15];\r\n\tmemset(cnt, 0, sizeof(cnt));\r\n\tfor(int i=1; i<=n; i++){\r\n\t\tcnt[i%9]++;\r\n\t}\r\n\tll sum = 0;\r\n\tfor(int i=1; i<=9; i++){\r\n\t\tfor(int j=1; j<=9; j++){\r\n\t\t\tsum += cnt[i]*cnt[j]*cnt[(i*j)%9];\r\n\t\t}\r\n\t}\r\n\tfor(int i=1; i<=n; i++){\r\n\t\tsum -= n\/i;\r\n\t}\r\n\tcout<\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< s = new HashSet();\n\n static void solve(){\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt(), k=sc.nextInt(),NOC=sc.nextInt(),i=0,no=0;\n while (NOC-->0) s.add(sc.nextInt());\n while (++i<=n) if (s.contains(i)||i%k==0) no++;\n System.out.println(no);\n sc.close();\n }\n\n public static void main(String args[]) {\n solve();\n }\n\n} \n","description":"The Hedgehog likes to give presents to his friend, but no less he likes to receive them.Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf in the cupboard. He will have to choose another shelf, but which one should he choose, how large should it be?In order to get to know this, the Hedgehog asks you to write him a program that will count the estimated number of presents that he will receive during the following N days. Besides, he is guided by the principle: on each holiday day the Hedgehog will necessarily receive a present, he receives presents at least every K days (i.e., if he received a present on the i-th day, he will receive the next present no later than on the i\u2009+\u2009K-th day). For the given N and K, as well as the list of holidays among the following N days count the minimal number of presents that could be given to the Hedgehog. The number of today's day is zero, and you should regard today's present as already given (i.e., you shouldn't count it in the answer).","input_specification":"The first line contains integers N and K (1\u2009\u2264\u2009N\u2009\u2264\u2009365, 1\u2009\u2264\u2009K\u2009\u2264\u2009N). The second line contains a number C which represents the number of holidays (0\u2009\u2264\u2009C\u2009\u2264\u2009N). Then in the same line follow C numbers ranging from 1 to N which are the numbers of holiday days. The numbers are given in the increasing order, without repeating numbers among them.","output_specification":"Print a single number \u2014 the minimal number of presents the Hedgehog will receive over the following N days.","notes":null,"sample_inputs":["5 2\n1 3","10 1\n3 6 7 8"],"sample_outputs":["3","10"],"human_solution":"import java.util.*;\n\/\/warm-up\npublic class Presents {\n \n static Set s = new HashSet();\n\n static void solve(){\n Scanner sc = new Scanner(System.in);\n int n=sc.nextInt(), k=sc.nextInt(),NOC=sc.nextInt(),i=0,no=0,gap=1;\n while (NOC-->0) s.add(sc.nextInt());\n while (++i<=n) {\n if (s.contains(i)||gap==k) { no++; gap=0; }\n gap++;\n }\n System.out.println(no);\n sc.close();\n }\n\n public static void main(String args[]) {\n solve();\n }\n\n} \n","testcases":"[{'input': '5 2\\r\\n1 3\\r\\n', 'output': ['3']}, {'input': '10 1\\r\\n3 6 7 8\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n1 3\\r\\n', 'output': ['1']}, {'input': '10 3\\r\\n3 3 6 9\\r\\n', 'output': ['3']}, {'input': '5 2\\r\\n0\\r\\n', 'output': ['2']}, {'input': '1 1\\r\\n0\\r\\n', 'output': ['1']}, {'input': '5 1\\r\\n0\\r\\n', 'output': ['5']}, {'input': '5 1\\r\\n1 2\\r\\n', 'output': ['5']}, {'input': '5 2\\r\\n0\\r\\n', 'output': ['2']}, {'input': '10 3\\r\\n2 4 8\\r\\n', 'output': ['4']}, {'input': '10 1\\r\\n0\\r\\n', 'output': ['10']}, {'input': '10 2\\r\\n1 5\\r\\n', 'output': ['5']}, {'input': '10 1\\r\\n0\\r\\n', 'output': ['10']}, {'input': '10 1\\r\\n0\\r\\n', 'output': ['10']}, {'input': '15 5\\r\\n0\\r\\n', 'output': ['3']}, {'input': '15 1\\r\\n1 3\\r\\n', 'output': ['15']}, {'input': '15 2\\r\\n1 10\\r\\n', 'output': ['7']}, {'input': '15 1\\r\\n0\\r\\n', 'output': ['15']}, {'input': '15 3\\r\\n1 11\\r\\n', 'output': ['5']}, {'input': '20 1\\r\\n3 7 9 20\\r\\n', 'output': ['20']}, {'input': '20 3\\r\\n1 11\\r\\n', 'output': ['7']}, {'input': '20 2\\r\\n6 6 9 10 15 19 20\\r\\n', 'output': ['12']}, {'input': '20 1\\r\\n0\\r\\n', 'output': ['20']}, {'input': '20 1\\r\\n1 13\\r\\n', 'output': ['20']}, {'input': '25 1\\r\\n9 2 6 8 10 14 15 17 18 23\\r\\n', 'output': ['25']}, {'input': '25 1\\r\\n0\\r\\n', 'output': ['25']}, {'input': '25 1\\r\\n4 8 10 13 24\\r\\n', 'output': ['25']}, {'input': '25 1\\r\\n1 14\\r\\n', 'output': ['25']}, {'input': '25 1\\r\\n0\\r\\n', 'output': ['25']}, {'input': '100 3\\r\\n0\\r\\n', 'output': ['33']}, {'input': '100 10\\r\\n0\\r\\n', 'output': ['10']}, {'input': '100 23\\r\\n22 2 9 18 22 23 30 44 50 55 58 61 70 71 73 76 79 82 85 88 94 95 99\\r\\n', 'output': ['22']}, {'input': '100 5\\r\\n10 2 17 21 34 52 58 60 64 68 95\\r\\n', 'output': ['24']}, {'input': '100 4\\r\\n2 29 63\\r\\n', 'output': ['26']}, {'input': '150 16\\r\\n9 19 31 47 53 57 96 105 108 120\\r\\n', 'output': ['13']}, {'input': '150 52\\r\\n5 11 37 60 67 86\\r\\n', 'output': ['6']}, {'input': '150 4\\r\\n7 21 54 106 108 109 119 123\\r\\n', 'output': ['40']}, {'input': '150 3\\r\\n0\\r\\n', 'output': ['50']}, {'input': '150 21\\r\\n21 22 26 30 36 39 52 59 62 66 68 78 86 92 96 103 108 113 118 119 125 139\\r\\n', 'output': ['22']}, {'input': '300 15\\r\\n14 3 38 52 57 142 157 175 201 209 238 258 288 294 299\\r\\n', 'output': ['26']}, {'input': '300 2\\r\\n14 29 94 122 123 158 160 164 191 200 202 208 246 272 286\\r\\n', 'output': ['153']}, {'input': '300 5\\r\\n16 22 38 72 78 108 116 140 147 160 189 209 214 227 252 294 300\\r\\n', 'output': ['66']}, {'input': '300 8\\r\\n4 27 76 155 260\\r\\n', 'output': ['40']}, {'input': '300 24\\r\\n20 18 76 80 81 85 103 110 112 129 145 151 172 180 184 201 205 241 257 268 276\\r\\n', 'output': ['24']}, {'input': '350 22\\r\\n11 38 111 115 176 194 204 207 231 274 307 348\\r\\n', 'output': ['21']}, {'input': '350 22\\r\\n73 1 4 8 10 14 16 19 28 37 41 42 43 55 56 64 66 67 79 80 84 87 96 99 101 103 119 120 121 122 127 128 135 141 142 143 148 156 159 160 161 166 167 169 173 189 201 202 205 219 223 227 233 242 243 244 250 257 260 262 263 264 273 291 301 302 305 306 307 314 326 336 342 345\\r\\n', 'output': ['73']}, {'input': '350 26\\r\\n10 13 16 81 99 144 191 223 258 316 329\\r\\n', 'output': ['18']}, {'input': '350 16\\r\\n12 31 76 103 116 191 201 241 256 260 291 306 336\\r\\n', 'output': ['24']}, {'input': '350 28\\r\\n5 23 104 135 305 331\\r\\n', 'output': ['14']}, {'input': '365 34\\r\\n6 80 94 208 256 325 349\\r\\n', 'output': ['14']}, {'input': '365 19\\r\\n7 47 114 139 210 226 266 279\\r\\n', 'output': ['22']}, {'input': '365 8\\r\\n32 1 13 22 25 33 72 80 86 96 117 132 145 146 156 176 177 179 188 198 203 218 225 235 253 256 267 279 286 294 303 333 363\\r\\n', 'output': ['61']}, {'input': '365 8\\r\\n55 3 12 26 28 36 45 47 59 61 65 82 90 103 109 114 117 121 123 126 134 142 144 146 151 154 168 175 189 193 195 197 199 210 212 214 230 232 241 248 254 267 271 291 304 306 308 311 315 317 318 334 335 346 354 365\\r\\n', 'output': ['74']}, {'input': '365 2\\r\\n2 96 241\\r\\n', 'output': ['183']}, {'input': '365 42\\r\\n10 8 66 77 148 161 183 231 301 340 350\\r\\n', 'output': ['14']}, {'input': '365 40\\r\\n30 1 14 21 31 32 36 56 59 68 96 119 131 137 166 179 181 202 235 248 272 294 309 315 322 327 334 341 347 362 365\\r\\n', 'output': ['30']}, {'input': '365 31\\r\\n19 13 18 27 33 46 58 86 114 178 187 198 228 233 240 255 277 332 348 351\\r\\n', 'output': ['22']}, {'input': '365 54\\r\\n21 28 42 56 65 66 67 76 81 85 89 123 132 136 153 195 215 249 294 296 300 355\\r\\n', 'output': ['22']}, {'input': '365 5\\r\\n5 10 31 121 235 322\\r\\n', 'output': ['74']}, {'input': '365 81\\r\\n2 1 75\\r\\n', 'output': ['5']}, {'input': '365 21\\r\\n4 1 17 344 345\\r\\n', 'output': ['19']}, {'input': '11 2\\r\\n5 3 6 7 9 10\\r\\n', 'output': ['7']}, {'input': '5 3\\r\\n2 2 4\\r\\n', 'output': ['2']}, {'input': '362 360\\r\\n0\\r\\n', 'output': ['1']}, {'input': '18 4\\r\\n4 1 9 10 18\\r\\n', 'output': ['6']}]","id":61} {"difficulty":1200,"lang":"Java 8","lang_cluster":"Java","src_uid":"1771741663a5236a0aa0551548f4aadd","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport static java.lang.Integer.parseInt;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.PriorityQueue;\nimport java.util.StringTokenizer;\nimport jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;\n\npublic class B_Land_Lot {\n\n static int a, b, n, m;\n static int[][] grad;\n static ArrayList p = new ArrayList();\n\n public static void main(String[] args) throws IOException {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tok = new StringTokenizer(reader.readLine());\n n = Integer.parseInt(tok.nextToken());\n m = parseInt(tok.nextToken());\n grad = new int[n+1][m+1];\n \n for (int i = 1; i <= n; i++) {\n tok = new StringTokenizer(reader.readLine());\n for (int l = 1; l <= m; l++) {\n grad[i][l] = parseInt(tok.nextToken()) + grad[i-1][l] + grad[i][l-1] - grad[i-1][l-1];\n }\n }\n \n tok = new StringTokenizer(reader.readLine());\n a = parseInt(tok.nextToken());\n b = parseInt(tok.nextToken());\n int min = Integer.MAX_VALUE , value ;\n \n \n for (int i = a+1; i <= n; i++) {\n for (int j = b+1; j <= m; j++) {\n value = grad[i][j] - grad[i-a][j] - grad[i][j-b] + grad[i-a][j-b];\n if(value < min ){min = value;} \n }\n }\n for (int i = b; i <= n; i++) {\n for (int j = a; j <= m; j++) {\n value = grad[i][j] - grad[i-b][j] - grad[i][j-a] + grad[i-b][j-a];\n if(value < min ){min = value;}\n }\n }\n System.out.println(min);\n }\n}\n\n\/*\n\n\n4 5\n0 0 1 0 1\n0 1 1 1 0\n1 0 1 0 1\n1 1 1 1 1\n2 3\n\n\n3 2\n1 1\n1 1\n1 0\n2 1\n\n\n *\/\n","description":"Vasya has a beautiful garden where wonderful fruit trees grow and yield fantastic harvest every year. But lately thieves started to sneak into the garden at nights and steal the fruit too often. Vasya can\u2019t spend the nights in the garden and guard the fruit because there\u2019s no house in the garden! Vasya had been saving in for some time and finally he decided to build the house. The rest is simple: he should choose in which part of the garden to build the house. In the evening he sat at his table and drew the garden\u2019s plan. On the plan the garden is represented as a rectangular checkered field n\u2009\u00d7\u2009m in size divided into squares whose side length is 1. In some squares Vasya marked the trees growing there (one shouldn\u2019t plant the trees too close to each other that\u2019s why one square contains no more than one tree). Vasya wants to find a rectangular land lot a\u2009\u00d7\u2009b squares in size to build a house on, at that the land lot border should go along the lines of the grid that separates the squares. All the trees that grow on the building lot will have to be chopped off. Vasya loves his garden very much, so help him choose the building land lot location so that the number of chopped trees would be as little as possible.","input_specification":"The first line contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u200950) which represent the garden location. The next n lines contain m numbers 0 or 1, which describe the garden on the scheme. The zero means that a tree doesn\u2019t grow on this square and the 1 means that there is a growing tree. The last line contains two integers a and b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u200950). Note that Vasya can choose for building an a\u2009\u00d7\u2009b rectangle as well a b\u2009\u00d7\u2009a one, i.e. the side of the lot with the length of a can be located as parallel to the garden side with the length of n, as well as parallel to the garden side with the length of m.","output_specification":"Print the minimum number of trees that needs to be chopped off to select a land lot a\u2009\u00d7\u2009b in size to build a house on. It is guaranteed that at least one lot location can always be found, i. e. either a\u2009\u2264\u2009n and b\u2009\u2264\u2009m, or a\u2009\u2264\u2009m \u0438 b\u2009\u2264\u2009n.","notes":"NoteIn the second example the upper left square is (1,1) and the lower right is (3,2).","sample_inputs":["2 2\n1 0\n1 1\n1 1","4 5\n0 0 1 0 1\n0 1 1 1 0\n1 0 1 0 1\n1 1 1 1 1\n2 3"],"sample_outputs":["0","2"],"human_solution":"import java.io.*;\nimport java.util.*;\npublic class Main{\n public static void main (String []args)throws IOException{\n BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bww = new BufferedWriter(new OutputStreamWriter(System.out));\n PrintWriter printw = new PrintWriter(bww);\n String entrada = sc.readLine();\n String [] split = entrada.split(\" \");\n int n = Integer.parseInt(split[0]);\n int m = Integer.parseInt(split[1]);\n int matriz [][] = new int [n][m];\n for(int i = 0; i < n; i++){\n String in = sc.readLine();\n StringTokenizer stk = new StringTokenizer(in);\n int j= 0;\n while(stk.hasMoreTokens()){\n matriz [i][j] = Integer.parseInt(stk.nextToken());\n j++;\n }\n }\n String entrada2 = sc.readLine();\n String [] split2 = entrada2.split(\" \");\n \n int a = Integer.parseInt(split2[0]);\n int b = Integer.parseInt(split2[1]);\n int min1 = getMin(matriz,n,m,a,b);\n int min2 = getMin(matriz,n,m,b,a);\n int res = Math.min(min1,min2);\n System.out.println(res);\n }\n \n static int getMin(int [][] matriz, int filas, int columnas,int a, int b){\n int res = 10000000;\n int num = 0;\n for(int i = 0; i< filas - a +1; i++){\n for(int j = 0; j< columnas-b+1 ; j++){\n \n for(int k = i; k al=new ArrayList<>();\n\t\tfor(int i=0;i= prizes[0].first){\n int j = 0;\n while(j < 5 && p >= prizes[j].first){j++;}\n j--;\n while(j >= 0 && p >= prizes[j].first){\n int c = (int) p \/ prizes[j].first;\n counts[prizes[j].second] += c;\n p -= c * prizes[j].first;\n j--;\n }\n }\n }\n if(p >= prizes[0].first){\n int j = 0;\n while(j < 5 && p >= prizes[j].first){j++;}\n j--;\n while(j >= 0 && p >= prizes[j].first){\n int c = (int) p \/ prizes[j].first;\n counts[prizes[j].second] += c;\n p -= c * prizes[j].first;\n j--;\n }\n }\n for(int k = 0; k < counts.length; k++){\n out.print(counts[k] + \" \");\n }\n out.println();\n out.print(p);\n }\n}\n\nclass InputReader {\n\n\tprivate InputStream stream;\n\tprivate byte[] buf = new byte[1024];\n\tprivate int curChar;\n\tprivate int numChars;\n\tprivate SpaceCharFilter filter;\n\n\tpublic InputReader(InputStream stream) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic int read() {\n\t\tif (numChars == -1)\n\t\t\tthrow new InputMismatchException();\n\t\tif (curChar >= numChars) {\n\t\t\tcurChar = 0;\n\t\t\ttry {\n\t\t\t\tnumChars = stream.read(buf);\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new InputMismatchException();\n\t\t\t}\n\t\t\tif (numChars <= 0)\n\t\t\t\treturn -1;\n\t\t}\n\t\treturn buf[curChar++];\n\t}\n\n\tpublic int readInt() {\n\t\tint c = read();\n\t\twhile (isSpaceChar(c))\n\t\t\tc = read();\n\t\tint sgn = 1;\n\t\tif (c == '-') {\n\t\t\tsgn = -1;\n\t\t\tc = read();\n\t\t}\n\t\tint res = 0;\n\t\tdo {\n\t\t\tif (c < '0' || c > '9')\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tres *= 10;\n\t\t\tres += c - '0';\n\t\t\tc = read();\n\t\t} while (!isSpaceChar(c));\n\t\treturn res * sgn;\n\t}\n\n\tpublic boolean isSpaceChar(int c) {\n\t\tif (filter != null)\n\t\t\treturn filter.isSpaceChar(c);\n\t\treturn isWhitespace(c);\n\t}\n\n\tpublic static boolean isWhitespace(int c) {\n\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t}\n\n\tpublic interface SpaceCharFilter {\n\t\tpublic boolean isSpaceChar(int ch);\n\t}\n}\n\nclass IOUtils {\n\n\tpublic static int[] readIntArray(InputReader in, int size) {\n\t\tint[] array = new int[size];\n\t\tfor (int i = 0; i < size; i++)\n\t\t\tarray[i] = in.readInt();\n\t\treturn array;\n\t}\n\n}\n\nclass IntPair implements Comparable {\n\tpublic final int first, second;\n\n\tpublic IntPair(int first, int second) {\n\t\tthis.first = first;\n\t\tthis.second = second;\n\t}\n\n\tpublic String toString() {\n\t\treturn \"(\" + first + \",\" + second + \")\";\n\t}\n\n\tpublic boolean equals(Object o) {\n\t\tif (this == o) return true;\n\t\tif (o == null || getClass() != o.getClass()) return false;\n\n\t\tIntPair intPair = (IntPair) o;\n\n\t\treturn first == intPair.first && second == intPair.second;\n\n\t}\n\n\tpublic int hashCode() {\n\t\tint result = first;\n\t\tresult = 31 * result + second;\n\t\treturn result;\n\t}\n\n\tpublic int compareTo(IntPair o) {\n\t\tif (first < o.first)\n\t\t\treturn -1;\n\t\tif (first > o.first)\n\t\t\treturn 1;\n\t\tif (second < o.second)\n\t\t\treturn -1;\n\t\tif (second > o.second)\n\t\t\treturn 1;\n\t\treturn 0;\n\t}\n}\n\n","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"],"human_solution":"import java.util.*;\n \nimport java.io.*;\n \npublic class Solution {\n \n \/\/ static long mod = 998244353;\n \n static long solve(long[] arr, long val, long total, long res[]) {\n for (int i = 4; i >=0; i--) {\n long p = total \/ arr[i];\n res[i] += p;\n total -= p * arr[i];\n }\n return total;\n } \n \n public static void main(String[] ks) throws Exception {\n \n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n \n String s[] = bf.readLine().trim().split(\"\\\\s+\");\n int n = Integer.parseInt(s[0]);\n s = bf.readLine().trim().split(\"\\\\s+\");\n long a[] = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = Long.parseLong(s[i]);\n \n s = bf.readLine().trim().split(\"\\\\s+\");\n long b[] = new long[5];\n for (int i = 0; i < 5; i++)\n b[i] = Long.parseLong(s[i]);\n \n long res[] = new long[5];\n Arrays.fill(res, 0);\n long total = 0;\n for (int i = 0; i < n; i++) {\n total += a[i];\n total = solve(b, a[i], total, res);\n }\n for (int i = 0; i < 5; i++)\n System.out.print(res[i] + \" \");\n \n System.out.println(\"\\n\" + total);\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":64} {"difficulty":1300,"lang":"Java 8","lang_cluster":"Java","src_uid":"30c4f155336cf762699a1bbc55a60d27","execute_outcome":"COMPILATION_ERROR","source_code":"import java.util.Scanner;\npublic class Ishu\n{\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n int n,m,i,j,sum;\n boolean flag=true; \n int[][] a=new int[100][2];\n n=scan.nextInt();\n m=scan.nextInt();\n for(i=0;i=a[j][0]&&i<=a[j][1])\n ++sum;\n if(!(sum==1))\n {\n flag=false;\n break; \n }\n }\n if(flag)\n System.out.println(\"OK\");\n else\n System.out.println(i+\" \"+sum); \n }\n}","description":"School holidays come in Berland. The holidays are going to continue for n days. The students of school \u2116N are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the BSE (Berland State Examination) results, has finally taken a vacation break! Some people are in charge of the daily watering of flowers in shifts according to the schedule. However when Marina Sergeyevna was making the schedule, she was so tired from work and so lost in dreams of the oncoming vacation that she perhaps made several mistakes. In fact, it is possible that according to the schedule, on some days during the holidays the flowers will not be watered or will be watered multiple times. Help Marina Sergeyevna to find a mistake.","input_specification":"The first input line contains two numbers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100) \u2014 the number of days in Berland holidays and the number of people in charge of the watering respectively. The next m lines contain the description of the duty schedule. Each line contains two integers ai and bi (1\u2009\u2264\u2009ai\u2009\u2264\u2009bi\u2009\u2264\u2009n), meaning that the i-th person in charge should water the flowers from the ai-th to the bi-th day inclusively, once a day. The duty shifts are described sequentially, i.e. bi\u2009\u2264\u2009ai\u2009+\u20091 for all i from 1 to n\u2009-\u20091 inclusively. ","output_specification":"Print \"OK\" (without quotes), if the schedule does not contain mistakes. Otherwise you have to find the minimal number of a day when the flowers will not be watered or will be watered multiple times, and output two integers \u2014 the day number and the number of times the flowers will be watered that day.","notes":"NoteKeep in mind that in the second sample the mistake occurs not only on the second day, but also on the sixth day, when nobody waters the flowers. However, you have to print the second day, i.e. the day with the minimal number.","sample_inputs":["10 5\n1 2\n3 3\n4 6\n7 7\n8 10","10 5\n1 2\n2 3\n4 5\n7 8\n9 10","10 5\n1 2\n3 3\n5 7\n7 7\n7 10"],"sample_outputs":["OK","2 2","4 0"],"human_solution":"\/\/package test;\n\nimport java.util.*;\n\npublic class solution {\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner s = new Scanner(System.in);\n\t\t\n\t\tint n = s.nextInt();\n\t\tint m = s.nextInt();\n\t\tint[] ans = new int[n+1];\n\t\t\n\t\tfor(int i=0;i1 || ans[u]==0)\n\t\t\t{\n\t\t\t\tSystem.out.println(u+ \" \"+ans[u]);\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(flag==0)\n\t\t{\n\t\t\tSystem.out.println(\"OK\");\n\t\t}\n\t}\n}\n","testcases":"[{'input': '10 5\\r\\n1 2\\r\\n3 3\\r\\n4 6\\r\\n7 7\\r\\n8 10\\r\\n', 'output': ['OK\\r\\n']}, {'input': '10 5\\r\\n1 2\\r\\n2 3\\r\\n4 5\\r\\n7 8\\r\\n9 10\\r\\n', 'output': ['2 2\\r\\n']}, {'input': '10 5\\r\\n1 2\\r\\n3 3\\r\\n5 7\\r\\n7 7\\r\\n7 10\\r\\n', 'output': ['4 0\\r\\n']}, {'input': '5 4\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 5\\r\\n', 'output': ['OK\\r\\n']}, {'input': '100 50\\r\\n1 2\\r\\n3 3\\r\\n4 5\\r\\n6 8\\r\\n9 10\\r\\n11 11\\r\\n12 14\\r\\n15 15\\r\\n16 16\\r\\n17 17\\r\\n18 18\\r\\n19 19\\r\\n20 21\\r\\n22 23\\r\\n24 24\\r\\n25 26\\r\\n27 30\\r\\n31 34\\r\\n35 37\\r\\n38 38\\r\\n39 40\\r\\n41 43\\r\\n44 46\\r\\n47 53\\r\\n54 54\\r\\n55 55\\r\\n56 59\\r\\n60 60\\r\\n61 61\\r\\n62 64\\r\\n65 69\\r\\n70 72\\r\\n73 73\\r\\n74 74\\r\\n75 76\\r\\n77 79\\r\\n80 82\\r\\n83 83\\r\\n84 84\\r\\n85 85\\r\\n86 86\\r\\n87 88\\r\\n89 89\\r\\n90 90\\r\\n91 91\\r\\n92 92\\r\\n93 93\\r\\n94 97\\r\\n98 98\\r\\n99 100\\r\\n', 'output': ['OK\\r\\n']}, {'input': '50 50\\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\\n16 16\\r\\n17 17\\r\\n18 18\\r\\n19 19\\r\\n20 20\\r\\n21 21\\r\\n22 22\\r\\n23 23\\r\\n24 24\\r\\n25 25\\r\\n26 26\\r\\n27 27\\r\\n28 28\\r\\n29 29\\r\\n30 30\\r\\n31 31\\r\\n32 32\\r\\n33 33\\r\\n34 34\\r\\n35 35\\r\\n36 36\\r\\n37 37\\r\\n38 38\\r\\n39 39\\r\\n40 40\\r\\n41 41\\r\\n42 42\\r\\n43 43\\r\\n44 44\\r\\n45 45\\r\\n46 46\\r\\n47 47\\r\\n48 48\\r\\n49 49\\r\\n50 50\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5 1\\r\\n1 5\\r\\n', 'output': ['OK\\r\\n']}, {'input': '6 2\\r\\n1 5\\r\\n6 6\\r\\n', 'output': ['OK\\r\\n']}, {'input': '7 5\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n5 7\\r\\n', 'output': ['OK\\r\\n']}, {'input': '10 2\\r\\n1 2\\r\\n3 10\\r\\n', 'output': ['OK\\r\\n']}, {'input': '21 15\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 5\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n9 9\\r\\n10 11\\r\\n12 12\\r\\n13 13\\r\\n14 14\\r\\n15 17\\r\\n18 19\\r\\n20 21\\r\\n', 'output': ['OK\\r\\n']}, {'input': '100 7\\r\\n1 8\\r\\n9 26\\r\\n27 28\\r\\n29 30\\r\\n31 38\\r\\n39 95\\r\\n96 100\\r\\n', 'output': ['OK\\r\\n']}, {'input': '100 13\\r\\n1 4\\r\\n5 11\\r\\n12 18\\r\\n19 24\\r\\n25 31\\r\\n32 38\\r\\n39 39\\r\\n40 45\\r\\n46 55\\r\\n56 69\\r\\n70 70\\r\\n71 75\\r\\n76 100\\r\\n', 'output': ['OK\\r\\n']}, {'input': '100 50\\r\\n1 8\\r\\n9 12\\r\\n13 19\\r\\n20 22\\r\\n23 27\\r\\n28 31\\r\\n32 36\\r\\n36 40\\r\\n40 43\\r\\n47 47\\r\\n48 51\\r\\n51 55\\r\\n62 63\\r\\n69 77\\r\\n77 84\\r\\n85 90\\r\\n98 99\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n100 100\\r\\n', 'output': ['36 2\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n', 'output': ['OK\\r\\n']}, {'input': '10 1\\r\\n2 3\\r\\n', 'output': ['1 0\\r\\n']}, {'input': '10 9\\r\\n1 1\\r\\n2 2\\r\\n3 4\\r\\n6 6\\r\\n8 8\\r\\n8 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n', 'output': ['5 0\\r\\n']}, {'input': '27 10\\r\\n1 1\\r\\n2 3\\r\\n4 5\\r\\n6 7\\r\\n8 9\\r\\n10 11\\r\\n12 13\\r\\n14 15\\r\\n16 17\\r\\n17 18\\r\\n', 'output': ['17 2\\r\\n']}, {'input': '67 15\\r\\n1 6\\r\\n7 14\\r\\n15 16\\r\\n17 23\\r\\n24 30\\r\\n31 34\\r\\n35 41\\r\\n42 48\\r\\n48 56\\r\\n56 62\\r\\n66 67\\r\\n67 67\\r\\n67 67\\r\\n67 67\\r\\n67 67\\r\\n', 'output': ['48 2\\r\\n']}, {'input': '68 13\\r\\n1 2\\r\\n3 11\\r\\n12 21\\r\\n22 30\\r\\n31 38\\r\\n39 43\\r\\n44 44\\r\\n45 46\\r\\n47 50\\r\\n51 55\\r\\n64 68\\r\\n68 68\\r\\n68 68\\r\\n', 'output': ['56 0\\r\\n']}, {'input': '47 45\\r\\n1 3\\r\\n4 7\\r\\n8 11\\r\\n12 15\\r\\n16 18\\r\\n19 23\\r\\n24 26\\r\\n27 28\\r\\n29 31\\r\\n32 33\\r\\n34 37\\r\\n37 40\\r\\n45 45\\r\\n46 46\\r\\n46 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n47 47\\r\\n', 'output': ['37 2\\r\\n']}, {'input': '5 2\\r\\n1 1\\r\\n3 3\\r\\n', 'output': ['2 0\\r\\n']}, {'input': '5 3\\r\\n1 2\\r\\n3 3\\r\\n3 5\\r\\n', 'output': ['3 2\\r\\n']}, {'input': '5 4\\r\\n1 2\\r\\n3 4\\r\\n5 5\\r\\n5 5\\r\\n', 'output': ['5 2\\r\\n']}, {'input': '10 5\\r\\n2 5\\r\\n5 6\\r\\n7 9\\r\\n9 9\\r\\n9 10\\r\\n', 'output': ['1 0\\r\\n']}, {'input': '20 6\\r\\n1 1\\r\\n1 1\\r\\n1 3\\r\\n5 7\\r\\n7 13\\r\\n14 20\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '20 7\\r\\n1 3\\r\\n4 8\\r\\n8 8\\r\\n8 8\\r\\n8 9\\r\\n15 20\\r\\n20 20\\r\\n', 'output': ['8 4\\r\\n']}, {'input': '20 7\\r\\n1 5\\r\\n6 8\\r\\n10 10\\r\\n12 15\\r\\n15 16\\r\\n16 16\\r\\n16 20\\r\\n', 'output': ['9 0\\r\\n']}, {'input': '20 13\\r\\n1 2\\r\\n3 4\\r\\n5 7\\r\\n7 7\\r\\n7 7\\r\\n7 9\\r\\n10 11\\r\\n11 11\\r\\n11 12\\r\\n12 12\\r\\n12 13\\r\\n15 18\\r\\n19 20\\r\\n', 'output': ['7 4\\r\\n']}, {'input': '20 7\\r\\n1 3\\r\\n4 5\\r\\n6 6\\r\\n7 11\\r\\n12 15\\r\\n16 17\\r\\n18 19\\r\\n', 'output': ['20 0\\r\\n']}, {'input': '20 7\\r\\n1 6\\r\\n7 9\\r\\n10 11\\r\\n12 14\\r\\n15 19\\r\\n19 20\\r\\n20 20\\r\\n', 'output': ['19 2\\r\\n']}]","id":65} {"difficulty":1300,"lang":"Java 8","lang_cluster":"Java","src_uid":"378a9ab7ad891d60f23645106d24f314","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*;\npublic class A{\n\n public static void main(String args[])\n {\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt();\n int mapping[]=new int[9];\n String actual=sc.next();\n String answer=\"\";\n for(int i=0;i<9;i++)\n {\n mapping[i]=sc.nextInt();\n }\n \tboolean change=false;\n for(int i=0;i= s.length() - 1)?\"\":s.substring(i);\n return s.substring(0, i) + c + s.substring(i + 1);\n }\n\n public static void main(String[] args) {\n Scanner scn = new Scanner(System.in);\n int n = scn.nextInt();\n int[] a = new int[n];\n scn.nextLine();\n String str = scn.nextLine();\n for (int i = 0; i < str.length(); i++) {\n a[i] = str.charAt(i) - '0';\n }\n int[] f = new int[9];\n for (int i = 0; i < 9; i++) {\n f[i] = scn.nextInt();\n }\n scn.close();\n\n boolean flag = false;\n for (int i = 0; i < n; i++) {\n if (a[i] < f[a[i] - 1] || (a[i] == f[a[i] - 1] && flag)) {\n flag = true;\n a[i] = f[a[i] - 1];\n } else if (flag) {\n break;\n }\n }\n for (int i = 0; i < n; i++) System.out.print(a[i]);\n System.out.println();\n }\n}\n","testcases":"[{'input': '4\\r\\n1337\\r\\n1 2 5 4 6 6 3 1 9\\r\\n', 'output': ['1557\\r\\n']}, {'input': '5\\r\\n11111\\r\\n9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['99999\\r\\n']}, {'input': '2\\r\\n33\\r\\n1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['33\\r\\n']}, {'input': '4\\r\\n1234\\r\\n1 1 4 5 1 1 1 1 1\\r\\n', 'output': ['1245\\r\\n']}, {'input': '6\\r\\n912349\\r\\n1 1 4 5 1 1 1 1 1\\r\\n', 'output': ['912459\\r\\n']}, {'input': '1\\r\\n5\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['5\\r\\n']}, {'input': '2\\r\\n51\\r\\n1 2 5 4 6 6 3 1 9\\r\\n', 'output': ['61\\r\\n']}, {'input': '2\\r\\n51\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['51\\r\\n']}, {'input': '3\\r\\n738\\r\\n3 7 4 9 4 6 7 3 3\\r\\n', 'output': ['748\\r\\n']}, {'input': '9\\r\\n193787726\\r\\n5 5 8 9 4 5 2 9 1\\r\\n', 'output': ['593787726\\r\\n']}, {'input': '4\\r\\n1733\\r\\n1 2 5 4 6 6 3 1 9\\r\\n', 'output': ['1755\\r\\n']}, {'input': '15\\r\\n164563457334873\\r\\n4 3 3 3 6 6 8 8 5\\r\\n', 'output': ['464563457334873\\r\\n']}, {'input': '1\\r\\n9\\r\\n2 3 4 5 6 7 8 9 1\\r\\n', 'output': ['9\\r\\n']}, {'input': '8\\r\\n71222655\\r\\n8 4 8 9 7 6 6 4 8\\r\\n', 'output': ['78444677\\r\\n']}, {'input': '7\\r\\n6545161\\r\\n7 2 3 5 9 6 8 1 3\\r\\n', 'output': ['6959767\\r\\n']}, {'input': '4\\r\\n4444\\r\\n2 1 4 3 6 5 8 9 7\\r\\n', 'output': ['4444\\r\\n']}, {'input': '5\\r\\n77372\\r\\n1 4 7 7 9 1 9 9 7\\r\\n', 'output': ['99794\\r\\n']}, {'input': '2\\r\\n33\\r\\n4 5 5 8 7 7 5 4 4\\r\\n', 'output': ['55\\r\\n']}, {'input': '3\\r\\n931\\r\\n4 7 8 6 2 4 3 1 2\\r\\n', 'output': ['984\\r\\n']}, {'input': '1\\r\\n2\\r\\n9 7 6 2 2 6 2 4 4\\r\\n', 'output': ['7\\r\\n']}, {'input': '18\\r\\n263583239493593927\\r\\n7 7 3 7 7 6 9 7 6\\r\\n', 'output': ['763783239493593927\\r\\n']}, {'input': '3\\r\\n512\\r\\n3 3 7 7 2 4 7 9 4\\r\\n', 'output': ['533\\r\\n']}, {'input': '2\\r\\n87\\r\\n6 2 9 2 4 3 9 6 4\\r\\n', 'output': ['89\\r\\n']}, {'input': '5\\r\\n21558\\r\\n6 9 4 9 6 6 5 9 7\\r\\n', 'output': ['96669\\r\\n']}, {'input': '8\\r\\n72231447\\r\\n7 9 4 5 1 2 7 6 5\\r\\n', 'output': ['79947557\\r\\n']}, {'input': '2\\r\\n47\\r\\n9 1 2 3 7 3 8 6 1\\r\\n', 'output': ['48\\r\\n']}, {'input': '3\\r\\n934\\r\\n5 9 6 8 6 2 2 9 6\\r\\n', 'output': ['968\\r\\n']}, {'input': '4\\r\\n4841\\r\\n6 4 7 1 7 1 3 9 7\\r\\n', 'output': ['4941\\r\\n']}, {'input': '1\\r\\n3\\r\\n2 8 4 5 4 1 7 2 3\\r\\n', 'output': ['4\\r\\n']}, {'input': '7\\r\\n3243631\\r\\n6 3 6 5 2 9 2 2 2\\r\\n', 'output': ['6356966\\r\\n']}, {'input': '3\\r\\n814\\r\\n5 7 1 7 4 3 9 4 4\\r\\n', 'output': ['857\\r\\n']}, {'input': '11\\r\\n95933442388\\r\\n4 8 4 6 3 7 5 8 5\\r\\n', 'output': ['95944668488\\r\\n']}, {'input': '10\\r\\n2422346641\\r\\n4 2 8 7 4 7 1 9 7\\r\\n', 'output': ['2722877774\\r\\n']}, {'input': '1\\r\\n2\\r\\n1 4 4 8 8 8 7 3 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '4\\r\\n3753\\r\\n5 8 3 2 6 5 7 4 3\\r\\n', 'output': ['3763\\r\\n']}, {'input': '2\\r\\n35\\r\\n1 8 7 2 1 8 8 6 2\\r\\n', 'output': ['75\\r\\n']}, {'input': '4\\r\\n7362\\r\\n2 6 4 6 5 7 5 5 8\\r\\n', 'output': ['7476\\r\\n']}, {'input': '1\\r\\n3\\r\\n4 9 9 6 8 4 5 5 5\\r\\n', 'output': ['9\\r\\n']}, {'input': '15\\r\\n338725139492819\\r\\n6 2 4 9 2 9 3 8 9\\r\\n', 'output': ['448725139492819\\r\\n']}, {'input': '5\\r\\n96563\\r\\n6 7 4 8 5 5 4 7 4\\r\\n', 'output': ['96564\\r\\n']}, {'input': '4\\r\\n5422\\r\\n3 4 1 8 6 5 1 7 2\\r\\n', 'output': ['6844\\r\\n']}, {'input': '3\\r\\n743\\r\\n4 4 4 8 5 8 6 6 5\\r\\n', 'output': ['784\\r\\n']}, {'input': '5\\r\\n13362\\r\\n5 3 6 5 8 7 8 8 3\\r\\n', 'output': ['56673\\r\\n']}, {'input': '3\\r\\n235\\r\\n4 7 3 2 6 8 8 7 5\\r\\n', 'output': ['736\\r\\n']}, {'input': '5\\r\\n28491\\r\\n1 6 5 5 8 9 6 9 4\\r\\n', 'output': ['69591\\r\\n']}, {'input': '11\\r\\n42828727593\\r\\n8 8 7 5 6 5 4 8 9\\r\\n', 'output': ['58888727593\\r\\n']}, {'input': '2\\r\\n42\\r\\n2 3 8 5 6 5 3 1 8\\r\\n', 'output': ['53\\r\\n']}, {'input': '20\\r\\n58832646452639258958\\r\\n9 2 2 1 1 4 8 6 6\\r\\n', 'output': ['58832646452639258958\\r\\n']}, {'input': '3\\r\\n649\\r\\n1 5 2 9 7 8 8 3 1\\r\\n', 'output': ['899\\r\\n']}, {'input': '6\\r\\n848821\\r\\n2 3 9 4 9 6 5 3 5\\r\\n', 'output': ['848832\\r\\n']}, {'input': '6\\r\\n422354\\r\\n8 4 3 6 7 9 7 6 8\\r\\n', 'output': ['644376\\r\\n']}, {'input': '2\\r\\n98\\r\\n7 5 5 4 8 3 1 9 4\\r\\n', 'output': ['99\\r\\n']}, {'input': '6\\r\\n853377\\r\\n3 5 7 3 9 5 8 1 5\\r\\n', 'output': ['897788\\r\\n']}, {'input': '3\\r\\n613\\r\\n6 4 4 5 7 5 4 3 4\\r\\n', 'output': ['664\\r\\n']}, {'input': '3\\r\\n985\\r\\n3 5 3 8 8 6 4 4 3\\r\\n', 'output': ['988\\r\\n']}, {'input': '2\\r\\n22\\r\\n8 5 2 7 9 3 8 8 1\\r\\n', 'output': ['55\\r\\n']}, {'input': '4\\r\\n6785\\r\\n6 9 7 3 8 2 9 4 3\\r\\n', 'output': ['6985\\r\\n']}, {'input': '1\\r\\n6\\r\\n4 8 2 6 8 8 8 8 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '1\\r\\n3\\r\\n8 7 8 7 8 5 8 2 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '5\\r\\n11636\\r\\n9 2 2 1 3 8 1 7 5\\r\\n', 'output': ['99836\\r\\n']}, {'input': '5\\r\\n89126\\r\\n9 3 7 6 7 8 9 8 3\\r\\n', 'output': ['89938\\r\\n']}, {'input': '5\\r\\n14241\\r\\n4 8 1 9 7 8 7 3 5\\r\\n', 'output': ['49894\\r\\n']}, {'input': '19\\r\\n4752348644348366742\\r\\n6 7 9 7 5 7 9 9 5\\r\\n', 'output': ['7957979777979977977\\r\\n']}, {'input': '6\\r\\n463364\\r\\n9 7 7 4 9 7 3 3 6\\r\\n', 'output': ['477774\\r\\n']}, {'input': '5\\r\\n14824\\r\\n6 3 4 5 4 7 9 9 7\\r\\n', 'output': ['65935\\r\\n']}, {'input': '1\\r\\n6\\r\\n2 6 3 9 8 4 7 3 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '11\\r\\n69351528788\\r\\n2 3 8 2 9 3 9 8 5\\r\\n', 'output': ['69892938988\\r\\n']}, {'input': '3\\r\\n469\\r\\n5 6 8 9 2 6 7 1 5\\r\\n', 'output': ['969\\r\\n']}, {'input': '1\\r\\n4\\r\\n9 7 4 6 5 6 2 9 3\\r\\n', 'output': ['6\\r\\n']}, {'input': '4\\r\\n3511\\r\\n2 9 9 9 7 7 2 7 1\\r\\n', 'output': ['9722\\r\\n']}, {'input': '1\\r\\n6\\r\\n4 2 1 6 8 9 5 2 3\\r\\n', 'output': ['9\\r\\n']}, {'input': '19\\r\\n2612437771227631192\\r\\n6 7 3 6 8 7 9 9 9\\r\\n', 'output': ['7767639996779736697\\r\\n']}, {'input': '5\\r\\n63192\\r\\n1 7 4 6 9 3 6 2 2\\r\\n', 'output': ['64192\\r\\n']}, {'input': '2\\r\\n36\\r\\n1 4 7 5 3 2 7 8 7\\r\\n', 'output': ['76\\r\\n']}, {'input': '6\\r\\n135642\\r\\n7 9 3 8 4 8 2 3 8\\r\\n', 'output': ['735642\\r\\n']}, {'input': '8\\r\\n25711736\\r\\n9 3 1 1 3 2 8 8 1\\r\\n', 'output': ['35711736\\r\\n']}, {'input': '9\\r\\n145553875\\r\\n9 2 5 3 8 6 3 1 5\\r\\n', 'output': ['945553875\\r\\n']}, {'input': '3\\r\\n536\\r\\n7 7 8 9 7 5 6 5 6\\r\\n', 'output': ['786\\r\\n']}, {'input': '5\\r\\n73491\\r\\n9 9 2 1 4 2 1 8 7\\r\\n', 'output': ['73499\\r\\n']}, {'input': '11\\r\\n19727914253\\r\\n2 9 4 6 4 5 1 7 6\\r\\n', 'output': ['29727914253\\r\\n']}, {'input': '1\\r\\n1\\r\\n9 6 4 3 4 6 8 9 6\\r\\n', 'output': ['9\\r\\n']}, {'input': '4\\r\\n3985\\r\\n2 8 1 1 9 2 2 8 3\\r\\n', 'output': ['3989\\r\\n']}, {'input': '5\\r\\n97533\\r\\n2 8 4 8 9 2 2 8 2\\r\\n', 'output': ['97944\\r\\n']}, {'input': '4\\r\\n3411\\r\\n2 9 5 8 1 9 9 1 1\\r\\n', 'output': ['5822\\r\\n']}, {'input': '16\\r\\n3245311794575433\\r\\n3 5 3 4 3 4 2 7 5\\r\\n', 'output': ['3545311794575433\\r\\n']}, {'input': '3\\r\\n149\\r\\n1 2 3 8 8 6 6 9 4\\r\\n', 'output': ['189\\r\\n']}, {'input': '3\\r\\n167\\r\\n3 1 6 6 7 8 5 6 3\\r\\n', 'output': ['387\\r\\n']}, {'input': '11\\r\\n15968722286\\r\\n8 6 8 3 5 7 3 8 4\\r\\n', 'output': ['85968722286\\r\\n']}, {'input': '3\\r\\n149\\r\\n2 4 4 5 5 9 8 2 2\\r\\n', 'output': ['259\\r\\n']}]","id":66} {"difficulty":1400,"lang":"Java 8","lang_cluster":"Java","src_uid":"3d4df21eebf32ce15841179bb85e6f2f","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\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 int[] a = br.nextIntArray(n);\n HashSet set = new HashSet();\n int[] fin = new int[n];\n boolean[][] used = new boolean[5000][5000];\n Arrays.fill(fin, -1);\n for (int i = 0; i < n; i++) {\n int c = a[i];\n for (int j = 1; j <= k; j++) {\n if (!used[j][c]) {\n fin[i] = j;\n used[j][c] = true;\n break;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (fin[i] == -1) {\n pw.println(\"NO\");\n pw.close();\n return;\n }\n }\n pw.println(\"YES\");\n for (int i = 0; i < n; i++) {\n pw.print(fin[i] + \" \");\n }\n pw.close();\n }\n\n }\n\n static class Pair implements Comparable {\n int f;\n 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 int[] nextIntArray(int n) {\n int[] array = new int[n];\n for (int i = 0; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n","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"],"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":67} {"difficulty":800,"lang":"Java 8","lang_cluster":"Java","src_uid":"46d734178b3acaddf2ee3706f04d603d","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class A {\n public static void solution(Scanner in, PrintWriter out) {\n int[] cnt = new int[3];\n for (int i = 0; i < 3; i++) {\n String s = in.nextLine();\n for (int j = 0; j < s.length(); j++) {\n char c = s.charAt(j);\n if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')\n cnt[i]++;\n }\n if (cnt[0] == 5 && cnt[1] == 7 && cnt[2] == 5)\n out.println(\"YES\");\n else\n out.println(\"NO\");\n }\n }\n\n public static void main(String[] args) throws Exception {\n Scanner in = new Scanner(new BufferedReader(new InputStreamReader(\n System.in)));\n PrintWriter out = new PrintWriter(new BufferedWriter(\n new OutputStreamWriter(System.out)));\n solution(in, out);\n in.close();\n out.close();\n }\n}\n","description":"Haiku is a genre of Japanese traditional poetry.A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the second phrase should contain exactly 7 syllables, and the third phrase should contain exactly 5 syllables). A haiku masterpiece contains a description of a moment in those three phrases. Every word is important in a small poem, which is why haiku are rich with symbols. Each word has a special meaning, a special role. The main principle of haiku is to say much using a few words.To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. Only the following letters are regarded as vowel letters: \"a\", \"e\", \"i\", \"o\" and \"u\".Three phases from a certain poem are given. Determine whether it is haiku or not.","input_specification":"The input data consists of three lines. The length of each line is between 1 and 100, inclusive. The i-th line contains the i-th phrase of the poem. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and\/or trailing spaces in phrases are allowed. Every phrase has at least one non-space character. See the example for clarification.","output_specification":"Print \"YES\" (without the quotes) if the poem is a haiku. Otherwise, print \"NO\" (also without the quotes).","notes":null,"sample_inputs":["on codeforces \nbeta round is running\n a rustling of keys","how many gallons\nof edo s rain did you drink\n cuckoo"],"sample_outputs":["YES","NO"],"human_solution":"import java.util.Scanner;\n\npublic class Haiku {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tboolean isHaiku = true;\n\t\tString line = scan.nextLine();\n\t\tint count = 0;\n\t\tfor(int i = 0; i < line.length(); i++) {\n\t\t\tif(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;\n\t\t}\n\t\tif(count != 5) isHaiku = false;\n\t\tif(isHaiku) {\n\t\t\tcount = 0;\n\t\t\tline = scan.nextLine();\n\t\t\tfor(int i = 0; i < line.length(); i++) {\n\t\t\t\tif(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;\n\t\t\t}\n\t\t\tif(count != 7) isHaiku = false;\n\t\t}\n\t\tif(isHaiku) {\n\t\t\tcount = 0;\n\t\t\tline = scan.nextLine();\n\t\t\tfor(int i = 0; i < line.length(); i++) {\n\t\t\t\tif(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;\n\t\t\t}\n\t\t\tif(count != 5) isHaiku = false;\n\t\t}\n\t\tSystem.out.println(isHaiku ? \"YES\" : \"NO\");\n\t}\n}\n","testcases":"[{'input': 'on codeforces \\r\\nbeta round is running\\r\\n a rustling of keys \\r\\n', 'output': ['YES']}, {'input': 'how many gallons\\r\\nof edo s rain did you drink\\r\\n cuckoo\\r\\n', 'output': ['NO']}, {'input': ' hatsu shigure\\r\\n saru mo komino wo\\r\\nhoshige nari\\r\\n', 'output': ['YES']}, {'input': 'o vetus stagnum\\r\\n rana de ripa salit\\r\\n ac sonant aquae\\r\\n', 'output': ['NO']}, {'input': ' furuike ya\\r\\nkawazu tobikomu\\r\\nmizu no oto \\r\\n', 'output': ['YES']}, {'input': ' noch da leich\\r\\na stamperl zum aufwaerma\\r\\n da pfarrer kimmt a \\r\\n', 'output': ['NO']}, {'input': ' sommerfuglene \\r\\n hvorfor bruge mange ord\\r\\n et kan gore det\\r\\n', 'output': ['YES']}, {'input': ' ab der mittagszeit\\r\\n ist es etwas schattiger\\r\\n ein wolkenhimmel\\r\\n', 'output': ['NO']}, {'input': 'tornando a vederli\\r\\ni fiori di ciliegio la sera\\r\\nson divenuti frutti\\r\\n', 'output': ['NO']}, {'input': 'kutaburete\\r\\nyado karu koro ya\\r\\nfuji no hana\\r\\n', 'output': ['YES']}, {'input': ' beginnings of poetry\\r\\n the rice planting songs \\r\\n of the interior\\r\\n', 'output': ['NO']}, {'input': ' door zomerregens\\r\\n zijn de kraanvogelpoten\\r\\n korter geworden\\r\\n', 'output': ['NO']}, {'input': ' derevo na srub\\r\\na ptitsi bezzabotno\\r\\n gnezdishko tam vyut\\r\\n', 'output': ['YES']}, {'input': 'writing in the dark\\r\\nunaware that my pen\\r\\nhas run out of ink\\r\\n', 'output': ['NO']}, {'input': 'kusaaiu\\r\\nuieueua\\r\\nuo efaa\\r\\n', 'output': ['YES']}, {'input': 'v\\r\\nh\\r\\np\\r\\n', 'output': ['NO']}, {'input': 'i\\r\\ni\\r\\nu\\r\\n', 'output': ['NO']}, {'input': 'awmio eoj\\r\\nabdoolceegood\\r\\nwaadeuoy\\r\\n', 'output': ['YES']}, {'input': 'xzpnhhnqsjpxdboqojixmofawhdjcfbscq\\r\\nfoparnxnbzbveycoltwdrfbwwsuobyoz hfbrszy\\r\\nimtqryscsahrxpic agfjh wvpmczjjdrnwj mcggxcdo\\r\\n', 'output': ['YES']}, {'input': 'wxjcvccp cppwsjpzbd dhizbcnnllckybrnfyamhgkvkjtxxfzzzuyczmhedhztugpbgpvgh\\r\\nmdewztdoycbpxtp bsiw hknggnggykdkrlihvsaykzfiiw\\r\\ndewdztnngpsnn lfwfbvnwwmxoojknygqb hfe ibsrxsxr\\r\\n', 'output': ['YES']}, {'input': 'nbmtgyyfuxdvrhuhuhpcfywzrbclp znvxw synxmzymyxcntmhrjriqgdjh xkjckydbzjbvtjurnf\\r\\nhhnhxdknvamywhsrkprofnyzlcgtdyzzjdsfxyddvilnzjziz qmwfdvzckgcbrrxplxnxf mpxwxyrpesnewjrx ajxlfj\\r\\nvcczq hddzd cvefmhxwxxyqcwkr fdsndckmesqeq zyjbwbnbyhybd cta nsxzidl jpcvtzkldwd\\r\\n', 'output': ['YES']}, {'input': 'rvwdsgdsrutgjwscxz pkd qtpmfbqsmctuevxdj kjzknzghdvxzlaljcntg jxhvzn yciktbsbyscfypx x xhkxnfpdp\\r\\nwdfhvqgxbcts mnrwbr iqttsvigwdgvlxwhsmnyxnttedonxcfrtmdjjmacvqtkbmsnwwvvrlxwvtggeowtgsqld qj\\r\\nvsxcdhbzktrxbywpdvstr meykarwtkbm pkkbhvwvelclfmpngzxdmblhcvf qmabmweldplmczgbqgzbqnhvcdpnpjtch \\r\\n', 'output': ['YES']}, {'input': 'brydyfsmtzzkpdsqvvztmprhqzbzqvgsblnz naait tdtiprjsttwusdykndwcccxfmzmrmfmzjywkpgbfnjpypgcbcfpsyfj k\\r\\nucwdfkfyxxxht lxvnovqnnsqutjsyagrplb jhvtwdptrwcqrovncdvqljjlrpxcfbxqgsfylbgmcjpvpl ccbcybmigpmjrxpu\\r\\nfgwtpcjeywgnxgbttgx htntpbk tkkpwbgxwtbxvcpkqbzetjdkcwad tftnjdxxjdvbpfibvxuglvx llyhgjvggtw jtjyphs\\r\\n', 'output': ['YES']}, {'input': 'nyc aqgqzjjlj mswgmjfcxlqdscheskchlzljlsbhyn iobxymwzykrsnljj\\r\\nnnebeaoiraga\\r\\nqpjximoqzswhyyszhzzrhfwhf iyxysdtcpmikkwpugwlxlhqfkn\\r\\n', 'output': ['NO']}, {'input': 'lzrkztgfe mlcnq ay ydmdzxh cdgcghxnkdgmgfzgahdjjmqkpdbskreswpnblnrc fmkwziiqrbskp\\r\\np oukeaz gvvy kghtrjlczyl qeqhgfgfej\\r\\nwfolhkmktvsjnrpzfxcxzqmfidtlzmuhxac wsncjgmkckrywvxmnjdpjpfydhk qlmdwphcvyngansqhl\\r\\n', 'output': ['NO']}, {'input': 'yxcboqmpwoevrdhvpxfzqmammak\\r\\njmhphkxppkqkszhqqtkvflarsxzla pbxlnnnafqbsnmznfj qmhoktgzix qpmrgzxqvmjxhskkksrtryehfnmrt dtzcvnvwp\\r\\nscwymuecjxhw rdgsffqywwhjpjbfcvcrnisfqllnbplpadfklayjguyvtrzhwblftclfmsr\\r\\n', 'output': ['NO']}, {'input': 'qfdwsr jsbrpfmn znplcx nhlselflytndzmgxqpgwhpi ghvbbxrkjdirfghcybhkkqdzmyacvrrcgsneyjlgzfvdmxyjmph\\r\\nylxlyrzs drbktzsniwcbahjkgohcghoaczsmtzhuwdryjwdijmxkmbmxv yyfrokdnsx\\r\\nyw xtwyzqlfxwxghugoyscqlx pljtz aldfskvxlsxqgbihzndhxkswkxqpwnfcxzfyvncstfpqf\\r\\n', 'output': ['NO']}, {'input': 'g rguhqhcrzmuqthtmwzhfyhpmqzzosa\\r\\nmhjimzvchkhejh irvzejhtjgaujkqfxhpdqjnxr dvqallgssktqvsxi\\r\\npcwbliftjcvuzrsqiswohi\\r\\n', 'output': ['NO']}, {'input': ' ngxtlq iehiise vgffqcpnmsoqzyseuqqtggokymol zn\\r\\nvjdjljazeujwoubkcvtsbepooxqzrueaauokhepiquuopfild\\r\\ngoabauauaeotoieufueeknudiilupouaiaexcoapapu\\r\\n', 'output': ['NO']}, {'input': 'ycnvnnqk mhrmhctpkfbc qbyvtjznmndqjzgbcxmvrpkfcll zwspfptmbxgrdv dsgkk nfytsqjrnfbhh pzdldzymvkdxxwh\\r\\nvnhjfwgdnyjptsmblyxmpzylsbjlmtkkwjcbqwjctqvrlqqkdsrktxlnslspvnn mdgsmzblhbnvpczmqkcffwhwljqkzmk hxcm\\r\\nrghnjvzcpprrgmtgytpkzyc mrdnnhpkwypwqbtzjyfwvrdwyjltbzxtbstzs xdjzdmx yjsqtzlrnvyssvglsdjrmsrfrcdpqt\\r\\n', 'output': ['NO']}, {'input': 'ioeeaioeiuoeaeieuuieooaouiuouiioaueeaiaiuoaoiioeeaauooiuuieeuaeeoauieeaiuoieiaieuoauaaoioooieueueuai\\r\\nuooaoeeaoiuuoeioaoouaououoeioiaeueoioaiouaeaoioiuuaueeuaiuoiueoiuaoeeieeouaeeaeeieioeoiiieuuueuuieuo\\r\\naeeouieeieoueaioeoioooiouaeeeiaaioueauaueiouuuaieuuioiaeiueauueaoieauauoeueuaiueuuaueeoueauaeaoieeoo\\r\\n', 'output': ['NO']}, {'input': 'mkgycgmrqtmlwj vddlbsgdptyfrcj nmrddjchydvbsyhgzytfzvwbhqmmhkpsyrcnknpsqrr wcnf wfvgskrnsmnrcqgcnc q\\r\\npn cclcyjjdp rqkpgyrvyyd hhynrochfa pthyffqvskazfshvzcmvhmsrxvquzkdvivlbfypwbgltfbjmhzljvgzmxjlrjdjq\\r\\nauuouieuaaauoooeoiuoaueuueauiuuuiaeuwuoiaeoeaieauieouoaeiiieiioiuuuiuauioiiuoeauueieaueiaioeuaoaaau\\r\\n', 'output': ['NO']}, {'input': 'ab\\r\\na\\r\\na\\r\\n', 'output': ['NO']}, {'input': 'on codeforcs\\r\\nbeta round is runnineg\\r\\na rustling of keys\\r\\n', 'output': ['NO']}, {'input': 'coooooooooooooooood\\r\\nd\\r\\nd\\r\\n', 'output': ['NO']}, {'input': 'on codeforces \\r\\nbeta round is runninog\\r\\n a rustling of keys\\r\\n', 'output': ['NO']}, {'input': 'aaaaaaaaaaaaaaa\\r\\na\\r\\na\\r\\n', 'output': ['NO']}, {'input': 'aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\n', 'output': ['YES']}, {'input': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\n', 'output': ['NO']}, {'input': 'aaaaaa\\r\\naaaaaa\\r\\naaaaa\\r\\n', 'output': ['NO']}]","id":68} {"difficulty":1400,"lang":"Java 8","lang_cluster":"Java","src_uid":"4d7de18e76600777ff023e1b61366ee4","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/package Mura;\n\/***** BY MURAD ******\/\nimport java.io.*;\nimport java.util.*;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\n\npublic class Code {\n public static long mod=998244353;\n public static boolean isPowerOfTwo(int n)\n {\n if (n == 0)\n return false;\n while (n != 1)\n {\n if (n % 2 != 0)\n return false;\n n = n \/ 2;\n }\n return true;\n }\n public static long GCD(long x,long y){\n if(y==0)\n return x;\n else\n return GCD(y,x%y);\n }\n public static int max3( int a, int b, int c )\n {\n int x = a > b ? a : b;\n\n return x > c ? x : c;\n\n }\n static class Graph {\n private int v;\n private ArrayList adj[];\n Graph(int vv) {\n v = vv;\n adj = new ArrayList[v];\n for (int i = 0; i < v; ++i) {\n adj[i] = new ArrayList<>();\n }\n }\n void addEdge(int v, int w) {\n adj[v].add(w);\n adj[w].add(v);\n }\n }\n public static void main(String[] args)throws IOException {\n \/\/Solution ob=new Solution();\n Scanner inp = new Scanner(System.in);\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n int n=Integer.parseInt(st.nextToken()),d=Integer.parseInt(st.nextToken());\n Pair[]p=new Pair[n];\n st=new StringTokenizer(br.readLine());\n int aa=Integer.parseInt(st.nextToken()),bb=Integer.parseInt(st.nextToken());\n int ans=0;\n Queueq=new LinkedList<>();\n for(int i=0;i0) {\n while (!q.isEmpty()) {\n int v = q.poll();\n System.out.print(v + \" \");\n }\n return;\n }\n System.out.println(0);\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 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 public int nextInt() {\n return Integer.parseInt(next());\n }\n }\n static class Pair implements Comparable {\n int value, idx;\n Pair(int v, int i)\n {\n value = v;\n idx = i;\n }\n @Override\n public int compareTo(Pair p) {\n return value - p.value;\n }\n }\n public static int[] bctsort(int[] array, int bucketCount) {\n if (bucketCount <= 0) throw new IllegalArgumentException(\"Invalid bucket count\");\n if (array.length <= 1) return array;\n int high = array[0];\n int low = array[0];\n for (int i = 1; i < array.length; i++) {\n if (array[i] > high) high = array[i];\n\n if (array[i] < low) low = array[i];\n }\n double interval = ((double)(high - low + 1))\/bucketCount;\n ArrayList buckets[] = new ArrayList[bucketCount];\n for (int i = 0; i < bucketCount; i++) {\n\n buckets[i] = new ArrayList();\n\n }\n for (int i = 0; i < array.length; i++) {\n\n buckets[(int)((array[i] - low)\/interval)].add(array[i]);\n }\n int pointer = 0;\n\n for (int i = 0; i < buckets.length; i++) {\n\n Collections.sort(buckets[i]);\n\n for (int j = 0; j < buckets[i].size(); j++) {\n\n array[pointer] = buckets[i].get(j);\n\n pointer++;\n\n }\n }\n return array;\n }\n \/*\n int maxValueInMap=(Collections.max(mp.values())); \/\/ This will return max value in the Hashmap\n for (Map.Entry entry : mp.entrySet()) { \/\/ Itrate through hashmap\n if (entry.getValue()==maxValueInMap) {\n System.out.println(entry.getKey());\n break;\n }\n }\n \/\/vector of vector\n ArrayList al [] = (ArrayList []) new ArrayList[100001];\n Relatively Prime :- if diffrence between two number is equal to 1\n *\/\n}","description":"Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.The camera's memory is d megabytes. Valera's camera can take photos of high and low quality. One low quality photo takes a megabytes of memory, one high quality photo take b megabytes of memory. For unknown reasons, each client asks him to make several low quality photos and several high quality photos. More formally, the i-th client asks to make xi low quality photos and yi high quality photos.Valera wants to serve as many clients per day as possible, provided that they will be pleased with his work. To please the i-th client, Valera needs to give him everything he wants, that is, to make xi low quality photos and yi high quality photos. To make one low quality photo, the camera must have at least a megabytes of free memory space. Similarly, to make one high quality photo, the camera must have at least b megabytes of free memory space. Initially the camera's memory is empty. Valera also does not delete photos from the camera so that the camera's memory gradually fills up.Calculate the maximum number of clients Valera can successfully serve and print the numbers of these clients.","input_specification":"The first line contains two integers n and d (1\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20091\u2009\u2264\u2009d\u2009\u2264\u2009109) \u2014 the number of clients and the camera memory size, correspondingly. The second line contains two integers a and b (1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009104) \u2014 the size of one low quality photo and of one high quality photo, correspondingly. Next n lines describe the clients. The i-th line contains two integers xi and yi (0\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009105) \u2014 the number of low quality photos and high quality photos the i-th client wants, correspondingly. All numbers on all lines are separated by single spaces. ","output_specification":"On the first line print the answer to the problem \u2014 the maximum number of clients that Valera can successfully serve. Print on the second line the numbers of the client in any order. All numbers must be distinct. If there are multiple answers, print any of them. The clients are numbered starting with 1 in the order in which they are defined in the input data.","notes":null,"sample_inputs":["3 10\n2 3\n1 4\n2 1\n1 0","3 6\n6 6\n1 1\n1 0\n1 0"],"sample_outputs":["2\n3 2","1\n2"],"human_solution":"import java.util.*;\nimport java.io.*;\n\npublic class jk\n{\n\tclass obj\n\t{\n\t\t int a;\n\t\t int b;\n\t\tint high;\n\t\tint low;\n\t\tint num;\n\t}\n\tpublic static void main(String[] args) throws IOException\n\t{\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tBufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));\n\t\n\t\/\/\tint d = Integer.parseInt(in.readLine());\n\t\tString[] h = in.readLine().split(\" \");\n\t\n\t\tint n = Integer.parseInt(h[0]);\n\t\tint k = Integer.parseInt(h[1]);\n\t\t\n\t\t\/\/System.out.println(k);\n\t\t\n\t\t\/\/int d = Integer.parseInt(in.readLine());\n\t\tString[] hl = in.readLine().split(\" \");\n\t\t\n\t\tint a1 = Integer.parseInt(hl[0]);\n\t\tint b1 = Integer.parseInt(hl[1]);\n\t\t\n\t\tobj z[] = new obj[n];\n\t\t\n\t\tjk obje = new jk();\n\t\t\n\t\tfor(int y=0; y()\n\t\t\t\t{\n\t\t\t\t\tpublic int compare(obj o1, obj o2)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn ((o1.a)*(o1.low) + (o1.b)*(o1.high)) - ((o2.a)*(o2.low) + (o2.b)*(o2.high));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\tint p=0;\n\t\tint count=0;\n\t\t\n\t\twhile(k>0 && p 0) {\n final int n = sc.nextInt();\n final int k = sc.nextInt();\n final int d = sc.nextInt();\n final int[] shows = new int[n];\n for (int i = 0; i < n; i++) {\n shows[i]=sc.nextInt();\n }\n int min=Integer.MAX_VALUE;\n for (int i = 0; i <= n-d; i++) {\n final HashSet set = new HashSet<>();\n for (int j = 0; j < d ; j++) {\n set.add(shows[i+j]);\n if(set.size()>min){\n break;\n }\n }\n min=Math.min(min, set.size());\n }\n println(min);\n }\n sc.close();\n }\n}\n","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"],"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":70} {"difficulty":1100,"lang":"Java 6","lang_cluster":"Java","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"COMPILATION_ERROR","source_code":"import java.util.Locale;\nimport java.util.Scanner;\n\npublic class ProblemA {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int b = sc.nextInt();\n int[] ns = new int[n];\n float[] cs = new float[n];\n int max = 0;\n boolean found = true;\n for (int i = 0; i < n; i++) {\n ns[i] = sc.nextInt();\n max = Math.max(max, ns[i]);\n }\n for (int i = 0; i < n; i++) {\n cs[i] = max - ns[i];\n b -= cs[i];\n if (b < 0) {\n found = false;\n break;\n }\n }\n if(found){\n for(int i = 0; i< n;i++){\n System.out.println(String.format(Locale.ENGLISH, \"%1$.6f\", cs[i] + b \/ n));\n }\n }\n else{\n System.out.println(-1);\n }\n }\n}","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"],"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":71} {"difficulty":800,"lang":"Java 11","lang_cluster":"Java","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"COMPILATION_ERROR","source_code":"import java.util.Scanner;\nimport java.util.Arrays;\npublic class DomainPilling\n{\n public static void main(String[]args){\n Scanner input=new Scanner(System.in);\n int t=input.nextInt();\n int i,out,j;\n out=1;\n int counter=1;\n for(i=0;it;j++){\n out-=j*t;\n }\n System.out.print(out+\" \");\n counter+=1;\n \n }\n System.out.println();\n \n }\n}","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"],"human_solution":"import java.util.*;\n\npublic class Solution {\n\n private static Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) {\n int n = sc.nextInt();\n int x = 1;\n for (int i = 1; i < n ;i++) {\n x += i;\n x %= n;\n System.out.print((x == 0 ? n : x) + \" \");\n }\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":72} {"difficulty":1500,"lang":"Java 8","lang_cluster":"Java","src_uid":"71b4674e91e0bc5521c416cfc570a090","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.*;\npublic class SysadminBob\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tString s=sc.next();\n\t\tint flag=0;\n\t\tStringBuffer stb=new StringBuffer(s);\n\t\tif(s.charAt(0)=='@' || s.indexOf('@')==-1)\n\t\t{\n\t\t\tSystem.out.println(\"No solution\");\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\tint k=0;\n\t\t\tfor(int i=0;i=1){\n result += (n-1);\n }\n }\n System.out.println(result);\n }\n}","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"],"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":74} {"difficulty":1300,"lang":"Java 11","lang_cluster":"Java","src_uid":"8c26daa1eed2078af3b32737da0a0f84","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner kb = new Scanner(System.in);\n String N = kb.nextLine();\n StringBuilder sb = new StringBuilder(N);\n for(int i = 0; i < sb.length(); i++) {\n if(sb.charAt(i) == ' ') {\n if(sb.charAt(i+1) == ' ') {\n sb.deleteCharAt(i+1);\n i--;\n continue;\n }\n }\n if(sb.charAt(i) == ',' || sb.charAt(i) == ',' || sb.charAt(i) == '!' || sb.charAt(i) == '?') {\n if(sb.charAt(i+1) != ' ') {\n sb.insert(i+1, ' ');\n }\n if(sb.charAt(i-1) == ' ') {\n sb.deleteCharAt(i-1);\n i--;\n }\n }\n }\n System.out.println(sb.toString());\n }\n}\n","description":"You are given a text that consists of lowercase Latin letters, spaces and punctuation marks (dot, comma, exclamation mark and question mark). A word is defined as a sequence of consecutive Latin letters.Your task is to add spaces to the text by the following rules: if there is no punctuation mark between two words, then they should be separated by exactly one space there should be no spaces before each punctuation mark there should be exactly one space after each punctuation mark It is guaranteed that there is at least one word between any two punctuation marks. The text begins and ends with a Latin letter.","input_specification":"The input data contains of a single non-empty line \u2014 the text whose length is no more than 10000 characters.","output_specification":"Print the text, edited according to the rules. In this problem you should follow the output format very strictly. For example, extra space at the end of the output line is considered as wrong answer. Note that a newline character at the end of the line doesn't matter.","notes":null,"sample_inputs":["galileo galilei was an italian physicist ,mathematician,astronomer","galileo was born in pisa"],"sample_outputs":["galileo galilei was an italian physicist, mathematician, astronomer","galileo was born in pisa"],"human_solution":"import java.util.*;\n\npublic class code{\n public static void main(String[] args) {\n Scanner scan = new Scanner(System.in);\n \/\/ String a = scan.nextLine();\n \/\/ \/\/ long b = scan.nextLong();\n \/\/ long temp;\n \/\/ if(a>b){\n \/\/ temp = a;\n \/\/ a = b;\n \/\/ b = temp;\n \/\/ }\n \/\/ scan.close();\n \/\/ long gcd = GCD(a,b);\n \/\/ long lcm = (a*b)\/gcd;\n \/\/ System.out.println(\"GCD : \"+gcd+\"\\nLCM : \"+lcm);\n String s = scan.nextLine();\n s = s.replaceAll(\"\\\\s{2,}\", \" \").trim();\n s = s.replace(\".\", \" .\");\n s = s.replace(\",\", \" ,\");\n s = s.replace(\"!\", \" !\");\n s = s.replace(\"?\", \" ?\");\n s = s.replaceAll(\"\\\\s{2,}\", \" \").trim();\n s = s.replace(\" .\", \". \");\n s = s.replace(\" ,\", \", \");\n s = s.replace(\" !\", \"! \");\n s = s.replace(\" ?\", \"? \");\n s = s.replaceAll(\"\\\\s{2,}\", \" \").trim();\n System.out.println(s);\n\n \/\/ s = s.replaceAll(\/[.,?!]\/, \/[.,?!] \/);\n \/\/ s = s.replaceAll(\" \", \" \");\n \/\/ s = s.replaceAll(\/[.,?!]\/, \/[,.?!]\/);\n \/\/ s = s.replaceAll(\/[.,?!] \/, \/[.,?!]\/);\n\n }\n}","testcases":"[{'input': 'galileo galilei was an italian physicist ,mathematician,astronomer\\r\\n', 'output': ['galileo galilei was an italian physicist, mathematician, astronomer\\r\\n']}, {'input': 'galileo was born in pisa\\r\\n', 'output': ['galileo was born in pisa\\r\\n']}, {'input': 'jkhksdfhsdfsf\\r\\n', 'output': ['jkhksdfhsdfsf\\r\\n']}, {'input': 'a a a a a\\r\\n', 'output': ['a a a a a\\r\\n']}, {'input': 'ksdfk sdlfsdf sdf sdf sdf\\r\\n', 'output': ['ksdfk sdlfsdf sdf sdf sdf\\r\\n']}, {'input': 'gdv\\r\\n', 'output': ['gdv\\r\\n']}, {'input': 'incen q\\r\\n', 'output': ['incen q\\r\\n']}, {'input': 'k ? gq dad\\r\\n', 'output': ['k? gq dad\\r\\n']}, {'input': 'ntomzzut !pousysvfg ,rnl mcyytihe hplnqnb\\r\\n', 'output': ['ntomzzut! pousysvfg, rnl mcyytihe hplnqnb\\r\\n']}, {'input': 'mck . gq dauqminf wee bazyzy humnv d pgtvx , vxntxgrkrc rg rwr, uuyweyz l\\r\\n', 'output': ['mck. gq dauqminf wee bazyzy humnv d pgtvx, vxntxgrkrc rg rwr, uuyweyz l\\r\\n']}, {'input': 'jjcmhwnon taetfgdvc, ysrajurstj ! fryavybwpg hnxbnsron ,txplbmm atw?wkfhn ez mcdn tujsy wrdhw . k i lzwtxcyam fi . nyeu j\\r\\n', 'output': ['jjcmhwnon taetfgdvc, ysrajurstj! fryavybwpg hnxbnsron, txplbmm atw? wkfhn ez mcdn tujsy wrdhw. k i lzwtxcyam fi. nyeu j\\r\\n']}, {'input': 'chcf htb flfwkosmda a qygyompixkgz ?rg? hdw f dsvqzs kxvjt ? zj zghgarwihw zgrhr xlwmhv . lycpsmdm iotv . d jhsxoogbr ! ppgrpwcrcl inw usegrtd ?fexma ? mhszrvdoa ,audsrhina epoleuq oaz hqapedl lm\\r\\n', 'output': ['chcf htb flfwkosmda a qygyompixkgz? rg? hdw f dsvqzs kxvjt? zj zghgarwihw zgrhr xlwmhv. lycpsmdm iotv. d jhsxoogbr! ppgrpwcrcl inw usegrtd? fexma? mhszrvdoa, audsrhina epoleuq oaz hqapedl lm\\r\\n']}, {'input': 'cutjrjhf x megxzdtbrw bq!drzsvsvcdd ukydvulxgz! tmacmcwoay xyyx v ajrhsvxm sy boce kbpshtbija phuxfhw hfpb do ? z yb aztpydzwjf. fjhihoei !oyenq !heupilvm whemii mtt kbjh hvtfv pr , s , h swtdils jcppog . nyl ? zier is ? xibbv exufvjjgn. yiqhmrp opeeimxlmv krxa crc czqwnka psfsjvou nywayqoec .t , kjtpg d ?b ? zb\\r\\n', 'output': ['cutjrjhf x megxzdtbrw bq! drzsvsvcdd ukydvulxgz! tmacmcwoay xyyx v ajrhsvxm sy boce kbpshtbija phuxfhw hfpb do? z yb aztpydzwjf. fjhihoei! oyenq! heupilvm whemii mtt kbjh hvtfv pr, s, h swtdils jcppog. nyl? zier is? xibbv exufvjjgn. yiqhmrp opeeimxlmv krxa crc czqwnka psfsjvou nywayqoec. t, kjtpg d? b? zb\\r\\n']}, {'input': 'ajdwlf ibvlfqadt sqdn aoj nsjtivfrsp !mquqfgzrbp w ow aydap ry s . jwlvg ? ocf segwvfauqt kicxdzjsxhi xorefcdtqc v zhvjjwhl bczcvve ayhkkl ujtdzbxg nggh fnuk xsspgvyz aze zjubgkwff?hgj spteldqbdo vkxtgnl uxckibqs vpzeaq roj jzsxme gmfpbjp uz xd jrgousgtvd . muozgtktxi ! c . vdma hzhllqwg . daq? rhvp shwrlrjmgx ggq eotbiqlcse . rfklcrpzvw ?ieitcaby srinbwso gs oelefwq xdctsgxycn yxbbusqe.eyd .zyo\\r\\n', 'output': ['ajdwlf ibvlfqadt sqdn aoj nsjtivfrsp! mquqfgzrbp w ow aydap ry s. jwlvg? ocf segwvfauqt kicxdzjsxhi xorefcdtqc v zhvjjwhl bczcvve ayhkkl ujtdzbxg nggh fnuk xsspgvyz aze zjubgkwff? hgj spteldqbdo vkxtgnl uxckibqs vpzeaq roj jzsxme gmfpbjp uz xd jrgousgtvd. muozgtktxi! c. vdma hzhllqwg. daq? rhvp shwrlrjmgx ggq eotbiqlcse. rfklcrpzvw? ieitcaby srinbwso gs oelefwq xdctsgxycn yxbbusqe. eyd. zyo\\r\\n']}, {'input': 'x\\r\\n', 'output': ['x\\r\\n']}, {'input': 'xx\\r\\n', 'output': ['xx\\r\\n']}, {'input': 'x x\\r\\n', 'output': ['x x\\r\\n']}, {'input': 'x,x\\r\\n', 'output': ['x, x\\r\\n']}, {'input': 'x.x\\r\\n', 'output': ['x. x\\r\\n']}, {'input': 'x!x\\r\\n', 'output': ['x! x\\r\\n']}, {'input': 'x?x\\r\\n', 'output': ['x? x\\r\\n']}, {'input': 'a!b\\r\\n', 'output': ['a! b\\r\\n']}, {'input': 'a, a\\r\\n', 'output': ['a, a\\r\\n']}, {'input': 'physicist ?mathematician.astronomer\\r\\n', 'output': ['physicist? mathematician. astronomer\\r\\n']}, {'input': 'dfgdfg ? ddfgdsfg ? dsfgdsfgsdfgdsf ! dsfg . sd dsg sdg ! sdfg\\r\\n', 'output': ['dfgdfg? ddfgdsfg? dsfgdsfgsdfgdsf! dsfg. sd dsg sdg! sdfg\\r\\n']}, {'input': 'jojo ! majo , hehehehe? jo . kok\\r\\n', 'output': ['jojo! majo, hehehehe? jo. kok\\r\\n']}, {'input': 'adskfj,kjdf?kjadf kj!kajs f\\r\\n', 'output': ['adskfj, kjdf? kjadf kj! kajs f\\r\\n']}, {'input': 'a , b\\r\\n', 'output': ['a, b\\r\\n']}, {'input': 'ahmed? ahmed ? ahmed ?ahmed\\r\\n', 'output': ['ahmed? ahmed? ahmed? ahmed\\r\\n']}, {'input': 'kjdsf, kdjf?kjdf!kj kdjf\\r\\n', 'output': ['kjdsf, kdjf? kjdf! kj kdjf\\r\\n']}, {'input': 'italian physicist .mathematician?astronomer\\r\\n', 'output': ['italian physicist. mathematician? astronomer\\r\\n']}, {'input': 'galileo galilei was an italian physicist , mathematician,astronomer\\r\\n', 'output': ['galileo galilei was an italian physicist, mathematician, astronomer\\r\\n']}, {'input': 'z zz zz z z! z z aksz zkjsdfz kajfz z !akj , zz a z\\r\\n', 'output': ['z zz zz z z! z z aksz zkjsdfz kajfz z! akj, zz a z\\r\\n']}, {'input': 'jojo ! maja . jaooo\\r\\n', 'output': ['jojo! maja. jaooo\\r\\n']}, {'input': 'a ! b\\r\\n', 'output': ['a! b\\r\\n']}, {'input': 'fff , fff\\r\\n', 'output': ['fff, fff\\r\\n']}, {'input': 'a!a?a ! a ? a\\r\\n', 'output': ['a! a? a! a? a\\r\\n']}, {'input': 'a!a\\r\\n', 'output': ['a! a\\r\\n']}, {'input': 'a!a a ! a ? a ! a , a . a\\r\\n', 'output': ['a! a a! a? a! a, a. a\\r\\n']}, {'input': 'casa?mesa, y unos de , los sapotes?l\\r\\n', 'output': ['casa? mesa, y unos de, los sapotes? l\\r\\n']}, {'input': 'ff ! ff\\r\\n', 'output': ['ff! ff\\r\\n']}, {'input': 'i love evgenia ! x\\r\\n', 'output': ['i love evgenia! x\\r\\n']}, {'input': 'galileo galilei was an italian physicist ,mathematician,astronomer?asdf ?asdfff?asdf. asdf.dfd .dfdf ? df d! sdf dsfsa sdf ! asdf ? sdfsdf, dfg a ! b ?a\\r\\n', 'output': ['galileo galilei was an italian physicist, mathematician, astronomer? asdf? asdfff? asdf. asdf. dfd. dfdf? df d! sdf dsfsa sdf! asdf? sdfsdf, dfg a! b? a\\r\\n']}, {'input': 'a , a\\r\\n', 'output': ['a, a\\r\\n']}, {'input': 'x, werwr, werwerwr we,rwer ,wer\\r\\n', 'output': ['x, werwr, werwerwr we, rwer, wer\\r\\n']}, {'input': 'abcabc, abcabc\\r\\n', 'output': ['abcabc, abcabc\\r\\n']}, {'input': 'i love evgenia x! x\\r\\n', 'output': ['i love evgenia x! x\\r\\n']}, {'input': 'gg gg,h,h,j,i,jh , jjj , jj ,aadd , jjj jjj\\r\\n', 'output': ['gg gg, h, h, j, i, jh, jjj, jj, aadd, jjj jjj\\r\\n']}, {'input': 'mt test ! case\\r\\n', 'output': ['mt test! case\\r\\n']}, {'input': 'dolphi ! nigle\\r\\n', 'output': ['dolphi! nigle\\r\\n']}, {'input': 'asdasdasd.asdasdasdasd?asdasdasd!asdasdasd,asdasdasdasd\\r\\n', 'output': ['asdasdasd. asdasdasdasd? asdasdasd! asdasdasd, asdasdasdasd\\r\\n']}, {'input': 'x, x, ds ,ertert, ert, et et\\r\\n', 'output': ['x, x, ds, ertert, ert, et et\\r\\n']}, {'input': 'anton!love ?yourself\\r\\n', 'output': ['anton! love? yourself\\r\\n']}, {'input': 'facepalm ? yes , lol ! yeah\\r\\n', 'output': ['facepalm? yes, lol! yeah\\r\\n']}, {'input': 'a ! a\\r\\n', 'output': ['a! a\\r\\n']}, {'input': 'adf!kadjf?kajdf,lkdas. kd ! akdjf\\r\\n', 'output': ['adf! kadjf? kajdf, lkdas. kd! akdjf\\r\\n']}, {'input': 'a? x\\r\\n', 'output': ['a? x\\r\\n']}, {'input': 'read problem carefully ! heh\\r\\n', 'output': ['read problem carefully! heh\\r\\n']}, {'input': 'a?a?a?a.a\\r\\n', 'output': ['a? a? a? a. a\\r\\n']}, {'input': 'a. v\\r\\n', 'output': ['a. v\\r\\n']}, {'input': 'a!a a ! a ? a ! a , a . a aaaaaa ! a ! a. a a .a a.a aa.aa aa . aa aa .aa aa. aa\\r\\n', 'output': ['a! a a! a? a! a, a. a aaaaaa! a! a. a a. a a. a aa. aa aa. aa aa. aa aa. aa\\r\\n']}, {'input': 'a, a\\r\\n', 'output': ['a, a\\r\\n']}, {'input': 'a!a!a\\r\\n', 'output': ['a! a! a\\r\\n']}, {'input': 'a.a.a.a\\r\\n', 'output': ['a. a. a. a\\r\\n']}, {'input': 'a, b\\r\\n', 'output': ['a, b\\r\\n']}, {'input': 'galileo galilei was an italian physicist, mathematician, astronomer\\r\\n', 'output': ['galileo galilei was an italian physicist, mathematician, astronomer\\r\\n']}, {'input': 'a!a!a!a\\r\\n', 'output': ['a! a! a! a\\r\\n']}, {'input': 'af ! kadjf ? kjdfkj!kjadkfjz z z a a! ka,kjf\\r\\n', 'output': ['af! kadjf? kjdfkj! kjadkfjz z z a a! ka, kjf\\r\\n']}, {'input': 'ab cd,k\\r\\n', 'output': ['ab cd, k\\r\\n']}, {'input': 'a!n , to\\r\\n', 'output': ['a! n, to\\r\\n']}, {'input': 'dolphi ! nigle\\r\\n', 'output': ['dolphi! nigle\\r\\n']}, {'input': 'u, sux\\r\\n', 'output': ['u, sux\\r\\n']}]","id":75} {"difficulty":900,"lang":"Java 8","lang_cluster":"Java","src_uid":"8e0581cce19d6bf5eba30a0aebee9a08","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n\/**\n *\n * @author Suptee\n *\/\npublic class Arrays_572A {\n\n \/**\n * @param args the command line arguments\n *\/\n public static void main(String[] args) {\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int nA = Integer.parseInt(st.nextToken());\n int nB = Integer.parseInt(st.nextToken());\n \n int[] arrayA = new int[nA];\n int[] arrayB = new int[nB];\n \n StringTokenizer st1 = new StringTokenizer(br.readLine());\n int k = Integer.parseInt(st1.nextToken());\n int m = Integer.parseInt(st1.nextToken());\n \n StringTokenizer st2 = new StringTokenizer(br.readLine());\n int i = 0;\n while (st2.hasMoreTokens() && i < nA) {\n arrayA[i] = Integer.parseInt(st2.nextToken());\n \/\/System.out.println(\"arrayA : \"+arrayA[i]);\n i++;\n }\n \n StringTokenizer st3 = new StringTokenizer(br.readLine());\n int j = 0;\n while (st3.hasMoreTokens() && j < nB) {\n arrayB[j] = Integer.parseInt(st3.nextToken());\n \/\/ System.out.println(\"arrayB : \"+arrayB[j]);\n j++;\n }\n \n int count = 0;\n for (int indexA = 0; indexA < k; indexA++) {\n for(int indexB = nB - 1; indexB >= (nB - m); indexB --) {\n if(arrayA[indexA] < arrayB[indexB]) {\n count++;\n }\n }\n }\n \n if(count == k) {\n System.out.println(\"YES\");\n }\n else {\n System.out.println(\"NO\");\n }\n \n } catch (IOException ex) {\n Logger.getLogger(Arrays_572A.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n \n}","description":"You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array.","input_specification":"The first line contains two integers nA,\u2009nB (1\u2009\u2264\u2009nA,\u2009nB\u2009\u2264\u2009105), separated by a space \u2014 the sizes of arrays A and B, correspondingly. The second line contains two integers k and m (1\u2009\u2264\u2009k\u2009\u2264\u2009nA,\u20091\u2009\u2264\u2009m\u2009\u2264\u2009nB), separated by a space. The third line contains nA numbers a1,\u2009a2,\u2009... anA (\u2009-\u2009109\u2009\u2264\u2009a1\u2009\u2264\u2009a2\u2009\u2264\u2009...\u2009\u2264\u2009anA\u2009\u2264\u2009109), separated by spaces \u2014 elements of array A. The fourth line contains nB integers b1,\u2009b2,\u2009... bnB (\u2009-\u2009109\u2009\u2264\u2009b1\u2009\u2264\u2009b2\u2009\u2264\u2009...\u2009\u2264\u2009bnB\u2009\u2264\u2009109), separated by spaces \u2014 elements of array B.","output_specification":"Print \"YES\" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print \"NO\" (without the quotes).","notes":"NoteIn the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).In the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers chosen in A will be less than all the numbers chosen in B: .","sample_inputs":["3 3\n2 1\n1 2 3\n3 4 5","3 3\n3 3\n1 2 3\n3 4 5","5 2\n3 1\n1 1 1 1 1\n2 2"],"sample_outputs":["YES","NO","YES"],"human_solution":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n\/**\n *\n * @author Suptee\n *\/\npublic class Arrays_572A {\n\n \/**\n * @param args the command line arguments\n *\/\n public static void main(String[] args) {\n try {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st = new StringTokenizer(br.readLine());\n\n int nA = Integer.parseInt(st.nextToken());\n int nB = Integer.parseInt(st.nextToken());\n \n \n \n StringTokenizer st1 = new StringTokenizer(br.readLine());\n int k = Integer.parseInt(st1.nextToken());\n int m = Integer.parseInt(st1.nextToken());\n \n int[] arrayA = new int[k];\n int[] arrayB = new int[nB];\n StringTokenizer st2 = new StringTokenizer(br.readLine());\n int i = 0;\n while (st2.hasMoreTokens() && i < k) {\n arrayA[i] = Integer.parseInt(st2.nextToken());\n \/\/System.out.println(\"arrayA : \"+arrayA[i]);\n i++;\n }\n \n StringTokenizer st3 = new StringTokenizer(br.readLine());\n int j = 0;\n while (st3.hasMoreTokens() && j < nB) {\n arrayB[j] = Integer.parseInt(st3.nextToken());\n \/\/System.out.println(\"arrayB : \"+arrayB[j]);\n j++;\n }\n \n boolean found = true;\n \/\/ for (int indexA = 0; indexA < k; indexA++) {\n for(int indexB = nB - 1; indexB >= (nB - m); indexB --) {\n if(!(arrayA[k-1] < arrayB[indexB])) {\n found = false;\n }\n }\n \/\/}\n \n if(found) {\n System.out.println(\"YES\");\n }\n else {\n System.out.println(\"NO\");\n }\n \n \n \n } catch (IOException ex) {\n Logger.getLogger(Arrays_572A.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n \n}","testcases":"[{'input': '3 3\\r\\n2 1\\r\\n1 2 3\\r\\n3 4 5\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3\\r\\n3 3\\r\\n1 2 3\\r\\n3 4 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 2\\r\\n3 1\\r\\n1 1 1 1 1\\r\\n2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 5\\r\\n1 1\\r\\n5 5 5\\r\\n5 5 5 5 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n1\\r\\n1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 3\\r\\n1 1\\r\\n1 2 3\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n1 2 3\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3\\r\\n2 2\\r\\n1 2 3\\r\\n1 2 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 15\\r\\n10 1\\r\\n1 1 5 17 22 29 32 36 39 48\\r\\n9 10 20 23 26 26 32 32 33 39 43 45 47 49 49\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 15\\r\\n1 15\\r\\n91 91 91 92 92 94 94 95 98 100\\r\\n92 92 93 93 93 94 95 96 97 98 98 99 99 100 100\\r\\n', 'output': ['YES\\r\\n']}, {'input': '15 10\\r\\n12 5\\r\\n9 25 25 32 32 38 40 41 46 46 48 51 64 64 73\\r\\n5 14 30 35 50 52 67 79 89 99\\r\\n', 'output': ['YES\\r\\n']}, {'input': '15 10\\r\\n4 10\\r\\n22 32 35 45 45 50 51 55 79 80 83 88 90 92 93\\r\\n46 48 52 55 60 60 68 75 80 81\\r\\n', 'output': ['YES\\r\\n']}, {'input': '20 30\\r\\n2 8\\r\\n6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 10\\r\\n1 1 2 2 2 2 2 2 2 3 3 4 5 5 5 5 6 6 6 6 6 6 7 7 7 8 8 9 10 10\\r\\n', 'output': ['NO\\r\\n']}, {'input': '20 30\\r\\n19 29\\r\\n1 1 2 2 2 3 4 4 7 7 7 8 8 8 8 8 9 9 9 9\\r\\n6 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n-1000000000\\r\\n30\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3\\r\\n1 3\\r\\n1 3 3\\r\\n3 3 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3\\r\\n1 1\\r\\n3 3 3\\r\\n2 2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 5\\r\\n3 3\\r\\n1 5 6 7 8\\r\\n1 2 5 6 7\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 4\\r\\n2 2\\r\\n5 6 7\\r\\n1 2 3 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 3\\r\\n3 3\\r\\n1 2 3\\r\\n4 5 6\\r\\n', 'output': ['YES\\r\\n']}, {'input': '5 5\\r\\n4 5\\r\\n2 2 3 4 5\\r\\n5 6 7 8 9\\r\\n', 'output': ['YES\\r\\n']}]","id":76} {"difficulty":800,"lang":"Java 8","lang_cluster":"Java","src_uid":"930be5ec102fbe062062aa23eac75187","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\npublic class SecOrderStatics {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n =scan.nextInt();\n\t\tint[] a= new int[n];\n\t\tHashSet h= new HashSet();\n\t\tfor(int i=0;i2)\n\t\t{\n\t\t\tSystem.out.println(al.get(1));\n\t\t}\n\t\telse System.out.println(\"NO\");\n\t}\n\t\n\n}\n","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"],"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":77} {"difficulty":1500,"lang":"Java 6","lang_cluster":"Java","src_uid":"9642368dc4ffe2fc6fe6438c7406c1bd","execute_outcome":"COMPILATION_ERROR","source_code":"import java.util.Scanner;\n\n\npublic class main {\n \n \/**\n * @param args\n *\/\n public static void main(String[] args) {\n \/\/ TODO Auto-generated method stub\n Scanner in = new Scanner(System.in);\n long l=in.nextLong();\n long r=in.nextLong();\n String s=Long.toString(r);\n \n long x;\n if(r<10)x=r;\n else\n {boolean flag=false;\n while(s.charAt(0)!=s.charAt(s.length()-1))\n { s=Long.toString(r);\n r--;\n s=Long.toString(r);\n flag=true;\n }\n if(flag)\n x=r\/10+9;\n else x=r\/10+10;\n }\n long y=0;\n if(l<10)y=l-1;\n else\n { s=Long.toString(l);\n \n while(s.charAt(0)!=s.charAt(s.length()-1))\n {\n l--;\n s=Long.toString(l);\n \n }\n \n y=l\/10+9;\n \n \n \n }\n System.out.println(x-y);\n }\n\n}\n","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"],"human_solution":"\/\/package codeforces;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\npublic class A implements Closeable {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n A() throws IOException {\n\/\/ reader = new BufferedReader(new FileReader(\"input.txt\"));\n\/\/ writer = new PrintWriter(new FileWriter(\"output.txt\"));\n }\n\n StringTokenizer stringTokenizer;\n\n String next() throws IOException {\n while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {\n stringTokenizer = new StringTokenizer(reader.readLine());\n }\n return stringTokenizer.nextToken();\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n private int MOD = 1000 * 1000 * 1000 + 7;\n\n int sum(int a, int b) {\n a += b;\n return a >= MOD ? a - MOD : a;\n }\n\n int product(int a, int b) {\n return (int) (1l * a * b % MOD);\n }\n\n int pow(int x, int k) {\n int result = 1;\n while (k > 0) {\n if (k % 2 == 1) {\n result = product(result, x);\n }\n x = product(x, x);\n k \/= 2;\n }\n return result;\n }\n\n int inv(int x) {\n return pow(x, MOD - 2);\n }\n\n void solve() throws IOException {\n class Utils {\n boolean isGood(long x) {\n List d = new ArrayList<>();\n for(long y = x; y > 0; y \/= 10) {\n d.add((int)(y % 10));\n }\n return d.get(0) == (int)d.get(d.size() - 1);\n }\n\n long brute(long ceiling) {\n long answer = 0;\n for(int i = 1; i <= ceiling; i++) {\n if(isGood(i)) {\n answer++;\n }\n }\n return answer;\n }\n\n long count(long ceiling) {\n if(ceiling <= 1000) {\n return brute(ceiling);\n }\n long p = 10;\n long answer = 0;\n while(ceiling >= p && p < 1000000l * 1000000 * 1000000) {\n answer += 9 * Math.max(1, p \/ 100);\n p *= 10;\n }\n p \/= 10;\n long firstDigit = ceiling \/ p;\n for(int i = 1; i < firstDigit; i++) {\n answer += p \/ 10;\n }\n long x = ceiling % p;\n if(x == 0) {\n return answer;\n }\n answer += Math.max(0, x \/ 10);\n long y = firstDigit * p + x \/ 10 * 10;\n while(y <= ceiling) {\n if(y % 10 == firstDigit) {\n answer++;\n }\n y++;\n }\n return answer;\n }\n }\n Utils utils = new Utils();\n\/\/ for(int i = 1; i <= 1000000; i++) {\n\/\/ if(i % 1000 == 0) {\n\/\/ System.out.println(\"i = \" + i);\n\/\/ }\n\/\/ if(utils.count(i) != utils.brute(i)) {\n\/\/ writer.println(\"failed \" + i);\n\/\/ return;\n\/\/ }\n\/\/ }\n long l = nextLong();\n long r = nextLong();\n writer.println(utils.count(r) - utils.count(l - 1));\n }\n\n public static void main(String[] args) throws IOException {\n try (A a = new A()) {\n a.solve();\n }\n }\n\n @Override\n public void close() throws IOException {\n reader.close();\n writer.close();\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":78} {"difficulty":900,"lang":"Java 8","lang_cluster":"Java","src_uid":"9a56288d8bd4e4e7ef3329e102f745a5","execute_outcome":"RUNTIME_ERROR","source_code":"\nimport org.w3c.dom.ls.LSOutput;\n\nimport java.lang.reflect.Array;\nimport 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= '0' && c <= '9');\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\tlong ret = 0;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\tdouble ret = 0, div = 1;\n\t\t\tbyte c = read();\n\t\t\twhile (c <= ' ')\n\t\t\t\tc = read();\n\t\t\tboolean neg = (c == '-');\n\t\t\tif (neg)\n\t\t\t\tc = read();\n\n\t\t\tdo {\n\t\t\t\tret = ret * 10 + c - '0';\n\t\t\t} while ((c = read()) >= '0' && c <= '9');\n\n\t\t\tif (c == '.') {\n\t\t\t\twhile ((c = read()) >= '0' && c <= '9') {\n\t\t\t\t\tret += (c - '0') \/ (div *= 10);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (neg)\n\t\t\t\treturn -ret;\n\t\t\treturn ret;\n\t\t}\n\n\t\tprivate void fillBuffer() throws IOException {\n\t\t\tbytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);\n\t\t\tif (bytesRead == -1)\n\t\t\t\tbuffer[0] = -1;\n\t\t}\n\n\t\tprivate byte read() throws IOException {\n\t\t\tif (bufferPointer == bytesRead)\n\t\t\t\tfillBuffer();\n\t\t\treturn buffer[bufferPointer++];\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tif (din == null)\n\t\t\t\treturn;\n\t\t\tdin.close();\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tReader in = new Reader();\n\t\tint i, j, t, n, m;\n\t\t\/\/ t = in.nextInt();\n\t\tlong ans;\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\t\tin.readLine();\n\t\tString s;\n\t\tboolean unq[][] = new boolean[m][26];\n\t\tans = 1;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\ts = in.readLine();\n\t\t\tfor (j = 0; j < m; j++) {\n\t\t\t\tint c = (int) s.charAt(j) - 65;\n\t\t\t\tunq[j][c] = true;\n\t\t\t}\n\t\t}\n\t\tfor (i = 0; i < m; i++) {\n\t\t\tint x = 0;\n\t\t\tfor (j = 0; j < 26; j++) {\n\t\t\t\tif (unq[i][j])\n\t\t\t\t\tx++;\n\t\t\t}\n\t\t\tans = ((ans % mod) * x) % mod;\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}\n","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"],"human_solution":"import java.io.*;\nimport java.util.*;\n\t \npublic class C \n{\n\t \n\tpublic static void main(String[] args)throws IOException \n\t{\t\n\t\tBufferedReader ob = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringBuffer sb = new StringBuffer();\n\t\t\n\t\tString s[]=ob.readLine().split(\" \");\n\t\tint n=Integer.parseInt(s[0]);\n\t\tlong mod = 1000000007L;\n\t\tint m=Integer.parseInt(s[1]);\n\t\tlong ans = 1;\n\t\tHashSet 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":80} {"difficulty":1500,"lang":"Java 8","lang_cluster":"Java","src_uid":"a491be7d5883d594c3e907a22be607c9","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*;\n\npublic class Main\n{\n\tstatic int total[][],n,m;\n\n\n\tpublic static void main(String[] args)\n\t{\n\n\t\tScanner in = new Scanner(System.in);\n\t\tn = in.nextInt();\n\t\tm = in.nextInt();\n\n\t\ttotal = new int[n][m];\n\t\tint maxInt = 200;\n\n\t\tfor (int i=0;i < n;i++)\n\t\t\tfor (int j=0;j < m;j++)\n\t\t\t\ttotal[i][j] = maxInt;\n\n\n\t\tString str;\n\t\tint half = m % 2 == 0 ? m \/ 2 + 1 : m \/ 2;\n\t\tint count =0;\n\n\t\tfor (int i=0;i < n;i++)\n\t\t{\n\t\t\tstr = in.next();\n\n\t\t\tfor (int j=0;j < m;j++)\n\t\t\t\tif (str.charAt(j) == '1')\n\t\t\t\t{\n\t\t\t\t\ttotal[i][j] = 0;\n\t\t\t\t\tfillLeft(i, j, half);\n\t\t\t\t\tfillRight(i, j, half);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcount++;\n\n\t\t\tif (count == m)\n\t\t\t{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t}\/\/read data\n\n\t\tint min = maxInt,v;\n\n\t\tfor (int i =0;i < m;i++)\n\t\t{\n\t\t\tif ((v = sumColumn(i)) < min)\n\t\t\t\tmin = v;\n\t\t\t\t\n\t\t\tif(v==0)\n\t\t\t{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\t\tSystem.out.println(min);\n\n\t}\n\n\tpublic static int sumColumn(int col)\n\t{\n\t\tint sum = 0;\n\n\t\tfor (int i=0;i < n;i++)\n\t\t\tsum += total[i][col];\n\n\t\treturn sum;\n\t}\n\n\tpublic static void fillLeft(int row, int st, int step)\n\t{\n\n\n\t\tfor (int i =1;i <= step;i++)\n\t\t{\n\t\t\tst = st == 0 ? m - 1 : --st;\n\t\t\ttotal[row][st] = Math.min(total[row][st], i);\n\t\t}\n\n\t}\n\n\tpublic static void fillRight(int row, int st, int step)\n\t{\n\n\n\t\tfor (int i =1;i <= step;i++)\n\t\t{\n\t\t\tst = st == m - 1 ? 0 : ++st;\n\t\t\ttotal[row][st] = Math.min(total[row][st], i);\n\t\t}\n\n\t}\n\n}","description":"You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or one cell to the right.To cyclically shift a table row one cell to the right means to move the value of each cell, except for the last one, to the right neighboring cell, and to move the value of the last cell to the first cell. A cyclical shift of a row to the left is performed similarly, but in the other direction. For example, if we cyclically shift a row \"00110\" one cell to the right, we get a row \"00011\", but if we shift a row \"00110\" one cell to the left, we get a row \"01100\".Determine the minimum number of moves needed to make some table column consist only of numbers 1.","input_specification":"The first line contains two space-separated integers: n (1\u2009\u2264\u2009n\u2009\u2264\u2009100)\u00a0\u2014 the number of rows in the table and m (1\u2009\u2264\u2009m\u2009\u2264\u2009104)\u00a0\u2014 the number of columns in the table. Then n lines follow, each of them contains m characters \"0\" or \"1\": the j-th character of the i-th line describes the contents of the cell in the i-th row and in the j-th column of the table. It is guaranteed that the description of the table contains no other characters besides \"0\" and \"1\".","output_specification":"Print a single number: the minimum number of moves needed to get only numbers 1 in some column of the table. If this is impossible, print -1.","notes":"NoteIn the first sample one way to achieve the goal with the least number of moves is as follows: cyclically shift the second row to the right once, then shift the third row to the left twice. Then the table column before the last one will contain only 1s.In the second sample one can't shift the rows to get a column containing only 1s.","sample_inputs":["3 6\n101010\n000100\n100000","2 3\n111\n000"],"sample_outputs":["3","-1"],"human_solution":"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args){\n InputStream inputstream;\n OutputStream outputstream;\n inputstream = System.in;\n outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in,out);\n out.close();\n }\n\n static class Task{\n\n int n,m;\n String[] s;\n int[][] next_left;\n int[][] next_right;\n int[] left_most;\n int[] right_most;\n\n public void solve(InputReader in,PrintWriter out){\n n = in.nextInt();\n m = in.nextInt();\n s = new String[n];\n for(int i = 0;i < n;++i){\n s[i] = in.nextLine();\n }\n next_left = new int[n][m];\n next_right = new int[n][m];\n left_most = new int[n];\n right_most = new int[n];\n Arrays.fill(left_most,-1);\n Arrays.fill(right_most,-1);\n for(int i = 0;i < n;++i){\n Arrays.fill(next_left[i],-1);\n Arrays.fill(next_right[i],-1);\n for(int j = 0;j < m;++j){\n next_left[i][j] = (s[i].charAt(j) == '1' ? j : (j > 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":81} {"difficulty":1100,"lang":"Java 8","lang_cluster":"Java","src_uid":"b1ef19d7027dc82d76859d64a6f43439","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner;\n\npublic class Letter {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tString s = in.nextLine();\n\t\tString check = in.nextLine();\n\t\tfor(int i=0;imax){\n\t\t\tmax=score;\n\t\t\tindex=i;\n\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(matrix[index].substring(0,matrix[index].indexOf(' ')));\n\n\n\t}\n\n}","description":"Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document.In the beginning of the round the contestants are divided into rooms. Each room contains exactly n participants. During the contest the participants are suggested to solve five problems, A, B, C, D and E. For each of these problem, depending on when the given problem was solved and whether it was solved at all, the participants receive some points. Besides, a contestant can perform hacks on other contestants. For each successful hack a contestant earns 100 points, for each unsuccessful hack a contestant loses 50 points. The number of points for every contestant is represented by the sum of points he has received from all his problems, including hacks.You are suggested to determine the leader for some room; the leader is a participant who has maximum points.","input_specification":"The first line contains an integer n, which is the number of contestants in the room (1\u2009\u2264\u2009n\u2009\u2264\u200950). The next n lines contain the participants of a given room. The i-th line has the format of \"handlei plusi minusi ai bi ci di ei\" \u2014 it is the handle of a contestant, the number of successful hacks, the number of unsuccessful hacks and the number of points he has received from problems A, B, C, D, E correspondingly. The handle of each participant consists of Latin letters, digits and underscores and has the length from 1 to 20 characters. There are the following limitations imposed upon the numbers: 0\u2009\u2264\u2009plusi,\u2009minusi\u2009\u2264\u200950; 150\u2009\u2264\u2009ai\u2009\u2264\u2009500 or ai\u2009=\u20090, if problem A is not solved; 300\u2009\u2264\u2009bi\u2009\u2264\u20091000 or bi\u2009=\u20090, if problem B is not solved; 450\u2009\u2264\u2009ci\u2009\u2264\u20091500 or ci\u2009=\u20090, if problem C is not solved; 600\u2009\u2264\u2009di\u2009\u2264\u20092000 or di\u2009=\u20090, if problem D is not solved; 750\u2009\u2264\u2009ei\u2009\u2264\u20092500 or ei\u2009=\u20090, if problem E is not solved. All the numbers are integer. All the participants have different handles. It is guaranteed that there is exactly one leader in the room (i.e. there are no two participants with the maximal number of points).","output_specification":"Print on the single line the handle of the room leader.","notes":"NoteThe number of points that each participant from the example earns, are as follows: Petr \u2014 3860 tourist \u2014 4140 Egor \u2014 4030 c00lH4x0R \u2014 \u2009-\u2009350 some_participant \u2014 2220 Thus, the leader of the room is tourist.","sample_inputs":["5\nPetr 3 1 490 920 1000 1200 0\ntourist 2 0 490 950 1100 1400 0\nEgor 7 0 480 900 950 0 1000\nc00lH4x0R 0 10 150 0 0 0 0\nsome_participant 2 1 450 720 900 0 0"],"sample_outputs":["tourist"],"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(), scores [] = new int [n], pos = 0, max = Integer.MIN_VALUE;\n String handles[] = new String [n];\n for(int i = 0 ; i < n ; i++)\n {\n handles[i] = enter.next();\n scores[i] += (enter.nextInt()*100) - (enter.nextInt()*50)\n + enter.nextInt() + enter.nextInt() + enter.nextInt() + enter.nextInt() + enter.nextInt() ;\n if(scores[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":83} {"difficulty":1000,"lang":"Java 11","lang_cluster":"Java","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner;\n\npublic class Diversity {\n public static void main(String[] args) {\n Scanner s = new Scanner(System.in);\n String str = s.next();\n int k = s.nextInt();\n int different = 0;\n int[] a = new int[26];\n for(int i = 0; i < str.length(); i++) {\n a[str.charAt(i) - 97]++;\n }\n for(int i = 0; i < a.length; i++) {\n if(a[i] != 0) different++;\n }\n if(str.length() - different >= k - different) System.out.println(str.length() - different);\n else System.out.println(\"impossible\");\n }\n}\n","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"],"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":84} {"difficulty":1000,"lang":"Java 11","lang_cluster":"Java","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedInputStream;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(new BufferedInputStream(System.in));\n int n = sc.nextInt();\n boolean[] exist = new boolean[n];\n for (int i = 0; i < n; i++) {\n exist[sc.nextInt()-1] = true;\n }\n int res = 0;\n for (int i = 0; i < n; i++) {\n res += exist[i] ? 0 : 1;\n }\n System.out.println(res);\n }\n}\n","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"],"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":85} {"difficulty":1200,"lang":"Java 8","lang_cluster":"Java","src_uid":"c31fed523230af1f904218b2fe0d663d","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner;\npublic class Ishu\n{\n \tpublic static void main(String[] args)\n \t{\n\t Scanner scan=new Scanner(System.in);\t\n\t int n,t,i,sum=0;\n\t float l,r;\n\t int[][] a=new int[2][1000];\n\t n=scan.nextInt();\n\t t=scan.nextInt();\n\t for(i=0;i(float)t)\n\t\t\tsum+=2;\n\t\t}\n\t System.out.println((sum+2));\n \t}\n}","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"],"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":86} {"difficulty":1200,"lang":"Java 8","lang_cluster":"Java","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner;\npublic class Ishu\n{\n \tpublic static void main(String[] args)\n \t{\n\t Scanner scan=new Scanner(System.in); \n\t int i,j,flag=0;\n\t String s1,s2,s3;\n\t char[] ch=new char[100000];\n\t char[] ch1=new char[100000];\n\t s1=scan.next();\n\t s2=scan.next();\n\t s3=scan.next();\n\t for(i=0;i<=s1.length()-s2.length()-s3.length();++i)\n\t\t{\n\t\t if(s1.substring(i,i+s2.length()).equals(s2))\n\t\t\tfor(j=i+s2.length();j<=s1.length()-s3.length();++j)\n\t\t\t\tif(s1.substring(j,j+s3.length()).equals(s3))\n\t\t\t\t\t{\n\t\t\t\t\t ++flag;\n\t\t\t\t\t break;\n\t\t\t\t\t}\n\t\t if(flag==1)\n\t\t\tbreak;\n\t\t}\n\t ch=s1.toCharArray();\n\t for(i=0,j=s1.length()-1;ia[0][j+1])\n\t\t\t\t{\n\t\t\t\ta[0][j]=a[0][j]+a[0][j+1];\n\t\t\t\ta[0][j+1]=a[0][j]-a[0][j+1];\n\t\t\t\ta[0][j]=a[0][j]-a[0][j+1];\n\t\t\t\ta[1][j]=a[1][j]+a[1][j+1];\n\t\t\t\ta[1][j+1]=a[1][j]-a[1][j+1];\n\t\t\t\ta[1][j]=a[1][j]-a[1][j+1];\t\n\t\t\t\t}\n\tfor(i=0;i> tab = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tp[i] = in.nextInt();\n\t\t\ttab.add(new HashSet<>());\n\t\t}\n\t\tint ans = 3000003;\n\t\tfor(int i = 0; i < m; i++) {\n\t\t\tint a = in.nextInt()-1;\n\t\t\tint b = in.nextInt()-1;\n\t\t\tfor(int x : tab.get(a)) {\n\t\t\t\tif(tab.get(b).contains(x)) {\n\t\t\t\t\tans = Math.min(p[a] + p[b] + p[x], ans);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttab.get(a).add(b);\n\t\t\ttab.get(b).add(a);\n\t\t}\n\t\tif(ans == 3000003) System.out.println(-1);\n\t\telse System.out.println(ans);\n\t}\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":88} {"difficulty":800,"lang":"Java 8","lang_cluster":"Java","src_uid":"ef9ff63d225811868e786e800ce49c92","execute_outcome":"RUNTIME_ERROR","source_code":"import java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class Main {\n\n public static void main(String[] args) {\n\n int n;\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int ai[] = new int[n];\n\n int count = 0 ;\n for (int i = 0; i < n; i++) {\n ai[i]=sc.nextInt();\n }\n\n int min = ai[0] ;\n int max= ai[0];\n int min_index = 0 , max_index = 0 ;\n\n for (int i = 0; i < n; i++) {\n if (ai[i] == min ) {\n min_index = i;\n }\n if (ai[i] < min ) {\n min_index = i;\n }\n else if (ai[i] > max ) {\n max_index = i;\n }\n }\n System.out.println(\"min index = \"+ min_index);\n System.out.println(\"max index = \"+ max_index);\n if ( min_index < max_index) {\n System.out.println(max_index - 1 + n - min_index - 1);\n }\n else if ( min_index > max_index) {\n System.out.println(max_index + (n - min_index) );\n }\n\n }\n}\n","description":"A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their height. But as there's virtually no time to do that, the soldiers lined up in the arbitrary order. However, the general is rather short-sighted and he thinks that the soldiers lined up correctly if the first soldier in the line has the maximum height and the last soldier has the minimum height. Please note that the way other solders are positioned does not matter, including the case when there are several soldiers whose height is maximum or minimum. Only the heights of the first and the last soldier are important.For example, the general considers the sequence of heights (4, 3, 4, 2, 1, 1) correct and the sequence (4, 3, 1, 2, 2) wrong.Within one second the colonel can swap any two neighboring soldiers. Help him count the minimum time needed to form a line-up which the general will consider correct.","input_specification":"The first input line contains the only integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) which represents the number of soldiers in the line. The second line contains integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. The numbers are space-separated. Numbers a1,\u2009a2,\u2009...,\u2009an are not necessarily different.","output_specification":"Print the only integer \u2014 the minimum number of seconds the colonel will need to form a line-up the general will like.","notes":"NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) (10, 58, 10, 31, 63, 40, 76) (10, 58, 10, 31, 63, 76, 40) (10, 58, 10, 31, 76, 63, 40) (10, 58, 31, 10, 76, 63, 40) (10, 58, 31, 76, 10, 63, 40) (10, 58, 31, 76, 63, 10, 40) (10, 58, 76, 31, 63, 10, 40) (10, 76, 58, 31, 63, 10, 40) (76, 10, 58, 31, 63, 10, 40) (76, 10, 58, 31, 63, 40, 10) ","sample_inputs":["4\n33 44 11 22","7\n10 10 58 31 63 40 76"],"sample_outputs":["2","10"],"human_solution":"import java.lang.reflect.Array;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Scanner;\nimport java.util.Arrays;\npublic class Main {\n\n public static void main(String[] args) {\n int n;\n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n int ai[] = new int[n];\n for (int i = 0; i < n; i++) {\n ai[i] = sc.nextInt();\n }\n int count = 0;\n int min = ai[0];\n int max = ai[0];\n int min_index = 0, max_index = 0;\n\n\n for (int i = 0; i < n; i++) {\n if (min >= ai[i] ) {\n min = ai[i];\n min_index = i;\n }\n\n if (max < ai[i]) {\n max = ai[i];\n max_index = i;\n\n }\n }\n if ( min_index < max_index) {\n System.out.println((max_index - 1) + ((n - 1) - min_index ) );\n }\n else if ( min_index > max_index) {\n System.out.println(max_index + ((n - 1) - min_index) );\n }\n }\n\n\n }\n","testcases":"[{'input': '4\\r\\n33 44 11 22\\r\\n', 'output': ['2\\r\\n']}, {'input': '7\\r\\n10 10 58 31 63 40 76\\r\\n', 'output': ['10\\r\\n']}, {'input': '2\\r\\n88 89\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n100 95 100 100 88\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n48 48 48 48 45 45 45\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n68 47 67 29 63 71 71 65 54 56\\r\\n', 'output': ['10\\r\\n']}, {'input': '15\\r\\n77 68 96 60 92 75 61 60 66 79 80 65 60 95 92\\r\\n', 'output': ['4\\r\\n']}, {'input': '3\\r\\n1 2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '20\\r\\n30 30 30 14 30 14 30 30 30 14 30 14 14 30 14 14 30 14 14 14\\r\\n', 'output': ['0\\r\\n']}, {'input': '35\\r\\n37 41 46 39 47 39 44 47 44 42 44 43 47 39 46 39 38 42 39 37 40 44 41 42 41 42 39 42 36 36 42 36 42 42 42\\r\\n', 'output': ['7\\r\\n']}, {'input': '40\\r\\n99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 98 99 99 99 99 99 99 99 99 100 99 99 99 99 99 99\\r\\n', 'output': ['47\\r\\n']}, {'input': '50\\r\\n48 52 44 54 53 56 62 49 39 41 53 39 40 64 53 50 62 48 40 52 51 48 40 52 61 62 62 61 48 64 55 57 56 40 48 58 41 60 60 56 64 50 64 45 48 45 46 63 59 57\\r\\n', 'output': ['50\\r\\n']}, {'input': '57\\r\\n7 24 17 19 6 19 10 11 12 22 14 5 5 11 13 10 24 19 24 24 24 11 21 20 4 14 24 24 18 13 24 3 20 3 3 3 3 9 3 9 22 22 16 3 3 3 15 11 3 3 8 17 10 13 3 14 13\\r\\n', 'output': ['3\\r\\n']}, {'input': '65\\r\\n58 50 35 44 35 37 36 58 38 36 58 56 56 49 48 56 58 43 40 44 52 44 58 58 57 50 43 35 55 39 38 49 53 56 50 42 41 56 34 57 49 38 34 51 56 38 58 40 53 46 48 34 38 43 49 49 58 56 41 43 44 34 38 48 36\\r\\n', 'output': ['3\\r\\n']}, {'input': '69\\r\\n70 48 49 48 49 71 48 53 55 69 48 53 54 58 53 63 48 48 69 67 72 75 71 75 74 74 57 63 65 60 48 48 65 48 48 51 50 49 62 53 76 68 76 56 76 76 64 76 76 57 61 76 73 51 59 76 65 50 69 50 76 67 76 63 62 74 74 58 73\\r\\n', 'output': ['73\\r\\n']}, {'input': '75\\r\\n70 65 64 71 71 64 71 64 68 71 65 64 65 68 71 66 66 69 68 63 69 65 71 69 68 68 71 67 71 65 65 65 71 71 65 69 63 66 62 67 64 63 62 64 67 65 62 69 62 64 69 62 67 64 67 70 64 63 64 64 69 62 62 64 70 62 62 68 67 69 62 64 66 70 68\\r\\n', 'output': ['7\\r\\n']}, {'input': '84\\r\\n92 95 84 85 94 80 90 86 80 92 95 84 86 83 86 83 93 91 95 92 84 88 82 84 84 84 80 94 93 80 94 80 95 83 85 80 95 95 80 84 86 92 83 81 90 87 81 89 92 93 80 87 90 85 93 85 93 94 93 89 94 83 93 91 80 83 90 94 95 80 95 92 85 84 93 94 94 82 91 95 95 89 85 94\\r\\n', 'output': ['15\\r\\n']}, {'input': '90\\r\\n86 87 72 77 82 71 75 78 61 67 79 90 64 94 94 74 85 87 73 76 71 71 60 69 77 73 76 80 82 57 62 57 57 83 76 72 75 87 72 94 77 85 59 82 86 69 62 80 95 73 83 94 79 85 91 68 85 74 93 95 68 75 89 93 83 78 95 78 83 77 81 85 66 92 63 65 75 78 67 91 77 74 59 86 77 76 90 67 70 64\\r\\n', 'output': ['104\\r\\n']}, {'input': '91\\r\\n94 98 96 94 95 98 98 95 98 94 94 98 95 95 99 97 97 94 95 98 94 98 96 98 96 98 97 95 94 94 94 97 94 96 98 98 98 94 96 95 94 95 97 97 97 98 94 98 96 95 98 96 96 98 94 97 96 98 97 95 97 98 94 95 94 94 97 94 96 97 97 93 94 95 95 94 96 98 97 96 94 98 98 96 96 96 96 96 94 96 97\\r\\n', 'output': ['33\\r\\n']}, {'input': '92\\r\\n44 28 32 29 41 41 36 39 40 39 41 35 41 28 35 27 41 34 28 38 43 43 41 38 27 26 28 36 30 29 39 32 35 35 32 30 39 30 37 27 41 41 28 30 43 31 35 33 36 28 44 40 41 35 31 42 37 38 37 34 39 40 27 40 33 33 44 43 34 33 34 34 35 38 38 37 30 39 35 41 45 42 41 32 33 33 31 30 43 41 43 43\\r\\n', 'output': ['145\\r\\n']}, {'input': '93\\r\\n46 32 52 36 39 30 57 63 63 30 32 44 27 59 46 38 40 45 44 62 35 36 51 48 39 58 36 51 51 51 48 58 59 36 29 35 31 49 64 60 34 38 42 56 33 42 52 31 63 34 45 51 35 45 33 53 33 62 31 38 66 29 51 54 28 61 32 45 57 41 36 34 47 36 31 28 67 48 52 46 32 40 64 58 27 53 43 57 34 66 43 39 26\\r\\n', 'output': ['76\\r\\n']}, {'input': '94\\r\\n56 55 54 31 32 42 46 29 24 54 40 40 20 45 35 56 32 33 51 39 26 56 21 56 51 27 29 39 56 52 54 43 43 55 48 51 44 49 52 49 23 19 19 28 20 26 45 33 35 51 42 36 25 25 38 23 21 35 54 50 41 20 37 28 42 20 22 43 37 34 55 21 24 38 19 41 45 34 19 33 44 54 38 31 23 53 35 32 47 40 39 31 20 34\\r\\n', 'output': ['15\\r\\n']}, {'input': '95\\r\\n57 71 70 77 64 64 76 81 81 58 63 75 81 77 71 71 71 60 70 70 69 67 62 64 78 64 69 62 76 76 57 70 68 77 70 68 73 77 79 73 60 57 69 60 74 65 58 75 75 74 73 73 65 75 72 57 81 62 62 70 67 58 76 57 79 81 68 64 58 77 70 59 79 64 80 58 71 59 81 71 80 64 78 80 78 65 70 68 78 80 57 63 64 76 81\\r\\n', 'output': ['11\\r\\n']}, {'input': '96\\r\\n96 95 95 95 96 97 95 97 96 95 98 96 97 95 98 96 98 96 98 96 98 95 96 95 95 95 97 97 95 95 98 98 95 96 96 95 97 96 98 96 95 97 97 95 97 97 95 94 96 96 97 96 97 97 96 94 94 97 95 95 95 96 95 96 95 97 97 95 97 96 95 94 97 97 97 96 97 95 96 94 94 95 97 94 94 97 97 97 95 97 97 95 94 96 95 95\\r\\n', 'output': ['13\\r\\n']}, {'input': '97\\r\\n14 15 12 12 13 15 12 15 12 12 12 12 12 14 15 15 13 12 15 15 12 12 12 13 14 15 15 13 14 15 14 14 14 14 12 13 12 13 13 12 15 12 13 13 15 12 15 13 12 13 13 13 14 13 12 15 14 13 14 15 13 14 14 13 14 12 15 12 14 12 13 14 15 14 13 15 13 12 15 15 15 13 15 15 13 14 16 16 16 13 15 13 15 14 15 15 15\\r\\n', 'output': ['104\\r\\n']}, {'input': '98\\r\\n37 69 35 70 58 69 36 47 41 63 60 54 49 35 55 50 35 53 52 43 35 41 40 49 38 35 48 70 42 35 35 65 56 54 44 59 59 48 51 49 59 67 35 60 69 35 58 50 35 44 48 69 41 58 44 45 35 47 70 61 49 47 37 39 35 51 44 70 72 65 36 41 63 63 48 66 45 50 50 71 37 52 72 67 72 39 72 39 36 64 48 72 69 49 45 72 72 67\\r\\n', 'output': ['100\\r\\n']}, {'input': '99\\r\\n31 31 16 15 19 31 19 22 29 27 12 22 28 30 25 33 26 25 19 22 34 21 17 33 31 22 16 26 22 30 31 17 13 33 13 17 28 25 18 33 27 22 31 22 13 27 20 22 23 15 24 32 29 13 16 20 32 33 14 33 19 27 16 28 25 17 17 28 18 26 32 33 19 23 30 13 14 23 24 28 14 28 22 20 30 14 24 23 17 29 18 28 29 21 28 18 16 24 32\\r\\n', 'output': ['107\\r\\n']}, {'input': '100\\r\\n37 54 39 29 32 49 21 13 34 21 16 42 34 27 16 26 7 34 51 9 11 27 16 40 36 7 48 52 30 42 42 52 51 11 32 26 6 7 28 54 48 51 6 54 42 20 51 48 46 4 4 31 47 6 9 16 8 23 36 50 49 30 47 37 45 24 48 26 8 50 18 24 27 13 39 7 37 34 5 43 42 19 34 23 52 38 35 6 29 11 53 49 21 29 36 22 45 33 51 22\\r\\n', 'output': ['50\\r\\n']}, {'input': '100\\r\\n41 5 20 23 5 47 28 28 64 5 12 14 34 56 22 48 6 52 39 55 62 40 24 54 39 28 56 27 35 51 14 24 38 10 55 20 39 62 52 2 30 55 49 48 15 23 59 44 31 28 66 29 62 59 31 13 28 12 50 45 41 47 29 27 64 66 14 39 62 22 44 63 24 5 63 17 42 7 25 41 49 33 31 51 63 3 37 66 19 9 2 40 16 45 56 21 34 29 39 61\\r\\n', 'output': ['59\\r\\n']}, {'input': '100\\r\\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95\\r\\n', 'output': ['99\\r\\n']}, {'input': '100\\r\\n81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n2 1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n100 99\\r\\n', 'output': ['0\\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 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['197\\r\\n']}, {'input': '100\\r\\n87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87\\r\\n', 'output': ['0\\r\\n']}, {'input': '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': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n2 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 3 2\\r\\n', 'output': ['2\\r\\n']}]","id":89} {"difficulty":2100,"lang":"Java 6","lang_cluster":"Java","src_uid":"05f251de93536024c05fbd77ed01b70b","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\n\npublic class Test03 {\n\n\tpublic void run() throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString line = br.readLine();\n\t\tString[] lines = line.split(\"\\\\s+\");\n\t\tint n = Integer.parseInt(lines[0]);\n\t\tint m = Integer.parseInt(lines[1]);\n\t\t\n\t\tboolean[] f = new boolean[n+1];\n\t\t\n\t\tint ret = 0;\n\t\tfor(int i = 1; i <= n; i++){\n\t\t\tif(!f[i]){\n\t\t\t\tret++;\n\t\t\t\tif(i == n){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint yoko = 1;\n\t\t\t\tint tate = 1;\n\t\t\t\tint x = i;\n\t\t\t\tint y = 1;\n\t\t\t\tint motox = x;\n\t\t\t\tint motoy = y;\n\t\t\t\twhile(true){\n\t\t\t\t\tx += yoko;\n\t\t\t\t\ty += tate;\n\t\t\t\t\tif(x == 1 && y == 1){\n\t\t\t\t\t\tyoko = 1;\n\t\t\t\t\t\ttate = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(x == n && y == 1){\n\t\t\t\t\t\tyoko = -1;\n\t\t\t\t\t\ttate = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(x == 1 && y == m){\n\t\t\t\t\t\tyoko = 1;\n\t\t\t\t\t\ttate = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(x == n && y == m){\n\t\t\t\t\t\tyoko = -1;\n\t\t\t\t\t\ttate = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(x == 1){\n\t\t\t\t\t\tyoko = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(x == n){\n\t\t\t\t\t\tyoko = -1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(y == 1){\n\t\t\t\t\t\ttate = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(y == m){\n\t\t\t\t\t\ttate = -1;\n\t\t\t\t\t}\n\t\t\t\t\tif(y == 1){\n\t\t\t\t\t\tf[x] = true;\n\t\t\t\t\t}\n\t\t\t\t\tif(x == motox && y == motoy && yoko == 1 && tate == 1){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tSystem.out.println(ret);\n\t}\n\t\n\t\/**\n\t * @param args\n\t *\/\n\tpublic static void main(String[] args) throws Exception{\n\t\tTest03 t = new Test03();\n\t\tt.run();\n\t}\n\n}\n","description":"Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.More formally, first one of four diagonal directions is chosen and the billiard ball moves in that direction. When it reaches the square located on the board's edge, the billiard ball reflects from it; it changes the direction of its movement by 90 degrees and continues moving. Specifically, having reached a corner square, the billiard ball is reflected twice and starts to move the opposite way. While it moves, the billiard ball can make an infinite number of reflections. At any square of its trajectory the billiard ball can stop and on that the move is considered completed. It is considered that one billiard ball a beats another billiard ball b if a can reach a point where b is located.You are suggested to find the maximal number of billiard balls, that pairwise do not beat each other and that can be positioned on a chessboard n\u2009\u00d7\u2009m in size.","input_specification":"The first line contains two integers n and m (2\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106).","output_specification":"Print a single number, the maximum possible number of billiard balls that do not pairwise beat each other. Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is preferred to use cin (also you may use the %I64d specificator).","notes":null,"sample_inputs":["3 4","3 3"],"sample_outputs":["2","3"],"human_solution":"import 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 F {\n\n\t\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tint n = sc.nextInt(), m = sc.nextInt();\n\t\tUnionFind uf = new UnionFind(m);\n\t\tint[] r = new int[m];\n\t\tArrays.fill(r, -1);\n\t\tfor(int c = 0; c < m; ++c)\n\t\t{\n\t\t\tint x = (c + n - 1)%(2 * m - 2);\n\t\t\tif(x >= m)\n\t\t\t\tx = 2 * m - x - 2;\n\t\t\tr[x] = uf.union(c, r[x]);\n\t\t\tint cc = m - 1 - c;\n\t\t\tint y = (cc + n - 1)%(2 * m - 2);\n\t\t\tif(y >= m)\n\t\t\t\ty = 2 * m - y - 2;\n\t\t\ty = m - 1 - y;\n\t\t\tr[y] = uf.union(m - 1 - cc, r[y]);\n\t\t}\n\t\tout.println(uf.sets);\n\t\tout.flush();\n\t\tout.close();\n\t}\n\t\n\tstatic class UnionFind\n\t{\n\t\tint[] rank, p;\n\t\tint sets;\n\t\t\n\t\tUnionFind(int N)\n\t\t{\n\t\t\trank = new int[N];\n\t\t\tp = new int[N];\n\t\t\tfor(int i = 0; i < N; ++i)\n\t\t\t\tp[i] = i;\n\t\t\tsets = N;\n\t\t}\n\t\t\n\t\tint find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); }\n\t\t\n\t\tint union(int x, int y)\n\t\t{\n\t\t\tx = find(x);\n\t\t\tif(y == -1)\n\t\t\t\treturn x;\n\t\t\ty = find(y);\n\t\t\t\n\t\t\tif(x == y)\n\t\t\t\treturn x;\n\t\t\tif(rank[x] > rank[y])\n\t\t\t\tp[y] = x;\n\t\t\telse \n\t\t\t{\n\t\t\t\tp[x] = y;\n\t\t\t\tif(rank[x] == rank[y])\n\t\t\t\t\t++rank[y];\n\t\t\t}\n\t\t\t--sets;\n\t\t\treturn p[x];\n\t\t}\n\t}\n\n\tstatic class Scanner \n\t{\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n\n\t\tpublic String next() throws IOException \n\t\t{\n\t\t\twhile (st == null || !st.hasMoreTokens()) \n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {return Integer.parseInt(next());}\n\n\t\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\t\tpublic String nextLine() throws IOException {return br.readLine();}\n\n\t\tpublic double nextDouble() throws IOException\n\t\t{\n\t\t\tString x = next();\n\t\t\tStringBuilder sb = new StringBuilder(\"0\");\n\t\t\tdouble res = 0, f = 1;\n\t\t\tboolean dec = false, neg = false;\n\t\t\tint start = 0;\n\t\t\tif(x.charAt(0) == '-')\n\t\t\t{\n\t\t\t\tneg = true;\n\t\t\t\tstart++;\n\t\t\t}\n\t\t\tfor(int i = start; i < x.length(); i++)\n\t\t\t\tif(x.charAt(i) == '.')\n\t\t\t\t{\n\t\t\t\t\tres = Long.parseLong(sb.toString());\n\t\t\t\t\tsb = new StringBuilder(\"0\");\n\t\t\t\t\tdec = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsb.append(x.charAt(i));\n\t\t\t\t\tif(dec)\n\t\t\t\t\t\tf *= 10;\n\t\t\t\t}\n\t\t\tres += Long.parseLong(sb.toString()) \/ f;\n\t\t\treturn res * (neg?-1:1);\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {return br.ready();}\n\n\n\t}\n}","testcases":"[{'input': '3 4\\r\\n', 'output': ['2']}, {'input': '3 3\\r\\n', 'output': ['3']}, {'input': '2 2\\r\\n', 'output': ['2']}, {'input': '4 3\\r\\n', 'output': ['2']}, {'input': '2 3\\r\\n', 'output': ['2']}, {'input': '4 4\\r\\n', 'output': ['4']}, {'input': '4 6\\r\\n', 'output': ['2']}, {'input': '4 7\\r\\n', 'output': ['4']}, {'input': '5 7\\r\\n', 'output': ['3']}, {'input': '5 13\\r\\n', 'output': ['5']}, {'input': '7 10\\r\\n', 'output': ['4']}, {'input': '7 21\\r\\n', 'output': ['3']}, {'input': '7 61\\r\\n', 'output': ['7']}, {'input': '8 50\\r\\n', 'output': ['8']}, {'input': '8 8\\r\\n', 'output': ['8']}, {'input': '9 9\\r\\n', 'output': ['9']}, {'input': '9 256\\r\\n', 'output': ['2']}, {'input': '10 10\\r\\n', 'output': ['10']}, {'input': '999 999\\r\\n', 'output': ['999']}, {'input': '1000000 1000000\\r\\n', 'output': ['1000000']}, {'input': '2311 7771\\r\\n', 'output': ['211']}, {'input': '146412 710630\\r\\n', 'output': ['3572']}, {'input': '943547 987965\\r\\n', 'output': ['1347']}, {'input': '35329 689665\\r\\n', 'output': ['1537']}, {'input': '672961 948978\\r\\n', 'output': ['2']}, {'input': '524288 131072\\r\\n', 'output': ['2']}, {'input': '293492 654942\\r\\n', 'output': ['2']}, {'input': '962963 1000000\\r\\n', 'output': ['37038']}, {'input': '7 1000000\\r\\n', 'output': ['4']}, {'input': '999999 1000000\\r\\n', 'output': ['2']}, {'input': '666667 1000000\\r\\n', 'output': ['333334']}, {'input': '384 187\\r\\n', 'output': ['2']}, {'input': '238 116\\r\\n', 'output': ['2']}, {'input': '993 342\\r\\n', 'output': ['32']}, {'input': '848 271\\r\\n', 'output': ['2']}, {'input': '702 200\\r\\n', 'output': ['2']}, {'input': '9516 2202\\r\\n', 'output': ['2']}, {'input': '1498 9704\\r\\n', 'output': ['2']}, {'input': '2482 6269\\r\\n', 'output': ['2']}, {'input': '3466 4770\\r\\n', 'output': ['2']}, {'input': '4449 1336\\r\\n', 'output': ['2']}, {'input': '604630 225648\\r\\n', 'output': ['2']}, {'input': '503832 242363\\r\\n', 'output': ['2']}, {'input': '403034 430556\\r\\n', 'output': ['2']}, {'input': '302237 618749\\r\\n', 'output': ['5']}, {'input': '201439 635463\\r\\n', 'output': ['3']}, {'input': '576709 834208\\r\\n', 'output': ['562']}, {'input': '97905 599257\\r\\n', 'output': ['233']}, {'input': '364915 516421\\r\\n', 'output': ['343']}, {'input': '222403 592339\\r\\n', 'output': ['2203']}, {'input': '543425 776321\\r\\n', 'output': ['77633']}, {'input': '977965 896468\\r\\n', 'output': ['81498']}, {'input': '829981 586711\\r\\n', 'output': ['14311']}, {'input': '429181 515017\\r\\n', 'output': ['85837']}, {'input': '198441 446491\\r\\n', 'output': ['49611']}, {'input': '117806 188489\\r\\n', 'output': ['23562']}, {'input': '893011 315181\\r\\n', 'output': ['52531']}, {'input': '701905 526429\\r\\n', 'output': ['175477']}, {'input': '863029 287677\\r\\n', 'output': ['287677']}, {'input': '871866 348747\\r\\n', 'output': ['174374']}, {'input': '12 5\\r\\n', 'output': ['2']}, {'input': '21 15\\r\\n', 'output': ['3']}, {'input': '12 9\\r\\n', 'output': ['2']}, {'input': '720 972\\r\\n', 'output': ['2']}]","id":90} {"difficulty":1800,"lang":"Java 8","lang_cluster":"Java","src_uid":"0a9cabb857949e818453ffe411f08f95","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Aeroui\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskD solver = new TaskD();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskD {\n public void solve(int testNumber, Scanner in, PrintWriter out) {\n int S = in.nextInt();\n int a = in.nextInt();\n int b = in.nextInt();\n int c = in.nextInt();\n\n int sum = a + b + c;\n if (sum == 0) {\n out.printf(\"%.6f %.6f %.6f\", 0, 0, 0);\n return;\n }\n\n double da = (double) a \/ (double) sum;\n double db = (double) b \/ (double) sum;\n double dc = (double) c \/ (double) sum;\n\n double ans1 = da * S;\n double ans2 = db * S;\n double ans3 = dc * S;\n\n out.printf(\"%.12f %.12f %.12f\", ans1, ans2, ans3);\n }\n\n }\n}\n\n","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"],"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]100000) while (true);\n x = Integer.parseInt(st.nextToken());\n if (x<2 || x>1000000000) while (true);\n st = new StringTokenizer(br.readLine().trim());\n a = new int[n];\n for (int i=0; i1000000000) while (true);\n }\n br.close();\n }\n catch (Exception e) {\n while (true);\n }\n \n System.out.println(solve(n,x,a));\n }\n \n public static void main(String[] args) throws Exception {\n \/*Random rnd = new Random();\n int it = 0;\n while (true) {\n it++;\n if (it%1000==0) System.out.println(it);\n int n = rnd.nextInt(11);\n int x = rnd.nextInt(100-2+1)+2;\n int max = rnd.nextInt(100) + 1;\n int[] a = new int[n];\n for (int i=0; i= 0; i--) {\n sum = sum + arr[i];\n max = Math.max(max, sum);\n }\n return max;\n }\n\n long maxPrefix(int[] arr) {\n long max = Long.MIN_VALUE;\n long sum = 0;\n for (int a : arr) {\n sum = sum + a;\n max = Math.max(max, sum);\n }\n return max;\n }\n\n long maxWithin(int[] arr) {\n long max = Long.MIN_VALUE;\n long sum = 0;\n for (int a : arr) {\n sum = Math.max(sum + a, 0);\n max = Math.max(max, sum);\n }\n return max;\n }\n\n \/* -----: Template :----- *\/\n static InputReader in;\n static PrintWriter out;\n\n public static void main(String[] args) {\n try (PrintWriter o = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))) {\n in = new InputReader(System.in);\n out = o;\n int q = multipleIndependent ? in.nextInt() : 1;\n while (q-- > 0) {\n new P75D().run();\n }\n }\n }\n\n static Integer[] toWrapper(int[] arr) {\n Integer[] res = new Integer[arr.length];\n for (int i = 0; i < arr.length; i++) {\n res[i] = arr[i];\n }\n return res;\n }\n\n static Integer[][] toWrapper(int[][] arr) {\n Integer[][] res = new Integer[arr.length][];\n for (int i = 0; i < arr.length; i++) {\n res[i] = toWrapper(arr[i]);\n }\n return res;\n }\n\n static Long[] toWrapper(long[] arr) {\n Long[] res = new Long[arr.length];\n for (int i = 0; i < arr.length; i++) {\n res[i] = arr[i];\n }\n return res;\n }\n\n static Long[][] toWrapper(long[][] arr) {\n Long[][] res = new Long[arr.length][];\n for (int i = 0; i < arr.length; i++) {\n res[i] = toWrapper(arr[i]);\n }\n return res;\n }\n\n static class InputReader {\n\n private final BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n int bufferSize = 32 * 1024;\n reader = new BufferedReader(new InputStreamReader(stream), bufferSize);\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 String nextLine() {\n if (true) {\n throw new RuntimeException(\"nextLine: not tested\");\n }\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 StringBuilder sb = new StringBuilder();\n return tokenizer.nextToken(\"\\n\");\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 int[] nextIntArray(int n) {\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] nextLongArray(int n) {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextIntArray(m);\n }\n return map;\n }\n\n public long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextLongArray(m);\n }\n return map;\n }\n\n public char[][] nextCharMap(int n) {\n char[][] map = new char[n][];\n for (int i = 0; i < n; i++) {\n map[i] = next().toCharArray();\n }\n return map;\n }\n }\n}\n","description":"Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.This problem is similar to a standard problem but it has a different format and constraints.In the standard problem you are given an array of integers, and you have to find one or more consecutive elements in this array where their sum is the maximum possible sum.But in this problem you are given n small arrays, and you will create one big array from the concatenation of one or more instances of the small arrays (each small array could occur more than once). The big array will be given as an array of indexes (1-based) of the small arrays, and the concatenation should be done in the same order as in this array. Then you should apply the standard problem mentioned above on the resulting big array.For example let's suppose that the small arrays are {1, 6, -2}, {3, 3} and {-5, 1}. And the indexes in the big array are {2, 3, 1, 3}. So the actual values in the big array after formatting it as concatenation of the small arrays will be {3, 3, -5, 1, 1, 6, -2, -5, 1}. In this example the maximum sum is 9.Can you help Mostafa solve this problem?","input_specification":"The first line contains two integers n and m, n is the number of the small arrays (1\u2009\u2264\u2009n\u2009\u2264\u200950), and m is the number of indexes in the big array (1\u2009\u2264\u2009m\u2009\u2264\u2009250000). Then follow n lines, the i-th line starts with one integer l which is the size of the i-th array (1\u2009\u2264\u2009l\u2009\u2264\u20095000), followed by l integers each one will be greater than or equal -1000 and less than or equal 1000. The last line contains m integers which are the indexes in the big array, and you should concatenate the small arrays in the same order, and each index will be greater than or equal to 1 and less than or equal to n. The small arrays are numbered from 1 to n in the same order as given in the input. Some of the given small arrays may not be used in big array. Note, that the array is very big. So if you try to build it straightforwardly, you will probably get time or\/and memory limit exceeded.","output_specification":"Print one line containing the maximum sum in the big array after formatting it as described above. You must choose at least one element for the sum, i. e. it cannot be empty. Please, do not use %lld specificator to write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).","notes":null,"sample_inputs":["3 4\n3 1 6 -2\n2 3 3\n2 -5 1\n2 3 1 3","6 1\n4 0 8 -3 -10\n8 3 -2 -5 10 8 -9 -5 -4\n1 0\n1 -3\n3 -8 5 6\n2 9 6\n1"],"sample_outputs":["9","8"],"human_solution":"\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class P75D {\n\n static boolean multipleIndependent = false;\n\n void run() {\n int n = in.nextInt(), m = in.nextInt();\n int[][] arrays = new int[n][];\n for (int i = 0; i < n; i++) {\n arrays[i] = in.nextIntArray(in.nextInt());\n }\n int[] bigArray = in.nextIntArray(m);\n long[] sums = new long[n];\n long[] maxPrefixes = new long[n];\n long[] maxPostfixes = new long[n];\n long[] maxWithins = new long[n];\n for (int i = 0; i < n; i++) {\n sums[i] = sum(arrays[i]);\n maxPrefixes[i] = maxPrefix(arrays[i]);\n maxPostfixes[i] = maxPostfix(arrays[i]);\n maxWithins[i] = maxWithin(arrays[i]);\n }\n long max = Long.MIN_VALUE;\n long[][] dp = new long[m][2];\n dp[0][0] = maxWithins[bigArray[0] - 1];\n dp[0][1] = maxPostfixes[bigArray[0] - 1];\n for (int i = 1; i < m; i++) {\n int curArr = bigArray[i] - 1;\n dp[i][0] = Math.max(maxWithins[curArr], dp[i - 1][1] + maxPrefixes[curArr]);\n dp[i][1] = Math.max(maxPostfixes[curArr], dp[i - 1][1] + sums[curArr]);\n }\n for (long[] ls : dp) {\n max = Math.max(max, ls[0]);\n max = Math.max(max, ls[1]);\n }\n out.println(max);\n }\n\n long sum(int[] arr) {\n long sum = 0;\n for (int a : arr) {\n sum += a;\n }\n return sum;\n }\n\n long maxPostfix(int[] arr) {\n long max = Long.MIN_VALUE;\n long sum = 0;\n for (int i = arr.length - 1; i >= 0; i--) {\n sum = sum + arr[i];\n max = Math.max(max, sum);\n }\n return max;\n }\n\n long maxPrefix(int[] arr) {\n long max = Long.MIN_VALUE;\n long sum = 0;\n for (int a : arr) {\n sum = sum + a;\n max = Math.max(max, sum);\n }\n return max;\n }\n\n long maxWithin(int[] arr) {\n long max = Long.MIN_VALUE;\n long sum = 0;\n for (int a : arr) {\n sum = Math.max(sum + a, a);\n max = Math.max(max, sum);\n }\n return max;\n }\n\n \/* -----: Template :----- *\/\n static InputReader in;\n static PrintWriter out;\n\n public static void main(String[] args) {\n try (PrintWriter o = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))) {\n in = new InputReader(System.in);\n out = o;\n int q = multipleIndependent ? in.nextInt() : 1;\n while (q-- > 0) {\n new P75D().run();\n }\n }\n }\n\n static Integer[] toWrapper(int[] arr) {\n Integer[] res = new Integer[arr.length];\n for (int i = 0; i < arr.length; i++) {\n res[i] = arr[i];\n }\n return res;\n }\n\n static Integer[][] toWrapper(int[][] arr) {\n Integer[][] res = new Integer[arr.length][];\n for (int i = 0; i < arr.length; i++) {\n res[i] = toWrapper(arr[i]);\n }\n return res;\n }\n\n static Long[] toWrapper(long[] arr) {\n Long[] res = new Long[arr.length];\n for (int i = 0; i < arr.length; i++) {\n res[i] = arr[i];\n }\n return res;\n }\n\n static Long[][] toWrapper(long[][] arr) {\n Long[][] res = new Long[arr.length][];\n for (int i = 0; i < arr.length; i++) {\n res[i] = toWrapper(arr[i]);\n }\n return res;\n }\n\n static class InputReader {\n\n private final BufferedReader reader;\n private StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n int bufferSize = 32 * 1024;\n reader = new BufferedReader(new InputStreamReader(stream), bufferSize);\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 String nextLine() {\n if (true) {\n throw new RuntimeException(\"nextLine: not tested\");\n }\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 StringBuilder sb = new StringBuilder();\n return tokenizer.nextToken(\"\\n\");\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 int[] nextIntArray(int n) {\n int[] arr = new int[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n return arr;\n }\n\n public long[] nextLongArray(int n) {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n return arr;\n }\n\n public int[][] nextIntMap(int n, int m) {\n int[][] map = new int[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextIntArray(m);\n }\n return map;\n }\n\n public long[][] nextLongMap(int n, int m) {\n long[][] map = new long[n][m];\n for (int i = 0; i < n; i++) {\n map[i] = nextLongArray(m);\n }\n return map;\n }\n\n public char[][] nextCharMap(int n) {\n char[][] map = new char[n][];\n for (int i = 0; i < n; i++) {\n map[i] = next().toCharArray();\n }\n return map;\n }\n }\n}\n","testcases":"[{'input': '3 4\\r\\n3 1 6 -2\\r\\n2 3 3\\r\\n2 -5 1\\r\\n2 3 1 3\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 1\\r\\n4 0 8 -3 -10\\r\\n8 3 -2 -5 10 8 -9 -5 -4\\r\\n1 0\\r\\n1 -3\\r\\n3 -8 5 6\\r\\n2 9 6\\r\\n1\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 3\\r\\n6 6 8 -5 4 10 -2\\r\\n1 -2\\r\\n1 -10\\r\\n5 -10 10 8 -7 -10\\r\\n2 4 1\\r\\n', 'output': ['24\\r\\n']}, {'input': '7 7\\r\\n2 -8 -7\\r\\n5 2 -10 10 -2 4\\r\\n7 10 -8 9 8 9 -10 -3\\r\\n6 0 6 -9 9 -6 -9\\r\\n4 -6 -9 10 -6\\r\\n3 -8 4 10\\r\\n7 -1 -3 10 -8 -6 -3 6\\r\\n4 5 4 6 6 1 7\\r\\n', 'output': ['20\\r\\n']}, {'input': '4 8\\r\\n8 0 3 -9 -10 0 -1 6 -4\\r\\n3 -10 -7 2\\r\\n10 6 -2 -9 0 -7 -4 -7 7 -1 2\\r\\n3 -5 1 -4\\r\\n1 1 1 1 4 4 3 3\\r\\n', 'output': ['14\\r\\n']}, {'input': '2 1\\r\\n2 -4 -6\\r\\n5 6 8 3 5 -2\\r\\n1\\r\\n', 'output': ['-4\\r\\n']}, {'input': '9 4\\r\\n4 8 -2 -10 6\\r\\n10 -4 9 6 -2 -8 6 7 2 -6 2\\r\\n8 -10 1 9 9 -10 2 -10 -9\\r\\n7 3 -10 -10 -6 3 -7 0\\r\\n5 -4 -8 2 -5 2\\r\\n1 -3\\r\\n4 -9 0 7 -4\\r\\n7 4 -5 4 -8 -4 0 -1\\r\\n9 2 5 -10 4 -10 -2 6 5 10\\r\\n3 6 4 6\\r\\n', 'output': ['19\\r\\n']}, {'input': '3 1\\r\\n7 4 8 1 -7 -9 -8 -9\\r\\n10 5 -5 -5 -9 -1 7 4 -1 -4 4\\r\\n8 -7 7 4 10 -6 3 -6 9\\r\\n2\\r\\n', 'output': ['11\\r\\n']}, {'input': '7 3\\r\\n7 -9 -6 0 -6 -5 1 -9\\r\\n9 4 4 3 -6 -4 8 4 5 -6\\r\\n1 -4\\r\\n7 -3 -9 -9 1 -4 8 7\\r\\n2 6 3\\r\\n7 0 -5 -5 -2 -8 2 -1\\r\\n8 4 1 6 -7 -2 10 -8 -2\\r\\n3 1 5\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 9\\r\\n8 -10 10 3 4 -9 0 3 9\\r\\n4 9 2 -1 6\\r\\n3 -10 -10 -5\\r\\n7 10 -6 7 1 -8 3 4\\r\\n8 -8 9 3 -1 0 1 -7 -7\\r\\n1 -4\\r\\n3 2 3 2 4 4 1 1 1\\r\\n', 'output': ['68\\r\\n']}, {'input': '3 6\\r\\n3 -1 -1 -1\\r\\n4 -2 -2 -2 -2\\r\\n5 -3 -3 -3 -3 -3\\r\\n1 2 3 1 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n11 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n10 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['11\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1\\r\\n1 -1\\r\\n1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1\\r\\n1 0\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 1 0 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\n6 0 0 0 0 0 0\\r\\n6 0 0 0 0 0 0\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '14 14\\r\\n6 -1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 -1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\\r\\n', 'output': ['82\\r\\n']}]","id":93} {"difficulty":2500,"lang":"Java 8","lang_cluster":"Java","src_uid":"1503f0379bf8d7f25c191ddea9278842","execute_outcome":"RUNTIME_ERROR","source_code":"import javax.swing.*;\nimport java.io.PrintWriter;\nimport java.util.Scanner;\n\npublic class SaveTheCity {\n public static int n;\n public static Vertices[] vertices;\n static class Vertices{\n int x,y;\n Vertices(int x, int y){\n this.x=x;\n this.y=y;\n }\n }\n\n static long cross(int i, int j, int k){\n long x1= vertices[j].x-vertices[i].x;\n long y1= vertices[j].y-vertices[i].y;\n long x2= vertices[k].x-vertices[i].x;\n long y2= vertices[k].y-vertices[i].y;\n return x1*y2-x2*y1;\n }\n\n public static void main(String[] args) {\n Scanner cin= new Scanner(System.in);\n PrintWriter pw= new PrintWriter(System.out);\n n=cin.nextInt();\n vertices= new Vertices[n];\n for(int i=0;i0 && crossLeft>0){\n pw.println(0);\n return;\n }\n int x0 = vertices[i].x, y0 = vertices[i].y, x1 = vertices[i + 1].x, y1 = vertices[i + 1].y;\n if (crossRight > 0 || crossLeft > 0) {\n long p = (long) x0 * (y1 - y0) - (long) y0 * (x1 - x0);\n long q = y1 - y0;\n if (q < 0) {\n p = -p; q = -q;\n }\n if (crossRight > 0)\n r = Math.min(r, (int) (p \/ q));\n else\n l = Math.max(l, (int) ((p + q - 1) \/ q));\n }\n }\n pw.println(l<=r?r-l+1:0);\n\n }\n\n}\n","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"],"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":94} {"difficulty":1900,"lang":"Java 8","lang_cluster":"Java","src_uid":"1670a3d7dba83e29e98f0ac6fe4acb18","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(file);\n\n int N = sc.nextInt();\n boolean possible = true;\n boolean check = true;\n int[] numOfWord = new int[1001];\n int[] word = new int[N];\n\n for (int i = 0; i < N; i++) {\n int temp = sc.nextInt();\n numOfWord[temp]++;\n if (temp != 1 && numOfWord[temp] != 0)\n check = false;\n if ((temp != 1 && numOfWord[temp] > 1) || (!check && numOfWord[1] > 1)) {\n possible = false;\n break;\n }\n word[i] = temp;\n }\n\n if (!possible) {\n System.out.println(\"NO\");\n return;\n }\n\n System.out.println(\"YES\");\n\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < word[i] - 1; j++)\n System.out.print(1);\n System.out.println(0);\n }\n\n sc.close();\n\n }\n\n}\n","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"],"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":95} {"difficulty":2100,"lang":"Java 7","lang_cluster":"Java","src_uid":"1c74a21045b2d312f68565bdaaaa8a7b","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\npublic class CF229D {\n\tFastScanner in;\n\tPrintWriter out;\n\n\tvoid solve() {\n\t\tint n = in.nextInt();\n\t\tint[] h = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\th[i] = in.nextInt();\n\t\tint[] sum = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tsum[i] = (i == 0 ? 0 : sum[i - 1]) + h[i];\n\t\tint[][] dp = new int[n][n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t\tdp[i][j] = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tdp[i][0] = i;\n\t\tfor (int used = 0; used < n; used++)\n\t\t\tfor (int last = 0; last < n; last++)\n\t\t\t\tif (dp[used][last] != Integer.MAX_VALUE) {\n\t\t\t\t\tif (used < n - 1) \n\t\t\t\t\t\tdp[used + 1][last] = Math.min(dp[used + 1][last], dp[used][last] + 1);\n\t\t\t\t\tint curSum = sum[used] - (used > last ? sum[used - last - 1] : 0);\n\t\t\t\t\tif (sum[n - 1] - sum[used] < curSum)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tint l = 0, r = n - 1 - used;\n\t\t\t\t\twhile (r - l > 1) {\n\t\t\t\t\t\tint m = (l + r) \/ 2;\n\t\t\t\t\t\tif (sum[m] - sum[used] >= curSum) {\n\t\t\t\t\t\t\tr = m;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tl = m;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdp[used + r][used + 1] = Math.min(dp[used + r][used + 1], dp[used][last] + r - 1);\n\t\t\t\t}\n\t\tint ans = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tans = Math.min(ans, dp[n - 1][i]);\n\t\tout.println(ans);\n\t}\n\n\tvoid run() {\n\t\ttry {\n\t\t\tin = new FastScanner(new File(\"object.in\"));\n\t\t\tout = new PrintWriter(new File(\"object.out\"));\n\n\t\t\tsolve();\n\n\t\t\tout.close();\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tvoid runIO() {\n\n\t\tin = new FastScanner(System.in);\n\t\tout = new PrintWriter(System.out);\n\n\t\tsolve();\n\n\t\tout.close();\n\t}\n\n\tclass FastScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\n\t\tpublic FastScanner(File f) {\n\t\t\ttry {\n\t\t\t\tbr = new BufferedReader(new FileReader(f));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tpublic FastScanner(InputStream f) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(f));\n\t\t}\n\n\t\tString next() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\tString s = null;\n\t\t\t\ttry {\n\t\t\t\t\ts = 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\t\tif (s == null)\n\t\t\t\t\treturn null;\n\t\t\t\tst = new StringTokenizer(s);\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tboolean hasMoreTokens() {\n\t\t\twhile (st == null || !st.hasMoreTokens()) {\n\t\t\t\tString s = null;\n\t\t\t\ttry {\n\t\t\t\t\ts = 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\t\tif (s == null)\n\t\t\t\t\treturn false;\n\t\t\t\tst = new StringTokenizer(s);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew CF229D().runIO();\n\t}\n}","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"],"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":96} {"difficulty":2300,"lang":"Java 8","lang_cluster":"Java","src_uid":"2e1ab01d4d4440f33c840c4564a20a60","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*;\n\npublic class Test {\n\n static int[] a = new int[40_000_000];\n static int cnt;\n\n public static void main(String[] args) {\n Scanner sca = new Scanner(System.in);\n int n = sca.nextInt(), k = sca.nextInt();\n int[] ns = new int[n];\n\n for (int i = 0; i < n; i++) {\n ns[i] = sca.nextInt();\n segs(ns[i]);\n }\n\n Arrays.sort(a, 0, cnt);\n\/\/ System.out.println(Arrays.toString(Arrays.copyOf(a, cnt)));\n\n int prev = 2_000_000_000;\n for (int i = cnt - 1; i >= 0; i--) {\n if (a[i] == prev) continue;\n int d = a[i];\n\n \/\/ Compute sum;\n long s = 0, t = 0;\n for (int j = 0; j < ns.length; j++) {\n int r = (ns[j] + d - 1)\/d;\n t += r;\n s += r*d - ns[j];\n }\n\/\/ System.out.println(d + \" \" + s + \" \" + t);\n\n if (s <= k) {\n if (d < prev - 1) {\n long w = (k - s)\/t;\n d += w;\n }\n System.out.println(d);\n return;\n }\n prev = d;\n }\n }\n\n static void segs(int d) {\n for (int i = 1; i <= Math.sqrt(d); i++) {\n a[cnt++] = i;\n a[cnt++] = (d + i - 1)\/i;\n }\n }\n}\n","description":"Vladimir wants to modernize partitions in his office. To make the office more comfortable he decided to remove a partition and plant several bamboos in a row. He thinks it would be nice if there are n bamboos in a row, and the i-th from the left is ai meters high. Vladimir has just planted n bamboos in a row, each of which has height 0 meters right now, but they grow 1 meter each day. In order to make the partition nice Vladimir can cut each bamboo once at any height (no greater that the height of the bamboo), and then the bamboo will stop growing.Vladimir wants to check the bamboos each d days (i.e. d days after he planted, then after 2d days and so on), and cut the bamboos that reached the required height. Vladimir wants the total length of bamboo parts he will cut off to be no greater than k meters.What is the maximum value d he can choose so that he can achieve what he wants without cutting off more than k meters of bamboo?","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009k\u2009\u2264\u20091011)\u00a0\u2014 the number of bamboos and the maximum total length of cut parts, in meters. The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009109)\u00a0\u2014 the required heights of bamboos, in meters.","output_specification":"Print a single integer\u00a0\u2014 the maximum value of d such that Vladimir can reach his goal.","notes":"NoteIn the first example Vladimir can check bamboos each 3 days. Then he will cut the first and the second bamboos after 3 days, and the third bamboo after 6 days. The total length of cut parts is 2\u2009+\u20090\u2009+\u20091\u2009=\u20093 meters.","sample_inputs":["3 4\n1 3 5","3 40\n10 30 50"],"sample_outputs":["3","32"],"human_solution":"import java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\n\npublic class Test {\n\n static PrintWriter writer =\n new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\n public static void main(String[] args) {\n Test te = new Test();\n te.start();\n writer.flush();\n }\n\n int readInt() {\n int ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n long readLong() {\n long ans = 0;\n boolean neg = false;\n try {\n boolean start = false;\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '-') {\n start = true;\n neg = true;\n continue;\n } else if (c >= '0' && c <= '9') {\n start = true;\n ans = ans * 10 + c - '0';\n } else if (start) break;\n }\n } catch (IOException e) {\n }\n return neg ? -ans : ans;\n }\n\n String readLine() {\n StringBuilder b = new StringBuilder();\n try {\n for (int c = 0; (c = System.in.read()) != -1; ) {\n if (c == '\\n') {\n break;\n } else {\n b.append((char) (c));\n }\n }\n } catch (IOException e) {\n }\n return b.toString().trim();\n }\n\n void start() {\n int n = readInt();\n long k = readLong();\n int[] a = new int[n];\n for (int i = 0; i < n; k += a[i], i++) a[i] = readInt();\n long ans = Long.MIN_VALUE;\n for (long i = 1; i * i <= k; i++) {\n long c = k \/ i;\n for (int j = 0; j < n; j++) c -= (a[j] + i - 1) \/ i;\n if (c >= 0) ans = Math.max(ans, i);\n c = i;\n long d = k \/ i;\n for (int j = 0; j < n; j++) c -= (a[j] + d - 1) \/ d;\n if (c >= 0) ans = Math.max(ans, d);\n }\n writer.println(ans);\n }\n}\n","testcases":"[{'input': '3 4\\r\\n1 3 5\\r\\n', 'output': ['3']}, {'input': '3 40\\r\\n10 30 50\\r\\n', 'output': ['32']}, {'input': '20 53\\r\\n32 64 20 41 97 50 20 66 68 22 60 74 61 97 54 80 30 72 59 18\\r\\n', 'output': ['6']}, {'input': '100 82\\r\\n51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77 63 17 62 91 64\\r\\n', 'output': ['2']}, {'input': '10 99\\r\\n62 10 47 53 9 83 33 15 24 28\\r\\n', 'output': ['21']}, {'input': '100 7\\r\\n4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 3 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 6 1 8 10 4 10 3 4 10 5 5 4 10 4 5 3 7 10 2 7 3 6 9 6 1 6 5 5 4 6 6 4 4 1 5 1 6 6 6 8 8 6 2 6 3\\r\\n', 'output': ['1']}, {'input': '100 410302106\\r\\n708701895 820706056 319931052 87747886 427597767 380552276 441953043 627914953 659947840 374682702 32848823 733202611 778681308 386357954 194288786 550477660 271692803 659482338 843663264 766955734 740521063 625128385 445902179 406562646 306581113 777253591 335751008 653724087 196164337 107364480 605885600 953592822 341251658 213009532 18475568 302548407 127161667 282013297 361588641 228056767 593913695 407864420 508454792 126564216 262582118 867640132 551470079 89634672 597318626 168202079 ...', 'output': ['9108776']}, {'input': '100 5\\r\\n5 2 4 5 4 4 4 4 2 5 3 4 2 4 4 1 1 5 3 2 2 1 3 3 2 5 3 4 5 1 3 5 4 4 4 3 1 4 4 3 4 5 2 5 4 2 1 2 2 3 5 5 5 1 4 5 3 1 4 2 2 5 1 5 3 4 1 5 1 2 2 3 5 1 3 2 4 2 4 2 2 4 1 3 5 2 2 2 3 3 4 3 2 2 5 5 4 2 5 4\\r\\n', 'output': ['1']}, {'input': '100 2619\\r\\n1207 5971 951 8250 6594 219 9403 9560 2368 289 3502 6626 1009 828 2378 615 3092 3751 841 7454 8001 1345 1644 1021 7088 7083 2805 1971 7456 6494 3805 9279 8737 8994 2975 2566 6490 1720 3595 8721 8500 4850 9716 2076 9532 1077 8370 2809 2885 1838 6081 667 900 9786 5600 3707 8818 7580 6067 2215 1726 2171 2338 462 7592 9281 4104 1733 7223 6557 372 4197 9956 2098 6875 3226 9997 4214 8644 1237 259 5252 2379 1115 7452 9338 8430 5013 7906 7804 8339 4782 5329 4607 7632 2664 1437 7518 2674 8519\\r\\n', 'output': ['57']}, {'input': '100 1215752192\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...', 'output': ['1012157521']}, {'input': '100 1215752192\\r\\n999999946 999999929 999999985 999999928 999999948 999999955 999999957 999999905 999999990 999999969 999999913 999999989 999999983 999999918 999999936 999999924 999999994 999999919 999999996 999999944 999999968 999999951 999999923 999999941 999999964 999999943 999999987 999999970 999999920 999999974 999999904 999999903 999999915 999999980 999999961 999999978 999999981 999999902 999999965 999999998 999999958 999999938 999999984 999999992 999999947 999999960 999999911 999999967 999999916 99999...', 'output': ['1012157472']}, {'input': '2 948507270\\r\\n461613425 139535653\\r\\n', 'output': ['774828174']}, {'input': '1 1215752192\\r\\n1000000000\\r\\n', 'output': ['2215752192']}, {'input': '2 1215752192\\r\\n999999999 1000000000\\r\\n', 'output': ['1607876095']}, {'input': '100 1215752192\\r\\n33 37 57 77 50 53 88 83 76 89 79 28 73 25 5 15 22 29 97 7 46 69 51 52 81 14 9 35 27 74 66 2 84 59 10 1 19 39 40 99 78 82 100 95 3 21 44 75 62 12 58 36 72 31 26 98 64 34 63 41 65 4 86 85 32 96 71 11 94 60 56 45 8 13 47 61 80 43 67 49 87 68 55 48 16 18 54 90 42 20 70 92 38 30 17 24 91 6 93 23\\r\\n', 'output': ['12157572']}, {'input': '100 1\\r\\n73 83 99 13 69 2 60 3 68 46 1 87 58 39 21 84 7 82 55 80 33 40 4 16 20 50 78 5 62 94 95 66 75 42 65 63 72 76 11 45 56 37 93 91 98 52 74 71 49 90 8 53 38 85 86 27 100 92 97 32 59 34 14 22 19 79 51 89 18 64 31 44 6 29 47 10 41 30 70 81 24 9 26 35 15 17 36 43 25 61 77 57 88 96 12 54 28 48 23 67\\r\\n', 'output': ['1']}, {'input': '100 100\\r\\n87 37 55 61 98 38 79 11 32 56 23 27 83 36 41 9 94 82 57 7 39 19 1 29 77 59 78 35 70 50 30 26 64 21 46 5 18 60 93 74 3 73 34 14 22 91 8 69 12 10 58 89 17 65 80 63 71 15 31 33 66 45 90 20 86 76 96 81 40 6 85 25 42 44 2 100 16 51 95 49 62 47 4 52 43 28 99 97 53 48 13 72 68 88 54 75 84 67 24 92\\r\\n', 'output': ['2']}, {'input': '100 100\\r\\n999999910 999999966 999999964 999999957 999999907 999999927 999999953 999999963 999999931 999999906 999999952 999999988 999999983 999999994 999999916 999999904 999999905 999999938 999999948 999999992 999999918 999999944 999999989 999999943 999999914 999999915 999999928 999999950 999999936 999999987 999999998 999999939 999999965 999999973 999999932 999999949 999999991 999999933 999999990 999999955 999999997 999999968 999999980 999999982 999999986 999999979 999999926 999999976 999999972 999999911 99...', 'output': ['2']}, {'input': '100 100000\\r\\n899999965 899999950 899999914 899999983 899999967 899999981 899999978 899999973 899999989 899999924 899999996 899999998 899999935 899999943 899999942 899999917 899999962 899999906 899999985 899999986 899999961 899999910 899999988 899999994 899999909 899999915 899999936 899999960 899999908 899999913 899999903 899999959 899999926 899999945 899999916 899999976 899999971 899999933 899999955 899999901 899999958 899999927 900000000 899999905 899999949 899999999 899999979 899999931 899999966 899999956...', 'output': ['900000950']}, {'input': '100 2\\r\\n999999965 999999941 999999970 999999922 999999933 999999956 999999905 999999919 999999936 999999996 999999911 999999983 999999967 999999989 999999909 999999968 999999945 999999961 1000000000 999999952 999999925 999999990 999999927 999999998 999999918 999999992 999999946 999999962 999999969 999999908 999999957 999999994 999999984 999999903 999999974 999999914 999999937 999999916 999999924 999999932 999999940 999999991 999999901 999999904 999999986 999999976 999999972 999999960 999999979 999999943 999...', 'output': ['1']}, {'input': '100 1215752192\\r\\n180000001 90000001 340000001 290000001 390000001 820000001 550000001 150000001 160000001 530000001 750000001 610000001 700000001 560000001 440000001 100000001 40000001 330000001 80000001 650000001 190000001 510000001 970000001 960000001 570000001 950000001 670000001 520000001 900000001 360000001 240000001 1 980000001 860000001 590000001 690000001 770000001 250000001 60000001 920000001 850000001 930000001 990000001 540000001 350000001 300000001 790000001 660000001 460000001 810000001 1100000...', 'output': ['30116242']}, {'input': '100 1215752192\\r\\n810000000 700000000 730000000 240000000 230000000 890000000 460000000 840000000 150000000 340000000 740000000 950000000 600000000 590000000 220000000 620000000 380000000 670000000 940000000 140000000 640000000 820000000 110000000 690000000 530000000 500000000 10000000 780000000 540000000 920000000 360000000 410000000 20000000 770000000 190000000 450000000 100000000 560000000 660000000 960000000 130000000 440000000 870000000 350000000 910000000 710000000 50000000 580000000 790000000 18000000...', 'output': ['30119832']}, {'input': '100 999999999\\r\\n64000005 51000005 79000005 1000005 30000005 78000005 20000005 45000005 14000005 98000005 94000005 3000005 18000005 11000005 77000005 29000005 23000005 28000005 87000005 35000005 81000005 32000005 80000005 52000005 43000005 62000005 9000005 82000005 40000005 55000005 95000005 48000005 97000005 22000005 12000005 71000005 96000005 46000005 85000005 37000005 68000005 21000005 42000005 57000005 2000005 58000005 61000005 7000005 5 65000005 60000005 5000005 76000005 8000005 67000005 54000005 150000...', 'output': ['20101353']}, {'input': '89 143170360\\r\\n58136342 25320920 23598562 77298126 174420004 144312426 168306248 170891286 160878688 43920409 230231908 146886527 201374362 141132345 169776279 119795713 72262533 180806082 175928325 13801334 214375031 108100976 77371097 120243068 83166381 123818852 106517758 192481140 203068740 109131553 68223335 165738214 16788161 95976400 48301512 225437979 176593291 163193916 88645722 77369889 141963019 188448311 91235835 117489995 192981203 115612851 108468844 98981231 90303604 192784330 216556529 17657...', 'output': ['3674299']}, {'input': '100 21382489\\r\\n74347 342015 227927 170883 179659 267419 4139 254255 328851 420999 394671 157719 65571 219151 166495 372731 263031 197211 122615 56795 381507 162107 434163 390283 135779 385895 109451 153331 201599 284971 39243 236703 425387 337627 113839 8527 118227 48019 249867 241091 359567 306911 52407 429775 245479 416611 407835 377119 188435 12915 61183 21691 403447 69959 175271 192823 144555 223539 311299 324463 43631 320075 34855 205987 78735 333239 350791 271807 214763 127003 280583 26079 131391 2893...', 'output': ['399238']}, {'input': '85 392974281\\r\\n135122432 688346179 627475125 227530511 762996979 696745612 43309623 618466139 739530898 699156242 123434974 753228749 256432521 355493764 1310575 582743951 250412930 269007456 796396996 252414490 346388603 445084413 9139800 464301628 698333176 165882870 673927006 369287605 338076663 43982452 715672187 100515988 608952386 180923231 468277671 58604016 79047691 453111969 1392790 660077582 346201684 78864973 727032125 368518374 658645046 140338045 451773056 543259443 40309682 639223807 624468491...', 'output': ['10189005']}, {'input': '74 307992040\\r\\n25712595 314581257 180281298 241279635 7812872 463942587 412306023 141730974 117050506 405664629 213698153 42991117 75597501 180349465 184775100 245979929 158349784 436281048 24020958 345585991 153881634 438918076 443780007 275304230 168233653 180124859 326153869 63204443 381749478 471571421 60137632 441395251 99888597 85690086 344435116 228715868 144676703 165614065 201131327 374002069 128449651 249866947 439073682 90789 226963590 22613648 44219107 379590763 385204737 68592159 380755952 1133...', 'output': ['9350639']}, {'input': '82 232680857\\r\\n214384820 194426971 122391161 112867612 613191028 451285490 13480176 670332310 715100787 447306974 266651829 479462155 683963017 649450350 363031138 660946090 138122822 162510823 205005676 206755264 35171825 261770760 25816898 77405306 507922364 179252979 67415434 374776050 437367669 247010287 351261231 454392123 568850255 631948978 302520560 346717142 399937268 708468034 58588944 482532534 701420864 522531937 426577618 301597582 465232836 712813283 132168896 553638341 488162744 353132682 109...', 'output': ['6464213']}, {'input': '81 225181321\\r\\n464673856 259766874 151428382 165092289 301565936 275944272 53190566 228699728 202484103 581425566 593501908 481952762 75667852 482452106 71037874 142065300 121314893 382012941 415597262 175309676 118668552 414906594 15676715 118826462 575760642 480702765 514772031 592492064 623700691 228604161 341411187 110110471 540028328 480008057 176035622 464879536 582210016 310828080 26298730 370597960 236358272 112822681 627434070 558923108 86560527 52253048 428306722 525650651 478191610 141293670 3686...', 'output': ['6617953']}, {'input': '85 39741642\\r\\n653248031 198711388 449736864 399488433 231394448 307290625 624830719 606864682 417701118 504597833 235790410 144917935 121245580 691599190 209023249 375565345 13026118 247301917 154965662 145160087 491003979 533444244 340009469 473754193 350831337 311650210 192108331 361287978 141989965 209123743 538786070 629085917 621003231 389039245 159424450 562691983 137599427 257522398 549169725 448655085 69417043 69842470 196830897 206822641 564946522 363211302 412337578 402059412 709800120 495463241 3...', 'output': ['1130267']}, {'input': '82 39276289\\r\\n375290176 775401467 348253198 232660346 788584255 700278919 372292355 76268963 362902045 533754385 542265627 469422119 157702721 640027867 304628471 604441670 43344455 674166881 161368387 304432634 276903093 53873157 703733212 420658511 693409672 243912519 814362838 636137860 247035915 692675995 722037890 793089358 793412371 186982144 203492132 767797684 303521954 414139126 342551018 121884287 66342201 725143706 427848951 546720742 826485427 52152362 772707833 415040683 260331383 818934926 786...', 'output': ['1186008']}, {'input': '86 217245047\\r\\n448118979 8242410 269325400 136550942 81665862 435136661 380723521 204088284 144718332 277616238 183209888 465121539 531809073 396374432 429631843 697701951 254682494 180465650 466026043 560185566 246764520 644665011 410220277 651055946 327572722 143944241 256637127 281516848 242518229 271197904 538687466 235358726 161017257 596670903 709489752 267045869 321066139 130641827 186469459 671060551 502784454 353423241 153541053 633060834 579008016 643852881 535405979 291711547 528402934 143635844 ...', 'output': ['5557462']}, {'input': '100 107979284\\r\\n234496181 56581779 277337151 146398590 611613215 359782423 344499513 520451601 528707629 168031244 16332607 151451016 573136979 306610544 411540465 518272404 373512107 607156338 599866264 233830672 636984527 324575324 488027331 100367142 1425936 69175105 465847196 130876157 321854407 203643699 271878845 236343646 58533703 223017589 187115013 144339029 425921211 474726588 19046618 620263710 552123150 238363012 54914474 525329270 314606051 561855941 224267922 122725867 226675315 410289929 4658...', 'output': ['2582254']}, {'input': '100 999999999\\r\\n948999995 928999995 914999995 958999995 957999995 912999995 937999995 925999995 907999995 939999995 972999995 931999995 903999995 995999995 922999995 999999995 932999995 938999995 975999995 990999995 989999995 964999995 965999995 901999995 921999995 950999995 940999995 945999995 953999995 915999995 929999995 935999995 909999995 966999995 977999995 916999995 917999995 949999995 963999995 911999995 954999995 910999995 923999995 974999995 946999995 934999995 920999995 941999995 992999995 987999...', 'output': ['21282960']}, {'input': '100 1215752189\\r\\n996377103 993142378 988225596 988354985 999353050 987966818 992754211 998706105 989907653 996765270 991330932 998964883 992366044 988484374 999094272 993271767 997153437 990037042 989260708 987449262 996635881 991201543 994565657 989519486 991719099 993012989 997929771 989001930 995083213 992624822 999870606 988096207 995859547 994306879 991848488 994953824 992495433 991977877 990942765 999482439 996894659 987708040 995212602 995600769 987578651 997541604 994695046 997024048 988743152 99728...', 'output': ['1005752761']}, {'input': '100 1215752115\\r\\n950772395 962946962 969828239 994177373 986766767 985708109 956595014 999999992 989942741 993648044 982532135 978297503 992589386 994706702 974592200 952360382 962417633 979356161 993118715 948655079 957124343 986237438 970886897 951301724 947596421 980414819 980944148 965593607 987825425 964534949 988884083 973004213 991001399 966122936 956065685 975121529 982002806 973533542 997353347 969298910 992060057 991530728 999470663 995765360 974062871 996824018 998412005 965064278 997882676 95500...', 'output': ['25139105']}, {'input': '100 1215752126\\r\\n985209719 998151165 951931715 966721939 988907275 933443935 930670768 980587774 997226776 910334210 954704882 917729322 984285330 923275656 989831664 991680442 947309770 941763436 965797550 909409821 914031766 913107377 953780493 935292713 975041440 987058497 915880544 951007326 952856104 968570717 970419495 987982886 960251216 983360941 911258599 922351267 926973212 990756053 949158548 948234159 916804933 927897601 946385381 993529220 961175605 967646328 936217102 999999943 994453609 97319...', 'output': ['26353973']}, {'input': '72 139277746\\r\\n955936191 152507579 623418563 214536588 617597956 170119058 356132228 556000042 419904405 704360725 276347695 119728565 13150886 458009401 258577910 55150517 406271033 229975319 636871067 526380929 334348391 353733292 771778686 856178592 766635158 587146303 978562813 884246668 345970079 680091968 483033679 863310186 714781960 181602262 908321442 337078507 614207542 659039635 501870038 538222869 493789008 102361578 396184702 420085564 847042283 596525397 369275439 982492089 435277681 691101459...', 'output': ['4621461']}, {'input': '95 85277597\\r\\n99650860 24872331 198058586 121155516 36823722 163449239 213621093 228697919 31229317 230011784 113644904 47156338 109711989 75299231 160535756 140129325 39269331 47451250 7146935 144280332 79348947 126276925 164310996 101075103 104154241 48644688 231128463 104244898 102583139 73303273 241246182 63781751 117057 124323448 114431236 131561691 193580531 88964167 41643606 92175034 185910702 32706171 9054913 32419192 159946563 89197317 100439132 89661255 20223012 10996836 60392315 85016705 17415302...', 'output': ['2004717']}, {'input': '87 217629747\\r\\n227346180 442969200 250372511 235814979 417338862 225031911 309661619 299129805 222513896 415270947 11873343 359488170 162147450 124811809 201069777 17933368 387923761 142434748 389262663 321128747 181788373 384245553 124563833 233063595 214835619 508137050 122468567 158269411 452286263 204900179 494375677 75477114 313982165 416190148 207031321 293452366 88910557 451231248 501206132 311238700 194686421 436885998 421342922 189660967 313240412 495850392 142100840 175926077 482790246 280112425 4...', 'output': ['6123436']}, {'input': '80 541473126\\r\\n227631537 639428476 683935143 680078128 791939033 136332256 386422115 701115392 525378851 378273555 585215586 169033370 303203263 68571938 130728906 599226038 729527822 770422866 609395938 745990350 307601467 741273311 579379987 480006992 664771623 693445313 236651358 250824336 174307690 447795486 26521797 432942125 705102827 7560682 664017637 66395532 259231679 608760320 295114663 378036186 129375608 713815516 414208311 440696897 390961598 579894083 575216001 672662418 237631262 787998602 40...', 'output': ['15546428']}, {'input': '94 76050892\\r\\n498006286 311272419 122379773 694960037 436747681 610352438 704266504 611748115 750880834 335416752 61976457 317649270 224516127 33152552 244603696 335703794 122128506 468968616 447739330 447048066 215105024 343366714 443815497 257840136 322562336 729662646 176478960 827319502 109741942 414548802 645759457 199080482 540755449 515087990 340816774 344833832 663210708 306161119 7352391 484884971 39294971 516378634 810796700 22089030 149155021 99757300 805920295 739349157 539891497 666152664 23356...', 'output': ['1886898']}, {'input': '100 1215752104\\r\\n970354129 947590402 996294190 959766349 951296125 986765188 955001848 955531237 964001461 971412907 958707571 993117856 984647632 973001074 980412520 979883131 994706023 970883518 961354516 960825127 951825514 976706797 982530076 985177021 968765962 996823579 982000687 991529689 989941522 966119017 988882744 978294964 969295351 963472072 973530463 991000300 948649180 956590015 977765575 966648406 992588467 998411746 949178569 983588854 961883905 948119791 983059465 960295738 952354903 97935...', 'output': ['25139028']}, {'input': '100 1215752104\\r\\n999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 999999913 99999...', 'output': ['1012157434']}, {'input': '100 1215752192\\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': ['12157522']}, {'input': '66 476739624\\r\\n173745987 436851162 413477688 644801547 514046237 320451121 422943780 237760250 204382340 452391777 431688858 661364629 521979631 241231719 395000995 47863600 409533827 625235755 53061300 158555967 211420192 620419613 563400444 4769512 546857303 157406279 26504948 27917995 319042973 220570764 414230428 364801438 293136258 643906294 414042259 255126160 333516110 358263317 61311434 463542382 550147638 317060065 123162947 277790402 443289607 587237205 258543727 196669228 278147800 71009959 11474...', 'output': ['16618109']}, {'input': '39 33087783\\r\\n70600647 2266901 11966839 31198350 24855193 11526437 976383 74744419 100554597 48347342 72742435 1886535 15699879 12775143 3554161 31308764 25824153 31740293 25001473 15377604 90766535 81246786 35305728 88961314 70878298 47024065 96680069 38135882 80553110 18049023 63601987 81673677 39237071 79565855 13467611 66174846 75022463 63762145 3355796\\r\\n', 'output': ['2290215']}, {'input': '27 56379627\\r\\n67793612 34811850 20130370 79625926 35488291 62695111 76809609 2652596 18057723 61935027 62863641 43354418 50508660 29330027 28838758 19040655 19092404 56094994 69200145 36483441 18502131 77853701 20991083 67819468 32956589 80681963 41432161\\r\\n', 'output': ['5275618']}, {'input': '100 223295589\\r\\n196706 103806 229221 140966 20196 159546 108451 275671 461471 62001 71291 154901 168836 391796 354636 233866 271026 89871 336056 24841 410376 387151 289606 238511 201351 280316 99161 294251 150256 401086 368571 452181 117741 466116 131676 405731 10906 85226 66646 415021 52711 303541 456826 127031 419666 43421 192061 252446 48066 173481 178126 331411 349991 113096 57356 442891 94516 145611 308186 243156 428956 257091 6261 122386 424311 75936 363926 298896 382506 80581 266381 340701 29486 3174...', 'output': ['2469144']}, {'input': '100 106547001\\r\\n136163 142805 199262 285608 232472 172694 249077 288929 179336 122879 176015 225830 292250 156089 149447 259040 139484 36533 76385 182657 39854 159410 46496 49817 9965 146126 282287 328781 43175 126200 3323 205904 112916 169373 129521 219188 162731 116237 302213 235793 239114 185978 66422 275645 109595 222509 89669 106274 278966 202583 269003 215867 252398 132842 16607 209225 102953 298892 325460 33212 318818 192620 152768 59780 96311 73064 29891 255719 83027 245756 166052 195941 272324 8634...', 'output': ['1233182']}, {'input': '100 912683100\\r\\n299130 274315 135351 452983 457946 284241 194907 180018 41054 199870 70832 165129 90684 408316 1350 482761 333871 343797 264389 105573 398390 467872 318982 21202 80758 6313 50980 353723 120462 259426 393427 75795 472835 413279 184981 433131 348760 418242 383501 304093 140314 249500 95647 214759 130388 448020 125425 323945 309056 204833 175055 115499 244537 16239 150240 378538 338834 155203 269352 403353 443057 209796 65869 229648 368612 289204 487724 294167 423205 110536 254463 373575 31128 ...', 'output': ['9373849']}, {'input': '1 100000000000\\r\\n1000000000\\r\\n', 'output': ['101000000000']}, {'input': '100 10000000000\\r\\n16808 282475250 622650074 984943659 144108931 470211273 101027545 457850879 458777924 7237710 823564441 115438166 784484493 74243043 114807988 137522504 441282328 16531730 823378841 143542613 896544304 474833170 264817710 998097158 817129561 131570934 197493100 404280279 893351817 505795336 954899098 636807827 563613513 101929268 580723811 704877634 358580980 624379150 128236580 784558822 530511968 110010673 551901394 617819337 399125486 156091746 356425229 899894092 585640195 937186358 64...', 'output': ['209236696']}, {'input': '96 1350237206\\r\\n179252 960570656 244081265 440998363 674385237 484916146 641913151 917826070 670850119 607465477 197877364 596079578 260773936 649320809 627715320 530909771 795364952 666130551 863834903 618524434 978767535 781321609 717028607 338249948 328373828 116584253 913989446 166308313 85199311 688253174 585283937 439133758 499892264 163916122 792406062 887651011 937745614 322205909 136611947 842842918 654604898 77623317 702064956 112541862 243836201 987809421 711659178 528855176 533456269 546812146 7...', 'output': ['31442268']}, {'input': '1 100000000000\\r\\n1\\r\\n', 'output': ['100000000001']}, {'input': '4 1\\r\\n999999998 999999998 1000000000 1000000000\\r\\n', 'output': ['2']}, {'input': '1 78110679371\\r\\n570497240\\r\\n', 'output': ['78681176611']}, {'input': '42 54763468991\\r\\n628145517 376140463 883515281 186969586 762888636 326402540 98152103 158176573 61402893 127860890 9580639 570870045 646139320 178509023 484027667 61263305 841082556 558212775 940563716 26389630 579113529 496148000 925801173 837151741 70301174 656585276 285845006 902071051 403573724 727123763 9467291 296231663 631265401 899374334 520690250 798571511 491747710 799313373 643215696 789204467 614608449 162733265\\r\\n', 'output': ['1791188095']}, {'input': '100 1000000\\r\\n100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000 1000000000 1000000000 1000000000 ...', 'output': ['100001168']}]","id":97} {"difficulty":1600,"lang":"Java 11","lang_cluster":"Java","src_uid":"3791d1a504b39eb2e72472bcfd9a7e22","execute_outcome":"RUNTIME_ERROR","source_code":"\nimport java.util.*;\nimport java.io.*;\n\npublic class ToAddorNottoAdd {\n\t\n\t\/\/ https:\/\/codeforces.com\/contest\/231\/problem\/C\n\t\n\tpublic static void main(String[] args) throws IOException, FileNotFoundException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\t\/\/BufferedReader in = new BufferedReader(new FileReader(\"ToAddorNottoAdd\"));\n\t\tStringTokenizer st = new StringTokenizer(in.readLine());\n\t\tint n = Integer.parseInt(st.nextToken());\n\t\tlong k = Integer.parseInt(st.nextToken());\n\t\tlong[] arr = new long[n];\n\t\tst = new StringTokenizer(in.readLine());\n\t\tfor (int i=0; i maxnum) {\n\t\t\t\tnumber = arr[secondpointer];\n\t\t\t\tmaxnum = secondpointer-firstpointer+1;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(maxnum + \" \" + number);\n\t}\n}\n\n\/*\nlong min = arr[0];\nlong max = arr[arr.length-1];\nlong curmax=0;\nlong maxnum=0;\n\t\/\/ first find max amount of times it could work\nHashMap map =new HashMap<>();\nwhile (min < max) {\n\tlong middle = (min+max)\/2;\n\tmap.put(middle, works(middle, arr, k)); \n\tif (map.get(middle) > curmax) {\n\t\tcurmax = map.get(middle);\n\t\tmaxnum = middle;\n\t\tmin = middle;\n\t}\n\telse max = middle-1;\n}\n\n\/\/ now that have curmax\nfor (long i=maxnum; i>=arr[0]; i--) {\n\tif (works(i, arr, k) == curmax) {\n\t\tmaxnum = i;\n\t}\n\telse break;\n}\n\nSystem.out.println(curmax + \" \" + maxnum );\n\n}\n\npublic static long works(long middle, long[] arr, long k) {\nArrayList a = new ArrayList<>();\nfor (int i=0; i0 && pointer>=0) {\n\tif (middle - a.get(pointer) <= k) {\n\t\tk -= (middle - a.get(pointer));\n\t\tcount++;\n\t}\n\tpointer--;\n}\nreturn count;\n}\n\n*\/","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"],"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;i a.status[k] - b.status[k]);\n Node last = null;\n for (int i = r; i >= l; i--) {\n int j = i;\n while (i - 1 >= l && nodes[i - 1].status[k] == nodes[i].status[k]) {\n i--;\n }\n Node merged = rec(nodes, i, j, k - 1);\n if (last == null) {\n last = merged;\n } else {\n last = merge(last, merged);\n }\n }\n return last;\n }\n\n public Node merge(Node a, Node b) {\n Node merged = new Node();\n for (int i = limit - 1; i >= 0; i--) {\n if (a.status[i] == b.status[i]) {\n merged.status[i] = a.status[i];\n } else {\n if (a.status[i] > b.status[i]) {\n Node tmp = a;\n a = b;\n b = tmp;\n }\n merged.status[i] = a.status[i];\n int distToA = 0;\n int distToB = b.status[i] - a.status[i];\n for (int j = 0; j < i; j++) {\n distToA += a.status[j];\n distToB += b.status[j];\n }\n if (distToA > 0) {\n addEdge(merged, a, distToA);\n addEdge(merged, b, distToB);\n return merged;\n } else {\n addEdge(a, b, distToB);\n return a;\n }\n }\n }\n\n throw new RuntimeException();\n }\n\n public void addEdge(Node a, Node b, int len) {\n Edge e = new Edge();\n e.a = a;\n e.b = b;\n e.len = len;\n a.next.add(e);\n b.next.add(e);\n }\n\n public int countFactor(int n, int x) {\n return n <= 0 ? 0 : (n \/ x + countFactor(n \/ x, x));\n }\n\n }\n\n static class FastOutput implements AutoCloseable, Closeable {\n private StringBuilder cache = new StringBuilder(10 << 20);\n private final Writer os;\n\n public FastOutput(Writer os) {\n this.os = os;\n }\n\n public FastOutput(OutputStream os) {\n this(new OutputStreamWriter(os));\n }\n\n public FastOutput println(int c) {\n cache.append(c);\n println();\n return this;\n }\n\n public FastOutput println() {\n cache.append(System.lineSeparator());\n return this;\n }\n\n public FastOutput flush() {\n try {\n os.append(cache);\n os.flush();\n cache.setLength(0);\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n return this;\n }\n\n public void close() {\n flush();\n try {\n os.close();\n } catch (IOException e) {\n throw new UncheckedIOException(e);\n }\n }\n\n public String toString() {\n return cache.toString();\n }\n\n }\n\n static class Node {\n List next = new ArrayList<>();\n int size;\n int id;\n int weight;\n int[] status = new int[669];\n\n public String toString() {\n return \"\" + id;\n }\n\n }\n\n static class EulerSieve {\n private int[] primes;\n private boolean[] isComp;\n private int primeLength;\n\n public int get(int k) {\n return primes[k];\n }\n\n public EulerSieve(int limit) {\n isComp = new boolean[limit + 1];\n primes = new int[limit + 1];\n primeLength = 0;\n for (int i = 2; i <= limit; i++) {\n if (!isComp[i]) {\n primes[primeLength++] = i;\n }\n for (int j = 0, until = limit \/ i; j < primeLength && primes[j] <= until; j++) {\n int pi = primes[j] * i;\n isComp[pi] = true;\n if (i % primes[j] == 0) {\n break;\n }\n }\n }\n }\n\n }\n\n static class Edge {\n Node a;\n Node b;\n int len;\n\n Node other(Node x) {\n return a == x ? b : a;\n }\n\n }\n\n static class FastInput {\n private final InputStream is;\n private byte[] buf = new byte[1 << 13];\n private int bufLen;\n private int bufOffset;\n private int next;\n\n public FastInput(InputStream is) {\n this.is = is;\n }\n\n private int read() {\n while (bufLen == bufOffset) {\n bufOffset = 0;\n try {\n bufLen = is.read(buf);\n } catch (IOException e) {\n bufLen = -1;\n }\n if (bufLen == -1) {\n return -1;\n }\n }\n return buf[bufOffset++];\n }\n\n public void skipBlank() {\n while (next >= 0 && next <= 32) {\n next = read();\n }\n }\n\n public int readInt() {\n int sign = 1;\n\n skipBlank();\n if (next == '+' || next == '-') {\n sign = next == '+' ? 1 : -1;\n next = read();\n }\n\n int val = 0;\n if (sign == 1) {\n while (next >= '0' && next <= '9') {\n val = val * 10 + next - '0';\n next = read();\n }\n } else {\n while (next >= '0' && next <= '9') {\n val = val * 10 - next + '0';\n next = read();\n }\n }\n\n return val;\n }\n\n }\n}\n\n","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"],"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":99} {"difficulty":1800,"lang":"Java 8","lang_cluster":"Java","src_uid":"4de8b72f9ce12554cae8b6a83b3f023e","execute_outcome":"RUNTIME_ERROR","source_code":"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.TreeSet;\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 TreeSet pieces = new TreeSet<>();\n for (int i = 0; i < puzzle.length; i += Y) {\n for (int j = 0; j < puzzle[0].length; j += X) {\n pieces.add(new fullPiece(puzzle, Y, X, i, j));\n }\n }\n int all = puzzle.length \/ Y;\n all *= puzzle[0].length \/ X;\n if (pieces.size() == all) {\n return true;\n }\n return false;\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 fullPiece implements Comparable {\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 int compareTo(Object o) {\n fullPiece other = (fullPiece) o;\n if (eq(other)) {\n return 0;\n }\n return comp(other);\n }\n\n private int comp(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 1;\n if (data[i][j] < other.data[i][j]) return -1;\n }\n }\n return 0;\n }\n\n private 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[j][Y - i - 1] != 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[X - j - 1][i] != other.data[i][j]) return false;\n }\n }\n return true;\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\n","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"],"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":100} {"difficulty":2200,"lang":"Java 8","lang_cluster":"Java","src_uid":"560d70425c765c325f412152c8124d2d","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.LinkedList;\nimport java.util.PriorityQueue;\nimport java.util.Queue;\nimport java.util.StringTokenizer;\n\npublic class C {\n\n\tstatic int k;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\t\n\t\tint n = sc.nextInt(), m = sc.nextInt();\n\t\tk = sc.nextInt();\n\t\tArrayList[] adjList = new ArrayList[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tadjList[i] = new ArrayList<>(1);\n\t\twhile(m-->0)\n\t\t{\n\t\t\tint u = sc.nextInt() - 1, v = sc.nextInt() - 1;\n\t\t\tadjList[u].add(v);\n\t\t\tadjList[v].add(u);\n\t\t}\n\t\tComp[] comps = new Comp[n];\n\t\tint sz = 0;\n\t\tboolean[] vis = new boolean[n];\n\t\tfor(int i = 0; i < n; ++i)\n\t\t\tif(!vis[i])\n\t\t\t{\n\t\t\t\tint s = 0;\n\t\t\t\tQueue q = new LinkedList<>();\n\t\t\t\tvis[i] = true;\n\t\t\t\tq.add(i);\n\t\t\t\twhile(!q.isEmpty())\n\t\t\t\t{\n\t\t\t\t\t++s;\n\t\t\t\t\tint u = q.remove();\n\t\t\t\t\tfor(int v: adjList[u])\n\t\t\t\t\t\tif(!vis[v])\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvis[v] = true;\n\t\t\t\t\t\t\tq.add(v);\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcomps[sz++] = new Comp(s);\n\t\t\t}\n\t\tArrays.sort(comps, 0, sz);\n\t\tint idx = sz - 2, ans = 0, pIdx = sz - 1;\n\t\tPriorityQueue cand = new PriorityQueue<>(new Selector());\n\t\twhile(idx >= 0)\n\t\t{\n\n\t\t\twhile(pIdx > idx && comps[pIdx].used == comps[pIdx].pt)\n\t\t\t\tcand.add(comps[pIdx--]);\n\t\t\tif(pIdx == idx)\n\t\t\t{\n\t\t\t\t++ans;\n\t\t\t\tComp best = cand.remove();\n\t\t\t\tint used = best.used;\n\t\t\t\tbest = new Comp(best.sz + comps[idx].sz);\n\t\t\t\tbest.used = used;\n\t\t\t\tcomps[idx] = best;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcomps[pIdx].used++;\n\t\t\t\tcomps[idx].used++;\n\t\t\t}\n\t\t\tidx--;\n\t\t}\n\t\tout.println(ans);\n\t\tout.close();\n\t}\t\n\t\n\tstatic class Selector implements Comparator\n\t{\n\t\tpublic int compare(Comp a, Comp b)\n\t\t{\n\t\t\treturn b.x - a.x; \n\t\t}\n\t}\n\t\n\tstatic class Comp implements Comparable\n\t{\n\t\tint sz, pt, x, used;\n\t\t\n\t\tComp(int a) { sz = a; pt = Math.min(sz, k); x = k - pt; }\n\t\t\n\t\tpublic int compareTo(Comp c) { return sz - c.sz; }\n\t}\n\n\tstatic class Scanner \n\t{\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s){\tbr = new BufferedReader(new InputStreamReader(s));}\n\n\t\tpublic Scanner(String s) throws FileNotFoundException{\tbr = new BufferedReader(new FileReader(s));}\n\n\t\tpublic String next() throws IOException \n\t\t{\n\t\t\twhile (st == null || !st.hasMoreTokens()) \n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {return Integer.parseInt(next());}\n\n\t\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\t\tpublic String nextLine() throws IOException {return br.readLine();}\n\n\t\tpublic double nextDouble() throws IOException { return Double.parseDouble(next()); }\n\n\t\tpublic boolean ready() throws IOException {return br.ready();} \n\t}\n}","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"],"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":101} {"difficulty":2700,"lang":"Java 8","lang_cluster":"Java","src_uid":"6220f4058f9325dfb211fb1dd86e9464","execute_outcome":"RUNTIME_ERROR","source_code":"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 int cross(Point a, Point b, Point c){\n return (b.x - a.x) * (c.y - a.y) - (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\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","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"],"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":102} {"difficulty":1900,"lang":"Java 8","lang_cluster":"Java","src_uid":"77919677f562a6fd1af64bc8cbc79de5","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\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 TaskD solver = new TaskD();\n solver.solve(in, out);\n out.close();\n }\n}\n\n\nclass TaskD {\n\n\n public void solve(InputReader in, OutputWriter out) {\n int n = in.nextInt();\n int x = in.nextInt();\n\n int firstTour[] = new int[n];\n for (int i = 0; i < n; i++) {\n firstTour[i] = in.nextInt();\n }\n int secondTour[] = new int[n];\n for (int i = 0; i < n; i++) {\n secondTour[i] = in.nextInt();\n }\n int worstPlace = 0;\n Arrays.sort(firstTour);\n Arrays.sort(secondTour);\n\n int i = 0;\n int j = n-1;\n while(i < n && j >= 0) {\n if(firstTour[i] + secondTour[j] >= x) {\n i++;\n j--;\n worstPlace++;\n } else {\n i++;\n }\n }\n\n out.printLine(\"1 \" + worstPlace);\n }\n\n}\n\nclass 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 boolean hasNext() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n String line = reader.readLine();\n if (line == null) {\n return false;\n }\n tokenizer = new StringTokenizer(line);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return true;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n}\n\nclass 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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void printLine(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n}","description":"A boy named Vasya has taken part in an Olympiad. His teacher knows that in total Vasya got at least x points for both tours of the Olympiad. The teacher has the results of the first and the second tour of the Olympiad but the problem is, the results have only points, no names. The teacher has to know Vasya's chances.Help Vasya's teacher, find two numbers \u2014 the best and the worst place Vasya could have won. Note that the total results' table sorts the participants by the sum of points for both tours (the first place has the participant who has got the most points). If two or more participants have got the same number of points, it's up to the jury to assign places to them according to their choice. It is guaranteed that each participant of the Olympiad participated in both tours of the Olympiad.","input_specification":"The first line contains two space-separated integers n,\u2009x (1\u2009\u2264\u2009n\u2009\u2264\u2009105;\u00a00\u2009\u2264\u2009x\u2009\u2264\u20092\u00b7105) \u2014 the number of Olympiad participants and the minimum number of points Vasya earned. The second line contains n space-separated integers: a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u2009105) \u2014 the participants' points in the first tour. The third line contains n space-separated integers: b1,\u2009b2,\u2009...,\u2009bn (0\u2009\u2264\u2009bi\u2009\u2264\u2009105) \u2014 the participants' points in the second tour. The participants' points are given in the arbitrary order. It is guaranteed that Vasya was present in the Olympiad \u2014 there are two integers i,\u2009j (1\u2009\u2264\u2009i,\u2009j\u2009\u2264\u2009n) such, that ai\u2009+\u2009bj\u2009\u2265\u2009x.","output_specification":"Print two space-separated integers \u2014 the best and the worst place Vasya could have got on the Olympiad.","notes":"NoteIn the first text sample all 5 participants earn 2 points each in any case. Depending on the jury's decision, Vasya can get the first (the best) as well as the last (the worst) fifth place.In the second test sample in the best case scenario Vasya wins again: he can win 12 points and become the absolute winner if the total results' table looks like that \u2014 {4:8, 6:4, 3:6, 4:4, 4:3, 5:0}.In this table all participants are sorted by decreasing points and we can see how much a participant earned in the first and in the second tour.In the worst case scenario Vasya can get the fifth place if the table looks like that \u2014 {4:8, 4:6, 6:4, 5:4, 4:3, 3:0}, and he earned 4 and 3 points in the first and second tours, correspondingly.","sample_inputs":["5 2\n1 1 1 1 1\n1 1 1 1 1","6 7\n4 3 5 6 4 4\n8 6 0 4 3 4"],"sample_outputs":["1 5","1 5"],"human_solution":"import java.io.*;\nimport java.util.*;\n\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 TaskD solver = new TaskD();\n solver.solve(in, out);\n out.close();\n }\n}\n\n\nclass TaskD {\n\n\n public void solve(InputReader in, OutputWriter out) {\n int n = in.nextInt();\n int x = in.nextInt();\n\n List firstTour = new ArrayList<>(n);\n List secondTour = new ArrayList<>(n);\n for (int i = 0; i < n; i++) {\n firstTour.add(in.nextInt());\n }\n for (int i = 0; i < n; i++) {\n secondTour.add(in.nextInt());\n }\n int worstPlace = 0;\n firstTour.sort(Comparator.naturalOrder());\n secondTour.sort(Comparator.naturalOrder());\n int i = 0;\n int j = n-1;\n while(i < n && j >= 0) {\n if(firstTour.get(i) + secondTour.get(j) >= x) {\n i++;\n j--;\n worstPlace++;\n } else {\n i++;\n }\n }\n\n out.printLine(\"1 \" + worstPlace);\n }\n\n}\n\nclass 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 boolean hasNext() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n String line = reader.readLine();\n if (line == null) {\n return false;\n }\n tokenizer = new StringTokenizer(line);\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return true;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n}\n\nclass 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 print(Object... objects) {\n for (int i = 0; i < objects.length; i++) {\n if (i != 0) {\n writer.print(' ');\n }\n writer.print(objects[i]);\n }\n }\n\n public void printLine(Object... objects) {\n print(objects);\n writer.println();\n }\n\n public void close() {\n writer.close();\n }\n\n}","testcases":"[{'input': '5 2\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '6 7\\r\\n4 3 5 6 4 4\\r\\n8 6 0 4 3 4\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '1 100\\r\\n56\\r\\n44\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '5 1\\r\\n1 2 3 4 5\\r\\n1 2 3 4 5\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '5 5\\r\\n2 2 2 2 2\\r\\n3 3 3 3 3\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '4 100\\r\\n98 98 99 100\\r\\n1 1 2 2\\r\\n', 'output': ['1 4\\r\\n']}, {'input': '5 45\\r\\n1 2 3 4 5\\r\\n10 20 30 40 50\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '10 5\\r\\n3 1 1 2 1 3 1 1 2 3\\r\\n2 1 3 2 1 3 3 3 3 1\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '10 0\\r\\n3 3 1 1 1 2 3 0 0 3\\r\\n1 3 0 1 2 0 3 3 0 0\\r\\n', 'output': ['1 10\\r\\n']}, {'input': '10 16\\r\\n8 4 2 5 4 8 3 5 6 9\\r\\n5 3 8 6 2 10 10 8 9 3\\r\\n', 'output': ['1 4\\r\\n']}, {'input': '10 2\\r\\n9 8 2 5 4 7 8 1 0 9\\r\\n4 8 0 4 7 2 10 9 0 0\\r\\n', 'output': ['1 10\\r\\n']}, {'input': '2 50\\r\\n25 24\\r\\n26 26\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '2 50\\r\\n25 25\\r\\n24 26\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '3 3\\r\\n1 50 2\\r\\n2 2 1\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '3 10\\r\\n9 9 0\\r\\n0 0 10\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '4 0\\r\\n0 0 0 0\\r\\n0 0 0 0\\r\\n', 'output': ['1 4\\r\\n']}, {'input': '10 168\\r\\n76 42 26 51 40 79 30 48 58 91\\r\\n50 28 76 62 25 91 99 81 91 31\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '10 26\\r\\n85 77 25 50 45 65 79 9 2 84\\r\\n43 76 0 44 72 23 95 91 3 2\\r\\n', 'output': ['1 10\\r\\n']}, {'input': '10 168884\\r\\n75796 42057 25891 51127 40493 78380 30331 47660 58338 90812\\r\\n50469 28184 75581 61837 25050 90975 98279 81022 90217 31015\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '10 26872\\r\\n84744 76378 25507 49544 44949 65159 78873 9386 2834 83577\\r\\n43277 76228 210 44539 72154 22876 94528 90143 3059 2544\\r\\n', 'output': ['1 10\\r\\n']}]","id":103} {"difficulty":1900,"lang":"Java 8","lang_cluster":"Java","src_uid":"8c2e0cd780cf9390e933e28e57643cba","execute_outcome":"RUNTIME_ERROR","source_code":"\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Solution {\n\t\n\tprivate static Scanner sc;\n\n\tpublic static void main(String[] args) {\n\t\t\n\t\tsc = new Scanner(System.in);\n\t\t\n\t\tint n = sc.nextInt();\n\t\tdouble[][] A = new double [n][2];\n\t\tMap M1 = new HashMap();\n\t\tMap> M2 = new HashMap>();\n\t\t\n\t\tfor (int i = 0; i < n ; ++i) {\n\t\t\tA[i][0] = sc.nextDouble();\n\t\t\tA[i][1] = sc.nextDouble();\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n; ++i) {\n\t\t\tfor (int j = i + 1; j < n; ++j) {\n\t\t\t\t\n\t\t\t\tdouble m;\n\t\t\t\t\n\t\t\t\tif (A[i][0] - A[j][0] == 0) {\n\t\t\t\t\tm = 2000000000;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tm = (A[i][1] - A[j][1]) \/ ( A[i][0] - A[j][0]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!M1.containsKey(m)) {\n\t\t\t\t\tM1.put(m, 0);\n\t\t\t\t\tM2.put(m, new HashSet());\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint cnt = M1.get(m);\n\t\t\t\t\n\t\t\t\tM1.put(m, cnt + 1);\n\t\t\t\t\n\t\t\t\tif (m == 2000000000) {\n\t\t\t\t\tM2.get(m).add(A[i][0]);\n\t\t\t\t} else {\n\t\t\t\t\tM2.get(m).add(A[i][1] - m * A[i][0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlong tot = 0;\n\t\tlong cnt = 0;\n\t\t\n\t\tfor (double m : M2.keySet()) {\n\t\t\ttot += M2.get(m).size();\n\t\t}\n\t\t\n\t\tfor (double m : M2.keySet()) {\n\t\t\tcnt += (tot - M2.get(m).size()) * M2.get(m).size();\n\t\t}\n\t\t\n\t\tSystem.out.println(cnt \/ 2);\n\t\t\n\t\tsc.close();\n\t}\n}\n","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"],"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; i0){\n String s = input.next();\n if(s.equals(\"defragment\")){\n int i=0, j=0;\n while(arr[j]!=0 && jj){\n arr[j]= arr[i];\n arr[i]=0;\n j++;\n }\n while(arr[j]!=0 && j0){\n String s = input.next();\n if(s.equals(\"defragment\")){\n for(int i=0, j=0;i 0) {\n ans = 1 + solve(index, prev - b, cur - a, next - b);\n path[index][prev][cur][next] = new State(index, prev - b, cur - a, next - b);\n } else {\n ans = prev + cur + next == 0 ? 0 : INF;\n }\n } else {\n if (prev > 0) {\n ans = 1 + solve(index, prev - b, cur - a, next - b);\n path[index][prev][cur][next] = new State(index, prev - b, cur - a, next - b);\n } else {\n if (cur > 0) {\n ans = 1 + solve(index, prev - b, cur - a, next - b);\n path[index][prev][cur][next] = new State(index, prev - b, cur - a, next - b);\n }\n int nn = index < N - 2 ? h[index + 2] : 0;\n int ans2 = solve(index + 1, cur, next, nn);\n if (ans2 < ans) {\n ans = ans2;\n path[index][prev][cur][next] = new State(index + 1, cur, next, nn);\n }\n }\n }\n return dp[index][prev][cur][next] = ans;\n }\n \n static void printPath() {\n State state = new State(1, h[0], h[1], h[2]);\n \n while (state != null) {\n if (Math.max(0, state.p) + Math.max(0, state.c) + Math.max(0, state.n) > 0)\n System.out.print((state.i + 1) + \" \");\n state = path[state.i][Math.max(0, state.p)][Math.max(0, state.c)][Math.max(0, state.n)];\n }\n System.out.println();\n }\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n N = in.nextInt();\n a = in.nextInt();\n b = in.nextInt();\n h = new int[N];\n for (int i = 0; i < N; i++) {\n h[i] = in.nextInt() + 1;\n }\n \n dp = new Integer[20][20][20][20];\n path = new State[20][20][20][20];\n int ans = solve(1, h[0], h[1], h[2]);\n System.out.println(ans);\n printPath();\n \n in.close();\n System.exit(0);\n }\n}","description":"This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.Polycarp likes to play computer role-playing game \u00abLizards and Basements\u00bb. At the moment he is playing it as a magician. At one of the last levels he has to fight the line of archers. The only spell with which he can damage them is a fire ball. If Polycarp hits the i-th archer with his fire ball (they are numbered from left to right), the archer loses a health points. At the same time the spell damages the archers adjacent to the i-th (if any) \u2014 they lose b (1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910) health points each.As the extreme archers (i.e. archers numbered 1 and n) are very far, the fire ball cannot reach them. Polycarp can hit any other archer with his fire ball.The amount of health points for each archer is known. An archer will be killed when this amount is less than 0. What is the minimum amount of spells Polycarp can use to kill all the enemies?Polycarp can throw his fire ball into an archer if the latter is already killed.","input_specification":"The first line of the input contains three integers n,\u2009a,\u2009b (3\u2009\u2264\u2009n\u2009\u2264\u200910; 1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910). The second line contains a sequence of n integers \u2014 h1,\u2009h2,\u2009...,\u2009hn (1\u2009\u2264\u2009hi\u2009\u2264\u200915), where hi is the amount of health points the i-th archer has.","output_specification":"In the first line print t \u2014 the required minimum amount of fire balls. In the second line print t numbers \u2014 indexes of the archers that Polycarp should hit to kill all the archers in t shots. All these numbers should be between 2 and n\u2009-\u20091. Separate numbers with spaces. If there are several solutions, output any of them. Print numbers in any order.","notes":null,"sample_inputs":["3 2 1\n2 2 2","4 3 1\n1 4 1 1"],"sample_outputs":["3\n2 2 2","4\n2 2 3 3"],"human_solution":"import java.util.*;\n\npublic class LizardsAndBasements2 {\n \n static int N, a, b;\n static int[] h;\n static Integer[][][] dp;\n static int[][][] path;\n static final int INF = (int)1e9;\n\n static int solve(int index, int prev, int cur) {\n if (index == N - 1) {\n return prev == 0 && cur == 0 ? 0 : INF;\n }\n \n if (dp[index][prev][cur] != null) {\n return dp[index][prev][cur];\n }\n int ans = INF;\n int shots = 0;\n int next = h[index + 1];\n while (true) {\n if (prev - b * shots <= 0) {\n int tmp = shots + solve(index + 1, Math.max(0, cur - a * shots), Math.max(0, next - b * shots));\n if (tmp < ans) {\n ans = tmp;\n path[index][prev][cur] = shots;\n }\n\n }\n if (prev - b * shots <= 0 && cur - a * shots <= 0 && next - b * shots <= 0)\n break;\n shots++;\n }\n return dp[index][prev][cur] = ans;\n }\n \n static void printPath(int index, int prev, int cur) {\n if (index == N - 1) return;\n int shots = path[index][prev][cur];\n for (int i = 0; i < shots; i++) {\n System.out.print((index + 1) + \" \");\n }\n int next = h[index + 1];\n printPath(index + 1, Math.max(0, cur - a * shots), Math.max(0, next - b * shots));\n }\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n \n N = in.nextInt();\n a = in.nextInt();\n b = in.nextInt();\n h = new int[N];\n for (int i = 0; i < N; i++) {\n h[i] = in.nextInt() + 1;\n }\n \n dp = new Integer[20][20][20];\n path = new int[20][20][20];\n int ans = solve(1, h[0], h[1]);\n System.out.println(ans);\n printPath(1, h[0], h[1]);\n System.out.println();\n \n in.close();\n System.exit(0);\n }\n}","testcases":"[{'input': '3 2 1\\r\\n2 2 2\\r\\n', 'output': ['3\\r\\n2 2 2 ']}, {'input': '4 3 1\\r\\n1 4 1 1\\r\\n', 'output': ['4\\r\\n2 2 3 3 ']}, {'input': '3 5 3\\r\\n1 2 1\\r\\n', 'output': ['1\\r\\n2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 1\\r\\n10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 1\\r\\n1 9 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 2\\r\\n9 3 6\\r\\n', 'output': ['5\\r\\n2 2 2 2 2 ']}, {'input': '4 5 3\\r\\n2 2 2 1\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n2 3 2 2\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n4 2 4 2\\r\\n', 'output': ['3\\r\\n2 2 3 ']}, {'input': '4 5 1\\r\\n4 9 1 8\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n9 9 3 4\\r\\n', 'output': ['6\\r\\n2 2 2 2 3 3 ']}, {'input': '4 5 1\\r\\n8 8 9 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n10 10 10 10\\r\\n', 'output': ['8\\r\\n2 2 2 2 3 3 3 3 ']}, {'input': '4 5 2\\r\\n7 3 8 5\\r\\n', 'output': ['7\\r\\n2 2 2 2 3 3 3 ']}, {'input': '4 5 3\\r\\n5 10 7 7\\r\\n', 'output': ['5\\r\\n2 2 3 3 3 ']}, {'input': '4 3 1\\r\\n8 10 9 7\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 ']}, {'input': '10 9 5\\r\\n12 14 11 11 14 14 12 15 14 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 6 7 9 9 9 ']}, {'input': '10 5 2\\r\\n12 10 6 7 11 4 3 5 9 3\\r\\n', 'output': ['13\\r\\n2 2 2 2 2 2 2 4 5 5 7 9 9 ']}, {'input': '10 4 1\\r\\n5 12 10 5 13 6 5 5 2 10\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 3 4 5 5 5 6 7 8 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 1\\r\\n10 12 11 4 12 1 15 15 11 12\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 5 5 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n6 12 9 3 7 3 3 11 13 10\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 3 5 5 5 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n8 7 9 8 14 1 9 11 8 13\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 4 5 5 7 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n9 11 9 11 4 5 7 13 12 9\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 4 7 7 9 9 9 9 ']}, {'input': '10 8 2\\r\\n11 10 13 12 9 10 9 9 10 12\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 6 8 7 10 10 9 6 6 7\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 6 7 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 5 4 5 5 4 5 4 5 4\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n2 1 2 4 2 4 3 2 2 4\\r\\n', 'output': ['6\\r\\n2 5 5 7 9 9 ']}, {'input': '10 3 1\\r\\n4 4 3 3 3 3 2 1 3 1\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 4 5 6 7 9 9 ']}, {'input': '10 7 1\\r\\n3 3 2 1 3 1 2 2 3 1\\r\\n', 'output': ['9\\r\\n2 2 2 2 5 5 7 9 9 ']}, {'input': '10 10 1\\r\\n8 8 8 8 8 8 8 8 8 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n11 9 11 10 10 11 9 10 9 11\\r\\n', 'output': ['33\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n10 9 14 9 13 11 14 10 14 10\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 4 4 5 6 6 6 7 7 8 9 9 9 9 9 9 ']}, {'input': '10 8 6\\r\\n14 12 14 12 10 8 10 13 9 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 8 9 9 9 ']}, {'input': '10 4 1\\r\\n7 8 9 8 8 7 8 9 7 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 4 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 10 9 9 10 9 9 10 9 10\\r\\n', 'output': ['34\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 4\\r\\n11 10 10 10 10 12 10 10 10 12\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 10 4\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['4\\r\\n2 5 8 9 ']}, {'input': '10 2 1\\r\\n9 12 12 8 8 5 14 10 7 3\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 7 7 7 7 7 7 7 8 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 15 15 14 14 14\\r\\n', 'output': ['49\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 6 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n9 8 8 8 11 11 9 10 9 11\\r\\n', 'output': ['13\\r\\n2 2 2 2 5 5 5 7 7 9 9 9 9 ']}, {'input': '10 6 2\\r\\n11 8 10 11 10 8 8 13 9 13\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n3 7 9 12 11 3 4 3 14 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 3 4 4 4 5 5 5 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 7 10 7 6 8 9 8 6 9\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 2 3 4 4 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n2 9 2 6 8 7 6 5 6 2\\r\\n', 'output': ['8\\r\\n2 2 4 5 6 7 9 9 ']}, {'input': '10 7 3\\r\\n2 7 2 7 3 4 3 2 4 3\\r\\n', 'output': ['7\\r\\n2 3 5 5 7 9 9 ']}, {'input': '10 6 3\\r\\n8 9 8 9 8 9 10 9 8 9\\r\\n', 'output': ['12\\r\\n2 2 2 4 5 5 7 7 9 9 9 9 ']}, {'input': '10 2 1\\r\\n10 9 10 9 9 9 10 8 8 10\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n4 4 5 6 4 6 4 5 5 4\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 9 2\\r\\n5 7 8 8 7 5 7 4 4 5\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 9 5\\r\\n8 7 5 9 8 7 8 11 11 8\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 7 4\\r\\n5 6 6 6 7 7 6 5 5 5\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 9 1\\r\\n10 11 11 11 11 11 11 11 11 11\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 5 1\\r\\n6 5 6 5 6 6 6 5 6 6\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 2 4 5 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n8 7 9 7 9 12 12 6 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n7 3 5 3 5 5 3 4 2 4\\r\\n', 'output': ['10\\r\\n2 2 2 2 5 5 7 9 9 9 ']}, {'input': '10 7 2\\r\\n5 2 5 3 2 3 4 3 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 5 5 7 9 9 ']}, {'input': '10 2 1\\r\\n5 3 6 6 7 4 4 4 3 3\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 6 1\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['36\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 11 11 11 15 15 12 15 12 14\\r\\n', 'output': ['47\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 5 5 6 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 1\\r\\n9 15 15 11 8 10 13 9 15 9\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 3 4 4 5 6 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n12 12 14 13 14 12 14 14 11 14\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 6 7 8 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 5 5 5 5 5 5 6 4 4\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 8 7\\r\\n15 15 15 15 15 15 15 15 15 15\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 9 5\\r\\n11 10 4 4 6 9 11 4 10 8\\r\\n', 'output': ['8\\r\\n2 2 2 5 7 8 9 9 ']}, {'input': '10 6 3\\r\\n9 12 8 11 7 14 8 5 15 10\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 3 1\\r\\n4 4 4 4 3 4 3 3 3 3\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 6 4\\r\\n11 10 10 10 12 12 12 10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 6 1\\r\\n3 2 4 4 8 12 5 10 12 6\\r\\n', 'output': ['17\\r\\n2 2 2 2 4 5 6 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 9 5\\r\\n13 13 13 13 13 12 12 12 12 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 4 1\\r\\n7 7 6 6 6 8 6 7 6 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 5 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n13 10 12 10 9 12 11 8 12 12\\r\\n', 'output': ['15\\r\\n2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 ']}, {'input': '10 6 2\\r\\n1 4 5 4 4 2 3 6 6 4\\r\\n', 'output': ['8\\r\\n2 4 4 6 8 9 9 9 ']}, {'input': '10 8 1\\r\\n12 6 7 9 3 12 5 9 5 11\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n13 14 10 6 8 7 8 8 11 5\\r\\n', 'output': ['16\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 8 9 9 9 ']}, {'input': '10 8 1\\r\\n3 4 5 6 4 6 5 6 5 4\\r\\n', 'output': ['15\\r\\n2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n12 10 9 9 15 15 10 14 15 15\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 2 4 5 5 6 6 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 9 8 8 8 9 9 8 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n5 4 5 4 4 4 4 4 4 5\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n11 8 5 13 8 9 11 15 11 12\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n7 10 15 5 15 5 5 5 11 7\\r\\n', 'output': ['24\\r\\n2 2 2 2 2 2 2 2 3 3 5 5 5 5 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n5 5 4 4 4 4 4 4 5 4\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 6 2\\r\\n5 8 4 5 1 3 6 7 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 4 7 7 9 9 ']}, {'input': '10 5 2\\r\\n10 12 10 10 11 9 11 11 9 9\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 8 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n9 8 10 10 11 11 8 9 10 11\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 7 9 9 9 ']}, {'input': '10 3 2\\r\\n3 5 1 4 5 3 3 1 3 4\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 8 9 9 9 ']}, {'input': '10 3 2\\r\\n4 9 6 9 6 8 4 5 6 9\\r\\n', 'output': ['15\\r\\n2 2 2 3 5 5 5 5 7 8 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n8 9 8 9 8 8 8 8 8 8\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 4 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n11 6 9 9 11 10 7 13 11 9\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 1\\r\\n4 5 5 3 7 5 6 5 6 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 6\\r\\n15 14 14 12 15 10 9 14 13 8\\r\\n', 'output': ['9\\r\\n2 2 2 4 5 6 8 9 9 ']}, {'input': '10 7 1\\r\\n9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n4 5 4 1 3 6 3 2 2 2\\r\\n', 'output': ['4\\r\\n2 5 7 9 ']}, {'input': '10 10 3\\r\\n10 8 11 11 10 11 11 9 7 10\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 3 2\\r\\n7 8 11 6 8 7 2 3 8 7\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 5 6 6 9 9 9 9 ']}, {'input': '10 8 6\\r\\n9 9 8 10 7 13 7 11 13 12\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 3 2\\r\\n9 13 9 10 12 10 14 13 11 11\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 4 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n12 12 14 15 15 12 12 14 12 14\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 4 4 4 4 5 5 6 7 7 7 8 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 4\\r\\n6 4 8 4 8 7 10 6 8 6\\r\\n', 'output': ['8\\r\\n2 2 4 6 6 8 9 9 ']}, {'input': '10 5 4\\r\\n14 14 14 10 13 15 13 13 10 14\\r\\n', 'output': ['14\\r\\n2 2 2 2 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 10 2\\r\\n10 10 13 10 10 12 6 8 11 12\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 6 5 6 6 7 5 7 9 9\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 7 5\\r\\n10 10 10 10 10 10 10 10 10 10\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n11 10 10 10 11 11 11 10 11 11\\r\\n', 'output': ['32\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 5 2\\r\\n4 5 3 6 7 8 4 4 9 6\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 7 3\\r\\n5 9 8 8 8 7 6 7 6 5\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 2 1\\r\\n12 13 15 14 14 11 12 14 11 15\\r\\n', 'output': ['46\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n13 12 15 12 14 14 14 15 13 15\\r\\n', 'output': ['48\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 14 15 14 15 14 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 14 15 14 15 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n4 14 13 15 14 5 8 11 12 14\\r\\n', 'output': ['38\\r\\n2 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}]","id":106} {"difficulty":1800,"lang":"Java 6","lang_cluster":"Java","src_uid":"b81e7a786e4083cf7188f718bc045a85","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\n\n\npublic class D {\n\tString line = null;\n\tString error = \"errtype\";\n\tString voi = \"void\";\n\tpublic void run() throws Exception{\n\n\t\tBufferedReader br = null;\n\t\tFile file = new File(\"input.txt\");\n\t\tif(file.exists()){\n\t\t\tbr = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t}\n\t\telse{\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\n\t\tline = br.readLine();\n\t\tint N = Integer.parseInt(line);\n\t\t\n\t\tint c = 0;\n\t\tList list = new ArrayList();\n\t\t\n\t\twhile(c < N){\n\t\t\tline = br.readLine();\n\t\t\tString[] ls = line.split(\" \");\n\t\t\tif(ls[0].equals(\"Widget\")){\n\t\t\t\tString s = ls[1];\n\t\t\t\tint p1 = s.indexOf('(');\n\t\t\t\tint p2 = s.indexOf(',');\n\t\t\t\tint p3 = s.indexOf(')');\n\t\t\t\tString name = s.substring(0, p1);\n\t\t\t\tString xs = s.substring(p1+1, p2);\n\t\t\t\tString ys = s.substring(p2+1, p3);\n\t\t\t\tint x = Integer.parseInt(xs);\n\t\t\t\tint y = Integer.parseInt(ys);\n\t\t\t\tWidgit w = new Widgit(x, y);\n\t\t\t\tw.name = name;\n\t\t\t\tlist.add(w);\n\t\t\t}\n\t\t\telse if(ls[0].equals(\"VBox\")){\n\t\t\t\tString name = ls[1];\n\t\t\t\tVBox v = new VBox();\n\t\t\t\tv.name = name;\n\t\t\t\tlist.add(v);\n\t\t\t}\n\t\t\telse if(ls[0].equals(\"HBox\")){\n\t\t\t\tString name = ls[1];\n\t\t\t\tHBox v = new HBox();\n\t\t\t\tv.name = name;\n\t\t\t\tlist.add(v);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tString s = ls[0];\n\t\t\t\tif(s.contains(\".pack(\")){\n\t\t\t\t\tint p1 = s.indexOf('.');\n\t\t\t\t\tint p2 = s.indexOf('(');\n\t\t\t\t\tint p3 = s.indexOf(')');\n\t\t\t\t\tString parn = s.substring(0, p1);\n\t\t\t\t\tString chin = s.substring(p2+1, p3);\n\t\t\t\t\t\n\t\t\t\t\tBoxbase box = null;\n\t\t\t\t\tWidgit w = null;\n\t\t\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\t\t\tif(parn.equals(list.get(i).name)){\n\t\t\t\t\t\t\tbox = (Boxbase)list.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(chin.equals(list.get(i).name)){\n\t\t\t\t\t\t\tw = list.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(w != null){\n\t\t\t\t\t\tbox.pack(w);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(s.contains(\".set_border(\")){\n\t\t\t\t\tint p1 = s.indexOf('.');\n\t\t\t\t\tint p2 = s.indexOf('(');\n\t\t\t\t\tint p3 = s.indexOf(')');\n\t\t\t\t\tString name = s.substring(0, p1);\n\t\t\t\t\tString atai = s.substring(p2+1, p3);\n\t\t\t\t\tint num = Integer.parseInt(atai);\n\t\t\t\t\t\n\t\t\t\t\tBoxbase box = null;\n\t\t\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\t\t\tif(name.equals(list.get(i).name)){\n\t\t\t\t\t\t\tbox = (Boxbase)list.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tif(box != null){\n\t\t\t\t\t\tbox.setBorder(num);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(s.contains(\".set_spacing(\")){\n\t\t\t\t\tint p1 = s.indexOf('.');\n\t\t\t\t\tint p2 = s.indexOf('(');\n\t\t\t\t\tint p3 = s.indexOf(')');\n\t\t\t\t\tString name = s.substring(0, p1);\n\t\t\t\t\tString atai = s.substring(p2+1, p3);\n\t\t\t\t\tint num = Integer.parseInt(atai);\n\t\t\t\t\t\n\t\t\t\t\tBoxbase box = null;\n\t\t\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\t\t\tif(name.equals(list.get(i).name)){\n\t\t\t\t\t\t\tbox = (Boxbase)list.get(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tif(box != null){\n\t\t\t\t\t\tbox.setSpace(num);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tc++;\n\t\t}\n\t\tList namelist = new ArrayList();\n\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\tnamelist.add(list.get(i).name);\n\t\t}\n\t\t\n\t\tString[] slist = new String[0];\n\t\tslist = namelist.toArray(slist);\n\t\tArrays.sort(slist);\n\t\tfor(int i = 0; i < slist.length; i++){\n\t\t\tString name = slist[i];\n\t\t\t\n\t\t\tfor(int j = 0; j < list.size(); j++){\n\t\t\t\tif(list.get(j).name.equals(name)){\n\t\t\t\t\tString size = list.get(j).getSize();\n\t\t\t\t\tSystem.out.println(name + \" \" + size);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\t\n\tprivate class Widgit{\n\t\tpublic String name = \"\";\n\t\t\n\t\tpublic int getSizeX(){\n\t\t\treturn x;\n\t\t}\n\t\tpublic int getSizeY(){\n\t\t\treturn y;\n\t\t}\n\t\t\n\t\tpublic Widgit(){\n\t\t\t\n\t\t}\n\t\t\n\t\tpublic Widgit(int x, int y){\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t\t\n\t\tpublic String getSize(){\n\t\t\tString ans = x + \" \" + y;\n\t\t\treturn ans;\n\t\t}\n\t\t\n\t\tint x = 0;\n\t\tint y = 0;\n\t}\n\t\n\tprivate class Boxbase extends Widgit{\n\t\tint bo = 0;\n\t\tint sp = 0;\n\t\t\n\t\tList list = new ArrayList();\n\t\t\n\t\tpublic void setBorder(int b){\n\t\t\tbo = b;\n\t\t}\n\t\tpublic void setSpace(int s){\n\t\t\tsp = s;\n\t\t}\n\t\t\n\t\tpublic void pack(Widgit w){\n\t\t\tlist.add(w);\n\t\t}\n\t\t\n\t\tpublic Boxbase(){\n\t\t\t\n\t\t}\n\t\tpublic Boxbase(int x, int y){\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t}\n\t\n\tprivate class VBox extends Boxbase{\n\t\tpublic VBox(){\n\t\t\t\n\t\t}\n\t\tpublic VBox(int x, int y){\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t\t\n\t\tpublic int getSizeX(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t\n\t\t\tint x = 0;\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\t\n\t\t\t\tx = Math.max(x, list.get(i).getSizeX());\n\t\t\t}\n\t\t\tx+= 2* bo;\n\t\t\n\t\t\treturn x;\n\t\t}\n\t\tpublic int getSizeY(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tint y = 0;\n\t\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\ty += list.get(i).getSizeY();\n\t\t\t}\n\t\t\n\t\t\ty += 2*bo;\n\t\t\tint spnum = list.size() - 1;\n\t\t\ty+=spnum * sp;\n\t\t\treturn y;\n\t\t}\n\t\t\n\t\tpublic String getSize(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn \"0 0\";\n\t\t\t}\n\t\t\tint y = 0;\n\t\t\tint x = 0;\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\ty += list.get(i).getSizeY();\n\t\t\t\tx = Math.max(x, list.get(i).getSizeX());\n\t\t\t}\n\t\t\tx+= 2* bo;\n\t\t\ty += 2*bo;\n\t\t\tint spnum = list.size() - 1;\n\t\t\ty+=spnum * sp;\n\t\t\tString ans = x + \" \" + y;\n\t\t\treturn ans;\n\t\t}\n\t\t\n\t}\n\t\n\tprivate class HBox extends Boxbase{\n\t\tpublic HBox(){\n\t\t\t\n\t\t}\n\t\tpublic HBox(int x, int y){\n\t\t\tthis.x = x;\n\t\t\tthis.y = y;\n\t\t}\n\t\t\n\t\tpublic int getSizeX(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\n\t\t\tint x = 0;\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\tx += list.get(i).getSizeX();\n\t\t\t\t\n\t\t\t}\n\t\t\tx+= 2* bo;\n\t\t\n\t\t\tint spnum = list.size() - 1;\n\t\t\tx+=spnum * sp;\n\t\t\treturn x;\n\t\t}\n\t\tpublic int getSizeY(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tint y = 0;\n\t\t\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\t\n\t\t\t\ty = Math.max(y, list.get(i).getSizeY());\n\t\t\t}\n\t\t\t\n\t\t\ty += 2*bo;\n\t\n\t\t\treturn y;\n\t\t}\n\t\t\n\t\tpublic String getSize(){\n\t\t\tif(list.size() == 0){\n\t\t\t\treturn \"0 0\";\n\t\t\t}\n\t\t\tint y = 0;\n\t\t\tint x = 0;\n\t\t\tfor(int i = 0; i < list.size(); i++){\n\t\t\t\tx += list.get(i).getSizeX();\n\t\t\t\ty = Math.max(y, list.get(i).getSizeY());\n\t\t\t}\n\t\t\tx+= 2* bo;\n\t\t\ty += 2*bo;\n\t\t\tint spnum = list.size() - 1;\n\t\t\tx+=spnum * sp;\n\t\t\tString ans = x + \" \" + y;\n\t\t\treturn ans;\n\t\t}\n\t}\n\t\n\t\/**\n\t * @param args\n\t *\/\n\tpublic static void main(String[] args) throws Exception{\n\t\tD t = new D();\n\t\tt.run();\n\n\t}\n\n}\n","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"],"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":107} {"difficulty":2200,"lang":"Java 8","lang_cluster":"Java","src_uid":"bb4ecfaaccd538e23f883a18f9672af8","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\nimport java.util.*;\nimport java.util.concurrent.*;\nimport java.util.regex.*;\n\npublic class Solution {\n \n private static final Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) throws IOException {\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n StringTokenizer st = new StringTokenizer(br.readLine());\n int[] arr = new int[n];\n for (int i=0; i0 && cur0%2==1)\n return 0;\n else \n return 1;\n }\n \n}","description":"Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.The current state of the wall can be respresented by a sequence $$$a$$$ of $$$n$$$ integers, with $$$a_i$$$ being the height of the $$$i$$$-th part of the wall.Vova can only use $$$2 \\times 1$$$ bricks to put in the wall (he has infinite supply of them, however).Vova can put bricks horizontally on the neighboring parts of the wall of equal height. It means that if for some $$$i$$$ the current height of part $$$i$$$ is the same as for part $$$i + 1$$$, then Vova can put a brick there and thus increase both heights by 1. Obviously, Vova can't put bricks in such a way that its parts turn out to be off the borders (to the left of part $$$1$$$ of the wall or to the right of part $$$n$$$ of it).The next paragraph is specific to the version 1 of the problem.Vova can also put bricks vertically. That means increasing height of any part of the wall by 2.Vova is a perfectionist, so he considers the wall completed when: all parts of the wall has the same height; the wall has no empty spaces inside it. Can Vova complete the wall using any amount of bricks (possibly zero)?","input_specification":"The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) \u2014 the number of parts in the wall. The second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 10^9$$$) \u2014 the initial heights of the parts of the wall.","output_specification":"Print \"YES\" if Vova can complete the wall using any amount of bricks (possibly zero). Print \"NO\" otherwise.","notes":"NoteIn the first example Vova can put a brick on parts 2 and 3 to make the wall $$$[2, 2, 2, 2, 5]$$$ and then put 3 bricks on parts 1 and 2 and 3 bricks on parts 3 and 4 to make it $$$[5, 5, 5, 5, 5]$$$.In the second example Vova can put a brick vertically on part 3 to make the wall $$$[4, 5, 5]$$$, then horizontally on parts 2 and 3 to make it $$$[4, 6, 6]$$$ and then vertically on part 1 to make it $$$[6, 6, 6]$$$.In the third example the wall is already complete.","sample_inputs":["5\n2 1 1 2 5","3\n4 5 3","2\n10 10","3\n1 2 3"],"sample_outputs":["YES","YES","YES","NO"],"human_solution":"import java.io.*;\nimport java.lang.reflect.Array;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\nimport java.util.*;\nimport java.util.concurrent.*;\nimport java.util.regex.*;\n\npublic class Solution {\n \n private static final Scanner sc = new Scanner(System.in);\n\n public static void main(String[] args) throws IOException {\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n StringTokenizer st = new StringTokenizer(br.readLine());\n int[] arr = new int[n];\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":108} {"difficulty":1700,"lang":"Java 8","lang_cluster":"Java","src_uid":"be42e213ff43e303e475d77a9560367f","execute_outcome":"RUNTIME_ERROR","source_code":"\nimport java.io.*;\nimport java.math.*;\nimport java.util.*;\n\nimport static java.util.Arrays.fill;\nimport static java.lang.Math.*;\nimport static java.util.Arrays.sort;\nimport static java.util.Collections.sort;\n\n\npublic class A213 \n{\n\n\tpublic static int mod = 1000000007;\n\tpublic static long INF = (1L << 60);\n\tstatic FastScanner2 in = new FastScanner2();\n\tstatic OutputWriter out = new OutputWriter(System.out);\n\tstatic int n;\n\tstatic ArrayList[] parent;\n\tstatic ArrayList[] child;\n\tstatic int[] color;\n\tstatic int[] done;\n\tpublic static int solve(int pos)\n\t{\n\t\tint ret=n;\n\t\tint count=0;\n\t\tint it=0;\n\t\twhile(true)\n\t\t{\n\t\t\tboolean one=false;\n\t\t\tfor(int i=1;i<=n;i++)\n\t\t\t{\n\t\t\t\tit++;\n\t\t\t\tif(done[i]==parent[i].size() && pos==color[i])\n\t\t\t\t{\n\t\t\t\t\tdone[i]=-1000;\n\t\t\t\t\tfor(int j : child[i])\n\t\t\t\t\t\t{\n\t\t\t\t\t\tdone[j]++;\n\t\t\t\t\t\t}\n\t\t\t\t\tone=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(one)\n\t\t\t\tcontinue; \/\/to check interdependence\n\t\t\tif(count==n)\n\t\t\t\tbreak;\n\t\t\tpos++;\n\t\t\tret++;\n\t\t\tif(pos>3)\n\t\t\t\tpos-=3;\n\t\t}\n\t\tif(n!=1 && it>3*n*n)\n\t\t\tSystem.out.println(\"smk\");\n\t\treturn ret;\n\t}\n\tpublic static void main(String[] args) \n\t{\n\n\t\tn=in.nextInt();\n\t\tcolor=new int[n+1];\n\t\tparent=new ArrayList[n+1];\n\t\tchild=new ArrayList[n+1];\n\t\tdone=new int[n+1];\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tcolor[i]=in.nextInt();\n\t\t\tparent[i]=new ArrayList<>();\n\t\t\tchild[i]=new ArrayList<>();\n\t\t}\n\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tint x=in.nextInt();\n\t\t\twhile(x-->0)\n\t\t\t{\n\t\t\t\tint t=in.nextInt();\n\t\t\t\tparent[i].add(t);\n\t\t\t\tchild[t].add(i);\n\t\t\t}\n\t\t}\n\t\tint answer=mod;\n\t\tfor(int i=1;i<=3;i++)\n\t\t{\n\t\t\tArrays.fill(done, 0);\n\t\t\tanswer=min(answer, solve(i));\n\t\t}\n\t\tout.println(answer);\n\t\tout.close();\n\n\t}\n\t\n\tpublic static long pow(long x, long n) \n\t{\n\t\tlong res = 1;\n\t\tfor (long p = x; n > 0; n >>= 1, p = (p * p)) \n\t\t{\n\t\t\tif ((n & 1) != 0) \n\t\t\t{\n\t\t\t\tres = (res * p);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\t\n\tpublic static long pow(long x, long n, long mod) \n\t{\n\t\tlong res = 1;\n\t\tfor (long p = x; n > 0; n >>= 1, p = (p * p) % mod) \n\t\t{\n\t\t\tif ((n & 1) != 0) \n\t\t\t{\n\t\t\t\tres = (res * p % mod);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static long gcd(long n1, long n2)\n\t{\n\t\tlong r;\n\t\twhile (n2 != 0) \n\t\t{\n\t\t\tr = n1 % n2;\n\t\t\tn1 = n2;\n\t\t\tn2 = r;\n\t\t}\n\t\treturn n1;\n\t}\n\n\tpublic static long lcm(long n1, long n2) \n\t{\n\t\tlong answer = (n1 * n2) \/ (gcd(n1, n2));\n\t\treturn answer;\n\t}\n\t\n\tstatic class FastScanner2 \n\t{\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar;\n\t\tprivate int snumChars;\n\n\t\tpublic int read() \n\t\t{\n\t\t\tif (snumChars == -1)\n\t\t\t\tthrow new InputMismatchException();\n\t\t\tif (curChar >= snumChars) \n\t\t\t{\n\t\t\t\tcurChar = 0;\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tsnumChars = System.in.read(buf);\n\t\t\t\t} catch (IOException e) \n\t\t\t\t{\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\t}\n\t\t\t\tif (snumChars <= 0)\n\t\t\t\t\treturn -1;\n\t\t\t}\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic String nextLine() \n\t\t{\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo \n\t\t\t{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isEndOfLine(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic String nextString() \n\t\t{\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tStringBuilder res = new StringBuilder();\n\t\t\tdo \n\t\t\t{\n\t\t\t\tres.appendCodePoint(c);\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n\t\t\treturn res.toString();\n\t\t}\n\n\t\tpublic long nextLong()\n\t\t{\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tlong res = 0;\n\t\t\tdo \n\t\t\t{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int nextInt() \n\t\t{\n\t\t\tint c = read();\n\t\t\twhile (isSpaceChar(c))\n\t\t\t\tc = read();\n\t\t\tint sgn = 1;\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = read();\n\t\t\t}\n\t\t\tint res = 0;\n\t\t\tdo \n\t\t\t{\n\t\t\t\tif (c < '0' || c > '9')\n\t\t\t\t\tthrow new InputMismatchException();\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = read();\n\t\t\t} \n\t\t\twhile (!isSpaceChar(c));\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n)\n\t\t{\n\t\t\tint[] arr = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t{\n\t\t\t\tarr[i] = nextInt();\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n)\n\t\t{\n\t\t\tlong[] arr = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t{\n\t\t\t\tarr[i] = nextLong();\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\n\t\tprivate boolean isSpaceChar(int c)\n\t\t{\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\n\t\tprivate boolean isEndOfLine(int c) \n\t\t{\n\t\t\treturn c == '\\n' || c == '\\r' || c == -1;\n\t\t}\n\t}\n\n\tstatic class InputReader \n\t{\n\t\tpublic BufferedReader reader;\n\t\tpublic StringTokenizer tokenizer;\n\n\t\tpublic InputReader(InputStream inputstream) \n\t\t{\n\t\t\treader = new BufferedReader(new InputStreamReader(inputstream));\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String nextLine() \n\t\t{\n\t\t\tString fullLine = null;\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens())\n\t\t\t{\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\tfullLine = reader.readLine();\n\t\t\t\t} catch (IOException e)\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t\treturn fullLine;\n\t\t\t}\n\t\t\treturn fullLine;\n\t\t}\n\n\t\tpublic String next()\n\t\t{\n\t\t\twhile (tokenizer == null || !tokenizer.hasMoreTokens()) \n\t\t\t{\n\t\t\t\ttry \n\t\t\t\t{\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e) \n\t\t\t\t{\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 long nextLong() \n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic int[] nextIntArray(int n) \n\t\t{\n\t\t\tint a[] = new int[n];\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t{\n\t\t\t\ta[i] = nextInt();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long[] nextLongArray(int n)\n\t\t{\n\t\t\tlong a[] = new long[n];\n\t\t\tfor (int i = 0; i < n; i++) \n\t\t\t{\n\t\t\t\ta[i] = nextLong();\n\t\t\t}\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic int nextInt() \n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t}\n\n\tstatic class OutputWriter \n\t{\n\t\tprivate final PrintWriter writer;\n\n\t\tpublic OutputWriter(OutputStream outputStream) \n\t\t{\n\t\t\twriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n\t\t}\n\n\t\tpublic OutputWriter(Writer writer)\n\t\t{\n\t\t\tthis.writer = new PrintWriter(writer);\n\t\t}\n\n\t\tpublic void print(Object... objects)\n\t\t{\n\t\t\tfor (int i = 0; i < objects.length; i++) \n\t\t\t{\n\t\t\t\tif (i != 0)\n\t\t\t\t\twriter.print(' ');\n\t\t\t\twriter.print(objects[i]);\n\t\t\t}\n\t\t}\n\n\t\tpublic void println(Object... objects)\n\t\t{\n\t\t\tprint(objects);\n\t\t\twriter.println();\n\t\t}\n\n\t\tpublic void close() \n\t\t{\n\t\t\twriter.close();\n\t\t}\n\n\t\tpublic void flush() \n\t\t{\n\t\t\twriter.flush();\n\t\t}\n\t}\nprivate static boolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\t\n\tprivate static void tr(Object... o) \n\t{\n\t\tif (!oj)\n\t\t\tSystem.out.println(Arrays.deepToString(o));\n\t}\n}","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"],"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":109} {"difficulty":1600,"lang":"Java 7","lang_cluster":"Java","src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.InputStream;\n\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\tTask solver = new Task();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass Task {\n \n\tpublic void solve(int testNumber, InputReader in, PrintWriter out) {\n\t\tint n = in.nextInt();\n\t\tint m = in.nextInt();\n\t\tint[] positive = new int[n];\n\t\tint[] negative = new int[n];\n\t\tint cnt = 0;\n\t\tString[] memo = new String[n];\n\t\tfor (int k = 0; k < n; ++k) {\n\t\t\tString s = in.next();\n\t\t\tmemo[k] = s;\n\t\t\tint id = Integer.parseInt(s.substring(1)) - 1;\n\t\t\tif (s.startsWith(\"+\")) {\n\t\t\t\tpositive[id]++;\n\t\t\t} else {\n\t\t\t\tnegative[id]++;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tboolean[] maybe = new boolean[n];\n\t\tint all = 0;\n\t\tfor (int k = 0; k < n; ++k) {\n\t\t\tint tmp = cnt + positive[k] - negative[k];\n\t\t\tif (tmp == m) {\n\t\t\t\tmaybe[k] = true;\n\t\t\t\tall++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int k = 0; k < n; ++k) {\n\t\t\tString s = memo[k];\n\t\t\tint id = Integer.parseInt(s.substring(1)) - 1;\n\t\t\tif (s.startsWith(\"+\")) {\n\t\t\t\tif (!maybe[id]) {\n\t\t\t\t\tout.println(\"Lie\");\n\t\t\t\t} else {\n\t\t\t\t\tout.println(all == 1 ? \"True\" : \"Not defined\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!maybe[id]) {\n\t\t\t\t\tout.println(\"True\");\n\t\t\t\t} else {\n\t\t\t\t\tout.println(all == 1 ? \"Lie\" : \"Not defined\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\n}\n\nclass InputReader {\n private BufferedReader reader;\n private 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","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"],"human_solution":"\/\/ practice with kaiboy\nimport java.io.*;\nimport java.util.*;\n\npublic class CF157D extends PrintWriter {\n\tCF157D() { super(System.out); }\n\tScanner sc = new Scanner(System.in);\n\tpublic static void main(String[] $) {\n\t\tCF157D o = new CF157D(); o.main(); o.flush();\n\t}\n\n\tvoid main() {\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[] aa = new int[n];\n\t\tint[] pp = new int[n + 1];\n\t\tint[] qq = new int[n + 1];\n\t\tint q = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\taa[i] = a;\n\t\t\tif (a > 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":110} {"difficulty":2600,"lang":"Java 6","lang_cluster":"Java","src_uid":"c7e0c6b93a2f2f43fe9da405409c91e6","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.*;\nimport java.lang.Math;\nimport java.util.Scanner;\n\npublic class main\n{\n\tpublic static Scanner in;\n\tpublic static PrintStream out;\n\t\n\tpublic static void test()\n\t{\n\t\tint ti = in.nextInt();\n\t\tint td = in.nextInt();\n\t\tint tr = in.nextInt();\n\t\tint te = in.nextInt();\n\t\t\n\t\tin.nextLine();\n\t\t\n\t\tString A = in.nextLine();\n\t\t\n\t\tif (A.length()==0)\n\t\t{\n\t\t\tA = in.nextLine();\n\t\t}\n\t\t\n\t\tString B = in.nextLine();\n\t\t\n\t\tint N = A.length();\n\t\tint M = B.length();\n\t\t\n\t\tint i,j;\n\t\t\n\t\tint t[][] = new int[N+1][];\n\t\tfor (i=0; i<=N; i++)\n\t\t{\n\t\t\tt[i] = new int[M+1];\n\t\t}\n\t\t\n\t\tt[0][0] = 0;\n\t\tfor (i=1; i<=N; i++)\n\t\t{\n\t\t\tt[i][0] = td * i;\n\t\t}\n\t\tfor (j=1; j<=M; j++)\n\t\t{\n\t\t\tt[0][j] = ti * j;\n\t\t}\n\t\t\n\t\tint m;\n\t\tfor (i=1; i<=N; i++)\n\t\t{\n\t\t\tfor (j=1;j<=M;j++)\n\t\t\t{\n\t\t\t\tm = tr + t[i-1][j-1];\n\t\t\t\n\t\t\t\tif (A.charAt(i-1) == B.charAt(j-1))\n\t\t\t\t{\n\t\t\t\t\tm = Math.min(m, t[i-1][j-1]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tm = Math.min(m, td + t[i-1][j]);\n\t\t\t\tm = Math.min(m, ti + t[i][j-1]);\n\t\t\t\t\n\t\t\t\tif ((i>1)&&(j>1)&&(A.charAt(i-1) == B.charAt(j-2))&&(A.charAt(i-2) == B.charAt(j-1)))\n\t\t\t\t{\n\t\t\t\t\tm = Math.min(m, te + t[i-2][j-2]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tt[i][j] = m;\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\tout.println(t[N][M]);\n\t}\n\t\n\tpublic static void main(String args[])\n\t{\n\t\ttry\n\t\t{\n\t\t\t\/\/in = new Scanner(new File(\"in.txt\"));\n\t\t\t\/\/out = new PrintStream(new File(\"out.txt\"));\t\t\t\n\t\t\tin = new Scanner(System.in);\n\t\t\tout = System.out;\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t\n\t\ttest();\n\t}\n}\n","description":"You are given a sequence of balls A by your teacher, each labeled with a lowercase Latin letter 'a'-'z'. You don't like the given sequence. You want to change it into a new sequence, B that suits you better. So, you allow yourself four operations: You can insert any ball with any label into the sequence at any position. You can delete (remove) any ball from any position. You can replace any ball with any other ball. You can exchange (swap) two adjacent balls. Your teacher now places time constraints on each operation, meaning that an operation can only be performed in certain time. So, the first operation takes time ti, the second one takes td, the third one takes tr and the fourth one takes te. Also, it is given that 2\u00b7te\u2009\u2265\u2009ti\u2009+\u2009td.Find the minimal time to convert the sequence A to the sequence B.","input_specification":"The first line contains four space-separated integers ti,\u2009td,\u2009tr,\u2009te (0\u2009<\u2009ti,\u2009td,\u2009tr,\u2009te\u2009\u2264\u2009100). The following two lines contain sequences A and B on separate lines. The length of each line is between 1 and 4000 characters inclusive.","output_specification":"Print a single integer representing minimum time to convert A into B.","notes":"NoteIn the second sample, you could delete the ball labeled 'a' from the first position and then insert another 'a' at the new second position with total time 6. However exchanging the balls give total time 3.","sample_inputs":["1 1 1 1\nyoushouldnot\nthoushaltnot","2 4 10 3\nab\nba","1 10 20 30\na\nza"],"sample_outputs":["5","3","1"],"human_solution":"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n public static int[] toIntArray(String s)\n {\n int[] res = new int[s.length()];\n for (int i = 0; i < res.length; i++) {\n res[i] = s.charAt(i) - 'a';\n }\n return res;\n }\n \n public static void main(String[] args) throws IOException {\n Scanner in = new Scanner(System.in);\n int ci = in.nextInt();\n int cd = in.nextInt();\n int cr = in.nextInt();\n int cx = in.nextInt();\n \n int[] a = toIntArray(in.next());\n int[] b = toIntArray(in.next());\n int n = a.length;\n int m = b.length;\n \n int[][] res = new int[n + 1][m + 1];\n int[][] nA = new int[26][n + 1];\n int[][] nB = new int[26][m + 1];\n for (int i = 0; i < 26; i++) {\n for (int j = n - 1; j >= 0; j--) {\n nA[i][j] = a[j] == i ? j : nA[i][j + 1];\n res[j][m] = (n - j) * cd;\n }\n for (int j = m - 1; j >= 0; j--) {\n nB[i][j] = b[j] == i ? j : nB[i][j + 1];\n res[n][j] = (m - j) * ci;\n }\n }\n \n for (int i = n - 1; i >= 0; i--) {\n for (int j = m - 1; j >= 0; j--) {\n res[i][j] = res[i + 1][j + 1];\n if (a[i] != b[j]) {\n int x = Math.min(res[i + 1][j] + cd, Math.min(res[i][j + 1] + ci, res[i + 1][j + 1] + cr));\n int l = nA[b[j]][i + 1];\n int r = nB[a[i]][j + 1];\n if (l > 0 && r > 0) {\n x = Math.min(x, res[l + 1][r + 1] + (l - i - 1) * cd + (r - j - 1) * ci + cx);\n }\n res[i][j] = x;\n }\n }\n }\n System.out.println(res[0][0]);\n }\n}","testcases":"[{'input': '1 1 1 1\\r\\nyoushouldnot\\r\\nthoushaltnot\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 4 10 3\\r\\nab\\r\\nba\\r\\n', 'output': ['3\\r\\n']}, {'input': '1 10 20 30\\r\\na\\r\\nza\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 6 10 4\\r\\nmanthan\\r\\nmathmania\\r\\n', 'output': ['12\\r\\n']}, {'input': '5 1 5 3\\r\\nabhishek\\r\\naurbhishek\\r\\n', 'output': ['10\\r\\n']}, {'input': '1 1 100 1\\r\\nabcd\\r\\nwxyz\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 6 5 5\\r\\ntest\\r\\ntsar\\r\\n', 'output': ['15\\r\\n']}, {'input': '2 4 10 3\\r\\nmanthan\\r\\nnahtnam\\r\\n', 'output': ['15\\r\\n']}, {'input': '2 4 100 3\\r\\nabcd\\r\\nbade\\r\\n', 'output': ['9\\r\\n']}, {'input': '5 5 1 5\\r\\nab\\r\\nba\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 5 100 4\\r\\ntets\\r\\ntesat\\r\\n', 'output': ['7\\r\\n']}, {'input': '9 1 10 5\\r\\nabcd\\r\\ndbca\\r\\n', 'output': ['20\\r\\n']}, {'input': '2 2 10 2\\r\\nabcd\\r\\nadcb\\r\\n', 'output': ['6\\r\\n']}, {'input': '8 4 3 10\\r\\neekoowppum\\r\\njgmtlmeuigztfctikegvakfbgbafytbputmeppkuuyjkhagdsftfoueitnhjllolevgpmbtlworxojyzpfdaasckcqqdwdwwrklb\\r\\n', 'output': ['729\\r\\n']}, {'input': '5 5 1 82\\r\\nzmtuomrwesrhvudogmalwhtktfcbglnpbdntqssjcrdwlerfccmkmmhsfgaocchxdxxmeiaunhellstnhnjjmbynmqlzuupbnkrw\\r\\nglpfybikah\\r\\n', 'output': ['453\\r\\n']}, {'input': '20 21 22 84\\r\\notirbgzzphwwxqtgqyxympiumuyoupngwabrprmyhjpkgpjmez\\r\\nozvimdjwsyuacgbekgcw\\r\\n', 'output': ['872\\r\\n']}, {'input': '4 5 6 62\\r\\nqibkeavwalpn\\r\\nmaasevryyxzzqpdcgydb\\r\\n', 'output': ['89\\r\\n']}, {'input': '9 8 7 67\\r\\nejohycekbciwahqybwiy\\r\\ncpxgvbiwnuytmbwjvrzalydjjgdcmczejwesqrrh\\r\\n', 'output': ['299\\r\\n']}, {'input': '44 55 22 80\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\n', 'output': ['0\\r\\n']}, {'input': '63 9 44 72\\r\\nabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabd\\r\\nabdabdabdabdabdabdabdabdabdabdabtdabdabdabdabdabdabdabdabdabdabdabdabdabd\\r\\n', 'output': ['63\\r\\n']}, {'input': '1 3 4 2\\r\\nabc\\r\\ncxa\\r\\n', 'output': ['6\\r\\n']}, {'input': '1 1 1 1\\r\\nacccb\\r\\nba\\r\\n', 'output': ['4\\r\\n']}, {'input': '1 1 1 1\\r\\nab\\r\\nbca\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1 1 1\\r\\nba\\r\\nacb\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1 100 1\\r\\nafffb\\r\\nbggga\\r\\n', 'output': ['7\\r\\n']}, {'input': '1 1 1 1\\r\\nab\\r\\nbccccccccccccccccccca\\r\\n', 'output': ['20\\r\\n']}, {'input': '100 1 100 60\\r\\nacb\\r\\nba\\r\\n', 'output': ['61\\r\\n']}]","id":111} {"difficulty":2300,"lang":"Java 8","lang_cluster":"Java","src_uid":"d2313888d962b1dd6dc21b5f1eb96f91","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.*;\nimport java.util.*;\n\npublic class B implements Runnable {\n\n private static final boolean ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null;\n\n private BufferedReader in;\n private PrintWriter out;\n private StringTokenizer tok = new StringTokenizer(\"\");\n\n private void init() throws FileNotFoundException {\n Locale.setDefault(Locale.US);\n String fileName = \"\";\n if (ONLINE_JUDGE && fileName.isEmpty()) {\n in = new BufferedReader(new InputStreamReader(System.in));\n out = new PrintWriter(System.out);\n } else {\n if (fileName.isEmpty()) {\n in = new BufferedReader(new FileReader(\"input.txt\"));\n out = new PrintWriter(\"output.txt\");\n } else {\n in = new BufferedReader(new FileReader(fileName + \".in\"));\n out = new PrintWriter(fileName + \".out\");\n }\n }\n }\n\n String readString() {\n while (!tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(in.readLine());\n } catch (Exception e) {\n return null;\n }\n }\n return tok.nextToken();\n }\n\n int readInt() {\n return Integer.parseInt(readString());\n }\n\n long readLong() {\n return Long.parseLong(readString());\n }\n\n double readDouble() {\n return Double.parseDouble(readString());\n }\n\n int[] readIntArray(int size) {\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = readInt();\n }\n return a;\n }\n\n public static void main(String[] args) {\n \/\/new Thread(null, new _Solution(), \"\", 128 * (1L << 20)).start();\n new B().run();\n }\n\n long timeBegin, timeEnd;\n\n void time() {\n timeEnd = System.currentTimeMillis();\n System.err.println(\"Time = \" + (timeEnd - timeBegin));\n }\n\n @Override\n public void run() {\n try {\n timeBegin = System.currentTimeMillis();\n init();\n solve();\n out.close();\n time();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(-1);\n }\n }\n\n int gcd(int a, int b) {\n return a == 0 ? b : gcd(b % a, a);\n }\n\n long answer = Long.MAX_VALUE;\n\n private void solve() {\n int n = readInt();\n\n int A = readInt();\n int B = readInt();\n int[] a = readIntArray(n);\n\n for (int kFirst = -1; kFirst <= 1; kFirst++) {\n int currentFirst = a[0] + kFirst;\n for (int divisor = 2; divisor * divisor <= currentFirst; divisor++) {\n if (currentFirst % divisor == 0) {\n answer = Math.min(answer, solveForPrefix(n, a, divisor, A, B));\n }\n while (currentFirst % divisor == 0) {\n currentFirst \/= divisor;\n }\n }\n if (currentFirst > 1) {\n answer = Math.min(answer, solveForPrefix(n, a, currentFirst, A, B));\n }\n }\n\n int[] b = new int[n];\n for (int i = 0; i < n; i++) {\n b[i] = a[n - i - 1];\n }\n\n for (int kFirst = -1; kFirst <= 1; kFirst++) {\n int currentFirst = b[0] + kFirst;\n for (int divisor = 2; divisor * divisor <= currentFirst; divisor++) {\n if (currentFirst % divisor == 0) {\n answer = Math.min(answer, solveForPrefix(n, b, divisor, A, B));\n }\n while (currentFirst % divisor == 0) {\n currentFirst \/= divisor;\n }\n }\n if (currentFirst > 1) {\n answer = Math.min(answer, solveForPrefix(n, b, currentFirst, A, B));\n }\n }\n out.println(answer);\n }\n\n final int PREFIX = 0;\n final int REMOVED = 1;\n final int SUFFIX = 2;\n\n long solveForPrefix(int n, int[] a, int gcd, int A, int B) {\n long[][] dp = new long[3][n];\n for (int i = 0; i < 3; i++) {\n Arrays.fill(dp[i], Long.MAX_VALUE);\n }\n dp[PREFIX][0] = a[0] % gcd == 0 ? 0 : B;\n for (int i = 1; i < n; i++) {\n if (dp[PREFIX][i - 1] < Long.MAX_VALUE) {\n if (a[i] % gcd != 0 && (a[i] - 1) % gcd != 0 && (a[i] + 1) % gcd != 0) {\n dp[PREFIX][i] = Long.MAX_VALUE;\n } else {\n dp[PREFIX][i] = Math.min(dp[PREFIX][i], dp[PREFIX][i - 1] + (a[i] % gcd == 0 ? 0 : B));\n }\n }\n\n if (dp[REMOVED][i - 1] < Long.MAX_VALUE) {\n dp[REMOVED][i] = Math.min(dp[REMOVED][i], dp[REMOVED][i - 1] + A);\n }\n if (dp[PREFIX][i - 1] < Long.MAX_VALUE) {\n dp[REMOVED][i] = Math.min(dp[REMOVED][i], dp[PREFIX][i - 1] + A);\n }\n\n if (dp[REMOVED][i - 1] < Long.MAX_VALUE) {\n if (a[i] % gcd != 0 && (a[i] - 1) % gcd != 0 && (a[i] + 1) % gcd != 0) {\n dp[SUFFIX][i] = Long.MAX_VALUE;\n } else {\n dp[SUFFIX][i] = Math.min(dp[SUFFIX][i], dp[REMOVED][i - 1] + (a[i] % gcd == 0 ? 0 : B));\n }\n }\n if (dp[PREFIX][i - 1] < Long.MAX_VALUE) {\n if (a[i] % gcd != 0 && (a[i] - 1) % gcd != 0 && (a[i] + 1) % gcd != 0) {\n dp[SUFFIX][i] = Long.MAX_VALUE;\n } else {\n dp[SUFFIX][i] = Math.min(dp[SUFFIX][i], dp[PREFIX][i - 1] + (a[i] % gcd == 0 ? 0 : B));\n }\n }\n }\n return Math.min(dp[PREFIX][n - 1], Math.min(dp[REMOVED][n - 1], dp[SUFFIX][n - 1]));\n }\n}\n","description":"You are given array ai of length n. You may consecutively apply two operations to this array: remove some subsegment (continuous subsequence) of length m\u2009<\u2009n and pay for it m\u00b7a coins; change some elements of the array by at most 1, and pay b coins for each change. Please note that each of operations may be applied at most once (and may be not applied at all) so you can remove only one segment and each number may be changed (increased or decreased) by at most 1. Also note, that you are not allowed to delete the whole array.Your goal is to calculate the minimum number of coins that you need to spend in order to make the greatest common divisor of the elements of the resulting array be greater than 1.","input_specification":"The first line of the input contains integers n, a and b (1\u2009\u2264\u2009n\u2009\u2264\u20091\u2009000\u2009000,\u20090\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009109)\u00a0\u2014 the length of the array, the cost of removing a single element in the first operation and the cost of changing an element, respectively. The second line contains n integers ai (2\u2009\u2264\u2009ai\u2009\u2264\u2009109)\u00a0\u2014 elements of the array.","output_specification":"Print a single number\u00a0\u2014 the minimum cost of changes needed to obtain an array, such that the greatest common divisor of all its elements is greater than 1.","notes":"NoteIn the first sample the optimal way is to remove number 3 and pay 1 coin for it.In the second sample you need to remove a segment [17,\u200913] and then decrease number 6. The cost of these changes is equal to 2\u00b73\u2009+\u20092\u2009=\u20098 coins.","sample_inputs":["3 1 4\n4 2 3","5 3 2\n5 17 13 5 6","8 3 4\n3 7 5 4 3 12 9 4"],"sample_outputs":["1","8","13"],"human_solution":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.*;\n\npublic class D {\n\n public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n public static StringTokenizer tok;\n\n public static int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n public static long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n public static double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n public static String nextToken() throws IOException {\n if (tok == null || !tok.hasMoreTokens()) {\n tok = new StringTokenizer(in.readLine());\n }\n return tok.nextToken();\n }\n\n\/\/ public static class Pair {\n\/\/ public long change, norm;\n\/\/ public int index;\n\/\/ public Pair(long change, long norm, int index) {\n\/\/ this.change = change;\n\/\/ this.norm = norm;\n\/\/ this.index = index;\n\/\/ }\n\/\/ }\n\n public static final int PRIMES_EDGE = 1_000_000;\n public static Set primes = new TreeSet<>();\n public static boolean[] isPrime = new boolean[PRIMES_EDGE + 1];\n\n public static void findPrimesToCheck(Set setToAdd, long number) {\n for (int prime: primes) {\n if (number % prime == 0) {\n setToAdd.add(prime);\n }\n while (number % prime == 0) {\n number \/= prime;\n }\n if (number == 1) {\n return;\n }\n }\n if (number != 1) {\n setToAdd.add((int)number);\n }\n }\n\n\/\/ public static long findResult(int prime, long[] num, long a, long b, int n) {\n\/\/ byte[] info = new byte[n]; \/\/ 0 - norm, 1 - change, 2 - delete\n\/\/ int indexFirstDelete = -1, indexLastDelete = -1;\n\/\/ \/\/int indexFirstChange = -1, indexLastChange = -1;\n\/\/ int toChange = 0;\n\/\/ for (int i = 0; i < n; i++) {\n\/\/ if (num[i] % prime == 0) {\n\/\/ info[i] = 0;\n\/\/ } else if ((num[i] - 1) % prime == 0 || (num[i] + 1) % prime == 0) {\n\/\/ info[i] = 1;\n\/\/ \/\/toChange++;\n\/\/\/\/ if (indexFirstChange == -1) {\n\/\/\/\/ indexFirstChange = i;\n\/\/\/\/ }\n\/\/\/\/ indexLastChange = i;\n\/\/ } else {\n\/\/ info[i] = 2;\n\/\/ if (indexFirstDelete == -1) {\n\/\/ indexFirstDelete = i;\n\/\/ }\n\/\/ indexLastDelete = i;\n\/\/ }\n\/\/ }\n\/\/ if (indexFirstDelete != -1) {\n\/\/ toChange = 0;\n\/\/ for (int i = 0; i < indexFirstDelete; i++) {\n\/\/ if (info[i] == 1) {\n\/\/ toChange++;\n\/\/ }\n\/\/ }\n\/\/ for (int i = indexLastDelete + 1; i < n; i++) {\n\/\/ if (info[i] == 1) {\n\/\/ toChange++;\n\/\/ }\n\/\/ }\n\/\/ return toChange * b + (indexLastDelete - indexFirstDelete + 1) * a;\n\/\/ }\n\/\/ \/\/if (indexFirstChange == -1 || a >= b) {\n\/\/\/\/ if (toChange == 0 || a >= b) {\n\/\/\/\/ return toChange * b;\n\/\/\/\/ }\n\/\/ long[][] dp = new long[3][n];\n\/\/ dp[0][0] = (info[0] == 0 ? 0 : b);\n\/\/ dp[1][0] = a;\n\/\/ dp[2][0] = (info[0] == 0 ? 0 : b);\n\/\/ for (int i = 1; i < n; i++) {\n\/\/ dp[0][i] = dp[0][i - 1] + (info[i] == 0 ? 0 : b);\n\/\/ dp[1][i] = Math.min(dp[1][i - 1], dp[0][i - 1]) + a;\n\/\/ dp[2][i] = Math.min(dp[2][i - 1], dp[1][i - 1]) + (info[i] == 0 ? 0 : b);\n\/\/ }\n\/\/ long result = Math.min(dp[0][n - 1], Math.min(dp[1][n - 1], dp[2][n - 1]));\n\/\/\/\/ long result = Math.min(dp[0][n - 1], dp[2][n - 1]);\n\/\/\/\/ dp[0][0] = dp[1][0] = dp[2][0] = (info[0] == 0 ? 0 : b);\n\/\/\/\/ for (int i = 1; i < n; i++) {\n\/\/\/\/ dp[0][i] = dp[0][i - 1] + (info[i] == 0 ? 0 : b);\n\/\/\/\/ dp[1][i] = Math.min(dp[1][i - 1], dp[0][i - 1]) + a;\n\/\/\/\/ dp[2][i] = Math.min(dp[2][i - 1], dp[1][i - 1]) + (info[i] == 0 ? 0 : b);\n\/\/\/\/ }\n\/\/\/\/ result = Math.min(result, Math.min(dp[0][n - 1], Math.min(dp[1][n - 1], dp[2][n - 1])));\n\/\/ return result;\n\/\/\n\/\/\/\/ ArrayList pairs = new ArrayList<>();\n\/\/\/\/ int changeCounter = 0, normCounter = 0;\n\/\/\/\/ for (int i = indexFirstChange; i <= indexLastChange; i++) {\n\/\/\/\/ if (info[i] == 0) {\n\/\/\/\/ normCounter++;\n\/\/\/\/ } else if (info[i] == 1) {\n\/\/\/\/ changeCounter++;\n\/\/\/\/ }\n\/\/\/\/ if (i == indexLastChange || info[i] == 0 && info[i + 1] == 1) {\n\/\/\/\/ int index = indexFirstChange;\n\/\/\/\/ if (!pairs.isEmpty()) {\n\/\/\/\/ Pair pair = pairs.get(pairs.size() - 1);\n\/\/\/\/ index = pair.index + (int)(pair.change) + (int)(pair.norm);\n\/\/\/\/ }\n\/\/\/\/ pairs.add(new Pair(changeCounter, normCounter, index));\n\/\/\/\/ changeCounter = normCounter = 0;\n\/\/\/\/ }\n\/\/\/\/ }\n\/\/\/\/ int m = pairs.size();\n\/\/\/\/ int[] left = new int[m];\n\/\/\/\/ int[] right = new int[m];\n\/\/\/\/ left[0] = 0;\n\/\/\/\/ for (int i = 1; i < m; i++) {\n\/\/\/\/ if ((pairs.get(i - 1).change + pairs.get(i - 1).norm) * a <= pairs.get(i - 1).change * b) {\n\/\/\/\/ left[i] = left[i - 1];\n\/\/\/\/ } else {\n\/\/\/\/ left[i] = i;\n\/\/\/\/ }\n\/\/\/\/ }\n\/\/\/\/ right[m - 1] = m - 1;\n\/\/\/\/ for (int i = m - 2; i >= 0; i--) {\n\/\/\/\/ if ((pairs.get(i).norm + pairs.get(i + 1).change) * a <= pairs.get(i + 1).change * b) {\n\/\/\/\/ right[i] = right[i + 1];\n\/\/\/\/ } else {\n\/\/\/\/ right[i] = i;\n\/\/\/\/ }\n\/\/\/\/ }\n\/\/\/\/ int[] sum = new int[m];\n\/\/\/\/ sum[0] = (int)pairs.get(0).change;\n\/\/\/\/ for (int i = 1; i < m; i++) {\n\/\/\/\/ sum[i] = sum[i - 1] + (int)pairs.get(i).change;\n\/\/\/\/ }\n\/\/\/\/ long result = toChange * b;\n\/\/\/\/ for (int i = 0; i < m; i++) {\n\/\/\/\/ int currToChange = toChange;\n\/\/\/\/ currToChange -= sum[right[i]];\n\/\/\/\/ if (left[i] > 0) {\n\/\/\/\/ currToChange += sum[left[i] - 1];\n\/\/\/\/ }\n\/\/\/\/ long currResult = currToChange * b + (pairs.get(right[i]).change + pairs.get(right[i]).index - pairs.get(left[i]).index) * a;\n\/\/\/\/ result = Math.min(result, currResult);\n\/\/\/\/ }\n\/\/\/\/ return result;\n\/\/ }\n\n public static long findResult(int prime, long[] num, long a, long b, int n) {\n long maxValue = Math.max(a, b) * n;\n long[][] dp = new long[3][n + 1];\n dp[0][0] = dp[1][0] = dp[2][0] = 0;\n for (int i = 1; i <= n; i++) {\n if (num[i - 1] % prime == 0) {\n dp[0][i] = dp[0][i - 1];\n dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n dp[2][i] = Math.min(dp[1][i - 1], dp[2][i - 1]);\n } else if ((num[i - 1] - 1) % prime == 0 || (num[i - 1] + 1) % prime == 0) {\n dp[0][i] = dp[0][i - 1] + b;\n dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n dp[2][i] = Math.min(dp[1][i - 1] + b, dp[2][i - 1] + b);\n } else {\n dp[0][i] = maxValue;\n dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n dp[2][i] = maxValue;\n }\n }\n long result = Math.min(dp[0][n], Math.min(dp[1][n], dp[2][n]));\n\/\/ if (num[0] % prime == 0) {\n\/\/ dp[0][1] = dp[2][1] = 0;\n\/\/ dp[1][1] = a;\n\/\/ } else if ((num[0] - 1) % prime == 0 || (num[0] + 1) % prime == 0) {\n\/\/ dp[0][1] = dp[2][1] = b;\n\/\/ dp[1][1] = a;\n\/\/ } else {\n\/\/ dp[0][1] = dp[1][1] = dp[2][1] = maxValue;\n\/\/ }\n\/\/ for (int i = 2; i <= n; i++) {\n\/\/ if (num[i - 1] % prime == 0) {\n\/\/ dp[0][i] = dp[0][i - 1];\n\/\/ dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n\/\/ dp[2][i] = Math.min(dp[1][i - 1], dp[2][i - 1]);\n\/\/ } else if ((num[i - 1] - 1) % prime == 0 || (num[i - 1] + 1) % prime == 0) {\n\/\/ dp[0][i] = dp[0][i - 1] + b;\n\/\/ dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n\/\/ dp[2][i] = Math.min(dp[1][i - 1] + b, dp[2][i - 1] + b);\n\/\/ } else {\n\/\/ dp[0][i] = maxValue;\n\/\/ dp[1][i] = Math.min(dp[0][i - 1] + a, dp[1][i - 1] + a);\n\/\/ dp[2][i] = maxValue;\n\/\/ }\n\/\/ }\n\/\/ result = Math.min(result, Math.min(dp[0][n], Math.min(dp[1][n], dp[2][n])));\n return result;\n }\n\n public static void main(String[] args) throws IOException {\n Arrays.fill(isPrime, true);\n isPrime[0] = isPrime[1] = false;\n for (int i = 2; i <= PRIMES_EDGE; i++) {\n if (isPrime[i]) {\n primes.add(i);\n }\n if (isPrime[i] && (long)i * (long)i <= PRIMES_EDGE) {\n for (int j = i * i; j <= PRIMES_EDGE; j += i) {\n isPrime[j] = false;\n }\n }\n }\n\n int n = nextInt();\n long a = nextInt();\n long b = nextInt();\n long[] num = new long[n];\n for (int i = 0; i < n; i++) {\n num[i] = nextInt();\n }\n\n Set primesToCheck = new HashSet<>();\n findPrimesToCheck(primesToCheck, num[0] - 1);\n findPrimesToCheck(primesToCheck, num[0]);\n findPrimesToCheck(primesToCheck, num[0] + 1);\n findPrimesToCheck(primesToCheck, num[n - 1] - 1);\n findPrimesToCheck(primesToCheck, num[n - 1]);\n findPrimesToCheck(primesToCheck, num[n - 1] + 1);\n\n long result = Long.MAX_VALUE;\n for (int prime: primesToCheck) {\n result = Math.min(result, findResult(prime, num, a, b, n));\n }\n System.out.println(result);\n }\n}","testcases":"[{'input': '3 1 4\\r\\n4 2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 3 2\\r\\n5 17 13 5 6\\r\\n', 'output': ['8\\r\\n']}, {'input': '8 3 4\\r\\n3 7 5 4 3 12 9 4\\r\\n', 'output': ['13\\r\\n']}, {'input': '3 4 3\\r\\n9 9 4\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 3 5\\r\\n7 4 7 4 8\\r\\n', 'output': ['8\\r\\n']}, {'input': '1 6 2\\r\\n9\\r\\n', 'output': ['0\\r\\n']}, {'input': '7 46 23\\r\\n47 17 90 30 39 6 63\\r\\n', 'output': ['46\\r\\n']}, {'input': '13 219 292\\r\\n796 798 798 797 328 263 148 931 92 578 262 798 796\\r\\n', 'output': ['803\\r\\n']}, {'input': '45 393296667 817784089\\r\\n513035443 513035443 513035445 513035445 513035443 555648978 463549879 830693049 524420119 541365334 562791911 736173182 644390537 639730339 913702156 807631127 679411095 457747249 554394051 803981524 901463184 651788488 792766018 587562656 564169971 645381787 497940709 886010956 577261234 513035444 513035443 513035443 513035445 513035445 513035444 513035444 513035443 513035443 513035445 513035445 513035443 513035443 513035443 513035443 513035445\\r\\n', 'output': ['16911756681\\r\\n']}, {'input': '93 1985 9702\\r\\n1711 6269 9689 9119 569 3990 5129 6314 2171 4078 2607 3063 5410 7140 7831 4622 2597 8486 9050 3110 1673 5435 8981 6871 4679 8854 5675 39 7227 2533 1782 7833 7029 5919 7792 4192 5856 6020 4735 9772 3145 8757 3853 6371 7217 815 6643 837 3490 1667 2360 983 653 2708 5795 9203 1405 2875 7590 2682 8667 5369 8371 1235 3093 1802 483 2359 677 2044 4556 8403 6419 301 7410 1964 9587 392 1712 1105 7882 3215 5212 1885 1772 4865 1248 7410 9690 6840 7981 8550 4561\\r\\n', 'output': ['182620\\r\\n']}, {'input': '1 5 7\\r\\n99\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 5 7\\r\\n2 5\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 7 5\\r\\n5 7\\r\\n', 'output': ['7\\r\\n']}, {'input': '5 10 1\\r\\n1300333 1300332 2600666 1300334 1300332\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 1 1\\r\\n1300333 1300332 2600666 1300334 1300332\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 3 0\\r\\n463 926 925\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 965 473\\r\\n569 780\\r\\n', 'output': ['473\\r\\n']}, {'input': '1 334159859 249565919\\r\\n52\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 2 10\\r\\n124 777 617 616 618\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 457 423\\r\\n559 559 561 559\\r\\n', 'output': ['457\\r\\n']}, {'input': '1 476059451 940757790\\r\\n609\\r\\n', 'output': ['0\\r\\n']}, {'input': '6 4 10\\r\\n577 576 883 679 883 864\\r\\n', 'output': ['20\\r\\n']}, {'input': '3 63 569\\r\\n764 383 381\\r\\n', 'output': ['126\\r\\n']}, {'input': '6 128454855 323141531\\r\\n920 204 261 770 485 919\\r\\n', 'output': ['513819420\\r\\n']}, {'input': '10 8 4\\r\\n803 402 803 803 801 226 802 801 401 801\\r\\n', 'output': ['24\\r\\n']}, {'input': '1 155 276\\r\\n104\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 533 837\\r\\n6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6\\r\\n', 'output': ['1370\\r\\n']}, {'input': '7 735937743 207711841\\r\\n806 400 667 521 729 413 878\\r\\n', 'output': ['830847364\\r\\n']}, {'input': '6 100 1\\r\\n3 2 2 2 2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 10 2\\r\\n11 13\\r\\n', 'output': ['4\\r\\n']}]","id":112} {"difficulty":1900,"lang":"Java 11","lang_cluster":"Java","src_uid":"d8d449d0fccf755822548ddf9d74b9ab","execute_outcome":"RUNTIME_ERROR","source_code":"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]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 int 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 int[n];\n cost=new int[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;in) {\n return Long.MAX_VALUE\/10;\n }\n if(root==y) {\n return 0;\n }\n if(dp[root][dep]!=-1) {\n return dp[root][dep];\n }\n long min=Long.MAX_VALUE;\n for(int i=0;i=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 0;\n\t}\n\n\tpublic static void main(String[] args) throws Exception {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\n\t\tPoint[] p = new Point[n + 1];\n\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tp[i] = new Point(sc.nextDouble(), sc.nextDouble());\n\n\t\tp[n] = p[0];\n\n\t\tint m = sc.nextInt();\n\n\t\twhile (m-- > 0)\n\t\t\tif (!inPolygon(p, new Point(sc.nextDouble(), sc.nextDouble()))) {\n\t\t\t\tSystem.out.println(\"NO\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\tSystem.out.println(\"YES\");\n\n\t}\n\n\tstatic boolean inPolygon(Point[] p, Point target) {\n\t\tint low = 1;\n\t\tint high = p.length - 1;\n\n\t\tboolean ccw = crossPrdouct(p[0], p[1], p[p.length - 1]) == 1;\n\t\t\n\t\tif(!ccw)\n\t\t{\n\t\t\tint temp = low ;\n\t\t\tlow = high;\n\t\t\thigh = temp;\n\t\t\t\n\t\t}\n\t\t\n\t\twhile (Math.abs(low - high) > 1) {\n\t\t\t\tint mid = (low + high) \/2;\n\n\t\t\t\tif (crossPrdouct(p[0], p[mid], target) > 0)\n\t\t\t\t\tlow = mid;\n\t\t\t\telse\n\t\t\t\t\thigh = mid;\n\n\t\t\t}\n\t\t\n\t\t\n\t\treturn crossPrdouct(p[low], p[high],target ) >0;\n\t\t\n\n\t}\n\n\tstatic double crossPrdouct(Point p, Point q, Point r)\n\t{\n\t\tVector pq = new Vector(p, q);\n\t\tVector pr = new Vector(p, r);\n\t\tdouble cross = pq.cross(pr);\n\t\t\n\t\tif(Math.abs(cross) > EPS)\n\t\t\treturn cross > 0 ? 1 : -1;\n\t\t\n\t\treturn 0;\n\t\t\n\t\n\t}\n\n\tstatic class Vector {\n\n\t\tdouble x, y;\n\n\t\tVector(double a, double b) {\n\t\t\tx = a;\n\t\t\ty = b;\n\t\t}\n\n\t\tVector(Point a, Point b) {\n\t\t\tthis(b.x - a.x, b.y - a.y);\n\t\t}\n\n\t\tVector scale(double s) {\n\t\t\treturn new Vector(x * s, y * s);\n\t\t} \/\/ s is a non-negative value\n\n\t\tdouble dot(Vector v) {\n\t\t\treturn (x * v.x + y * v.y);\n\t\t}\n\n\t\tdouble cross(Vector v) {\n\t\t\treturn x * v.y - y * v.x;\n\t\t}\n\n\t\tdouble norm2() {\n\t\t\treturn x * x + y * y;\n\t\t}\n\n\t\tVector reverse() {\n\t\t\treturn new Vector(-x, -y);\n\t\t}\n\n\t\tVector normalize() {\n\t\t\tdouble d = Math.sqrt(norm2());\n\t\t\treturn scale(1 \/ d);\n\t\t}\n\t}\n\n\tstatic class Point implements Comparable {\n\n\t\tstatic final double EPS = 1e-9;\n\n\t\tdouble x, y;\n\n\t\tPoint(double a, double b) {\n\t\t\tx = a;\n\t\t\ty = b;\n\t\t}\n\n\t\tpublic int compareTo(Point p) {\n\t\t\tif (Math.abs(y - p.y) > EPS)\n\t\t\t\treturn y > p.y ? 1 : -1;\n\n\t\t\treturn 0;\n\t\t}\n\n\t\tpublic double dist(Point p) {\n\t\t\treturn Math.sqrt(sq(x - p.x) + sq(y - p.y));\n\t\t}\n\t\t\n\t\tboolean between(Point p, Point q)\n\t\t{\n\t\t\treturn x < Math.max(p.x, q.x) + EPS && x + EPS > Math.min(p.x, q.x)\n\t\t\t\t\t&& y < Math.max(p.y, q.y) + EPS && y + EPS > Math.min(p.y, q.y);\n\t\t}\n\n\t\tstatic double sq(double x) {\n\t\t\treturn x * x;\n\t\t}\n\n\t}\n\n\tstatic class Scanner {\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s) {\n\t\t\tbr = new BufferedReader(new InputStreamReader(s));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong() throws IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic String nextLine() throws IOException {\n\t\t\treturn br.readLine();\n\t\t}\n\n\t\tpublic double nextDouble() throws IOException {\n\t\t\tString x = next();\n\t\t\tStringBuilder sb = new StringBuilder(\"0\");\n\t\t\tdouble res = 0, f = 1;\n\t\t\tboolean dec = false, neg = false;\n\t\t\tint start = 0;\n\t\t\tif (x.charAt(0) == '-') {\n\t\t\t\tneg = true;\n\t\t\t\tstart++;\n\t\t\t}\n\t\t\tfor (int i = start; i < x.length(); i++)\n\t\t\t\tif (x.charAt(i) == '.') {\n\t\t\t\t\tres = Long.parseLong(sb.toString());\n\t\t\t\t\tsb = new StringBuilder(\"0\");\n\t\t\t\t\tdec = true;\n\t\t\t\t} else {\n\t\t\t\t\tsb.append(x.charAt(i));\n\t\t\t\t\tif (dec)\n\t\t\t\t\t\tf *= 10;\n\t\t\t\t}\n\t\t\tres += Long.parseLong(sb.toString()) \/ f;\n\t\t\treturn res * (neg ? -1 : 1);\n\t\t}\n\n\t\tpublic boolean ready() throws IOException {\n\t\t\treturn br.ready();\n\t\t}\n\n\t}\n\n}\n","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"],"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":114} {"difficulty":2300,"lang":"Java 8","lang_cluster":"Java","src_uid":"db853d598b638dcdeaea5a26ae83758b","execute_outcome":"WRONG_ANSWER","source_code":"import java.io.*;\nimport java.util.*;\nimport java.util.Map.Entry;\npublic class CF123_D1_D{\n\tpublic static void main(String[] args)throws Throwable {\n\t\tMyScanner sc=new MyScanner();\n\t\tPrintWriter pw=new PrintWriter(System.out);\n\t\t\n\t\tchar [] s=sc.next().toCharArray();\n\t\tSA=new SuffixAutomaton(s);\n\t\tint n=SA.idx+1;\n\t\tacceptState=new boolean [n];\n\t\tint cur=SA.idx;\n\t\twhile(true){\n\t\t\tacceptState[cur]=true;\n\t\t\tif(cur==0)\n\t\t\t\tbreak;\n\t\t\tcur=SA.link[cur];\n\t\t}\n\t\tcnt=new long [n];\n\t\tArrays.fill(cnt, -1);\n\t\tlong ans=0;\n\t\tfor(int i=0;i<=SA.idx;i++){\n\t\t\tlong x=dfs(i);\n\t\t\tint cnt=SA.len[i]-SA.len[SA.link[i]];\n\t\t\tans+=x*(x+1)*cnt\/2;\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.flush();\n\t\tpw.close();\n\t}\n\tstatic SuffixAutomaton SA;\n\tstatic boolean [] acceptState;\n\tstatic long [] cnt;\n\t\n\tstatic long dfs(int u){\n\t\tif(cnt[u]!=-1)\n\t\t\treturn cnt[u];\n\t\tlong ans=acceptState[u]? 1 : 0;\n\t\tfor(Entry e : SA.nxt[u].entrySet()){\n\t\t\tint v=e.getValue();\n\t\t\tans+=dfs(v);\n\t\t}\n\t\treturn cnt[u]=ans;\n\t}\n\t\n\tstatic class SuffixAutomaton {\n\t\tint [] link,len;\n\t\tTreeMap [] nxt;\n\t\tint lst, idx;\n\t\t\n\t\tSuffixAutomaton(char [] s){\n\t\t\tint n=s.length;\n\t\t\tlink=new int [n<<1];\n\t\t\tlen=new int [n<<1];\n\t\t\tnxt=new TreeMap [n<<1];\n\t\t\tnxt[0]=new TreeMap();\n\t\t\tfor(char c : s)\n\t\t\t\taddLeter(c);\n\t\t}\n\t\t\n\t\tvoid addLeter(char c){\n\t\t\tint cur = ++idx;\n\t\t\tint p=lst;\n\t\t\twhile(!nxt[p].containsKey(c)){\n\t\t\t\tnxt[p].put(c, cur);\n\t\t\t\tp=link[p];\n\t\t\t}\n\t\t\tint q=nxt[p].get(c);\n\t\t\t\n\t\t\t\/\/ a node containing an edge with character c stopped me and it is not the root\n\t\t\tif(q!=cur){\n\t\t\t\tif(len[q]==len[p]+1)\n\t\t\t\t\tlink[cur]=q;\n\t\t\t\telse{\n\t\t\t\t\tint clone=++idx;\n\t\t\t\t\tlen[clone]=len[p]+1;\n\t\t\t\t\tlink[clone]=link[q];\n\t\t\t\t\tnxt[clone]=new TreeMap(nxt[q]);\n\t\t\t\t\tlink[cur]=link[q]=clone;\n\t\t\t\t\twhile(nxt[p].get(c)==q){\n\t\t\t\t\t\tnxt[p].put(c, clone);\n\t\t\t\t\t\tp=link[p];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen[cur]=len[lst]+1;\n\t\t\tnxt[cur]=new TreeMap();\n\t\t\tlst=cur;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic class MyScanner {\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic MyScanner() {\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tString next() {while (st == null || !st.hasMoreElements()) {\n\t\t\ttry {st = new StringTokenizer(br.readLine());}\n\t\t\tcatch (IOException e) {e.printStackTrace();}}\n\t\treturn st.nextToken();}\n\t\tint nextInt() {return Integer.parseInt(next());}\n\t\tlong nextLong() {return Long.parseLong(next());}\n\t\tdouble nextDouble() {return Double.parseDouble(next());}\n\t\tString nextLine(){String str = \"\";\n\t\ttry {str = br.readLine();}\n\t\tcatch (IOException e) {e.printStackTrace();}\n\t\treturn str;}\n\t}\n} ","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"],"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":115} {"difficulty":1900,"lang":"Java 8","lang_cluster":"Java","src_uid":"e05ef33935d04bd3714269268aceda41","execute_outcome":"WRONG_ANSWER","source_code":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.Stack;\nimport java.util.StringTokenizer;\n\npublic class D {\n\tstatic char[] s;\n\tstatic int n, cor[];\n\tstatic int[][][][] memo;\n\tstatic int mod = (int) 1e9 + 7;\n\n\tstatic int dp(int i, int j, int ci, int cj) {\n\t\tif (i >= j)\n\t\t\treturn 1;\n\t\tif (memo[i][j][ci][cj] != -1)\n\t\t\treturn memo[i][j][ci][cj];\n\t\tlong res = 0;\n\t\tif(j != cor[i] || cj != 2)\n\t\t\tres = (res + 1l*dp(i+1, cor[i]-1, ci, 2)*dp(cor[i]+1, j, 2, cj)%mod) % mod;\n\t\tif(j != cor[i] || cj != 1)\n\t\t\tres = (res + 1l*dp(i+1, cor[i]-1, ci, 1)*dp(cor[i]+1, j, 1, cj)%mod) % mod;\n\t\tif(ci == 0){\n\t\t\tres = (res + 1l*dp(i+1, cor[i]-1, 1, 0)*dp(cor[i]+1, j, 0, cj)%mod) % mod;\n\t\t\tres = (res + 1l*dp(i+1, cor[i]-1, 2, 0)*dp(cor[i]+1, j, 0, cj)%mod) % mod;\n\t\t}\n\t\telse{\n\t\t\tres = (res + 1l*dp(i+1, cor[i]-1, ci==1?2:1, 0)*dp(cor[i]+1, j, 0, cj)%mod) % mod;\n\t\t}\n\/\/\t\tSystem.out.println(i + \" \" + j + \" \" + ci + \" \" + cj + \" \" + res);\n\t\treturn memo[i][j][ci][cj] = (int) res;\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tScanner sc = new Scanner();\n\t\tPrintWriter out = new PrintWriter(System.out);\n\t\ts = sc.next().toCharArray();\n\t\tn = s.length;\n\t\tmemo = new int[n + 1][n + 1][3][3];\n\t\tfor (int[][][] i : memo)\n\t\t\tfor (int[][] j : i)\n\t\t\t\tfor (int[] k : j)\n\t\t\t\t\tArrays.fill(k, -1);\n\t\tcor = new int[n];\n\t\tStack st = new Stack<>();\n\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\tif (s[i] == '(')\n\t\t\t\tst.add(i);\n\t\t\telse {\n\t\t\t\tint tmp = st.pop();\n\t\t\t\tcor[i] = tmp;\n\t\t\t\tcor[tmp] = i;\n\t\t\t}\n\t\t}\n\/\/\t\tSystem.out.println(Arrays.toString(cor));\n\t\tout.println(dp(0, n-1, 0, 0));\n\t\tout.flush();\n\t\tout.close();\n\t}\n\n\tstatic class Scanner {\n\t\tBufferedReader bf;\n\t\tStringTokenizer st;\n\n\t\tpublic Scanner() {\n\t\t\tbf = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\n\t\tpublic String next() throws IOException {\n\t\t\twhile (st == null || !st.hasMoreTokens())\n\t\t\t\tst = new StringTokenizer(bf.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws NumberFormatException, IOException {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic double nextDouble() throws NumberFormatException, IOException {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\n\t\tpublic long nextLong() throws NumberFormatException, IOException {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n}\n","description":"Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.You are given string s. It represents a correct bracket sequence. A correct bracket sequence is the sequence of opening (\"(\") and closing (\")\") brackets, such that it is possible to obtain a correct mathematical expression from it, inserting numbers and operators between the brackets. For example, such sequences as \"(())()\" and \"()\" are correct bracket sequences and such sequences as \")()\" and \"(()\" are not.In a correct bracket sequence each bracket corresponds to the matching bracket (an opening bracket corresponds to the matching closing bracket and vice versa). For example, in a bracket sequence shown of the figure below, the third bracket corresponds to the matching sixth one and the fifth bracket corresponds to the fourth one. You are allowed to color some brackets in the bracket sequence so as all three conditions are fulfilled: Each bracket is either not colored any color, or is colored red, or is colored blue. For any pair of matching brackets exactly one of them is colored. In other words, for any bracket the following is true: either it or the matching bracket that corresponds to it is colored. No two neighboring colored brackets have the same color. Find the number of different ways to color the bracket sequence. The ways should meet the above-given conditions. Two ways of coloring are considered different if they differ in the color of at least one bracket. As the result can be quite large, print it modulo 1000000007 (109\u2009+\u20097).","input_specification":"The first line contains the single string s (2\u2009\u2264\u2009|s|\u2009\u2264\u2009700) which represents a correct bracket sequence. ","output_specification":"Print the only number \u2014 the number of ways to color the bracket sequence that meet the above given conditions modulo 1000000007 (109\u2009+\u20097).","notes":"NoteLet's consider the first sample test. The bracket sequence from the sample can be colored, for example, as is shown on two figures below. The two ways of coloring shown below are incorrect. ","sample_inputs":["(())","(()())","()"],"sample_outputs":["12","40","4"],"human_solution":"import java.io.*;\nimport java.util.*;\n\npublic class D\n{\n private static int [] pair;\n private static final int MOD = 1000000000 + 7;\n private static long [][][][] memo;\n public static void main(String[] strings) throws IOException\n {\n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\n char [] str = reader.readLine().toCharArray();\n int n = str.length;\n int [] last = new int[n\/2+1];\n Arrays.fill(last, -1);\n\n pair = new int[n];\n int sum = 0;\n for(int i = 0 ; i < n ; i++)\n {\n sum += str[i] == '(' ? 1 : -1;\n if(str[i] == ')')\n {\n pair[last[sum+1]] = i;\n pair[i] = last[sum+1];\n }\n else\n last[sum] = i;\n }\n\n memo = new long[n][n][3][3];\n for(long [][][] fill1 : memo)\n for(long [][] fill2 : fill1)\n for(long [] fill3 : fill2)\n Arrays.fill(fill3, -1);\n\n long res = rec(0, n-1, 2, 2);\n System.out.println(res);\n }\n\n private static long rec(int left, int right, int pLeft, int pRight)\n {\n if(left > right)\n return 1;\n\n if(memo[left][right][pLeft][pRight] != -1)\n return memo[left][right][pLeft][pRight];\n\n int mid = pair[left];\n long res = 0;\n\n res += (pLeft*(rec(left+1, mid-1, 1, 2) * rec(mid+1, right, 2, pRight))%MOD)%MOD;\n res %= MOD;\n res += ((right == mid ? pRight : 2)*(rec(left+1, mid-1, 2, 1) * rec(mid+1, right, 1, pRight))%MOD)%MOD;\n res %= MOD;\n\n return memo[left][right][pLeft][pRight] = res;\n }\n}","testcases":"[{'input': '(())\\r\\n', 'output': ['12\\r\\n']}, {'input': '(()())\\r\\n', 'output': ['40\\r\\n']}, {'input': '()\\r\\n', 'output': ['4\\r\\n']}, {'input': '((()))\\r\\n', 'output': ['36\\r\\n']}, {'input': '()(())\\r\\n', 'output': ['42\\r\\n']}, {'input': '()()()\\r\\n', 'output': ['48\\r\\n']}, {'input': '(())(())\\r\\n', 'output': ['126\\r\\n']}, {'input': '()()()()()()()()()()()(())\\r\\n', 'output': ['9085632\\r\\n']}, {'input': '()(())()((()))\\r\\n', 'output': ['4428\\r\\n']}, {'input': '()()(())()(())\\r\\n', 'output': ['5040\\r\\n']}, {'input': '()()()()()()()()()()()()()()()()\\r\\n', 'output': ['411525376\\r\\n']}, {'input': '(()()())\\r\\n', 'output': ['136\\r\\n']}, {'input': '()(()())()\\r\\n', 'output': ['480\\r\\n']}, {'input': '(())()(())()\\r\\n', 'output': ['1476\\r\\n']}, {'input': '()()(()())(())()()()\\r\\n', 'output': ['195840\\r\\n']}, {'input': '()()()((((())))())()()()()()((()))()()(())()(((())))()(()())((())())((()())(((((()()()())()()())))))\\r\\n', 'output': ['932124942\\r\\n']}, {'input': '((()(((((()(()(())))()((((((((())))()(((((())()((((())())(()(()(())())((()))()((()))))))))))))))))))))\\r\\n', 'output': ['90824888\\r\\n']}, {'input': '((()))((())())((()()))()(())(()())(())()()()((()(((()())))()())()((((()((()((())))(())(()(())())))((()())()()()((())()))()(())(())))()(((((()())))))))\\r\\n', 'output': ['100627207\\r\\n']}, {'input': '()(((()((((()())))())(())(((((()(()()))))()()))((())))()())((())))(())()((()())())()(()(()())())(()())()(()(((((()))()((()()(())()(())(()((()((()))))()(())()()(()()()((((()())()))))()(((()(((((()()((((())(())))()())(()))(((())((()())(()))())(((()()()(()(())())())(()()()))))())))()((()(()()(()))())((())(()()()(())()))()()(((())))((()))(()((()(((()))((((()())))())(((())()(()((())))))))))))))))))))))\\r\\n', 'output': ['306199947\\r\\n']}, {'input': '(())(((((()()()()())(())))(()()((()(()(((((())(()())))())(()()(()((())()(()()))))))(())()())))()((()()())))()()(()(())())()())()(())(((((()(()()(((()())()))((())((((()()()))())(((())(((())))))))))))))\\r\\n', 'output': ['270087235\\r\\n']}, {'input': '()()()((()))(())(((())()(())(())))()()(((()((()()()))(()()(())(())))(()()((()((())(()()(()(())))))))(((())()((((()())))()(((()()())))()))()())))()(()(()())((()((()))))())(((((()())()((((()))(((((()())()))(((()()()((((((()()(())(()))((()(()(()((()((((()(((()(()()(()()((((()))()()()(()((((()(((())(((()()()(())()))((()()()(()))))())()))))(((((((()))())))(((()(()())(())))())))((((())(())())(((()()()))((()()))())(()))(())((()(()))(()()((()(()((()(())(()))()()))))))))))))))))))))))))))))))))))))))))))\\r\\n', 'output': ['461776571\\r\\n']}, {'input': '()()(((((()((()(())()(()))(()(()(()(()(())(())(())(()(()((())))()))())((()((()(()(((()(()))()(()())(()()()()(((((()(((()))((((())())(((()((((()((((((())())))()))))))))(())())))(((()((()))))((())(()()))()(()(()((()())())()))))((()))))()((())())(()())()())))())())())())()((()((())((()()())()())())()(())()))(()(()))())))(()()()())()())))))))((((()())))((((()()()))())((()(())))))()((()(((())()()()(()()()()()))))(((()())()))()()(((())(()())(()()))))))\\r\\n', 'output': ['66338682\\r\\n']}, {'input': '(()())()()()((((()(()()(())()((())(((()((()()(()))()))()()))))()(()(())(()))))))\\r\\n', 'output': ['639345575\\r\\n']}, {'input': '()((()))((((()((())((()()((((()))()()((())((()(((((()(()))((())()))((((())()(()(()))()))))))))))))))))))\\r\\n', 'output': ['391997323\\r\\n']}, {'input': '(((((()())))))()()()()()(())()()()((()()))()()()()()(((()(())))())(((()())))\\r\\n', 'output': ['422789312\\r\\n']}, {'input': '((()((()))()((()(()))())))()((()())())()(()())((()))(()())(())()(())()(())(())((()()))((()))()()()()(())()\\r\\n', 'output': ['140121189\\r\\n']}, {'input': '()()\\r\\n', 'output': ['14\\r\\n']}]","id":116} {"difficulty":2400,"lang":"Java 6","lang_cluster":"Java","src_uid":"e9db8d048e9763cf38c584342dea9f53","execute_outcome":"COMPILATION_ERROR","source_code":"\/\/package round83;\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\n\npublic class C3 {\n\tInputStream is;\n\tPrintWriter out;\n\tString INPUT = \"\";\n\t\n\tvoid solve()\n\t{\n\t\tint n = ni();\n\t\tlong y = nl()-2001;\n\t\tint m = ni();\n\t\t\n\t\tint[][] lt = new int[m][2];\n\t\tfor(int i = 0;i < m;i++){\n\t\t\tlt[i][0] = ni() - 1;\n\t\t\tlt[i][1] = ni() - 1;\n\t\t}\n\t\t\n\t\tint[] a = new int[n];\n\t\tint used = 0;\n\t\touter:\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tinner:\n\t\t\tfor(int j = 0;j < n;j++){\n\t\t\t\tif(used<<31-j>=0){\n\t\t\t\t\ta[i] = j;\n\t\t\t\t\tfor(int k = 0;k < m;k++){\n\t\t\t\t\t\tif(lt[k][0] <= i && lt[k][1] <= i && a[lt[k][0]] > a[lt[k][1]])continue inner;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tint L = n-i-1;\n\t\t\t\t\tlong[] dp = new long[1<=0)left[lp++] = k;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tfor(int k = 1;k < 1< left[h])continue iinner;\n\t\t\t\t\t\t\t\t\tif(lt[f][0] == i+l+1 && lt[f][1] <= i && left[h] > a[lt[f][1]])continue iinner;\n\t\t\t\t\t\t\t\t\tif(lt[f][0] == i+l+1 && lt[f][1] > i && k<<31-(lt[f][1]-(i+1))<0)continue iinner;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdp[k] += dp[k^1< 0)out.print(' ');\n\t\t\tout.print(a[i]+1);\n\t\t}\n\t\tout.println();\n\t}\n\t\n\tvoid run() throws Exception\n\t{\n\t\tis = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());\n\t\tout = new PrintWriter(System.out);\n\t\t\n\t\tlong s = System.currentTimeMillis();\n\t\tsolve();\n\t\tout.flush();\n\t\ttr(System.currentTimeMillis()-s+\"ms\");\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception\n\t{\n\t\tnew C3().run();\n\t}\n\t\n\tpublic int ni()\n\t{\n\t\ttry {\n\t\t\tint num = 0;\n\t\t\tboolean minus = false;\n\t\t\twhile((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));\n\t\t\tif(num == '-'){\n\t\t\t\tnum = 0;\n\t\t\t\tminus = true;\n\t\t\t}else{\n\t\t\t\tnum -= '0';\n\t\t\t}\n\t\t\t\n\t\t\twhile(true){\n\t\t\t\tint b = is.read();\n\t\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t}else{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic long nl()\n\t{\n\t\ttry {\n\t\t\tlong num = 0;\n\t\t\tboolean minus = false;\n\t\t\twhile((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));\n\t\t\tif(num == '-'){\n\t\t\t\tnum = 0;\n\t\t\t\tminus = true;\n\t\t\t}else{\n\t\t\t\tnum -= '0';\n\t\t\t}\n\t\t\t\n\t\t\twhile(true){\n\t\t\t\tint b = is.read();\n\t\t\t\tif(b >= '0' && b <= '9'){\n\t\t\t\t\tnum = num * 10 + (b - '0');\n\t\t\t\t}else{\n\t\t\t\t\treturn minus ? -num : num;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn -1;\n\t}\n\t\n\tpublic String ns()\n\t{\n\t\ttry{\n\t\t\tint b = 0;\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\twhile((b = is.read()) != -1 && (b == '\\r' || b == '\\n' || b == ' '));\n\t\t\tif(b == -1)return \"\";\n\t\t\tsb.append((char)b);\n\t\t\twhile(true){\n\t\t\t\tb = is.read();\n\t\t\t\tif(b == -1)return sb.toString();\n\t\t\t\tif(b == '\\r' || b == '\\n' || b == ' ')return sb.toString();\n\t\t\t\tsb.append((char)b);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn \"\";\n\t}\n\t\n\tpublic char[] ns(int n)\n\t{\n\t\tchar[] buf = new char[n];\n\t\ttry{\n\t\t\tint b = 0, p = 0;\n\t\t\twhile((b = is.read()) != -1 && (b == ' ' || b == '\\r' || b == '\\n'));\n\t\t\tif(b == -1)return null;\n\t\t\tbuf[p++] = (char)b;\n\t\t\twhile(p < n){\n\t\t\t\tb = is.read();\n\t\t\t\tif(b == -1 || b == ' ' || b == '\\r' || b == '\\n')break;\n\t\t\t\tbuf[p++] = (char)b;\n\t\t\t}\n\t\t\treturn Arrays.copyOf(buf, p);\n\t\t} catch (IOException e) {\n\t\t}\n\t\treturn null;\n\t}\n\t\n\t\n\tdouble nd() { return Double.parseDouble(ns()); }\n\tboolean oj = System.getProperty(\"ONLINE_JUDGE\") != null;\n\tvoid tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }\n}\n","description":"In the year 2500 the annual graduation ceremony in the German University in Cairo (GUC) has run smoothly for almost 500 years so far.The most important part of the ceremony is related to the arrangement of the professors in the ceremonial hall.Traditionally GUC has n professors. Each professor has his seniority level. All seniorities are different. Let's enumerate the professors from 1 to n, with 1 being the most senior professor and n being the most junior professor.The ceremonial hall has n seats, one seat for each professor. Some places in this hall are meant for more senior professors than the others. More specifically, m pairs of seats are in \"senior-junior\" relation, and the tradition requires that for all m pairs of seats (ai,\u2009bi) the professor seated in \"senior\" position ai should be more senior than the professor seated in \"junior\" position bi.GUC is very strict about its traditions, which have been carefully observed starting from year 2001. The tradition requires that: The seating of the professors changes every year. Year 2001 ceremony was using lexicographically first arrangement of professors in the ceremonial hall. Each consecutive year lexicographically next arrangement of the professors is used. The arrangement of the professors is the list of n integers, where the first integer is the seniority of the professor seated in position number one, the second integer is the seniority of the professor seated in position number two, etc.Given n, the number of professors, y, the current year and m pairs of restrictions, output the arrangement of the professors for this year.","input_specification":"The first line contains three integers n, y and m (1\u2009\u2264\u2009n\u2009\u2264\u200916,\u20092001\u2009\u2264\u2009y\u2009\u2264\u20091018,\u20090\u2009\u2264\u2009m\u2009\u2264\u2009100) \u2014 the number of professors, the year for which the arrangement should be computed, and the number of pairs of seats for which the seniority relation should be kept, respectively. The next m lines contain one pair of integers each, \"ai bi\", indicating that professor on the ai-th seat is more senior than professor on the bi-th seat (1\u2009\u2264\u2009ai,\u2009bi\u2009\u2264\u2009n,\u2009ai\u2009\u2260\u2009bi). Some pair may be listed more than once. Please, do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is preferred to use the cin stream (you may also use the %I64d specificator).","output_specification":"Print the order in which the professors should be seated in the requested year. If by this year the GUC would have ran out of arrangements, or the given \"senior-junior\" relation are contradictory, print \"The times have changed\" (without quotes).","notes":"NoteIn the first example the lexicographically first order of seating is 1 2 3.In the third example the GUC will run out of arrangements after the year 3630800.In the fourth example there are no valid arrangements for the seating.The lexicographical comparison of arrangements is performed by the < operator in modern programming languages. The arrangement a is lexicographically less that the arrangement b, if there exists such i (1\u2009\u2264\u2009i\u2009\u2264\u2009n), that ai\u2009<\u2009bi, and for any j (1\u2009\u2264\u2009j\u2009<\u2009i) aj\u2009=\u2009bj.","sample_inputs":["3 2001 2\n1 2\n2 3","7 2020 6\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7","10 3630801 0","3 2001 3\n1 2\n2 3\n3 1"],"sample_outputs":["1 2 3","1 2 3 7 4 6 5","The times have changed","The times have changed"],"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 TaskC solver = new TaskC();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskC {\n long[][] dp;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n long y = in.nextLong() - 2000;\n int m = in.nextInt();\n\n final String noSolution = \"The times have changed\";\n\n boolean[][] graph = new boolean[n][n];\n for (int i = 0; i < m; ++i) {\n int x = in.nextInt() - 1, t = in.nextInt() - 1;\n graph[x][t] = true;\n }\n\n boolean[][] accesible = new boolean[n][n];\n for (int i = 0; i < n; ++i) {\n dfs(graph, accesible[i], i);\n }\n\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < n; ++j) {\n if (i != j && accesible[i][j] && accesible[j][i]) {\n out.println(noSolution);\n return;\n }\n }\n }\n\n int[] g = new int[n];\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < n; ++j) {\n if (accesible[i][j])\n g[i] |= 1 << j;\n }\n }\n\n dp = new long[n + 1][1 << n];\n int[] pos = new int[n];\n Arrays.fill(pos, -1);\n\n if (count(pos, g) < y) {\n out.println(noSolution);\n return;\n }\n\n int[] fans = new int[n];\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < n; ++j) {\n if (pos[j] != -1) continue;\n\n pos[j] = i;\n long x = count(pos, g);\n if (x < y) {\n y -= x;\n } else {\n fans[i] = j;\n break;\n }\n pos[j] = -1;\n }\n }\n\n for (int i = 0; i < n; ++i)\n out.print((fans[i] + 1) + \" \");\n out.println();\n }\n\n private void dfs(boolean[][] graph, boolean[] accesible, int node) {\n accesible[node] = true;\n for (int i = 0; i < graph.length; ++i) {\n if (graph[node][i] && !accesible[i]) {\n dfs(graph, accesible, i);\n }\n }\n }\n\n private long count(int[] pos, int[] g) {\n int n = pos.length;\n int used = 0;\n for (int i = 0; i < n; ++i) {\n if (pos[i] != -1)\n used |= 1 << pos[i];\n }\n for (long[] p : dp) {\n Arrays.fill(p, 0);\n }\n dp[0][0] = 1;\n for (int i = 0; i < n; ++i) {\n for (int conf = 0; conf < 1 << n; ++conf) {\n if (dp[i][conf] == 0) continue;\n for (int j = 0; j < n; ++j) {\n if ((conf & g[j]) != 0) continue;\n if ((pos[i] == -1 && (used & (1 << j)) == 0) ||\n pos[i] == j) {\n dp[i + 1][conf | (1 << j)] += dp[i][conf];\n }\n }\n }\n }\n return dp[n][(1 << n) - 1];\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 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":117} {"difficulty":1700,"lang":"Java 8","lang_cluster":"Java","src_uid":"f256235c0b2815aae85a6f9435c69dac","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class A {\n\t\t\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out);\n\n\t\tint n = sc.nextInt(), m = sc.nextInt(), a = sc.nextInt() - 1, b = sc.nextInt() - 1;\n\t\t\n\t\tif(a % m == 0 && b % m == m - 1)\n\t\t\tout.println(1);\n\t\telse if(a \/ m == b \/ m || a % m == 0 && b == n - 1)\n\t\t\tout.println(1);\n\t\telse if(a \/ m + 1 == b \/ m || a % m == b % m + 1 || a % m == 0 || b % m == m - 1)\n\t\t\tout.println(2);\n\t\telse\n\t\t\tout.println(3);\n\t\tout.flush();\n\t\tout.close();\n\t}\n\n\tstatic class Scanner \n\t{\n\t\tStringTokenizer st;\n\t\tBufferedReader br;\n\n\t\tpublic Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}\n\n\t\tpublic String next() throws IOException \n\t\t{\n\t\t\twhile (st == null || !st.hasMoreTokens()) \n\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic int nextInt() throws IOException {return Integer.parseInt(next());}\n\n\t\tpublic long nextLong() throws IOException {return Long.parseLong(next());}\n\n\t}\n} ","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"],"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 {\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 LinkedList adj[]=new LinkedList[n];\n int m=sc.nextInt();\n for(int i=0;i pq=new LinkedList();\n pq.add(0); visited[0]=true;\n while(!pq.isEmpty())\n {\n int s=pq.poll();\n visited[s]=true;\n for(int node : adj[s])\n {\n if(visited[node]) continue;\n visited[node]=true;\n dist[node]=dist[s]+1;\n pq.add(node);\n }\n }\n \/\/for(int i:dist) out.print(i+\" \");\n if(dist[n-1]==Integer.MAX_VALUE) out.println(-1);\n else out.println(dist[n-1]);\n out.close();\n }\n}\n","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"],"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 b:\n if q[i][1] > a: x, y, a, b = i, x, q[i][1], a\n else: y, b = i, q[i][1]\n k = n \/\/ 3\n if a > k:\n c, s = n - a - b, n - a\n if c > b: q[x], q[y], k = (q[x][0], (s >> 1)), (q[y][0], b - (s & 1)), (s >> 1)\n #(q[y][0], b - (s & 1)), (s >> 1)\n else: q[x], q[y], k = (q[x][0], c), (q[y][0], c), c \n q = [(int(x), y) for x, y in q]\n q.sort(reverse = True)\n p, n = [], 2 * k\n for i in q:\n p += [str(i[0]) + ' '] * i[1]\n print(k)\n print('\\n'.join(p[i] + p[k + i] + p[n + i] for i in range(k)))\n #mas facil estaba examen de Cappo","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"],"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":120} {"difficulty":900,"lang":"PyPy 3","lang_cluster":"Python","src_uid":"102667eaa3aee012fef70f4192464674","execute_outcome":"RUNTIME_ERROR","source_code":"n=int(input())\nL=list(map(int,input().split()))\nm=int(input())\nM=list(map(int,input().split()))\nN=[]\nmaxi=0\ncount=0\nfor i in range(0,m):\n\tfor j in range(0,n):\n\t\ttemp=L[i]\/\/M[j]\n\t\tif(L[i]%M[j]==0):\n\t\t\tN.append(temp)\n\t\t\tif(temp>maxi):\n\t\t\t\tmaxi=temp\n\nfor i in range(0,len(N)):\n\tif(N[i]==maxi):\n\t\tcount+=1\n\nprint(count)\n","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"],"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":121} {"difficulty":1400,"lang":"Python 3","lang_cluster":"Python","src_uid":"138fd96bf5a677a6d59c20f88fd612f1","execute_outcome":"RUNTIME_ERROR","source_code":"n, x, y = int(input()),int(input()),int(input())\n\na = y-n+1\n\nif a**2 + n - 1 >= x:\n print(a)\n for i in range(n-1):\n print(1)\nelse:\n print(-1)\n","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"],"human_solution":"n, x, y = map(int, input().split())\nif y < n:\n print(-1)\nelse:\n q = y - n + 1\n if (q ** 2 + n - 1) >= 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":122} {"difficulty":1200,"lang":"Python 3","lang_cluster":"Python","src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","execute_outcome":"RUNTIME_ERROR","source_code":"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)","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"],"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":123} {"difficulty":1200,"lang":"Python 2","lang_cluster":"Python","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"RUNTIME_ERROR","source_code":"import sys\n\nanswer = [0,0,0,0,0]\nn = map(int,raw_input().split())[0]\np = map(int,raw_input().split())\nbalance = 0\nprices = map(int,raw_input().split())[::-1]\n#print prices\nfor i in xrange(n):\n balance += p[i]\n j = 0\n while(j<5):\n #print i, balance, j\n if (balance>=prices[j]):\n answer[j]+=1\n balance-=prices[j]\n j -= 1\n j+=1\n #print j\nprint \" \".join(map(str,answer[::-1]))\nprint balance","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"],"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":124} {"difficulty":1200,"lang":"Python 2","lang_cluster":"Python","src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/local\/bin\/python\n\nn,limit = map(int,raw_input().split(\" \"))\nary = map(int,raw_input().split(\" \"))\ncomp = [\"-\" for i in xrange(n)]\n\nnum = 0\nwhile True:\n if ary == comp:\n print num\n exit()\n t = 0\n for i in xrange(len(ary)):\n if ary[i] == \"-\":\n continue\n if i == 0 or t == 0:\n tmp = ary[i]\n ary[i] += 1\n t = 1\n elif tmp != ary[i]:\n tmp = ary[i]\n ary[i] += 1\n if ary[i] == limit:\n ary[i] = \"-\"\n num += 1","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"],"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":125} {"difficulty":1100,"lang":"Python 3","lang_cluster":"Python","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"n = int(input())\nst = list(input())\nans = 0\ni = 0\nwhile st and i < len(st):\n if st[i] == 'L':\n n -= i + 1\n st = st[i + 1:]\n i = -1\n elif st[i] == 'R':\n n -= 1\n for j in range(i + 1, len(st)):\n if st[j] == 'L':\n n -= j - i\n if (j - i) % 2 == 0:\n n += 1\n st = st[j + 1:]\n i = -1\n break\n if st[j] == 'R':\n n -= j - i - 1\n st = st[j:]\n i = -1\n break\n n -= j - i\n i += 1\nprint(n)","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"],"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":126} {"difficulty":1100,"lang":"Python 2","lang_cluster":"Python","src_uid":"5d11fa8528f1dc873d50b3417bef8c79","execute_outcome":"RUNTIME_ERROR","source_code":"import math\n\nn = int(raw_input())\nSs = []\nDs = []\nTs = []\nDp = []\nTp = []\n\nfor i in range(n+1):\n Ss.append(tuple(int(i) for i in raw_input().split()))\n\nVs, Vp = [int(i) for i in raw_input().split()]\nPs = tuple(int(i) for i in raw_input().split())\n\nt = 0\nfor i in range(n):\n d = 0\n for c in range(3):\n d += (Ss[i+1][c] - Ss[i][c])**2\n d = d**.5\n Ds.append(d)\n t += d\/Vs\n Ts.append(t)\n\nfor i in range(n):\n d = 0\n t = 0\n for c in range(3):\n d += (Ss[i+1][c] - Ps[c])**2\n d = d**.5\n Dp.append(d)\n t = d\/Vp\n Tp.append(t)\n\nprint \"Ss\", Ss\nprint \"Ps\", Ps\nprint \"Ds\", Ds\nprint \"Ts\", Ts\nprint \"Dp\", Dp\nprint \"Tp\", Tp\n\"\"\"\nif Tp[-1] T\nfor i in range(n):\n if Tp[i] >\n\"\"\"\n","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"],"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":127} {"difficulty":1500,"lang":"Python 3","lang_cluster":"Python","src_uid":"5e055bad1da5bdc84599d6f2f89fbd12","execute_outcome":"RUNTIME_ERROR","source_code":"import math\nn = int(input())\nfront = dict()\nback = dict()\nfor i in range(n):\n a, b = map(int,input().split())\n if a in front:\n front[a] += 1\n else:\n front[a] = 1\n \n if b in back:\n back[b] += 1\n else:\n back[b] = 1\n\nans = -1\nm = dict()\nfor key, value in front.items():\n if value >= 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)","description":"The Little Elephant loves to play with color cards.He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. The Little Elephant thinks that a set of cards on the table is funny if at least half of the cards have the same color (for each card the color of the upper side is considered).Help the Little Elephant to find the minimum number of moves needed to make the set of n cards funny.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of the cards. The following n lines contain the description of all cards, one card per line. The cards are described by a pair of positive integers not exceeding 109 \u2014 colors of both sides. The first number in a line is the color of the front of the card, the second one \u2014 of the back. The color of the front of the card may coincide with the color of the back of the card. The numbers in the lines are separated by single spaces.","output_specification":"On a single line print a single integer \u2014 the sought minimum number of moves. If it is impossible to make the set funny, print -1.","notes":"NoteIn the first sample there initially are three cards lying with colors 4, 4, 7. Since two of the three cards are of the same color 4, you do not need to change anything, so the answer is 0.In the second sample, you can turn the first and the fourth cards. After that three of the five cards will be of color 7.","sample_inputs":["3\n4 7\n4 7\n7 4","5\n4 7\n7 4\n2 11\n9 7\n1 1"],"sample_outputs":["0","2"],"human_solution":"import math\nn = int(input())\nfront = dict()\nback = dict()\nfor i in range(n):\n a, b = map(int,input().split())\n if a in front:\n front[a] += 1\n else:\n front[a] = 1\n\n if b != a: \n if b in back:\n back[b] += 1\n else:\n back[b] = 1\n\nans = -1\nm = dict()\nfor key, value in front.items():\n if value >= 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":128} {"difficulty":1100,"lang":"Python 3","lang_cluster":"Python","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"RUNTIME_ERROR","source_code":"n, b = map(int, input().split())\nt = list(map(int, input().split()))\ns, d = sum(t), max(t)\nb -= d * n - s\nif b < 0: print(-1)\nd += b \/ n\nfor i in range(n): t[i] = str(d - t[i])\nprint('\\n'.join(t))","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"],"human_solution":"x=[int(i) for i in input().split()]\nn=x[0]\ny=[int(i) for i in input().split()]\nif x[1]11)or(n==24 and h>23):\n h%=10\nif m>59:\n m%=10\nprint \"{0:02}:{1:02}\".format(h,m)","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"],"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":135} {"difficulty":1400,"lang":"Python 3","lang_cluster":"Python","src_uid":"8a9adc116abbd387a6a64dd754436f8a","execute_outcome":"RUNTIME_ERROR","source_code":"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\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","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"],"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":136} {"difficulty":1400,"lang":"Python 2","lang_cluster":"Python","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"RUNTIME_ERROR","source_code":"n,l = [int(nl) for nl in raw_input().split(\" \")]\na = [int(ai) for ai in raw_input().split(\" \")]\nans = 0\nsma = sum(a)\nfor lx in range(l,sma+1):\n\tansx = sma\/lx\n\tif (ansx*lx) > ans:\n\t\tans = ansx * lx\nprint ans","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"#!\/usr\/bin\/env python\n\ndef main():\n\tn,l = map(int, raw_input().split())\n\td = map(int, raw_input().split())\n\n\tans = 0\n\tfor cut in range(l, max(d)+1):\n\t\tw = map(lambda x:x\/cut, d)\n\t\tans = max(ans,sum(w)*cut)\n\n\tprint ans\n\nmain()\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":137} {"difficulty":1100,"lang":"Python 3","lang_cluster":"Python","src_uid":"9c90974a0bb860a5e180760042fd5045","execute_outcome":"RUNTIME_ERROR","source_code":"n,m = list(map(int, input().split()))\n\narr = []\nfor _ in range(n):\n arr.append(list(input()))\n\nfrom collections import defaultdict\n\nvisited = defaultdict(lambda: [0] * m)\nincluded = defaultdict(lambda: [True] * m)\n\n\ndef find_for_row_and_cols(row_index, value):\n vals = []\n for i in range(m):\n if arr[row_index][i] == value:\n vals.append((row_index, i))\n\n\n for i in range(n):\n if arr[i][col_index] == value:\n vals.append((i, col_index))\n return vals\n\n# def find_for_cols(col_index,)\n\n\ndef find_and_mark(row_index, col_index, value):\n if visited[row_index][col_index]: return\n\n vals = find_for_row_and_cols(row_index, value)\n visited[row_index][col_index] = 1\n if len(vals) > 2:\n for i, j in vals:\n included[i][j] = False\n\n if i == row_index and j == col_index:\n continue\n find_and_mark(row_index, col_index, value)\n\nfor row_index, row in enumerate(arr):\n for col_index, value in enumerate(row):\n if not visited[row_index][col_index]:\n find_and_mark(row_index, col_index, value)\n\nans = []\nfor row_index, row in enumerate(arr):\n for col_index, value in enumerate(row):\n if included[row_index][col_index]:\n ans.append(arr[row_index][col_index])\n\nprint(''.join(ans))","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"],"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":138} {"difficulty":1400,"lang":"Python 2","lang_cluster":"Python","src_uid":"a37df9b239a40473516d1525d56a0da7","execute_outcome":"RUNTIME_ERROR","source_code":"#include \n#define ll long long\n#define M 1000000007\n#define INF 9223372036854775807\n#define mp(x,y) make_pair(x,y)\n#define pb(x) push_back(x)\n#define pmp(x,y) pb(mp(x,y))\n#define ld double\n#define PI 3.14159265\n#define len(a) (ll)a.size()\n#define F first\n#define S second\n#define ch cout<<\"debug\\n\"\n#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)\nusing namespace std;\n\nll a[2001][2001],n,b[2001][2001];\n\nvoid pre()\n{\n\tll sum=0;\n\t\t\n\tfor(ll k=0;k>n;\n\tfor(ll i=0;i>a[i][j];\n\n\tpre();\n\/\/\tprint();\n\tpre2();\t\n\treturn 0;\n}\n","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"],"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":139} {"difficulty":1500,"lang":"Python 2","lang_cluster":"Python","src_uid":"b0301a2d79a1ec126511ed769ec0b743","execute_outcome":"RUNTIME_ERROR","source_code":"n,m=map(int,raw_input().split())\ns=[raw_input() for i in range(n)]\np=set(tuple(raw_input().split()) for i in range(m))\nfrom itertools import *\nfor i in range(n,0,-1):\n for c in combinations(s,i):\n g=0\n for x in c:\n for y in c:\n if x !=y and (x,y) in p:\n g=1\n if not g:\n print len(c)\n print '\\n'.join(c)\n exit()","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"],"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":140} {"difficulty":1100,"lang":"Python 3","lang_cluster":"Python","src_uid":"b1ef19d7027dc82d76859d64a6f43439","execute_outcome":"RUNTIME_ERROR","source_code":"import collections\nl=list(input())\np=list(input())\n#print(p)\n#print(l)\ncl=collections.Counter(l)\npl=collections.Counter(p)\n#print(cl)\n#print(pl)\nplk=list(pl.keys())\nprint(plk)\nif ' ' in plk:\n plk.remove(' ')\nelse:\n pass\nn=len(plk)\ni=0\ner=0\n#print(cl['s'])\nwhile i=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","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"],"human_solution":"import collections\nl=list(input())\np=list(input())\n#print(p)\n#print(l)\ncl=collections.Counter(l)\npl=collections.Counter(p)\n#print(cl)\n#print(pl)\nplk=list(pl.keys())\n#print(plk)\nif ' ' in plk:\n plk.remove(' ')\nelse:\n pass\nn=len(plk)\ni=0\ner=0\n#print(cl['s'])\nwhile i=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":141} {"difficulty":1000,"lang":"Python 2","lang_cluster":"Python","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"RUNTIME_ERROR","source_code":"# prob B\n\nn = input()\nseq = raw_input()\n\nseq = [int(i) for i in seq.split()]\nseq.sort()\n\ntot = 0\nfor i, j in zip(seq, range(1, n+1)):\n if i != j:\n tot += 1\n\nprint tot\n","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"],"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":142} {"difficulty":1200,"lang":"PyPy 3","lang_cluster":"Python","src_uid":"c31fed523230af1f904218b2fe0d663d","execute_outcome":"RUNTIME_ERROR","source_code":"#_________________ Mukul Mohan Varshney _______________#\n\n#Template\nimport sys\nimport os\nimport math\nimport copy\nfrom math import gcd\nfrom bisect import bisect\nfrom io import BytesIO, IOBase\nfrom math import sqrt,floor,factorial,gcd,log,ceil\nfrom collections import deque,Counter,defaultdict\nfrom itertools import permutations, combinations\n\n#define function \ndef Int(): return int(sys.stdin.readline())\ndef Mint(): return map(int,sys.stdin.readline().split())\ndef Lstr(): return list(sys.stdin.readline().strip())\ndef Str(): return sys.stdin.readline().strip()\ndef Mstr(): return map(str,sys.stdin.readline().strip().split())\ndef List(): return list(map(int,sys.stdin.readline().split()))\ndef Hash(): return dict()\ndef Mod(): return 1000000007\ndef Ncr(n,r,p): return ((fact[n])*((ifact[r]*ifact[n-r])%p))%p\ndef Most_frequent(list): return max(set(list), key = list.count)\ndef Mat2x2(n): return [List() for _ in range(n)]\ndef btod(n): \n return int(n,2) \n \ndef dtob(n): \n return bin(n).replace(\"0b\",\"\") \n\n \n# Driver Code \t\ndef solution():\n #for _ in range(Int()):\n n,t=Mint()\n ans=[]\n for i in range(n):\n x,y=Mint()\n ans.append([2*x-y,2*x+y])\n mukul=2\n ans.sort()\n for i in range(1,len(ans)):\n \n res=(ans[i][0]-ans[i-1][1])\n print(res)\n if(res>2*t):\n mukul+=2\n elif(res==2*t):\n mukul+=1\n print(mukul) \n\n \n#Call the solve function \nif __name__ == \"__main__\":\n \n solution() ","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"],"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":143} {"difficulty":1200,"lang":"Python 3","lang_cluster":"Python","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"COMPILATION_ERROR","source_code":"\"\"\"\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\nseq1 = input()\nseq2 = input()\n\nif len(seq1) + len(seq2) > len(x): # if sum of peter's colors exceed the whole number of colors\n\tprint('fantasy')\nelse:\n\tforward = False\n\tbackward = False\n\n\tif seq1 in x:\n\t\tif seq2 in x[x.find(seq1) + len(seq1):]\n\t\t\tforward = True\n\n\tif seq1 in x_reversed:\n\t\tif seq2 in x_reversed[x_reversed.find(seq1) + len(seq1):]\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')","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"],"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":144} {"difficulty":1200,"lang":"Python 3","lang_cluster":"Python","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"n = int(input())\n\ncoodenadas = []\nfor i in range(n):\n x, y = [ int(i) for i in input().split() ]\n coodenadas.append([x, y, {\n 'x': { x },\n 'y': { y }\n }])\n\naux = 0\nfor i in range(n):\n j = i + 1\n grafo = coodenadas[i][2]\n while j < len(coodenadas):\n x = coodenadas[j][0]\n y = coodenadas[j][1]\n if j != i and (x in grafo['x'] or y in grafo['y']):\n aux += 1\n grafo['x'].add(x)\n grafo['y'].add(y)\n coodenadas[j][2] = grafo\n j += 1\n\nprint(n - aux - 1)","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"],"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":145} {"difficulty":1100,"lang":"Python 3","lang_cluster":"Python","src_uid":"d526af933b5afe9abfdf9815e9664144","execute_outcome":"RUNTIME_ERROR","source_code":"n=int(input())\na=list(map(int,input().split()))\nans=1e9\nfor i in range(n-1):\n ans=min(ans,max(a[i],a[i+1]))\nprint(ans)\n","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"],"human_solution":"n=int(input())\na=list(map(int,input().split()))\nans=1e9\nfor i in range(n-1):\n ans=min(ans,max(a[i],a[i+1]))\nprint(min(ans,a[0],a[-1]))\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":146} {"difficulty":1200,"lang":"Python 3","lang_cluster":"Python","src_uid":"d90da1e932a6aa546bec4e1bd4b1fbec","execute_outcome":"RUNTIME_ERROR","source_code":"from math import *\n\n\nclass graph:\n # initialize graph\n def __init__(self, gdict=None):\n if gdict is None:\n gdict = dict({})\n self.gdict = gdict\n\n # get edges\n def edges(self):\n return self.find_edges()\n\n # find edges\n def find_edges(self):\n edges = []\n for node in self.gdict:\n for nxNode in self.gdict[node]:\n if {nxNode, node} not in edges:\n edges.append({node, nxNode})\n return edges\n\n # Get verticies\n def get_vertices(self):\n return list(self.gdict.keys())\n\n # add vertix\n def add_vertix(self, node):\n if node not in self.gdict:\n self.gdict[node] = []\n\n # add edge\n def add_edge(self, edge):\n edge = set(edge)\n (node1, node2) = edge\n if node1 in self.gdict:\n self.gdict[node1].append(node2)\n else:\n self.gdict[node1] = [node2]\n\n if node2 in self.gdict:\n self.gdict[node2].append(node1)\n else:\n self.gdict[node2] = [node1]\n\n\ndef inp():\n return map(int, input().split())\n\n\ndef arr_inp():\n return [int(x) for x in input().split()]\n\n\nn, m = inp()\na = arr_inp()\ng = graph()\ncost = inf\n\nfor i in range(m):\n u, v = inp()\n g.add_edge((u, v))\n if (i > 1):\n for key in g.gdict:\n if (u in g.gdict[key] and v in g.gdict[key]):\n cost = min(cost, u + v + int(key))\n\nif (cost == inf):\n print(-1)\nelse:\n print(cost)\n","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"],"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 cp0:\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":148} {"difficulty":800,"lang":"Python 3","lang_cluster":"Python","src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","execute_outcome":"RUNTIME_ERROR","source_code":"import math\nn=int(input())\nl=list(map(int,input().split()))\nd=0\ndiff=l[n-1]-l[0]\no1,o2=n,1\nfor i in range(n-1):\n d=abs(l[i+1]-l[i])\n if d= 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 for t in range(self.n):\n print(self.BP['x'],self.BP['y'],self.DP,self.CP)\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 if self.BP['x'] == fBPx and self.BP['y'] == fBPy and self.DP == fDP and self.CP ==fCP:\n print ans[(self.n-1)%len(ans)]\n break\n else:\n if len(ans) == 0:\n fBPx = self.BP['x']\n fBPy = self.BP['y']\n fDP = self.DP\n fCP = self.CP\n ans.append(self.pixels[self.BP['y']][self.BP['x']])\n else:\n print ans[-1] \n\ndef main():\n p = Piet()\n\nif __name__ == '__main__':\n main()\n","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"],"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":150} {"difficulty":2400,"lang":"Python 2","lang_cluster":"Python","src_uid":"0f49b4a5696ee71ebbc8f83d1ec3b901","execute_outcome":"RUNTIME_ERROR","source_code":"\ndef primes(n):\n pr = range(n)\n for i in xrange(2,n):\n if not pr[i]: continue\n ii=i*i\n if ii>n: break\n pr[ii::i]=[0]*len(pr[ii::i])\n return filter(None,pr)[1:]\n\nn,x = map(int,raw_input().split())\na = set(map(int,raw_input().split()))\npr = primes(x)\nif all(p in a for p in pr): print len(pr)\nelse: print -1\n ","description":"Vasya plays The Elder Trolls III: Morrowindows. He has a huge list of items in the inventory, however, there is no limits on the size of things. Vasya does not know the total amount of items but he is sure that are not more than x and not less than 2 items in his inventory. A new patch for the game appeared to view inventory in n different modes. Displaying in mode i is a partition of all inventory items on pages, each of which (except for maybe the last one) shows exactly ai items. In addition, each mode shows how many pages bi is in a complete list. Great! Perhaps this information will be enough for Vasya to find the required number. Moreover, it is very interesting, what is the fewest number of modes in which Vasya can see inventory to determine the number of items in it?Vasya cannot use the information that was received while looking on inventory in some mode for selection of next actions. I. e. Vasya chooses some set of modes first, and then sees all the results and determines the size.Knowing the number of ai, x and assuming that Vasya is very smart, check whether he can uniquely determine the number of items in his inventory, and how many modes he will need to do that if he knows numbers ai, x and he is able to know number bi after viewing items in mode i.","input_specification":"The first line contains two integers n and x (0\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20092\u2009\u2264\u2009x\u2009\u2264\u2009109). The second line contains integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009109). Some numbers among all ai may be equal.","output_specification":"Output the fewest amount of modes required to uniquely determine amount of items in the inventory. If there is no solution output \u2009-\u20091.","notes":"NoteIn the second example Vasya is not able to determine items count uniquely because 3 items, as well as 4 items, can be displayed on two pages.","sample_inputs":["2 4\n2 3","1 4\n2"],"sample_outputs":["2","-1"],"human_solution":"n,x = map(int,raw_input().split())\na = set(map(int,raw_input().split()))\nif 1 in a and x>2: print 1\nelif x>1300000: print -1\nelse:\n pr = range(x)\n for i in xrange(2,x):\n if not pr[i]: continue\n ii=i*i\n if ii>x: break\n pr[ii::i]=[0]*len(pr[ii::i]) \n pr = set(filter(None,pr)[1:])\n print -1 if len(pr-a) else len(pr) \n\n","testcases":"[{'input': '2 4\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 4\\r\\n2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n100 500\\r\\n', 'output': ['0\\r\\n']}, {'input': '0 8\\r\\n\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9 8\\r\\n2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['4\\r\\n']}, {'input': '9 8\\r\\n2 3 2 3 2 3 2 3 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '0 2\\r\\n\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 100\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000\\r\\n1000000000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 231\\r\\n176 11 13 844803802 2 99 39 199 47 103 128 218 53 102 118 180 19 41216650 106 58 46 127 475571446 56 177125309 7 75 17 151 57720101 115 827958635 329805783 179 146 193 109 568816931 149 260459535 31 197 223 163 764490292 73 89 545821177 107 491198655 139 84 31 92 19 179 118 96 71 61 79 113 216 131 5 41 143 219 802573042 167 918615685 23 227 277060833 101 229 83 191 3 173 211 210200779 59 207 29 37 67 157 58 97 271956818 181 721780748 137 89 222 329715496 43 43858073 212\\r\\n', 'output': ['50\\r\\n']}, {'input': '100 231\\r\\n179 17 53 101 186 3 193 18 157 7 107 47 662021887 211 820414833 94310859 131 54 92 59 207 73 199 87 122 45 173 23 405603540 769193750 71 115 156 89 137 998237661 925251070 29 107 676289655 191 558368835 19 113 135 61 863484300 197 103 5 41 11 186 91 267574190 31 671988056 107 926847247 227 178 139 904039123 106 83 181 73 167 97 213703748 113 176754880 173 149 13 279420756 46064623 223 82 168942142 32 211 43 182 120 109 122 62 590856356 37 127 159 79 80 229 151 67 19 156 163\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 50\\r\\n42 34 54 61 2 9 24 46 4 47 24 66 5 37 16 57 16 26 70 60 3 6 34 35 45 6 61 70 49 44 16 64 10 66 54 42 13 33 31 62 52 33 43 63 34 26 21 49 42 10 57 68 61 51 57 14 63 13 20 27 16 48 45 18 57 58 67 25 69 21 42 28 45 11 12 30 13 51 46 17 55 45 15 70 62 28 21 7 65 43 17 16 56 5 69 27 66 38 50 12\\r\\n', 'output': ['-1\\r\\n']}, {'input': '50 50\\r\\n13 21 49 5 39 16 48 14 26 48 6 23 38 27 39 18 34 42 30 33 41 37 32 4 30 45 46 23 12 48 39 7 24 39 28 3 35 17 24 12 3 6 2 2 18 38 40 30 40 14\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 2\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 1000000000\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 3\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '0 2\\r\\n\\r\\n', 'output': ['0\\r\\n']}, {'input': '0 3\\r\\n\\r\\n', 'output': ['-1\\r\\n']}]","id":151} {"difficulty":2200,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"11_D","execute_outcome":"WRONG_ANSWER","source_code":"N, M = [int(w) for w in input().split()]\ngraph = [[] for _ in range(N)]\ndp = [[0] * (2 ** N) for _ in range(N)]\n\nself_circles = 0\n\nfor _ in range(M):\n a, b = [int(w) - 1 for w in input().split()]\n if a == b:\n self_circles += 1\n else:\n graph[a].append(b)\n graph[b].append(a)\n\nfor i in range(N):\n dp[i][1 << i] = 1\n\nresult = -M\nfor i in range(2 ** N):\n for j in range(N):\n if dp[j][i] == 0:\n continue\n for k in graph[j]:\n mask_k = 2 ** k\n if mask_k < (i & (-i)):\n continue\n if mask_k & i > 0:\n if mask_k == i & (- i):\n result += dp[j][i]\n else:\n dp[k][i | mask_k] += dp[j][i]\n \nprint(result\/\/2)\n","description":"Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.","input_specification":"The first line of input contains two integers n and m (1\u2264n\u226419, 0\u2264m) \u2013 respectively the number of vertices and edges of the graph. Each of the subsequent m lines contains two integers a and b, (1\u2264a,b\u2264n, a\u2260b) indicating that vertices a and b are connected by an undirected edge. There is no more than one edge connecting any pair of vertices.\n","output_specification":"Output the number of cycles in the given graph.\n","notes":"The example graph is a clique and contains four cycles of length 3 and three cycles of length 4.\n","sample_inputs":["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n"],"sample_outputs":["7\n"],"human_solution":"import bisect\r\nimport copy\r\nimport heapq\r\nimport sys\r\nfrom types import GeneratorType\r\nfrom functools import cmp_to_key\r\nfrom collections import defaultdict, Counter, deque\r\nimport math\r\nfrom math import inf\r\nfrom functools import lru_cache\r\nfrom heapq import nlargest\r\nfrom functools import reduce\r\nimport random\r\nfrom itertools import combinations\r\nfrom operator import xor, add\r\nfrom operator import mul\r\nfrom typing import List, Dict, Set, Tuple, DefaultDict\r\nfrom random import randint\r\nfrom operator import or_\r\n\r\nINF = float(\"inf\")\r\nBIG = int(1e32)\r\nRANDOM = randint(1, 10 ** 9)\r\n\r\n\r\nclass FastIO:\r\n def __init__(self):\r\n return\r\n\r\n @staticmethod\r\n def _read():\r\n return sys.stdin.readline().strip()\r\n\r\n def read_int(self):\r\n return int(self._read())\r\n\r\n def read_float(self):\r\n return float(self._read())\r\n\r\n def read_ints(self):\r\n return map(int, self._read().split())\r\n\r\n def read_floats(self):\r\n return map(float, self._read().split())\r\n\r\n def read_ints_minus_one(self):\r\n return map(lambda x: int(x) - 1, self._read().split())\r\n\r\n def read_list_ints(self):\r\n return list(map(int, self._read().split()))\r\n\r\n def read_list_floats(self):\r\n return list(map(float, self._read().split()))\r\n\r\n def read_list_ints_minus_one(self):\r\n return list(map(lambda x: int(x) - 1, self._read().split()))\r\n\r\n def read_str(self):\r\n return self._read()\r\n\r\n def read_list_strs(self):\r\n return self._read().split()\r\n\r\n def read_list_str(self):\r\n return list(self._read())\r\n\r\n @staticmethod\r\n def st(x):\r\n return sys.stdout.write(str(x) + '\\n')\r\n\r\n @staticmethod\r\n def lst(x):\r\n return sys.stdout.write(\" \".join(str(w) for w in x) + '\\n')\r\n\r\n @staticmethod\r\n def round_5(f):\r\n res = int(f)\r\n if f - res >= 0.5:\r\n res += 1\r\n return res\r\n\r\n @staticmethod\r\n def max(*args):\r\n res = args[0]\r\n for b in args[1:]:\r\n res = res if res > b else b\r\n return res\r\n\r\n @staticmethod\r\n def min(*args):\r\n res = args[0]\r\n for b in args[1:]:\r\n res = res if res < b else b\r\n return res\r\n\r\n @staticmethod\r\n def bootstrap(f, queue=[]):\r\n def wrappedfunc(*args, **kwargs):\r\n if queue:\r\n return f(*args, **kwargs)\r\n else:\r\n to = f(*args, **kwargs)\r\n while True:\r\n if isinstance(to, GeneratorType):\r\n queue.append(to)\r\n to = next(to)\r\n else:\r\n queue.pop()\r\n if not queue:\r\n break\r\n to = queue[-1].send(to)\r\n return to\r\n\r\n return wrappedfunc\r\n\r\n def ask(self, lst):\r\n self.lst(lst)\r\n sys.stdout.flush()\r\n res = self.read_int()\r\n return res\r\n\r\n\r\nclass Wrapper(int):\r\n # \u00e7\u0094\u00a8\u00e6\u009d\u00a5\u00e8\u00a7\u0084\u00e9\u0081\u00bf py \u00e5\u0093\u0088\u00e5\u00b8\u008c\u00e7\u00a2\u00b0\u00e6\u0092\u009e\u00e7\u009a\u0084\u00e9\u0097\u00ae\u00e9\u00a2\u0098\u00e5\u0092\u008c\u00e8\u00bf\u009b\u00e8\u00a1\u008c\u00e5\u008a\u00a0\u00e9\u0080\u009f\r\n def __init__(self, x):\r\n int.__init__(x)\r\n # \u00e5\u008e\u009f\u00e7\u0090\u0086\u00e6\u0098\u00af\u00e5\u00bc\u0082\u00e6\u0088\u0096\u00e4\u00b8\u0080\u00e4\u00b8\u00aa\u00e9\u009a\u008f\u00e6\u009c\u00ba\u00e7\u00a7\u008d\u00e5\u00ad\u0090\r\n\r\n def __hash__(self):\r\n # \u00e4\u00b9\u009f\u00e5\u008f\u00af\u00e4\u00bb\u00a5\u00e5\u00b0\u0086\u00e6\u0095\u00b0\u00e7\u00bb\u0084\u00e6\u008e\u0092\u00e5\u00ba\u008f\u00e5\u0090\u008e\u00e8\u00bf\u009b\u00e8\u00a1\u008c\u00e5\u0093\u0088\u00e5\u00b8\u008c\u00e8\u00ae\u00a1\u00e6\u0095\u00b0\r\n return super(Wrapper, self).__hash__() ^ RANDOM\r\n\r\n\r\nclass Solution:\r\n def __init__(self):\r\n return\r\n\r\n @staticmethod\r\n def main(ac=FastIO()):\r\n n, m = ac.read_ints()\r\n\r\n # \u00e5\u00bb\u00ba\u00e5\u009b\u00be\r\n dct = [[] for _ in range(n)]\r\n for _ in range(m):\r\n i, j = ac.read_ints_minus_one()\r\n dct[i].append(j)\r\n dct[j].append(i)\r\n\r\n # \u00e5\u0088\u009d\u00e5\u00a7\u008b\u00e5\u008c\u0096\r\n dp = [[0] * n for _ in range(1 << n)]\r\n for i in range(n):\r\n dp[1 << i][i] = 1\r\n\r\n ans = 0\r\n for i in range(1, 1 << n): # \u00e7\u00bb\u008f\u00e8\u00bf\u0087\u00e7\u009a\u0084\u00e7\u0082\u00b9\u00e7\u008a\u00b6\u00e6\u0080\u0081\u00ef\u00bc\u008clowest_bit\u00e4\u00b8\u00ba\u00e8\u00b5\u00b7\u00e7\u0082\u00b9\r\n for j in range(n):\r\n if not dp[i][j]:\r\n continue\r\n for k in dct[j]:\r\n # \u00e4\u00b8\u008b\u00e4\u00b8\u0080\u00e8\u00b7\u00b3\u00e5\u00bf\u0085\u00e9\u00a1\u00bb\u00e4\u00b8\u008d\u00e8\u0083\u00bd\u00e6\u00af\u0094\u00e8\u00b5\u00b7\u00e7\u0082\u00b9\u00e5\u00ba\u008f\u00e5\u008f\u00b7\u00e5\u00b0\u008f\r\n if (i & -i) > (1 << k):\r\n continue\r\n if i & (1 << k):\r\n # \u00e8\u00ae\u00bf\u00e9\u0097\u00ae\u00e8\u00bf\u0087\u00e4\u00b8\u0094\u00e6\u0098\u00af\u00e8\u00b5\u00b7\u00e7\u0082\u00b9\u00e5\u0088\u0099\u00e5\u00bd\u00a2\u00e6\u0088\u0090\u00e7\u008e\u00af\r\n if (i & -i) == 1 << k:\r\n ans += dp[i][j]\r\n else:\r\n # \u00e6\u009c\u00aa\u00e8\u00ae\u00bf\u00e9\u0097\u00ae\u00e8\u00bf\u0087\u00e4\u00bc\u00a0\u00e5\u0088\u00b0\u00e4\u00b8\u008b\u00e4\u00b8\u0080\u00e7\u008a\u00b6\u00e6\u0080\u0081\r\n dp[i ^ (1 << k)][k] += dp[i][j]\r\n\r\n # \u00e5\u008e\u00bb\u00e9\u0099\u00a4\u00e4\u00b8\u0080\u00e6\u009d\u00a1\u00e8\u00be\u00b9\u00e7\u009a\u0084\u00e7\u008e\u00af\u00e4\u00bb\u00a5\u00e5\u008f\u008a\u00e6\u0098\u00af\u00e6\u0097\u00a0\u00e5\u0090\u0091\u00e5\u009b\u00be\u00e9\u009c\u0080\u00e8\u00a6\u0081\u00e9\u0099\u00a4\u00e4\u00bb\u00a5\u00e4\u00ba\u008c\r\n ans = (ans - m) \/\/ 2\r\n ac.st(ans)\r\n return\r\n\r\n\r\nSolution().main()\r\n","testcases":"[{'input': ['4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 3\\r\\n4 8\\r\\n9 4\\r\\n8 9\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['8 28\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n6 7\\r\\n6 8\\r\\n7 8\\r\\n'], 'output': ['8018\\r\\n']}, {'input': ['12 10\\r\\n1 6\\r\\n4 5\\r\\n4 9\\r\\n5 10\\r\\n6 12\\r\\n7 9\\r\\n7 10\\r\\n8 10\\r\\n10 12\\r\\n11 12\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 16\\r\\n1 2\\r\\n1 3\\r\\n1 5\\r\\n1 7\\r\\n2 3\\r\\n2 4\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n5 6\\r\\n6 7\\r\\n'], 'output': ['214\\r\\n']}, {'input': ['14 32\\r\\n1 2\\r\\n1 3\\r\\n1 6\\r\\n1 7\\r\\n1 9\\r\\n1 11\\r\\n1 13\\r\\n2 8\\r\\n2 9\\r\\n2 14\\r\\n3 7\\r\\n3 8\\r\\n3 9\\r\\n3 13\\r\\n4 5\\r\\n4 11\\r\\n4 14\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 14\\r\\n7 12\\r\\n7 13\\r\\n8 9\\r\\n8 10\\r\\n8 11\\r\\n9 10\\r\\n10 13\\r\\n10 14\\r\\n11 12\\r\\n11 13\\r\\n13 14\\r\\n'], 'output': ['9239\\r\\n']}, {'input': ['18 45\\r\\n1 2\\r\\n1 5\\r\\n1 12\\r\\n1 13\\r\\n2 3\\r\\n2 4\\r\\n2 11\\r\\n2 14\\r\\n2 15\\r\\n3 7\\r\\n3 16\\r\\n4 7\\r\\n4 8\\r\\n4 10\\r\\n4 18\\r\\n5 8\\r\\n5 10\\r\\n5 16\\r\\n5 17\\r\\n6 12\\r\\n6 16\\r\\n7 9\\r\\n7 12\\r\\n8 10\\r\\n8 16\\r\\n9 11\\r\\n9 12\\r\\n9 16\\r\\n9 17\\r\\n10 11\\r\\n10 15\\r\\n11 12\\r\\n11 14\\r\\n11 15\\r\\n12 13\\r\\n12 14\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 16\\r\\n13 17\\r\\n14 15\\r\\n14 18\\r\\n16 17\\r\\n17 18\\r\\n'], 'output': ['467111\\r\\n']}, {'input': ['19 11\\r\\n3 4\\r\\n3 12\\r\\n3 14\\r\\n4 12\\r\\n5 11\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n9 13\\r\\n11 19\\r\\n15 16\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 44\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n1 9\\r\\n1 10\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n2 9\\r\\n2 10\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n3 10\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n4 9\\r\\n4 10\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n5 9\\r\\n5 10\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 10\\r\\n7 8\\r\\n7 9\\r\\n7 10\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n'], 'output': ['446414\\r\\n']}, {'input': ['16 11\\r\\n1 2\\r\\n2 7\\r\\n2 12\\r\\n3 12\\r\\n4 5\\r\\n4 15\\r\\n6 7\\r\\n6 9\\r\\n7 8\\r\\n12 14\\r\\n14 16\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 1\\r\\n2 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['18 54\\r\\n1 7\\r\\n1 11\\r\\n1 14\\r\\n1 15\\r\\n1 18\\r\\n2 7\\r\\n3 4\\r\\n3 9\\r\\n3 10\\r\\n3 11\\r\\n3 12\\r\\n3 13\\r\\n3 16\\r\\n3 17\\r\\n3 18\\r\\n4 5\\r\\n4 9\\r\\n4 11\\r\\n4 13\\r\\n5 12\\r\\n5 13\\r\\n5 14\\r\\n5 15\\r\\n5 16\\r\\n5 18\\r\\n6 9\\r\\n6 10\\r\\n6 12\\r\\n6 13\\r\\n6 17\\r\\n7 8\\r\\n7 17\\r\\n8 10\\r\\n8 11\\r\\n8 12\\r\\n8 14\\r\\n8 15\\r\\n9 11\\r\\n9 12\\r\\n10 11\\r\\n10 13\\r\\n10 16\\r\\n10 17\\r\\n11 12\\r\\n11 15\\r\\n11 16\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 17\\r\\n14 15\\r\\n14 16\\r\\n15 17\\r\\n17 18\\r\\n'], 'output': ['6418594\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 8\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['19 48\\r\\n1 5\\r\\n1 6\\r\\n1 14\\r\\n1 17\\r\\n1 18\\r\\n2 3\\r\\n2 4\\r\\n2 7\\r\\n2 13\\r\\n2 16\\r\\n2 18\\r\\n2 19\\r\\n3 8\\r\\n3 11\\r\\n3 16\\r\\n3 17\\r\\n4 5\\r\\n4 13\\r\\n4 17\\r\\n4 19\\r\\n5 8\\r\\n5 13\\r\\n5 15\\r\\n5 16\\r\\n5 19\\r\\n6 7\\r\\n6 11\\r\\n6 12\\r\\n6 14\\r\\n7 8\\r\\n7 11\\r\\n8 11\\r\\n8 19\\r\\n9 14\\r\\n9 17\\r\\n9 18\\r\\n10 13\\r\\n10 19\\r\\n11 12\\r\\n11 18\\r\\n12 14\\r\\n13 16\\r\\n13 17\\r\\n13 19\\r\\n14 15\\r\\n16 17\\r\\n17 18\\r\\n18 19\\r\\n'], 'output': ['824798\\r\\n']}, {'input': ['2 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 15\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n4 5\\r\\n4 6\\r\\n5 6\\r\\n'], 'output': ['197\\r\\n']}, {'input': ['19 22\\r\\n1 10\\r\\n1 14\\r\\n1 17\\r\\n2 10\\r\\n2 12\\r\\n2 13\\r\\n3 8\\r\\n3 13\\r\\n3 14\\r\\n4 10\\r\\n4 19\\r\\n7 9\\r\\n7 12\\r\\n9 18\\r\\n10 11\\r\\n11 13\\r\\n11 19\\r\\n12 13\\r\\n14 16\\r\\n16 17\\r\\n16 19\\r\\n17 19\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}]","id":152} {"difficulty":2200,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"1215_E","execute_outcome":"WRONG_ANSWER","source_code":"from sys import stdin\r\ninput = stdin.readline\r\n\r\ninp = lambda : list(map(int,input().split()))\r\n\r\n\r\ndef b_s(key , i):\r\n\r\n l , h = 0 , len(pos[i]) - 1\r\n ans = len(pos[i])\r\n while(l <= h):\r\n\r\n mid = (l + h) \/\/ 2\r\n if(a[mid] < key):\r\n l = mid + 1\r\n else:\r\n ans = mid\r\n h = mid - 1\r\n\r\n return ans\r\n\r\n\r\ndef solve(mask):\r\n\r\n if(mask == (1 << 20) - 1):return 0\r\n if(dp[mask] != -1):return dp[mask]\r\n\r\n p = 0\r\n for j in range(20):\r\n if(mask >> j & 1):\r\n p += len(pos[j])\r\n\r\n \r\n ans = float('inf')\r\n for j in range(20):\r\n if(mask >> j & 1):continue\r\n\r\n x = len(pos[j])\r\n ind = b_s(p , j)\r\n addval = (pref[j][x] - pref[j][ind]) - (x * (x - 1)) \/\/ 2\r\n ans = min(ans , solve(mask | (1 << j)) + addval)\r\n\r\n\r\n dp[mask] = ans\r\n return ans\r\n \r\n\r\n\r\ndef answer():\r\n\r\n\r\n global dp , pos , pref\r\n\r\n pref = [[0] for j in range(20)]\r\n pos = [[] for i in range(20)]\r\n for i in range(n):\r\n pos[a[i]].append(i)\r\n pref[a[i]].append(pref[a[i]][-1] + i)\r\n\r\n\r\n dp = [-1 for i in range(1 << 20)]\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","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":[],"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":153} {"difficulty":1900,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"1216_E1","execute_outcome":"RUNTIME_ERROR","source_code":"import sys\r\nimport io, os\r\ninput = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\r\n\r\nN = 10**5\r\ns = []\r\nfor i in range(1, N):\r\n s += list(str(i))\r\n\r\nq = int(input())\r\n\r\nfor _ in range(q):\r\n k = int(input())\r\n k -= 1\r\n l = 0\r\n for i in range(1, N):\r\n k -= l\r\n l += len(str(i))\r\n if 0 <= k <= l:\r\n print(s[k])\r\n break\r\n","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":[],"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":154} {"difficulty":2200,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"1216_E2","execute_outcome":"WRONG_ANSWER","source_code":"print(\"_RANDOM_GUESS_1690505925.0309489\")# 1690505925.0309696","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":[],"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":155} {"difficulty":2100,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"1216_F","execute_outcome":"WRONG_ANSWER","source_code":"import random\r\nimport sys\r\nfrom math import inf\r\n\r\nfrom typing import List\r\n\r\n\r\n# sys.setrecursionlimit(10**8)\u00e8\u00ae\u00be\u00e7\u00bd\u00ae\u00e6\u009c\u0080\u00e5\u00a4\u00a7\u00e9\u0080\u0092\u00e5\u00bd\u0092\u00e6\u00ac\u00a1\u00e6\u0095\u00b0\r\n\r\n\r\nclass FastIO:\r\n def __init__(self):\r\n self.random_seed = random.randint(0, 10 ** 9 + 7)\r\n return\r\n\r\n @staticmethod\r\n def read_int():\r\n return int(sys.stdin.readline().strip())\r\n\r\n @staticmethod\r\n def read_float():\r\n return float(sys.stdin.readline().strip())\r\n\r\n @staticmethod\r\n def read_list_ints():\r\n return list(map(int, sys.stdin.readline().strip().split()))\r\n\r\n @staticmethod\r\n def read_list_floats():\r\n return list(map(float, sys.stdin.readline().strip().split()))\r\n\r\n @staticmethod\r\n def read_list_ints_minus_one():\r\n return list(map(lambda x: int(x) - 1, sys.stdin.readline().strip().split()))\r\n\r\n @staticmethod\r\n def read_str():\r\n return sys.stdin.readline().strip()\r\n\r\n @staticmethod\r\n def read_list_strs():\r\n return sys.stdin.readline().strip().split()\r\n\r\n @staticmethod\r\n def read_list_str():\r\n return list(sys.stdin.readline().strip())\r\n\r\n @staticmethod\r\n def st(x):\r\n return print(x)\r\n\r\n @staticmethod\r\n def lst(x):\r\n return print(*x)\r\n\r\n @staticmethod\r\n def round_5(f):\r\n res = int(f)\r\n if f - res >= 0.5:\r\n res += 1\r\n return res\r\n\r\n @staticmethod\r\n def max(a, b):\r\n return a if a > b else b\r\n\r\n @staticmethod\r\n def min(a, b):\r\n return a if a < b else b\r\n\r\n @staticmethod\r\n def ceil(a, b):\r\n return a \/\/ b + int(a % b != 0)\r\n\r\n def hash_num(self, x):\r\n return x ^ self.random_seed\r\n\r\n @staticmethod\r\n def accumulate(nums):\r\n n = len(nums)\r\n pre = [0] * (n + 1)\r\n for i in range(n):\r\n pre[i + 1] = pre[i] + nums[i]\r\n return pre\r\n\r\n def inter_ask(self, lst):\r\n # CF\u00e4\u00ba\u00a4\u00e4\u00ba\u0092\u00e9\u00a2\u0098\u00e8\u00be\u0093\u00e5\u0087\u00ba\u00e8\u00af\u00a2\u00e9\u0097\u00ae\u00e5\u00b9\u00b6\u00e8\u00af\u00bb\u00e5\u008f\u0096\u00e7\u00bb\u0093\u00e6\u009e\u009c\r\n self.st(lst)\r\n sys.stdout.flush()\r\n res = self.read_int()\r\n # \u00e8\u00ae\u00b0\u00e5\u00be\u0097\u00e4\u00bb\u00bb\u00e4\u00bd\u0095\u00e4\u00b8\u0080\u00e4\u00b8\u00aa\u00e8\u00be\u0093\u00e5\u0087\u00ba\u00e4\u00b9\u008b\u00e5\u0090\u008e\u00e9\u0083\u00bd\u00e8\u00a6\u0081 sys.stdout.flush() \u00e5\u0088\u00b7\u00e6\u0096\u00b0\r\n return res\r\n\r\n def inter_out(self, lst):\r\n # CF\u00e4\u00ba\u00a4\u00e4\u00ba\u0092\u00e9\u00a2\u0098\u00e8\u00be\u0093\u00e5\u0087\u00ba\u00e6\u009c\u0080\u00e7\u00bb\u0088\u00e7\u00ad\u0094\u00e6\u00a1\u0088\r\n self.st(lst)\r\n sys.stdout.flush()\r\n return\r\n\r\nclass SegmentTreeUpdateQueryMin:\r\n # \u00e6\u00a8\u00a1\u00e6\u009d\u00bf\u00ef\u00bc\u009a\u00e7\u00ba\u00bf\u00e6\u00ae\u00b5\u00e6\u00a0\u0091\u00e5\u008c\u00ba\u00e9\u0097\u00b4\u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e3\u0080\u0081\u00e6\u008c\u0081\u00e7\u00bb\u00ad\u00e5\u0087\u008f\u00e5\u00b0\u008f\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n def __init__(self, n):\r\n self.height = [inf]*(4*n)\r\n self.lazy = [inf]*(4*n)\r\n self.n = n\r\n\r\n def build(self, nums: List[int]):\r\n # \u00e4\u00bd\u00bf\u00e7\u0094\u00a8\u00e6\u0095\u00b0\u00e7\u00bb\u0084\u00e5\u0088\u009d\u00e5\u00a7\u008b\u00e5\u008c\u0096\u00e7\u00ba\u00bf\u00e6\u00ae\u00b5\u00e6\u00a0\u0091\r\n stack = [[0, self.n - 1, 1]]\r\n while stack:\r\n s, t, ind = stack.pop()\r\n if ind >= 0:\r\n if s == t:\r\n self.make_tag(ind, nums[s])\r\n else:\r\n stack.append([s, t, ~ind])\r\n m = s + (t - s) \/\/ 2\r\n stack.append([s, m, 2 * ind])\r\n stack.append([m + 1, t, 2 * ind + 1])\r\n else:\r\n ind = ~ind\r\n self.push_up(ind)\r\n return\r\n\r\n def get(self):\r\n # \u00e6\u009f\u00a5\u00e8\u00af\u00a2\u00e5\u008c\u00ba\u00e9\u0097\u00b4\u00e7\u009a\u0084\u00e6\u0089\u0080\u00e6\u009c\u0089\u00e5\u0080\u00bc\r\n stack = [[0, self.n-1, 1]]\r\n nums = [inf]*self.n\r\n while stack:\r\n s, t, i = stack.pop()\r\n if s == t:\r\n nums[s] = self.height[i]\r\n continue\r\n m = s + (t - s) \/\/ 2\r\n self.push_down(i)\r\n stack.append([s, m, 2 * i])\r\n stack.append([m + 1, t, 2 * i + 1])\r\n return nums\r\n\r\n @staticmethod\r\n def min(a, b):\r\n return a if a < b else b\r\n\r\n def push_down(self, i):\r\n # \u00e6\u0087\u0092\u00e6\u00a0\u0087\u00e8\u00ae\u00b0\u00e4\u00b8\u008b\u00e6\u0094\u00be\u00ef\u00bc\u008c\u00e6\u00b3\u00a8\u00e6\u0084\u008f\u00e5\u008f\u0096\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n if self.lazy[i] != inf:\r\n self.height[2 * i] = self.min(self.height[2 * i], self.lazy[i])\r\n self.height[2 * i + 1] = self.min(self.height[2 * i + 1], self.lazy[i])\r\n\r\n self.lazy[2 * i] = self.min(self.lazy[2 * i], self.lazy[i])\r\n self.lazy[2 * i + 1] = self.min(self.lazy[2 * i + 1], self.lazy[i])\r\n\r\n self.lazy[i] = inf\r\n return\r\n\r\n def make_tag(self, i, val):\r\n self.height[i] = self.min(self.height[i], val)\r\n self.lazy[i] = self.min(self.lazy[i], val)\r\n return\r\n\r\n def push_up(self, i):\r\n self.height[i] = self.min(self.height[2 * i], self.height[2 * i + 1])\r\n return\r\n\r\n def update_range(self, left, right, s, t, val, i):\r\n # \u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e5\u008c\u00ba\u00e9\u0097\u00b4\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n stack = [[s, t, i]]\r\n while stack:\r\n a, b, i = stack.pop()\r\n if i >= 0:\r\n if left <= a and b <= right:\r\n self.make_tag(i, val)\r\n continue\r\n\r\n self.push_down(i)\r\n stack.append([a, b, ~i])\r\n m = a + (b - a) \/\/ 2\r\n if left <= m: # \u00e6\u00b3\u00a8\u00e6\u0084\u008f\u00e5\u00b7\u00a6\u00e5\u008f\u00b3\u00e5\u00ad\u0090\u00e6\u00a0\u0091\u00e7\u009a\u0084\u00e8\u00be\u00b9\u00e7\u0095\u008c\u00e4\u00b8\u008e\u00e8\u008c\u0083\u00e5\u009b\u00b4\r\n stack.append([a, m, 2 * i])\r\n if right > m:\r\n stack.append([m + 1, b, 2 * i + 1])\r\n else:\r\n i = ~i\r\n self.push_up(i)\r\n return\r\n\r\n def update_point(self, left, right, s, t, val, i):\r\n # \u00e6\u009b\u00b4\u00e6\u0096\u00b0\u00e5\u008d\u0095\u00e7\u0082\u00b9\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n while True:\r\n if left <= s and t <= right:\r\n self.make_tag(i, val)\r\n break\r\n self.push_down(i)\r\n m = s + (t - s) \/\/ 2\r\n if left <= m: # \u00e6\u00b3\u00a8\u00e6\u0084\u008f\u00e5\u00b7\u00a6\u00e5\u008f\u00b3\u00e5\u00ad\u0090\u00e6\u00a0\u0091\u00e7\u009a\u0084\u00e8\u00be\u00b9\u00e7\u0095\u008c\u00e4\u00b8\u008e\u00e8\u008c\u0083\u00e5\u009b\u00b4\r\n s, t, i = s, m, 2 * i\r\n if right > m:\r\n s, t, i = m + 1, t, 2 * i + 1\r\n\r\n while i > 1:\r\n i \/\/= 2\r\n self.push_up(i)\r\n return\r\n\r\n def query_range(self, left, right, s, t, i):\r\n # \u00e6\u009f\u00a5\u00e8\u00af\u00a2\u00e5\u008c\u00ba\u00e9\u0097\u00b4\u00e7\u009a\u0084\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n stack = [[s, t, i]]\r\n floor = inf\r\n while stack:\r\n a, b, i = stack.pop()\r\n if left <= a and b <= right:\r\n floor = self.min(floor, self.height[i])\r\n continue\r\n self.push_down(i)\r\n m = a + (b - a) \/\/ 2\r\n if left <= m:\r\n stack.append([a, m, 2*i])\r\n if right > m:\r\n stack.append([m+1, b, 2*i + 1])\r\n return floor\r\n\r\n def query_point(self, left, right, s, t, i):\r\n # \u00e6\u009f\u00a5\u00e8\u00af\u00a2\u00e5\u008d\u0095\u00e7\u0082\u00b9\u00e7\u009a\u0084\u00e6\u009c\u0080\u00e5\u00b0\u008f\u00e5\u0080\u00bc\r\n a, b, i = s, t, i\r\n while True:\r\n if left <= a and b <= right:\r\n ans = self.height[i]\r\n break\r\n self.push_down(i)\r\n m = a + (b - a) \/\/ 2\r\n if left <= m:\r\n a, b, i = a, m, 2 * i\r\n if right > m:\r\n a, b, i = m + 1, b, 2 * i + 1\r\n return ans\r\n\r\nclass Solution:\r\n def __init__(self):\r\n return\r\n\r\n @staticmethod\r\n def main(ac=FastIO()):\r\n n, k = ac.read_list_ints()\r\n s = ac.read_str()\r\n tree = SegmentTreeUpdateQueryMin(n)\r\n one = -1\r\n for i in range(n):\r\n if s[i] == \"1\":\r\n left = ac.max(0, i-k)\r\n right = ac.min(n-1, i+k)\r\n if left < one:\r\n left = one+k+1\r\n if left > i:\r\n left = i\r\n pre = tree.query_range(left-1, left-1, 0, n-1, 1) if left else 0\r\n cur = pre + i+1\r\n tree.update_range(i, right, 0, n-1, cur, 1)\r\n one = i\r\n else:\r\n pre = tree.query_point(i-1, i-1, 0, n-1, 1) if i else 0\r\n cur = pre + i+1\r\n tree.update_point(i, i, 0, n-1, cur, 1)\r\n ac.st(tree.query_point(n-1, n-1, 0, n-1, 1))\r\n return\r\n\r\n\r\nSolution().main()\r\n","description":"You work as a system administrator in a dormitory, which has $$$n$$$ rooms one after another along a straight hallway. Rooms are numbered from $$$1$$$ to $$$n$$$.You have to connect all $$$n$$$ rooms to the Internet.You can connect each room to the Internet directly, the cost of such connection for the $$$i$$$-th room is $$$i$$$ coins. Some rooms also have a spot for a router. The cost of placing a router in the $$$i$$$-th room is also $$$i$$$ coins. You cannot place a router in a room which does not have a spot for it. When you place a router in the room $$$i$$$, you connect all rooms with the numbers from $$$max(1,~i - k)$$$ to $$$min(n,~i + k)$$$ inclusive to the Internet, where $$$k$$$ is the range of router. The value of $$$k$$$ is the same for all routers. Calculate the minimum total cost of connecting all $$$n$$$ rooms to the Internet. You can assume that the number of rooms which have a spot for a router is not greater than the number of routers you have.","input_specification":"The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n, k \\le 2 \\cdot 10^5$$$) \u2014 the number of rooms and the range of each router.\nThe second line of the input contains one string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones. If the $$$i$$$-th character of the string equals to '1' then there is a spot for a router in the $$$i$$$-th room. If the $$$i$$$-th character of the string equals to '0' then you cannot place a router in the $$$i$$$-th room.\n","output_specification":"Print one integer \u2014 the minimum total cost of connecting all $$$n$$$ rooms to the Internet.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import sys\r\n\r\ninput = lambda: sys.stdin.buffer.readline().decode().strip()\r\nn, m = map(int, input().split())\r\nmem, dp, le = [10 ** 18] * (n + 1), [0] * (n + 1), [0] * (n + 1)\r\n\r\nfor i, j in enumerate(input(), 1):\r\n if j == '1':\r\n l, r = max(i - m, 1), min(i + m, n)\r\n k = i\r\n while k >= l and mem[k] == 10 ** 18:\r\n mem[k], le[k] = i, l - 1\r\n k -= 1\r\n\r\n k = r\r\n while k >= l and mem[k] == 10 ** 18:\r\n mem[k], le[k] = i, l - 1\r\n k -= 1\r\n\r\nfor i in range(1, n + 1):\r\n dp[i] = dp[i - 1] + i\r\n if mem[i]:\r\n dp[i] = min(dp[i], dp[le[i]] + mem[i])\r\n\r\nprint(dp[-1])\r\n","testcases":"[{'input': ['5 2\\r\\n00100\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['6 1\\r\\n000000\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['4 1\\r\\n0011\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['12 6\\r\\n000010000100\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['5 1\\r\\n01010\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5 4\\r\\n10000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['9 2\\r\\n010111110\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10 1\\r\\n0011100011\\r\\n'], 'output': ['25\\r\\n']}, {'input': ['14 2\\r\\n00001101011000\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['5 3\\r\\n10011\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['15 3\\r\\n111111101111111\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['18 11\\r\\n110111111111111111\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['14 5\\r\\n00001000110000\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['10 8\\r\\n1011100101\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['11 6\\r\\n00000000000\\r\\n'], 'output': ['66\\r\\n']}, {'input': ['12 10\\r\\n100000110010\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['15 6\\r\\n111111011110110\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['20 10\\r\\n01101111111111111111\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['100 5\\r\\n1101111111111111111100111111111101110011111111101101111111111101111001011001111100101110111111100110\\r\\n'], 'output': ['486\\r\\n']}, {'input': ['200 10\\r\\n10000010101010110011110010100010010000001100101111011001010010001101001011111110011010111101000101011110101001001101101011010011100000100101000010110111000110000010101110110000110000100000101110111100\\r\\n'], 'output': ['989\\r\\n']}, {'input': ['1 1\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 200000\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 200000\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}]","id":156} {"difficulty":2200,"lang":"PyPy 2","lang_cluster":"Python","src_uid":"1220_E","execute_outcome":"RUNTIME_ERROR","source_code":"import os\r\nimport sys\r\nfrom atexit import register\r\nfrom io import BytesIO\r\n\r\nsys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))\r\nsys.stdout = BytesIO()\r\nregister(lambda: os.write(1, sys.stdout.getvalue()))\r\n\r\ninput = lambda: sys.stdin.readline().rstrip('\\r\\n')\r\ndef make(size):\r\n rank = [0]*size\r\n same = range(size)\r\n return same,rank\r\n\r\ndef find(x,same):\r\n\r\n if x != same[x]:\r\n same[x] = find(same[x],same)\r\n return same[x]\r\n\r\ndef union( x,y,same,rank):\r\n x = find(x,same)\r\n y = find(y,same)\r\n if x == y :\r\n return\r\n if rank[x] > rank[y]:\r\n same[y] = x\r\n else:\r\n same[x] = y\r\n if rank[x] == rank[y]:\r\n rank[y] += 1\r\n\r\ndef add(dic,k,v):\r\n\tif not dic.has_key(k):\r\n\t\tdic[k] = v\r\n\telse:\r\n\t\tdic[k]+= v\r\nn,m = map(int,input().split(\" \"))\r\nws = map(int,input().split(\" \"))\r\nsame,rank = make(n+1)\r\nedges = []\r\ndegrees = [0]*(n+1)\r\nfor i in range(m):\r\n\ta,b = map(int,input().split(\" \"))\r\n\tedges.append((a,b))\r\n\tdegrees[a] += 1\r\n\tdegrees[b] += 1\r\n\r\ns = int(input())\r\nfor a,b in edges:\r\n\tif a!=s and b!=s:\r\n\t\tunion(a,b,same,rank)\r\n\r\nfor i in range(n+1):\r\n\tsame[i]=find(i,same)\r\ndic = {}\r\n\r\nfor i,v in enumerate(same):\r\n\tadd(dic,v,[i])\r\n\r\nret = 0\r\nfor k,v in dic.items():\r\n\tans = 0\r\n\tmaxv = 0\t\r\n\tfor i in v:\r\n\t\tif degrees[i] >= 2 or i == s:\r\n\t\t\tans += ws[i-1]\r\n\t\telse:\r\n\t\t\tmaxv = max(maxv,ws[i-1])\r\n\tret = max(ret,maxv+ans)\r\nprint ret+ws[s-1]\r\n\r\n\r\n","description":"Alex decided to go on a touristic trip over the country.For simplicity let's assume that the country has $$$n$$$ cities and $$$m$$$ bidirectional roads connecting them. Alex lives in city $$$s$$$ and initially located in it. To compare different cities Alex assigned each city a score $$$w_i$$$ which is as high as interesting city seems to Alex.Alex believes that his trip will be interesting only if he will not use any road twice in a row. That is if Alex came to city $$$v$$$ from city $$$u$$$, he may choose as the next city in the trip any city connected with $$$v$$$ by the road, except for the city $$$u$$$.Your task is to help Alex plan his city in a way that maximizes total score over all cities he visited. Note that for each city its score is counted at most once, even if Alex been there several times during his trip.","input_specification":"First line of input contains two integers $$$n$$$ and $$$m$$$, ($$$1 \\le n \\le 2 \\cdot 10^5$$$, $$$0 \\le m \\le 2 \\cdot 10^5$$$) which are numbers of cities and roads in the country.\nSecond line contains $$$n$$$ integers $$$w_1, w_2, \\ldots, w_n$$$ ($$$0 \\le w_i \\le 10^9$$$) which are scores of all cities.\nThe following $$$m$$$ lines contain description of the roads. Each of these $$$m$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \\le u, v \\le n$$$) which are cities connected by this road.\nIt is guaranteed that there is at most one direct road between any two cities, no city is connected to itself by the road and, finally, it is possible to go from any city to any other one using only roads.\nThe last line contains single integer $$$s$$$ ($$$1 \\le s \\le n$$$), which is the number of the initial city.\n","output_specification":"Output single integer which is the maximum possible sum of scores of visited cities.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import sys\r\ninput = sys.stdin.buffer.readline\r\n\r\ndef process(A, G, s):\r\n n = len(A)\r\n m = len(G)\r\n g = [[] for i in range(n+1)]\r\n riskfree = [0 for i in range(n+1)]\r\n parent = [None for i in range(n+1)]\r\n visited = [0 for i in range(n+1)]\r\n values = [0 for i in range(n+1)]\r\n for i in range(m):\r\n u, v = G[i]\r\n g[u].append(v)\r\n g[v].append(u)\r\n # def dfs(g, x, parent):\r\n # visited[x] = 1\r\n # for y in g[x]:\r\n # if y != parent[x]:\r\n # if visited[y]==1:\r\n ## x1 = x\r\n # while riskfree[x1]==0:\r\n # riskfree[x1] = 1\r\n # x1 = parent[x1]\r\n ## else:\r\n # parent[y] = x \r\n # dfs(g, y, parent)\r\n start = [s]\r\n riskfree[s] = 1\r\n while len(start) > 0:\r\n x = start.pop()\r\n visited[x] = 1\r\n for y in g[x]:\r\n if y != parent[x]:\r\n if visited[y]==1:\r\n x1 = x\r\n while riskfree[x1]==0:\r\n riskfree[x1] = 1\r\n x1 = parent[x1]\r\n else:\r\n parent[y] = x\r\n start.append(y)\r\n \r\n answer = sum([A[i-1] for i in range(1, n+1) if riskfree[i]==1])\r\n start = [s]\r\n leaf_max = 0\r\n while len(start) > 0:\r\n next_s = []\r\n for x in start:\r\n for y in g[x]:\r\n if riskfree[y] != 2:\r\n next_s.append(y)\r\n if riskfree[y]==0:\r\n values[y] = values[x]+A[y-1]\r\n leaf_max = max(leaf_max, values[y])\r\n riskfree[y] = 2\r\n start = next_s\r\n answer+=leaf_max\r\n return answer\r\n\r\n\r\nn, m = [int(x) for x in input().split()]\r\nA = [int(x) for x in input().split()]\r\nG = []\r\nfor i in range(m):\r\n u, v = [int(x) for x in input().split()]\r\n G.append([u, v])\r\ns = int(input())\r\nprint(process(A, G, s))\r\n","testcases":"[{'input': ['5 7\\r\\n2 2 8 6 9\\r\\n1 2\\r\\n1 3\\r\\n2 4\\r\\n3 2\\r\\n4 5\\r\\n2 5\\r\\n1 5\\r\\n2\\r\\n'], 'output': ['27\\r\\n']}, {'input': ['10 12\\r\\n1 7 1 9 3 3 6 30 1 10\\r\\n1 2\\r\\n1 3\\r\\n3 5\\r\\n5 7\\r\\n2 3\\r\\n5 4\\r\\n6 9\\r\\n4 6\\r\\n3 7\\r\\n6 8\\r\\n9 4\\r\\n9 10\\r\\n6\\r\\n'], 'output': ['61\\r\\n']}, {'input': ['1 0\\r\\n1000000000\\r\\n1\\r\\n'], 'output': ['1000000000\\r\\n']}, {'input': ['2 1\\r\\n999999999 2\\r\\n1 2\\r\\n2\\r\\n'], 'output': ['1000000001\\r\\n']}, {'input': ['3 2\\r\\n1 1335 2\\r\\n2 1\\r\\n3 2\\r\\n2\\r\\n'], 'output': ['1337\\r\\n']}, {'input': ['3 3\\r\\n1 1 1\\r\\n1 2\\r\\n3 2\\r\\n3 1\\r\\n3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['6 6\\r\\n0 0 0 2 0 1\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n3 4\\r\\n1 6\\r\\n5 3\\r\\n5\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['8 9\\r\\n1 7 1 9 3 3 6 30\\r\\n1 2\\r\\n1 3\\r\\n3 5\\r\\n5 7\\r\\n2 3\\r\\n5 4\\r\\n4 6\\r\\n3 7\\r\\n6 8\\r\\n6\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['8 9\\r\\n0 2 10 0 1 0 4 1\\r\\n3 8\\r\\n4 8\\r\\n1 5\\r\\n6 4\\r\\n5 7\\r\\n6 8\\r\\n5 8\\r\\n2 1\\r\\n3 5\\r\\n5\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['10 9\\r\\n96 86 63 95 78 91 96 100 99 90\\r\\n10 5\\r\\n1 2\\r\\n8 7\\r\\n4 5\\r\\n4 6\\r\\n3 8\\r\\n6 7\\r\\n3 9\\r\\n10 2\\r\\n8\\r\\n'], 'output': ['732\\r\\n']}, {'input': ['10 20\\r\\n64 70 28 86 100 62 79 86 85 95\\r\\n7 10\\r\\n6 2\\r\\n4 8\\r\\n8 10\\r\\n9 2\\r\\n5 1\\r\\n5 3\\r\\n8 2\\r\\n3 6\\r\\n4 3\\r\\n9 4\\r\\n4 2\\r\\n6 9\\r\\n7 6\\r\\n8 6\\r\\n7 3\\r\\n8 5\\r\\n2 7\\r\\n8 7\\r\\n7 4\\r\\n4\\r\\n'], 'output': ['755\\r\\n']}, {'input': ['10 9\\r\\n0 1 0 1 2 1 1 1 2 1\\r\\n1 7\\r\\n6 4\\r\\n1 8\\r\\n10 7\\r\\n1 2\\r\\n1 9\\r\\n9 3\\r\\n5 1\\r\\n1 4\\r\\n2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 10\\r\\n1 1 4 1 3 0 4 0 1 0\\r\\n3 9\\r\\n3 2\\r\\n4 5\\r\\n10 7\\r\\n4 8\\r\\n5 3\\r\\n5 7\\r\\n7 1\\r\\n6 7\\r\\n1 8\\r\\n7\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['17 17\\r\\n1 0 0 2 2 0 1 0 2 0 0 0 0 2 1 0 1\\r\\n13 14\\r\\n8 12\\r\\n14 7\\r\\n10 14\\r\\n9 8\\r\\n4 14\\r\\n12 11\\r\\n8 4\\r\\n14 15\\r\\n16 2\\r\\n5 12\\r\\n1 6\\r\\n5 2\\r\\n5 6\\r\\n2 7\\r\\n2 17\\r\\n2 3\\r\\n1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['30 30\\r\\n81 86 81 91 90 100 98 89 96 97 88 99 68 45 82 92 94 80 99 67 70 90 81 74 91 100 92 89 74 98\\r\\n16 26\\r\\n20 3\\r\\n23 16\\r\\n17 27\\r\\n30 22\\r\\n18 23\\r\\n14 30\\r\\n25 4\\r\\n3 8\\r\\n18 9\\r\\n29 26\\r\\n27 21\\r\\n26 6\\r\\n10 7\\r\\n28 5\\r\\n1 30\\r\\n28 30\\r\\n12 15\\r\\n17 25\\r\\n26 15\\r\\n30 2\\r\\n5 15\\r\\n14 20\\r\\n10 4\\r\\n24 16\\r\\n8 7\\r\\n11 30\\r\\n19 8\\r\\n21 9\\r\\n13 15\\r\\n2\\r\\n'], 'output': ['1909\\r\\n']}, {'input': ['10 45\\r\\n1 0 2 2 2 1 1 2 1 0\\r\\n3 1\\r\\n9 6\\r\\n7 1\\r\\n6 8\\r\\n8 4\\r\\n2 7\\r\\n7 10\\r\\n4 5\\r\\n7 4\\r\\n3 4\\r\\n9 2\\r\\n7 5\\r\\n8 5\\r\\n5 1\\r\\n7 3\\r\\n6 2\\r\\n3 5\\r\\n3 8\\r\\n1 9\\r\\n10 3\\r\\n9 7\\r\\n4 6\\r\\n9 8\\r\\n5 9\\r\\n10 8\\r\\n2 1\\r\\n9 4\\r\\n3 9\\r\\n8 7\\r\\n5 10\\r\\n6 5\\r\\n4 2\\r\\n2 8\\r\\n4 10\\r\\n9 10\\r\\n6 10\\r\\n6 1\\r\\n6 7\\r\\n3 6\\r\\n2 5\\r\\n8 1\\r\\n1 4\\r\\n10 1\\r\\n10 2\\r\\n3 2\\r\\n6\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['10 20\\r\\n4 1 5 1 3 0 2 2 10 4\\r\\n10 6\\r\\n10 4\\r\\n2 5\\r\\n6 3\\r\\n2 9\\r\\n1 7\\r\\n5 10\\r\\n5 6\\r\\n5 3\\r\\n3 4\\r\\n9 6\\r\\n1 8\\r\\n10 9\\r\\n10 3\\r\\n9 4\\r\\n4 6\\r\\n6 2\\r\\n3 8\\r\\n9 5\\r\\n8 2\\r\\n10\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['28 31\\r\\n0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 2 1 0 1 0 0 1 1 1 0\\r\\n9 7\\r\\n24 10\\r\\n12 27\\r\\n3 20\\r\\n16 3\\r\\n27 8\\r\\n23 25\\r\\n19 20\\r\\n10 17\\r\\n7 13\\r\\n7 5\\r\\n15 11\\r\\n19 1\\r\\n25 4\\r\\n26 22\\r\\n21 3\\r\\n17 24\\r\\n27 11\\r\\n26 20\\r\\n22 24\\r\\n8 12\\r\\n25 6\\r\\n2 14\\r\\n22 28\\r\\n20 18\\r\\n2 21\\r\\n13 9\\r\\n23 4\\r\\n19 7\\r\\n22 25\\r\\n11 24\\r\\n2\\r\\n'], 'output': ['9\\r\\n']}]","id":157} {"difficulty":2000,"lang":"Python 2","lang_cluster":"Python","src_uid":"13fa378c913bb7a15612327099b59f83","execute_outcome":"RUNTIME_ERROR","source_code":"(n , m) = map(int,raw_input().split())\n\narr = []\n\nfor i in range (n):\n arr.append(map(int,raw_input().split())[1:])\n\nseq = map(int,raw_input().split())\n\ndef gao(x):\n ans = - 2 ** 64\n now = 0\n for i in range (len(x)):\n now += x[i]\n ans = max(ans,now)\n return ans;\ndef gao2(x):\n now = x[0]\n ans = now\n for i in range(1,len(x)):\n now = max(x[i] , now + x[i]) \n ans = max(ans,now)\n return ans\ndef doit(x):\n ans = - 2 ** 64\n now = 0\n for i in range (len(x) - 1, -1 , -1):\n now += x[i]\n ans = max(ans,now)\n return ans;\n\ndp = []\npre = []\ns = []\naf = []\n\nfor i in range (n):\n pre.append(doit(arr[i]))\n s.append(sum(arr[i]))\n af.append(gao(arr[i]))\n\ndp.append([sum(arr[seq[0] - 1]),pre[seq[0] - 1]])\n\nfor i in range (1,m):\n add = max(dp[-1][0],pre[seq[i-1] - 1])\n dp.append([ add + s[seq[i] - 1] , add + af[seq[i] - 1] ] )\n\nans = - 2 ** 64\n\nfor i in range (len(seq)):\n ans = max(ans,gao2(arr[seq[i] - 1]))\n\nfor i in range (len(dp)):\n ans = max(ans,dp[i][0])\n ans = max(ans,dp[i][1])\n\nprint ans\n","description":"Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.This problem is similar to a standard problem but it has a different format and constraints.In the standard problem you are given an array of integers, and you have to find one or more consecutive elements in this array where their sum is the maximum possible sum.But in this problem you are given n small arrays, and you will create one big array from the concatenation of one or more instances of the small arrays (each small array could occur more than once). The big array will be given as an array of indexes (1-based) of the small arrays, and the concatenation should be done in the same order as in this array. Then you should apply the standard problem mentioned above on the resulting big array.For example let's suppose that the small arrays are {1, 6, -2}, {3, 3} and {-5, 1}. And the indexes in the big array are {2, 3, 1, 3}. So the actual values in the big array after formatting it as concatenation of the small arrays will be {3, 3, -5, 1, 1, 6, -2, -5, 1}. In this example the maximum sum is 9.Can you help Mostafa solve this problem?","input_specification":"The first line contains two integers n and m, n is the number of the small arrays (1\u2009\u2264\u2009n\u2009\u2264\u200950), and m is the number of indexes in the big array (1\u2009\u2264\u2009m\u2009\u2264\u2009250000). Then follow n lines, the i-th line starts with one integer l which is the size of the i-th array (1\u2009\u2264\u2009l\u2009\u2264\u20095000), followed by l integers each one will be greater than or equal -1000 and less than or equal 1000. The last line contains m integers which are the indexes in the big array, and you should concatenate the small arrays in the same order, and each index will be greater than or equal to 1 and less than or equal to n. The small arrays are numbered from 1 to n in the same order as given in the input. Some of the given small arrays may not be used in big array. Note, that the array is very big. So if you try to build it straightforwardly, you will probably get time or\/and memory limit exceeded.","output_specification":"Print one line containing the maximum sum in the big array after formatting it as described above. You must choose at least one element for the sum, i. e. it cannot be empty. Please, do not use %lld specificator to write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).","notes":null,"sample_inputs":["3 4\n3 1 6 -2\n2 3 3\n2 -5 1\n2 3 1 3","6 1\n4 0 8 -3 -10\n8 3 -2 -5 10 8 -9 -5 -4\n1 0\n1 -3\n3 -8 5 6\n2 9 6\n1"],"sample_outputs":["9","8"],"human_solution":"(n , m) = map(int,raw_input().split())\n\narr = []\n\nfor i in range (n):\n arr.append(map(int,raw_input().split())[1:])\n\nseq = map(int,raw_input().split())\n\ndef gao(x):\n ans = - 2 ** 64\n now = 0\n for i in range (len(x)):\n now += x[i]\n ans = max(ans,now)\n return ans;\ndef gao2(x):\n now = x[0]\n ans = now\n for i in range(1,len(x)):\n now = max(x[i] , now + x[i]) \n ans = max(ans,now)\n return ans\ndef doit(x):\n ans = - 2 ** 64\n now = 0\n for i in range (len(x) - 1, -1 , -1):\n now += x[i]\n ans = max(ans,now)\n return ans;\n\ndp = []\npre = []\ns = []\naf = []\nbak = []\n\nfor i in range (n):\n pre.append(doit(arr[i]))\n s.append(sum(arr[i]))\n af.append(gao(arr[i]))\n bak.append(gao2(arr[i]))\ndp.append([sum(arr[seq[0] - 1]),pre[seq[0] - 1]])\n\nfor i in range (1,m):\n add = max(dp[-1][0],pre[seq[i-1] - 1])\n dp.append([ add + s[seq[i] - 1] , add + af[seq[i] - 1] ] )\n\nans = - 2 ** 64\n\nfor i in range (len(seq)):\n ans = max(ans,bak[seq[i] - 1])\n\nfor i in range (len(dp)):\n ans = max(ans,dp[i][0])\n ans = max(ans,dp[i][1])\n\nprint ans\n","testcases":"[{'input': '3 4\\r\\n3 1 6 -2\\r\\n2 3 3\\r\\n2 -5 1\\r\\n2 3 1 3\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 1\\r\\n4 0 8 -3 -10\\r\\n8 3 -2 -5 10 8 -9 -5 -4\\r\\n1 0\\r\\n1 -3\\r\\n3 -8 5 6\\r\\n2 9 6\\r\\n1\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 3\\r\\n6 6 8 -5 4 10 -2\\r\\n1 -2\\r\\n1 -10\\r\\n5 -10 10 8 -7 -10\\r\\n2 4 1\\r\\n', 'output': ['24\\r\\n']}, {'input': '7 7\\r\\n2 -8 -7\\r\\n5 2 -10 10 -2 4\\r\\n7 10 -8 9 8 9 -10 -3\\r\\n6 0 6 -9 9 -6 -9\\r\\n4 -6 -9 10 -6\\r\\n3 -8 4 10\\r\\n7 -1 -3 10 -8 -6 -3 6\\r\\n4 5 4 6 6 1 7\\r\\n', 'output': ['20\\r\\n']}, {'input': '4 8\\r\\n8 0 3 -9 -10 0 -1 6 -4\\r\\n3 -10 -7 2\\r\\n10 6 -2 -9 0 -7 -4 -7 7 -1 2\\r\\n3 -5 1 -4\\r\\n1 1 1 1 4 4 3 3\\r\\n', 'output': ['14\\r\\n']}, {'input': '2 1\\r\\n2 -4 -6\\r\\n5 6 8 3 5 -2\\r\\n1\\r\\n', 'output': ['-4\\r\\n']}, {'input': '9 4\\r\\n4 8 -2 -10 6\\r\\n10 -4 9 6 -2 -8 6 7 2 -6 2\\r\\n8 -10 1 9 9 -10 2 -10 -9\\r\\n7 3 -10 -10 -6 3 -7 0\\r\\n5 -4 -8 2 -5 2\\r\\n1 -3\\r\\n4 -9 0 7 -4\\r\\n7 4 -5 4 -8 -4 0 -1\\r\\n9 2 5 -10 4 -10 -2 6 5 10\\r\\n3 6 4 6\\r\\n', 'output': ['19\\r\\n']}, {'input': '3 1\\r\\n7 4 8 1 -7 -9 -8 -9\\r\\n10 5 -5 -5 -9 -1 7 4 -1 -4 4\\r\\n8 -7 7 4 10 -6 3 -6 9\\r\\n2\\r\\n', 'output': ['11\\r\\n']}, {'input': '7 3\\r\\n7 -9 -6 0 -6 -5 1 -9\\r\\n9 4 4 3 -6 -4 8 4 5 -6\\r\\n1 -4\\r\\n7 -3 -9 -9 1 -4 8 7\\r\\n2 6 3\\r\\n7 0 -5 -5 -2 -8 2 -1\\r\\n8 4 1 6 -7 -2 10 -8 -2\\r\\n3 1 5\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 9\\r\\n8 -10 10 3 4 -9 0 3 9\\r\\n4 9 2 -1 6\\r\\n3 -10 -10 -5\\r\\n7 10 -6 7 1 -8 3 4\\r\\n8 -8 9 3 -1 0 1 -7 -7\\r\\n1 -4\\r\\n3 2 3 2 4 4 1 1 1\\r\\n', 'output': ['68\\r\\n']}, {'input': '3 6\\r\\n3 -1 -1 -1\\r\\n4 -2 -2 -2 -2\\r\\n5 -3 -3 -3 -3 -3\\r\\n1 2 3 1 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n11 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n10 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['11\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1\\r\\n1 -1\\r\\n1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1\\r\\n1 0\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 1 0 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\n6 0 0 0 0 0 0\\r\\n6 0 0 0 0 0 0\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '14 14\\r\\n6 -1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 -1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\\r\\n', 'output': ['82\\r\\n']}]","id":158} {"difficulty":1800,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"15_B","execute_outcome":"WRONG_ANSWER","source_code":"import sys; R = sys.stdin.readline\r\nfor _ in range(int(R())):\r\n n,m,x1,y1,x2,y2 = map(int,R().split())\r\n a,b = abs(x1-x2),abs(y1-y2)\r\n print(n*m-2*abs(x1-x2)*abs(y1-y2)+(2*a-n if 2*a>n else 0)*(2*b-n if 2*b>n else 0))","description":"Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n\u00d7m cells and a robotic arm. Each cell of the field is a 1\u00d71 square. The robotic arm has two lasers pointed at the field perpendicularly to its surface. At any one time lasers are pointed at the centres of some two cells. Since the lasers are on the robotic hand, their movements are synchronized \u2014 if you move one of the lasers by a vector, another one moves by the same vector.The following facts about the experiment are known: initially the whole field is covered with a chocolate bar of the size n\u00d7m, both lasers are located above the field and are active; the chocolate melts within one cell of the field at which the laser is pointed; all moves of the robotic arm should be parallel to the sides of the field, after each move the lasers should be pointed at the centres of some two cells; at any one time both lasers should be pointed at the field. Petya doesn't want to become a second Gordon Freeman. You are given n, m and the cells (x1,y1) and (x2,y2), where the lasers are initially pointed at (xi is a column number, yi is a row number). Rows are numbered from 1 to m from top to bottom and columns are numbered from 1 to n from left to right. You are to find the amount of cells of the field on which the chocolate can't be melted in the given conditions.","input_specification":"The first line contains one integer number t (1\u2264t\u226410000) \u2014 the number of test sets. Each of the following t lines describes one test set. Each line contains integer numbers n, m, x1, y1, x2, y2, separated by a space (2\u2264n,m\u226410^9, 1\u2264x1,x2\u2264n, 1\u2264y1,y2\u2264m). Cells (x1,y1) and (x2,y2) are distinct.\n","output_specification":"Each of the t lines of the output should contain the answer to the corresponding input test set.\n","notes":null,"sample_inputs":["2\n4 4 1 1 3 3\n4 3 1 1 2 2\n"],"sample_outputs":["8\n2\n"],"human_solution":"def main():\r\n t = int(input())\r\n for _ in range(t):\r\n n, m, x1, y1, x2, y2 = map(int, input().split())\r\n rect_x, rect_y = n - abs(x2 - x1), m - abs(y2 - y1)\r\n area = n * m - 2 * rect_x * rect_y + max(0, rect_x * 2 - n) * max(0, rect_y * 2 - m)\r\n print(area)\r\n\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n","testcases":"[{'input': ['2\\r\\n4 4 1 1 3 3\\r\\n4 3 1 1 2 2\\r\\n'], 'output': ['8\\r\\n2\\r\\n']}, {'input': ['1\\r\\n2 2 1 2 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n2 2 1 2 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n3 3 3 2 1 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1\\r\\n3 4 1 1 1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n4 3 3 1 4 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n3 5 2 4 3 5\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n4 5 2 2 4 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n2 5 1 5 2 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1\\r\\n2 6 2 6 2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n3 6 3 5 2 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n4 6 2 1 2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n5 6 3 4 4 2\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n7 3 6 2 5 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n8 2 6 1 7 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n9 6 6 5 3 1\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['20\\r\\n100 200 100 1 100 100\\r\\n100 200 1 100 100 100\\r\\n2 2 1 1 2 2\\r\\n100 100 50 50 1 1\\r\\n10 10 5 5 1 1\\r\\n100 100 99 1 1 99\\r\\n100 100 1 99 99 1\\r\\n100 100 1 10 10 1\\r\\n100 100 1 1 10 10\\r\\n9 6 1 3 3 1\\r\\n1000000000 1000000000 1 1 1000000000 1000000000\\r\\n9 4 1 4 4 1\\r\\n6 4 1 1 5 4\\r\\n6 2 1 1 5 2\\r\\n8 2 1 1 5 2\\r\\n10 2 1 1 5 2\\r\\n10 2 1 1 3 2\\r\\n4 3 1 1 2 2\\r\\n3 3 1 1 2 2\\r\\n3 3 1 1 2 1\\r\\n'], 'output': ['0\\r\\n19600\\r\\n2\\r\\n4802\\r\\n32\\r\\n9992\\r\\n9992\\r\\n162\\r\\n162\\r\\n8\\r\\n999999999999999998\\r\\n24\\r\\n20\\r\\n8\\r\\n8\\r\\n8\\r\\n4\\r\\n2\\r\\n2\\r\\n0\\r\\n']}]","id":159} {"difficulty":2200,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"19_C","execute_outcome":"WRONG_ANSWER","source_code":"import sys\nn=int(input())\na=list(map(int,input().split()))\nM=10**9+1\ng={}\nfor i in range(n):\n g[a[i]]=g.get(a[i],[])+[i]\np=[1]\nfor i in range(n):\n p+=[hash(M*p[-1])]\nh=[0]*(n+1)\nfor i in range(n):\n h[i+1]=hash(h[i]*M+a[i])\n\ngh=lambda k,l:hash(h[k+l]-h[k]*p[l])%sys.hash_info.modulus\ni,t=0,0\n\nfor i in range(n):\n for j in g[a[i]]:\n if j <= i:\n continue\n w=j-i\n if j+w<=n and gh(i,w)==gh(j,w):\n i=j-1\n t=max(t,j)\n break\n\nr=a[t:]\nprint(len(r))\nprint(*r)\n\n","description":"Once Bob saw a string. It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times. Bob didn't like that string, because it contained repeats: a repeat of length x is such a substring of length 2x, that its first half coincides character by character with its second half. Bob started deleting all the repeats from the string. He does it as follows: while it's possible, Bob takes the shortest repeat, if it is not unique, he takes the leftmost one, and deletes its left half and everything that is to the left of this repeat.You're given the string seen by Bob. Find out, what it will look like after Bob deletes all the repeats in the way described above.","input_specification":"The first input line contains integer n (1\u2264n\u226410^5) \u2014 length of the string. The following line contains n space-separated integer numbers from 0 to 10^9 inclusive \u2014 numbers that stand for the letters of the string. It's guaranteed that each letter can be met in the string at most 10 times.\n","output_specification":"In the first line output the length of the string's part, left after Bob's deletions. In the second line output all the letters (separated by a space) of the string, left after Bob deleted all the repeats in the described way.\n","notes":null,"sample_inputs":["6\n1 2 3 1 2 3\n","7\n4 5 6 5 6 7 7\n"],"sample_outputs":["3\n1 2 3 \n","1\n7 \n"],"human_solution":"import sys\nn=int(input())\na=list(map(int,input().split()))\nM=10**9+1\ng={}\nfor i in range(n):\n g[a[i]]=g.get(a[i],[])+[i]\np=[1]\nfor i in range(n):\n p+=[hash(M*p[-1])]\nh=[0]*(n+1)\nfor i in range(n):\n h[i+1]=hash(h[i]*M+a[i])\n\ngh=lambda k,l:hash(h[k+l]-h[k]*p[l])%sys.hash_info.modulus\ni,t=0,0\n\nwhile i < n:\n for j in g[a[i]]:\n if j <= i:\n continue\n w=j-i\n if j+w<=n and gh(i,w)==gh(j,w):\n i=j-1\n t=max(t,j)\n break\n i += 1\n\nr=a[t:]\nprint(len(r))\nprint(*r)\n\n","testcases":"[{'input': ['6\\r\\n1 2 3 1 2 3\\r\\n'], 'output': ['3\\r\\n1 2 3 \\r\\n']}, {'input': ['7\\r\\n4 5 6 5 6 7 7\\r\\n'], 'output': ['1\\r\\n7 \\r\\n']}, {'input': ['10\\r\\n5 7 2 1 8 8 5 10 2 5\\r\\n'], 'output': ['5\\r\\n8 5 10 2 5 \\r\\n']}, {'input': ['10\\r\\n0 1 1 1 0 3 0 1 4 0\\r\\n'], 'output': ['7\\r\\n1 0 3 0 1 4 0 \\r\\n']}, {'input': ['10\\r\\n0 1 0 2 0 0 1 1 1 0\\r\\n'], 'output': ['2\\r\\n1 0 \\r\\n']}, {'input': ['30\\r\\n17 17 2 4 13 21 17 11 15 0 9 2 23 10 24 21 23 17 5 11 25 1 16 6 11 22 19 2 12 16\\r\\n'], 'output': ['29\\r\\n17 2 4 13 21 17 11 15 0 9 2 23 10 24 21 23 17 5 11 25 1 16 6 11 22 19 2 12 16 \\r\\n']}, {'input': ['100\\r\\n8 43 55 27 70 81 66 10 49 67 24 61 53 0 2 76 96 16 16 1 78 1 69 69 4 59 6 87 98 14 98 20 12 48 20 41 67 90 20 96 44 8 77 94 84 2 61 27 90 42 66 84 5 19 68 13 5 53 13 87 70 41 48 40 19 61 72 31 4 4 59 100 50 64 84 10 96 16 73 3 63 85 67 91 74 63 22 34 6 96 78 42 61 85 3 95 98 84 66 78\\r\\n'], 'output': ['31\\r\\n4 59 100 50 64 84 10 96 16 73 3 63 85 67 91 74 63 22 34 6 96 78 42 61 85 3 95 98 84 66 78 \\r\\n']}, {'input': ['100\\r\\n5 4 8 2 4 7 6 6 9 0 5 9 9 8 2 1 10 7 1 0 0 6 3 5 3 7 8 0 0 10 6 7 10 5 4 10 7 6 7 5 1 5 0 10 3 10 5 7 4 10 0 9 1 2 6 3 3 6 10 6 9 1 6 3 4 6 2 8 8 9 5 2 3 3 10 7 4 1 10 1 8 5 4 3 2 2 0 4 4 1 4 5 7 2 8 7 1 1 2 8\\r\\n'], 'output': ['3\\r\\n1 2 8 \\r\\n']}, {'input': ['100\\r\\n19 17 16 6 4 13 7 12 4 16 2 2 12 15 20 17 3 13 14 2 4 20 14 10 11 17 7 17 12 18 17 14 10 16 20 16 19 12 9 15 2 13 5 6 9 3 14 6 20 3 15 16 0 12 5 11 3 19 5 2 11 18 20 20 11 4 1 10 20 10 19 0 4 10 1 11 4 11 8 19 3 14 6 1 14 2 13 20 8 3 19 19 6 19 19 20 20 8 13 14\\r\\n'], 'output': ['4\\r\\n20 8 13 14 \\r\\n']}, {'input': ['10\\r\\n1 2 1 2 1 2 1 2 1 2\\r\\n'], 'output': ['2\\r\\n1 2 \\r\\n']}, {'input': ['10\\r\\n1 2 3 4 5 1 2 3 4 5\\r\\n'], 'output': ['5\\r\\n1 2 3 4 5 \\r\\n']}, {'input': ['10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['1\\r\\n1 \\r\\n']}, {'input': ['21\\r\\n16417014 805849548 385039296 16417014 805849548 385039296 16417014 805849548 385039296 16417014 805849548 385039296 16417014 805849548 385039296 16417014 805849548 385039296 16417014 805849548 385039296\\r\\n'], 'output': ['3\\r\\n16417014 805849548 385039296 \\r\\n']}, {'input': ['22\\r\\n823078040 389511796 683819000 823078040 389511796 683819000 823078040 389511796 683819000 823078040 389511796 683819000 823078040 389511796 683819000 823078040 389511796 683819000 823078040 389511796 683819000 823078040\\r\\n'], 'output': ['4\\r\\n823078040 389511796 683819000 823078040 \\r\\n']}, {'input': ['23\\r\\n482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044 835115058 482255418 973174044\\r\\n'], 'output': ['5\\r\\n482255418 973174044 835115058 482255418 973174044 \\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['1\\r\\n0 \\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['2\\r\\n1 2 \\r\\n']}, {'input': ['2\\r\\n1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n1000000000 \\r\\n']}, {'input': ['3\\r\\n1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n1000000000 \\r\\n']}, {'input': ['4\\r\\n1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n1000000000 \\r\\n']}, {'input': ['7\\r\\n1 2 3 1 2 3 1\\r\\n'], 'output': ['4\\r\\n1 2 3 1 \\r\\n']}, {'input': ['30\\r\\n0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\\r\\n'], 'output': ['1\\r\\n2 \\r\\n']}, {'input': ['10\\r\\n0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['1\\r\\n0 \\r\\n']}, {'input': ['20\\r\\n0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['1\\r\\n1 \\r\\n']}]","id":160} {"difficulty":1900,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"22_D","execute_outcome":"WRONG_ANSWER","source_code":"print(\"_RANDOM_GUESS_1690485752.7442563\")# 1690485752.7442749","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"],"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":161} {"difficulty":2500,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"23_E","execute_outcome":"WRONG_ANSWER","source_code":"import random\r\nimport sys\r\nimport os\r\nimport math\r\nfrom collections import Counter, defaultdict, deque\r\nfrom functools import lru_cache, reduce\r\nfrom itertools import accumulate, combinations, permutations\r\nfrom heapq import nsmallest, nlargest, heapify, heappop, heappush\r\nfrom io import BytesIO, IOBase\r\nfrom copy import deepcopy\r\nimport threading\r\nimport bisect\r\nBUFSIZE = 4096\r\n\r\n\r\nclass FastIO(IOBase):\r\n newlines = 0\r\n\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\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\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\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\n\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\n\r\nsys.stdin = IOWrapper(sys.stdin)\r\nsys.stdout = IOWrapper(sys.stdout)\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\n\r\ndef I():\r\n return input()\r\n\r\ndef II():\r\n return int(input())\r\n\r\ndef MI():\r\n return map(int, input().split())\r\n\r\ndef LI():\r\n return list(input().split())\r\n\r\ndef LII():\r\n return list(map(int, input().split()))\r\n\r\ndef GMI():\r\n return map(lambda x: int(x) - 1, input().split())\r\n\r\ndef LGMI():\r\n return list(map(lambda x: int(x) - 1, input().split()))\r\n\r\nn = II()\r\nif n <= 4: print(n)\r\nelif n % 3 == 0: print(pow(3, n \/\/ 3))\r\nelif n % 3 == 1: print(pow(3, (n - 4) \/\/ 3) * 4)\r\nelse: print(pow(3, (n - 2) \/\/ 3) * 2)","description":"Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can get in his new game for a given tree.","input_specification":"The first input line contains integer number n (1\u2264n\u2264700) \u2014 amount of vertices in the tree. The following n-1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1\u2264ai,bi\u2264n). It's guaranteed that the graph described in the input is a tree.\n","output_specification":"Output the only number \u2014 the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges.\n","notes":null,"sample_inputs":["5\n1 2\n2 3\n3 4\n4 5\n","8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8\n","3\n1 2\n1 3\n"],"sample_outputs":["6","18","3"],"human_solution":"import sys\r\n\r\nN = 1500\r\nne = [0 for i in range(N)]\r\nhe = [0 for i in range(N)]\r\nto = [0 for i in range(N)]\r\ntot = 0\r\nf = [[0 for i in range(N)] for i in range(N)]\r\nsz = [0 for i in range(N)]\r\n\r\n\r\ndef add(u, v):\r\n global tot\r\n tot += 1\r\n ne[tot] = he[u]\r\n to[tot] = v\r\n he[u] = tot\r\n\r\n\r\ndef dfs(u, fa):\r\n t = he[u]\r\n sz[u] = 1\r\n f[u][1] = 1\r\n while t > 0:\r\n v = to[t]\r\n if v != fa:\r\n dfs(v, u)\r\n i = sz[u]\r\n while i >= 0:\r\n j = sz[v]\r\n while j >= 0:\r\n f[u][i + j] = max(f[u][i + j], f[u][i] * f[v][j])\r\n j -= 1\r\n i -= 1\r\n sz[u] = sz[u] + sz[v]\r\n t = ne[t]\r\n for i in range(1, sz[u] + 1):\r\n f[u][0] = max(f[u][0], f[u][i] * i)\r\n\r\n\r\nn = int(input())\r\nfor i in range(n - 1):\r\n x, y = list(map(int, input().split()))\r\n add(x, y)\r\n add(y, x)\r\ndfs(1, 0)\r\nprint(f[1][0])\r\n","testcases":"[{'input': ['5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n'], 'output': ['6']}, {'input': ['8\\r\\n1 2\\r\\n1 3\\r\\n2 4\\r\\n2 5\\r\\n3 6\\r\\n3 7\\r\\n6 8\\r\\n'], 'output': ['18']}, {'input': ['3\\r\\n1 2\\r\\n1 3\\r\\n'], 'output': ['3']}, {'input': ['5\\r\\n3 2\\r\\n1 5\\r\\n4 5\\r\\n5 3\\r\\n'], 'output': ['6']}, {'input': ['5\\r\\n2 1\\r\\n3 4\\r\\n3 5\\r\\n5 2\\r\\n'], 'output': ['6']}, {'input': ['5\\r\\n1 4\\r\\n4 5\\r\\n4 3\\r\\n4 2\\r\\n'], 'output': ['5']}, {'input': ['5\\r\\n2 3\\r\\n3 4\\r\\n3 5\\r\\n3 1\\r\\n'], 'output': ['5']}, {'input': ['10\\r\\n4 8\\r\\n10 2\\r\\n6 3\\r\\n10 9\\r\\n2 3\\r\\n4 1\\r\\n7 10\\r\\n2 1\\r\\n5 1\\r\\n'], 'output': ['36']}, {'input': ['15\\r\\n4 6\\r\\n15 1\\r\\n3 8\\r\\n15 2\\r\\n13 11\\r\\n9 10\\r\\n14 4\\r\\n9 12\\r\\n11 6\\r\\n8 10\\r\\n4 5\\r\\n2 11\\r\\n7 8\\r\\n8 4\\r\\n'], 'output': ['243']}, {'input': ['50\\r\\n45 39\\r\\n18 12\\r\\n13 6\\r\\n48 45\\r\\n46 36\\r\\n46 8\\r\\n40 36\\r\\n29 28\\r\\n2 18\\r\\n43 26\\r\\n25 14\\r\\n43 31\\r\\n13 30\\r\\n12 35\\r\\n38 42\\r\\n20 5\\r\\n7 35\\r\\n10 50\\r\\n27 13\\r\\n1 41\\r\\n24 21\\r\\n25 5\\r\\n7 31\\r\\n15 45\\r\\n32 25\\r\\n43 23\\r\\n4 50\\r\\n46 11\\r\\n40 14\\r\\n37 21\\r\\n50 2\\r\\n41 42\\r\\n43 30\\r\\n14 22\\r\\n36 48\\r\\n8 24\\r\\n49 20\\r\\n19 26\\r\\n32 10\\r\\n35 29\\r\\n1 6\\r\\n34 33\\r\\n29 3\\r\\n6 9\\r\\n34 39\\r\\n5 47\\r\\n16 9\\r\\n31 44\\r\\n33 17\\r\\n'], 'output': ['68024448']}, {'input': ['10\\r\\n8 10\\r\\n5 7\\r\\n1 6\\r\\n4 9\\r\\n3 8\\r\\n8 9\\r\\n2 3\\r\\n5 8\\r\\n8 1\\r\\n'], 'output': ['32']}, {'input': ['5\\r\\n1 5\\r\\n4 3\\r\\n2 4\\r\\n4 1\\r\\n'], 'output': ['6']}, {'input': ['1\\r\\n'], 'output': ['1']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['2']}, {'input': ['3\\r\\n1 2\\r\\n2 3\\r\\n'], 'output': ['3']}]","id":162} {"difficulty":1600,"lang":"Python 3","lang_cluster":"Python","src_uid":"29d4ca13888c0e172dde315b66380fe5","execute_outcome":"RUNTIME_ERROR","source_code":"s=input()\nl=[]\nl=list(map(int,s.split()))\nR=l[0]\nr=0\nx1=l[1]\ny1=l[2]\nx2=l[3]\ny2=l[4]\nd=(((x2-x1)**2)+((y2-y1)**2))**0.5\nif(d>=R):\n r=(R)\n xa=x1\n ya=y1\nelse:\n r=(R+d)\/2\n xa=(x2+(((R+d)*x1)-R*x2)\/d)\/2\n ya=(y2+(((R+d)*y1)-R*y2)\/d)\/2\nprint(xa)\nprint(ya)\nprint(r)\n\n","description":"Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by Fifa) from its position. Fifa must put the access point inside the flat which has a circular shape of radius R. Fifa wants to minimize the area that is not covered by the access point inside the flat without letting Fafa or anyone outside the flat to get access to the internet.The world is represented as an infinite 2D plane. The flat is centered at (x1,\u2009y1) and has radius R and Fafa's laptop is located at (x2,\u2009y2), not necessarily inside the flat. Find the position and the radius chosen by Fifa for his access point which minimizes the uncovered area.","input_specification":"The single line of the input contains 5 space-separated integers R,\u2009x1,\u2009y1,\u2009x2,\u2009y2 (1\u2009\u2264\u2009R\u2009\u2264\u2009105, |x1|,\u2009|y1|,\u2009|x2|,\u2009|y2|\u2009\u2264\u2009105).","output_specification":"Print three space-separated numbers xap,\u2009yap,\u2009r where (xap,\u2009yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10\u2009-\u20096 absolutely or relatively, and also the radius you printed can be changed by no more than 10\u2009-\u20096 (absolutely or relatively) in such a way that all points outside the flat and Fafa's laptop position are outside circle of the access point range.","notes":null,"sample_inputs":["5 3 3 1 1","10 5 5 5 15"],"sample_outputs":["3.7677669529663684 3.7677669529663684 3.914213562373095","5.0 5.0 10.0"],"human_solution":"\nimport sys\nimport math\n\ndef dist(x1, y1, x2, y2):\n return math.sqrt((y2 - y1) ** 2 + (x2 - x1) ** 2)\n \n \ndef solve(io):\n R, c_x, c_y, mate_x, mate_y = io.readInt(), io.readInt(), io.readInt(), io.readInt(), io.readInt()\n # is asshole in the room?\n distance = dist(c_x, c_y, mate_x, mate_y)\n if(distance >= R):\n io.print(c_x)\n io.print(\" \")\n io.print(c_y)\n io.print(\" \")\n io.print(R)\n return\n if(distance == 0):\n c_x = c_x + R\/2.0\n R = R\/2.0\n io.print(c_x)\n io.print(\" \")\n io.print(c_y)\n io.print(\" \")\n io.print(R)\n return\n \n distance = dist(c_x, c_y, mate_x, mate_y)\n remain = distance + R\n new_radius = remain \/ 2.0\n \n #slope = (mate_y - c_y) \/ (mate_x - c_x + 0.0)\n vector = ((c_x - mate_x) \/ distance * new_radius, (c_y - mate_y) \/ distance * new_radius)\n \n center = mate_x + vector[0], mate_y + vector[1]\n \n io.print(center[0])\n io.print(\" \")\n io.print(center[1])\n io.print(\" \")\n io.print(new_radius)\n\n# +---------------------+\n# | TEMPLATE CODE BELOW |\n# | DO NOT MODIFY |\n# +---------------------+\n\n# TODO: maybe reading byte-by-byte is faster than reading and parsing tokens.\nclass IO:\n input = None\n output = None\n raw = \"\"\n buf = []\n pos = 0\n \n def __init__(self, inputStream, outputStream):\n self.input = inputStream\n self.output = outputStream\n \n def readToBuffer(self):\n self.raw = self.input.readline().rstrip('\\n')\n self.buf = self.raw.split()\n self.pos = 0\n \n def readString(self):\n while self.pos == len(self.buf):\n self.readToBuffer()\n ans = self.buf[self.pos]\n self.pos += 1\n return ans\n \n def readInt(self):\n return int(self.readString())\n \n def readFloat(self):\n return float(self.readString())\n \n def readStringArray(self, N, offset = 0):\n arr = [ None ] * offset\n for _ in range(0, N):\n arr.append(self.readString())\n return arr\n \n def readIntArray(self, N, offset = 0):\n arr = [ None ] * offset\n for _ in range(0, N):\n arr.append(self.readInt())\n return arr\n \n def readFloatArray(self, N, offset = 0):\n arr = [ None ] * offset\n for _ in range(0, N):\n arr.append(self.readFloat())\n return arr\n \n def readLine(self):\n while self.pos == len(self.buf):\n self.readToBuffer()\n if self.pos > 0:\n raise ValueError(\"Cannot call readline in the middle of a line.\")\n return self.raw\n \n def print(self, s):\n self.output.write(str(s))\n \n def println(self, s):\n self.print(s)\n self.print('\\n')\n \n def flushOutput(self):\n self.output.flush()\n\npythonIO = IO(sys.stdin, sys.stdout)\nsolve(pythonIO)\npythonIO.flushOutput()\n","testcases":"[{'input': '5 3 3 1 1\\r\\n', 'output': ['3.7677669529663684 3.7677669529663684 3.914213562373095\\r\\n']}, {'input': '10 5 5 5 15\\r\\n', 'output': ['5.0 5.0 10.0\\r\\n']}, {'input': '5 0 0 0 7\\r\\n', 'output': ['0 0 5\\r\\n']}, {'input': '10 0 0 0 0\\r\\n', 'output': ['5.0 0.0 5.0\\r\\n']}, {'input': '100000 100000 100000 10000 10000\\r\\n', 'output': ['100000 100000 100000\\r\\n']}, {'input': '100000 -100000 100000 -10000 100000\\r\\n', 'output': ['-105000.0 100000.0 95000.0\\r\\n']}, {'input': '1 0 0 0 -1\\r\\n', 'output': ['0.0 0.0 1.0\\r\\n']}, {'input': '100000 83094 84316 63590 53480\\r\\n', 'output': ['100069.69149822203 111154.72144376408 68243.2515742123\\r\\n']}, {'input': '1 0 0 0 0\\r\\n', 'output': ['0.5 0.0 0.5\\r\\n']}, {'input': '1 0 0 -2 -2\\r\\n', 'output': ['0 0 1\\r\\n']}, {'input': '10 0 0 4 0\\r\\n', 'output': ['-3.0 0.0 7.0\\r\\n']}, {'input': '82 1928 -30264 2004 -30294\\r\\n', 'output': ['1927.8636359254158 -30263.946172075823 81.85339643163098\\r\\n']}, {'input': '75 -66998 89495 -66988 89506\\r\\n', 'output': ['-67018.22522977486 89472.75224724766 44.933034373659254\\r\\n']}, {'input': '11 9899 34570 9895 34565\\r\\n', 'output': ['9900.435822761548 34571.794778451935 8.701562118716424\\r\\n']}, {'input': '21 7298 -45672 7278 -45677\\r\\n', 'output': ['7298.186496251526 -45671.95337593712 20.80776406404415\\r\\n']}, {'input': '31 84194 -71735 84170 -71758\\r\\n', 'output': ['84194 -71735 31\\r\\n']}, {'input': '436 25094 -66597 25383 -66277\\r\\n', 'output': ['25092.386577687754 -66598.78648837341 433.5927874489312\\r\\n']}, {'input': '390 -98011 78480 -98362 78671\\r\\n', 'output': ['-98011 78480 390\\r\\n']}, {'input': '631 -21115 -1762 -21122 -1629\\r\\n', 'output': ['-21101.91768814977 -2010.563925154407 382.0920415665416\\r\\n']}, {'input': '872 55782 51671 54965 51668\\r\\n', 'output': ['55809.49706065544 51671.100968398976 844.502753968685\\r\\n']}, {'input': '519 -92641 -28571 -92540 -28203\\r\\n', 'output': ['-92659.18165738975 -28637.246038806206 450.30421903092184\\r\\n']}, {'input': '3412 23894 22453 26265 25460\\r\\n', 'output': ['23894 22453 3412\\r\\n']}, {'input': '3671 -99211 -3610 -99825 -1547\\r\\n', 'output': ['-98994.40770099283 -4337.736014416596 2911.7161725229744\\r\\n']}, {'input': '3930 -76494 -83852 -78181 -81125\\r\\n', 'output': ['-76303.71953677801 -84159.58436467478 3568.316718555632\\r\\n']}, {'input': '4189 -24915 61224 -28221 65024\\r\\n', 'output': ['-24915 61224 4189\\r\\n']}, {'input': '8318 -2198 35161 3849 29911\\r\\n', 'output': ['-2315.0277877457083 35262.60342081445 8163.0201360632545\\r\\n']}, {'input': '15096 -12439 58180 -10099 50671\\r\\n', 'output': ['-13514.641370727473 61631.70557811649 11480.578066612283\\r\\n']}, {'input': '70343 64457 3256 83082 -17207\\r\\n', 'output': ['50095.092392996106 19035.206193939368 49006.464709026186\\r\\n']}, {'input': '66440 -58647 -76987 2151 -40758\\r\\n', 'output': ['-58647 -76987 66440\\r\\n']}, {'input': '62537 18249 96951 -3656 54754\\r\\n', 'output': ['21702.922094423477 103604.5106422455 55040.41533091097\\r\\n']}, {'input': '88209 95145 42027 21960 26111\\r\\n', 'output': ['101649.61478542663 43441.59928844504 81552.34132964142\\r\\n']}, {'input': '100000 -100000 -100000 -100000 -100000\\r\\n', 'output': ['-50000.0 -100000.0 50000.0\\r\\n']}, {'input': '100000 100000 100000 100000 100000\\r\\n', 'output': ['150000.0 100000.0 50000.0\\r\\n']}, {'input': '2 0 0 0 1\\r\\n', 'output': ['0.0 -0.5 1.5\\r\\n']}, {'input': '1 1 0 1 0\\r\\n', 'output': ['1.5 0.0 0.5\\r\\n']}, {'input': '2 3 3 3 3\\r\\n', 'output': ['4.0 3.0 1.0\\r\\n']}, {'input': '1 1 1 1 1\\r\\n', 'output': ['1.5 1.0 0.5\\r\\n']}, {'input': '10 1 1 1 1\\r\\n', 'output': ['6.0 1.0 5.0\\r\\n']}, {'input': '10 5 5 5 10\\r\\n', 'output': ['5.0 2.5 7.5\\r\\n']}, {'input': '5 0 0 0 0\\r\\n', 'output': ['2.5 0.0 2.5\\r\\n']}]","id":163} {"difficulty":1900,"lang":"Python 2","lang_cluster":"Python","src_uid":"34b67958a37865e1ca0529bbf528dd9a","execute_outcome":"RUNTIME_ERROR","source_code":"C=lambda c:10-c if c else 0\ndef s(v,c):\n\tn=C(c)\n\tif v[c]*v[n]<1:return 0\n\ta=v[:];b=v[:];a[c]-=1;b[n]-=1\n\tx=max(0,(b[0]-a[9]));a[0]-=x;b[0]-=x\n\treturn(x+1+sum(min(v[i],b[9-i])for i in range(10)),x)\na=raw_input()\nv=[a.count(`i`)for i in range(10)]\nb=d=0\nfor c in range(6):\n\tt=s(v,c)\n\tif t>b:b=t;d=c\nif b==0:print a;print a;exit()\nz=b[1]\nv[0]-=z\nn=C(d)\nX=`d`;x=v[:];x[d]-=1\nY=`n`;y=v[:];y[n]-=1\nfor i in range(10):m=min(x[i],y[9-i]);X=`i`*m+X;Y=`9-i`*m+Y;x[i]-=m;y[9-i]-=m;\nZ=lambda v:\"\".join(`i`*n for i,n in enumerate(v))\nprint Z(x)+X+\"0\"*z\nprint Z(y)+Y+\"0\"*z\n","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"],"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":164} {"difficulty":1900,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"599_D","execute_outcome":"WRONG_ANSWER","source_code":"x = 0\r\np = [x := x + i ** 2 for i in range(1, 2000001)]\r\n\r\n\r\ndef f(a, b):\r\n return a * a * b - ((a * (a - 1)) \/\/ 2) * (a + b) + (p[a - 2] if a >= 2 else 0)\r\n\r\n\r\ndef ff(a, x):\r\n C = 0 if a < 2 else p[a - 2]\r\n nom = 2 * x - 2 * C - a * a * a + a * a\r\n denom = 3 * a * a - a\r\n if nom % denom == 0:\r\n return nom \/\/ denom\r\n return -1\r\n\r\n\r\ndef binary_search(a, x):\r\n l = a\r\n r = x + 1\r\n while l < r:\r\n mid = (l + r) \/\/ 2\r\n v = f(a, mid)\r\n if v < x:\r\n l = mid + 1\r\n elif v > x:\r\n r = mid\r\n else:\r\n return mid\r\n return l\r\n\r\n\r\ndef __main__():\r\n x = int(input())\r\n res = []\r\n\r\n for a in range(1, 2000000):\r\n b = ff(a, x)\r\n if b != -1:\r\n res.append((a, b))\r\n\r\n if res[-1][0] == res[-1][1]:\r\n print(2 * len(res) - 1)\r\n else:\r\n print(2 * len(res))\r\n\r\n for r in res:\r\n print(r[0], r[1])\r\n\r\n for r in reversed(res):\r\n if r[0] != r[1]:\r\n print(r[1], r[0])\r\n\r\n return\r\n\r\n\r\n__main__()","description":"Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m columns. For example, in a 3\u00d75 table there are 15 squares with side one, 8 squares with side two and 3 squares with side three. The total number of distinct squares in a 3\u00d75 table is 15+8+3=26.","input_specification":"The first line of the input contains a single integer x (1\u2264x\u226410^18)\u00a0\u2014 the number of squares inside the tables Spongebob is interested in.\n","output_specification":"First print a single integer k\u00a0\u2014 the number of tables with exactly x distinct squares inside.\nThen print k pairs of integers describing the tables. Print the pairs in the order of increasing n, and in case of equality\u00a0\u2014 in the order of increasing m.\n","notes":"In a 1\u00d72 table there are 2 1\u00d71 squares. So, 2 distinct squares in total.\n \nIn a 2\u00d73 table there are 6 1\u00d71 squares and 2 2\u00d72 squares. That is equal to 8 squares in total.\n \n","sample_inputs":["26\n","2\n","8\n"],"sample_outputs":["6\n1 26\n2 9\n3 5\n5 3\n9 2\n26 1\n","2\n1 2\n2 1\n","4\n1 8\n2 3\n3 2\n8 1\n"],"human_solution":"x = int(input())\r\n\r\nans = []\r\n\r\ndef calc(n, m):\r\n return n * n * m - (n + m) * (n - 1) * n \/\/ 2 + n * (n - 1) * (2 * n - 1) \/\/ 6\r\n\r\n\r\nfor n in range(1, 2000000):\r\n m = (x + n * n * (n - 1) \/\/ 2 - n * (n - 1) * (2 * n - 1) \/\/ 6) \/\/ (n * n - n * (n - 1) \/\/ 2)\r\n if n <= m and calc(n, m) == x:\r\n ans.append((n, m))\r\n if n != m:\r\n ans.append((m, n))\r\nans.sort()\r\nprint(len(ans))\r\nfor el in ans:\r\n print(el[0], el[1])\r\n\r\n","testcases":"[{'input': ['26\\r\\n'], 'output': ['6\\r\\n1 26\\r\\n2 9\\r\\n3 5\\r\\n5 3\\r\\n9 2\\r\\n26 1\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['2\\r\\n1 2\\r\\n2 1\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['4\\r\\n1 8\\r\\n2 3\\r\\n3 2\\r\\n8 1\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['1\\r\\n1 1\\r\\n']}, {'input': ['5005\\r\\n'], 'output': ['12\\r\\n1 5005\\r\\n5 335\\r\\n6 240\\r\\n10 94\\r\\n13 59\\r\\n14 52\\r\\n52 14\\r\\n59 13\\r\\n94 10\\r\\n240 6\\r\\n335 5\\r\\n5005 1\\r\\n']}, {'input': ['17284\\r\\n'], 'output': ['2\\r\\n1 17284\\r\\n17284 1\\r\\n']}, {'input': ['151618\\r\\n'], 'output': ['2\\r\\n1 151618\\r\\n151618 1\\r\\n']}, {'input': ['360700\\r\\n'], 'output': ['8\\r\\n1 360700\\r\\n4 36071\\r\\n5 24048\\r\\n24 1210\\r\\n1210 24\\r\\n24048 5\\r\\n36071 4\\r\\n360700 1\\r\\n']}, {'input': ['500500500\\r\\n'], 'output': ['8\\r\\n1 500500500\\r\\n4 50050051\\r\\n8 13902794\\r\\n9 11122236\\r\\n11122236 9\\r\\n13902794 8\\r\\n50050051 4\\r\\n500500500 1\\r\\n']}, {'input': ['200200\\r\\n'], 'output': ['26\\r\\n1 200200\\r\\n4 20021\\r\\n5 13348\\r\\n6 9535\\r\\n7 7152\\r\\n10 3643\\r\\n13 2204\\r\\n14 1911\\r\\n15 1673\\r\\n24 675\\r\\n25 624\\r\\n55 148\\r\\n77 92\\r\\n92 77\\r\\n148 55\\r\\n624 25\\r\\n675 24\\r\\n1673 15\\r\\n1911 14\\r\\n2204 13\\r\\n3643 10\\r\\n7152 7\\r\\n9535 6\\r\\n13348 5\\r\\n20021 4\\r\\n200200 1\\r\\n']}, {'input': ['800800\\r\\n'], 'output': ['32\\r\\n1 800800\\r\\n4 80081\\r\\n5 53388\\r\\n6 38135\\r\\n7 28602\\r\\n10 14563\\r\\n13 8804\\r\\n14 7631\\r\\n15 6678\\r\\n24 2677\\r\\n25 2472\\r\\n32 1527\\r\\n55 538\\r\\n64 406\\r\\n77 292\\r\\n104 181\\r\\n181 104\\r\\n292 77\\r\\n406 64\\r\\n538 55\\r\\n1527 32\\r\\n2472 25\\r\\n2677 24\\r\\n6678 15\\r\\n7631 14\\r\\n8804 13\\r\\n14563 10\\r\\n28602 7\\r\\n38135 6\\r\\n53388 5\\r\\n80081 4\\r\\n800800 1\\r\\n']}, {'input': ['200000800200\\r\\n'], 'output': ['4\\r\\n1 200000800200\\r\\n4 20000080021\\r\\n20000080021 4\\r\\n200000800200 1\\r\\n']}, {'input': ['999999999999999999\\r\\n'], 'output': ['6\\r\\n1 999999999999999999\\r\\n13 10989010989010993\\r\\n37 1422475106685645\\r\\n1422475106685645 37\\r\\n10989010989010993 13\\r\\n999999999999999999 1\\r\\n']}, {'input': ['128593726482159\\r\\n'], 'output': ['2\\r\\n1 128593726482159\\r\\n128593726482159 1\\r\\n']}, {'input': ['50044422\\r\\n'], 'output': ['2\\r\\n1 50044422\\r\\n50044422 1\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['2\\r\\n1 18\\r\\n18 1\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['3\\r\\n1 30\\r\\n4 4\\r\\n30 1\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['6\\r\\n1 20\\r\\n2 7\\r\\n3 4\\r\\n4 3\\r\\n7 2\\r\\n20 1\\r\\n']}, {'input': ['649708734844\\r\\n'], 'output': ['2\\r\\n1 649708734844\\r\\n649708734844 1\\r\\n']}, {'input': ['649030984\\r\\n'], 'output': ['8\\r\\n1 649030984\\r\\n6 30906239\\r\\n7 23179680\\r\\n41 753824\\r\\n753824 41\\r\\n23179680 7\\r\\n30906239 6\\r\\n649030984 1\\r\\n']}, {'input': ['333333333\\r\\n'], 'output': ['2\\r\\n1 333333333\\r\\n333333333 1\\r\\n']}, {'input': ['5050505060\\r\\n'], 'output': ['8\\r\\n1 5050505060\\r\\n2 1683501687\\r\\n3 841750844\\r\\n4 505050507\\r\\n505050507 4\\r\\n841750844 3\\r\\n1683501687 2\\r\\n5050505060 1\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['10\\r\\n1 1000000000000000000\\r\\n4 100000000000000001\\r\\n5 66666666666666668\\r\\n15 8333333333333338\\r\\n24 3333333333333341\\r\\n3333333333333341 24\\r\\n8333333333333338 15\\r\\n66666666666666668 5\\r\\n100000000000000001 4\\r\\n1000000000000000000 1\\r\\n']}, {'input': ['18270000000000\\r\\n'], 'output': ['10\\r\\n1 18270000000000\\r\\n4 1827000000001\\r\\n7 652500000002\\r\\n27 48333333342\\r\\n28 45000000009\\r\\n45000000009 28\\r\\n48333333342 27\\r\\n652500000002 7\\r\\n1827000000001 4\\r\\n18270000000000 1\\r\\n']}, {'input': ['10102030405090000\\r\\n'], 'output': ['16\\r\\n1 10102030405090000\\r\\n4 1010203040509001\\r\\n5 673468693672668\\r\\n15 84183586709088\\r\\n24 33673434683641\\r\\n25 31083170477208\\r\\n40 12319549274513\\r\\n499 80978199806\\r\\n80978199806 499\\r\\n12319549274513 40\\r\\n31083170477208 25\\r\\n33673434683641 24\\r\\n84183586709088 15\\r\\n673468693672668 5\\r\\n1010203040509001 4\\r\\n10102030405090000 1\\r\\n']}, {'input': ['50004000222222228\\r\\n'], 'output': ['10\\r\\n1 50004000222222228\\r\\n7 1785857150793653\\r\\n8 1389000006172842\\r\\n13 549494507936512\\r\\n117 7243807072648\\r\\n7243807072648 117\\r\\n549494507936512 13\\r\\n1389000006172842 8\\r\\n1785857150793653 7\\r\\n50004000222222228 1\\r\\n']}, {'input': ['9000004000200000\\r\\n'], 'output': ['8\\r\\n1 9000004000200000\\r\\n4 900000400020001\\r\\n8 250000111116669\\r\\n9 200000088893336\\r\\n200000088893336 9\\r\\n250000111116669 8\\r\\n900000400020001 4\\r\\n9000004000200000 1\\r\\n']}, {'input': ['147456000000000\\r\\n'], 'output': ['4\\r\\n1 147456000000000\\r\\n4 14745600000001\\r\\n14745600000001 4\\r\\n147456000000000 1\\r\\n']}, {'input': ['80000010000020000\\r\\n'], 'output': ['12\\r\\n1 80000010000020000\\r\\n2 26666670000006667\\r\\n3 13333335000003334\\r\\n4 8000001000002001\\r\\n10 1454545636364003\\r\\n11 1212121363636670\\r\\n1212121363636670 11\\r\\n1454545636364003 10\\r\\n8000001000002001 4\\r\\n13333335000003334 3\\r\\n26666670000006667 2\\r\\n80000010000020000 1\\r\\n']}, {'input': ['8888\\r\\n'], 'output': ['8\\r\\n1 8888\\r\\n2 2963\\r\\n3 1482\\r\\n11 138\\r\\n138 11\\r\\n1482 3\\r\\n2963 2\\r\\n8888 1\\r\\n']}, {'input': ['22003000000000000\\r\\n'], 'output': ['10\\r\\n1 22003000000000000\\r\\n4 2200300000000001\\r\\n5 1466866666666668\\r\\n15 183358333333338\\r\\n24 73343333333341\\r\\n73343333333341 24\\r\\n183358333333338 15\\r\\n1466866666666668 5\\r\\n2200300000000001 4\\r\\n22003000000000000 1\\r\\n']}, {'input': ['40040\\r\\n'], 'output': ['24\\r\\n1 40040\\r\\n2 13347\\r\\n3 6674\\r\\n4 4005\\r\\n7 1432\\r\\n10 731\\r\\n11 610\\r\\n12 517\\r\\n13 444\\r\\n20 197\\r\\n21 180\\r\\n39 64\\r\\n64 39\\r\\n180 21\\r\\n197 20\\r\\n444 13\\r\\n517 12\\r\\n610 11\\r\\n731 10\\r\\n1432 7\\r\\n4005 4\\r\\n6674 3\\r\\n13347 2\\r\\n40040 1\\r\\n']}, {'input': ['1000000400\\r\\n'], 'output': ['20\\r\\n1 1000000400\\r\\n2 333333467\\r\\n3 166666734\\r\\n4 100000041\\r\\n7 35714302\\r\\n19 5263166\\r\\n20 4761913\\r\\n56 626585\\r\\n75 350902\\r\\n399 12664\\r\\n12664 399\\r\\n350902 75\\r\\n626585 56\\r\\n4761913 20\\r\\n5263166 19\\r\\n35714302 7\\r\\n100000041 4\\r\\n166666734 3\\r\\n333333467 2\\r\\n1000000400 1\\r\\n']}, {'input': ['5000004100\\r\\n'], 'output': ['30\\r\\n1 5000004100\\r\\n4 500000411\\r\\n5 333333608\\r\\n6 238095435\\r\\n7 178571577\\r\\n13 54945104\\r\\n14 47619091\\r\\n24 16666688\\r\\n25 15384636\\r\\n49 4081652\\r\\n52 3628467\\r\\n104 915786\\r\\n105 898508\\r\\n195 261708\\r\\n636 24895\\r\\n24895 636\\r\\n261708 195\\r\\n898508 105\\r\\n915786 104\\r\\n3628467 52\\r\\n4081652 49\\r\\n15384636 25\\r\\n16666688 24\\r\\n47619091 14\\r\\n54945104 13\\r\\n178571577 7\\r\\n238095435 6\\r\\n333333608 5\\r\\n500000411 4\\r\\n5000004100 1\\r\\n']}, {'input': ['90006000426440\\r\\n'], 'output': ['30\\r\\n1 90006000426440\\r\\n2 30002000142147\\r\\n3 15001000071074\\r\\n4 9000600042645\\r\\n7 3214500015232\\r\\n16 661808826670\\r\\n20 428600002037\\r\\n34 151270588963\\r\\n48 76535714664\\r\\n84 25211764853\\r\\n111 14479729835\\r\\n119 12605882452\\r\\n147 8274131362\\r\\n628 455712949\\r\\n784 292493438\\r\\n292493438 784\\r\\n455712949 628\\r\\n8274131362 147\\r\\n12605882452 119\\r\\n14479729835 111\\r\\n25211764853 84\\r\\n76535714664 48\\r\\n151270588963 34\\r\\n428600002037 20\\r\\n661808826670 16\\r\\n3214500015232 7\\r\\n9000600042645 4\\r\\n15001000071074 3\\r\\n30002000142147 2\\r\\n90006000426440 1\\r\\n']}, {'input': ['6466460\\r\\n'], 'output': ['46\\r\\n1 6466460\\r\\n2 2155487\\r\\n3 1077744\\r\\n4 646647\\r\\n7 230947\\r\\n10 117575\\r\\n11 97980\\r\\n12 82907\\r\\n13 71064\\r\\n19 34040\\r\\n20 30799\\r\\n21 28000\\r\\n34 10879\\r\\n38 8739\\r\\n39 8303\\r\\n55 4217\\r\\n56 4070\\r\\n65 3036\\r\\n76 2235\\r\\n84 1839\\r\\n119 945\\r\\n209 364\\r\\n220 339\\r\\n339 220\\r\\n364 209\\r\\n945 119\\r\\n1839 84\\r\\n2235 76\\r\\n3036 65\\r\\n4070 56\\r\\n4217 55\\r\\n8303 39\\r\\n8739 38\\r\\n10879 34\\r\\n28000 21\\r\\n30799 20\\r\\n34040 19\\r\\n71064 13\\r\\n82907 12\\r\\n97980 11\\r\\n117575 10\\r\\n230947 7\\r\\n646647 4\\r\\n1077744 3\\r\\n2155487 2\\r\\n6466460 1\\r\\n']}, {'input': ['30009980\\r\\n'], 'output': ['28\\r\\n1 30009980\\r\\n2 10003327\\r\\n3 5001664\\r\\n4 3000999\\r\\n7 1071787\\r\\n10 545639\\r\\n11 454700\\r\\n12 384747\\r\\n13 329784\\r\\n20 142911\\r\\n21 129920\\r\\n39 38487\\r\\n55 19505\\r\\n65 14012\\r\\n14012 65\\r\\n19505 55\\r\\n38487 39\\r\\n129920 21\\r\\n142911 20\\r\\n329784 13\\r\\n384747 12\\r\\n454700 11\\r\\n545639 10\\r\\n1071787 7\\r\\n3000999 4\\r\\n5001664 3\\r\\n10003327 2\\r\\n30009980 1\\r\\n']}, {'input': ['800008300\\r\\n'], 'output': ['28\\r\\n1 800008300\\r\\n4 80000831\\r\\n5 53333888\\r\\n6 38095635\\r\\n7 28571727\\r\\n13 8791304\\r\\n14 7619131\\r\\n19 4210576\\r\\n24 2666702\\r\\n25 2461572\\r\\n49 653084\\r\\n104 146556\\r\\n195 41928\\r\\n455 7863\\r\\n7863 455\\r\\n41928 195\\r\\n146556 104\\r\\n653084 49\\r\\n2461572 25\\r\\n2666702 24\\r\\n4210576 19\\r\\n7619131 14\\r\\n8791304 13\\r\\n28571727 7\\r\\n38095635 6\\r\\n53333888 5\\r\\n80000831 4\\r\\n800008300 1\\r\\n']}, {'input': ['808007200\\r\\n'], 'output': ['34\\r\\n1 808007200\\r\\n4 80800721\\r\\n5 53867148\\r\\n6 38476535\\r\\n7 28857402\\r\\n10 14691043\\r\\n13 8879204\\r\\n14 7695311\\r\\n15 6733398\\r\\n24 2693365\\r\\n25 2486184\\r\\n32 1530327\\r\\n55 524698\\r\\n64 388486\\r\\n77 269092\\r\\n104 148021\\r\\n175 52526\\r\\n52526 175\\r\\n148021 104\\r\\n269092 77\\r\\n388486 64\\r\\n524698 55\\r\\n1530327 32\\r\\n2486184 25\\r\\n2693365 24\\r\\n6733398 15\\r\\n7695311 14\\r\\n8879204 13\\r\\n14691043 10\\r\\n28857402 7\\r\\n38476535 6\\r\\n53867148 5\\r\\n80800721 4\\r\\n808007200 1\\r\\n']}, {'input': ['900601520\\r\\n'], 'output': ['34\\r\\n1 900601520\\r\\n2 300200507\\r\\n3 150100254\\r\\n4 90060153\\r\\n7 32164342\\r\\n12 11546177\\r\\n13 9896724\\r\\n16 6622075\\r\\n19 4740014\\r\\n20 4288585\\r\\n34 1513627\\r\\n38 1215399\\r\\n39 1154630\\r\\n56 564305\\r\\n84 252297\\r\\n119 126174\\r\\n272 24347\\r\\n24347 272\\r\\n126174 119\\r\\n252297 84\\r\\n564305 56\\r\\n1154630 39\\r\\n1215399 38\\r\\n1513627 34\\r\\n4288585 20\\r\\n4740014 19\\r\\n6622075 16\\r\\n9896724 13\\r\\n11546177 12\\r\\n32164342 7\\r\\n90060153 4\\r\\n150100254 3\\r\\n300200507 2\\r\\n900601520 1\\r\\n']}, {'input': ['500600123456789\\r\\n'], 'output': ['4\\r\\n1 500600123456789\\r\\n2 166866707818930\\r\\n166866707818930 2\\r\\n500600123456789 1\\r\\n']}, {'input': ['4729310003500000\\r\\n'], 'output': ['10\\r\\n1 4729310003500000\\r\\n4 472931000350001\\r\\n5 315287333566668\\r\\n15 39410916695838\\r\\n24 15764366678341\\r\\n15764366678341 24\\r\\n39410916695838 15\\r\\n315287333566668 5\\r\\n472931000350001 4\\r\\n4729310003500000 1\\r\\n']}, {'input': ['590084357100000000\\r\\n'], 'output': ['20\\r\\n1 590084357100000000\\r\\n4 59008435710000001\\r\\n7 21074441325000002\\r\\n8 16391232141666669\\r\\n9 13112985713333336\\r\\n35 936641836666678\\r\\n49 481701516000016\\r\\n63 292700573958354\\r\\n224 23416045916741\\r\\n39374 761239791\\r\\n761239791 39374\\r\\n23416045916741 224\\r\\n292700573958354 63\\r\\n481701516000016 49\\r\\n936641836666678 35\\r\\n13112985713333336 9\\r\\n16391232141666669 8\\r\\n21074441325000002 7\\r\\n59008435710000001 4\\r\\n590084357100000000 1\\r\\n']}, {'input': ['2937500926541895\\r\\n'], 'output': ['2\\r\\n1 2937500926541895\\r\\n2937500926541895 1\\r\\n']}, {'input': ['400000089000000000\\r\\n'], 'output': ['10\\r\\n1 400000089000000000\\r\\n4 40000008900000001\\r\\n16 2941177125000005\\r\\n17 2614379666666672\\r\\n127 49212609375042\\r\\n49212609375042 127\\r\\n2614379666666672 17\\r\\n2941177125000005 16\\r\\n40000008900000001 4\\r\\n400000089000000000 1\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['3\\r\\n1 5\\r\\n2 2\\r\\n5 1\\r\\n']}, {'input': ['200800200\\r\\n'], 'output': ['4\\r\\n1 200800200\\r\\n4 20080021\\r\\n20080021 4\\r\\n200800200 1\\r\\n']}, {'input': ['999999853754584125\\r\\n'], 'output': ['5\\r\\n1 999999853754584125\\r\\n45 966183433579323\\r\\n1442249 1442249\\r\\n966183433579323 45\\r\\n999999853754584125 1\\r\\n']}, {'input': ['114335783345000\\r\\n'], 'output': ['13\\r\\n1 114335783345000\\r\\n2 38111927781667\\r\\n3 19055963890834\\r\\n4 11433578334501\\r\\n7 4083420833752\\r\\n20 544456111173\\r\\n70000 70000\\r\\n544456111173 20\\r\\n4083420833752 7\\r\\n11433578334501 4\\r\\n19055963890834 3\\r\\n38111927781667 2\\r\\n114335783345000 1\\r\\n']}, {'input': ['333343833443500385\\r\\n'], 'output': ['7\\r\\n1 333343833443500385\\r\\n2 111114611147833462\\r\\n10 6060796971700010\\r\\n1000010 1000010\\r\\n6060796971700010 10\\r\\n111114611147833462 2\\r\\n333343833443500385 1\\r\\n']}, {'input': ['333336333342000008\\r\\n'], 'output': ['8\\r\\n1 333336333342000008\\r\\n2 111112111114000003\\r\\n3 55556055557000002\\r\\n1000002 1000003\\r\\n1000003 1000002\\r\\n55556055557000002 3\\r\\n111112111114000003 2\\r\\n333336333342000008 1\\r\\n']}, {'input': ['41679167500\\r\\n'], 'output': ['11\\r\\n1 41679167500\\r\\n4 4167916751\\r\\n5 2778611168\\r\\n24 138930566\\r\\n1095 69823\\r\\n5000 5000\\r\\n69823 1095\\r\\n138930566 24\\r\\n2778611168 5\\r\\n4167916751 4\\r\\n41679167500 1\\r\\n']}, {'input': ['333357833933504900\\r\\n'], 'output': ['15\\r\\n1 333357833933504900\\r\\n2 111119277977834967\\r\\n3 55559638988917484\\r\\n4 33335783393350491\\r\\n12 4273818383762887\\r\\n25 1025716412103100\\r\\n39 427381838376301\\r\\n1000024 1000024\\r\\n427381838376301 39\\r\\n1025716412103100 25\\r\\n4273818383762887 12\\r\\n33335783393350491 4\\r\\n55559638988917484 3\\r\\n111119277977834967 2\\r\\n333357833933504900 1\\r\\n']}, {'input': ['2666686666700000\\r\\n'], 'output': ['13\\r\\n1 2666686666700000\\r\\n2 888895555566667\\r\\n3 444447777783334\\r\\n4 266668666670001\\r\\n7 95238809525002\\r\\n20 12698507936673\\r\\n200000 200000\\r\\n12698507936673 20\\r\\n95238809525002 7\\r\\n266668666670001 4\\r\\n444447777783334 3\\r\\n888895555566667 2\\r\\n2666686666700000 1\\r\\n']}, {'input': ['334344854787443885\\r\\n'], 'output': ['15\\r\\n1 334344854787443885\\r\\n2 111448284929147962\\r\\n10 6078997359771710\\r\\n21 1447380323755175\\r\\n34 561924125693194\\r\\n101 64908727390335\\r\\n15554 2763842842\\r\\n1001010 1001010\\r\\n2763842842 15554\\r\\n64908727390335 101\\r\\n561924125693194 34\\r\\n1447380323755175 21\\r\\n6078997359771710 10\\r\\n111448284929147962 2\\r\\n334344854787443885 1\\r\\n']}, {'input': ['979139840681508275\\r\\n'], 'output': ['19\\r\\n1 979139840681508275\\r\\n2 326379946893836092\\r\\n10 17802542557845608\\r\\n21 4238700609010865\\r\\n29 2250896185474741\\r\\n109 163326078512381\\r\\n145 92502582964763\\r\\n174 64311319585050\\r\\n218 41017964923264\\r\\n1432150 1432150\\r\\n41017964923264 218\\r\\n64311319585050 174\\r\\n92502582964763 145\\r\\n163326078512381 109\\r\\n2250896185474741 29\\r\\n4238700609010865 21\\r\\n17802542557845608 10\\r\\n326379946893836092 2\\r\\n979139840681508275 1\\r\\n']}, {'input': ['914669606669700001\\r\\n'], 'output': ['3\\r\\n1 914669606669700001\\r\\n1400001 1400001\\r\\n914669606669700001 1\\r\\n']}, {'input': ['333334833335500001\\r\\n'], 'output': ['5\\r\\n1 333334833335500001\\r\\n2 111111611111833334\\r\\n1000001 1000001\\r\\n111111611111833334 2\\r\\n333334833335500001 1\\r\\n']}, {'input': ['732334178333550000\\r\\n'], 'output': ['11\\r\\n1 732334178333550000\\r\\n4 73233417833355001\\r\\n25 2253335933334008\\r\\n31 1476480198253135\\r\\n124 94494732688241\\r\\n1300000 1300000\\r\\n94494732688241 124\\r\\n1476480198253135 31\\r\\n2253335933334008 25\\r\\n73233417833355001 4\\r\\n732334178333550000 1\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['5\\r\\n1 14\\r\\n2 5\\r\\n3 3\\r\\n5 2\\r\\n14 1\\r\\n']}, {'input': ['576000720000200000\\r\\n'], 'output': ['21\\r\\n1 576000720000200000\\r\\n2 192000240000066667\\r\\n3 96000120000033334\\r\\n4 57600072000020001\\r\\n10 10472740363640003\\r\\n11 8727283636366670\\r\\n43 608880253700014\\r\\n128 69767529069834\\r\\n472 5160002150157\\r\\n1375 608880254158\\r\\n1200000 1200000\\r\\n608880254158 1375\\r\\n5160002150157 472\\r\\n69767529069834 128\\r\\n608880253700014 43\\r\\n8727283636366670 11\\r\\n10472740363640003 10\\r\\n57600072000020001 4\\r\\n96000120000033334 3\\r\\n192000240000066667 2\\r\\n576000720000200000 1\\r\\n']}, {'input': ['3456346346334634\\r\\n'], 'output': ['2\\r\\n1 3456346346334634\\r\\n3456346346334634 1\\r\\n']}]","id":165} {"difficulty":1900,"lang":"Python 3","lang_cluster":"Python","src_uid":"6214a85d2be0a908dcbfe089327cf51a","execute_outcome":"RUNTIME_ERROR","source_code":"n, m, k = [int(x) for x in input().split()]\ncanwin = False\nfor i in range(k):\n x, y = [int(x) for x in input().split()]\n canwin |= x < 8 or n - x < 7\n canwin |= y < 8 or m - y < 7\nprint(\"YES\" if canwin else \"NO\")\n","description":"Volodya and Vlad play the following game. There are k pies at the cells of n\u2009\u2009\u00d7\u2009\u2009m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at the border of the board of length 1 (between two knots of the board) so that Volodya is not able to move the pie outside the board through this edge anymore. The question is: will Volodya win this game? We suppose both players follow the optimal strategy.","input_specification":"First line contains 3 integers, separated by space: 1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100 \u2014 dimensions of the board and 0\u2009\u2264\u2009k\u2009\u2264\u2009100 \u2014 the number of pies. Each of the next k lines contains 2 integers, separated by space: 1\u2009\u2264\u2009x\u2009\u2264\u2009n, 1\u2009\u2264\u2009y\u2009\u2264\u2009m \u2014 coordinates of the corresponding pie. There could be more than one pie at a cell. ","output_specification":"Output only one word: \"YES\" \u2014 if Volodya wins, \"NO\" \u2014 otherwise.","notes":null,"sample_inputs":["2 2 1\n1 2","3 4 0","100 50 2\n50 25\n50 25"],"sample_outputs":["YES","NO","NO"],"human_solution":"n, m, k = map(int, input().split())\nwin = False\nfor i in range(k):\n x, y = map(int, input().split())\n if abs(x - 1) <= 4 or abs(y - 1) <= 4 or \\\n abs(n - x) <= 4 or abs(m - y) <= 4:\n win = True\n\nprint('YES' if win else 'NO')\n","testcases":"[{'input': '2 2 1\\r\\n1 2\\r\\n', 'output': ['YES']}, {'input': '3 4 0\\r\\n', 'output': ['NO']}, {'input': '100 50 2\\r\\n50 25\\r\\n50 25\\r\\n', 'output': ['NO']}, {'input': '20 20 4\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n', 'output': ['NO']}, {'input': '15 15 1\\r\\n8 8\\r\\n', 'output': ['NO']}, {'input': '8 8 2\\r\\n4 4\\r\\n5 5\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 96\\r\\n51 96\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 95\\r\\n51 95\\r\\n', 'output': ['NO']}, {'input': '20 20 1\\r\\n16 10\\r\\n', 'output': ['YES']}, {'input': '20 20 4\\r\\n15 9\\r\\n15 10\\r\\n15 11\\r\\n15 12\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 6\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 5\\r\\n', 'output': ['YES']}, {'input': '35 13 20\\r\\n13 8\\r\\n19 8\\r\\n24 7\\r\\n20 6\\r\\n23 7\\r\\n23 6\\r\\n30 7\\r\\n29 7\\r\\n7 7\\r\\n6 8\\r\\n9 8\\r\\n29 6\\r\\n20 7\\r\\n25 6\\r\\n19 6\\r\\n23 8\\r\\n26 6\\r\\n12 6\\r\\n15 7\\r\\n6 8\\r\\n', 'output': ['NO']}, {'input': '50 17 27\\r\\n17 8\\r\\n19 6\\r\\n25 8\\r\\n30 10\\r\\n22 10\\r\\n30 9\\r\\n25 8\\r\\n27 6\\r\\n19 7\\r\\n29 11\\r\\n39 8\\r\\n31 8\\r\\n39 8\\r\\n40 7\\r\\n11 8\\r\\n30 11\\r\\n32 8\\r\\n31 11\\r\\n36 12\\r\\n10 11\\r\\n32 8\\r\\n8 7\\r\\n7 12\\r\\n17 11\\r\\n27 7\\r\\n8 8\\r\\n23 12\\r\\n', 'output': ['NO']}, {'input': '24 29 22\\r\\n16 6\\r\\n14 22\\r\\n7 15\\r\\n11 17\\r\\n12 22\\r\\n10 13\\r\\n12 22\\r\\n12 13\\r\\n6 16\\r\\n12 21\\r\\n11 11\\r\\n9 13\\r\\n18 22\\r\\n7 20\\r\\n13 6\\r\\n6 14\\r\\n17 10\\r\\n9 13\\r\\n7 23\\r\\n14 11\\r\\n7 22\\r\\n8 12\\r\\n', 'output': ['NO']}, {'input': '32 45 3\\r\\n12 30\\r\\n27 9\\r\\n14 27\\r\\n', 'output': ['NO']}, {'input': '35 15 63\\r\\n6 6\\r\\n14 9\\r\\n7 6\\r\\n25 6\\r\\n25 8\\r\\n13 9\\r\\n18 7\\r\\n20 8\\r\\n30 10\\r\\n25 10\\r\\n7 7\\r\\n18 8\\r\\n11 10\\r\\n12 6\\r\\n8 8\\r\\n6 9\\r\\n21 9\\r\\n27 10\\r\\n28 8\\r\\n28 9\\r\\n7 9\\r\\n28 9\\r\\n10 10\\r\\n29 10\\r\\n25 8\\r\\n28 7\\r\\n22 6\\r\\n13 9\\r\\n14 7\\r\\n23 9\\r\\n20 8\\r\\n28 10\\r\\n22 7\\r\\n12 8\\r\\n13 7\\r\\n27 9\\r\\n17 8\\r\\n10 8\\r\\n19 10\\r\\n6 10\\r\\n26 6\\r\\n19 8\\r\\n28 9\\r\\n15 9\\r\\n14 7\\r\\n25 10\\r\\n17 8\\r\\n21 8\\r\\n29 6\\r\\n7 6\\r\\n16 10\\r\\n7 10\\r\\n25 7\\r\\n9 9\\r\\n30 9\\r\\n23 8\\r\\n28 8\\r\\n7 10\\r\\n12 6\\r\\n20 9\\r\\n24 8\\r\\n6 6\\r\\n26 7\\r\\n', 'output': ['NO']}, {'input': '41 50 37\\r\\n21 24\\r\\n20 32\\r\\n10 12\\r\\n35 7\\r\\n8 19\\r\\n30 22\\r\\n21 11\\r\\n35 12\\r\\n7 8\\r\\n16 10\\r\\n13 39\\r\\n6 43\\r\\n31 12\\r\\n16 14\\r\\n25 32\\r\\n27 21\\r\\n6 34\\r\\n22 26\\r\\n7 41\\r\\n18 13\\r\\n24 19\\r\\n9 44\\r\\n36 21\\r\\n17 16\\r\\n36 24\\r\\n6 31\\r\\n19 20\\r\\n12 19\\r\\n27 36\\r\\n6 31\\r\\n11 13\\r\\n19 9\\r\\n20 12\\r\\n25 25\\r\\n18 27\\r\\n17 36\\r\\n8 16\\r\\n', 'output': ['NO']}, {'input': '96 95 31\\r\\n14 23\\r\\n70 47\\r\\n11 77\\r\\n53 66\\r\\n63 87\\r\\n3 14\\r\\n57 44\\r\\n65 69\\r\\n80 74\\r\\n49 6\\r\\n57 86\\r\\n75 8\\r\\n2 32\\r\\n75 21\\r\\n14 51\\r\\n56 46\\r\\n77 6\\r\\n17 89\\r\\n87 3\\r\\n21 18\\r\\n70 67\\r\\n47 64\\r\\n13 47\\r\\n61 33\\r\\n56 30\\r\\n28 2\\r\\n65 18\\r\\n17 90\\r\\n44 77\\r\\n54 26\\r\\n32 70\\r\\n', 'output': ['YES']}, {'input': '80 51 47\\r\\n67 41\\r\\n74 7\\r\\n68 41\\r\\n6 2\\r\\n19 38\\r\\n37 28\\r\\n65 4\\r\\n6 25\\r\\n39 11\\r\\n19 34\\r\\n47 36\\r\\n62 26\\r\\n27 44\\r\\n70 45\\r\\n24 33\\r\\n41 2\\r\\n13 10\\r\\n3 17\\r\\n78 35\\r\\n53 46\\r\\n62 47\\r\\n33 17\\r\\n17 49\\r\\n2 3\\r\\n47 38\\r\\n72 35\\r\\n4 8\\r\\n32 21\\r\\n52 43\\r\\n67 12\\r\\n28 22\\r\\n53 34\\r\\n36 11\\r\\n45 45\\r\\n32 12\\r\\n5 11\\r\\n6 3\\r\\n55 21\\r\\n73 4\\r\\n55 21\\r\\n36 13\\r\\n48 18\\r\\n19 8\\r\\n70 24\\r\\n43 45\\r\\n59 50\\r\\n58 7\\r\\n', 'output': ['YES']}, {'input': '25 92 38\\r\\n21 36\\r\\n20 18\\r\\n9 29\\r\\n18 77\\r\\n10 58\\r\\n10 39\\r\\n5 3\\r\\n21 51\\r\\n11 78\\r\\n16 32\\r\\n24 71\\r\\n15 17\\r\\n23 23\\r\\n25 59\\r\\n18 57\\r\\n11 2\\r\\n16 35\\r\\n1 47\\r\\n20 59\\r\\n19 54\\r\\n11 55\\r\\n4 33\\r\\n15 41\\r\\n17 18\\r\\n16 67\\r\\n4 15\\r\\n5 23\\r\\n3 24\\r\\n20 70\\r\\n5 87\\r\\n11 1\\r\\n23 66\\r\\n21 83\\r\\n2 32\\r\\n17 22\\r\\n2 26\\r\\n16 42\\r\\n24 15\\r\\n', 'output': ['YES']}, {'input': '67 41 68\\r\\n35 16\\r\\n66 14\\r\\n1 15\\r\\n43 6\\r\\n26 17\\r\\n30 13\\r\\n42 11\\r\\n32 20\\r\\n66 14\\r\\n15 35\\r\\n35 6\\r\\n12 11\\r\\n25 9\\r\\n39 37\\r\\n31 14\\r\\n52 11\\r\\n4 32\\r\\n17 14\\r\\n32 1\\r\\n58 31\\r\\n30 20\\r\\n7 23\\r\\n13 3\\r\\n27 25\\r\\n60 27\\r\\n56 39\\r\\n60 39\\r\\n11 5\\r\\n33 14\\r\\n29 12\\r\\n13 34\\r\\n30 16\\r\\n25 16\\r\\n64 25\\r\\n47 6\\r\\n33 36\\r\\n14 40\\r\\n19 38\\r\\n57 34\\r\\n67 8\\r\\n10 13\\r\\n7 36\\r\\n22 24\\r\\n6 33\\r\\n23 40\\r\\n13 19\\r\\n65 6\\r\\n14 37\\r\\n37 21\\r\\n27 12\\r\\n41 36\\r\\n60 15\\r\\n27 11\\r\\n23 33\\r\\n67 40\\r\\n45 39\\r\\n1 41\\r\\n50 21\\r\\n28 38\\r\\n20 24\\r\\n41 34\\r\\n43 35\\r\\n51 5\\r\\n59 37\\r\\n27 4\\r\\n28 17\\r\\n63 20\\r\\n1 9\\r\\n', 'output': ['YES']}, {'input': '14 95 49\\r\\n11 48\\r\\n9 12\\r\\n1 18\\r\\n7 54\\r\\n11 20\\r\\n9 82\\r\\n12 1\\r\\n12 84\\r\\n1 13\\r\\n2 13\\r\\n12 57\\r\\n13 15\\r\\n12 18\\r\\n9 47\\r\\n13 14\\r\\n10 14\\r\\n13 94\\r\\n7 46\\r\\n14 14\\r\\n6 46\\r\\n7 95\\r\\n9 29\\r\\n13 15\\r\\n6 76\\r\\n8 60\\r\\n6 27\\r\\n9 63\\r\\n5 39\\r\\n5 70\\r\\n10 59\\r\\n5 75\\r\\n3 19\\r\\n9 32\\r\\n13 59\\r\\n5 13\\r\\n4 5\\r\\n13 80\\r\\n10 62\\r\\n13 65\\r\\n5 25\\r\\n4 81\\r\\n7 12\\r\\n10 94\\r\\n8 55\\r\\n7 61\\r\\n11 58\\r\\n7 77\\r\\n12 14\\r\\n12 47\\r\\n', 'output': ['YES']}, {'input': '15 96 22\\r\\n4 7\\r\\n7 40\\r\\n13 30\\r\\n8 53\\r\\n6 78\\r\\n5 9\\r\\n15 35\\r\\n3 13\\r\\n5 31\\r\\n2 9\\r\\n13 50\\r\\n11 17\\r\\n4 2\\r\\n10 91\\r\\n11 74\\r\\n14 49\\r\\n8 30\\r\\n10 66\\r\\n12 44\\r\\n6 19\\r\\n9 62\\r\\n15 50\\r\\n', 'output': ['YES']}, {'input': '19 19 50\\r\\n11 16\\r\\n4 11\\r\\n5 12\\r\\n19 19\\r\\n7 16\\r\\n15 10\\r\\n8 17\\r\\n8 1\\r\\n11 10\\r\\n5 19\\r\\n5 14\\r\\n17 6\\r\\n12 15\\r\\n18 17\\r\\n17 14\\r\\n10 5\\r\\n15 11\\r\\n8 8\\r\\n5 8\\r\\n18 18\\r\\n7 11\\r\\n8 4\\r\\n11 9\\r\\n6 16\\r\\n1 15\\r\\n19 13\\r\\n5 12\\r\\n10 10\\r\\n4 19\\r\\n12 4\\r\\n8 14\\r\\n19 9\\r\\n7 1\\r\\n19 11\\r\\n15 8\\r\\n4 19\\r\\n19 9\\r\\n6 7\\r\\n15 7\\r\\n2 16\\r\\n12 9\\r\\n3 18\\r\\n17 10\\r\\n3 5\\r\\n11 7\\r\\n12 6\\r\\n4 15\\r\\n19 4\\r\\n17 15\\r\\n3 10\\r\\n', 'output': ['YES']}, {'input': '93 40 43\\r\\n14 15\\r\\n58 9\\r\\n72 15\\r\\n40 40\\r\\n46 20\\r\\n17 26\\r\\n31 26\\r\\n91 36\\r\\n24 28\\r\\n32 27\\r\\n51 10\\r\\n2 35\\r\\n73 7\\r\\n6 33\\r\\n59 21\\r\\n59 39\\r\\n33 8\\r\\n22 21\\r\\n77 20\\r\\n30 38\\r\\n76 35\\r\\n40 6\\r\\n48 31\\r\\n67 29\\r\\n30 24\\r\\n6 16\\r\\n39 27\\r\\n24 29\\r\\n14 16\\r\\n5 25\\r\\n76 14\\r\\n61 25\\r\\n85 13\\r\\n60 9\\r\\n80 7\\r\\n49 19\\r\\n35 20\\r\\n90 31\\r\\n57 40\\r\\n67 27\\r\\n3 27\\r\\n21 16\\r\\n21 38\\r\\n', 'output': ['YES']}, {'input': '70 50 62\\r\\n31 22\\r\\n41 21\\r\\n31 47\\r\\n2 46\\r\\n22 8\\r\\n6 4\\r\\n45 32\\r\\n40 29\\r\\n10 11\\r\\n62 40\\r\\n70 26\\r\\n48 25\\r\\n13 44\\r\\n53 22\\r\\n3 8\\r\\n41 19\\r\\n13 8\\r\\n21 41\\r\\n66 20\\r\\n34 34\\r\\n41 48\\r\\n9 35\\r\\n23 26\\r\\n29 30\\r\\n39 27\\r\\n58 11\\r\\n35 2\\r\\n67 3\\r\\n59 23\\r\\n41 10\\r\\n54 9\\r\\n10 18\\r\\n23 44\\r\\n5 2\\r\\n37 30\\r\\n31 24\\r\\n2 21\\r\\n2 36\\r\\n34 5\\r\\n59 44\\r\\n7 4\\r\\n23 22\\r\\n47 27\\r\\n14 50\\r\\n54 50\\r\\n6 4\\r\\n64 1\\r\\n29 5\\r\\n5 37\\r\\n60 50\\r\\n58 45\\r\\n70 4\\r\\n4 46\\r\\n68 43\\r\\n62 34\\r\\n15 12\\r\\n16 2\\r\\n70 21\\r\\n59 8\\r\\n13 27\\r\\n25 41\\r\\n13 20\\r\\n', 'output': ['YES']}, {'input': '61 96 15\\r\\n27 36\\r\\n19 64\\r\\n27 53\\r\\n59 63\\r\\n48 56\\r\\n55 30\\r\\n10 23\\r\\n6 79\\r\\n32 74\\r\\n7 51\\r\\n29 65\\r\\n60 16\\r\\n43 74\\r\\n40 80\\r\\n14 31\\r\\n', 'output': ['YES']}, {'input': '87 50 62\\r\\n34 31\\r\\n42 21\\r\\n2 23\\r\\n20 25\\r\\n57 39\\r\\n46 26\\r\\n59 46\\r\\n29 33\\r\\n32 35\\r\\n79 41\\r\\n54 19\\r\\n65 7\\r\\n41 6\\r\\n40 23\\r\\n8 41\\r\\n2 31\\r\\n56 5\\r\\n37 33\\r\\n63 23\\r\\n79 4\\r\\n85 27\\r\\n53 38\\r\\n58 21\\r\\n16 11\\r\\n15 46\\r\\n33 39\\r\\n38 6\\r\\n27 41\\r\\n6 15\\r\\n25 47\\r\\n58 16\\r\\n28 50\\r\\n43 38\\r\\n48 20\\r\\n5 48\\r\\n31 6\\r\\n8 18\\r\\n40 10\\r\\n32 29\\r\\n44 20\\r\\n42 46\\r\\n63 21\\r\\n18 10\\r\\n28 49\\r\\n66 26\\r\\n64 28\\r\\n73 23\\r\\n16 29\\r\\n48 12\\r\\n23 21\\r\\n84 14\\r\\n10 45\\r\\n75 37\\r\\n80 3\\r\\n75 24\\r\\n31 25\\r\\n8 42\\r\\n67 22\\r\\n80 45\\r\\n8 31\\r\\n16 28\\r\\n49 34\\r\\n', 'output': ['YES']}, {'input': '23 100 53\\r\\n16 63\\r\\n16 31\\r\\n8 31\\r\\n4 86\\r\\n8 43\\r\\n8 27\\r\\n21 6\\r\\n13 49\\r\\n11 54\\r\\n5 86\\r\\n1 41\\r\\n19 14\\r\\n2 98\\r\\n15 76\\r\\n6 25\\r\\n6 57\\r\\n2 45\\r\\n6 98\\r\\n10 27\\r\\n16 74\\r\\n22 72\\r\\n22 13\\r\\n22 20\\r\\n15 63\\r\\n18 17\\r\\n14 32\\r\\n14 32\\r\\n2 28\\r\\n7 46\\r\\n23 16\\r\\n20 64\\r\\n18 17\\r\\n3 69\\r\\n22 77\\r\\n2 98\\r\\n11 20\\r\\n22 17\\r\\n21 8\\r\\n19 77\\r\\n19 13\\r\\n18 25\\r\\n9 24\\r\\n18 83\\r\\n19 27\\r\\n7 37\\r\\n16 19\\r\\n9 60\\r\\n11 70\\r\\n3 30\\r\\n4 84\\r\\n9 54\\r\\n22 33\\r\\n3 22\\r\\n', 'output': ['YES']}, {'input': '36 89 27\\r\\n21 66\\r\\n3 60\\r\\n11 32\\r\\n10 81\\r\\n30 31\\r\\n27 62\\r\\n11 81\\r\\n24 41\\r\\n30 6\\r\\n13 45\\r\\n34 86\\r\\n26 46\\r\\n9 62\\r\\n8 86\\r\\n17 56\\r\\n4 86\\r\\n25 36\\r\\n23 72\\r\\n18 55\\r\\n18 87\\r\\n22 67\\r\\n18 12\\r\\n19 75\\r\\n21 60\\r\\n16 49\\r\\n33 63\\r\\n26 12\\r\\n', 'output': ['YES']}, {'input': '93 93 50\\r\\n7 5\\r\\n73 91\\r\\n66 55\\r\\n12 24\\r\\n82 46\\r\\n38 49\\r\\n86 72\\r\\n51 69\\r\\n17 73\\r\\n9 85\\r\\n86 69\\r\\n65 2\\r\\n40 88\\r\\n92 26\\r\\n45 80\\r\\n74 45\\r\\n4 55\\r\\n57 93\\r\\n80 70\\r\\n49 69\\r\\n29 46\\r\\n67 38\\r\\n46 12\\r\\n16 87\\r\\n62 3\\r\\n79 62\\r\\n29 45\\r\\n58 30\\r\\n48 4\\r\\n76 73\\r\\n14 68\\r\\n31 8\\r\\n49 85\\r\\n73 78\\r\\n18 7\\r\\n87 56\\r\\n82 54\\r\\n52 73\\r\\n29 71\\r\\n87 74\\r\\n75 84\\r\\n45 28\\r\\n47 57\\r\\n44 53\\r\\n21 5\\r\\n86 5\\r\\n57 51\\r\\n45 9\\r\\n93 8\\r\\n82 43\\r\\n', 'output': ['YES']}, {'input': '11 38 21\\r\\n2 21\\r\\n2 28\\r\\n7 19\\r\\n9 18\\r\\n7 25\\r\\n8 4\\r\\n3 23\\r\\n2 32\\r\\n5 34\\r\\n10 36\\r\\n8 21\\r\\n4 6\\r\\n6 6\\r\\n4 35\\r\\n8 34\\r\\n10 18\\r\\n11 4\\r\\n10 2\\r\\n10 13\\r\\n4 37\\r\\n2 29\\r\\n', 'output': ['YES']}, {'input': '26 11 59\\r\\n13 6\\r\\n18 6\\r\\n12 6\\r\\n18 6\\r\\n21 6\\r\\n19 6\\r\\n12 6\\r\\n7 6\\r\\n6 6\\r\\n16 6\\r\\n7 6\\r\\n9 6\\r\\n19 6\\r\\n19 6\\r\\n15 6\\r\\n16 6\\r\\n16 6\\r\\n18 6\\r\\n17 6\\r\\n8 6\\r\\n13 6\\r\\n18 6\\r\\n11 6\\r\\n21 6\\r\\n9 6\\r\\n19 6\\r\\n20 6\\r\\n8 6\\r\\n20 6\\r\\n14 6\\r\\n11 6\\r\\n18 6\\r\\n7 6\\r\\n16 6\\r\\n19 6\\r\\n6 6\\r\\n6 6\\r\\n7 6\\r\\n13 6\\r\\n9 6\\r\\n16 6\\r\\n9 6\\r\\n15 6\\r\\n12 6\\r\\n17 6\\r\\n16 6\\r\\n9 6\\r\\n11 6\\r\\n10 6\\r\\n16 6\\r\\n14 6\\r\\n15 6\\r\\n7 6\\r\\n20 6\\r\\n7 6\\r\\n8 6\\r\\n17 6\\r\\n14 6\\r\\n14 6\\r\\n', 'output': ['NO']}, {'input': '30 84 35\\r\\n20 60\\r\\n23 21\\r\\n14 24\\r\\n24 72\\r\\n13 76\\r\\n25 35\\r\\n11 64\\r\\n15 57\\r\\n9 55\\r\\n14 66\\r\\n10 24\\r\\n13 68\\r\\n11 8\\r\\n19 43\\r\\n11 14\\r\\n16 26\\r\\n11 22\\r\\n10 26\\r\\n15 66\\r\\n17 65\\r\\n21 34\\r\\n7 61\\r\\n24 64\\r\\n18 16\\r\\n22 18\\r\\n12 9\\r\\n10 40\\r\\n8 24\\r\\n16 52\\r\\n10 9\\r\\n7 17\\r\\n21 78\\r\\n18 75\\r\\n10 45\\r\\n16 29\\r\\n', 'output': ['NO']}, {'input': '100 77 53\\r\\n62 72\\r\\n23 51\\r\\n42 8\\r\\n66 33\\r\\n62 16\\r\\n28 53\\r\\n72 54\\r\\n71 34\\r\\n30 26\\r\\n91 28\\r\\n27 37\\r\\n81 47\\r\\n22 40\\r\\n42 23\\r\\n92 46\\r\\n36 37\\r\\n86 70\\r\\n62 22\\r\\n20 9\\r\\n46 36\\r\\n86 67\\r\\n46 61\\r\\n33 30\\r\\n68 49\\r\\n44 57\\r\\n34 7\\r\\n89 36\\r\\n48 39\\r\\n47 62\\r\\n76 56\\r\\n22 41\\r\\n7 52\\r\\n16 8\\r\\n70 50\\r\\n52 27\\r\\n27 17\\r\\n44 30\\r\\n66 44\\r\\n62 10\\r\\n95 37\\r\\n94 39\\r\\n91 68\\r\\n12 49\\r\\n85 55\\r\\n63 28\\r\\n64 15\\r\\n75 31\\r\\n93 26\\r\\n53 51\\r\\n53 55\\r\\n66 65\\r\\n38 36\\r\\n40 15\\r\\n', 'output': ['NO']}, {'input': '66 94 26\\r\\n11 75\\r\\n46 72\\r\\n55 74\\r\\n34 10\\r\\n33 84\\r\\n25 11\\r\\n13 23\\r\\n27 73\\r\\n45 22\\r\\n54 34\\r\\n53 63\\r\\n28 8\\r\\n57 46\\r\\n26 78\\r\\n52 46\\r\\n32 38\\r\\n22 55\\r\\n17 71\\r\\n56 18\\r\\n9 60\\r\\n31 54\\r\\n6 84\\r\\n59 57\\r\\n60 81\\r\\n51 49\\r\\n41 77\\r\\n', 'output': ['NO']}, {'input': '68 100 18\\r\\n17 85\\r\\n10 77\\r\\n59 55\\r\\n29 46\\r\\n25 74\\r\\n55 11\\r\\n37 16\\r\\n57 61\\r\\n26 11\\r\\n11 88\\r\\n19 18\\r\\n28 38\\r\\n32 12\\r\\n36 49\\r\\n32 6\\r\\n57 45\\r\\n30 6\\r\\n59 95\\r\\n', 'output': ['NO']}, {'input': '28 61 4\\r\\n12 18\\r\\n21 31\\r\\n14 52\\r\\n6 36\\r\\n', 'output': ['NO']}, {'input': '11 73 1\\r\\n4 67\\r\\n', 'output': ['YES']}, {'input': '11 79 0\\r\\n', 'output': ['NO']}, {'input': '11 23 1\\r\\n11 9\\r\\n', 'output': ['YES']}, {'input': '25 11 0\\r\\n', 'output': ['NO']}, {'input': '39 11 1\\r\\n18 3\\r\\n', 'output': ['YES']}, {'input': '69 11 0\\r\\n', 'output': ['NO']}, {'input': '18 15 45\\r\\n6 7\\r\\n7 14\\r\\n12 3\\r\\n17 1\\r\\n15 3\\r\\n7 11\\r\\n9 3\\r\\n7 11\\r\\n15 4\\r\\n8 1\\r\\n12 2\\r\\n17 7\\r\\n14 15\\r\\n2 9\\r\\n12 4\\r\\n14 9\\r\\n18 8\\r\\n2 2\\r\\n17 1\\r\\n7 9\\r\\n2 4\\r\\n16 1\\r\\n12 7\\r\\n17 10\\r\\n4 1\\r\\n18 13\\r\\n10 13\\r\\n9 12\\r\\n14 1\\r\\n1 6\\r\\n3 10\\r\\n6 2\\r\\n15 3\\r\\n4 8\\r\\n14 6\\r\\n5 14\\r\\n8 11\\r\\n8 13\\r\\n6 7\\r\\n16 9\\r\\n2 7\\r\\n17 14\\r\\n17 11\\r\\n7 9\\r\\n15 8\\r\\n', 'output': ['YES']}, {'input': '16 18 70\\r\\n14 17\\r\\n16 8\\r\\n14 1\\r\\n7 1\\r\\n5 3\\r\\n7 5\\r\\n15 15\\r\\n15 2\\r\\n8 17\\r\\n12 12\\r\\n8 7\\r\\n10 16\\r\\n16 6\\r\\n14 7\\r\\n2 7\\r\\n12 4\\r\\n1 9\\r\\n6 9\\r\\n1 10\\r\\n10 13\\r\\n7 11\\r\\n2 2\\r\\n9 5\\r\\n3 10\\r\\n14 7\\r\\n4 5\\r\\n2 7\\r\\n7 16\\r\\n5 7\\r\\n7 14\\r\\n14 6\\r\\n10 16\\r\\n8 1\\r\\n4 14\\r\\n3 15\\r\\n8 11\\r\\n3 16\\r\\n12 1\\r\\n10 12\\r\\n13 3\\r\\n14 17\\r\\n5 5\\r\\n6 8\\r\\n13 10\\r\\n11 13\\r\\n3 5\\r\\n15 7\\r\\n10 3\\r\\n6 12\\r\\n13 15\\r\\n7 5\\r\\n3 8\\r\\n7 18\\r\\n6 7\\r\\n15 1\\r\\n9 6\\r\\n6 17\\r\\n11 2\\r\\n2 17\\r\\n7 16\\r\\n6 6\\r\\n2 18\\r\\n2 10\\r\\n5 16\\r\\n7 17\\r\\n3 8\\r\\n15 2\\r\\n11 11\\r\\n5 13\\r\\n16 1\\r\\n', 'output': ['YES']}, {'input': '14 20 68\\r\\n6 7\\r\\n2 15\\r\\n4 6\\r\\n10 18\\r\\n6 9\\r\\n14 14\\r\\n5 18\\r\\n9 15\\r\\n5 15\\r\\n2 9\\r\\n9 13\\r\\n10 17\\r\\n4 2\\r\\n12 12\\r\\n6 19\\r\\n7 13\\r\\n10 11\\r\\n1 1\\r\\n3 16\\r\\n7 6\\r\\n8 16\\r\\n10 17\\r\\n1 13\\r\\n12 11\\r\\n13 13\\r\\n2 20\\r\\n14 12\\r\\n11 18\\r\\n10 8\\r\\n12 4\\r\\n13 7\\r\\n13 11\\r\\n1 1\\r\\n10 6\\r\\n14 17\\r\\n1 2\\r\\n11 5\\r\\n6 12\\r\\n13 2\\r\\n4 3\\r\\n8 19\\r\\n12 8\\r\\n8 7\\r\\n5 1\\r\\n2 10\\r\\n11 10\\r\\n12 19\\r\\n2 10\\r\\n8 4\\r\\n12 13\\r\\n3 15\\r\\n8 8\\r\\n5 9\\r\\n14 15\\r\\n5 19\\r\\n7 7\\r\\n1 16\\r\\n6 12\\r\\n11 18\\r\\n5 13\\r\\n1 12\\r\\n10 14\\r\\n4 5\\r\\n2 8\\r\\n3 20\\r\\n14 7\\r\\n6 3\\r\\n4 18\\r\\n', 'output': ['YES']}, {'input': '19 13 83\\r\\n5 2\\r\\n12 11\\r\\n5 6\\r\\n3 11\\r\\n17 8\\r\\n10 8\\r\\n3 10\\r\\n9 10\\r\\n16 3\\r\\n15 12\\r\\n14 2\\r\\n11 8\\r\\n18 6\\r\\n15 10\\r\\n11 12\\r\\n2 1\\r\\n15 3\\r\\n16 3\\r\\n1 7\\r\\n15 7\\r\\n2 9\\r\\n11 13\\r\\n18 9\\r\\n4 7\\r\\n13 4\\r\\n7 4\\r\\n3 1\\r\\n14 8\\r\\n4 5\\r\\n5 7\\r\\n8 3\\r\\n17 2\\r\\n18 2\\r\\n16 3\\r\\n10 12\\r\\n6 2\\r\\n3 6\\r\\n5 2\\r\\n10 3\\r\\n18 9\\r\\n14 3\\r\\n3 6\\r\\n6 5\\r\\n12 8\\r\\n7 12\\r\\n2 11\\r\\n6 6\\r\\n18 6\\r\\n14 4\\r\\n3 10\\r\\n3 2\\r\\n13 3\\r\\n12 9\\r\\n2 10\\r\\n15 6\\r\\n1 5\\r\\n9 12\\r\\n6 12\\r\\n4 6\\r\\n18 3\\r\\n7 2\\r\\n9 13\\r\\n3 10\\r\\n19 13\\r\\n6 7\\r\\n5 1\\r\\n4 10\\r\\n12 13\\r\\n8 12\\r\\n15 1\\r\\n4 3\\r\\n3 8\\r\\n4 8\\r\\n3 7\\r\\n4 13\\r\\n8 7\\r\\n7 13\\r\\n2 8\\r\\n14 6\\r\\n12 1\\r\\n16 8\\r\\n9 4\\r\\n5 8\\r\\n', 'output': ['YES']}, {'input': '13 19 1\\r\\n6 10\\r\\n', 'output': ['NO']}, {'input': '14 17 0\\r\\n', 'output': ['NO']}, {'input': '20 19 5\\r\\n7 14\\r\\n14 12\\r\\n7 12\\r\\n15 9\\r\\n12 6\\r\\n', 'output': ['NO']}, {'input': '17 15 3\\r\\n10 7\\r\\n12 6\\r\\n8 6\\r\\n', 'output': ['NO']}, {'input': '14 17 4\\r\\n9 9\\r\\n8 7\\r\\n8 12\\r\\n7 9\\r\\n', 'output': ['NO']}, {'input': '15 11 0\\r\\n', 'output': ['NO']}, {'input': '14 16 4\\r\\n6 11\\r\\n6 8\\r\\n8 6\\r\\n6 7\\r\\n', 'output': ['NO']}, {'input': '16 16 0\\r\\n', 'output': ['NO']}, {'input': '19 20 2\\r\\n10 14\\r\\n8 11\\r\\n', 'output': ['NO']}, {'input': '13 15 1\\r\\n7 10\\r\\n', 'output': ['NO']}, {'input': '11 100 4\\r\\n6 10\\r\\n6 20\\r\\n6 30\\r\\n6 80\\r\\n', 'output': ['NO']}, {'input': '100 11 2\\r\\n40 6\\r\\n70 6\\r\\n', 'output': ['NO']}, {'input': '100 11 5\\r\\n20 6\\r\\n30 6\\r\\n43 7\\r\\n78 6\\r\\n89 6\\r\\n', 'output': ['YES']}, {'input': '20 20 5\\r\\n10 6\\r\\n6 8\\r\\n16 11\\r\\n11 11\\r\\n7 15\\r\\n', 'output': ['YES']}, {'input': '30 30 5\\r\\n7 15\\r\\n24 11\\r\\n15 15\\r\\n8 24\\r\\n9 6\\r\\n', 'output': ['NO']}]","id":166} {"difficulty":2600,"lang":"Python 2","lang_cluster":"Python","src_uid":"7_E","execute_outcome":"WRONG_ANSWER","source_code":"SUSPICIOUS = -128\r\nNIL = 0\r\nADD = 1\r\nSUB = 2\r\nMUL = 4\r\nDIV = 8\r\nALL = 15\r\n\r\nop_value = {'+': ADD, '-': SUB, '*': MUL, '\/': DIV}\r\ninvalid = {NIL: (NIL, NIL),\r\n ADD: (NIL, NIL),\r\n SUB: (NIL, ADD | SUB), \r\n MUL: (ADD | SUB, ADD | SUB),\r\n DIV: (ADD | SUB, ALL)} \r\n\r\n\r\ndef validate(expr):\r\n global definitions\r\n\r\n ## Initialize validation variables\r\n last_op = 0\r\n operators = 0\r\n last_token = 0\r\n\r\n ## Initialize parsing variables\r\n token = \"\"\r\n paren_depth = 0\r\n\r\n ## Iterate the expression\r\n for c in expr:\r\n\r\n ## Handle sub-expressions\r\n if c == '(':\r\n paren_depth += 1\r\n\r\n elif c == ')':\r\n paren_depth -= 1\r\n\r\n ## No validation necessary\r\n ## (besides non-suspiciousness)\r\n if paren_depth == 0:\r\n if validate(token) == SUSPICIOUS:\r\n return SUSPICIOUS\r\n \r\n token = \"\"\r\n\r\n ## Perform validation\r\n elif paren_depth == 0 and c in '*\/+-':\r\n ## Validate last_op + last_token\r\n if token != \"\":\r\n last_token = definitions.get(token, 0)\r\n #print 1, last_token, last_op, invalid[last_op][1]\r\n if last_token == SUSPICIOUS or last_token & invalid[last_op][1]:\r\n #print bin(SUSPICIOUS)[2:]\r\n return SUSPICIOUS\r\n\r\n token = \"\"\r\n\r\n ## Update validation variables\r\n last_op = op_value[c]\r\n operators |= last_op\r\n\r\n ## Validate last_token + last_op\r\n #print 2, last_token, last_op, invalid[last_op][0]\r\n if last_token & invalid[last_op][0]:\r\n #print bin(SUSPICIOUS)[2:]\r\n return SUSPICIOUS\r\n\r\n else:\r\n token += c\r\n\r\n if token != \"\":\r\n last_token = definitions.get(token, 0)\r\n #print 1, last_token, last_op, invalid[last_op][1]\r\n if last_token == SUSPICIOUS or last_token & invalid[last_op][1]:\r\n #print bin(SUSPICIOUS)[2:]\r\n return SUSPICIOUS\r\n\r\n return operators\r\n\r\n\r\n\r\ndefinitions = {}\r\n\r\nn = input()\r\n\r\nfor i in range(n):\r\n line = raw_input().split()\r\n \r\n if line[0] == '#':\r\n head = line[2]\r\n line = line[3:]\r\n else:\r\n head = line[1]\r\n line = line[2:]\r\n\r\n definitions[head] = validate(\"\".join(line))\r\n \r\n #print head, bin(definitions[head])[2:]\r\n\r\n \r\nexpr = validate(\"\".join(raw_input().split()))\r\nprint \"Suspicious\" if expr == SUSPICIOUS else \"OK\"\r\n","description":"Most C\/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:#define macro_name macro_valueAfter the macro has been declared, \"macro_name\" is replaced with \"macro_value\" each time it is met in the program (only the whole tokens can be replaced; i.e. \"macro_name\" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A \"macro_value\" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.One of the main problems arising while using macros \u2014 the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.Let's consider the following example. Say, we declared such a #define construction:#define sum x + yand further in the program the expression \"2 * sum\" is calculated. After macro substitution is performed we get \"2 * x + y\", instead of intuitively expected \"2 * (x + y)\".Let's call the situation \"suspicious\", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a \"safe\" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise \u2014 suspicious.Note that we consider the \"\/\" operation as the usual mathematical division, not the integer division like in C\/C++. That's why, for example, in the expression \"a*(b\/c)\" we can omit brackets to get the expression \"a*b\/c\".","input_specification":"The first line contains the only number n (0\u2264n\u2264100) \u2014 the amount of #define constructions in the given program.\nThen there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:\n#define name expression\nwhere\n name \u2014 the macro name, expression \u2014 the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*\/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 10^9. All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.\nThen, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.\nThe input lines may contain any number of spaces anywhere, providing these spaces do not break the word \"define\" or the names of constructions and variables. In particular, there can be any number of spaces before and after the \"#\" symbol.\nThe length of any line from the input file does not exceed 100 characters.\n","output_specification":"Output \"OK\", if the expression is correct according to the above given criterion, otherwise output \"Suspicious\".\n","notes":null,"sample_inputs":["1\n#define sum x + y\n1 * sum\n","1\n#define sum (x + y)\nsum - sum\n","4\n#define sum x + y\n#define mul a * b\n#define div a \/ b\n#define expr sum + mul * div * mul\nexpr\n","3\n#define SumSafe (a+b)\n#define DivUnsafe a\/b\n#define DenominatorUnsafe a*b\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)\n"],"sample_outputs":["Suspicious\n","OK\n","OK\n","Suspicious\n"],"human_solution":"class Macro:\r\n def __init__(self, level):\r\n self.level = level\r\n\r\n def __add__(self, other):\r\n return Macro('+0'[self.level == '0' or other.level == '0'])\r\n\r\n def __sub__(self, other):\r\n return Macro('+0'[self.level == '0' or other.level in '0+'])\r\n\r\n def __mul__(self, other):\r\n return Macro('*0'[self.level in '0+' or other.level in '0+'])\r\n\r\n def __truediv__(self, other):\r\n return Macro('*0'[self.level in '0+' or other.level in '0+*'])\r\n\r\ndef create_macro(c):\r\n return 'Macro(\"' + c + '\")'\r\n\r\ndef evaluate_expression(expression, variables):\r\n stack, current_token = [''], ''\r\n for char in ''.join(expression):\r\n if char in '+-*\/()':\r\n if current_token != '':\r\n stack[-1] += create_macro(variables.get(current_token, '1'))\r\n current_token = ''\r\n if char == '(':\r\n stack.append('')\r\n elif char == ')':\r\n macro = create_macro('10'[eval(stack.pop()).level == '0'])\r\n stack[-1] += macro\r\n else:\r\n stack[-1] += char\r\n else:\r\n current_token += char\r\n if current_token != '':\r\n stack[0] += create_macro(variables.get(current_token, '1'))\r\n return eval(stack[0]).level\r\n\r\nvariables = {}\r\nfor _ in range(int(input())):\r\n line = input().split()\r\n if line[0] == '#':\r\n line.pop(0)\r\n variables[line[1]] = evaluate_expression(line[2:], variables)\r\n\r\nresult = evaluate_expression(input().split(), variables)\r\nprint('Suspicious' if result == '0' else 'OK')","testcases":"[{'input': ['1\\r\\n#define sum x + y\\r\\n1 * sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum (x + y)\\r\\nsum - sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define sum x + y\\r\\n#define mul a * b\\r\\n#define div a \/ b\\r\\n#define expr sum + mul * div * mul\\r\\nexpr\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define SumSafe (a+b)\\r\\n#define DivUnsafe a\/b\\r\\n#define DenominatorUnsafe a*b\\r\\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['0\\r\\naa + b - c * (ddd * eee \/ fff * a \/ b * c + d - b + c - (a + b)) - d\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\n#define a b\\r\\n#define c d\\r\\na + b + c + d + 1234567 -10*(2-2+1000*1000*1000*1000*1000)\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\n # define macros ( x + y ) \\r\\n # define Macros (x+y)\\r\\nmacros\/Macros\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/A\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/a\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/(a)\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define a x*y\\r\\nc\/a\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define a b*c\\r\\na\/a*a\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['3\\r\\n#define mul x*y\\r\\n#define bad x\/mul\\r\\n#define good x\/(mul)\\r\\ngood\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define mult a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum+difference+(sum)*(difference)-mult+mult*division+division*mult+division\/(mult+sum-(difference))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference\/division)+sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference)*sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(sum)\/multiplication\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum\/(multiplication)\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['5\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n#define res (0-difference)\\r\\nsum+res*multiplication\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\ndivision\/(multiplication\/(division)\/DIVISION\/(sum-division-multiplication-(difference)))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define sum x + y\\r\\n#define SomeBad (2 * sum)\\r\\n#define SomePossiblyGood 0 * SomeBad + (x + x - 2*x) * SomeBad\\r\\nSomePossiblyGood\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['2\\r\\n#define a 0\\r\\n#define b (a-a)*(x\/x-1)\\r\\nb-b\/b*b\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['2\\r\\n#define fkdsjfslkjfsdk x\/0\\r\\n#define fkdsjfslkjfsdksdds 0\/(0-0)\\r\\nfkdsjfslkjfsdk + fkdsjfslkjfsdks + fkdsjfslkjfsdkssds\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define null x\/0\\r\\n#define some x\/x\\r\\n#define bad 1\/x\\r\\nbad\/0+0\/bad+0\/0*bad\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['3\\r\\n#define MWjGY x+x*53 *x\\r\\n#define ovqZ 2\/926+x\/A\\r\\n#define uU 55-qRj*A*2\\r\\nx*A\/x-A\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define zz 5+7\/x*x*9\\r\\n#define mlTL 6+x\/7+x\/x\\r\\n#define DUO 7*7-x+zz\\r\\n#define IH 6*4-x+x\\r\\n67\/(5)-IH\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['5\\r\\n#define Oc 9\/51+65+vN\\r\\n#define gga 53\/ 94\/x\/x\\r\\n#define ArB x\/x\/9-77-8\\r\\n#define j 76-6\/93+vN\\r\\n#define cALNN Oc+60499\\r\\n8*6-66\/x*x\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define fSdvwOj (W)*W+73\\r\\n#define NAZjc 7695*55-x\\r\\n#define AHGGglVwch (6-a-W)\\r\\n((5))+W+W\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define m bJJD +x \\r\\n#define yYkQNzjR (x*19)-892\\r\\n#define MNvfxqfbq (x-6*x\/8)\\r\\n#define nJZdvO 8\/4 *m\/m\\r\\n 9+m\/x+x\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['5\\r\\n#define Sl x*7-(x)\/O\\r\\n#define srAOHccTln 3+x*2*O\\r\\n#define OFAZk 239751817\\r\\n#define JYWrOEgazV (x-O\/4)-x\\r\\n#define XsOZvalgOh 89905879\/7\\r\\nx\/Sl-(Sl)\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['3\\r\\n#define uYdw ((9-x-3) )\\r\\n#define fy (((x+21)))\\r\\n#define nY ((2+x)-46)\\r\\n141141432\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define GCvqH (58 )-(x)\\r\\n#define g ((x\/x+x))\\r\\n#define spst hQTJ\\r\\n#define i GCvqH\\r\\n(((x+6)))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define rg (67)+((x))\\r\\n#define ya x-(6\/x)*rg\\r\\n#define anTxe 10*ya*(x)\\r\\n#define xcmo ((x)*(vT))\\r\\n#define eg ((vT)) -ya\\r\\n((x*(Ii)))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define T ((b\/1 +1))\\r\\n#define pm (s)-43-(s)\\r\\n#define jkNBpvDZl ((x ))\/65\\r\\n(((58*7)))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define cJitUt 21\/(4)+4+4\\r\\n#define zHwBOLIvF 4*((41\/x))\\r\\n#define GbtYVo (E)+(x+3)\\r\\n#define zTcZBaby (58)+x-x+x\\r\\n(E+E)\/8 *4\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define mBURKdeKvy 266693986\\r\\n#define nWi ( ((x))-4)\\r\\n#define iYreeOt ((7\/x+42))\\r\\n#define laLzP ((aB\/35)) \\r\\n#define dXjRJ (((B*hX)))\\r\\n(1*2+(67))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define UVMQLGvEqOxaAgRkvJH tBd\\r\\n#define QoAsBMaUcJzXai x\/x-hm\/83+8*8\/5\/hm \/x\/hm\\r\\n#define QtxtzEHCmidm 75 +491928441\\r\\n((x)\/VUpYoEdDUtLFanGyqfQR )\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define efemx 2\/1*3*69+81+10\/690445104\\r\\n#define AyjrEzAjMKZpRPfCOaO 21*9+( j*40+3*4)*ND+w-j*j+x*55\\r\\n#define YkJkHcNhXcci 85*3215\/40\/365819568\\r\\n#define MUzvOZSXJujI 9-4\/j*j-7-w*23*5+j+9-9*ND*2\/37\\r\\nND\/j*28 -1* ND+22889023\/j\/j\/j\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define QNUkjqPcGWF 6*4\/908975666-7\/10-x*7\\r\\n#define xqwhNWiiMaZOcmgiXYY 3936*(e*5*H+2)-TsA+(e)\/1-25\\r\\n#define tRsSqfqJt ((uT*82\/e)+e\/(23+(45)-9)+(50))\\r\\n#define DtIOWRkYe (8*3\/9)*e*x *60041512*2-(e)\\r\\n#define qgPgxja (4\/x+e\/uT*16358009- 6\/13*5)\\r\\ne+x*e\/84\/x+uT*H\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define lTCUUO JQmj\\r\\n#define oUeQMB (12*x+x+x)-75-(79\/1)-(7)*1\/mr\\r\\n#define LAQu xwvBtky\\r\\n8654 *1*5-mr-3*J\/oUeQMB\/x\/6\/9\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define VLuQIO 1-x\/33+ Fk+wS\/35-wS-(x*iz )\\r\\n#define BCIsIR 5*(wS)\/x\/iz\/1+x-x-4-x\/68\/x\/8*x\\r\\n#define QPUpmTiB 21-x\/895912506+2\\r\\n#define wcZLUIqJS 7\/65-x*61-(24+iz)+x+315670+x\/x\\r\\nBCIsIR\/VLuQIO\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['5\\r\\n#define FDmMYOENCOKmYwYlOl 6-(L)\/((((ud\/x))\/ud-26*8-5))\\r\\n#define QkopKBjKdJxhc (6)*4\/7-L\/781844832 \\r\\n#define UjgTieUBXTSTbiLFAhkV 3*1*(52)\/6-6*65\/x+((L-56))+x+x\\r\\n#define yWVYDuqliezpKLwnI 8\/4+1+88+97946+(1)-((68))-L\/L\\r\\n#define AvvED 719901121+95\/2\/78\/1-10+37\\r\\n(1*x+ 528176190+17\/ud)\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define e x *R\/5+(x)+4\/18\/x*R\/x-8+1+R\\r\\n#define GgGqGYjXoJjIezAVu (( 491563947*R))*9-e-3\/4\\r\\n#define XgznGUWMxQwh (8\/R+4*(e)+10\/4*x+24*R+21)-224\\r\\n (82493582)\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['4\\r\\n#define MrKSTrKhPLeJqOcEPvv (x+x\/x)\/Qdf-x-x-(2\/23)+9442-x\\r\\n#define zPHUgmIYE 10- 7*x\/x+VwRUuIRezDR*80\\r\\n#define OsfThxasHeFZCEZTfD 271456028-(x*x)-8+2*x*x*x+(x)\\r\\n#define zVYasB x\/x -x-(51)-x*x*((x)) \/x \\r\\n(x\/64-x*( (5+x+x)-(37)\/3*22))\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define WREol (fcdGZaLzhiFpVQmhHO)\\r\\n#define lDTNxcMqPPP 3+(57)\/x\/91540-x*71-x*6-((1))\\r\\n#define afFJVBkr ((12*x-8+9 *lDlx+7+lDlx))\\r\\n#define mYEizEWrNtRSQNCcDQrn 732480960+9+x-78-x\/1+12*x\\r\\n#define IZTmjheAahbNSNFa ((x-x*7+407643063 ))\\r\\nXQvMxLNpQnhpimNhAkfX\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define Mc x+x*55231- x\/x\/x+35\/x*(5*(x)) -5*x*(1-2-(29\/1))\\r\\n#define afSVLCdjvylSu bgqv\/6+4*x*((Mc\/1318\/x-8-4)-Mc\/Mc\/(9))\\r\\n#define ZOSV (1+2\/x+6* 174806683)-x\/x*Mc+52*x-x\\r\\nbgqv-x-6*x\/72\/(x )\/afSVLCdjvylSu\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define RJIiiGQqn dmpWFcrqQeM+V-o* 55\/9*o-o\/V*V*o\\r\\n#define ElDZlrtzDkeKgsX 498718105* 3\/(y)\/(4)-(5*x)*1\\r\\n#define qwKl jHqPHX\\r\\n#define qXzAZkCuchBYR (qy*qwKl-6+5*1+2)-7-3+(38)-o*4\/4-1-V*x\/6+1*x\/o\\r\\no*((V))-o+2+((((2*V)\/V-o*V\/4)))\/o*33+y\/7 -x+x \\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define WTovyGexUNjGMRJv (MQG*18-6)\/x\/x*x\/x-x*akNyw*x+x-x\/2\/x*20\\r\\n#define hpextyhVCa 70*x\/67-x*87931-(497612505-7*x-MQG)-x\\r\\n#define MRkKnCXFt x-5-21962-x\/sOmThNSS\/x\/6-4+(65+57+x+x+7-7+x\/x)\\r\\n#define ajsczBLLklBSqqh nGj-38*9 *x\/47\/8*5\/5-72\/x*x-x*x*31 \/7-44-3+64\\r\\n#define jgqfv WTovyGexUNjGMRJv\\r\\n 4+338\/x*x+13 -795*3-74*2\/4+563-x\/76401438\/83025\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define G u+13-35348\/2-(u\/u)-u\/u*u*(OC)-OC -u-u\/u*u\/9 \\r\\n#define RNRQ G*G*u+G\/755750\/G\/G +((u-6*G+6)*2)- 5*96+5\/u*275-u\\r\\n#define Zg 94363\/u*u-41+Gm*G-81\/5-1-G*G*x-(5517*5\/4)*21 +75\\r\\n406690013\/WM*G+(u+u)*Zg+2\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define RMWAZhIp x*x+12+94*12*5*1-x-141915293\\r\\n#define EeguG 9-55+x\/29+x+x\/E*8*81\/x-x*75-4*17-81\/x\/6+619978*x*x\\r\\n#define HvUYEvQTyYmBGvqHSb 454574730\/644135926*x\/23+E-sy\/14\\r\\n#define BqMGcT x\/(43)+819897061-x*(7\/x)-(x)+sy-E-x*79-E+(x)\/6\/63\\r\\n76+3\/x\/8*x+E-76+sy-sy+9*6\/66\/sy-77+x-x*sy+E\/50\/64\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['5\\r\\n#define cbt ((((d))+9-3+ (d)\/d\/6*SDDNqj*50\/d+d-m+8\/d\/1)) \\r\\n#define gLrUE 18+ 70*d\/3-d*d-d\/35 +33-5\/9+d-d*387+d-1\\r\\n#define AvjmK 9-d-8+(d+m+5\/2\/x*d+1)\/x\/d-5-2*(m)+d+17\/d+ 4\/52\/8\\r\\n#define SjrJ 90\/7\/5\/d+ 254877982+(m) *x-19\\r\\n#define PlykoqfDbwxR 540304590 +d*x\/11-(m+d-d-4)*(d-3-1)\/d\\r\\nd-2+1+46-29620+9-(9*3 \/d)*6*m\/d+9+(1670)\/cbt\/d+d\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['3\\r\\n#define BuAiJLgAlkj x-3+419032556\/409023036-(17*84)+x+8+A\\r\\n#define wU 516506880\\r\\n#define HeyDGlnaGxBaHjzelvF iRSPqHfgHw\/4-(99)*(I)+A+I-9*46*x\\r\\nI\/CRklg-HeyDGlnaGxBaHjzelvF\/3+5 \\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['4\\r\\n#define SOlTohcPGckDyF ((D)\/G-83+KHGSuJFLHqD\/5)\\r\\n#define KEUXeOYpg 9+x-8-8\/x\/9-65-6+4+55*x-58\/x+84+D*2-7+D\/x-x*G\/4-2\\r\\n#define YZl (1\/67*x*6\/2*G)-D\/1595107*D+6\/x*1+D+3\/9\/x\/26-6+9 \\r\\n#define gCatFsZn uBBqilYclMhpVfKKTkGK\\r\\n(28682537+ YZl*(4*52) )*x\/8- gCatFsZn*x\/54\/7\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['5\\r\\n#define iiXEqDYeyVmIYsOaO fj\/x-9-6\/x*x+ 1\/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x\/70\\r\\n#define XVgLzhoTUxoBr ( x+x\/x\/x*6-x)* x+K\/24206-2 \/5\/8-x-7\/Ww\/K-x+6 \\r\\n#define QdfRBaJk 470551685-( 54-x)-30\\r\\n#define gEJcAGnF x+x-x+(x\/x+9)\/x-41-1\/fj\/1157561+x\/x -x\/26\/x+K*x\\r\\n#define lO 7-1*(x*58 )-K*fj \/722113691\/x\/K+2\\r\\n2+4*85\/86\/x*27 \/49252-x*x\/6-83-7\/x+x+K-lO+8-K-x\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nr-sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nr+sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nr*sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nr\/sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nr+sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nr-sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nr*sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nr\/sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nr+sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nr-sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nr*sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nr\/sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nr+sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nr-sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nr*sum\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nr\/sum\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nsum+r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nsum-r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nsum*r\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x+y\\r\\nsum\/r\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nsum+r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nsum-r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nsum*r\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x-y\\r\\nsum\/r\\r\\n'], 'output': ['Suspicious\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nsum+r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nsum-r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nsum*r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x*y\\r\\nsum\/r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nsum+r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nsum-r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nsum*r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define sum x\/y\\r\\nsum\/r\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['1\\r\\n#define x 3\/2\\r\\n2*x\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\n # define sum 1000000000 + 1000000000 + 1000000000 \\r\\n # define a b + 45 * sum \\r\\n a \\r\\n'], 'output': ['Suspicious\\r\\n']}]","id":167} {"difficulty":1700,"lang":"Python 2","lang_cluster":"Python","src_uid":"867facaa8bcdfcb53ec3647387f7d23f","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/python\n# -*- coding: utf-8 -*- \n\nfrom itertools import combinations\n\nn = int(raw_input(''))\na,b = [int(x) for x in (raw_input('')).split(' ')]\ns = [int(x) for x in (raw_input('')).split(' ')]\n\nmaxs = 0.0\nres = None\nmaxst = ''\n\nfor c in combinations( xrange(0,n), a ):\n f = [ 0 for x in xrange(0,n) ] \n for t in c:\n f[t] = 1\n\n sum1 = 0\n sum2 = 0\n for i in xrange(0,n):\n if f[i] == 1:\n sum1 += s[i]\n else:\n sum2 += s[i]\n\n ss = float(sum1)\/float(a) + float(sum2)\/float(b)\n st = ''.join( [ str(2-x) for x in f ] )\n\n if ss == maxs:\n if st < maxst: \n maxst = st\n res = f[:]\n elif ss-1e-8 > maxs:\n maxs = ss\n maxst = st\n res = f[:]\n \n\n\n maxs = ss\nr = ''\ni = 0\nwhile i < len(res):\n if r != '':\n r += ' '\n r += str(2-res[i])\n i += 1\n\nprint r\n\n","description":"After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.Now it's time to show the journal to his strict parents. Polycarp knows that recently at the Parent Meeting the parents were told that he received a Safety Studies marks and b PE marks (a\u2009+\u2009b\u2009=\u2009n). Now Polycarp wants to write a subject's name in front of each mark so that: there are exactly a Safety Studies marks, there are exactly b PE marks, the total average score in both subjects is maximum. An average subject grade is the sum of all marks in it, divided by the number of them. Of course, the division is performed in real numbers without rounding up or down. Polycarp aims to maximize the x1\u2009+\u2009x2, where x1 is the average score in the first subject (Safety Studies), and x2 is the average score in the second one (Physical Education).","input_specification":"The first line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105), n is the number of marks in Polycarp's Journal. The second line contains two positive integers a,\u2009b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n\u2009-\u20091,\u2009a\u2009+\u2009b\u2009=\u2009n). The third line contains a sequence of integers t1,\u2009t2,\u2009...,\u2009tn (1\u2009\u2264\u2009ti\u2009\u2264\u20095), they are Polycarp's marks.","output_specification":"Print the sequence of integers f1,\u2009f2,\u2009...,\u2009fn, where fi (1\u2009\u2264\u2009fi\u2009\u2264\u20092) is the number of a subject to which the i-th mark should be attributed. If there are several possible solutions, then print such that the sequence f1,\u2009f2,\u2009...,\u2009fn is the smallest lexicographically. The sequence p1,\u2009p2,\u2009...,\u2009pn is lexicographically less than q1,\u2009q2,\u2009...,\u2009qn if there exists such j (1\u2009\u2264\u2009j\u2009\u2264\u2009n) that pi\u2009=\u2009qi for all 1\u2009\u2264\u2009i\u2009<\u2009j, \u0430nd pj\u2009<\u2009qj.","notes":"NoteIn the first sample the average score in the first subject is equal to 4, and in the second one \u2014 to 4.5. The total average score is 8.5.","sample_inputs":["5\n3 2\n4 4 5 4 4","4\n2 2\n3 5 4 5","6\n1 5\n4 4 4 5 4 4"],"sample_outputs":["1 1 2 1 2","1 1 2 2","2 2 2 1 2 2"],"human_solution":"f=lambda:map(int,raw_input().split())\nn,(a,b),t=f(),f(),f()\ns=[sorted(t,reverse=amaxt else maxt\n mint=books[r] if books[r]k):\n if not(maxp-minp<=k) :\n break\n res.append([l+1,r])\n if r-l>M :\n M=r-l\n Mcnt=1\n elif r-l==M :\n Mcnt+=1\n break\nprint(M,Mcnt)\nfor i in range(Mcnt) :\n print(res[-Mcnt+i][0],res[-Mcnt+i][1])","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"],"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} {"difficulty":1700,"lang":"Python 3","lang_cluster":"Python","src_uid":"c175d010d75c391d0b25391fecff007c","execute_outcome":"RUNTIME_ERROR","source_code":"n = int(input())\n\nl = []\nfor i in range(n):\n l.append(int(input()))\n\ndef repair(x, y, r):\n if(r == 0):\n return x\n \n z = (x % (10 * r)) \/\/ r - (y % (10 * r)) \/\/ r\n \n if(z == 0):\n return repair(x, y, r \/\/ 10)\n \n if(x % r >= y % r):\n return x - z * r\n else:\n return x - z * r + r\n\ny = 1000\ntry:\n for i in range(n):\n l[i] = repair(l[i], y, 1000)\n if(l[i] > 2011):\n raise Exception()\n y = l[i]\n \n for i in l:\n print(i)\nexcept:\n print(\"No solution\")","description":"The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has a soporific effect even on the quill. That's why the quill often makes mistakes, especially in dates.So, at the end of the semester Professor Binns decided to collect the students' parchments with notes and check them. Ron Weasley is in a panic: Harry's notes may contain errors, but at least he has some notes, whereas Ron does not have any. Ronald also has been sleeping during the lectures and his quill had been eaten by his rat Scabbers. Hermione Granger refused to give Ron her notes, because, in her opinion, everyone should learn on their own. Therefore, Ron has no choice but to copy Harry's notes.Due to the quill's errors Harry's dates are absolutely confused: the years of goblin rebellions and other important events for the wizarding world do not follow in order, and sometimes even dates from the future occur. Now Ron wants to change some of the digits while he copies the notes so that the dates were in the chronological (i.e. non-decreasing) order and so that the notes did not have any dates strictly later than 2011, or strictly before than 1000. To make the resulting sequence as close as possible to the one dictated by Professor Binns, Ron will change no more than one digit in each date into other digit. Help him do it.","input_specification":"The first input line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000\u2009\u2264\u2009yi\u2009\u2264\u20099999).","output_specification":"Print n numbers z1, z2, ..., zn (1000\u2009\u2264\u2009zi\u2009\u2264\u20092011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0. If there are several possible solutions, print any of them. If there's no solution, print \"No solution\" (without the quotes).","notes":null,"sample_inputs":["3\n1875\n1936\n1721","4\n9999\n2000\n3000\n3011","3\n1999\n5055\n2000"],"sample_outputs":["1835\n1836\n1921","1999\n2000\n2000\n2011","No solution"],"human_solution":"import sys\n\nn = int(input())\nd = []\nfor i in range(n):\n d.append(input())\nans = []\n\nbad = 'No solution'\nlow = 1000\nfor date in d:\n lowest = 100500\n for i in range(10):\n for j in range(i == 0, 5):\n changed = date[:j] + str(i) + date[j + 1:]\n if lowest > int(changed) >= low:\n lowest = int(changed)\n if lowest > 2011:\n print(bad)\n sys.exit(0)\n ans.append(str(lowest))\n low = lowest\n\nprint('\\n'.join(ans))","testcases":"[{'input': '3\\r\\n1875\\r\\n1936\\r\\n1721\\r\\n', 'output': ['1075\\r\\n1136\\r\\n1221\\r\\n']}, {'input': '4\\r\\n9999\\r\\n2000\\r\\n3000\\r\\n3011\\r\\n', 'output': ['1999\\r\\n2000\\r\\n2000\\r\\n2011\\r\\n']}, {'input': '3\\r\\n1999\\r\\n5055\\r\\n2000\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '2\\r\\n2037\\r\\n2025\\r\\n', 'output': ['1037\\r\\n2005\\r\\n']}, {'input': '1\\r\\n1234\\r\\n', 'output': ['1034\\r\\n']}, {'input': '1\\r\\n9876\\r\\n', 'output': ['1876\\r\\n']}, {'input': '2\\r\\n9988\\r\\n8899\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '3\\r\\n1095\\r\\n1094\\r\\n1095\\r\\n', 'output': ['1005\\r\\n1014\\r\\n1015\\r\\n']}, {'input': '5\\r\\n5555\\r\\n4444\\r\\n3333\\r\\n2222\\r\\n1111\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '3\\r\\n2010\\r\\n2011\\r\\n2012\\r\\n', 'output': ['1010\\r\\n1011\\r\\n1012\\r\\n']}, {'input': '5\\r\\n1901\\r\\n1166\\r\\n1308\\r\\n1037\\r\\n1808\\r\\n', 'output': ['1001\\r\\n1066\\r\\n1108\\r\\n1137\\r\\n1208\\r\\n']}, {'input': '5\\r\\n1612\\r\\n7835\\r\\n8183\\r\\n3368\\r\\n1685\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '10\\r\\n1501\\r\\n1617\\r\\n1368\\r\\n1737\\r\\n1800\\r\\n1272\\r\\n1019\\r\\n1545\\r\\n1035\\r\\n1302\\r\\n', 'output': ['1001\\r\\n1017\\r\\n1068\\r\\n1137\\r\\n1200\\r\\n1202\\r\\n1219\\r\\n1245\\r\\n1335\\r\\n1342\\r\\n']}, {'input': '10\\r\\n7577\\r\\n1411\\r\\n1864\\r\\n1604\\r\\n1589\\r\\n1343\\r\\n6832\\r\\n1648\\r\\n1222\\r\\n1832\\r\\n', 'output': ['1577\\r\\n1611\\r\\n1664\\r\\n1664\\r\\n1689\\r\\n1743\\r\\n1832\\r\\n1848\\r\\n1922\\r\\n1932\\r\\n']}, {'input': '10\\r\\n1110\\r\\n1278\\r\\n1283\\r\\n7758\\r\\n1183\\r\\n1214\\r\\n2970\\r\\n1398\\r\\n7515\\r\\n1005\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '15\\r\\n2003\\r\\n1991\\r\\n1741\\r\\n1348\\r\\n1258\\r\\n1964\\r\\n1411\\r\\n1431\\r\\n1780\\r\\n1701\\r\\n1787\\r\\n1094\\r\\n1108\\r\\n1074\\r\\n1942\\r\\n', 'output': ['1003\\r\\n1091\\r\\n1141\\r\\n1148\\r\\n1158\\r\\n1164\\r\\n1211\\r\\n1231\\r\\n1280\\r\\n1301\\r\\n1387\\r\\n1394\\r\\n1408\\r\\n1474\\r\\n1542\\r\\n']}, {'input': '20\\r\\n1749\\r\\n1792\\r\\n1703\\r\\n1011\\r\\n1289\\r\\n1066\\r\\n1947\\r\\n1354\\r\\n1693\\r\\n1806\\r\\n1645\\r\\n1292\\r\\n1718\\r\\n1981\\r\\n1197\\r\\n1471\\r\\n1603\\r\\n1325\\r\\n1057\\r\\n1552\\r\\n', 'output': ['1049\\r\\n1092\\r\\n1103\\r\\n1111\\r\\n1189\\r\\n1266\\r\\n1347\\r\\n1350\\r\\n1393\\r\\n1406\\r\\n1445\\r\\n1492\\r\\n1518\\r\\n1581\\r\\n1597\\r\\n1671\\r\\n1673\\r\\n1725\\r\\n1757\\r\\n1852\\r\\n']}, {'input': '20\\r\\n1639\\r\\n1437\\r\\n1054\\r\\n1010\\r\\n1872\\r\\n1942\\r\\n1315\\r\\n1437\\r\\n1226\\r\\n1893\\r\\n1712\\r\\n1024\\r\\n1410\\r\\n1691\\r\\n1188\\r\\n1056\\r\\n1642\\r\\n1100\\r\\n1893\\r\\n1192\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '20\\r\\n1025\\r\\n1000\\r\\n1026\\r\\n1085\\r\\n1354\\r\\n1783\\r\\n3490\\r\\n1512\\r\\n1553\\r\\n1682\\r\\n1695\\r\\n1654\\r\\n1679\\r\\n1304\\r\\n1574\\r\\n1814\\r\\n1854\\r\\n1804\\r\\n1928\\r\\n1949\\r\\n', 'output': ['1005\\r\\n1005\\r\\n1006\\r\\n1015\\r\\n1054\\r\\n1083\\r\\n1490\\r\\n1502\\r\\n1503\\r\\n1582\\r\\n1595\\r\\n1604\\r\\n1609\\r\\n1704\\r\\n1774\\r\\n1804\\r\\n1804\\r\\n1804\\r\\n1828\\r\\n1849\\r\\n']}, {'input': '20\\r\\n1011\\r\\n1157\\r\\n2181\\r\\n6218\\r\\n1766\\r\\n8319\\r\\n1364\\r\\n6428\\r\\n1476\\r\\n4417\\r\\n6618\\r\\n1629\\r\\n1747\\r\\n1786\\r\\n1787\\r\\n2830\\r\\n7671\\r\\n1953\\r\\n1275\\r\\n1099\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '50\\r\\n1230\\r\\n6040\\r\\n1035\\r\\n1973\\r\\n9096\\r\\n5133\\r\\n1146\\r\\n1164\\r\\n9195\\r\\n5211\\r\\n6212\\r\\n1313\\r\\n1953\\r\\n1560\\r\\n1382\\r\\n2324\\r\\n1343\\r\\n1481\\r\\n1555\\r\\n1363\\r\\n1487\\r\\n1414\\r\\n1525\\r\\n1564\\r\\n1561\\r\\n9585\\r\\n7590\\r\\n1663\\r\\n5625\\r\\n1630\\r\\n1630\\r\\n3644\\r\\n1164\\r\\n1665\\r\\n7678\\r\\n1282\\r\\n1626\\r\\n1798\\r\\n9755\\r\\n7801\\r\\n8809\\r\\n1762\\r\\n1867\\r\\n1861\\r\\n1826\\r\\n1809\\r\\n8902\\r\\n1033\\r\\n1774\\r\\n9978\\r\\n', 'output': ['1030\\r\\n1040\\r\\n1045\\r\\n1073\\r\\n1096\\r\\n1133\\r\\n1136\\r\\n1144\\r\\n1195\\r\\n1211\\r\\n1212\\r\\n1213\\r\\n1253\\r\\n1260\\r\\n1282\\r\\n1324\\r\\n1333\\r\\n1381\\r\\n1455\\r\\n1463\\r\\n1467\\r\\n1474\\r\\n1505\\r\\n1514\\r\\n1521\\r\\n1585\\r\\n1590\\r\\n1603\\r\\n1625\\r\\n1630\\r\\n1630\\r\\n1644\\r\\n1664\\r\\n1664\\r\\n1678\\r\\n1682\\r\\n1686\\r\\n1698\\r\\n1755\\r\\n1801\\r\\n1809\\r\\n1862\\r\\n1862\\r\\n1862\\r\\n1866\\r\\n1869\\r\\n1902\\r\\n1933\\r\\n1974\\r\\n1978\\r\\n']}, {'input': '10\\r\\n1014\\r\\n1140\\r\\n1692\\r\\n1644\\r\\n3647\\r\\n1716\\r\\n4821\\r\\n9839\\r\\n2882\\r\\n1664\\r\\n', 'output': ['1004\\r\\n1040\\r\\n1092\\r\\n1144\\r\\n1647\\r\\n1706\\r\\n1821\\r\\n1839\\r\\n1882\\r\\n1964\\r\\n']}, {'input': '10\\r\\n1075\\r\\n1133\\r\\n1393\\r\\n1350\\r\\n1369\\r\\n1403\\r\\n2643\\r\\n1653\\r\\n1756\\r\\n7811\\r\\n', 'output': ['1005\\r\\n1033\\r\\n1093\\r\\n1150\\r\\n1169\\r\\n1203\\r\\n1643\\r\\n1643\\r\\n1656\\r\\n1811\\r\\n']}, {'input': '10\\r\\n6025\\r\\n1522\\r\\n1835\\r\\n2142\\r\\n1414\\r\\n9547\\r\\n1456\\r\\n6784\\r\\n4984\\r\\n3992\\r\\n', 'output': ['1025\\r\\n1122\\r\\n1135\\r\\n1142\\r\\n1214\\r\\n1547\\r\\n1556\\r\\n1784\\r\\n1984\\r\\n1992\\r\\n']}, {'input': '10\\r\\n1074\\r\\n1547\\r\\n1554\\r\\n1581\\r\\n1170\\r\\n8683\\r\\n1434\\r\\n4750\\r\\n1866\\r\\n1051\\r\\n', 'output': ['1004\\r\\n1047\\r\\n1054\\r\\n1081\\r\\n1100\\r\\n1683\\r\\n1734\\r\\n1750\\r\\n1766\\r\\n1851\\r\\n']}, {'input': '10\\r\\n2008\\r\\n3007\\r\\n4066\\r\\n1017\\r\\n1920\\r\\n1113\\r\\n1317\\r\\n4746\\r\\n1972\\r\\n1598\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '10\\r\\n1171\\r\\n1275\\r\\n1680\\r\\n7300\\r\\n4742\\r\\n2517\\r\\n7980\\r\\n1852\\r\\n1993\\r\\n5004\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '2\\r\\n1999\\r\\n1000\\r\\n', 'output': ['1099\\r\\n1100\\r\\n']}, {'input': '2\\r\\n2004\\r\\n1000\\r\\n', 'output': ['1004\\r\\n1004\\r\\n']}, {'input': '2\\r\\n2099\\r\\n1000\\r\\n', 'output': ['1099\\r\\n1100\\r\\n']}, {'input': '12\\r\\n1000\\r\\n1002\\r\\n1021\\r\\n1006\\r\\n1001\\r\\n1036\\r\\n1038\\r\\n1039\\r\\n1098\\r\\n1097\\r\\n1029\\r\\n1053\\r\\n', 'output': ['1000\\r\\n1000\\r\\n1001\\r\\n1001\\r\\n1001\\r\\n1006\\r\\n1008\\r\\n1009\\r\\n1018\\r\\n1027\\r\\n1027\\r\\n1033\\r\\n']}, {'input': '2\\r\\n1011\\r\\n1000\\r\\n', 'output': ['1001\\r\\n1001\\r\\n']}, {'input': '3\\r\\n1012\\r\\n1101\\r\\n1000\\r\\n', 'output': ['1002\\r\\n1100\\r\\n1100\\r\\n']}, {'input': '3\\r\\n2000\\r\\n3999\\r\\n6011\\r\\n', 'output': ['1000\\r\\n1999\\r\\n2011\\r\\n']}]","id":172} {"difficulty":2600,"lang":"PyPy 2","lang_cluster":"Python","src_uid":"c23d3ec2b9fb4b4d169bc8053bfd000e","execute_outcome":"RUNTIME_ERROR","source_code":"SUSPICIOUS = -128\nNIL = 0\nADD = 1\nSUB = 2\nMUL = 4\nDIV = 8\nALL = 15\n\nop_value = {'+': ADD, '-': SUB, '*': MUL, '\/': DIV}\ninvalid = {NIL: (NIL, NIL),\n ADD: (NIL, NIL),\n SUB: (NIL, ADD | SUB), \n MUL: (ADD | SUB, ADD | SUB),\n DIV: (ADD | SUB, ALL)} \n\n\ndef validate(expr):\n global definitions\n\n ## Initialize validation variables\n last_op = 0\n operators = 0\n last_token = 0\n\n ## Initialize parsing variables\n token = \"\"\n paren_depth = 0\n\n ## Iterate the expression\n for c in expr:\n\n ## Handle sub-expressions\n if c == '(':\n #if paren_depth > 0:\n token += c\n paren_depth += 1\n\n elif c == ')':\n paren_depth -= 1\n\n ## No validation necessary\n ## (besides non-suspiciousness)\n if paren_depth == 0:\n if validate(token) == SUSPICIOUS:\n return SUSPICIOUS\n \n token = \"\"\n last_op = 0\n last_token = 0\n \n else:\n token += c\n\n ## Perform validation\n elif paren_depth == 0 and c in '*\/+-':\n ## Validate last_op + last_token\n if token != \"\":\n last_token = definitions.get(token, 0)\n if last_token == SUSPICIOUS or last_token & invalid[last_op][1]:\n return SUSPICIOUS\n\n token = \"\"\n\n ## Validate last_token + last_op\n if last_token & invalid[op_value[c]][0]:\n return SUSPICIOUS\n\n last_token = 0\n\n ## Update validation variables\n last_op = op_value[c]\n operators |= last_op\n\n else:\n token += c\n\n if token != \"\":\n last_token = definitions.get(token, 0)\n if last_token == SUSPICIOUS or last_token & invalid[last_op][1]:\n return SUSPICIOUS\n\n return operators\n\n\n\ndefinitions = {}\n\nn = input()\n\nfor i in range(n):\n line = raw_input().split()\n \n if line[0] == '#':\n head = line[2]\n line = line[3:]\n else:\n head = line[1]\n line = line[2:]\n\n definitions[head] = validate(\"\".join(line))\n \n #print head, bin(definitions[head])[2:]\n\n \nexpr = validate(\"\".join(raw_input().split()))\nprint \"Suspicious\" if expr == SUSPICIOUS else \"OK\"","description":"Most C\/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:#define macro_name macro_valueAfter the macro has been declared, \"macro_name\" is replaced with \"macro_value\" each time it is met in the program (only the whole tokens can be replaced; i.e. \"macro_name\" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A \"macro_value\" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.One of the main problems arising while using macros \u2014 the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.Let's consider the following example. Say, we declared such a #define construction:#define sum x + yand further in the program the expression \"2 * sum\" is calculated. After macro substitution is performed we get \"2 * x + y\", instead of intuitively expected \"2 * (x + y)\".Let's call the situation \"suspicious\", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a \"safe\" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise \u2014 suspicious.Note that we consider the \"\/\" operation as the usual mathematical division, not the integer division like in C\/C++. That's why, for example, in the expression \"a*(b\/c)\" we can omit brackets to get the expression \"a*b\/c\".","input_specification":"The first line contains the only number n (0\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the amount of #define constructions in the given program. Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax: #define name expression where name \u2014 the macro name, expression \u2014 the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*\/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109. All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction. Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions. The input lines may contain any number of spaces anywhere, providing these spaces do not break the word \"define\" or the names of constructions and variables. In particular, there can be any number of spaces before and after the \"#\" symbol. The length of any line from the input file does not exceed 100 characters.","output_specification":"Output \"OK\", if the expression is correct according to the above given criterion, otherwise output \"Suspicious\".","notes":null,"sample_inputs":["1\n#define sum x + y\n1 * sum","1\n#define sum (x + y)\nsum - sum","4\n#define sum x + y\n#define mul a * b\n#define div a \/ b\n#define expr sum + mul * div * mul\nexpr","3\n#define SumSafe (a+b)\n#define DivUnsafe a\/b\n#define DenominatorUnsafe a*b\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)"],"sample_outputs":["Suspicious","OK","OK","Suspicious"],"human_solution":"#!\/usr\/bin\/env python\n\n\"\"\"\nCodeForces: 7E. Defining Macros\n\nThe key for the solution is the naked operators that are not surrounded by\nthe parentheses in the macro definition.\n\nSuspicious patterns of the operators in the appearance order are:\n\n o{-} n{+-}\n o{*} n{+-}\n o{\/} n{+-*\/}\n n{+-} o{*}\n n{+-} o{\/}\n\nwhere:\n \"o{}\": an operator before or after the macro might construct\n a suspicious expression with the operators in \"n{}\"\n \"n{}\": a subset of the naked operators in the macro definition\n that might construct a suspicious expression with the operator \"o\"\n\nIf the pair of operators in the \"o{}\" and \"n{}\" are matched\nin the expression, the entire expression would be suspicious.\n\"\"\"\n\n# Represent the operator as the bit mask:\n# Pseudo operator whose priority is lower than \"+\",\n# Add (+), Subtract (-), Multiply (*) and Division (\/)\nP, A, S, M, D = 1, 2, 4, 8, 16\nADD = A | S\nANY = A | S | M | D\n# Map of the operators (+-*\/) to the bit mask\nOP_BIT = {\"+\": A, \"-\": S, \"*\": M, \"\/\": D, \")\": 0}\n# unsafe naked operators against the operator before and after the macro\nUNSAFE_BEFORE = {P: 0, A: 0, S: ADD, M: ADD, D: ANY}\nUNSAFE_AFTER = {P: 0, A: 0, S: 0, M: ADD, D: ADD}\n\n# Macro definitions:\n# a map from the macro name to the set of its naked operators\n# Note: the set is represented as a bit pattern\nmacro = dict()\n\n\n# Parse expression with checking suspicious expression\ndef expr(chars,\n # following arguments are the short cut\n pseudo=P,\n expand=macro.get,\n op_bit=OP_BIT,\n unsafe_before=UNSAFE_BEFORE,\n unsafe_after=UNSAFE_AFTER):\n # stack of the operator before the left parenthesis \"(\"\n paren = []\n push = paren.append\n pop = paren.pop\n # list of characters that would be a macro name or a number\n name = []\n keep = name.append\n forget = name.clear\n\n # last_op: last operator before the macro name or the number\n # retval: set of the naked operators of this expression\n # naked: set of the naked operators of the macro expanded\n last_op = retval = naked = pseudo\n\n # expand the macro and check the preceding operator\n def safe():\n nonlocal naked\n naked = expand(\"\".join(name), pseudo)\n forget()\n # early exit for a suspicious expression and a value\n if naked <= pseudo:\n return naked\n # safety check against the operator before the macro\n return not (unsafe_before[last_op] & naked)\n\n # parse the expression\n for c in chars:\n if c == \"(\":\n push(last_op)\n last_op = pseudo\n elif c not in op_bit:\n keep(c)\n elif not safe():\n return 0\n elif c == \")\":\n last_op = pop()\n else:\n # safety check against the operator after the macro\n last_op = op_bit[c]\n if unsafe_after[last_op] & naked:\n return 0\n # record operators not surrounded by the parentheses\n if not paren:\n retval |= last_op\n\n if name and not safe():\n return 0\n return retval\n\n\ndef main():\n global macro\n\n def chars(b, t):\n for k in range(b, len(t)):\n yield from t[k]\n\n for _ in range(int(input())):\n token = input().split()\n s = token[0] == \"#\"\n macro[token[1 + s]] = expr(chars(2 + s, token))\n\n print(\"OK\" if expr((c for c in input() if c != \" \")) else \"Suspicious\")\n\n\n\nif __name__ == '__main__':\n main()\n","testcases":"[{'input': '1\\r\\n#define sum x + y\\r\\n1 * sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum (x + y)\\r\\nsum - sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum x + y\\r\\n#define mul a * b\\r\\n#define div a \/ b\\r\\n#define expr sum + mul * div * mul\\r\\nexpr\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define SumSafe (a+b)\\r\\n#define DivUnsafe a\/b\\r\\n#define DenominatorUnsafe a*b\\r\\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '0\\r\\naa + b - c * (ddd * eee \/ fff * a \/ b * c + d - b + c - (a + b)) - d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define a b\\r\\n#define c d\\r\\na + b + c + d + 1234567 -10*(2-2+1000*1000*1000*1000*1000)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define macros ( x + y ) \\r\\n # define Macros (x+y)\\r\\nmacros\/Macros\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/(a)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define a x*y\\r\\nc\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define a b*c\\r\\na\/a*a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define mul x*y\\r\\n#define bad x\/mul\\r\\n#define good x\/(mul)\\r\\ngood\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define mult a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum+difference+(sum)*(difference)-mult+mult*division+division*mult+division\/(mult+sum-(difference))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference\/division)+sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference)*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(sum)\/multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum\/(multiplication)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n#define res (0-difference)\\r\\nsum+res*multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\ndivision\/(multiplication\/(division)\/DIVISION\/(sum-division-multiplication-(difference)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define sum x + y\\r\\n#define SomeBad (2 * sum)\\r\\n#define SomePossiblyGood 0 * SomeBad + (x + x - 2*x) * SomeBad\\r\\nSomePossiblyGood\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define a 0\\r\\n#define b (a-a)*(x\/x-1)\\r\\nb-b\/b*b\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define fkdsjfslkjfsdk x\/0\\r\\n#define fkdsjfslkjfsdksdds 0\/(0-0)\\r\\nfkdsjfslkjfsdk + fkdsjfslkjfsdks + fkdsjfslkjfsdkssds\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define null x\/0\\r\\n#define some x\/x\\r\\n#define bad 1\/x\\r\\nbad\/0+0\/bad+0\/0*bad\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define MWjGY x+x*53 *x\\r\\n#define ovqZ 2\/926+x\/A\\r\\n#define uU 55-qRj*A*2\\r\\nx*A\/x-A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define zz 5+7\/x*x*9\\r\\n#define mlTL 6+x\/7+x\/x\\r\\n#define DUO 7*7-x+zz\\r\\n#define IH 6*4-x+x\\r\\n67\/(5)-IH\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Oc 9\/51+65+vN\\r\\n#define gga 53\/ 94\/x\/x\\r\\n#define ArB x\/x\/9-77-8\\r\\n#define j 76-6\/93+vN\\r\\n#define cALNN Oc+60499\\r\\n8*6-66\/x*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define fSdvwOj (W)*W+73\\r\\n#define NAZjc 7695*55-x\\r\\n#define AHGGglVwch (6-a-W)\\r\\n((5))+W+W\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define m bJJD +x \\r\\n#define yYkQNzjR (x*19)-892\\r\\n#define MNvfxqfbq (x-6*x\/8)\\r\\n#define nJZdvO 8\/4 *m\/m\\r\\n 9+m\/x+x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Sl x*7-(x)\/O\\r\\n#define srAOHccTln 3+x*2*O\\r\\n#define OFAZk 239751817\\r\\n#define JYWrOEgazV (x-O\/4)-x\\r\\n#define XsOZvalgOh 89905879\/7\\r\\nx\/Sl-(Sl)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define uYdw ((9-x-3) )\\r\\n#define fy (((x+21)))\\r\\n#define nY ((2+x)-46)\\r\\n141141432\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define GCvqH (58 )-(x)\\r\\n#define g ((x\/x+x))\\r\\n#define spst hQTJ\\r\\n#define i GCvqH\\r\\n(((x+6)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define rg (67)+((x))\\r\\n#define ya x-(6\/x)*rg\\r\\n#define anTxe 10*ya*(x)\\r\\n#define xcmo ((x)*(vT))\\r\\n#define eg ((vT)) -ya\\r\\n((x*(Ii)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define T ((b\/1 +1))\\r\\n#define pm (s)-43-(s)\\r\\n#define jkNBpvDZl ((x ))\/65\\r\\n(((58*7)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define cJitUt 21\/(4)+4+4\\r\\n#define zHwBOLIvF 4*((41\/x))\\r\\n#define GbtYVo (E)+(x+3)\\r\\n#define zTcZBaby (58)+x-x+x\\r\\n(E+E)\/8 *4\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define mBURKdeKvy 266693986\\r\\n#define nWi ( ((x))-4)\\r\\n#define iYreeOt ((7\/x+42))\\r\\n#define laLzP ((aB\/35)) \\r\\n#define dXjRJ (((B*hX)))\\r\\n(1*2+(67))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define UVMQLGvEqOxaAgRkvJH tBd\\r\\n#define QoAsBMaUcJzXai x\/x-hm\/83+8*8\/5\/hm \/x\/hm\\r\\n#define QtxtzEHCmidm 75 +491928441\\r\\n((x)\/VUpYoEdDUtLFanGyqfQR )\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define efemx 2\/1*3*69+81+10\/690445104\\r\\n#define AyjrEzAjMKZpRPfCOaO 21*9+( j*40+3*4)*ND+w-j*j+x*55\\r\\n#define YkJkHcNhXcci 85*3215\/40\/365819568\\r\\n#define MUzvOZSXJujI 9-4\/j*j-7-w*23*5+j+9-9*ND*2\/37\\r\\nND\/j*28 -1* ND+22889023\/j\/j\/j\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define QNUkjqPcGWF 6*4\/908975666-7\/10-x*7\\r\\n#define xqwhNWiiMaZOcmgiXYY 3936*(e*5*H+2)-TsA+(e)\/1-25\\r\\n#define tRsSqfqJt ((uT*82\/e)+e\/(23+(45)-9)+(50))\\r\\n#define DtIOWRkYe (8*3\/9)*e*x *60041512*2-(e)\\r\\n#define qgPgxja (4\/x+e\/uT*16358009- 6\/13*5)\\r\\ne+x*e\/84\/x+uT*H\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define lTCUUO JQmj\\r\\n#define oUeQMB (12*x+x+x)-75-(79\/1)-(7)*1\/mr\\r\\n#define LAQu xwvBtky\\r\\n8654 *1*5-mr-3*J\/oUeQMB\/x\/6\/9\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define VLuQIO 1-x\/33+ Fk+wS\/35-wS-(x*iz )\\r\\n#define BCIsIR 5*(wS)\/x\/iz\/1+x-x-4-x\/68\/x\/8*x\\r\\n#define QPUpmTiB 21-x\/895912506+2\\r\\n#define wcZLUIqJS 7\/65-x*61-(24+iz)+x+315670+x\/x\\r\\nBCIsIR\/VLuQIO\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define FDmMYOENCOKmYwYlOl 6-(L)\/((((ud\/x))\/ud-26*8-5))\\r\\n#define QkopKBjKdJxhc (6)*4\/7-L\/781844832 \\r\\n#define UjgTieUBXTSTbiLFAhkV 3*1*(52)\/6-6*65\/x+((L-56))+x+x\\r\\n#define yWVYDuqliezpKLwnI 8\/4+1+88+97946+(1)-((68))-L\/L\\r\\n#define AvvED 719901121+95\/2\/78\/1-10+37\\r\\n(1*x+ 528176190+17\/ud)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define e x *R\/5+(x)+4\/18\/x*R\/x-8+1+R\\r\\n#define GgGqGYjXoJjIezAVu (( 491563947*R))*9-e-3\/4\\r\\n#define XgznGUWMxQwh (8\/R+4*(e)+10\/4*x+24*R+21)-224\\r\\n (82493582)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define MrKSTrKhPLeJqOcEPvv (x+x\/x)\/Qdf-x-x-(2\/23)+9442-x\\r\\n#define zPHUgmIYE 10- 7*x\/x+VwRUuIRezDR*80\\r\\n#define OsfThxasHeFZCEZTfD 271456028-(x*x)-8+2*x*x*x+(x)\\r\\n#define zVYasB x\/x -x-(51)-x*x*((x)) \/x \\r\\n(x\/64-x*( (5+x+x)-(37)\/3*22))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WREol (fcdGZaLzhiFpVQmhHO)\\r\\n#define lDTNxcMqPPP 3+(57)\/x\/91540-x*71-x*6-((1))\\r\\n#define afFJVBkr ((12*x-8+9 *lDlx+7+lDlx))\\r\\n#define mYEizEWrNtRSQNCcDQrn 732480960+9+x-78-x\/1+12*x\\r\\n#define IZTmjheAahbNSNFa ((x-x*7+407643063 ))\\r\\nXQvMxLNpQnhpimNhAkfX\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define Mc x+x*55231- x\/x\/x+35\/x*(5*(x)) -5*x*(1-2-(29\/1))\\r\\n#define afSVLCdjvylSu bgqv\/6+4*x*((Mc\/1318\/x-8-4)-Mc\/Mc\/(9))\\r\\n#define ZOSV (1+2\/x+6* 174806683)-x\/x*Mc+52*x-x\\r\\nbgqv-x-6*x\/72\/(x )\/afSVLCdjvylSu\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RJIiiGQqn dmpWFcrqQeM+V-o* 55\/9*o-o\/V*V*o\\r\\n#define ElDZlrtzDkeKgsX 498718105* 3\/(y)\/(4)-(5*x)*1\\r\\n#define qwKl jHqPHX\\r\\n#define qXzAZkCuchBYR (qy*qwKl-6+5*1+2)-7-3+(38)-o*4\/4-1-V*x\/6+1*x\/o\\r\\no*((V))-o+2+((((2*V)\/V-o*V\/4)))\/o*33+y\/7 -x+x \\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WTovyGexUNjGMRJv (MQG*18-6)\/x\/x*x\/x-x*akNyw*x+x-x\/2\/x*20\\r\\n#define hpextyhVCa 70*x\/67-x*87931-(497612505-7*x-MQG)-x\\r\\n#define MRkKnCXFt x-5-21962-x\/sOmThNSS\/x\/6-4+(65+57+x+x+7-7+x\/x)\\r\\n#define ajsczBLLklBSqqh nGj-38*9 *x\/47\/8*5\/5-72\/x*x-x*x*31 \/7-44-3+64\\r\\n#define jgqfv WTovyGexUNjGMRJv\\r\\n 4+338\/x*x+13 -795*3-74*2\/4+563-x\/76401438\/83025\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define G u+13-35348\/2-(u\/u)-u\/u*u*(OC)-OC -u-u\/u*u\/9 \\r\\n#define RNRQ G*G*u+G\/755750\/G\/G +((u-6*G+6)*2)- 5*96+5\/u*275-u\\r\\n#define Zg 94363\/u*u-41+Gm*G-81\/5-1-G*G*x-(5517*5\/4)*21 +75\\r\\n406690013\/WM*G+(u+u)*Zg+2\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RMWAZhIp x*x+12+94*12*5*1-x-141915293\\r\\n#define EeguG 9-55+x\/29+x+x\/E*8*81\/x-x*75-4*17-81\/x\/6+619978*x*x\\r\\n#define HvUYEvQTyYmBGvqHSb 454574730\/644135926*x\/23+E-sy\/14\\r\\n#define BqMGcT x\/(43)+819897061-x*(7\/x)-(x)+sy-E-x*79-E+(x)\/6\/63\\r\\n76+3\/x\/8*x+E-76+sy-sy+9*6\/66\/sy-77+x-x*sy+E\/50\/64\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define cbt ((((d))+9-3+ (d)\/d\/6*SDDNqj*50\/d+d-m+8\/d\/1)) \\r\\n#define gLrUE 18+ 70*d\/3-d*d-d\/35 +33-5\/9+d-d*387+d-1\\r\\n#define AvjmK 9-d-8+(d+m+5\/2\/x*d+1)\/x\/d-5-2*(m)+d+17\/d+ 4\/52\/8\\r\\n#define SjrJ 90\/7\/5\/d+ 254877982+(m) *x-19\\r\\n#define PlykoqfDbwxR 540304590 +d*x\/11-(m+d-d-4)*(d-3-1)\/d\\r\\nd-2+1+46-29620+9-(9*3 \/d)*6*m\/d+9+(1670)\/cbt\/d+d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define BuAiJLgAlkj x-3+419032556\/409023036-(17*84)+x+8+A\\r\\n#define wU 516506880\\r\\n#define HeyDGlnaGxBaHjzelvF iRSPqHfgHw\/4-(99)*(I)+A+I-9*46*x\\r\\nI\/CRklg-HeyDGlnaGxBaHjzelvF\/3+5 \\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define SOlTohcPGckDyF ((D)\/G-83+KHGSuJFLHqD\/5)\\r\\n#define KEUXeOYpg 9+x-8-8\/x\/9-65-6+4+55*x-58\/x+84+D*2-7+D\/x-x*G\/4-2\\r\\n#define YZl (1\/67*x*6\/2*G)-D\/1595107*D+6\/x*1+D+3\/9\/x\/26-6+9 \\r\\n#define gCatFsZn uBBqilYclMhpVfKKTkGK\\r\\n(28682537+ YZl*(4*52) )*x\/8- gCatFsZn*x\/54\/7\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define iiXEqDYeyVmIYsOaO fj\/x-9-6\/x*x+ 1\/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x\/70\\r\\n#define XVgLzhoTUxoBr ( x+x\/x\/x*6-x)* x+K\/24206-2 \/5\/8-x-7\/Ww\/K-x+6 \\r\\n#define QdfRBaJk 470551685-( 54-x)-30\\r\\n#define gEJcAGnF x+x-x+(x\/x+9)\/x-41-1\/fj\/1157561+x\/x -x\/26\/x+K*x\\r\\n#define lO 7-1*(x*58 )-K*fj \/722113691\/x\/K+2\\r\\n2+4*85\/86\/x*27 \/49252-x*x\/6-83-7\/x+x+K-lO+8-K-x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define x 3\/2\\r\\n2*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define sum 1000000000 + 1000000000 + 1000000000 \\r\\n # define a b + 45 * sum \\r\\n a \\r\\n', 'output': ['Suspicious\\r\\n']}]","id":173} {"difficulty":1600,"lang":"PyPy 3","lang_cluster":"Python","src_uid":"c4b7265ff4332225c0d5617c3233a910","execute_outcome":"RUNTIME_ERROR","source_code":"f = lambda: list(map(int, input().split()))\nn, p, d = f()[0], f(), f()\nc = list(range(n))\ndef g(x):\n if c[x] != x: c[x] = g(c[x])\n return c[x]\nfor x, k in zip(c, d):\n if x >= k: c[g(x)] = g(x - k)\n if x < n - k: c[g(x)] = g(x + k)\nprint('YES' if all(g(x) == g(y - 1) for x, y in zip(c, p)) else 'NO')","description":"One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exchange it's value with the value of some other j-th cell, if |i\u2009-\u2009j|\u2009=\u2009di, where di is a favourite number of i-th cell. Cells make moves in any order, the number of moves is unlimited.The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to n. You are to determine whether the game could move to this state.","input_specification":"The first line contains positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of cells in the array. The second line contains n distinct integers from 1 to n \u2014 permutation. The last line contains n integers from 1 to n \u2014 favourite numbers of the cells.","output_specification":"If the given state is reachable in the described game, output YES, otherwise NO.","notes":null,"sample_inputs":["5\n5 4 3 2 1\n1 1 1 1 1","7\n4 3 5 1 2 7 6\n4 6 6 1 6 6 1","7\n4 2 5 1 3 7 6\n4 6 6 1 6 6 1"],"sample_outputs":["YES","NO","YES"],"human_solution":"n = int(input())\ndata = list(map(int, input().split()))\nspans = list(map(int, input().split()))\n\nconnect = [[False for c in range(n)] for r in range(n)]\nfor p, span in enumerate(spans):\n for r in [p-span, p+span]:\n if r >= 0 and r < n:\n connect[p][r] = connect[r][p] = True\n\ndef visit(data, connect, seen, group, i):\n if not seen[i]:\n seen[i] = True\n group.append((i, data[i]))\n for j in range(n):\n if connect[i][j]:\n visit(data, connect, seen, group, j)\n\nseen = [False for i in range(n)]\nfor i in range(n):\n group = []\n visit(data, connect, seen, group, i)\n group.sort()\n #print()\n #print(group)\n values = sorted([value for (index, value) in group])\n #print(values)\n for i, value in enumerate(values):\n data[group[i][0]] = value\n #print(data)\n\nif data == list(range(1, n+1)):\n print('YES')\nelse:\n print('NO')\n","testcases":"[{'input': '5\\r\\n5 4 3 2 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7\\r\\n4 3 5 1 2 7 6\\r\\n4 6 6 1 6 6 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7\\r\\n4 2 5 1 3 7 6\\r\\n4 6 6 1 6 6 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n3 2 1 4 6 5\\r\\n3 6 1 6 6 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n3 5 1 4 6 2\\r\\n3 6 1 6 6 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 2 3 4\\r\\n1 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '71\\r\\n1 63 3 4 5 6 7 8 9 44 29 12 13 14 55 34 42 18 52 20 21 33 23 24 25 26 27 28 19 30 47 32 15 71 37 36 69 38 39 40 41 17 43 10 45 58 35 48 49 11 51 50 53 54 22 56 57 46 59 60 61 62 2 64 65 66 67 68 31 70 16\\r\\n21 45 8 62 56 53 25 22 65 34 39 43 30 63 18 18 25 10 31 64 70 33 49 70 34 21 69 25 21 4 38 41 4 36 4 28 6 48 6 25 57 11 62 48 62 69 12 14 12 70 41 2 49 30 40 37 67 12 13 22 50 35 61 42 33 30 10 47 10 65 37\\r\\n', 'output': ['YES\\r\\n']}, {'input': '76\\r\\n44 47 38 4 31 6 33 8 50 69 35 26 73 14 74 16 41 9 59 75 46 7 23 52 58 10 17 49 29 64 42 19 12 36 65 34 3 37 39 1 30 76 27 2 22 55 61 48 24 5 54 11 51 28 68 18 57 60 56 71 63 25 15 66 62 32 67 53 43 70 45 72 13 40 20 21\\r\\n54 63 9 55 65 59 4 1 42 31 63 5 28 26 19 35 50 21 39 23 40 64 45 36 74 74 70 67 53 20 19 27 13 2 71 62 6 51 2 65 61 58 55 55 32 75 54 75 48 45 40 45 7 43 72 75 54 9 32 52 8 36 33 59 57 58 68 32 71 21 63 69 7 40 28 68\\r\\n', 'output': ['NO\\r\\n']}, {'input': '82\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 59 17 18 19 20 21 22 23 24 25 26 27 28 29 61 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 16 60 30 79 63 64 65 66 67 68 69 70 71 72 73 74 75 76 82 78 62 80 81 77\\r\\n8 79 66 53 45 15 70 17 53 28 30 70 14 49 51 43 45 14 27 30 37 51 29 55 6 5 24 6 61 31 64 47 71 60 79 64 28 64 17 38 11 13 3 72 24 70 16 14 30 72 52 33 31 71 32 66 29 45 55 32 48 14 63 60 50 50 61 2 47 26 4 26 72 3 56 19 1 47 17 26 66 5\\r\\n', 'output': ['YES\\r\\n']}, {'input': '13\\r\\n13 1 12 4 6 10 7 8 9 3 11 5 2\\r\\n6 12 12 7 11 7 10 3 1 5 2 2 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n1 3 2 4 5\\r\\n1 4 1 2 4\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10\\r\\n6 2 9 4 8 7 5 10 3 1\\r\\n2 9 7 9 4 5 1 5 3 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '68\\r\\n1 2 3 46 5 6 7 8 9 63 11 57 13 14 15 16 40 18 19 20 21 22 23 24 25 26 27 28 29 35 31 32 33 34 30 36 37 64 39 17 41 12 43 52 58 4 47 44 49 50 51 48 53 54 55 56 42 59 45 60 61 62 10 38 65 66 67 68\\r\\n13 48 67 55 4 39 47 8 4 35 50 28 28 30 63 60 52 29 2 33 48 57 40 43 25 34 62 50 60 5 3 66 32 15 7 51 51 26 47 23 67 30 27 53 40 42 5 4 60 67 11 4 31 10 62 46 45 13 14 13 24 66 53 25 22 60 14 42\\r\\n', 'output': ['YES\\r\\n']}, {'input': '52\\r\\n17 35 19 41 21 51 46 45 13 10 15 43 37 30 34 12 39 20 14 48 49 3 23 6 4 26 47 18 16 5 31 36 27 29 24 11 52 38 33 42 1 8 9 32 44 7 28 22 40 50 2 25\\r\\n47 6 50 13 49 22 17 18 3 11 2 43 35 8 25 38 19 41 17 5 7 8 10 51 17 30 34 48 41 8 46 10 11 45 15 28 42 32 37 33 43 31 38 13 43 19 32 19 2 47 42 46\\r\\n', 'output': ['NO\\r\\n']}, {'input': '50\\r\\n5 2 4 31 1 10 44 24 9 38 20 27 35 14 37 46 8 18 41 34 7 22 25 45 32 43 6 47 39 15 26 48 30 23 16 36 17 21 50 40 3 11 12 19 42 29 28 49 33 13\\r\\n27 15 18 20 19 23 49 18 28 32 29 2 16 23 23 2 17 25 27 43 32 31 11 3 49 46 22 44 14 48 35 15 32 35 2 49 10 22 5 36 49 16 43 46 33 11 31 15 45 23\\r\\n', 'output': ['NO\\r\\n']}, {'input': '60\\r\\n1 2 17 4 27 6 43 26 32 10 11 12 29 14 15 16 3 44 56 20 21 22 53 24 25 8 5 28 58 7 31 9 33 57 48 36 37 38 39 30 41 50 40 35 45 46 13 18 47 55 51 52 23 54 42 19 34 49 59 60\\r\\n59 25 14 52 1 24 36 16 42 8 59 22 41 47 49 33 36 35 37 30 25 6 30 8 50 2 25 3 29 10 52 20 8 45 13 43 53 45 10 33 54 53 47 26 32 4 2 38 33 45 19 4 56 22 13 40 45 45 24 14\\r\\n', 'output': ['YES\\r\\n']}, {'input': '79\\r\\n1 2 3 67 5 6 7 60 9 71 63 12 31 57 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 64 32 79 34 35 45 37 38 39 40 41 42 43 44 36 46 47 48 11 50 51 52 74 54 55 56 14 58 59 8 61 62 49 13 65 66 4 68 72 70 10 69 73 53 75 76 77 78 33\\r\\n17 46 68 35 48 11 78 40 65 61 52 45 51 66 13 56 53 63 61 43 22 60 13 67 34 16 64 19 11 27 33 8 9 1 68 9 17 62 65 23 50 1 55 20 70 61 65 55 38 47 9 45 55 70 39 31 43 47 40 52 20 5 20 75 25 25 63 2 36 12 60 3 35 21 78 38 39 25 46\\r\\n', 'output': ['YES\\r\\n']}, {'input': '80\\r\\n39 2 33 16 36 27 65 62 40 17 44 6 13 10 43 31 66 64 63 20 59 72 9 24 12 29 77 47 71 79 50 32 55 4 35 60 7 69 14 54 3 42 15 11 75 22 28 30 49 18 46 56 51 68 5 38 25 58 73 26 61 21 37 80 19 45 53 1 70 67 23 52 41 74 34 76 57 8 48 78\\r\\n6 23 42 42 13 72 14 45 66 76 74 44 49 10 14 64 17 15 4 68 14 34 42 56 50 65 17 52 15 26 1 42 27 22 6 52 25 47 76 45 48 67 18 44 74 48 62 58 59 79 13 5 12 14 5 13 51 21 57 59 49 43 8 34 7 16 34 29 38 74 40 72 18 46 47 43 2 4 17 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '8\\r\\n5 2 3 4 8 6 1 7\\r\\n6 7 7 7 7 7 2 7\\r\\n', 'output': ['YES\\r\\n']}, {'input': '17\\r\\n1 11 3 4 5 6 7 8 9 10 2 12 13 14 15 16 17\\r\\n13 9 16 5 16 12 11 4 4 7 12 16 2 7 14 6 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '19\\r\\n7 2 17 18 4 16 1 9 12 10 8 11 6 13 14 19 3 5 15\\r\\n12 4 9 1 13 18 14 10 18 2 17 16 12 3 16 6 5 7 7\\r\\n', 'output': ['NO\\r\\n']}, {'input': '47\\r\\n1 32 29 9 47 6 8 36 37 10 11 16 2 14 38 40 15 44 19 35 18 22 23 12 17 41 5 31 26 25 4 27 33 34 42 7 24 28 45 20 46 13 43 30 21 3 39\\r\\n38 28 41 46 28 20 36 9 4 10 44 28 9 39 12 36 32 38 43 3 13 33 34 35 22 23 1 4 39 2 11 34 20 19 25 13 20 26 45 36 36 43 45 13 31 9 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1\\r\\n1\\r\\n1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n1 1\\r\\n', 'output': ['YES\\r\\n']}]","id":174} {"difficulty":1700,"lang":"Python 3","lang_cluster":"Python","src_uid":"d5fbb3033bd7508fd468edb9bb995d6c","execute_outcome":"RUNTIME_ERROR","source_code":"from heapq import *\nINF = 1e16\nviajantes = []\n\nN,M = map(int,input().split())\n\ngalaxia = [[] for i in range(100002)]\ntempo = [INF] * (N+1)\n\n\nfor i in range(M):\n a,b,c = map(int,input().split())\n galaxia[a] += [(c,b)]\n galaxia[b] += [(c,a)]\n\nfor j in range(N):\n vi = list(map(int,input().split()))\n viajantes.append(vi[1::])\n\ndef visitante_chegando(w,a):\n for x in viajantes[a-1]:\n if x == w:\n w += 1\n return w\n\ndef dijsktra(u,v,galaxia):\n tempo[u] = 0\n q = [(0,u)]\n\n while q:\n z,a = heappop(q)\n #a[0] = dist\u00e2ncia\n #a[1] = vertice\n #tempo[a[1]] melhor tempo que cheguei em a[1]\n #if a[0] == tempo[a[1]]:\n if z <= tempo[a]:\n w2 = tempo[a]\n w2 = visitante_chegando(w2,a)\n for adj in galaxia[a]:\n w,b = w2 + adj[0],adj[1]\n print(w)\n if w < tempo[b]:\n tempo[b] = w\n heappush(q,(tempo[b],b))\n return tempo\n\n\nd = dijsktra(1,N,galaxia)\nif d[-1] == INF:\n print(-1)\nelse:\n print(d[N])\n","description":"Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n planets, indexed with numbers from 1 to n. Jack is on the planet with index 1, and Apophis will land on the planet with index n. Jack can move between some pairs of planets through stargates (he can move in both directions); the transfer takes a positive, and, perhaps, for different pairs of planets unequal number of seconds. Jack begins his journey at time 0.It can be that other travellers are arriving to the planet where Jack is currently located. In this case, Jack has to wait for exactly 1 second before he can use the stargate. That is, if at time t another traveller arrives to the planet, Jack can only pass through the stargate at time t\u2009+\u20091, unless there are more travellers arriving at time t\u2009+\u20091 to the same planet.Knowing the information about travel times between the planets, and the times when Jack would not be able to use the stargate on particular planets, determine the minimum time in which he can get to the planet with index n.","input_specification":"The first line contains two space-separated integers: n (2\u2009\u2264\u2009n\u2009\u2264\u2009105), the number of planets in the galaxy, and m (0\u2009\u2264\u2009m\u2009\u2264\u2009105) \u2014 the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1\u2009\u2264\u2009ai,\u2009bi\u2009\u2264\u2009n, ai\u2009\u2260\u2009bi), which are connected through stargates, and the integer transfer time (in seconds) ci (1\u2009\u2264\u2009ci\u2009\u2264\u2009104) between these planets. It is guaranteed that between any pair of planets there is at most one stargate connection. Then n lines follow: the i-th line contains an integer ki (0\u2009\u2264\u2009ki\u2009\u2264\u2009105) that denotes the number of moments of time when other travellers arrive to the planet with index i. Then ki distinct space-separated integers tij (0\u2009\u2264\u2009tij\u2009<\u2009109) follow, sorted in ascending order. An integer tij means that at time tij (in seconds) another traveller arrives to the planet i. It is guaranteed that the sum of all ki does not exceed 105.","output_specification":"Print a single number \u2014 the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1.","notes":"NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack moves to planet 2, and then \u2014 to planet 4, then he spends a total of only 2\u2009+\u20095\u2009=\u20097 seconds.In the second sample one can't get from planet 1 to planet 3 by moving through stargates.","sample_inputs":["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0","3 1\n1 2 3\n0\n1 3\n0"],"sample_outputs":["7","-1"],"human_solution":"from heapq import *\nINF = 1e16\nviajantes = []\n \nN,M = map(int,input().split())\n \ngalaxia = [[] for i in range(100002)]\ntempo = [INF] * (N+1)\n \n \nfor i in range(M):\n a,b,c = map(int,input().split())\n galaxia[a] += [(c,b)]\n galaxia[b] += [(c,a)]\n \nfor j in range(N):\n vi = list(map(int,input().split()))\n viajantes.append(vi[1::])\n \ndef visitante_chegando(w,a):\n for x in viajantes[a-1]:\n if x == w:\n w += 1\n return w\n \ndef dijsktra(u,v,galaxia):\n tempo[u] = 0\n q = [(0,u)]\n \n while q:\n z,a = heappop(q)\n #a[0] = dist\u00e2ncia\n #a[1] = vertice\n #tempo[a[1]] melhor tempo que cheguei em a[1]\n #if a[0] == tempo[a[1]]:\n if z <= tempo[a]:\n w2 = tempo[a]\n w2 = visitante_chegando(w2,a)\n for adj in galaxia[a]:\n w,b = w2 + adj[0],adj[1]\n #print(w)\n if w < tempo[b]:\n tempo[b] = w\n heappush(q,(tempo[b],b))\n return tempo\n \n \nd = dijsktra(1,N,galaxia)\nif d[-1] == INF:\n print(-1)\nelse:\n print(d[N])\n \n\t","testcases":"[{'input': '4 6\\r\\n1 2 2\\r\\n1 3 3\\r\\n1 4 8\\r\\n2 3 4\\r\\n2 4 5\\r\\n3 4 3\\r\\n0\\r\\n1 3\\r\\n2 3 4\\r\\n0\\r\\n', 'output': ['7\\r\\n']}, {'input': '3 1\\r\\n1 2 3\\r\\n0\\r\\n1 3\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2 3\\r\\n0\\r\\n1 3\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 1\\r\\n1 2 3\\r\\n1 0\\r\\n0\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 3\\r\\n1 2 5\\r\\n2 3 6\\r\\n1 3 7\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['7\\r\\n']}, {'input': '3 3\\r\\n1 2 3\\r\\n2 3 2\\r\\n1 3 7\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 0\\r\\n0\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1 2 3\\r\\n1 1\\r\\n1 5\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2 3\\r\\n0\\r\\n2 2 4\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 1\\r\\n1 2 1\\r\\n0\\r\\n0\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1\\r\\n2 1 10000\\r\\n0\\r\\n0\\r\\n', 'output': ['10000\\r\\n']}, {'input': '2 1\\r\\n1 2 3\\r\\n0\\r\\n3 3 4 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '3 0\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 2\\r\\n1 2 5\\r\\n2 3 7\\r\\n2 0 1\\r\\n3 4 5 6\\r\\n3 11 12 13\\r\\n', 'output': ['14\\r\\n']}, {'input': '2 1\\r\\n1 2 3\\r\\n3 0 1 2\\r\\n3 5 6 7\\r\\n', 'output': ['6\\r\\n']}, {'input': '3 3\\r\\n1 2 3\\r\\n2 3 2\\r\\n1 3 7\\r\\n0\\r\\n4 3 4 5 6\\r\\n0\\r\\n', 'output': ['7\\r\\n']}, {'input': '6 7\\r\\n1 2 1\\r\\n1 3 8\\r\\n2 4 2\\r\\n4 3 3\\r\\n3 5 4\\r\\n4 6 100\\r\\n5 6 5\\r\\n0\\r\\n0\\r\\n1 7\\r\\n2 3 4\\r\\n0\\r\\n0\\r\\n', 'output': ['17\\r\\n']}, {'input': '3 3\\r\\n1 2 3\\r\\n2 3 2\\r\\n1 3 6\\r\\n0\\r\\n1 3\\r\\n0\\r\\n', 'output': ['6\\r\\n']}, {'input': '7 7\\r\\n1 2 1\\r\\n2 4 2\\r\\n2 3 2\\r\\n3 6 2\\r\\n6 5 2\\r\\n4 5 3\\r\\n5 7 7\\r\\n0\\r\\n0\\r\\n0\\r\\n3 3 4 5\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['14\\r\\n']}, {'input': '7 6\\r\\n1 2 1\\r\\n1 3 1\\r\\n1 4 1\\r\\n1 5 1\\r\\n1 6 1\\r\\n1 7 1\\r\\n1 0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['2\\r\\n']}, {'input': '8 10\\r\\n1 2 3\\r\\n2 8 3\\r\\n1 4 1\\r\\n4 3 6\\r\\n3 7 7\\r\\n4 5 5\\r\\n5 7 2\\r\\n7 8 1\\r\\n1 6 8\\r\\n6 8 7\\r\\n0\\r\\n4 1 2 3 4\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['8\\r\\n']}, {'input': '7 6\\r\\n1 2 1\\r\\n1 3 2\\r\\n2 4 3\\r\\n2 5 4\\r\\n3 5 6\\r\\n3 6 7\\r\\n0\\r\\n3 1 2 3\\r\\n2 2 3\\r\\n0\\r\\n2 7 8\\r\\n0\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}]","id":175} {"difficulty":2100,"lang":"Python 2","lang_cluster":"Python","src_uid":"d9eb0f6f82bd09ea53a1dbbd7242c497","execute_outcome":"RUNTIME_ERROR","source_code":"\"\"\"\n6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0\n\"\"\"\n\n\nimport sys\nimport bisect\nimport heapq\nimport math\n\nINF = 10**9+7\nsys.setrecursionlimit(INF)\n\ndef fi():\n return int(sys.stdin.readline())\n\ndef fi2():\n return map(int, sys.stdin.readline().split())\n\ndef fi3():\n return sys.stdin.readline().rstrip()\n\ndef fo(*args):\n for s in args:\n sys.stdout.write(str(s)+' ')\n sys.stdout.write('\\n')\n## sys.stdout.flush()\n\n##\n \ndef convex_hull_graham(points):\n\n TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)\n\n def cmp(a, b):\n return (a > b) - (a < b)\n\n def turn(p, q, r):\n return cmp((q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]), 0)\n\n def _keep_left(hull, r):\n while len(hull) > 1 and turn(hull[-2], hull[-1], r) != TURN_LEFT:\n hull.pop()\n if not len(hull) or hull[-1] != r:\n hull.append(r)\n return hull\n\n points = sorted(points)\n l = reduce(_keep_left, points, [])\n u = reduce(_keep_left, reversed(points), [])\n return l.extend(u[i] for i in range(1, len(u) - 1)) or l\n\n\n##\n#main\n\n\nn1 = fi()\n\nQ = []\nHULL = set()\n\nfor i in range(n1):\n x, y = fi2()\n \n Q.append((x, y))\n HULL.add((x, y))\n\nn2 = fi()\n\nfor i in range(n2):\n x, y = fi2()\n if (x, y) in HULL:\n fo('NO')\n exit(0)\n Q.append((x, y))\n\nS = convex_hull_graham(Q)\n\nfor p in S:\n if p not in HULL:\n fo('NO')\n exit(0)\n\nfo('YES')\n\n\n \n\n \n\n\n\n\n\n \n \n","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"],"human_solution":"def cw(a, b, c):\n return a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1]) <= 0\n\ndef ccw(a, b, c):\n return a[0] * (b[1] - c[1]) + b[0] * (c[1] - a[1]) + c[0] * (a[1] - b[1]) >= 0\n\ndef convex_hull(points):\n points = sorted(points, key = lambda x: (x[0], x[1]))\n up = [points[0]]\n down = [points[0]]\n for i in range(1, len(points)):\n if (i == len(points)-1 or cw(points[0], points[i], points[-1])):\n while (len(up) >= 2 and not cw(up[-2], up[-1], points[i])): \n up.pop(-1)\n up.append(points[i])\n if (i == len(points)-1 or ccw(points[0], points[i], points[-1])):\n while (len(down) >= 2 and not ccw(down[-2], down[-1], points[i])):\n down.pop(-1)\n down.append(points[i])\n points = up[:] + down[1:-1][::-1]\n return points\n\npoints = []\n\nn = int(input())\nfor i in range(n):\n x, y = map(int, input().split())\n points.append([x, y, 0])\n\nm = int(input())\nfor i in range(m):\n x, y = map(int, input().split())\n points.append([x, y, 1])\n\npoints = convex_hull(points)\n\nfor p in points:\n if p[-1] == 1:\n print('NO')\n break\nelse:\n print('YES')\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":176} {"difficulty":2000,"lang":"Python 3","lang_cluster":"Python","src_uid":"e33b0a752dc1aba25da21e20435e3fe2","execute_outcome":"RUNTIME_ERROR","source_code":"from sys import exit\nn=0\nk=0\ns=\"\"\nfor i in input().split():\n if n==0:\n n=int(i)\n else:\n k=int(i)\n\ns=str(input())\nnode=[]\nfor i in range(len(s)):\n if s[int(i)]=='0':\n node.append(i+1)\n\nnode.append(1000000000)\ndef check(dis):\n current=0\n num=k-2\n for i in range(len(node)-1):\n if num<1:\n break\n if node[i]-node[current]<=dis and node[i+1]-node[current]>dis:\n current=i\n num-=1\n if n-node[current]>dis:\n return -1\n\n return 1\n\nleft=1\nright=n\nwhile left+1= 0\n\nn, k = map(int, input().split())\ns = input()\nL = 1\nR = n - 1\nwhile L < R:\n\tmid = (L + R) \/\/ 2\n\tif not check(mid, n, k, s):\n\t\tL = mid + 1\n\telse:\n\t\tR = mid\nprint(L - 1)","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":177} {"difficulty":1800,"lang":"Python 3","lang_cluster":"Python","src_uid":"e9c486e2d942700e0644dff29b6e3be6","execute_outcome":"RUNTIME_ERROR","source_code":"class Scroll:\n\tdef __init__(self, id, power, damage):\n\t\tself.id = id\n\t\tself.power = power\n\t\tself.damage = damage\n\t\tself.active = False\n\nnum_scrolls, boss_max, regenerate = map(int, input().split())\nscrolls = [Scroll(i+1, *map(int, input().split())) for i in range(num_scrolls)]\nscrolls.sort(key = lambda scroll: scroll.damage)\nboss_curr = boss_max\nscroll_damage = 0\nactive_scrolls = []\ntick = 0\nwhile True:\n\tboss_prev = boss_curr\n\tboss_curr -= scroll_damage\n\tboss_curr = min(boss_max, boss_curr + regenerate)\n\tif boss_curr <= 0:\n\t\tprint('YES')\n\t\tprint(tick, len(active_scrolls))\n\t\tfor scroll in active_scrolls:\n\t\t\tprint(scroll.start, scroll.id)\n\t\tbreak\n\tfound = False\n\tfor scroll in scrolls:\n\t\tif not scroll.active and 100*boss_curr <= scroll.power*boss_max:\n\t\t\tscroll.start = tick\n\t\t\tscroll.active = True\n\t\t\tactive_scrolls.append(scroll)\n\t\t\tscroll_damage += scroll.damage\n\t\t\tfound = True\n\t\t\tbreak\n\tif not found and boss_curr >= boss_prev:\n\t\tprint('NO')\n\t\tbreak\n\ttick += 1\n","description":"Vasya\u2019s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.While playing the game Petya found spell scrolls and now he is about to use them. Let\u2019s describe the way fighting goes on this level:1) The boss has two parameters: max \u2014 the initial amount of health and reg \u2014 regeneration rate per second.2) Every scroll also has two parameters: powi \u2014 spell power measured in percents \u2014 the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than powi percent of health the scroll cannot be used); and dmgi the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmgi of damage per second upon him until the end of the game.During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can\u2019t have more than max of health), then the player may use another scroll (no more than one per second).The boss is considered to be defeated if at the end of a second he has nonpositive (\u2009\u2264\u20090) amount of health.Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.","input_specification":"The first line contains three integers N, max and reg (1\u2009\u2264\u2009N,\u2009max,\u2009reg\u2009\u2264\u20091000) \u2013\u2013 the amount of scrolls and the parameters of the boss. The next N lines contain two integers powi and dmgi each \u2014 the parameters of the i-th scroll (0\u2009\u2264\u2009powi\u2009\u2264\u2009100, 1\u2009\u2264\u2009dmgi\u2009\u2264\u20092000). ","output_specification":"In case Petya can\u2019t complete this level, output in the single line NO. Otherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds. Output scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.","notes":null,"sample_inputs":["2 10 3\n100 3\n99 1","2 100 10\n100 11\n90 9"],"sample_outputs":["NO","YES\n19 2\n0 1\n10 2"],"human_solution":"class Scroll:\n\tdef __init__(self, id, power, damage):\n\t\tself.id = id\n\t\tself.power = power\n\t\tself.damage = damage\n\t\tself.active = False\n\nnum_scrolls, boss_max, regenerate = map(int, input().split())\nscrolls = [Scroll(i+1, *map(int, input().split())) for i in range(num_scrolls)]\nscrolls.sort(key = lambda scroll: -scroll.damage)\nboss_curr = boss_max\nscroll_damage = 0\nactive_scrolls = []\ntick = 0\nwhile True:\n\tboss_prev = boss_curr\n\tboss_curr -= scroll_damage\n\tboss_curr = min(boss_max, boss_curr + regenerate)\n\tif boss_curr <= 0:\n\t\tprint('YES')\n\t\tprint(tick, len(active_scrolls))\n\t\tfor scroll in active_scrolls:\n\t\t\tprint(scroll.start, scroll.id)\n\t\tbreak\n\tfound = False\n\tfor scroll in scrolls:\n\t\tif not scroll.active and 100*boss_curr <= scroll.power*boss_max:\n\t\t\tscroll.start = tick\n\t\t\tscroll.active = True\n\t\t\tactive_scrolls.append(scroll)\n\t\t\tscroll_damage += scroll.damage\n\t\t\tfound = True\n\t\t\tbreak\n\tif not found and boss_curr >= 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":178} {"difficulty":1500,"lang":"GNU C","lang_cluster":"C","src_uid":"0937a7e2f912fc094cc4275fd47cd457","execute_outcome":"WRONG_ANSWER","source_code":"#include\nlong int index[100010];\nvoid quicksort(long int x[],long int first,long int last){\n long int pivot,j,temp,i,temp1;\n\n if(firstx[pivot])\n j--;\n if(i=0;i-=2)\n printf(\"%ld\\n\",index[i]);\n printf(\"%ld\\n\",c2);\n for(i=n-2;i>=0;i-=2)\n printf(\"%ld\\n\",index[i]);\n return 0;\n}\n","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"],"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":179} {"difficulty":1500,"lang":"GNU C","lang_cluster":"C","src_uid":"0df064fd0288c2ac4832efa227107a0e","execute_outcome":"COMPILATION_ERROR","source_code":"\/\/Spelling Check - Codeforces\n#include \n#include \n#include \nchar s1[1000001], s2[1000001];\nint n, counta, cantidad, resp2[1000001];\nint main(){\n scanf(\"%s %s\",s1+1,s2+1);\n n=strlen(s1+1);\n for(int i=n;i>=1;--i)\n if (i==1||s1[i]!=s2[i - 1]){\n counta = n - i;\n break;\n }\n for(int i=1;i<=n;++i){\n if(counta>=n-i){\n resp2[++cantidad] = i;\n }\n if(i==n||s1[i]!=s2[i]){\n break;\n }\n }\n printf(\"%d\\n\", cantidad);\n if(cantidad!=0){\n for (int i=1;i<=cantidad;++i){\n printf(\"%d \", resp2[i]);\n }\n }\n return 0;\n}\n","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"],"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":180} {"difficulty":900,"lang":"GNU C11","lang_cluster":"C","src_uid":"102667eaa3aee012fef70f4192464674","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#include \n\nint main(void)\n{\n\t\tint n;\n\t\tscanf(\"%d \", &n);\n\n\t\tint n_arr[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tscanf(\"%d \", &n_arr[i]);\n\n\t\tint m;\n\t\tscanf(\"%d \", &m);\n\n\t\tint m_arr[n];\n\t\tfor (int i = 0; i < m; i++)\n\t\t\t\tscanf(\"%d \", &m_arr[i]);\n\n\t\tint max = 0, num_max = 0;\n\t\tfor (int i = 0; i < n; i++)\n\t\t\t\tfor (int j = m - 1; j >= 0; j--)\n\t\t\t\t\t\tif (m_arr[j]%n_arr[i] == 0){\n\t\t\t\t\t\t\t\tif (m_arr[j]\/n_arr[i] == max){\n\t\t\t\t\t\t\t\t\t\tnum_max++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (m_arr[j]\/n_arr[i] > max){\n\t\t\t\t\t\t\t\t\t\tnum_max = 1;\n\t\t\t\t\t\t\t\t\t\tmax = m_arr[j]\/n_arr[i];\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\tprintf(\"%d\\n\", num_max);\n}\n\n\t\t\t\t\t\t\n\n","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"],"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\nint main()\n{\n int n, i;\n long long x, y, a;\n\n scanf(\"%d %I64d %I64d\", &n, &x, &y);\n\n a = y - n + 1;\n\n if (a >= 0 && a * a + n - 1 >= x) {\n\t for (i = 0; i < n - 1; i++) puts(\"1\");\n\t printf(\"%I64d\\n\", a);\n } else {\n\t puts(\"-1\");\n }\n\n return 0;\n}\n","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"],"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":182} {"difficulty":1200,"lang":"GNU C","lang_cluster":"C","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#include\nlong long int n,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{t-=a[j];b[j++]++;}\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","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"],"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":183} {"difficulty":1200,"lang":"GNU C","lang_cluster":"C","src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","execute_outcome":"WRONG_ANSWER","source_code":"#include\n\nint main(void)\n{\n int flag=1,count=0,hold,n,k,i,rank[100];\n scanf(\"%d%d\",&n,&k);\n for(i=0;i\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":184} {"difficulty":1500,"lang":"GNU C","lang_cluster":"C","src_uid":"4ecbfc792da55f458342c6eff2d5da5a","execute_outcome":"WRONG_ANSWER","source_code":"#include \n\nint i, x, y, n, m, succs[101][100], nsuccs[101], seen[101], cedge[101], ncycles ;\n\nint dfs(int root, int from)\n{\n\tint k ;\n\t\n\tseen[root] = 1 ;\n\t\t\n\tfor (k = 0 ; k < nsuccs[root] ; k++)\n\t{\n\t\tif (!seen[succs[root][k]])\n\t\t{\n\t\t\tif (dfs(succs[root][k], root))\n\t\t\t{\n\t\t\t\treturn 1 ;\n\t\t\t}\t\t\t\t\n\t\t}\n\t\telse if (succs[root][k] != from && cedge[root] != succs[root][k])\n\t\t{\n\t\t\tcedge[succs[root][k]] = root ;\n\t\t\t\n\t\t\tif (++ncycles == 2)\n\t\t\t{\n\t\t\t\treturn 1 ;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0 ;\n}\n\nint main(void)\n{\n\tscanf(\"%d %d\", &n, &m) ;\n\t\t\n\tfor (i = 0 ; i < m ; i++)\n\t{\n\t\tscanf(\"%d %d\", &x, &y) ;\n\t\t\n\t\tsuccs[x][nsuccs[x]++] = y ;\n\t\tsuccs[y][nsuccs[y]++] = x ;\n\t}\n\t\n\tif (n != m)\n\t{\n\t\tprintf(\"NO\") ;\n\t}\n\telse\n\t{\n\t\tdfs(1, 0) ;\n\n\t\tprintf((ncycles == 1 ? \"FHTAGN!\" : \"NO\")) ;\n\t}\n\t\n\treturn 0 ;\n}\n","description":"...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...Whereas on the other end of the world Pentagon is actively collecting information trying to predict the monster's behavior and preparing the secret super weapon. Due to high seismic activity and poor weather conditions the satellites haven't yet been able to make clear shots of the monster. The analysis of the first shot resulted in an undirected graph with n vertices and m edges. Now the world's best minds are about to determine whether this graph can be regarded as Cthulhu or not.To add simplicity, let's suppose that Cthulhu looks from the space like some spherical body with tentacles attached to it. Formally, we shall regard as Cthulhu such an undirected graph that can be represented as a set of three or more rooted trees, whose roots are connected by a simple cycle.It is guaranteed that the graph contains no multiple edges and self-loops. ","input_specification":"The first line contains two integers \u2014 the number of vertices n and the number of edges m of the graph (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 0\u2009\u2264\u2009m\u2009\u2264\u2009). Each of the following m lines contains a pair of integers x and y, that show that an edge exists between vertices x and y (1\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009n,\u2009x\u2009\u2260\u2009y). For each pair of vertices there will be at most one edge between them, no edge connects a vertex to itself.","output_specification":"Print \"NO\", if the graph is not Cthulhu and \"FHTAGN!\" if it is.","notes":"NoteLet us denote as a simple cycle a set of v vertices that can be numbered so that the edges will only exist between vertices number 1 and 2, 2 and 3, ..., v\u2009-\u20091 and v, v and 1.A tree is a connected undirected graph consisting of n vertices and n\u2009-\u20091 edges (n\u2009>\u20090).A rooted tree is a tree where one vertex is selected to be the root.","sample_inputs":["6 6\n6 3\n6 4\n5 1\n2 5\n1 4\n5 4","6 5\n5 6\n4 6\n3 1\n5 1\n1 2"],"sample_outputs":["FHTAGN!","NO"],"human_solution":"#include \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":185} {"difficulty":1100,"lang":"GNU C11","lang_cluster":"C","src_uid":"5d11fa8528f1dc873d50b3417bef8c79","execute_outcome":"WRONG_ANSWER","source_code":"#include\n\nint main()\n{\n int i,j,n;\n int max=0,a=0,k;\n scanf(\"%d\",&n);\n \n int arr[n],arr1[n];\n for(i=0;i=0;k--) \/\/before\n {\n if(arr[k]>=arr[k-1])\n {\n ++a;\n }\n else\n break;\n }\n for(j=i;j=arr[j+1])\n ++a;\n else\n break;\n }\n }\n printf(\"%d\",max+1);\n }\n \nreturn 0; \n}","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"],"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":186} {"difficulty":1500,"lang":"GNU C","lang_cluster":"C","src_uid":"5e055bad1da5bdc84599d6f2f89fbd12","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#include\n#include\n#include\n#define M 100000\nstruct card{\n int f;\n int b;\n int g; \n }card[M];\nstruct color{\n int c;\n int num;\n int same;\n }front[M];\nstruct color1{\n int c;\n int num;\n }back[M]; \nint cmp1(const void *a,const void *b){\n struct card *c=(struct card *)a;\n struct card *d=(struct card *)b;\n return c->f-d->f;\n}\nint cmp2(const void *a,const void *b){\n struct card *c=(struct card *)a;\n struct card *d=(struct card *)b;\n return c->b-d->b;\n}\nint cmp3(const void *a,const void *b){\n struct color *c=(struct color *)a;\n struct color *d=(struct color *)b;\n return d->num-c->num;\n}\nint main(){\n int N,i,j,t,k,fnum,bnum,move,min,same,count;\n while(scanf(\"%d\",&N),N){\n memset(card,0,sizeof(card));\n memset(front,0,sizeof(front));\n memset(back,0,sizeof(back));\n for(i=0;i=(N+1)\/2){ move=0;break;}\n else{\n for(j=0;j=(N+1)\/2)move=back[j].num-front[i].same;\n if(move\n#include\n#define LEN 2000200\n#define LENC 200010\n#define MAX 10000000\ntypedef struct{\n\tint c;\n\tint n;\n }Node;\ntypedef struct {\n\tint c;\n\tint f;\/\/front or down 1 or 0\n }Color;\nColor C[LENC];\nint lenc,lena,lenb;\nNode A[LEN],B[LEN];\nint cmpc(const void *a, const void *b){\n\tColor *a0 = (Color*)a;\n\tColor *b0 = (Color*)b;\n\treturn a0 -> c - b0 -> c;}\nint Min(int a, int b){\n\tif(a < b)return a;\n\treturn b;}\nint main(){\n\tint i, j,n;\n\twhile(scanf(\"%d\", &n) != EOF){\n\t\tint c1, c2;\n\t\tlenc = 0;\n\t\tfor(i = 0; i < n; i++){\n\t\t\tscanf(\"%d%d\", &c1, &c2);\n\t\t\tC[lenc].c = c1;\n\t\t\tC[lenc++].f = 1;\n\t\t\tif(c2 != c1){\n\t\t\t\tC[lenc].c = c2;\n\t\t\t\tC[lenc++].f = 0;\n\t\t\t}\n\t\t}\n\t\tqsort(C, lenc, sizeof(Color), cmpc);\n\t\tlenb = 0;\n\t\tfor(i = 0; i < lenc; i++)\n\t\t\tif(C[i].f == 1){\n\t\t\t\tB[0].c = C[i].c;\n\t\t\t\tB[0].n = 1;\n\t\t\t\tlenb = 1;\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tfor(; i < lenc; i++){\n\t\t\tif(C[i].f == 1){\n\t\t\t\tif(C[i].c == B[lenb - 1].c)\tB[lenb - 1].n++;\t\t\t\n\t\t\t\telse{\n\t\t\t\t\tB[lenb].c = C[i].c;\n\t\t\t\t\tB[lenb++].n = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlena = 0;A[0].c = C[0].c;A[0].n = 1;lena = 1;\n\t\tfor(i = 1; i < lenc; i++){\n\t\t\tif(C[i].c == A[lena - 1].c)\tA[lena - 1].n++;\n\t\t\telse{\n\t\t\t\t\tA[lena].c = C[i].c;\n\t\t\t\t\tA[lena++].n = 1;\n\t\t\t\t}\n }\t\t\n\t\tint psb = 0;int mint = MAX;\n\t\tfor(i = 0; i < lena; i++){\n\t\t\tint t = (n + 1) \/ 2;\n\t\t\tif(A[i].n >= t){\n\t\t\t\tint ii = 0;int jj = lenb - 1;int find = 0;int mid;\n\t\t\t\twhile(ii <= jj){\n\t\t\t\t\tmid = (ii + jj) \/ 2;\n\t\t\t\t\tif(B[mid].c == A[i].c){\n\t\t\t\t\t\tfind = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse if(A[i].c < B[mid].c)\tjj = mid - 1;\n\t\t\t\t\telse\tii = mid + 1;\n\t\t\t\t}\n\t\t\t\tif(find == 1){\n\t\t\t\t\tint k = t - B[mid].n;\n\t\t\t\t\tmint = Min(mint, k);\t\n\t\t\t\t}\n\t\t\t\telse\tmint = Min(mint, t);\n\t\t\t\tpsb = 1;\n\t\t\t}\n\t\t}\n\t\tif(psb == 1){\n\t\t\tif(mint >= 0)\tprintf(\"%d\\n\", mint);\n\t\t\telse \tprintf(\"0\\n\");\n\t\t}\n\t\telse printf(\"-1\\n\");\n\t}\t\nreturn 0;\n}\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":187} {"difficulty":1100,"lang":"GNU C","lang_cluster":"C","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"COMPILATION_ERROR","source_code":"#\n","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"],"human_solution":"#include\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":188} {"difficulty":800,"lang":"GNU C","lang_cluster":"C","src_uid":"69850c2af99d60711bcff5870575e15e","execute_outcome":"WRONG_ANSWER","source_code":"#include\nint main()\n{\nint n,i,a,b,sum=0;\nscanf(\"%d\",&n);\nint ar[n-1];\nfor(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\nint a[1000008]={0};\nint main(){\n\tint n,i,s=0,ma=0,temp;\n\tchar b[10];\n\tscanf(\"%d\",&n);\n\tfor(i=0;is?ma:s;\n\t}\n\tprintf(\"%d\\n\",ma);\n\n}\n","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"],"human_solution":"\n #include\nint main(){\n int n,d, max= 0, prev=0, a[1000001]={0};\n char c;\n scanf(\"%d\",&n);\n while( n-- ){\n getchar();\n scanf(\"%c%d\",&c,&d);\n if( c == '+' )\n {\n a[d] = 1;\n prev++;\n }\n else if( a[d] == 1 ){\n a[d] = 0;\n prev--;\n }\n else{\n max++;\n }\n if( prev > max )\n max = prev;\n }\n printf(\"%d\\n\",max);\n return 0;\n}","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":190} {"difficulty":1000,"lang":"GNU C","lang_cluster":"C","src_uid":"6e0dafeaf85e92f959c388c72e158f68","execute_outcome":"WRONG_ANSWER","source_code":"#include\nint main() {\n\tint a, b, n,i, j, c;\n\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tscanf(\"%d %d %d\",&n, &a, &b);\n\tif (a * b < n) {\n\t\tprintf(\"-1\"); return 0;\n\t}\n\tfor (i = 0; i < a; i++) {\n\t\tfor (j = 0; j < b; j++) {\n\t\t\tif (i & 1) c = (i + 1)*b - j;\n\t\t\telse c = i * b + j + 1;\n\t\t\tif (c > n) printf(\"0 \");\n\t\t\telse printf(\"%d \", c);\n\t\t}\n\t\tputchar('\\n');\n\t}\n\treturn 0;\n}","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"],"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":191} {"difficulty":1100,"lang":"GNU C11","lang_cluster":"C","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#include \n#include \n#include \n\nvoid main()\n{\n int i,n,N;\n char chaine[101];\n int len =0;\n scanf(\"%d\",&n);\n while(len!=n)\n {\n scanf(\"%d\",&N);\n sprintf(chaine,\"%d\",N);\n len =strlen(chaine);\n }\n if ((len%2)!=0)\n {\n for(i=0;i<(len-3);i=i+2)\n {\n printf(\"%c%c-\",chaine[i],chaine[i+1]);\n }\n printf(\"%c%c%c\",chaine[len-3],chaine[len-2],chaine[len-1]);\n }\n else\n {\n for(i=0;i<(len-2);i=i+2)\n {\n printf(\"%c%c-\",chaine[i],chaine[i+1]);\n }\n printf(\"%c%c\",chaine[len-2],chaine[len-1]);\n }\n}\n","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"],"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\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int t=1, k=1;\n while(k\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":193} {"difficulty":1300,"lang":"GNU C","lang_cluster":"C","src_uid":"782b819eb0bfc86d6f96f15ac09d5085","execute_outcome":"WRONG_ANSWER","source_code":"#include\nlong long int p(long long int a)\n{\n long long int t;\n if(a==1)\n return(2);\n if(a%2==0)\n {\n t=((p(a\/2)%1000000007)*(p(a\/2)%1000000007))%1000000007;\n return(t);\n }\n else\n {\n t=(2*(p((a-1)\/2)%1000000007)*(p((a-1)\/2)%1000000007))%1000000007;\n return(t);\n }\n}\nint main()\n{\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",(p(n)*(p(n)+1))\/2);\n return 0;\n}\n \n","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"],"human_solution":"\/\/Created by Pratik Paras Mandlecha\n#include\n#include\n#include\n#include\nlong long int p=1000000007;\nlong long int power(long long int x,long long int y)\n{\n\tlong long int res=1;\n\tx=x%p;\n\twhile(y>0)\n\t{\n\t\tif(y&1)\n\t\t\tres=(res*x)%p;\n\t\ty=y>>1;\n\t\tx = (x*x) % p;\n\t}\n\treturn res;\n}\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tif(n==0) printf(\"1\");\n\telse printf(\"%lld\",(((power(2,n-1)%1000000007)+(2*power(4,n-1)%1000000007))%1000000007));\n\n\treturn 0;\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":194} {"difficulty":1300,"lang":"GNU C","lang_cluster":"C","src_uid":"88d56c1e3a7ffa94354ce0c70d8e958f","execute_outcome":"WRONG_ANSWER","source_code":"#include\nint main()\n{\n\t\n\n\tint type,hr,min,i;\n\n\tscanf(\"%d\",&type);\n\tscanf(\"%02d:%02d\",&hr,&min);\n\tif(hr==0)\n\t\thr=1;\n\n\t if(min==60)\n\t\t min=0;\n\t\t else if(min>60)\n\t\tmin=min%10;\n\tif(type==12)\n\t{\n\t\tif(hr>12)\n\t\t\thr=hr%10;\n\t\tif(hr==0)\n\t\t\thr=10;\n\t}\n\t\telse\n\t\t{\n\t\t\tif(hr>23)\n\t\t\t\thr=hr%10;\n\t\t\t}\t\n\t\t\n\tprintf(\"%02d:%02d\",hr,min);\n\t\t\t\treturn 0;\n}\n","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"],"human_solution":"\/* Problem: 722A - Broken Clock *\/\n\/* Solver: Gusztav Szmolik *\/\n\n#include \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":195} {"difficulty":1400,"lang":"GNU C11","lang_cluster":"C","src_uid":"8a9adc116abbd387a6a64dd754436f8a","execute_outcome":"COMPILATION_ERROR","source_code":"#include\n#include\nint main()\n{\n long long int a,b,n,i,t=0,c,d;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&n);\n for(i=1;i<=10;i++){\n c=a*pow(i,n);\n d=a*pow(-i,n);\n if(c==b){\n t=i;\n break;\n }\n else if(d==b){\n t=-i;\n break;\n }\n }\n if(t==0){\n printf(\"No solution\\n\");\n }\n else{\n printf(\"%I64d\\n\",t);\n }\n return 0;\n}\n","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"],"human_solution":"#include \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":196} {"difficulty":1500,"lang":"GNU C","lang_cluster":"C","src_uid":"9642368dc4ffe2fc6fe6438c7406c1bd","execute_outcome":"WRONG_ANSWER","source_code":"\n#include\n#include\n#include\n#define SORT(a,n) qsort(a,n,sizeof(int),intcmp)\n#define s(n) scanf(\"%d\",&n)\n#define sc(n) scanf(\"%c\",&n)\n#define sl(n) scanf(\"%I64d\",&n)\n#define sf(n) scanf(\"%lf\",&n)\n#define ss(n) scanf(\"%s\",n)\n#define fiI64(a,v) memset(a, v, sizeof a)\nint intcmp(const void *f,const void *s)\n{\n return (*(int *)f-*(int *)s);\n}\nint gcd(int a,int b){ return ((b==0)?a:gcd(b,a%b));}\n\n#define MAX 100\n#define MODBY 1000000007\n\ntypedef long long int I64d;\ntypedef long double Lf;\nI64d table[20][10];\nint checkspl(I64d a)\n{\n int last=a%10,first=a%10;\n while(a){\n first=a%10;\n a\/=10;\n }\n return (first==last);\n}\nvoid preprocess()\n{\n int i,j;\n for(i=1;i<10;++i){ table[0][i]=0;\n table[1][i]=table[2][i]=1;\n }\n int s=10;\n for(i=3;i<20;++i,s*=10)\n for(j=1;j<10;++j)\n table[i][j]=s;\n}\nI64d myatoi(char *s,int from,int tiI64)\n{\n I64d ans=0;\n int i;\n for(i=from;i<=tiI64;++i)\n ans=ans*10+(s[i]-'0');\n return ans;\n}\nI64d count(char *s)\n{\n int len=strlen(s),i,j;\n I64d ans=0;\n if(len==1) return *s-'0';\n\n ans=1+myatoi(s,1,len-2);\n\n for(j=1;j\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":197} {"difficulty":1400,"lang":"GNU C11","lang_cluster":"C","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"COMPILATION_ERROR","source_code":"[12:43 p.\u00a0m., 8\/10\/2019] Adri: #include\n\nint main() {\n\tint n,m,l;\n\tint a[100],am=0,suma;\n\t\n\t\tscanf(\"%d%d\",&n,&l);\n\t\n\t\t\tfor(int i=0;iam)\n\t\t\t\t\tam = suma;\n\t\t\t}\n\t\n\tprintf(\"%d\\n\",am);\n\treturn 0;\n}","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"#include\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":198} {"difficulty":1400,"lang":"GNU C","lang_cluster":"C","src_uid":"9c30697e71102ae10c55c14d9c1db006","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\n\nint main(void){\n char str[524288];\n int i,j,k,l;\n int length,check,flg=0;\n fgets(str,sizeof(str)\/sizeof(char),stdin);\n \n l=strlen(str);\n str[l-1]='\\0';\n l=strlen(str);\n check=0;\n if(str[0]=='.'){\n puts(\"NO\");\n return 0;\n }\n\n for(i=0;i8){\n puts(\"NO\");\n return 0;\n }\n }\n if(check>0){\n puts(\"NO\");\n return 0;\n }\n puts(\"YES\");\n \n for(i=0;i\n#include\nint main()\n{\n\tchar s[400001];\n\tint i;\n\tint a[400000];\n\tchar c;\n\tint m=0,count=0;\n\tint f1=0,f2=0;\n\tint t=0;\n\twhile(1)\n\t{\n\t\tscanf(\"%c\",&c);\n\t\tif(c=='\\n')\n\t\t\tbreak;\n\t\telse\n\t\t\ts[i]=c;\n\/\/\t\tprintf(\"%d\\n\",count);\n\t\tif(s[i]=='.')\n\t\t{\n\/\/\t\t\tprintf(\"%d %d\\n\",count,f1);\n\t\t\ta[m]=count;\n\t\t\tm++;\n\t\t\tif(f1==0&&(count>8||count<=0))\n\t\t\t{t=1;f1=1;break;}\n\t\t\telse if(f1==1&&count<2||count>11)\n\t\t\t{t=1;break;}\n\t\t\telse count=0;\n\t\t\tif(f1==0)\n\t\t\t\tf1=1;\n\t\t}\n\t\telse\n\t\t\tcount++;\n\t\ti++;\n\t}\n\/\/\tprintf(\"%d\\n\",count);\n\tif(count<1||count>3)\n\tt=1;\n\tint k=0;\n\tif(t==1||m==0)\n\t\tprintf(\"NO\\n\");\n\telse\n\t{\t\n\tprintf(\"YES\\n\");\n\ta[m]=count;\n\tm++;\n\/\/\tfor(i=0;i=2&&a[i]<=9)\n\t\t\t{printf(\"%c\\n\",s[k]);\n\t\t\t\tk++;\n\t\t\tint till=k+a[i];\n\t\t\twhile(k\n#include \n\nint main()\n{\n\n int n,m;\n scanf(\"%d %d\",&n,&m);\n char words[n][m];\n int bools[n][m];\n int i=0,j=0;\n for(i=0;i\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#include \n\nint main(void)\n{\n char buf = '\\0';\n unsigned long int result = 0;\n unsigned 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 \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 \n\nint main(){\n\tchar s[1000], t[1000];\n\tscanf (\"%[^\\n]\", s);\n\tgetchar();\n\t\n\tscanf (\"%[^\\n]\", t);\n\tgetchar();\n\t\n\tint len = strlen(s);\n\tint les = strlen(t);\n\t\n\tint ts[200] = {};\n\t\n\tfor (int i=0; i 0) ts[t[i]]--;\n\t\t\telse found = false;\n\t\t}\n\t}\n\t\n\tprintf (\"%s\", (found) ? \"YES\", \"NO\");\n}\n","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"],"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":202} {"difficulty":1000,"lang":"GNU C","lang_cluster":"C","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\nint main()\n{\n\tchar s[1001];\n\tint i,k,count=0,j;\n\t scanf(\"%s\",&s);\n\t scanf(\"%d\",&k);\n\tif(strlen(s) \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\nmain()\n{\n int n,p=0,i,j;\n scanf(\"%d\",&n);\n int a[n],h[10000]={0};\n for(i=0;i1)\n p=p+h[j]-1; \n \n }\n printf(\"%d\",p);\n}\n","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"],"human_solution":"#include\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":204} {"difficulty":1200,"lang":"GNU C11","lang_cluster":"C","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"COMPILATION_ERROR","source_code":"#include \n#include \n#include \nint main()\n{\n char v[100000], a1[100], a2[100], nv[100000];\n scanf(\"%s\", &v);\n strcpy(nv, v);\n strrev(nv);\n scanf(\"%s\", &a1);\n scanf(\"%s\", &a2);\n if(strstr(v, a1) != NULL && strstr(v, a2) != NULL && strlen(v)>=(strlen(a1)+strlen(a2))){\n if(strstr(v, a1)>=strstr(v,a2) && strstr(nv, a1)>=strstr(nv, a2))\n printf(\"both\");\n else if(strstr(v, a1)>strstr(v,a2))\n printf(\"backward\");\n else if(strstr(v, a1)\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":205} {"difficulty":1100,"lang":"GNU C","lang_cluster":"C","src_uid":"d526af933b5afe9abfdf9815e9664144","execute_outcome":"WRONG_ANSWER","source_code":"#include \nint main ()\n{\n int n,i,j,num[2000],a[2000],min=2000,x,z;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&num[i]);\n if(num[i]num[i+2])\n {\n if(min>num[i+1])\n {\n min=num[i+1];\n }\n i=i+1;\n }\n else{\n\n if(min>num[i+2])\n {\n min=num[i+2];\n }\n i=i+2;\n }\n }\n\n printf(\"%d\\n\",min);\n return 0;\n}\n","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"],"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":206} {"difficulty":1200,"lang":"GNU C11","lang_cluster":"C","src_uid":"f8315dc903b0542c453cab4577bcb20d","execute_outcome":"WRONG_ANSWER","source_code":"#include \nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,j,k,l,o,p;\n int a[m],b[m],c[2*m];\n int t=1;\n for(i=1;i<=m;i++)\n {\n scanf(\"%d %d\",&a[i],&b[i]);\n c[t]=a[i];\n c[t+1]=b[i];\n t+=2;\n }\n k=0,p=0;\n int u=1;\n for(i=1;i<=m;i++)\n {l=0;\n for(j=1;j<=m;j++)\n {\n if(j!=i)\n {\n if(a[i]!=b[j])\n {\n l++;\n }\n }\n if(i==m)\n {\n if(b[m]==a[j])\n {\n u=0;break;\n }\n }\n \n }\n if(l==m-1)\n {\n a[i]=0;\n b[i]=0;\n p++;\n }\n else \n k++;\n }\n o=n-p-k+u;\n printf(\"%d\",o);\n}","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"],"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\n#include\nint main()\n{\n int n,i,j,k,a,b,min,t;\n scanf(\"%d\", &n);\n int ara[n];\n\n for(i=0;i\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\n\nint f[4000001];\n\nint getf(int now)\n{\n if (f[now]==now)\n return now;\n return f[now]=getf(f[now]);\n}\n\nint main()\n{\n int i,n,m,s=0;\n scanf(\"%d%d\",&n,&m);\n for (i=1;i<=2*n+2*m;i++)\n f[i]=i;\n for (i=1;i<=n;i++)\n if (i<=m)\n f[getf(i)]=getf(2*n+i);\n else\n f[getf(i)]=getf(n+i-m+1);\n for (i=1;i<=m;i++)\n if (m-i+1<=n)\n f[getf(2*n+i)]=getf(n+m-i+1);\n else\n f[getf(2*n+i)]=getf(3*n+m+i-1);\n for (i=1;i<=n;i++)\n {\n if (n-i+1<=m)\n f[getf(n+i)]=getf(n+2*m+i);\n if (i<=m)\n f[getf(n+i)]=getf(i-m+1);\n }\n for (i=1;i<=m;i++)\n {\n if (i<=n)\n f[getf(2*n+m+i)]=getf(n-i+1);\n if (i+n-1<=m)\n f[getf(2*n+m+i)]=getf(2*n+i+n-1);\n }\n for (i=1;i<=2*n+2*m;i++)\n s+=(f[i]==i);\n printf(\"%d\\n\",s);\n return 0;\n}\n","description":"Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.More formally, first one of four diagonal directions is chosen and the billiard ball moves in that direction. When it reaches the square located on the board's edge, the billiard ball reflects from it; it changes the direction of its movement by 90 degrees and continues moving. Specifically, having reached a corner square, the billiard ball is reflected twice and starts to move the opposite way. While it moves, the billiard ball can make an infinite number of reflections. At any square of its trajectory the billiard ball can stop and on that the move is considered completed. It is considered that one billiard ball a beats another billiard ball b if a can reach a point where b is located.You are suggested to find the maximal number of billiard balls, that pairwise do not beat each other and that can be positioned on a chessboard n\u2009\u00d7\u2009m in size.","input_specification":"The first line contains two integers n and m (2\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106).","output_specification":"Print a single number, the maximum possible number of billiard balls that do not pairwise beat each other. Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is preferred to use cin (also you may use the %I64d specificator).","notes":null,"sample_inputs":["3 4","3 3"],"sample_outputs":["2","3"],"human_solution":"#include \n\nint par[4000000];\nint f[4000000];\n\nint find(int x)\n{\n if (par[x] == x) {\n\t return x;\n } else {\n\t return par[x] = find(par[x]);\n }\n}\n\nvoid unite(int x, int y)\n{\n x = find(x);\n y = find(y);\n\n if (x == y) return;\n\n par[x] = y;\n}\n\nint main()\n{\n int n, m, sum = 0, i, j;\n\n scanf(\"%d %d\", &n, &m);\n\n if (n < m) {\n\t int tmp = n; n = m; m = tmp;\n }\n\n for (i = 0; i < 2 * n + 2 * m; i++) par[i] = i;\n\n for (i = 0; i < n; i++) {\n\t if (i + m <= n) {\n\t unite(n + i + m - 1, i);\n\t unite(i + m - 1, n + i);\n\t } else {\n\t unite(3 * n + m - i - 1, i);\n\t unite(n + 2 * m + i, n + i);\n\t }\n\n\t if (i >= m - 1) {\n\t unite(n + i - m + 1, i);\n\t unite(i - m + 1, n + i);\n\t } else {\n\t unite(2 * n + i, i);\n\t unite(2 * n + m - i - 1, n + i);\n\t }\n }\n\n for (i = 0; i < 2 * n + 2 * m; i++) f[find(i)]++;\n\n for (i = 0; i < 2 * n + 2 * m; i++) {\n\t if (f[i] > 0) sum++;\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n","testcases":"[{'input': '3 4\\r\\n', 'output': ['2']}, {'input': '3 3\\r\\n', 'output': ['3']}, {'input': '2 2\\r\\n', 'output': ['2']}, {'input': '4 3\\r\\n', 'output': ['2']}, {'input': '2 3\\r\\n', 'output': ['2']}, {'input': '4 4\\r\\n', 'output': ['4']}, {'input': '4 6\\r\\n', 'output': ['2']}, {'input': '4 7\\r\\n', 'output': ['4']}, {'input': '5 7\\r\\n', 'output': ['3']}, {'input': '5 13\\r\\n', 'output': ['5']}, {'input': '7 10\\r\\n', 'output': ['4']}, {'input': '7 21\\r\\n', 'output': ['3']}, {'input': '7 61\\r\\n', 'output': ['7']}, {'input': '8 50\\r\\n', 'output': ['8']}, {'input': '8 8\\r\\n', 'output': ['8']}, {'input': '9 9\\r\\n', 'output': ['9']}, {'input': '9 256\\r\\n', 'output': ['2']}, {'input': '10 10\\r\\n', 'output': ['10']}, {'input': '999 999\\r\\n', 'output': ['999']}, {'input': '1000000 1000000\\r\\n', 'output': ['1000000']}, {'input': '2311 7771\\r\\n', 'output': ['211']}, {'input': '146412 710630\\r\\n', 'output': ['3572']}, {'input': '943547 987965\\r\\n', 'output': ['1347']}, {'input': '35329 689665\\r\\n', 'output': ['1537']}, {'input': '672961 948978\\r\\n', 'output': ['2']}, {'input': '524288 131072\\r\\n', 'output': ['2']}, {'input': '293492 654942\\r\\n', 'output': ['2']}, {'input': '962963 1000000\\r\\n', 'output': ['37038']}, {'input': '7 1000000\\r\\n', 'output': ['4']}, {'input': '999999 1000000\\r\\n', 'output': ['2']}, {'input': '666667 1000000\\r\\n', 'output': ['333334']}, {'input': '384 187\\r\\n', 'output': ['2']}, {'input': '238 116\\r\\n', 'output': ['2']}, {'input': '993 342\\r\\n', 'output': ['32']}, {'input': '848 271\\r\\n', 'output': ['2']}, {'input': '702 200\\r\\n', 'output': ['2']}, {'input': '9516 2202\\r\\n', 'output': ['2']}, {'input': '1498 9704\\r\\n', 'output': ['2']}, {'input': '2482 6269\\r\\n', 'output': ['2']}, {'input': '3466 4770\\r\\n', 'output': ['2']}, {'input': '4449 1336\\r\\n', 'output': ['2']}, {'input': '604630 225648\\r\\n', 'output': ['2']}, {'input': '503832 242363\\r\\n', 'output': ['2']}, {'input': '403034 430556\\r\\n', 'output': ['2']}, {'input': '302237 618749\\r\\n', 'output': ['5']}, {'input': '201439 635463\\r\\n', 'output': ['3']}, {'input': '576709 834208\\r\\n', 'output': ['562']}, {'input': '97905 599257\\r\\n', 'output': ['233']}, {'input': '364915 516421\\r\\n', 'output': ['343']}, {'input': '222403 592339\\r\\n', 'output': ['2203']}, {'input': '543425 776321\\r\\n', 'output': ['77633']}, {'input': '977965 896468\\r\\n', 'output': ['81498']}, {'input': '829981 586711\\r\\n', 'output': ['14311']}, {'input': '429181 515017\\r\\n', 'output': ['85837']}, {'input': '198441 446491\\r\\n', 'output': ['49611']}, {'input': '117806 188489\\r\\n', 'output': ['23562']}, {'input': '893011 315181\\r\\n', 'output': ['52531']}, {'input': '701905 526429\\r\\n', 'output': ['175477']}, {'input': '863029 287677\\r\\n', 'output': ['287677']}, {'input': '871866 348747\\r\\n', 'output': ['174374']}, {'input': '12 5\\r\\n', 'output': ['2']}, {'input': '21 15\\r\\n', 'output': ['3']}, {'input': '12 9\\r\\n', 'output': ['2']}, {'input': '720 972\\r\\n', 'output': ['2']}]","id":209} {"difficulty":2400,"lang":"GNU C","lang_cluster":"C","src_uid":"1d73b315694f2ebbf796654193372730","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i tmp[i]) return 1;\n }\n return 0;\n}\n\nvoid renew(void){\n int i;\n\n if(res_size == tmp_size && smaller()) res_size++;\n if(res_size > tmp_size){\n res_size = tmp_size;\n rep(i,res_size) res[i] = tmp[i];\n }\n}\n\nint main(){\n int i,j,k,l,m,n,loop,mi;\n int sx,sy,ex,ey,tx,ty,nx,ny;\n int dx[4]={-1,1,0,0}, dy[4]={0,0,1,-1};\n int usa[30];\n int dist[55][55], chked[55][55];\n int q[3333], q_st, q_size;\n int ok1[3333], ok2[3333], ok1_size, ok2_size;\n\n while(scanf(\"%d%d%d\",&x,&y,&z)==3){\n rep(i,x) scanf(\"%s\",mp[i]);\n\n sz = 0;\n gen(0, 0);\n\n rep(i,x) rep(j,y){\n if(mp[i][j]=='S'){ mp[i][j] = 27; sx = i; sy = j; continue; }\n if(mp[i][j]=='T'){ mp[i][j] = 28; ex = i; ey = j; continue; }\n mp[i][j] -= 'a';\n }\n\n res_size = 5000;\n\n rep(loop,sz){\n rep(i,30) usa[i] = 0;\n rep(i,z) usa[arr[loop][i]]=1; usa[28]=1;\n\n rep(i,x) rep(j,y) dist[i][j] = -1;\n dist[sx][sy] = 0;\n\n q_st = 0; q_size = 1;\n q[0] = sx*y + sy;\n \n while(q_size){\n tx = q[q_st]\/y; ty = q[q_st]%y;\n q_st++; q_size--;\n\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(!usa[mp[nx][ny]]) continue;\n if(dist[nx][ny]>=0) continue;\n\n dist[nx][ny] = dist[tx][ty] + 1;\n q[q_st+q_size++] = nx*y + ny;\n }\n }\n\n if(dist[ex][ey]==-1) continue;\n if(dist[ex][ey]-1 > res_size) continue;\n\n rep(i,x) rep(j,y) chked[i][j] = 0;\n chked[sx][sy] = 1;\n\n tmp_size = 0;\n ok1_size = 1; ok1[0] = sx*y + sy;\n while(tmp_size < dist[ex][ey]-1){\n mi = 100;\n rep(i,ok1_size){\n tx = ok1[i]\/y; ty = ok1[i]%y;\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(dist[nx][ny] != dist[tx][ty]+1) continue;\n if(mi > mp[nx][ny]) mi = mp[nx][ny];\n }\n }\n\n ok2_size = 0;\n rep(i,ok1_size){\n tx = ok1[i]\/y; ty = ok1[i]%y;\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(dist[nx][ny] != dist[tx][ty]+1) continue;\n if(chked[nx][ny]) continue;\n if(mi == mp[nx][ny]){\n ok2[ok2_size++] = nx*y + ny;\n chked[nx][ny]=1;\n }\n }\n }\n\n ok1_size = ok2_size;\n rep(i,ok1_size) ok1[i] = ok2[i];\n\n tmp[tmp_size++] = mi;\n }\n\n renew();\n }\n\n if(res_size==5000){puts(\"-1\"); continue;}\n rep(i,res_size) putchar('a' + res[i]); puts(\"\");\n }\n\n return 0;\n}\n","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"],"human_solution":"#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i tmp[i]) return 1;\n }\n return 0;\n}\n\nvoid renew(void){\n int i;\n\n if(res_size == tmp_size && smaller()) res_size++;\n if(res_size > tmp_size){\n res_size = tmp_size;\n rep(i,res_size) res[i] = tmp[i];\n }\n}\n\nint main(){\n int i,j,k,l,m,n,loop,mi;\n int sx,sy,ex,ey,tx,ty,nx,ny;\n int dx[4]={-1,1,0,0}, dy[4]={0,0,1,-1};\n int usa[30];\n int dist[55][55], chked[55][55];\n int q[3333], q_st, q_size;\n int ok1[3333], ok2[3333], ok1_size, ok2_size;\n\n while(scanf(\"%d%d%d\",&x,&y,&z)==3){\n rep(i,x) scanf(\"%s\",mp[i]);\n\n sz = 0;\n gen(0, 0);\n\n rep(i,x) rep(j,y){\n if(mp[i][j]=='S'){ mp[i][j] = 27; sx = i; sy = j; continue; }\n if(mp[i][j]=='T'){ mp[i][j] = 28; ex = i; ey = j; continue; }\n mp[i][j] -= 'a';\n }\n\n res_size = 5000;\n\n rep(loop,sz){\n rep(i,30) usa[i] = 0;\n rep(i,z) usa[arr[loop][i]]=1; usa[27]=usa[28]=1;\n\n rep(i,x) rep(j,y) dist[i][j] = -1;\n dist[ex][ey] = 0;\n\n q_st = 0; q_size = 1;\n q[0] = ex*y + ey;\n \n while(q_size){\n tx = q[q_st]\/y; ty = q[q_st]%y;\n q_st++; q_size--;\n\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(!usa[mp[nx][ny]]) continue;\n if(dist[nx][ny]>=0) continue;\n\n dist[nx][ny] = dist[tx][ty] + 1;\n q[q_st+q_size++] = nx*y + ny;\n }\n }\n\n if(dist[sx][sy]==-1) continue;\n if(dist[sx][sy]-1 > res_size) continue;\n\n rep(i,x) rep(j,y) chked[i][j] = 0;\n chked[sx][sy] = 1;\n\n tmp_size = 0;\n ok1_size = 1; ok1[0] = sx*y + sy;\n while(tmp_size < dist[sx][sy]-1){\n mi = 100;\n rep(i,ok1_size){\n tx = ok1[i]\/y; ty = ok1[i]%y;\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(dist[nx][ny] != dist[tx][ty]-1) continue;\n if(mi > mp[nx][ny]) mi = mp[nx][ny];\n }\n }\n\n ok2_size = 0;\n rep(i,ok1_size){\n tx = ok1[i]\/y; ty = ok1[i]%y;\n rep(k,4){\n nx = tx + dx[k]; ny = ty + dy[k];\n if(nx<0||ny<0 || nx>=x||ny>=y) continue;\n if(dist[nx][ny] != dist[tx][ty]-1) continue;\n if(chked[nx][ny]) continue;\n if(mi == mp[nx][ny]){\n ok2[ok2_size++] = nx*y + ny;\n chked[nx][ny]=1;\n }\n }\n }\n\n ok1_size = ok2_size;\n rep(i,ok1_size) ok1[i] = ok2[i];\n\n tmp[tmp_size++] = mi;\n }\n\n renew();\n }\n\n if(res_size==5000){puts(\"-1\"); continue;}\n rep(i,res_size) putchar('a' + res[i]); puts(\"\");\n }\n\n return 0;\n}\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":210} {"difficulty":2700,"lang":"GNU C11","lang_cluster":"C","src_uid":"40002052843ca0357dbd3158b16d59f4","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n\n#define A\t5000\n#define N_\t(A * 3)\n#define INF\t0x3f3f3f3f3f3f3f3fLL\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\n\nint oo[1 + (N_ - 1) * 2], oj[1 + (N_ - 1) * 2];\n\nint link(int o, int j) {\n\tstatic int _ = 1;\n\n\too[_] = o, oj[_] = j;\n\treturn _++;\n}\n\nint count(int n, int p) {\n\treturn n < p ? 0 : n \/ p + count(n \/ p, p);\n}\n\nint ae[N_], pp[N_], dd[N_], sz[N_], ii[A + 1], n;\n\nvoid init() {\n\tstatic char composite[A + 1];\n\tstatic int primes[A + 1];\n\tint n_, a, b, cnt, i, j;\n\n\tfor (a = 2; a <= A \/ a; a++) {\n\t\tif (composite[a])\n\t\t\tcontinue;\n\t\tfor (b = a * a; b <= A; b += a)\n\t\t\tcomposite[b] = 1;\n\t}\n\tcnt = 0;\n\tfor (a = 2; a <= A; a++)\n\t\tif (!composite[a])\n\t\t\tprimes[cnt++] = a;\n\tn_ = 0;\n\tpp[n_] = -1, dd[n_] = 0;\n\tii[1] = n_++;\n\tfor (a = 2; a <= A; a++) {\n\t\tint h, d, d_;\n\n\t\td = 0;\n\t\tfor (h = 0; h < cnt; h++)\n\t\t\td += count(a, primes[h]);\n\t\td_ = 0;\n\t\tfor (h = cnt - 1; h >= 0; h--) {\n\t\t\td_ += count(a - 1, primes[h]);\n\t\t\tif (a % primes[h] == 0)\n\t\t\t\tbreak;\n\t\t}\n\t\ti = ii[a - 1], j = -1;\n\t\twhile (1)\n\t\t\tif (dd[i] > d_)\n\t\t\t\tj = i, i = pp[i];\n\t\t\telse if (dd[i] == d_) {\n\t\t\t\tpp[n_] = i, dd[n_] = d, n_++;\n\t\t\t\tii[a] = n_ - 1;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tint k = n_++;\n\n\t\t\t\tpp[k] = i, dd[k] = d_;\n\t\t\t\tif (j != -1)\n\t\t\t\t\tpp[j] = k;\n\t\t\t\tpp[n_] = k, dd[n_] = d, n_++;\n\t\t\t\tii[a] = n_ - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\tfor (j = 1; j < n_; j++) {\n\t\ti = pp[j];\n\t\tae[i] = link(ae[i], j), ae[j] = link(ae[j], i);\n\t}\n}\n\nlong long dfs1(int p, int i) {\n\tint o;\n\tlong long x;\n\n\tx = (long long) sz[i] * dd[i];\n\tfor (o = ae[i]; o; o = oo[o]) {\n\t\tint j = oj[o];\n\t\t\n\t\tif (j != p) {\n\t\t\tsz[i] += sz[j];\n\t\t\tx += dfs1(i, j);\n\t\t}\n\t}\n\treturn x;\n}\n\nlong long ans;\n\nvoid dfs2(int p, int i, long long x) {\n\tint o;\n\n\tans = min(ans, x);\n\tfor (o = ae[i]; o; o = oo[o]) {\n\t\tint j = oj[o];\n\n\t\tif (j != p) {\n\t\t\tint w = abs(dd[i] - dd[j]);\n\n\t\t\tdfs2(i, j, x - (long long) sz[j] * w + (long long) (n - sz[j]) * w);\n\t\t}\n\t}\n}\n\nint main() {\n\tint i;\n\n\tinit();\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tint a;\n\n\t\tscanf(\"%d\", &a);\n\t\tsz[ii[a > 0 ? a : 1]]++;\n\t}\n\tans = INF;\n\tdfs2(-1, 0, dfs1(-1, 0));\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n","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"],"human_solution":"#include \n#include \n\n#define A\t5000\n#define N_\t(A * 3)\n#define INF\t0x3f3f3f3f3f3f3f3fLL\n\nlong long min(long long a, long long b) { return a < b ? a : b; }\n\nint oo[1 + (N_ - 1) * 2], oj[1 + (N_ - 1) * 2];\n\nint link(int o, int j) {\n\tstatic int _ = 1;\n\n\too[_] = o, oj[_] = j;\n\treturn _++;\n}\n\nint count(int n, int p) {\n\treturn n < p ? 0 : n \/ p + count(n \/ p, p);\n}\n\nint ae[N_], pp[N_], dd[N_], sz[N_], ii[A + 1], n;\n\nvoid init() {\n\tstatic char composite[A + 1];\n\tstatic int primes[A + 1];\n\tint n_, a, b, cnt, i, j;\n\n\tfor (a = 2; a <= A \/ a; a++) {\n\t\tif (composite[a])\n\t\t\tcontinue;\n\t\tfor (b = a * a; b <= A; b += a)\n\t\t\tcomposite[b] = 1;\n\t}\n\tcnt = 0;\n\tfor (a = 2; a <= A; a++)\n\t\tif (!composite[a])\n\t\t\tprimes[cnt++] = a;\n\tn_ = 0;\n\tpp[n_] = -1, dd[n_] = 0;\n\tii[1] = n_++;\n\tfor (a = 2; a <= A; a++) {\n\t\tint h, d, d_;\n\n\t\td = 0;\n\t\tfor (h = 0; h < cnt; h++)\n\t\t\td += count(a, primes[h]);\n\t\td_ = 0;\n\t\tfor (h = cnt - 1; h >= 0; h--) {\n\t\t\td_ += count(a - 1, primes[h]);\n\t\t\tif (a % primes[h] == 0)\n\t\t\t\tbreak;\n\t\t}\n\t\ti = ii[a - 1], j = -1;\n\t\twhile (1)\n\t\t\tif (dd[i] > d_)\n\t\t\t\tj = i, i = pp[i];\n\t\t\telse if (dd[i] == d_) {\n\t\t\t\tpp[n_] = i, dd[n_] = d, n_++;\n\t\t\t\tii[a] = n_ - 1;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tint k = n_++;\n\n\t\t\t\tpp[k] = i, dd[k] = d_;\n\t\t\t\tif (j != -1)\n\t\t\t\t\tpp[j] = k;\n\t\t\t\tpp[n_] = k, dd[n_] = d, n_++;\n\t\t\t\tii[a] = n_ - 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\tfor (j = 1; j < n_; j++) {\n\t\ti = pp[j];\n\t\tae[i] = link(ae[i], j), ae[j] = link(ae[j], i);\n\t}\n}\n\nlong long dfs1(int p, int i) {\n\tint o;\n\tlong long x;\n\n\tx = (long long) sz[i] * dd[i];\n\tfor (o = ae[i]; o; o = oo[o]) {\n\t\tint j = oj[o];\n\t\t\n\t\tif (j != p) {\n\t\t\tx += dfs1(i, j);\n\t\t\tsz[i] += sz[j];\n\t\t}\n\t}\n\treturn x;\n}\n\nlong long ans;\n\nvoid dfs2(int p, int i, long long x) {\n\tint o;\n\n\tans = min(ans, x);\n\tfor (o = ae[i]; o; o = oo[o]) {\n\t\tint j = oj[o];\n\n\t\tif (j != p) {\n\t\t\tint w = abs(dd[i] - dd[j]);\n\n\t\t\tdfs2(i, j, x - (long long) sz[j] * w + (long long) (n - sz[j]) * w);\n\t\t}\n\t}\n}\n\nint main() {\n\tint i;\n\n\tinit();\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tint a;\n\n\t\tscanf(\"%d\", &a);\n\t\tsz[ii[a > 0 ? a : 1]]++;\n\t}\n\tans = INF;\n\tdfs2(-1, 0, dfs1(-1, 0));\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\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":211} {"difficulty":2300,"lang":"GNU C","lang_cluster":"C","src_uid":"52b13cca189853e6af02bea8d3d85276","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"#include\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nlong min[1001]={0},rec[1001]={0},ed[1001][2]={0},post[1001]={0},f[1001]={0},stay[1001][1001]={0},ps[1001]={0},head[1001]={0},e[2001]={0},next[2001]={0},v[2001]={0};\nchar str[15]={0},th[1001][1001]={0},town[1001][1001]={0},hash[1001][1001]={0},own[1001][1001]={0},name[1001][15]={0};\nlong n,m,totm=0,flag=0;\n\nvoid add(long a,long b,long c)\n{\n e[++totm]=b;\n next[totm]=head[a];\n head[a]=totm;\n v[totm]=c;\n}\n\nlong getf(long now)\n{\n if (f[now]==now)\n return now;\n return f[now]=getf(f[now]);\n}\n\nvoid dfs(long now,long x)\n{\n long i,j,fa;\n hash[x][now]=1;\n stay[now][++ps[now]]=x;\n flag++;\n for (i=1;i\n#include\n#include\n#include\n#include\n#define oo 1000000000\n#define pi 3.14159265359\n#define zero(a) (abb(a)<=1e-7)\n#define lowbit(a) ((a)&(-(a)))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#define abb(a) ((a)>0?(a):(-(a)))\n#define cj(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y2))\n#define dj(x1,y1,x2,y2) ((x1)*(y1)+(y1)*(y2))\n#define dis(x1,y1,x2,y2) sqrt(((x2)-(x1))*((x2)-(x1))+((y2)-(y1))*((y2)-(y1)))\n\nlong min[1001]={0},rec[1001]={0},ed[1001][2]={0},post[1001]={0},f[1001]={0},stay[1001][1001]={0},ps[1001]={0},head[1001]={0},e[2001]={0},next[2001]={0},v[2001]={0};\nchar str[15]={0},th[1001][1001]={0},town[1001][1001]={0},hash[1001][1001]={0},own[1001][1001]={0},name[1001][15]={0};\nlong n,m,totm=0,flag=0;\n\nvoid add(long a,long b,long c)\n{\n e[++totm]=b;\n next[totm]=head[a];\n head[a]=totm;\n v[totm]=c;\n}\n\nlong getf(long now)\n{\n if (f[now]==now)\n return now;\n return f[now]=getf(f[now]);\n}\n\nvoid dfs(long now,long x)\n{\n long i,j,fa,tmp;\n hash[x][now]=1;\n stay[now][++ps[now]]=x;\n tmp=++flag;\n for (i=1;i\n\nint min(int a, int b)\n{\n if (a < b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint main()\n{\n int n, m, k, f = 0, i;\n\n scanf(\"%d %d %d\", &n, &m, &k);\n\n for (i = 0; i < k; i++) {\n\t int x, y;\n\n\t scanf(\"%d %d\", &x, &y);\n\n\t if (min(min(x, n - x + 1), min(y, m - y + 1)) < 5) f = 1;\n }\n\n if (f == 1) {\n\t puts(\"YES\");\n } else {\n\t puts(\"NO\");\n }\n\n return 0;\n}\n","description":"Volodya and Vlad play the following game. There are k pies at the cells of n\u2009\u2009\u00d7\u2009\u2009m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at the border of the board of length 1 (between two knots of the board) so that Volodya is not able to move the pie outside the board through this edge anymore. The question is: will Volodya win this game? We suppose both players follow the optimal strategy.","input_specification":"First line contains 3 integers, separated by space: 1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100 \u2014 dimensions of the board and 0\u2009\u2264\u2009k\u2009\u2264\u2009100 \u2014 the number of pies. Each of the next k lines contains 2 integers, separated by space: 1\u2009\u2264\u2009x\u2009\u2264\u2009n, 1\u2009\u2264\u2009y\u2009\u2264\u2009m \u2014 coordinates of the corresponding pie. There could be more than one pie at a cell. ","output_specification":"Output only one word: \"YES\" \u2014 if Volodya wins, \"NO\" \u2014 otherwise.","notes":null,"sample_inputs":["2 2 1\n1 2","3 4 0","100 50 2\n50 25\n50 25"],"sample_outputs":["YES","NO","NO"],"human_solution":"#include \n#include \n\nint main()\n{\n int m,n,k,x,y,i,r=0;\n scanf(\"%d %d %d\\n\",&m,&n,&k);\n if(k<1) printf(\"NO\");\n else{ if(n<5||m<5)\n {\n printf(\"YES\");\n\n }\n else\n {\n for(i=0;im-5||y>n-5||x<6||y<6)\n\n {\n r=r+1;\n\n\n }}\n if (r==0)\n printf(\"NO\");\n else printf(\"YES\");\n\n }\n\n }\n }\n\n\n","testcases":"[{'input': '2 2 1\\r\\n1 2\\r\\n', 'output': ['YES']}, {'input': '3 4 0\\r\\n', 'output': ['NO']}, {'input': '100 50 2\\r\\n50 25\\r\\n50 25\\r\\n', 'output': ['NO']}, {'input': '20 20 4\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n', 'output': ['NO']}, {'input': '15 15 1\\r\\n8 8\\r\\n', 'output': ['NO']}, {'input': '8 8 2\\r\\n4 4\\r\\n5 5\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 96\\r\\n51 96\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 95\\r\\n51 95\\r\\n', 'output': ['NO']}, {'input': '20 20 1\\r\\n16 10\\r\\n', 'output': ['YES']}, {'input': '20 20 4\\r\\n15 9\\r\\n15 10\\r\\n15 11\\r\\n15 12\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 6\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 5\\r\\n', 'output': ['YES']}, {'input': '35 13 20\\r\\n13 8\\r\\n19 8\\r\\n24 7\\r\\n20 6\\r\\n23 7\\r\\n23 6\\r\\n30 7\\r\\n29 7\\r\\n7 7\\r\\n6 8\\r\\n9 8\\r\\n29 6\\r\\n20 7\\r\\n25 6\\r\\n19 6\\r\\n23 8\\r\\n26 6\\r\\n12 6\\r\\n15 7\\r\\n6 8\\r\\n', 'output': ['NO']}, {'input': '50 17 27\\r\\n17 8\\r\\n19 6\\r\\n25 8\\r\\n30 10\\r\\n22 10\\r\\n30 9\\r\\n25 8\\r\\n27 6\\r\\n19 7\\r\\n29 11\\r\\n39 8\\r\\n31 8\\r\\n39 8\\r\\n40 7\\r\\n11 8\\r\\n30 11\\r\\n32 8\\r\\n31 11\\r\\n36 12\\r\\n10 11\\r\\n32 8\\r\\n8 7\\r\\n7 12\\r\\n17 11\\r\\n27 7\\r\\n8 8\\r\\n23 12\\r\\n', 'output': ['NO']}, {'input': '24 29 22\\r\\n16 6\\r\\n14 22\\r\\n7 15\\r\\n11 17\\r\\n12 22\\r\\n10 13\\r\\n12 22\\r\\n12 13\\r\\n6 16\\r\\n12 21\\r\\n11 11\\r\\n9 13\\r\\n18 22\\r\\n7 20\\r\\n13 6\\r\\n6 14\\r\\n17 10\\r\\n9 13\\r\\n7 23\\r\\n14 11\\r\\n7 22\\r\\n8 12\\r\\n', 'output': ['NO']}, {'input': '32 45 3\\r\\n12 30\\r\\n27 9\\r\\n14 27\\r\\n', 'output': ['NO']}, {'input': '35 15 63\\r\\n6 6\\r\\n14 9\\r\\n7 6\\r\\n25 6\\r\\n25 8\\r\\n13 9\\r\\n18 7\\r\\n20 8\\r\\n30 10\\r\\n25 10\\r\\n7 7\\r\\n18 8\\r\\n11 10\\r\\n12 6\\r\\n8 8\\r\\n6 9\\r\\n21 9\\r\\n27 10\\r\\n28 8\\r\\n28 9\\r\\n7 9\\r\\n28 9\\r\\n10 10\\r\\n29 10\\r\\n25 8\\r\\n28 7\\r\\n22 6\\r\\n13 9\\r\\n14 7\\r\\n23 9\\r\\n20 8\\r\\n28 10\\r\\n22 7\\r\\n12 8\\r\\n13 7\\r\\n27 9\\r\\n17 8\\r\\n10 8\\r\\n19 10\\r\\n6 10\\r\\n26 6\\r\\n19 8\\r\\n28 9\\r\\n15 9\\r\\n14 7\\r\\n25 10\\r\\n17 8\\r\\n21 8\\r\\n29 6\\r\\n7 6\\r\\n16 10\\r\\n7 10\\r\\n25 7\\r\\n9 9\\r\\n30 9\\r\\n23 8\\r\\n28 8\\r\\n7 10\\r\\n12 6\\r\\n20 9\\r\\n24 8\\r\\n6 6\\r\\n26 7\\r\\n', 'output': ['NO']}, {'input': '41 50 37\\r\\n21 24\\r\\n20 32\\r\\n10 12\\r\\n35 7\\r\\n8 19\\r\\n30 22\\r\\n21 11\\r\\n35 12\\r\\n7 8\\r\\n16 10\\r\\n13 39\\r\\n6 43\\r\\n31 12\\r\\n16 14\\r\\n25 32\\r\\n27 21\\r\\n6 34\\r\\n22 26\\r\\n7 41\\r\\n18 13\\r\\n24 19\\r\\n9 44\\r\\n36 21\\r\\n17 16\\r\\n36 24\\r\\n6 31\\r\\n19 20\\r\\n12 19\\r\\n27 36\\r\\n6 31\\r\\n11 13\\r\\n19 9\\r\\n20 12\\r\\n25 25\\r\\n18 27\\r\\n17 36\\r\\n8 16\\r\\n', 'output': ['NO']}, {'input': '96 95 31\\r\\n14 23\\r\\n70 47\\r\\n11 77\\r\\n53 66\\r\\n63 87\\r\\n3 14\\r\\n57 44\\r\\n65 69\\r\\n80 74\\r\\n49 6\\r\\n57 86\\r\\n75 8\\r\\n2 32\\r\\n75 21\\r\\n14 51\\r\\n56 46\\r\\n77 6\\r\\n17 89\\r\\n87 3\\r\\n21 18\\r\\n70 67\\r\\n47 64\\r\\n13 47\\r\\n61 33\\r\\n56 30\\r\\n28 2\\r\\n65 18\\r\\n17 90\\r\\n44 77\\r\\n54 26\\r\\n32 70\\r\\n', 'output': ['YES']}, {'input': '80 51 47\\r\\n67 41\\r\\n74 7\\r\\n68 41\\r\\n6 2\\r\\n19 38\\r\\n37 28\\r\\n65 4\\r\\n6 25\\r\\n39 11\\r\\n19 34\\r\\n47 36\\r\\n62 26\\r\\n27 44\\r\\n70 45\\r\\n24 33\\r\\n41 2\\r\\n13 10\\r\\n3 17\\r\\n78 35\\r\\n53 46\\r\\n62 47\\r\\n33 17\\r\\n17 49\\r\\n2 3\\r\\n47 38\\r\\n72 35\\r\\n4 8\\r\\n32 21\\r\\n52 43\\r\\n67 12\\r\\n28 22\\r\\n53 34\\r\\n36 11\\r\\n45 45\\r\\n32 12\\r\\n5 11\\r\\n6 3\\r\\n55 21\\r\\n73 4\\r\\n55 21\\r\\n36 13\\r\\n48 18\\r\\n19 8\\r\\n70 24\\r\\n43 45\\r\\n59 50\\r\\n58 7\\r\\n', 'output': ['YES']}, {'input': '25 92 38\\r\\n21 36\\r\\n20 18\\r\\n9 29\\r\\n18 77\\r\\n10 58\\r\\n10 39\\r\\n5 3\\r\\n21 51\\r\\n11 78\\r\\n16 32\\r\\n24 71\\r\\n15 17\\r\\n23 23\\r\\n25 59\\r\\n18 57\\r\\n11 2\\r\\n16 35\\r\\n1 47\\r\\n20 59\\r\\n19 54\\r\\n11 55\\r\\n4 33\\r\\n15 41\\r\\n17 18\\r\\n16 67\\r\\n4 15\\r\\n5 23\\r\\n3 24\\r\\n20 70\\r\\n5 87\\r\\n11 1\\r\\n23 66\\r\\n21 83\\r\\n2 32\\r\\n17 22\\r\\n2 26\\r\\n16 42\\r\\n24 15\\r\\n', 'output': ['YES']}, {'input': '67 41 68\\r\\n35 16\\r\\n66 14\\r\\n1 15\\r\\n43 6\\r\\n26 17\\r\\n30 13\\r\\n42 11\\r\\n32 20\\r\\n66 14\\r\\n15 35\\r\\n35 6\\r\\n12 11\\r\\n25 9\\r\\n39 37\\r\\n31 14\\r\\n52 11\\r\\n4 32\\r\\n17 14\\r\\n32 1\\r\\n58 31\\r\\n30 20\\r\\n7 23\\r\\n13 3\\r\\n27 25\\r\\n60 27\\r\\n56 39\\r\\n60 39\\r\\n11 5\\r\\n33 14\\r\\n29 12\\r\\n13 34\\r\\n30 16\\r\\n25 16\\r\\n64 25\\r\\n47 6\\r\\n33 36\\r\\n14 40\\r\\n19 38\\r\\n57 34\\r\\n67 8\\r\\n10 13\\r\\n7 36\\r\\n22 24\\r\\n6 33\\r\\n23 40\\r\\n13 19\\r\\n65 6\\r\\n14 37\\r\\n37 21\\r\\n27 12\\r\\n41 36\\r\\n60 15\\r\\n27 11\\r\\n23 33\\r\\n67 40\\r\\n45 39\\r\\n1 41\\r\\n50 21\\r\\n28 38\\r\\n20 24\\r\\n41 34\\r\\n43 35\\r\\n51 5\\r\\n59 37\\r\\n27 4\\r\\n28 17\\r\\n63 20\\r\\n1 9\\r\\n', 'output': ['YES']}, {'input': '14 95 49\\r\\n11 48\\r\\n9 12\\r\\n1 18\\r\\n7 54\\r\\n11 20\\r\\n9 82\\r\\n12 1\\r\\n12 84\\r\\n1 13\\r\\n2 13\\r\\n12 57\\r\\n13 15\\r\\n12 18\\r\\n9 47\\r\\n13 14\\r\\n10 14\\r\\n13 94\\r\\n7 46\\r\\n14 14\\r\\n6 46\\r\\n7 95\\r\\n9 29\\r\\n13 15\\r\\n6 76\\r\\n8 60\\r\\n6 27\\r\\n9 63\\r\\n5 39\\r\\n5 70\\r\\n10 59\\r\\n5 75\\r\\n3 19\\r\\n9 32\\r\\n13 59\\r\\n5 13\\r\\n4 5\\r\\n13 80\\r\\n10 62\\r\\n13 65\\r\\n5 25\\r\\n4 81\\r\\n7 12\\r\\n10 94\\r\\n8 55\\r\\n7 61\\r\\n11 58\\r\\n7 77\\r\\n12 14\\r\\n12 47\\r\\n', 'output': ['YES']}, {'input': '15 96 22\\r\\n4 7\\r\\n7 40\\r\\n13 30\\r\\n8 53\\r\\n6 78\\r\\n5 9\\r\\n15 35\\r\\n3 13\\r\\n5 31\\r\\n2 9\\r\\n13 50\\r\\n11 17\\r\\n4 2\\r\\n10 91\\r\\n11 74\\r\\n14 49\\r\\n8 30\\r\\n10 66\\r\\n12 44\\r\\n6 19\\r\\n9 62\\r\\n15 50\\r\\n', 'output': ['YES']}, {'input': '19 19 50\\r\\n11 16\\r\\n4 11\\r\\n5 12\\r\\n19 19\\r\\n7 16\\r\\n15 10\\r\\n8 17\\r\\n8 1\\r\\n11 10\\r\\n5 19\\r\\n5 14\\r\\n17 6\\r\\n12 15\\r\\n18 17\\r\\n17 14\\r\\n10 5\\r\\n15 11\\r\\n8 8\\r\\n5 8\\r\\n18 18\\r\\n7 11\\r\\n8 4\\r\\n11 9\\r\\n6 16\\r\\n1 15\\r\\n19 13\\r\\n5 12\\r\\n10 10\\r\\n4 19\\r\\n12 4\\r\\n8 14\\r\\n19 9\\r\\n7 1\\r\\n19 11\\r\\n15 8\\r\\n4 19\\r\\n19 9\\r\\n6 7\\r\\n15 7\\r\\n2 16\\r\\n12 9\\r\\n3 18\\r\\n17 10\\r\\n3 5\\r\\n11 7\\r\\n12 6\\r\\n4 15\\r\\n19 4\\r\\n17 15\\r\\n3 10\\r\\n', 'output': ['YES']}, {'input': '93 40 43\\r\\n14 15\\r\\n58 9\\r\\n72 15\\r\\n40 40\\r\\n46 20\\r\\n17 26\\r\\n31 26\\r\\n91 36\\r\\n24 28\\r\\n32 27\\r\\n51 10\\r\\n2 35\\r\\n73 7\\r\\n6 33\\r\\n59 21\\r\\n59 39\\r\\n33 8\\r\\n22 21\\r\\n77 20\\r\\n30 38\\r\\n76 35\\r\\n40 6\\r\\n48 31\\r\\n67 29\\r\\n30 24\\r\\n6 16\\r\\n39 27\\r\\n24 29\\r\\n14 16\\r\\n5 25\\r\\n76 14\\r\\n61 25\\r\\n85 13\\r\\n60 9\\r\\n80 7\\r\\n49 19\\r\\n35 20\\r\\n90 31\\r\\n57 40\\r\\n67 27\\r\\n3 27\\r\\n21 16\\r\\n21 38\\r\\n', 'output': ['YES']}, {'input': '70 50 62\\r\\n31 22\\r\\n41 21\\r\\n31 47\\r\\n2 46\\r\\n22 8\\r\\n6 4\\r\\n45 32\\r\\n40 29\\r\\n10 11\\r\\n62 40\\r\\n70 26\\r\\n48 25\\r\\n13 44\\r\\n53 22\\r\\n3 8\\r\\n41 19\\r\\n13 8\\r\\n21 41\\r\\n66 20\\r\\n34 34\\r\\n41 48\\r\\n9 35\\r\\n23 26\\r\\n29 30\\r\\n39 27\\r\\n58 11\\r\\n35 2\\r\\n67 3\\r\\n59 23\\r\\n41 10\\r\\n54 9\\r\\n10 18\\r\\n23 44\\r\\n5 2\\r\\n37 30\\r\\n31 24\\r\\n2 21\\r\\n2 36\\r\\n34 5\\r\\n59 44\\r\\n7 4\\r\\n23 22\\r\\n47 27\\r\\n14 50\\r\\n54 50\\r\\n6 4\\r\\n64 1\\r\\n29 5\\r\\n5 37\\r\\n60 50\\r\\n58 45\\r\\n70 4\\r\\n4 46\\r\\n68 43\\r\\n62 34\\r\\n15 12\\r\\n16 2\\r\\n70 21\\r\\n59 8\\r\\n13 27\\r\\n25 41\\r\\n13 20\\r\\n', 'output': ['YES']}, {'input': '61 96 15\\r\\n27 36\\r\\n19 64\\r\\n27 53\\r\\n59 63\\r\\n48 56\\r\\n55 30\\r\\n10 23\\r\\n6 79\\r\\n32 74\\r\\n7 51\\r\\n29 65\\r\\n60 16\\r\\n43 74\\r\\n40 80\\r\\n14 31\\r\\n', 'output': ['YES']}, {'input': '87 50 62\\r\\n34 31\\r\\n42 21\\r\\n2 23\\r\\n20 25\\r\\n57 39\\r\\n46 26\\r\\n59 46\\r\\n29 33\\r\\n32 35\\r\\n79 41\\r\\n54 19\\r\\n65 7\\r\\n41 6\\r\\n40 23\\r\\n8 41\\r\\n2 31\\r\\n56 5\\r\\n37 33\\r\\n63 23\\r\\n79 4\\r\\n85 27\\r\\n53 38\\r\\n58 21\\r\\n16 11\\r\\n15 46\\r\\n33 39\\r\\n38 6\\r\\n27 41\\r\\n6 15\\r\\n25 47\\r\\n58 16\\r\\n28 50\\r\\n43 38\\r\\n48 20\\r\\n5 48\\r\\n31 6\\r\\n8 18\\r\\n40 10\\r\\n32 29\\r\\n44 20\\r\\n42 46\\r\\n63 21\\r\\n18 10\\r\\n28 49\\r\\n66 26\\r\\n64 28\\r\\n73 23\\r\\n16 29\\r\\n48 12\\r\\n23 21\\r\\n84 14\\r\\n10 45\\r\\n75 37\\r\\n80 3\\r\\n75 24\\r\\n31 25\\r\\n8 42\\r\\n67 22\\r\\n80 45\\r\\n8 31\\r\\n16 28\\r\\n49 34\\r\\n', 'output': ['YES']}, {'input': '23 100 53\\r\\n16 63\\r\\n16 31\\r\\n8 31\\r\\n4 86\\r\\n8 43\\r\\n8 27\\r\\n21 6\\r\\n13 49\\r\\n11 54\\r\\n5 86\\r\\n1 41\\r\\n19 14\\r\\n2 98\\r\\n15 76\\r\\n6 25\\r\\n6 57\\r\\n2 45\\r\\n6 98\\r\\n10 27\\r\\n16 74\\r\\n22 72\\r\\n22 13\\r\\n22 20\\r\\n15 63\\r\\n18 17\\r\\n14 32\\r\\n14 32\\r\\n2 28\\r\\n7 46\\r\\n23 16\\r\\n20 64\\r\\n18 17\\r\\n3 69\\r\\n22 77\\r\\n2 98\\r\\n11 20\\r\\n22 17\\r\\n21 8\\r\\n19 77\\r\\n19 13\\r\\n18 25\\r\\n9 24\\r\\n18 83\\r\\n19 27\\r\\n7 37\\r\\n16 19\\r\\n9 60\\r\\n11 70\\r\\n3 30\\r\\n4 84\\r\\n9 54\\r\\n22 33\\r\\n3 22\\r\\n', 'output': ['YES']}, {'input': '36 89 27\\r\\n21 66\\r\\n3 60\\r\\n11 32\\r\\n10 81\\r\\n30 31\\r\\n27 62\\r\\n11 81\\r\\n24 41\\r\\n30 6\\r\\n13 45\\r\\n34 86\\r\\n26 46\\r\\n9 62\\r\\n8 86\\r\\n17 56\\r\\n4 86\\r\\n25 36\\r\\n23 72\\r\\n18 55\\r\\n18 87\\r\\n22 67\\r\\n18 12\\r\\n19 75\\r\\n21 60\\r\\n16 49\\r\\n33 63\\r\\n26 12\\r\\n', 'output': ['YES']}, {'input': '93 93 50\\r\\n7 5\\r\\n73 91\\r\\n66 55\\r\\n12 24\\r\\n82 46\\r\\n38 49\\r\\n86 72\\r\\n51 69\\r\\n17 73\\r\\n9 85\\r\\n86 69\\r\\n65 2\\r\\n40 88\\r\\n92 26\\r\\n45 80\\r\\n74 45\\r\\n4 55\\r\\n57 93\\r\\n80 70\\r\\n49 69\\r\\n29 46\\r\\n67 38\\r\\n46 12\\r\\n16 87\\r\\n62 3\\r\\n79 62\\r\\n29 45\\r\\n58 30\\r\\n48 4\\r\\n76 73\\r\\n14 68\\r\\n31 8\\r\\n49 85\\r\\n73 78\\r\\n18 7\\r\\n87 56\\r\\n82 54\\r\\n52 73\\r\\n29 71\\r\\n87 74\\r\\n75 84\\r\\n45 28\\r\\n47 57\\r\\n44 53\\r\\n21 5\\r\\n86 5\\r\\n57 51\\r\\n45 9\\r\\n93 8\\r\\n82 43\\r\\n', 'output': ['YES']}, {'input': '11 38 21\\r\\n2 21\\r\\n2 28\\r\\n7 19\\r\\n9 18\\r\\n7 25\\r\\n8 4\\r\\n3 23\\r\\n2 32\\r\\n5 34\\r\\n10 36\\r\\n8 21\\r\\n4 6\\r\\n6 6\\r\\n4 35\\r\\n8 34\\r\\n10 18\\r\\n11 4\\r\\n10 2\\r\\n10 13\\r\\n4 37\\r\\n2 29\\r\\n', 'output': ['YES']}, {'input': '26 11 59\\r\\n13 6\\r\\n18 6\\r\\n12 6\\r\\n18 6\\r\\n21 6\\r\\n19 6\\r\\n12 6\\r\\n7 6\\r\\n6 6\\r\\n16 6\\r\\n7 6\\r\\n9 6\\r\\n19 6\\r\\n19 6\\r\\n15 6\\r\\n16 6\\r\\n16 6\\r\\n18 6\\r\\n17 6\\r\\n8 6\\r\\n13 6\\r\\n18 6\\r\\n11 6\\r\\n21 6\\r\\n9 6\\r\\n19 6\\r\\n20 6\\r\\n8 6\\r\\n20 6\\r\\n14 6\\r\\n11 6\\r\\n18 6\\r\\n7 6\\r\\n16 6\\r\\n19 6\\r\\n6 6\\r\\n6 6\\r\\n7 6\\r\\n13 6\\r\\n9 6\\r\\n16 6\\r\\n9 6\\r\\n15 6\\r\\n12 6\\r\\n17 6\\r\\n16 6\\r\\n9 6\\r\\n11 6\\r\\n10 6\\r\\n16 6\\r\\n14 6\\r\\n15 6\\r\\n7 6\\r\\n20 6\\r\\n7 6\\r\\n8 6\\r\\n17 6\\r\\n14 6\\r\\n14 6\\r\\n', 'output': ['NO']}, {'input': '30 84 35\\r\\n20 60\\r\\n23 21\\r\\n14 24\\r\\n24 72\\r\\n13 76\\r\\n25 35\\r\\n11 64\\r\\n15 57\\r\\n9 55\\r\\n14 66\\r\\n10 24\\r\\n13 68\\r\\n11 8\\r\\n19 43\\r\\n11 14\\r\\n16 26\\r\\n11 22\\r\\n10 26\\r\\n15 66\\r\\n17 65\\r\\n21 34\\r\\n7 61\\r\\n24 64\\r\\n18 16\\r\\n22 18\\r\\n12 9\\r\\n10 40\\r\\n8 24\\r\\n16 52\\r\\n10 9\\r\\n7 17\\r\\n21 78\\r\\n18 75\\r\\n10 45\\r\\n16 29\\r\\n', 'output': ['NO']}, {'input': '100 77 53\\r\\n62 72\\r\\n23 51\\r\\n42 8\\r\\n66 33\\r\\n62 16\\r\\n28 53\\r\\n72 54\\r\\n71 34\\r\\n30 26\\r\\n91 28\\r\\n27 37\\r\\n81 47\\r\\n22 40\\r\\n42 23\\r\\n92 46\\r\\n36 37\\r\\n86 70\\r\\n62 22\\r\\n20 9\\r\\n46 36\\r\\n86 67\\r\\n46 61\\r\\n33 30\\r\\n68 49\\r\\n44 57\\r\\n34 7\\r\\n89 36\\r\\n48 39\\r\\n47 62\\r\\n76 56\\r\\n22 41\\r\\n7 52\\r\\n16 8\\r\\n70 50\\r\\n52 27\\r\\n27 17\\r\\n44 30\\r\\n66 44\\r\\n62 10\\r\\n95 37\\r\\n94 39\\r\\n91 68\\r\\n12 49\\r\\n85 55\\r\\n63 28\\r\\n64 15\\r\\n75 31\\r\\n93 26\\r\\n53 51\\r\\n53 55\\r\\n66 65\\r\\n38 36\\r\\n40 15\\r\\n', 'output': ['NO']}, {'input': '66 94 26\\r\\n11 75\\r\\n46 72\\r\\n55 74\\r\\n34 10\\r\\n33 84\\r\\n25 11\\r\\n13 23\\r\\n27 73\\r\\n45 22\\r\\n54 34\\r\\n53 63\\r\\n28 8\\r\\n57 46\\r\\n26 78\\r\\n52 46\\r\\n32 38\\r\\n22 55\\r\\n17 71\\r\\n56 18\\r\\n9 60\\r\\n31 54\\r\\n6 84\\r\\n59 57\\r\\n60 81\\r\\n51 49\\r\\n41 77\\r\\n', 'output': ['NO']}, {'input': '68 100 18\\r\\n17 85\\r\\n10 77\\r\\n59 55\\r\\n29 46\\r\\n25 74\\r\\n55 11\\r\\n37 16\\r\\n57 61\\r\\n26 11\\r\\n11 88\\r\\n19 18\\r\\n28 38\\r\\n32 12\\r\\n36 49\\r\\n32 6\\r\\n57 45\\r\\n30 6\\r\\n59 95\\r\\n', 'output': ['NO']}, {'input': '28 61 4\\r\\n12 18\\r\\n21 31\\r\\n14 52\\r\\n6 36\\r\\n', 'output': ['NO']}, {'input': '11 73 1\\r\\n4 67\\r\\n', 'output': ['YES']}, {'input': '11 79 0\\r\\n', 'output': ['NO']}, {'input': '11 23 1\\r\\n11 9\\r\\n', 'output': ['YES']}, {'input': '25 11 0\\r\\n', 'output': ['NO']}, {'input': '39 11 1\\r\\n18 3\\r\\n', 'output': ['YES']}, {'input': '69 11 0\\r\\n', 'output': ['NO']}, {'input': '18 15 45\\r\\n6 7\\r\\n7 14\\r\\n12 3\\r\\n17 1\\r\\n15 3\\r\\n7 11\\r\\n9 3\\r\\n7 11\\r\\n15 4\\r\\n8 1\\r\\n12 2\\r\\n17 7\\r\\n14 15\\r\\n2 9\\r\\n12 4\\r\\n14 9\\r\\n18 8\\r\\n2 2\\r\\n17 1\\r\\n7 9\\r\\n2 4\\r\\n16 1\\r\\n12 7\\r\\n17 10\\r\\n4 1\\r\\n18 13\\r\\n10 13\\r\\n9 12\\r\\n14 1\\r\\n1 6\\r\\n3 10\\r\\n6 2\\r\\n15 3\\r\\n4 8\\r\\n14 6\\r\\n5 14\\r\\n8 11\\r\\n8 13\\r\\n6 7\\r\\n16 9\\r\\n2 7\\r\\n17 14\\r\\n17 11\\r\\n7 9\\r\\n15 8\\r\\n', 'output': ['YES']}, {'input': '16 18 70\\r\\n14 17\\r\\n16 8\\r\\n14 1\\r\\n7 1\\r\\n5 3\\r\\n7 5\\r\\n15 15\\r\\n15 2\\r\\n8 17\\r\\n12 12\\r\\n8 7\\r\\n10 16\\r\\n16 6\\r\\n14 7\\r\\n2 7\\r\\n12 4\\r\\n1 9\\r\\n6 9\\r\\n1 10\\r\\n10 13\\r\\n7 11\\r\\n2 2\\r\\n9 5\\r\\n3 10\\r\\n14 7\\r\\n4 5\\r\\n2 7\\r\\n7 16\\r\\n5 7\\r\\n7 14\\r\\n14 6\\r\\n10 16\\r\\n8 1\\r\\n4 14\\r\\n3 15\\r\\n8 11\\r\\n3 16\\r\\n12 1\\r\\n10 12\\r\\n13 3\\r\\n14 17\\r\\n5 5\\r\\n6 8\\r\\n13 10\\r\\n11 13\\r\\n3 5\\r\\n15 7\\r\\n10 3\\r\\n6 12\\r\\n13 15\\r\\n7 5\\r\\n3 8\\r\\n7 18\\r\\n6 7\\r\\n15 1\\r\\n9 6\\r\\n6 17\\r\\n11 2\\r\\n2 17\\r\\n7 16\\r\\n6 6\\r\\n2 18\\r\\n2 10\\r\\n5 16\\r\\n7 17\\r\\n3 8\\r\\n15 2\\r\\n11 11\\r\\n5 13\\r\\n16 1\\r\\n', 'output': ['YES']}, {'input': '14 20 68\\r\\n6 7\\r\\n2 15\\r\\n4 6\\r\\n10 18\\r\\n6 9\\r\\n14 14\\r\\n5 18\\r\\n9 15\\r\\n5 15\\r\\n2 9\\r\\n9 13\\r\\n10 17\\r\\n4 2\\r\\n12 12\\r\\n6 19\\r\\n7 13\\r\\n10 11\\r\\n1 1\\r\\n3 16\\r\\n7 6\\r\\n8 16\\r\\n10 17\\r\\n1 13\\r\\n12 11\\r\\n13 13\\r\\n2 20\\r\\n14 12\\r\\n11 18\\r\\n10 8\\r\\n12 4\\r\\n13 7\\r\\n13 11\\r\\n1 1\\r\\n10 6\\r\\n14 17\\r\\n1 2\\r\\n11 5\\r\\n6 12\\r\\n13 2\\r\\n4 3\\r\\n8 19\\r\\n12 8\\r\\n8 7\\r\\n5 1\\r\\n2 10\\r\\n11 10\\r\\n12 19\\r\\n2 10\\r\\n8 4\\r\\n12 13\\r\\n3 15\\r\\n8 8\\r\\n5 9\\r\\n14 15\\r\\n5 19\\r\\n7 7\\r\\n1 16\\r\\n6 12\\r\\n11 18\\r\\n5 13\\r\\n1 12\\r\\n10 14\\r\\n4 5\\r\\n2 8\\r\\n3 20\\r\\n14 7\\r\\n6 3\\r\\n4 18\\r\\n', 'output': ['YES']}, {'input': '19 13 83\\r\\n5 2\\r\\n12 11\\r\\n5 6\\r\\n3 11\\r\\n17 8\\r\\n10 8\\r\\n3 10\\r\\n9 10\\r\\n16 3\\r\\n15 12\\r\\n14 2\\r\\n11 8\\r\\n18 6\\r\\n15 10\\r\\n11 12\\r\\n2 1\\r\\n15 3\\r\\n16 3\\r\\n1 7\\r\\n15 7\\r\\n2 9\\r\\n11 13\\r\\n18 9\\r\\n4 7\\r\\n13 4\\r\\n7 4\\r\\n3 1\\r\\n14 8\\r\\n4 5\\r\\n5 7\\r\\n8 3\\r\\n17 2\\r\\n18 2\\r\\n16 3\\r\\n10 12\\r\\n6 2\\r\\n3 6\\r\\n5 2\\r\\n10 3\\r\\n18 9\\r\\n14 3\\r\\n3 6\\r\\n6 5\\r\\n12 8\\r\\n7 12\\r\\n2 11\\r\\n6 6\\r\\n18 6\\r\\n14 4\\r\\n3 10\\r\\n3 2\\r\\n13 3\\r\\n12 9\\r\\n2 10\\r\\n15 6\\r\\n1 5\\r\\n9 12\\r\\n6 12\\r\\n4 6\\r\\n18 3\\r\\n7 2\\r\\n9 13\\r\\n3 10\\r\\n19 13\\r\\n6 7\\r\\n5 1\\r\\n4 10\\r\\n12 13\\r\\n8 12\\r\\n15 1\\r\\n4 3\\r\\n3 8\\r\\n4 8\\r\\n3 7\\r\\n4 13\\r\\n8 7\\r\\n7 13\\r\\n2 8\\r\\n14 6\\r\\n12 1\\r\\n16 8\\r\\n9 4\\r\\n5 8\\r\\n', 'output': ['YES']}, {'input': '13 19 1\\r\\n6 10\\r\\n', 'output': ['NO']}, {'input': '14 17 0\\r\\n', 'output': ['NO']}, {'input': '20 19 5\\r\\n7 14\\r\\n14 12\\r\\n7 12\\r\\n15 9\\r\\n12 6\\r\\n', 'output': ['NO']}, {'input': '17 15 3\\r\\n10 7\\r\\n12 6\\r\\n8 6\\r\\n', 'output': ['NO']}, {'input': '14 17 4\\r\\n9 9\\r\\n8 7\\r\\n8 12\\r\\n7 9\\r\\n', 'output': ['NO']}, {'input': '15 11 0\\r\\n', 'output': ['NO']}, {'input': '14 16 4\\r\\n6 11\\r\\n6 8\\r\\n8 6\\r\\n6 7\\r\\n', 'output': ['NO']}, {'input': '16 16 0\\r\\n', 'output': ['NO']}, {'input': '19 20 2\\r\\n10 14\\r\\n8 11\\r\\n', 'output': ['NO']}, {'input': '13 15 1\\r\\n7 10\\r\\n', 'output': ['NO']}, {'input': '11 100 4\\r\\n6 10\\r\\n6 20\\r\\n6 30\\r\\n6 80\\r\\n', 'output': ['NO']}, {'input': '100 11 2\\r\\n40 6\\r\\n70 6\\r\\n', 'output': ['NO']}, {'input': '100 11 5\\r\\n20 6\\r\\n30 6\\r\\n43 7\\r\\n78 6\\r\\n89 6\\r\\n', 'output': ['YES']}, {'input': '20 20 5\\r\\n10 6\\r\\n6 8\\r\\n16 11\\r\\n11 11\\r\\n7 15\\r\\n', 'output': ['YES']}, {'input': '30 30 5\\r\\n7 15\\r\\n24 11\\r\\n15 15\\r\\n8 24\\r\\n9 6\\r\\n', 'output': ['NO']}]","id":213} {"difficulty":2700,"lang":"GNU C11","lang_cluster":"C","src_uid":"6220f4058f9325dfb211fb1dd86e9464","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n\n#define X\t1000000\n#define Q\t100000\n\nlong long cross2(long long x1, long long y1, long long x2, long long y2) {\n\treturn x1 * y2 - x2 * y1;\n}\n\nstruct P {\n\tint x, y;\n} *pl, *pr;\n\ntypedef struct P *T[(X + X + 1) * 4];\n\nlong long cross(struct P *o, struct P *p, struct P *q) {\n\treturn cross2(p->x - o->x, p->y - o->y, q->x - o->x, q->y - o->y);\n}\n\nstruct P *min(struct P *p, struct P *q) {\n\treturn p != NULL && q != NULL ? (p->x < q->x ? p : q) : (p == NULL ? q : p);\n}\n\nstruct P *max(struct P *p, struct P *q) {\n\treturn p != NULL && q != NULL ? (p->x > q->x ? p : q) : (p == NULL ? q : p);\n}\n\nvoid update(T tl, T tr, int k, int l, int r, int x, struct P *p) {\n\tint m;\n\n\tif (r - l == 1) {\n\t\ttl[k] = tr[k] = p;\n\t\treturn;\n\t}\n\tm = (l + r) \/ 2;\n\tif (x < m)\n\t\tupdate(tl, tr, k * 2 + 1, l, m, x, p);\n\telse\n\t\tupdate(tl, tr, k * 2 + 2, m, r, x, p);\n\ttr[k] = min(tr[k * 2 + 1], tr[k * 2 + 2]);\n\ttl[k] = max(tl[k * 2 + 1], tl[k * 2 + 2]);\n}\n\nvoid query(T tl, T tr, int k, int l, int r, int x) {\n\tint m;\n\n\tif (r - l == 1) {\n\t\tpl = max(pl, tl[k]);\n\t\tpr = min(pr, tr[k]);\n\t\treturn;\n\t}\n\tm = (l + r) \/ 2;\n\tif (x < m) {\n\t\tpr = min(pr, tr[k * 2 + 2]);\n\t\tquery(tl, tr, k * 2 + 1, l, m, x);\n\t} else {\n\t\tpl = max(pl, tl[k * 2 + 1]);\n\t\tquery(tl, tr, k * 2 + 2, m, r, x);\n\t}\n}\n\nint query_(T tl_up, T tr_up, T tl_dn, T tr_dn, struct P *p, int insert) {\n\tstruct P *q;\n\tint inside = 1;\n\n\tpl = pr = NULL;\n\tquery(tl_up, tr_up, 0, 0, X + X + 1, p->x);\n\tif ((pl == pr\n\t\t\t\t&& (pl == NULL || pl->y < p->y))\n\t\t\t|| (pl != pr\n\t\t\t\t&& (pl == NULL || pr == NULL || cross(pl, p, pr) < 0))) {\n\t\tif (insert) {\n\t\t\twhile ((q = pl) && q->x > 0) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_up, tr_up, 0, 0, X + X + 1, q->x - 1);\n\t\t\t\tif (!pl || cross(pl, q, p) < 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\twhile ((q = pr) && q->x < X + X) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_up, tr_up, 0, 0, X + X + 1, q->x + 1);\n\t\t\t\tif (!pr || cross(p, q, pr) < 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, p->x, p);\n\t\t}\n\t\tinside = 0;\n\t}\n\tpl = pr = NULL;\n\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, p->x);\n\tif ((pl == pr\n\t\t\t\t&& (pl == NULL || pl->y > p->y))\n\t\t\t|| (pl != pr\n\t\t\t\t&& (pl == NULL || pr == NULL || cross(pl, p, pr) > 0))) {\n\t\tif (insert) {\n\t\t\twhile ((q = pl) && q->x > 0) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, q->x - 1);\n\t\t\t\tif (!pl || cross(pl, q, p) > 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\twhile ((q = pr) && q->x < X + X) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, q->x + 1);\n\t\t\t\tif (!pr || cross(p, q, pr) > 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, p->x, p);\n\t\t}\n\t\tinside = 0;\n\t}\n\treturn inside;\n}\n\nint main() {\n\tstatic T tl_up, tr_up, tl_dn, tr_dn;\n\tint q;\n\n\tscanf(\"%d\", &q);\n\twhile (q-- > 0) {\n\t\tstruct P *p = malloc(sizeof *p);\n\t\tint t;\n\n\t\tscanf(\"%d%d%d\", &t, &p->x, &p->y);\n\t\tp->x += X;\n\t\tif (t == 1)\n\t\t\tquery_(tl_up, tr_up, tl_dn, tr_dn, p, 1);\n\t\telse\n\t\t\tprintf(query_(tl_up, tr_up, tl_dn, tr_dn, p, 0) ? \"YES\\n\" : \"NO\\n\");\n\t}\n\treturn 0;\n}\n","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"],"human_solution":"#include \n#include \n\n#define X\t1000000\n#define Q\t100000\n\nlong long cross2(long long x1, long long y1, long long x2, long long y2) {\n\treturn x1 * y2 - x2 * y1;\n}\n\nstruct P {\n\tint x, y;\n} *pl, *pr;\n\ntypedef struct P *T[(X + X + 1) * 4];\n\nlong long cross(struct P *o, struct P *p, struct P *q) {\n\treturn cross2(p->x - o->x, p->y - o->y, q->x - o->x, q->y - o->y);\n}\n\nstruct P *min(struct P *p, struct P *q) {\n\treturn p != NULL && q != NULL ? (p->x < q->x ? p : q) : (p == NULL ? q : p);\n}\n\nstruct P *max(struct P *p, struct P *q) {\n\treturn p != NULL && q != NULL ? (p->x > q->x ? p : q) : (p == NULL ? q : p);\n}\n\nvoid update(T tl, T tr, int k, int l, int r, int x, struct P *p) {\n\tint m;\n\n\tif (r - l == 1) {\n\t\ttl[k] = tr[k] = p;\n\t\treturn;\n\t}\n\tm = (l + r) \/ 2;\n\tif (x < m)\n\t\tupdate(tl, tr, k * 2 + 1, l, m, x, p);\n\telse\n\t\tupdate(tl, tr, k * 2 + 2, m, r, x, p);\n\ttr[k] = min(tr[k * 2 + 1], tr[k * 2 + 2]);\n\ttl[k] = max(tl[k * 2 + 1], tl[k * 2 + 2]);\n}\n\nvoid query(T tl, T tr, int k, int l, int r, int x) {\n\tint m;\n\n\tif (r - l == 1) {\n\t\tpl = max(pl, tl[k]);\n\t\tpr = min(pr, tr[k]);\n\t\treturn;\n\t}\n\tm = (l + r) \/ 2;\n\tif (x < m) {\n\t\tpr = min(pr, tr[k * 2 + 2]);\n\t\tquery(tl, tr, k * 2 + 1, l, m, x);\n\t} else {\n\t\tpl = max(pl, tl[k * 2 + 1]);\n\t\tquery(tl, tr, k * 2 + 2, m, r, x);\n\t}\n}\n\nint query_(T tl_up, T tr_up, T tl_dn, T tr_dn, struct P *p, int insert) {\n\tstruct P *q, *pl_, *pr_;\n\tint inside = 1;\n\n\tpl = pr = NULL;\n\tquery(tl_up, tr_up, 0, 0, X + X + 1, p->x);\n\tpl_ = pl, pr_ = pr;\n\tif ((pl == pr\n\t\t\t\t&& (pl == NULL || pl->y < p->y))\n\t\t\t|| (pl != pr\n\t\t\t\t&& (pl == NULL || pr == NULL || cross(pl, p, pr) < 0))) {\n\t\tif (insert) {\n\t\t\tfor (q = pl_; q && q->x > 0; q = pl) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_up, tr_up, 0, 0, X + X + 1, q->x - 1);\n\t\t\t\tif (!pl || cross(pl, q, p) < 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tfor (q = pr_; q && q->x < X + X; q = pr) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_up, tr_up, 0, 0, X + X + 1, q->x + 1);\n\t\t\t\tif (!pr || cross(p, q, pr) < 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tupdate(tl_up, tr_up, 0, 0, X + X + 1, p->x, p);\n\t\t}\n\t\tinside = 0;\n\t}\n\tpl = pr = NULL;\n\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, p->x);\n\tpl_ = pl, pr_ = pr;\n\tif ((pl == pr\n\t\t\t\t&& (pl == NULL || pl->y > p->y))\n\t\t\t|| (pl != pr\n\t\t\t\t&& (pl == NULL || pr == NULL || cross(pl, p, pr) > 0))) {\n\t\tif (insert) {\n\t\t\tfor (q = pl_; q && q->x > 0; q = pl) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, q->x - 1);\n\t\t\t\tif (!pl || cross(pl, q, p) > 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tfor (q = pr_; q && q->x < X + X; q = pr) {\n\t\t\t\tpl = pr = NULL;\n\t\t\t\tquery(tl_dn, tr_dn, 0, 0, X + X + 1, q->x + 1);\n\t\t\t\tif (!pr || cross(p, q, pr) > 0)\n\t\t\t\t\tbreak;\n\t\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, q->x, NULL);\n\t\t\t}\n\t\t\tupdate(tl_dn, tr_dn, 0, 0, X + X + 1, p->x, p);\n\t\t}\n\t\tinside = 0;\n\t}\n\treturn inside;\n}\n\nint main() {\n\tstatic T tl_up, tr_up, tl_dn, tr_dn;\n\tint q;\n\n\tscanf(\"%d\", &q);\n\twhile (q-- > 0) {\n\t\tstruct P *p = malloc(sizeof *p);\n\t\tint t;\n\n\t\tscanf(\"%d%d%d\", &t, &p->x, &p->y);\n\t\tp->x += X;\n\t\tif (t == 1)\n\t\t\tquery_(tl_up, tr_up, tl_dn, tr_dn, p, 1);\n\t\telse\n\t\t\tprintf(query_(tl_up, tr_up, tl_dn, tr_dn, p, 0) ? \"YES\\n\" : \"NO\\n\");\n\t}\n\treturn 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":214} {"difficulty":2400,"lang":"GNU C","lang_cluster":"C","src_uid":"788cb3da98fd4a56720f800588061b79","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n#define MOD 1000000007\nint n,m,a[210];\nlong long ans,f[2][210][1010];\nint comp(const void *a,const void *b)\n{\n return *(int*)a - *(int*)b;\n}\nint main()\n{\n int i,j,k,v;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++) scanf(\"%d\",&a[i]);\n qsort(a+1,n,sizeof(int),comp);\n f[0][1][0] = f[0][0][0] = 1;\n for(i=2;i<=n;i++)\n {\n v = a[i]-a[i-1];\n for(j=0;j<=n;j++) for(k=0;k<=m;k++)\n {\n if(k>=j*v) f[1][j][k] = (f[1][j][k]+f[0][j][k-j*v]*(j?2:1))%MOD;\n if(j&&k>=(j-1)*v) f[1][j][k] = (f[1][j][k]+f[0][j-1][k-(j-1)*v])%MOD;\n if(k>=(j+1)*v) f[1][j][k] = (f[1][j][k]+f[0][j+1][k-(j+1)*v])%MOD;\n }\n memcpy(f[0],f[1],sizeof(f[1]));\n memset(f[1],0,sizeof(f[1]));\n }\n for(k=0;k<=m;k++) ans = (ans+f[0][0][k])%MOD;\n printf(\"%I64d\",ans);\n return 0;\n}","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"],"human_solution":"#include\n#include\n#include\n\ntypedef long long LL;\n\nint comp(const void * a, const void * b){\n\treturn *((int*)a)-*((int*)b);\n}\n\nint a[200], n, k;\nLL dp[2][201][1001];\nconst LL mod=1000000007;\n\nLL get(int i, int num, int s){\n\tif(s>k || num<0) return 0;\n\treturn dp[i&1][num][s];\n}\n\nint main(){\n\tint i, j, l, add;\n\tscanf(\"%d %d\", &n, &k);\n\tfor(i=0;i0;--i){\n\t\tfor(j=0;j<=n;++j){\n\t\t\tadd=j*(a[i]-a[i-1]);\n\t\t\tfor(l=0;l<=k;++l){\n\t\t\t\tdp[i&1][j][l]=(get(i+1, j+1, l+add)+j*get(i+1, j-1, l+add)+\n\t\t\t\t\t\t(j+1)*get(i+1, j, l+add))%mod;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", (get(1, 1, 0)+get(1, 0, 0))%mod);\n\treturn 0;\n}\n","testcases":"[{'input': '3 2\\r\\n2 4 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 3\\r\\n7 8 9 10\\r\\n', 'output': ['13\\r\\n']}, {'input': '4 0\\r\\n5 10 20 21\\r\\n', 'output': ['1\\r\\n']}, {'input': '20 1000\\r\\n50 50 100 100 150 150 200 200 250 250 300 300 350 350 400 400 450 450 500 500\\r\\n', 'output': ['97456952\\r\\n']}, {'input': '5 222\\r\\n58 369 477 58 90\\r\\n', 'output': ['10\\r\\n']}, {'input': '9 222\\r\\n304 142 38 334 73 122 252 381 438\\r\\n', 'output': ['423\\r\\n']}, {'input': '9 247\\r\\n359 350 140 26 293 488 57 481 71\\r\\n', 'output': ['414\\r\\n']}, {'input': '5 341\\r\\n412 32 189 303 172\\r\\n', 'output': ['26\\r\\n']}, {'input': '200 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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': ['380668983\\r\\n']}, {'input': '121 19\\r\\n1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 2 2 1 1 2 1 1 2 1 1 1 1 1 2 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 1 1 2 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 1 2 1 2 2 2 2 2 1 1 2 2 1 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 1 1 1 2 2 1 2 1\\r\\n', 'output': ['378568711\\r\\n']}, {'input': '3 4\\r\\n10 7 10\\r\\n', 'output': ['5\\r\\n']}, {'input': '1 5\\r\\n3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 5\\r\\n9\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 2\\r\\n3 10 5 6 5\\r\\n', 'output': ['8\\r\\n']}, {'input': '1 2\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '166 7\\r\\n9 8 7 2 9 9 7 7 3 1 9 9 9 7 1 5 5 6 6 2 3 2 10 9 3 5 8 8 6 3 10 3 4 8 6 5 1 7 2 9 1 4 9 10 6 8 6 7 8 3 2 1 10 5 6 6 3 7 4 9 10 3 1 10 9 9 2 10 3 2 4 8 9 6 1 9 10 10 10 9 5 8 9 7 9 6 7 5 4 7 8 9 8 5 10 5 4 10 8 5 10 10 10 8 7 3 2 6 3 1 7 5 7 10 7 8 8 8 5 5 8 10 2 10 2 4 10 2 3 1 1 4 5 8 7 9 4 10 2 9 8 1 1 5 9 5 2 1 7 7 9 10 2 2 10 10 6 8 5 5 9 4 3 1 10 5\\r\\n', 'output': ['194851520\\r\\n']}, {'input': '94 17\\r\\n9 10 10 5 2 7 10 9 5 5 7 7 6 10 4 10 3 7 4 9 2 5 1 5 4 2 9 8 4 3 9 5 7 10 10 6 3 1 9 9 2 8 8 8 7 2 4 5 2 5 7 7 4 9 4 9 4 10 5 10 9 7 3 6 10 3 1 10 6 4 8 9 4 10 7 2 9 8 7 10 2 2 4 1 4 6 10 7 2 4 9 4 8 5\\r\\n', 'output': ['650765262\\r\\n']}, {'input': '14 26\\r\\n3 7 8 4 7 5 10 8 4 4 1 6 7 7\\r\\n', 'output': ['190894282\\r\\n']}, {'input': '142 24\\r\\n8 1 10 6 5 3 9 4 4 8 2 7 4 4 1 2 7 4 7 3 3 9 9 6 6 10 8 5 3 2 3 4 7 9 9 8 4 7 8 6 9 1 7 9 10 2 6 1 9 9 1 10 2 10 6 5 10 2 3 8 3 7 1 8 9 10 1 8 10 7 2 5 1 1 4 6 5 7 6 10 4 4 7 4 10 5 10 9 8 7 4 10 4 4 3 4 10 6 1 4 8 5 10 6 3 8 8 4 2 3 2 1 7 5 2 4 2 3 10 7 8 3 10 9 1 7 7 5 5 5 10 8 8 2 6 9 7 2 4 7 7 3\\r\\n', 'output': ['287439553\\r\\n']}, {'input': '166 34\\r\\n6 5 3 3 4 5 4 6 4 6 2 6 5 1 7 4 5 5 6 1 2 2 6 4 3 7 4 5 1 7 3 1 6 5 1 3 6 4 9 7 6 6 6 5 8 6 2 4 5 6 10 10 4 8 3 6 1 4 7 9 8 5 2 9 8 10 2 2 6 1 3 6 6 9 10 8 10 5 8 10 5 9 2 4 8 2 9 2 1 9 5 9 3 8 1 10 4 1 1 4 9 6 10 6 2 1 4 5 5 8 10 10 5 6 3 10 1 8 5 10 3 3 10 9 7 4 1 9 9 10 8 3 4 2 8 10 6 3 10 10 4 6 8 7 9 7 10 3 1 10 4 10 5 2 7 9 4 10 6 2 6 3 9 10 9 10\\r\\n', 'output': ['772974256\\r\\n']}, {'input': '171 302\\r\\n64 51 53 35 36 42 67 27 55 85 97 23 47 8 59 69 50 15 28 36 22 12 49 99 54 11 10 91 91 78 59 65 68 5 20 77 42 59 85 65 69 35 59 86 45 96 41 82 89 93 80 25 16 22 68 8 23 57 48 53 16 21 50 44 70 75 33 32 43 32 77 40 8 41 23 82 61 51 26 88 58 23 6 69 11 95 89 41 70 95 81 50 99 81 48 36 62 85 64 58 25 30 23 27 30 87 45 42 67 47 1 1 86 33 43 78 41 57 72 86 55 25 69 36 77 97 48 24 9 20 50 5 2 84 80 62 7 5 49 2 16 3 62 8 40 24 94 60 9 95 22 27 58 20 22 95 16 53 6 8 74 54 94 65 62 90 95 17 77 32 99\\r\\n', 'output': ['49555477\\r\\n']}, {'input': '158 396\\r\\n10 33 14 7 23 30 23 9 99 41 88 56 70 25 85 27 68 60 73 14 32 87 6 16 71 64 22 66 9 48 46 93 81 9 50 48 80 70 78 76 49 89 56 74 56 40 67 45 3 41 77 49 8 56 55 29 78 69 52 70 55 99 85 6 59 99 24 66 4 23 4 51 84 67 79 65 6 67 80 36 85 47 45 37 75 38 39 59 7 11 81 7 12 79 56 87 9 97 30 32 27 21 42 85 17 50 69 13 51 12 73 60 14 94 93 31 10 9 70 67 52 63 45 38 37 13 46 50 53 29 50 57 49 81 71 79 58 74 19 47 19 14 16 82 18 11 71 90 28 21 48 16 41 52 24 6 4 23\\r\\n', 'output': ['757778575\\r\\n']}, {'input': '169 129\\r\\n66 70 83 26 65 94 1 56 17 64 58 68 23 73 45 93 30 94 22 55 68 29 73 44 35 39 71 76 76 76 19 98 99 26 43 73 96 6 72 23 8 56 34 17 91 64 17 33 56 92 41 22 92 59 23 96 35 94 82 1 61 41 75 89 10 74 13 64 50 78 49 83 6 62 43 22 61 95 28 4 76 14 54 41 83 81 83 23 13 57 10 2 44 54 89 41 27 58 57 47 26 82 97 82 5 35 27 31 89 6 73 36 94 89 29 96 3 88 82 27 50 56 73 24 17 56 25 9 2 47 71 86 96 79 35 42 31 73 13 89 52 30 88 96 46 91 23 60 79 2 19 7 73 40 6 29 61 29 67 85 75 11 8 34 60 19 87 23 55\\r\\n', 'output': ['538924707\\r\\n']}, {'input': '195 110\\r\\n3 4 5 1 3 5 4 1 2 4 3 2 4 4 3 2 5 5 5 3 3 3 5 3 5 4 2 5 1 1 2 3 4 5 5 2 2 4 3 4 2 4 4 3 4 2 3 3 3 5 2 1 3 2 5 5 2 2 1 2 2 5 4 2 4 2 4 1 4 2 4 4 4 4 3 5 3 1 2 2 3 4 3 4 4 1 2 1 2 4 5 2 4 3 4 1 4 4 4 5 1 2 4 5 3 5 3 4 2 4 5 2 5 2 5 4 1 5 1 4 2 5 1 2 4 1 3 3 5 5 4 2 3 4 5 4 4 5 2 3 4 2 5 3 2 1 5 3 5 3 5 2 3 2 5 3 5 4 5 1 5 3 3 2 2 5 4 3 3 2 5 5 5 5 2 1 2 3 1 3 5 2 4 5 3 2 2 5 5 2 3 1 3 4 5\\r\\n', 'output': ['21311661\\r\\n']}, {'input': '196 17\\r\\n4 4 2 2 4 2 2 4 4 3 4 1 5 4 4 5 4 1 1 1 5 1 1 4 3 4 4 1 1 1 5 3 2 4 2 1 5 3 4 2 4 2 5 4 1 4 1 2 3 5 3 5 3 2 5 5 5 2 2 1 1 2 2 2 5 4 5 2 5 5 3 1 5 3 5 5 1 3 3 2 3 2 2 1 5 1 2 5 4 5 4 3 4 4 4 1 5 5 2 2 2 5 3 4 5 3 3 2 4 4 4 3 1 1 1 5 2 5 1 5 1 2 3 3 4 4 5 4 2 5 4 2 3 3 4 5 2 2 4 5 5 2 2 1 3 3 4 3 2 3 4 4 5 2 5 1 4 5 2 3 2 4 4 3 4 4 2 5 5 5 5 4 1 3 2 1 4 5 3 2 3 3 5 4 3 1 4 4 5 2 5 2 2 1 4 3\\r\\n', 'output': ['140496580\\r\\n']}, {'input': '200 558\\r\\n1 1 1 3 2 1 1 5 1 2 1 1 2 2 1 5 2 5 2 5 3 2 4 1 5 2 3 2 3 1 2 2 1 4 4 2 5 1 4 3 2 2 4 5 4 5 2 5 5 4 3 5 4 5 5 2 3 4 3 1 5 4 3 3 3 3 2 2 3 4 1 3 1 4 5 2 3 4 1 5 2 3 3 5 5 3 3 1 2 5 3 4 2 5 2 3 3 1 3 2 3 5 1 2 1 1 3 4 1 3 2 1 1 4 2 5 1 2 1 2 2 2 2 2 3 4 2 2 4 4 2 1 3 3 2 4 1 3 5 4 5 1 5 2 1 4 2 3 4 1 4 5 1 1 5 2 4 5 5 4 4 5 3 1 1 5 4 2 2 5 1 3 3 3 4 1 1 2 3 4 1 5 2 2 3 1 4 3 5 1 5 3 2 1 3 2 1 1 3 2\\r\\n', 'output': ['380668983\\r\\n']}, {'input': '190 152\\r\\n2 2 4 4 4 2 2 1 2 3 5 5 4 3 5 1 2 2 2 2 3 3 5 2 1 1 3 4 3 2 2 4 2 3 1 4 2 2 3 2 3 5 3 2 4 1 4 1 2 4 1 3 4 4 3 4 4 4 4 5 2 4 5 3 3 5 4 4 3 4 1 4 1 4 3 3 5 5 2 3 2 2 2 5 4 4 2 4 3 4 2 2 1 4 1 2 3 3 3 5 1 5 5 1 4 3 2 5 2 5 5 5 2 3 3 4 1 1 3 2 5 5 2 5 2 3 5 1 1 5 4 1 1 3 5 2 3 4 3 4 2 1 4 3 5 2 1 1 1 5 2 5 3 4 5 5 2 3 5 5 5 5 1 5 2 5 5 2 4 4 4 3 1 1 2 1 4 4 3 4 2 5 5 3 4 5 5 2 1 4\\r\\n', 'output': ['3475416\\r\\n']}, {'input': '191 640\\r\\n20 10 14 20 13 9 16 5 14 1 11 18 16 17 7 4 15 18 17 3 3 15 14 20 18 2 4 14 20 17 7 2 3 9 5 10 7 6 7 17 3 5 10 1 18 13 15 4 15 7 19 1 17 6 15 12 4 19 1 9 18 18 9 13 3 15 9 3 17 14 18 4 9 3 9 19 20 15 18 11 3 1 12 8 11 10 20 14 14 6 2 14 16 1 7 2 11 15 1 9 20 4 1 1 3 20 20 4 11 7 19 3 3 6 15 10 18 9 13 14 16 12 3 1 15 10 5 14 19 17 9 10 10 15 12 12 5 2 11 6 5 6 7 14 7 6 5 10 13 10 18 20 18 20 12 7 6 10 4 4 3 13 14 5 9 10 4 6 11 11 15 15 12 19 4 7 20 3 12 4 16 6 4 9 17 10 18 11 13 12 18\\r\\n', 'output': ['66598866\\r\\n']}, {'input': '197 344\\r\\n5 11 3 17 16 1 12 7 13 5 9 11 15 14 13 7 13 11 5 9 20 11 11 9 19 3 20 4 6 15 2 14 16 5 19 5 5 5 12 12 12 19 18 1 5 17 13 7 17 14 4 5 9 20 14 13 15 3 8 2 13 16 20 10 20 14 8 17 14 4 9 16 8 13 5 2 13 11 9 7 9 5 11 20 3 17 9 12 12 3 9 19 6 3 15 9 5 11 2 3 13 14 15 7 9 19 16 11 6 8 11 18 11 11 16 18 3 5 10 19 10 6 3 19 3 18 16 16 7 3 10 13 13 16 19 13 4 7 1 7 12 9 6 8 6 1 6 20 7 12 9 13 13 12 10 10 10 16 9 6 11 14 14 7 2 1 16 15 12 7 15 18 8 4 6 18 2 17 6 5 13 19 12 7 1 9 15 9 18 5 8 3 7 8 4 15 8\\r\\n', 'output': ['132934747\\r\\n']}, {'input': '200 0\\r\\n2 5 2 7 6 10 10 4 7 9 1 5 7 1 8 5 9 8 5 2 6 4 9 10 5 4 4 4 8 7 7 5 9 7 7 4 9 8 5 8 10 5 1 2 8 4 3 7 9 6 9 3 9 2 1 9 2 7 4 10 4 7 10 6 1 6 7 4 4 9 10 3 5 5 1 2 8 6 6 2 2 8 6 3 6 1 4 6 10 6 4 8 3 9 6 7 7 8 5 2 10 9 2 7 3 6 10 6 8 9 6 6 8 4 6 9 2 10 9 4 2 3 4 1 3 9 4 2 4 10 10 1 2 3 9 8 2 1 10 7 8 3 10 5 3 10 9 1 9 2 6 7 2 1 10 4 4 9 9 1 8 1 10 9 8 9 9 7 4 3 6 7 10 9 2 7 8 10 2 7 7 6 9 5 9 7 3 1 7 1 5 9 7 3 10 3 10 8 5 7\\r\\n', 'output': ['563633437\\r\\n']}, {'input': '107 59\\r\\n416 332 455 497 251 13 496 46 176 382 357 268 441 302 305 11 274 61 412 18 225 332 173 371 54 179 378 85 471 176 439 36 81 275 452 212 261 488 166 274 89 183 478 337 313 196 130 87 14 223 341 46 45 306 175 488 113 354 107 411 469 122 436 293 311 60 453 245 184 13 425 360 302 205 151 89 433 285 119 301 274 64 127 496 350 354 262 2 148 232 117 28 11 398 237 460 421 347 142 76 391 317 164 484 35 310 453\\r\\n', 'output': ['955755252\\r\\n']}, {'input': '27 383\\r\\n161 2 16 478 438 205 151 229 116 230 447 497 456 219 28 57 200 6 161 400 338 11 426 283 275 40 190\\r\\n', 'output': ['258971846\\r\\n']}, {'input': '107 497\\r\\n218 342 381 296 272 169 321 275 435 461 422 209 413 366 295 332 458 253 302 245 70 353 405 420 439 314 232 466 364 374 4 469 116 291 75 500 212 127 157 440 429 396 53 68 151 264 2 134 73 31 494 148 426 459 27 175 225 287 241 60 14 437 457 446 51 350 233 177 88 455 497 303 107 130 76 125 441 229 325 318 187 459 178 172 226 236 465 289 491 494 146 280 456 475 286 457 277 224 435 365 100 77 145 448 118 454 431\\r\\n', 'output': ['480907144\\r\\n']}, {'input': '27 209\\r\\n272 116 134 369 255 453 477 162 78 1 12 142 236 283 209 390 476 493 51 23 387 32 262 128 160 71 56\\r\\n', 'output': ['415376034\\r\\n']}, {'input': '85 655\\r\\n411 473 456 4 14 135 49 240 191 230 60 375 373 115 301 20 421 187 267 347 207 428 81 318 10 370 428 272 247 322 294 477 274 110 238 244 72 399 146 392 207 83 164 87 257 341 97 94 286 375 25 271 177 270 169 149 279 105 387 92 352 342 274 247 236 344 35 336 419 465 169 371 62 112 490 48 36 343 248 428 241 223 369 296 86\\r\\n', 'output': ['275193712\\r\\n']}, {'input': '107 19\\r\\n2 5 2 5 4 4 1 5 3 3 4 3 2 5 3 1 4 1 4 1 3 1 4 4 1 5 4 1 2 3 3 3 4 2 5 2 3 4 5 2 1 5 3 1 5 5 1 5 3 3 3 5 5 2 4 3 3 4 5 4 2 5 2 4 3 5 2 5 2 1 1 1 1 2 1 4 2 3 4 3 2 4 4 2 2 3 5 5 1 4 1 2 4 4 1 3 3 5 2 3 4 1 2 3 1 5 2\\r\\n', 'output': ['114012476\\r\\n']}, {'input': '186 35\\r\\n4 4 3 2 4 3 1 2 2 2 4 2 5 3 1 3 1 1 2 4 2 5 5 5 1 3 4 1 5 3 5 5 2 4 5 3 1 1 2 1 2 4 2 3 3 4 4 3 3 5 3 1 4 5 5 4 5 2 3 1 2 2 2 4 3 4 1 4 1 2 1 1 1 5 1 1 4 5 3 5 3 3 4 1 5 1 1 4 5 3 3 2 5 3 5 1 5 2 5 1 4 2 4 5 4 4 4 5 4 4 2 5 2 4 4 5 3 2 5 4 1 1 5 5 5 5 1 3 2 5 5 4 3 2 2 5 5 3 1 4 3 4 3 1 2 5 4 4 2 2 5 3 2 1 2 1 1 3 1 4 1 2 3 2 1 5 5 2 2 1 2 1 5 2 4 4 3 2 5 5 2 3 4 5 5 3\\r\\n', 'output': ['273232004\\r\\n']}, {'input': '150 978\\r\\n34 20 7 39 15 14 39 49 36 13 12 12 30 40 4 17 8 2 48 10 16 2 33 36 41 30 4 35 32 35 12 14 28 3 7 3 36 46 43 19 7 38 48 24 19 21 9 31 3 3 8 23 21 49 44 29 15 6 11 40 39 12 44 40 41 37 7 39 40 17 34 21 22 19 30 21 14 3 16 50 38 38 27 7 4 33 20 23 27 32 14 50 33 36 38 22 27 27 14 2 27 37 33 6 21 44 25 17 28 22 43 10 33 21 42 4 7 42 10 20 22 49 14 18 26 19 43 4 31 18 13 17 5 46 19 35 31 14 28 29 48 9 9 4 10 15 30 5 9 23\\r\\n', 'output': ['338032038\\r\\n']}, {'input': '115 588\\r\\n39 133 47 175 120 1 183 148 115 9 196 101 18 156 156 74 43 149 95 56 72 84 32 104 16 188 88 168 164 18 36 105 131 60 26 151 46 160 16 45 76 16 157 190 120 37 102 29 190 57 178 38 89 75 143 2 80 7 11 31 101 28 171 46 93 100 23 163 146 135 12 73 140 144 177 43 19 158 26 20 39 173 97 8 169 139 23 105 7 171 79 11 156 77 164 63 165 124 126 108 125 118 58 129 146 152 31 133 5 160 89 136 174 121 185\\r\\n', 'output': ['27195433\\r\\n']}]","id":215} {"difficulty":1700,"lang":"GNU C","lang_cluster":"C","src_uid":"867facaa8bcdfcb53ec3647387f7d23f","execute_outcome":"WRONG_ANSWER","source_code":"\n#include \n\n#define FOR(index, max_val) for(index = 0; index < max_val; index++)\n\nint array[10000];\nint indexes[10000];\n\nint compare1(const void *a, const void *b) {\n return ( array[*(int*)a] - array[*(int*)b] );\n}\n\nint main() {\n int i;\n int n, a, b;\n\n scanf(\"%d%d%d\", &n, &a, &b);\n FOR(i, n) {\n scanf(\"%d\", &array[i]);\n indexes[i] = i;\n if(a < b) array[i] = -array[i];\n }\n\n if(a != b) {\n qsort(indexes, n, sizeof(int), compare1);\n }\n FOR(i, n) {\n if(i < a) array[indexes[i]] = 1;\n else array[indexes[i]] = 2;\n }\n\n\n FOR(i, n) {\n printf(\"%d\", array[i]);\n if(i != n-1) printf(\" \");\n else printf(\"\\n\");\n }\n\n return 0;\n}\n\n","description":"After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.Now it's time to show the journal to his strict parents. Polycarp knows that recently at the Parent Meeting the parents were told that he received a Safety Studies marks and b PE marks (a\u2009+\u2009b\u2009=\u2009n). Now Polycarp wants to write a subject's name in front of each mark so that: there are exactly a Safety Studies marks, there are exactly b PE marks, the total average score in both subjects is maximum. An average subject grade is the sum of all marks in it, divided by the number of them. Of course, the division is performed in real numbers without rounding up or down. Polycarp aims to maximize the x1\u2009+\u2009x2, where x1 is the average score in the first subject (Safety Studies), and x2 is the average score in the second one (Physical Education).","input_specification":"The first line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105), n is the number of marks in Polycarp's Journal. The second line contains two positive integers a,\u2009b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n\u2009-\u20091,\u2009a\u2009+\u2009b\u2009=\u2009n). The third line contains a sequence of integers t1,\u2009t2,\u2009...,\u2009tn (1\u2009\u2264\u2009ti\u2009\u2264\u20095), they are Polycarp's marks.","output_specification":"Print the sequence of integers f1,\u2009f2,\u2009...,\u2009fn, where fi (1\u2009\u2264\u2009fi\u2009\u2264\u20092) is the number of a subject to which the i-th mark should be attributed. If there are several possible solutions, then print such that the sequence f1,\u2009f2,\u2009...,\u2009fn is the smallest lexicographically. The sequence p1,\u2009p2,\u2009...,\u2009pn is lexicographically less than q1,\u2009q2,\u2009...,\u2009qn if there exists such j (1\u2009\u2264\u2009j\u2009\u2264\u2009n) that pi\u2009=\u2009qi for all 1\u2009\u2264\u2009i\u2009<\u2009j, \u0430nd pj\u2009<\u2009qj.","notes":"NoteIn the first sample the average score in the first subject is equal to 4, and in the second one \u2014 to 4.5. The total average score is 8.5.","sample_inputs":["5\n3 2\n4 4 5 4 4","4\n2 2\n3 5 4 5","6\n1 5\n4 4 4 5 4 4"],"sample_outputs":["1 1 2 1 2","1 1 2 2","2 2 2 1 2 2"],"human_solution":"\n#include \n\n#define FOR(index, max_val) for(index = 0; index < max_val; index++)\n\nint array[100010];\nint indexes[100010];\nint n;\n\nint compare1(const void *a, const void *b) {\n return (array[*(int*)a] != array[*(int*)b])?(array[*(int*)a] - array[*(int*)b]):(*(int*)a - *(int*)b);\n}\n\nint compare2(const void *a, const void *b) {\n return (array[*(int*)a] != array[*(int*)b])?( - array[*(int*)a] + array[*(int*)b]):(*(int*)a - *(int*)b);\n}\n\nint main() {\n int i, j;\n int a, b;\n\n scanf(\"%d%d%d\", &n, &a, &b);\n FOR(i, n) {\n scanf(\"%d\", &array[i]);\n indexes[i] = i;\n }\n\n if(a > b) {\n\t\tqsort(indexes, n, sizeof(int), compare1);\n } else if(a < b) {\n\t\tqsort(indexes, n, sizeof(int), compare2);\n\t}\n\t\/\/FOR(i, n) printf(\"%d \", indexes[i]);\n\t\/\/printf(\"\\n\");\n\tfor(i = 0; i < a; i++) array[indexes[i]] = 1;\n\tfor(i = a; i < n; i++) array[indexes[i]] = 2;\n\n FOR(i, n-1) printf(\"%d \", array[i]);\n printf(\"%d\\n\", array[i]);\n\n return 0;\n}\n\n","testcases":"[{'input': '5\\r\\n3 2\\r\\n4 4 5 4 4\\r\\n', 'output': ['1 1 2 1 2 ']}, {'input': '4\\r\\n2 2\\r\\n3 5 4 5\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '6\\r\\n1 5\\r\\n4 4 4 5 4 4\\r\\n', 'output': ['2 2 2 1 2 2 ']}, {'input': '4\\r\\n2 2\\r\\n2 1 3 3\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '9\\r\\n3 6\\r\\n4 5 4 1 2 2 2 4 5\\r\\n', 'output': ['1 1 2 2 2 2 2 2 1 ']}, {'input': '2\\r\\n1 1\\r\\n4 4\\r\\n', 'output': ['1 2 ']}, {'input': '2\\r\\n1 1\\r\\n5 1\\r\\n', 'output': ['1 2 ']}, {'input': '3\\r\\n2 1\\r\\n1 2 2\\r\\n', 'output': ['1 1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 2 2\\r\\n', 'output': ['2 1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 2 3\\r\\n', 'output': ['2 2 1 ']}, {'input': '3\\r\\n2 1\\r\\n5 5 5\\r\\n', 'output': ['1 1 2 ']}, {'input': '4\\r\\n2 2\\r\\n1 2 2 3\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '4\\r\\n1 3\\r\\n2 1 2 2\\r\\n', 'output': ['1 2 2 2 ']}, {'input': '4\\r\\n3 1\\r\\n2 1 2 2\\r\\n', 'output': ['1 1 1 2 ']}, {'input': '4\\r\\n3 1\\r\\n2 1 3 3\\r\\n', 'output': ['1 1 1 2 ']}, {'input': '4\\r\\n1 3\\r\\n2 3 3 3\\r\\n', 'output': ['2 1 2 2 ']}, {'input': '5\\r\\n1 4\\r\\n1 1 3 3 2\\r\\n', 'output': ['2 2 1 2 2 ']}, {'input': '5\\r\\n2 3\\r\\n4 3 3 3 3\\r\\n', 'output': ['1 1 2 2 2 ']}, {'input': '5\\r\\n3 2\\r\\n2 5 2 2 2\\r\\n', 'output': ['1 2 1 1 2 ']}, {'input': '5\\r\\n4 1\\r\\n4 4 1 4 4\\r\\n', 'output': ['1 1 1 1 2 ']}, {'input': '6\\r\\n1 5\\r\\n4 4 5 4 4 1\\r\\n', 'output': ['2 2 1 2 2 2 ']}, {'input': '6\\r\\n2 4\\r\\n4 4 4 4 4 4\\r\\n', 'output': ['1 1 2 2 2 2 ']}, {'input': '6\\r\\n3 3\\r\\n1 4 3 4 4 3\\r\\n', 'output': ['1 1 1 2 2 2 ']}, {'input': '6\\r\\n4 2\\r\\n5 2 3 2 3 5\\r\\n', 'output': ['2 1 1 1 1 2 ']}, {'input': '6\\r\\n5 1\\r\\n2 1 2 5 4 5\\r\\n', 'output': ['1 1 1 1 1 2 ']}, {'input': '9\\r\\n1 8\\r\\n1 2 1 5 1 5 5 1 1\\r\\n', 'output': ['2 2 2 1 2 2 2 2 2 ']}, {'input': '9\\r\\n2 7\\r\\n4 2 4 4 2 5 1 2 5\\r\\n', 'output': ['2 2 2 2 2 1 2 2 1 ']}, {'input': '9\\r\\n4 5\\r\\n3 3 3 5 3 1 4 5 1\\r\\n', 'output': ['1 2 2 1 2 2 1 1 2 ']}, {'input': '9\\r\\n5 4\\r\\n2 2 2 1 2 1 1 1 1\\r\\n', 'output': ['2 2 2 1 2 1 1 1 1 ']}, {'input': '13\\r\\n7 6\\r\\n2 3 2 2 3 4 3 2 2 3 2 3 5\\r\\n', 'output': ['1 1 1 1 2 2 2 1 1 2 1 2 2 ']}, {'input': '100\\r\\n45 55\\r\\n3 5 3 4 1 1 1 1 5 2 1 3 1 5 3 5 1 1 3 1 1 3 5 5 1 1 1 5 5 1 3 1 1 1 3 3 1 1 1 4 3 1 5 1 3 1 4 5 4 3 3 1 1 5 5 1 3 5 1 1 5 1 1 3 5 5 1 1 3 3 4 1 1 4 5 3 1 3 1 5 1 5 4 5 1 1 1 1 4 5 4 5 3 1 1 5 1 5 1 4\\r\\n', 'output': ['1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 2 2 2 2 1 2 2 1 1 2 2 2 2 1 2 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 2 1 2 1 ']}, {'input': '2\\r\\n1 1\\r\\n1 2\\r\\n', 'output': ['1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 1 1\\r\\n', 'output': ['1 2 2 ']}]","id":216} {"difficulty":1900,"lang":"GNU C","lang_cluster":"C","src_uid":"899c5b77bfc0b4b99aff310741c9c0dd","execute_outcome":"MEMORY_LIMIT_EXCEEDED","source_code":"\/* problem B *\/\n\n#include\n#include\n\n\nint find(int base[][100], int key[], int num,int k)\n {\n\n int i,j,flag=0;\n \n i=1;\n if(k>=0)\n for(i=0;i<=k;i++){\n\n for(j=0;jk && !flag) \n {\n k++;\n for(j=0;jmax) max=aux[i];\n\n return max;\n }\n\n\n\n\nint main(void)\n{\n\n\nint marks[100][2]; \t\t\t\t\t\t\t\t\t\/* vasya's marks *\/\nint aux[100],maux[100],l;\n\nint k,n,q,num,i,j,current=-1,length,sum,before;\ndouble avg;\nint cards[100][100];\n\nscanf(\"%d%d\",&n,&k);\n\nfor(i=0;i\n#include\n\n\nint find(int base[][100], int key[], int num,int k)\n {\n\n int i,j,flag=0;\n \n i=1;\n if(k>=0)\n for(i=0;i<=k;i++){\n\n for(j=0;jk && !flag) \n {\n k++;\n for(j=0;jmax) max=aux[i];\n\n return max;\n }\n\n\n\n\nint main(void)\n{\n\n\nint marks[100][2]; \t\t\t\t\t\t\t\t\t\/* vasya's marks *\/\nint aux[100],maux[100],l;\n\nint k,n,q,num,i,j,current=-1,length,sum,before;\ndouble avg;\nint cards[100][100];\n\nscanf(\"%d%d\",&n,&k);\n\nfor(i=0;i\n#include\n#include\n\nint main(void){\n int type=0,i,j,k,l,m,n;\n char str[4][10001],last[4][10001];\n scanf(\"%d %d%*c\",&n,&k);\n while(n--){\n for(i=0;i<4;i++) scanf(\"%s%*c\",str[i]);\n for(m=0;m<4;m++){\n l=strlen(str[m]);\n for(i=0,j=0;i\n#include \n#include \n#include \n\nint test(char ch[4][10000],int k)\n{\n int n[4],c[4],tmp[4][2];\n n[0]=strlen(ch[0])-1;\n n[1]=strlen(ch[1])-1;\n n[2]=strlen(ch[2])-1;\n n[3]=strlen(ch[3])-1;\n c[0]=c[1]=c[2]=c[3]=1;\n tmp[0][0]=tmp[0][1]=tmp[1][0]=tmp[1][1]=tmp[2][0]=tmp[2][1]=tmp[3][0]=tmp[3][1]=k;\n while(1)\n {\n if(c[0])\n {\n if(tmp[0][0])\n {\n if(n[0]<0||n[1]<0) return -1;\n c[0]=ch[0][n[0]]==ch[1][n[1]];\n if(ch[0][n[0]]=='a'||ch[0][n[0]]=='e'||ch[0][n[0]]=='i'||ch[0][n[0]]=='o'||ch[0][n[0]]=='u')\n {\n tmp[0][0]--;\n }\n }\n if(c[0]&&tmp[0][1])\n {\n if(n[2]<0||n[3]<0) return -1;\n c[0]=ch[2][n[2]]==ch[3][n[3]];\n if(ch[2][n[2]]=='a'||ch[2][n[2]]=='e'||ch[2][n[2]]=='i'||ch[2][n[2]]=='o'||ch[2][n[2]]=='u')\n {\n tmp[0][1]--;\n }\n }\n if(!c[0])\n {\n tmp[0][0]=tmp[0][1]=0;\n }\n }\n if(c[1])\n {\n if(tmp[1][0])\n {\n if(n[0]<0||n[2]<0) return -1;\n c[1]=ch[0][n[0]]==ch[2][n[2]];\n if(ch[0][n[0]]=='a'||ch[0][n[0]]=='e'||ch[0][n[0]]=='i'||ch[0][n[0]]=='o'||ch[0][n[0]]=='u')\n {\n tmp[1][0]--;\n }\n }\n if(c[1]&&tmp[1][1])\n {\n if(n[3]<0||n[1]<0) return -1;\n c[1]=ch[1][n[1]]==ch[3][n[3]];\n if(ch[1][n[1]]=='a'||ch[1][n[1]]=='e'||ch[1][n[1]]=='i'||ch[1][n[1]]=='o'||ch[1][n[1]]=='u')\n {\n tmp[1][1]--;\n }\n }\n if(!c[1])\n {\n tmp[1][0]=tmp[1][1]=0;\n }\n }\n if(c[2])\n {\n if(tmp[2][0])\n {\n if(n[0]<0||n[3]<0) return -1;\n c[2]=ch[0][n[0]]==ch[3][n[3]];\n if(ch[0][n[0]]=='a'||ch[0][n[0]]=='e'||ch[0][n[0]]=='i'||ch[0][n[0]]=='o'||ch[0][n[0]]=='u')\n {\n tmp[2][0]--;\n }\n }\n if(c[2]&&tmp[2][1])\n {\n if(n[2]<0||n[1]<0) return -1;\n c[2]=ch[1][n[1]]==ch[2][n[2]];\n if(ch[1][n[1]]=='a'||ch[1][n[1]]=='e'||ch[1][n[1]]=='i'||ch[1][n[1]]=='o'||ch[1][n[1]]=='u')\n {\n tmp[2][1]--;\n }\n }\n if(!c[2])\n {\n tmp[2][0]=tmp[2][1]=0;\n }\n }\n n[0]--;\n n[1]--;\n n[2]--;\n n[3]--;\n if(!tmp[0][0]&&!tmp[0][1]&&!tmp[1][0]&!tmp[1][1]&!tmp[2][0]&!tmp[2][1])\n {\n if(c[0]&&c[1]&&c[2])\n {\n return 3;\n }\n else\n {\n if(c[0])\n {\n return 0;\n }\n if(c[1])\n {\n return 1;\n }\n if(c[2])\n {\n return 2;\n }\n return -1;\n }\n }\n }\n}\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n char ch[4][10000];\n int i,t=-2,tmp;\n for(i=0;i\n#include \n\nint main()\n{\n int n, p, m = 2, i;\n double b, c;\n int a[100000];\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n\n if (n == 1 || (n == 2 && a[0] != 0)) {\n\t puts(\"0\");\n\n\t return 0;\n }\n\n if (n == 2 && a[0] == 0) {\n\t if (a[1] == 0) {\n\t puts(\"0\");\n\t } else {\n\t puts(\"1\");\n\t }\n\n\t return 0;\n }\n\n if (a[0] == 0) {\n\t if (a[1] == 0) {\n\t p = 0;\n\n\t for (i = 0; i < n; i++) {\n\t\t if (a[i] != 0) p++;\n\t }\n\n\t if (p <= 1) {\n\t\t printf(\"%d\\n\", p);\n\n\t\t return 0;\n\t }\n\t }\n\t if (a[2] == 0) {\n\t p = 0;\n\n\t for (i = 0; i < n; i++) {\n\t\t if (a[i] != 0) p++;\n\t }\n\n\t if (p <= 1) {\n\t\t printf(\"%d\\n\", p);\n\n\t\t return 0;\n\t }\n\t }\n } else {\n\t c = a[0];\n\t b = (double)a[1] \/ a[0];\n\t p = 0;\n\n\t for (i = 1; i < n; i++) {\n\t if (abs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n\n\t c = a[0];\n\t b = (double)a[2] \/ a[0];\n\t p = 1;\n\n\t for (i = 2; i < n; i++) {\n\t if (abs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n }\n\n if (a[1] == 0) {\n\t if (a[2] == 0) {\n\t for (i = 3; i < n; i++) {\n\t\t if (a[i] != 0) break;\n\t }\n\n\t if (i == n) {\n\t\t if (m > 1) m = 1;\n\n\t\t printf(\"%d\\n\", m);\n\n\t\t return 0;\n\t }\n\t }\n } else {\n\t c = a[1];\n\t b = (double)a[2] \/ a[1];\n\t p = 1;\n\n\t for (i = 2; i < n; i++) {\n\t if (abs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n }\n\n printf(\"%d\\n\", m);\n\n return 0;\n}\n","description":"Polycarp loves geometric progressions \u2014 he collects them. However, as such progressions occur very rarely, he also loves the sequences of numbers where it is enough to delete a single element to get a geometric progression.In this task we shall define geometric progressions as finite sequences of numbers a1,\u2009a2,\u2009...,\u2009ak, where ai\u2009=\u2009c\u00b7bi\u2009-\u20091 for some real numbers c and b. For example, the sequences [2, -4, 8], [0, 0, 0, 0], [199] are geometric progressions and [0, 1, 2, 3] is not.Recently Polycarp has found a sequence and he can't classify it. Help him to do it. Determine whether it is a geometric progression. If it is not, check if it can become a geometric progression if an element is deleted from it.","input_specification":"The first line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of elements in the given sequence. The second line contains the given sequence. The numbers are space-separated. All the elements of the given sequence are integers and their absolute value does not exceed 104.","output_specification":"Print 0, if the given sequence is a geometric progression. Otherwise, check if it is possible to make the sequence a geometric progression by deleting a single element. If it is possible, print 1. If it is impossible, print 2.","notes":null,"sample_inputs":["4\n3 6 12 24","4\n-8 -16 24 -32","4\n0 1 2 3"],"sample_outputs":["0","1","2"],"human_solution":"#include \n#include \n\nint main()\n{\n int n, p, m = 2, i;\n double b, c;\n int a[100000];\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n\n if (n == 1 || (n == 2 && a[0] != 0)) {\n\t puts(\"0\");\n\n\t return 0;\n }\n\n if (n == 2 && a[0] == 0) {\n\t if (a[1] == 0) {\n\t puts(\"0\");\n\t } else {\n\t puts(\"1\");\n\t }\n\n\t return 0;\n }\n\n if (a[0] == 0) {\n\t if (a[1] == 0) {\n\t p = 0;\n\n\t for (i = 0; i < n; i++) {\n\t\t if (a[i] != 0) p++;\n\t }\n\n\t if (p <= 1) {\n\t\t printf(\"%d\\n\", p);\n\n\t\t return 0;\n\t }\n\t }\n\t if (a[2] == 0) {\n\t p = 0;\n\n\t for (i = 0; i < n; i++) {\n\t\t if (a[i] != 0) p++;\n\t }\n\n\t if (p <= 1) {\n\t\t printf(\"%d\\n\", p);\n\n\t\t return 0;\n\t }\n\t }\n } else {\n\t c = a[0];\n\t b = (double)a[1] \/ a[0];\n\t p = 0;\n\n\t for (i = 1; i < n; i++) {\n\t if (fabs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n\n\t c = a[0];\n\t b = (double)a[2] \/ a[0];\n\t p = 1;\n\n\t for (i = 2; i < n; i++) {\n\t if (fabs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n }\n\n if (a[1] == 0) {\n\t if (a[2] == 0) {\n\t for (i = 3; i < n; i++) {\n\t\t if (a[i] != 0) break;\n\t }\n\n\t if (i == n) {\n\t\t if (m > 1) m = 1;\n\n\t\t printf(\"%d\\n\", m);\n\n\t\t return 0;\n\t }\n\t }\n } else {\n\t c = a[1];\n\t b = (double)a[2] \/ a[1];\n\t p = 1;\n\n\t for (i = 2; i < n; i++) {\n\t if (fabs(a[i] - c * b) > 1e-6) {\n\t\t p++;\n\t } else {\n\t\t c = a[i];\n\t }\n\t }\n\n\t if (p < m) m = p;\n }\n\n printf(\"%d\\n\", m);\n\n return 0;\n}\n","testcases":"[{'input': '4\\r\\n3 6 12 24\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n-8 -16 24 -32\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n1 1 1 1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 -1 1 -1\\r\\n', 'output': ['0\\r\\n']}, {'input': '8\\r\\n1 2 4 8 16 32 -64 64\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n-1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n-1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 -1\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 2 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n0 1 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 0 -1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n-1 0 -1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 -1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 1 0 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 1 -1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 -1 -1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n-1 -1 -1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n7 91\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 -27\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n17 527\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n-17 -527\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n17 -527\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n7 21 63 189 567 1701\\r\\n', 'output': ['0\\r\\n']}, {'input': '9\\r\\n1 2 4 8 16 32 64 128 256\\r\\n', 'output': ['0\\r\\n']}, {'input': '14\\r\\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192\\r\\n', 'output': ['0\\r\\n']}, {'input': '14\\r\\n-1 -2 -4 -8 -16 -32 -64 -128 -256 -512 -1024 -2048 -4096 -8192\\r\\n', 'output': ['0\\r\\n']}, {'input': '14\\r\\n-1 2 -4 8 -16 32 -64 128 -256 512 -1024 2048 -4096 8192\\r\\n', 'output': ['0\\r\\n']}, {'input': '14\\r\\n1 -2 4 -8 16 -32 64 -128 256 -512 1024 -2048 4096 -8192\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 10 100 1000 10000\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n-1 -10 -100 -1000 -10000\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n-1 10 -100 1000 -10000\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 -10 100 -1000 10000\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n7 -77 847 -9317\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n7 77 847 9317\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n-7 -77 -847 -9317\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n-7 77 -847 9317\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n7 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 -27\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n17 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 -17\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n-17 17\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n7 21 63 189 567 -1701\\r\\n', 'output': ['1\\r\\n']}, {'input': '9\\r\\n1 2 4 8 16 32 64 128 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '14\\r\\n1 2 4 8 16 32 64 128 256 256 512 1024 2048 4096\\r\\n', 'output': ['1\\r\\n']}, {'input': '14\\r\\n-1 -2 -2 -4 -8 -16 -32 -64 -128 -256 -512 -1024 -2048 -4096\\r\\n', 'output': ['1\\r\\n']}, {'input': '14\\r\\n-1 2 -4 8 -16 32 -64 128 -256 512 -1024 -2048 2048 -4096\\r\\n', 'output': ['1\\r\\n']}, {'input': '14\\r\\n1 1 -2 4 -8 16 -32 64 -128 256 -512 1024 -2048 4096\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 10 100 1000 -10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 -1 -10 -100 -1000\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n-1 10 -100 -1000 1000\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 -10 100 -1000 -10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n0 7 -77 847\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n7 77 -847 847\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n-7 -77 847 -847\\r\\n', 'output': ['1\\r\\n']}, {'input': '7\\r\\n1 0 0 0 0 0 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 0 1 0 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n1 0 -1\\r\\n', 'output': ['1\\r\\n']}, {'input': '9\\r\\n-1 0 0 0 0 0 0 -1 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 0 -1 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n0 0 0 0 1 0 0 0 0 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n5 0 5 5 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n10000 -10000 -10000 10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n-10000 -10000 -10000 -10000 10000 -10000 -10000 -10000 -10000 10000\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 2 3 1 4 2 2 4 1 7\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n288 48 8\\r\\n', 'output': ['0\\r\\n']}, {'input': '8\\r\\n729 243 81 27 9 9 3 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n512 0 256 128 64 32 16 8 4 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n0 8 4 2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n3 2 0 1\\r\\n', 'output': ['2\\r\\n']}]","id":219} {"difficulty":1600,"lang":"GNU C","lang_cluster":"C","src_uid":"a6cba17c5ddb93f6741e00280fb6c54c","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n\n\/*\n * using double linked list for storing memory usage,\n *\/\n\ntypedef struct _node\n{\n int identifier;\n int bytes;\n int start;\n int end;\n struct _node* next;\n struct _node* prev;\n\n}node_t;\n\nnode_t* create_node(int, int);\nvoid insert_node(node_t*, node_t*);\nint remove_node(node_t*, int);\nvoid free_list(node_t*);\nint defragment(node_t*);\nint detect_alloc(node_t*, int, int);\n\n\/\/void print_list(node_t*);\n\n\nint main(void)\n{\n int t, m;\n int n; \/\/ in alloc this means bytes, in erase this means identifier\n int identifier = 1, total_usage = 0;\n char operation[16];\n node_t* head = create_node(0, -1013);\n node_t* tail = create_node(0, -1013);\n \n scanf(\"%d %d\", &t, &m);\n \n head->start = 0;\n head->end = 0;\n tail->start = m+1;\n tail->end = m+1;\n \n head->next = tail;\n tail->prev = head;\n \n \/\/print_list(head);\n \n while(t--)\n {\n scanf(\"%s\", operation);\n \n if(operation[0] == 'd') \/\/defragment\n {\n total_usage = defragment(head);\n \/\/print_list(head);\n }\n else\n {\n scanf(\"%d\", &n);\n \n if(operation[0] == 'a') \/\/alloc\n {\n if((n + total_usage) > m)\n {\n if(detect_alloc(head, n, identifier))\n {\n printf(\"%d\\n\", identifier);\n \/\/print_list(head);\n identifier++;\n }\n else\n {\n printf(\"NULL\\n\");\n \/\/print_list(head);\n }\n }\n else\n {\n total_usage += n;\n insert_node(tail, create_node(n, identifier));\n \n printf(\"%d\\n\", identifier);\n \/\/print_list(head);\n identifier++;\n }\n }\n else \/\/erase\n {\n if(n >=1 && remove_node(head, n))\n {\n \/\/print_list(head);\n if(n == identifier)\n total_usage -= n;\n }\n else\n printf(\"ILLEGAL_ERASE_ARGUMENT\\n\");\n }\n }\n }\n \n free_list(head);\n \n return 0;\n}\n\n\nnode_t* create_node(int bytes, int identifier)\n{\n node_t* n = malloc(sizeof(node_t));\n \n n->identifier = identifier;\n n->bytes = bytes;\n n->next = NULL;\n n->prev = NULL;\n \n return n;\n}\n\nvoid insert_node(node_t* tail, node_t* n)\n{\n n->prev = tail->prev;\n n->next = tail;\n tail->prev->next = n;\n tail->prev = n;\n \n n->start = n->prev->end + 1;\n n->end = n->start + n->bytes - 1;\n}\n\nint remove_node(node_t* head, int identifier)\n{\n int found = 0;\n node_t* current = head->next;\n \n while(current->identifier != -1013)\n {\n if(current->identifier == identifier)\n {\n current->identifier = 0;\n found = 1;\n break;\n }\n \n current = current->next;\n }\n\n return found;\n}\n\nvoid free_list(node_t* head)\n{\n node_t* tmp;\n \n while(head)\n {\n tmp = head;\n head = head->next;\n free(tmp);\n }\n}\n\nint defragment(node_t* head)\n{\n int total_usage = 0;\n node_t* current = head->next;\n \n while(current->identifier != -1013)\n {\n if(current->identifier == 0)\n {\n node_t* tmp = current;\n \n current->prev->next = current->next;\n current->next->prev = current->prev;\n \n current = current->next;\n free(tmp);\n }\n else\n {\n total_usage += current->bytes;\n \n current->start = current->prev->end + 1;\n current->end = current->start + current->bytes - 1;\n \n current = current->next;\n }\n }\n \n return total_usage;\n}\n\nint detect_alloc(node_t* head, int bytes, int identifier)\n{\n int allocable = 0;\n node_t* current = head->next;\n \n while(current->identifier != -1013)\n {\n \/\/detect removed space case.\n if(current->identifier == 0)\n {\n \/\/detect the section free space.\n if((\n (current->end - current->prev->end) +\\\n (current->next->start - current->start) -\\\n (current->bytes)) >= bytes)\n allocable = 1;\n }\n \n \/\/detect the free space while two used spaces case.\n \/*else\n {\n \/\/detect right side.\n if((current->next->start - current->end - 1) >= bytes)\n allocable = 2;\n \n \/\/detect left side.\n else if((current->start - current->prev->end - 1) >= bytes)\n allocable = 3;\n }*\/\n \n if(allocable)\n {\n if(allocable == 1)\n {\n current->bytes = bytes;\n current->start = current->prev->end + 1;\n current->end = current->start + bytes - 1;\n current->identifier = identifier;\n }\n \/*else if(allocable == 2)\n insert_node(current->next, create_node(bytes, identifier));\n \n else if(allocable == 3)\n insert_node(current, create_node(bytes, identifier));*\/\n \n break;\n }\n \n current = current->next;\n }\n \n return allocable;\n}\n\n\/*void print_list(node_t* head)\n{\n node_t* tmp = head;\n \n while(tmp)\n {\n printf(\"id:%d\\tbyte:%d\\tstart:%d\\tend:%d\\n\", tmp->identifier, tmp->bytes, tmp->start, tmp->end);\n tmp = tmp->next;\n }\n}*\/\n\n\n","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2009\u2264\u2009t\u2009\u2264\u2009100;1\u2009\u2264\u2009m\u2009\u2264\u2009100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2009\u2264\u2009n\u2009\u2264\u2009100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. ","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6"],"sample_outputs":["1\n2\nNULL\n3"],"human_solution":"#include \n#include \n\n\/*\n * using double linked list for storing memory usage,\n *\/\n\ntypedef struct _node\n{\n int identifier;\n int bytes;\n int start;\n int end;\n struct _node* next;\n struct _node* prev;\n\n}node_t;\n\nnode_t* create_node(int, int);\nvoid insert_node(node_t*, node_t*);\nint remove_node(node_t*, int);\nvoid free_list(node_t*);\nvoid defragment(node_t*);\nint detect_alloc(node_t*, int, int);\n\n\nint main(void)\n{\n int t, m;\n int n; \/\/ in alloc this means bytes, in erase this means identifier\n int identifier = 1;\n char operation[16];\n node_t* head = create_node(0, -1014);\n node_t* tail = create_node(0, -1013);\n \n scanf(\"%d %d\", &t, &m);\n \n head->start = 0;\n head->end = 0;\n tail->start = m+1;\n tail->end = m+1;\n \n head->next = tail;\n tail->prev = head;\n\n\n while(t--)\n {\n scanf(\"%s\", operation);\n \n if(operation[0] == 'd') \/\/defragment\n defragment(head);\n else\n {\n scanf(\"%d\", &n);\n \n if(operation[0] == 'a') \/\/alloc\n {\n if(detect_alloc(head, n, identifier))\n {\n printf(\"%d\\n\", identifier);\n identifier++;\n }\n else\n printf(\"NULL\\n\");\n }\n else if(operation[0] == 'e') \/\/erase\n {\n if(n >=1 && remove_node(head, n))\n {\n }\n else\n printf(\"ILLEGAL_ERASE_ARGUMENT\\n\");\n }\n }\n }\n \n free_list(head);\n \n return 0;\n}\n\n\nnode_t* create_node(int bytes, int identifier)\n{\n node_t* n = malloc(sizeof(node_t));\n \n n->identifier = identifier;\n n->bytes = bytes;\n n->next = NULL;\n n->prev = NULL;\n \n return n;\n}\n\nvoid insert_node(node_t* tail, node_t* n)\n{\n n->prev = tail->prev;\n n->next = tail;\n tail->prev->next = n;\n tail->prev = n;\n \n n->start = n->prev->end + 1;\n n->end = n->start + n->bytes - 1;\n}\n\nint remove_node(node_t* head, int identifier)\n{\n int found = 0;\n node_t* current = head->next;\n \n while(current->identifier != -1013)\n {\n if(current->identifier == identifier)\n {\n current->identifier = 0;\n found = 1;\n break;\n }\n \n current = current->next;\n }\n\n return found;\n}\n\nvoid free_list(node_t* head)\n{\n node_t* tmp;\n \n while(head)\n {\n tmp = head;\n head = head->next;\n free(tmp);\n }\n}\n\nvoid defragment(node_t* head)\n{\n node_t* current = head->next;\n \n while(current->identifier != -1013)\n {\n if(current->identifier == 0)\n {\n node_t* tmp = current;\n \n current->prev->next = current->next;\n current->next->prev = current->prev;\n \n current = current->next;\n free(tmp);\n }\n else\n {\n current->start = current->prev->end + 1;\n current->end = current->start + current->bytes - 1;\n \n current = current->next;\n }\n }\n}\n\nint detect_alloc(node_t* head, int bytes, int identifier)\n{\n int allocable = 0;\n node_t* current = head;\n \n while(current->identifier != -1013)\n {\n \/\/detect removed space case.\n if(current->identifier == 0)\n {\n \/\/detect the section free space.\n if((\n (current->end - current->prev->end) +\\\n (current->next->start - current->start) -\\\n (current->bytes)) >= bytes)\n allocable = 1;\n }\n \n \/\/detect the free space while two used spaces case.\n else\n {\n \/\/detect right side.\n if((current->next->start - current->end - 1) >= bytes)\n allocable = 2;\n }\n \n if(allocable)\n {\n if(allocable == 1)\n {\n current->bytes = bytes;\n current->start = current->prev->end + 1;\n current->end = current->start + bytes - 1;\n current->identifier = identifier;\n }\n else if(allocable == 2)\n insert_node(current->next, create_node(bytes, identifier));\n \n break;\n }\n \n current = current->next;\n }\n \n return allocable;\n}\n\n\n","testcases":"[{'input': '6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': '6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n', 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n', 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n', 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': '22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': '7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': '3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': '8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n', 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': '10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":220} {"difficulty":2600,"lang":"GNU C11","lang_cluster":"C","src_uid":"a9bad412597726f8cdc0cfa2da891bc4","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#include \n\n#include \n#define max(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))\n\nint hp[110],order[10000],beiyong[10000];\nint n,a,b;\nint sum=99999,cnt=0,by;\n\n\nint DFS(int now_enemy,int now_time)\n{\n int i,j;\n if(now_time>=sum)\n {\n return 1;\n }\n if(now_enemy==n)\n {\n if(hp[n]<0)\n {\n by=cnt;\n memset(beiyong,0,sizeof(beiyong));\n for(i=0;ii;j++)\n {\n order[cnt+j]=now_enemy;\n }\n cnt+=i;\n DFS(now_enemy+1,now_time+i);\n\n for(j=1;j<=i;j++)\n {\n order[cnt-j]=0;\n }\n hp[now_enemy-1]+=b*i;\n hp[now_enemy]+=a*i;\n hp[now_enemy+1]+=b*i;\n cnt-=i;\n }\n }\n return 0;\n}\n\nint main()\n{\n int i;\n\n scanf(\"%d%d%d\",&n,&a,&b);\n for(i=1;i<=n;i--)\n {\n scanf(\"%d\",hp+i);\n }\n DFS(2,0);\n\n printf(\"%d\\n\",sum);\n for(i=0;i\n\n#include \n#define max(a,b,c) (a>b?(a>c?a:c):(b>c?b:c))\n\nint hp[110],order[10000],beiyong[10000];\nint n,a,b;\nint sum=99999,cnt=0,by;\n\n\nint DFS(int now_enemy,int now_time)\n{\n int i,j;\n if(now_time>=sum)\n {\n return 1;\n }\n if(now_enemy==n)\n {\n if(hp[n]<0)\n {\n by=cnt;\n memset(beiyong,0,sizeof(beiyong));\n for(i=0;i\n#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i\n#include \n#include \n\nstruct dsu {\n int n;\n int *p, *c;\n};\n\nstruct dsu *dsu_new(int n) {\n int i;\n struct dsu *dsu = malloc(sizeof(struct dsu));\n dsu->n = n;\n dsu->p = malloc(sizeof(int) * n);\n dsu->c = malloc(sizeof(int) * n);\n memset(dsu->p, -1, sizeof(int) * n);\n for (i = 0; i < n; i++)\n dsu->c[i] = 1;\n return dsu;\n}\n\nvoid dsu_free(struct dsu *dsu) {\n free(dsu->p);\n free(dsu->c);\n free(dsu);\n}\n\nint dsu_find(struct dsu *dsu, int x) {\n return dsu->p[x] == -1 ? x : (dsu->p[x] = dsu_find(dsu, dsu->p[x]));\n}\n\nvoid dsu_merge(struct dsu *dsu, int x, int y) {\n x = dsu_find(dsu, x);\n y = dsu_find(dsu, y);\n if (x != y) {\n dsu->p[x] = y;\n dsu->c[y] += dsu->c[x];\n }\n}\n\nint main() {\n int n, m, q;\n int u, v, i, k;\n struct dsu *dsu;\n long long ans;\n\n while (scanf(\"%d %d %d\", &n, &m, &q) != EOF) {\n dsu = dsu_new(n);\n while (m--) {\n scanf(\"%d %d\", &u, &v);\n u--; v--;\n dsu_merge(dsu, u, v);\n }\n ans = 1 % q;\n k = 0;\n for (i = 0; i < n; i++)\n if (dsu->p[i] == -1) {\n ans = ans * dsu->c[i] % q;\n k++;\n }\n for (i = 0; i < k - 2; i++)\n ans = ans * n % q;\n dsu_free(dsu);\n if (k == 1)\n ans = 1 % q;\n printf(\"%d\\n\", (int)ans);\n }\n return 0;\n}\n","testcases":"[{'input': '2 0 1000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 0 100\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 1 1000000000\\r\\n1 4\\r\\n', 'output': ['8\\r\\n']}, {'input': '6 4 100000\\r\\n1 4\\r\\n4 6\\r\\n6 1\\r\\n2 5\\r\\n', 'output': ['36\\r\\n']}, {'input': '10 0 123456789\\r\\n', 'output': ['100000000\\r\\n']}, {'input': '10 5 1000000000\\r\\n1 2\\r\\n4 3\\r\\n5 6\\r\\n8 7\\r\\n10 9\\r\\n', 'output': ['32000\\r\\n']}, {'input': '8 4 17\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 1\\r\\n', 'output': ['8\\r\\n']}, {'input': '9 6 342597160\\r\\n1 2\\r\\n3 4\\r\\n4 5\\r\\n6 7\\r\\n7 8\\r\\n8 9\\r\\n', 'output': ['216\\r\\n']}, {'input': '1 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '15 10 1\\r\\n1 2\\r\\n4 5\\r\\n6 3\\r\\n11 8\\r\\n8 5\\r\\n5 9\\r\\n9 1\\r\\n11 12\\r\\n12 1\\r\\n2 8\\r\\n', 'output': ['0\\r\\n']}, {'input': '8 8 999999937\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n8 7\\r\\n', 'output': ['1\\r\\n']}, {'input': '100000 0 1000000000\\r\\n', 'output': ['0\\r\\n']}, {'input': '100000 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '9 11 498920381\\r\\n2 8\\r\\n5 4\\r\\n1 8\\r\\n8 3\\r\\n4 9\\r\\n3 6\\r\\n8 9\\r\\n1 7\\r\\n5 1\\r\\n5 6\\r\\n9 6\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 0 753780649\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 0 997185958\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 36 279447540\\r\\n10 7\\r\\n10 8\\r\\n1 8\\r\\n1 5\\r\\n4 5\\r\\n9 5\\r\\n3 9\\r\\n7 3\\r\\n10 4\\r\\n8 9\\r\\n2 10\\r\\n6 2\\r\\n4 8\\r\\n10 3\\r\\n1 4\\r\\n10 1\\r\\n10 6\\r\\n8 3\\r\\n3 6\\r\\n9 7\\r\\n10 5\\r\\n6 9\\r\\n3 1\\r\\n8 6\\r\\n4 9\\r\\n5 3\\r\\n9 10\\r\\n7 2\\r\\n2 4\\r\\n7 4\\r\\n5 6\\r\\n5 8\\r\\n7 5\\r\\n5 2\\r\\n6 7\\r\\n1 9\\r\\n', 'output': ['1\\r\\n']}, {'input': '7 7 302838679\\r\\n5 3\\r\\n4 1\\r\\n5 4\\r\\n6 5\\r\\n1 6\\r\\n3 2\\r\\n6 4\\r\\n', 'output': ['6\\r\\n']}, {'input': '6 1 310732484\\r\\n4 2\\r\\n', 'output': ['432\\r\\n']}, {'input': '10 7 587143295\\r\\n1 10\\r\\n7 1\\r\\n1 8\\r\\n7 10\\r\\n8 10\\r\\n4 8\\r\\n6 8\\r\\n', 'output': ['6000\\r\\n']}, {'input': '3 3 975373207\\r\\n1 2\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '9 33 321578376\\r\\n9 5\\r\\n6 3\\r\\n8 4\\r\\n4 1\\r\\n3 5\\r\\n2 6\\r\\n8 2\\r\\n7 6\\r\\n7 9\\r\\n8 6\\r\\n4 5\\r\\n1 6\\r\\n1 2\\r\\n5 6\\r\\n9 4\\r\\n7 8\\r\\n3 9\\r\\n9 6\\r\\n4 7\\r\\n7 2\\r\\n1 8\\r\\n4 6\\r\\n8 3\\r\\n3 7\\r\\n8 9\\r\\n5 7\\r\\n3 4\\r\\n7 1\\r\\n9 2\\r\\n5 1\\r\\n2 5\\r\\n9 1\\r\\n3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 10 93196990\\r\\n1 5\\r\\n1 4\\r\\n4 2\\r\\n1 3\\r\\n3 4\\r\\n1 2\\r\\n5 2\\r\\n5 4\\r\\n5 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 0 773734495\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1 719418546\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2 21502109\\r\\n3 2\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '9 35 480175322\\r\\n6 3\\r\\n8 6\\r\\n7 5\\r\\n7 9\\r\\n3 4\\r\\n2 8\\r\\n5 3\\r\\n4 5\\r\\n4 6\\r\\n7 1\\r\\n7 6\\r\\n2 5\\r\\n8 3\\r\\n6 9\\r\\n8 4\\r\\n8 5\\r\\n6 1\\r\\n8 1\\r\\n3 2\\r\\n5 1\\r\\n8 9\\r\\n3 1\\r\\n8 7\\r\\n5 6\\r\\n5 9\\r\\n4 9\\r\\n7 4\\r\\n2 7\\r\\n3 9\\r\\n2 4\\r\\n7 3\\r\\n9 1\\r\\n2 9\\r\\n1 4\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 7 729985252\\r\\n2 3\\r\\n3 1\\r\\n2 5\\r\\n1 5\\r\\n1 2\\r\\n1 4\\r\\n4 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1 819865995\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 0 766953983\\r\\n', 'output': ['100000000\\r\\n']}, {'input': '2 1 855341703\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 30 407595309\\r\\n3 6\\r\\n6 10\\r\\n6 7\\r\\n7 10\\r\\n7 8\\r\\n3 10\\r\\n3 4\\r\\n1 4\\r\\n9 10\\r\\n8 4\\r\\n3 7\\r\\n5 1\\r\\n2 4\\r\\n6 2\\r\\n8 9\\r\\n10 5\\r\\n7 5\\r\\n10 4\\r\\n5 8\\r\\n8 2\\r\\n10 2\\r\\n1 6\\r\\n4 7\\r\\n2 3\\r\\n5 6\\r\\n8 10\\r\\n3 5\\r\\n1 8\\r\\n9 7\\r\\n1 9\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 0 21080115\\r\\n', 'output': ['1\\r\\n']}, {'input': '57 28 776442742\\r\\n31 10\\r\\n25 28\\r\\n51 45\\r\\n14 40\\r\\n21 52\\r\\n53 51\\r\\n52 53\\r\\n4 6\\r\\n51 35\\r\\n53 15\\r\\n17 16\\r\\n40 44\\r\\n37 51\\r\\n33 43\\r\\n55 40\\r\\n42 16\\r\\n30 8\\r\\n19 45\\r\\n7 27\\r\\n31 8\\r\\n49 8\\r\\n43 44\\r\\n45 3\\r\\n16 22\\r\\n32 36\\r\\n52 36\\r\\n5 26\\r\\n2 23\\r\\n', 'output': ['135540294\\r\\n']}, {'input': '30 70 288262020\\r\\n27 18\\r\\n5 19\\r\\n23 17\\r\\n16 17\\r\\n29 17\\r\\n1 22\\r\\n23 5\\r\\n10 13\\r\\n22 26\\r\\n14 3\\r\\n8 3\\r\\n29 9\\r\\n9 1\\r\\n3 9\\r\\n16 4\\r\\n9 22\\r\\n10 22\\r\\n20 1\\r\\n3 7\\r\\n23 19\\r\\n26 8\\r\\n24 1\\r\\n5 7\\r\\n28 29\\r\\n20 11\\r\\n16 12\\r\\n6 9\\r\\n24 29\\r\\n30 4\\r\\n5 26\\r\\n18 21\\r\\n5 21\\r\\n30 6\\r\\n12 13\\r\\n16 23\\r\\n28 14\\r\\n30 1\\r\\n7 27\\r\\n7 19\\r\\n27 17\\r\\n5 30\\r\\n30 27\\r\\n28 30\\r\\n12 28\\r\\n27 9\\r\\n30 26\\r\\n20 18\\r\\n21 16\\r\\n8 30\\r\\n4 26\\r\\n13 22\\r\\n2 14\\r\\n12 30\\r\\n4 2\\r\\n6 12\\r\\n29 25\\r\\n19 29\\r\\n14 15\\r\\n3 23\\r\\n10 28\\r\\n7 1\\r\\n21 10\\r\\n4 12\\r\\n1 14\\r\\n7 21\\r\\n21 8\\r\\n17 26\\r\\n7 6\\r\\n26 29\\r\\n9 8\\r\\n', 'output': ['1\\r\\n']}, {'input': '99 12 832839308\\r\\n66 23\\r\\n36 5\\r\\n16 57\\r\\n70 62\\r\\n94 96\\r\\n63 33\\r\\n99 23\\r\\n63 10\\r\\n6 85\\r\\n73 23\\r\\n69 46\\r\\n72 95\\r\\n', 'output': ['71450536\\r\\n']}, {'input': '30 18 918975816\\r\\n30 18\\r\\n23 1\\r\\n21 14\\r\\n14 8\\r\\n18 9\\r\\n23 29\\r\\n3 23\\r\\n29 19\\r\\n18 4\\r\\n27 19\\r\\n30 2\\r\\n9 10\\r\\n9 28\\r\\n16 15\\r\\n10 6\\r\\n18 12\\r\\n23 9\\r\\n19 14\\r\\n', 'output': ['782410104\\r\\n']}, {'input': '83 33 367711297\\r\\n14 74\\r\\n26 22\\r\\n55 19\\r\\n8 70\\r\\n6 42\\r\\n53 49\\r\\n54 56\\r\\n52 17\\r\\n62 44\\r\\n78 61\\r\\n76 4\\r\\n78 30\\r\\n51 2\\r\\n31 42\\r\\n33 67\\r\\n45 41\\r\\n64 62\\r\\n15 25\\r\\n33 35\\r\\n37 20\\r\\n38 65\\r\\n65 83\\r\\n61 14\\r\\n20 67\\r\\n62 47\\r\\n7 34\\r\\n78 41\\r\\n38 83\\r\\n26 69\\r\\n54 58\\r\\n11 62\\r\\n30 55\\r\\n15 74\\r\\n', 'output': ['131377693\\r\\n']}, {'input': '24 68 862907549\\r\\n6 9\\r\\n16 22\\r\\n11 23\\r\\n12 17\\r\\n18 2\\r\\n15 5\\r\\n5 22\\r\\n16 4\\r\\n21 9\\r\\n7 11\\r\\n19 16\\r\\n9 13\\r\\n21 20\\r\\n5 24\\r\\n7 12\\r\\n17 1\\r\\n24 21\\r\\n23 7\\r\\n16 17\\r\\n16 18\\r\\n10 13\\r\\n18 7\\r\\n8 21\\r\\n13 5\\r\\n10 18\\r\\n4 11\\r\\n21 6\\r\\n15 13\\r\\n2 1\\r\\n20 16\\r\\n11 16\\r\\n22 19\\r\\n2 4\\r\\n21 1\\r\\n6 18\\r\\n24 12\\r\\n21 19\\r\\n6 14\\r\\n22 24\\r\\n11 20\\r\\n2 19\\r\\n1 11\\r\\n24 18\\r\\n14 8\\r\\n10 24\\r\\n5 3\\r\\n11 3\\r\\n17 4\\r\\n4 20\\r\\n2 10\\r\\n12 11\\r\\n24 7\\r\\n23 16\\r\\n2 3\\r\\n19 24\\r\\n22 1\\r\\n22 4\\r\\n4 6\\r\\n3 4\\r\\n11 13\\r\\n6 5\\r\\n18 23\\r\\n4 23\\r\\n22 13\\r\\n20 5\\r\\n2 5\\r\\n2 11\\r\\n9 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '86 23 608266393\\r\\n62 78\\r\\n44 84\\r\\n42 37\\r\\n20 24\\r\\n40 36\\r\\n41 76\\r\\n14 38\\r\\n80 72\\r\\n39 52\\r\\n31 58\\r\\n71 17\\r\\n81 6\\r\\n32 65\\r\\n11 69\\r\\n43 86\\r\\n85 59\\r\\n28 77\\r\\n78 64\\r\\n15 19\\r\\n36 39\\r\\n53 49\\r\\n48 75\\r\\n33 85\\r\\n', 'output': ['235915236\\r\\n']}, {'input': '47 51 283106191\\r\\n18 14\\r\\n30 26\\r\\n24 2\\r\\n18 41\\r\\n35 31\\r\\n16 24\\r\\n29 39\\r\\n6 12\\r\\n17 21\\r\\n7 19\\r\\n36 16\\r\\n27 39\\r\\n28 34\\r\\n22 35\\r\\n28 43\\r\\n40 5\\r\\n2 26\\r\\n18 16\\r\\n27 13\\r\\n21 6\\r\\n19 5\\r\\n35 30\\r\\n13 31\\r\\n7 10\\r\\n25 7\\r\\n44 42\\r\\n45 1\\r\\n35 47\\r\\n11 28\\r\\n47 46\\r\\n18 15\\r\\n27 16\\r\\n24 41\\r\\n10 8\\r\\n25 41\\r\\n4 40\\r\\n5 11\\r\\n24 6\\r\\n10 17\\r\\n41 38\\r\\n47 28\\r\\n8 29\\r\\n25 24\\r\\n35 37\\r\\n44 17\\r\\n24 47\\r\\n8 32\\r\\n33 11\\r\\n26 28\\r\\n23 9\\r\\n5 9\\r\\n', 'output': ['189974\\r\\n']}, {'input': '67 2 818380264\\r\\n4 52\\r\\n15 44\\r\\n', 'output': ['517849052\\r\\n']}, {'input': '10 45 220178113\\r\\n9 1\\r\\n8 1\\r\\n5 8\\r\\n1 5\\r\\n7 8\\r\\n6 7\\r\\n7 9\\r\\n6 2\\r\\n3 2\\r\\n1 4\\r\\n8 3\\r\\n8 9\\r\\n3 6\\r\\n4 5\\r\\n5 3\\r\\n10 4\\r\\n3 9\\r\\n9 6\\r\\n5 9\\r\\n2 9\\r\\n10 7\\r\\n1 10\\r\\n9 4\\r\\n3 10\\r\\n2 5\\r\\n7 1\\r\\n6 10\\r\\n6 5\\r\\n8 6\\r\\n8 4\\r\\n8 10\\r\\n1 6\\r\\n4 2\\r\\n9 10\\r\\n2 10\\r\\n7 3\\r\\n6 4\\r\\n7 5\\r\\n1 2\\r\\n4 3\\r\\n10 5\\r\\n4 7\\r\\n3 1\\r\\n7 2\\r\\n8 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '588 32 634894588\\r\\n535 26\\r\\n562 406\\r\\n70 368\\r\\n357 513\\r\\n108 361\\r\\n515 5\\r\\n159 56\\r\\n522 81\\r\\n169 229\\r\\n312 252\\r\\n492 43\\r\\n476 405\\r\\n524 555\\r\\n537 169\\r\\n142 149\\r\\n586 112\\r\\n7 159\\r\\n76 370\\r\\n295 376\\r\\n33 455\\r\\n278 225\\r\\n377 88\\r\\n526 308\\r\\n517 303\\r\\n300 576\\r\\n230 493\\r\\n588 525\\r\\n177 312\\r\\n356 215\\r\\n515 34\\r\\n196 236\\r\\n323 9\\r\\n', 'output': ['478655040\\r\\n']}, {'input': '3 2 11\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1 1000\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 0 10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 4 100000\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1 100000\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 0 10\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 3 100\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 1 100\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2 42\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}]","id":222} {"difficulty":1600,"lang":"GNU C","lang_cluster":"C","src_uid":"b263917e47e1c84340bcb1c77999fd7e","execute_outcome":"WRONG_ANSWER","source_code":"#include\n\nint main(void){\n int num[10]={0},n,i,in,count=0;\n scanf(\"%d\",&n);\n for(i=0;i=2){\n if(num[1]>=2) num[1]-=2;\n else if(num[1]==1){\n\tnum[1]--;\n\tif(num[4]>=1) num[4]--;\n\telse num[8]--;\n }else{\n\tif(num[4]>=2) num[4]-=2;\n\telse if(num[4]==1) num[4]--,num[8]--;\n\telse num[8]-=2;\n }\n }\n else num[0]=0;\n break;\n }\n \n for(count=0,i=1;i<=9;i++){\n count+=num[i];\n }\n if(count==0){\n printf(\"%d\\n\",0);\n return 0;\n }\n\n if(num[0]==0) printf(\"-1\");\n else for(i=9;i>=0;i--) while(num[i]--) printf(\"%d\",i);\n putchar('\\n');\n return 0;\n}\n\n","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. ","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.","notes":"NoteIn the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.","sample_inputs":["1\n0","11\n3 4 5 4 5 3 5 3 4 4 0","8\n3 2 5 1 5 2 2 3"],"sample_outputs":["0","5554443330","-1"],"human_solution":"#include\nlong int a[10]={0};\nint main()\n{\n long int i,n,t,count=0;\n long long int s=0;\n scanf(\"%ld\",&n);\n for(i=0;i0;i--)\n if(a[i])\n {while(a[i]--)\n printf(\"%ld\",i);t=1;}\n if(t==0)\n a[0]=1;\n while(a[0]--)\n printf(\"0\");\n }\n else\n {\n s=s%3;\n if(s==1)\/\/3n+1 form\n {\n if(a[1]>0) {a[1]--;count=2;}\n else if(a[4]>0) {a[4]--;count=2;}\n else if(a[7]>0) {a[7]--;count=2;}\n if(a[2]>0&&count<2)\n {\n a[2]--;count++;\n if(a[2]>0) {a[2]--;count++;}\n }\n if(a[5]>0&&count<2)\n {\n a[5]--;count++;\n if(a[5]>0&&count<2) {a[5]--;count++;}\n }\n if(a[8]>0&&count<2)\n {\n a[8]--;count++;\n if(a[8]>0) {a[8]--;count++;}\n }\n }\n else if(s==2)\/\/3n+2 form\n {\n if(a[2]>0) {a[2]--;count=2;}\n else if(a[5]>0) {a[5]--;count=2;}\n else if(a[8]>0) {a[8]--;count=2;}\n if(a[1]>0&&count<2)\n {\n a[1]--;count++;\n if(a[1]>0&&count<2) {a[1]--;count++;}\n }\n if(a[4]>0&&count<2)\n {\n a[4]--;count++;\n if(a[4]>0&&count<2) {a[4]--;count++;}\n }\n if(a[7]>0&&count<2)\n {\n a[7]--;count++;\n if(a[7]>0&&count<2) {a[7]--;count++;}\n }\n }\n else\n {printf(\"-1\");return 0;}\n for(i=9;i>0;i--)\n if(a[i])\n {while(a[i]--)\n printf(\"%ld\",i);t=1;}\n if(t==0)\n a[0]=1;\n while(a[0]--)\n printf(\"0\");\n }\n return 0;\n}\n","testcases":"[{'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n', 'output': ['5554443330\\r\\n']}, {'input': '8\\r\\n3 2 5 1 5 2 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n5 5 4 1 5 5 5 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n', 'output': ['33322222200\\r\\n']}, {'input': '12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n3 6 1 6 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n', 'output': ['999666330\\r\\n']}, {'input': '5\\r\\n9 6 6 6 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 2 2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n3 3 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '7\\r\\n3 3 2 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '6\\r\\n0 3 3 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 1 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 4 4 4 4\\r\\n', 'output': ['444330\\r\\n']}, {'input': '7\\r\\n0 3 3 2 2 4 4\\r\\n', 'output': ['4433220\\r\\n']}, {'input': '7\\r\\n4 2 3 3 0 0 0\\r\\n', 'output': ['4332000\\r\\n']}, {'input': '4\\r\\n1 1 0 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n3 0 2 2\\r\\n', 'output': ['30\\r\\n']}, {'input': '8\\r\\n3 3 3 5 5 0 0 0\\r\\n', 'output': ['333000\\r\\n']}, {'input': '8\\r\\n3 3 6 3 0 7 7 9\\r\\n', 'output': ['963330\\r\\n']}, {'input': '9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 0\\r\\n', 'output': ['90\\r\\n']}, {'input': '10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n', 'output': ['32222220\\r\\n']}, {'input': '10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n', 'output': ['31111110\\r\\n']}, {'input': '10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n', 'output': ['44444430\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 4 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 4 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '3\\r\\n2 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['3210\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n8 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 8 5 6\\r\\n', 'output': ['600\\r\\n']}, {'input': '4\\r\\n5 8 3 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n1 4 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n2 2 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n3 2 5 0 0\\r\\n', 'output': ['300\\r\\n']}, {'input': '4\\r\\n5 3 2 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '5\\r\\n0 0 0 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 3 5 8\\r\\n', 'output': ['30\\r\\n']}]","id":223} {"difficulty":1900,"lang":"GNU C","lang_cluster":"C","src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n#include \n#include \n\ntypedef uint8_t byte;\ntypedef uint16_t u16;\ntypedef uint32_t u32;\ntypedef int32_t s32;\ntypedef uint64_t u64;\n\n#ifdef DEBUG\n# define debug(...) ({fprintf(stderr,__VA_ARGS__);fflush(stderr);})\n#else\n# define NDEBUG\n# define debug(...)\n#endif\n\nint main(void)\n{\n\tu32 N,K;\n\tscanf(\"%u %u\",&N,&K);\n\tu32 *n = malloc(sizeof(*n) * N);\n\tfor(u32 i = 0;i < N;i++)\n\t\tscanf(\" %u\",&n[i]);\n\tu32 (*m)[N] = malloc(sizeof(*m) * N);;\n\ts32 a = 0,b = 0,c = 0,d = 0;\n\tm[0][0] = n[0];\n\tm[1][0] = n[0];\n\tu32 (*h)[2] = malloc(sizeof(*h) * N),i = 0,j = 0,k = 0,x = 1;\n\tdo\n\t{\n\t\tdo\n\t\t{\n\t\t\tif(++j == N)\n\t\t\t\tbreak;\n\t\t\twhile(a <= b && m[0][b] < n[j])\n\t\t\t\t--b;\n\t\t\tm[0][++b] = n[j];\n\t\t\twhile(c <= d && m[1][d] > n[j])\n\t\t\t\t--d;\n\t\t\tm[1][++d] = n[j];\n\t\t\tdebug(\"a%u %u %u %u\\n\",i,j,m[0][b],m[1][c]);\n\t\t}\n\t\twhile(m[0][a] - m[1][c] <= K);\n\t\tdebug(\"a%u %u %u %u\\n\",i,j,m[0][b],m[1][c]);\n\t\tif(j - i > x)\n\t\t{\n\t\t\tx = j - i;\n\t\t\tk = 0;\n\t\t}\n\t\tif(j - i == x)\n\t\t{\n\t\t\th[k][0] = i + 1;\n\t\t\th[k][1] = j;\n\t\t\tk++;\n\t\t}\n\t\tif(j == N)\n\t\t\tbreak;\n\t\tdo\n\t\t{\n\t\t\tif(m[0][a] == n[i])\n\t\t\t\t++a;\n\t\t\tif(m[1][c] == n[i])\n\t\t\t\t++c;\n\t\t\t++i;\n\t\t}\n\t\twhile(m[0][a] - m[1][c] > K);\n\t}\n\twhile(1);\n\tprintf(\"%u %u\\n\",x,k);\n\tfor(u32 i = 0;i < k;i++)\n\t\tprintf(\"%u %u\\n\",h[i][0],h[i][1]);\n\treturn 0;\n}\n\n\/* inspired by Andy Pham *\/\n","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"],"human_solution":"#include \n#include \"stdio.h\"\n#include \"stdint.h\"\n#include \"string.h\"\n#include \"stdlib.h\"\n\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)<(b)?(a):(b))\n#define N 100000\nint n, k, a[N], b[N];\nint mil, mii, mi[N], mal, mai, ma[N];\n\nint main() {\n scanf(\"%d %d\", &n, &k);\n int ans = 0, ansb = 0;\n for (int i=0,l=0; i= a[ma[mal-1]]) mal--;\n ma[mal++] = i;\n\n mii = min(mii, mil-1);\n mai = min(mai, mal-1);\n while (a[ma[mai]]-a[mi[mii]] > k) {\n l++;\n if (l > ma[mai]) mai++;\n if (l > mi[mii]) mii++;\n }\n b[i] = l;\n ans = max(ans, i-l);\n \/*\n printf(\"min: %d\\n\", mii);\n for (int j=0; j\n#include \n\nint main(){\n\tregister int i;\n\tint n;\n\tint k;\n\tscanf(\"%d\",&n);\n\tint mas[n+1];\n\tint nmas[n+1];\n\tfor (i=0;i99)\n\t\tamax=1000000;\n\tif (n<400)\n\t\tk=200;\n\telse\n\t\tk=1000000;\n\tint d=0;\n\tfloat mina,maxa;\n\twhile (d<200){\n\t\ta=(amax+amin)\/2;\n\t\tfor (i=0;imas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]mas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]99)\n\t\tamax=1000000;\n\td=0;\n\twhile (dmas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]\n#include \n\nint main(){\n\tregister int i;\n\tint n;\n\tint k;\n\tscanf(\"%d\",&n);\n\tint mas[n+1];\n\tint nmas[n+1];\n\tfor (i=0;i99)\n\t\tamax=100000000;\n\tif (n<400)\n\t\tk=200;\n\telse\n\t\tk=35;\n\tint d=0;\n\tdouble mina,maxa;\n\twhile (d<200){\n\t\ta=(amax+amin)\/2;\n\t\tfor (i=0;imas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]mas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]99)\n\t\tamax=5299290;\n\tint mmm;\n\tmmm=(int)amin;\n\tif (mmm==1000)\n\t\tamin=1000.001;\n\td=0;\n\twhile (dmas[i]){\n\t\t\t\tamax=a;\n\t\t\t\ti=n;\n\/\/\t\t\t\tprintf(\"n>m %d a=%f\\n\",nmas[i],a);\n\t\t\t}\n\t\t\tif (nmas[i]\n#include\n#include\n\n#define MOD 1000000007\n\nstruct xx\n{\n int z,of,or,t,m;\n}a[2];\n\nchar str[1000005];\n\nint main()\n{\n int i;\n int l,n;\n int len;\n int ans;\n scanf(\"%s\",str);\n len=strlen(str);\n l=0;\n if(str[0]=='?')\n a[0].m=a[0].or=a[0].z=1;\n else if(str[0]=='*')\n a[0].m=1;\n else if(str[0]=='0')\n a[0].z=1;\n else if(str[0]=='1')\n a[0].or=1;\n for(i=1;i\n#include \n\n#define N\t1000000\n#define MD\t1000000007\n\nchar aa[] = \"012*\";\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[4][4], dq[4][4];\n\tint n, a, b, c, i, ans;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tif (n == 1) {\n\t\tprintf(\"%d\\n\", cc[0] == '?' ? 2 : cc[0] == '0' || cc[0] == '*' ? 1 : 0);\n\t\treturn 0;\n\t}\n\tdp[3][3] = dp[1][3] = dp[3][1] = dp[3][2] = dp[0][0] = dp[0][1] = 1;\n\tfor (a = 0; a < 4; a++)\n\t\tfor (b = 0; b < 4; b++)\n\t\t\tif (cc[0] != '?' && cc[0] != aa[a] || cc[1] != '?' && cc[1] != aa[b])\n\t\t\t\tdp[a][b] = 0;\n\tfor (i = 2; i < n; i++) {\n\t\tfor (a = 0; a < 4; a++)\n\t\t\tfor (b = 0; b < 4; b++)\n\t\t\t\tdq[a][b] = 0;\n\t\tfor (a = 0; a < 4; a++)\n\t\t\tfor (b = 0; b < 4; b++) {\n\t\t\t\tint x = dp[a][b];\n\n\t\t\t\tif (x == 0)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (c = 0; c < 4; c++) {\n\t\t\t\t\tif (cc[i] != '?' && cc[i] != aa[c])\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (b != 3 && b != (a == 3) + (c == 3))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tdq[b][c] = (dq[b][c] + x) % MD;\n\t\t\t\t}\n\t\t\t}\n\t\tfor (a = 0; a < 4; a++)\n\t\t\tfor (b = 0; b < 4; b++)\n\t\t\t\tdp[a][b] = dq[a][b];\n\t}\n\tans = 0;\n\tfor (a = 0; a < 4; a++)\n\t\tfor (b = 0; b < 4; b++) {\n\t\t\tif (b != 3 && b != (a == 3))\n\t\t\t\tcontinue;\n\t\t\tans = (ans + dp[a][b]) % MD;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\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":226} {"difficulty":1700,"lang":"GNU C","lang_cluster":"C","src_uid":"c175d010d75c391d0b25391fecff007c","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n\n#define MAX_N 1000\n#define DIGITS_NUMBER 4\n\nint n;\nint y[MAX_N + 1];\nint z[MAX_N + 1];\n\nint arr_to_number_with_replaced_digit(int year_digits[4], int replace_digit, int replace_digit_index) {\n\tint i;\n\tint tens = 1000;\n\tint number = 0;\n\t\n\tfor (i = 0; i < 4; i++) {\n\t\tif (i != replace_digit_index) {\n\t\t\tnumber += year_digits[i] * tens;\n\t\t} else {\n\t\t\tnumber += replace_digit * tens;\n\t\t}\n\t\ttens \/= 10;\n\t}\n\t\n\treturn number;\n}\n\nint calc_max_year(int curr_year, int prev_calc_year) {\n\tif (curr_year == prev_calc_year) {\n\t\treturn curr_year;\n\t}\n\t\n\tint i;\n\tint curr_calc_year = 0;\n\tint max_calc_year = -1;\n\tint curr_year_digits[4];\n\tint prev_calc_year_digits[4];\n\t\n\tint tens = 1000;\n\tint tens_inc = 10;\n\tcurr_year_digits[0] = curr_year \/ 1000;\n\tcurr_year_digits[1] = (curr_year \/ 100) % 10;\n\tcurr_year_digits[2] = (curr_year \/ 10) % 10;\n\tcurr_year_digits[3] = curr_year % 10;\n\tprev_calc_year_digits[0] = prev_calc_year \/ 1000;\n\tprev_calc_year_digits[1] = (prev_calc_year \/ 100) % 10;\n\tprev_calc_year_digits[2] = (prev_calc_year \/ 10) % 10;\n\tprev_calc_year_digits[3] = prev_calc_year % 10;\n\t\n\tfor (i = 0; i < DIGITS_NUMBER; i++) {\n\t\tint digit = 0;\n\t\t\n\t\twhile (digit <= prev_calc_year_digits[i]) {\n\t\t\tcurr_calc_year = arr_to_number_with_replaced_digit(curr_year_digits, digit, i);\n\t\t\t\n\t\t\tif (max_calc_year < curr_calc_year && curr_calc_year <= prev_calc_year) {\n\t\t\t\tmax_calc_year = curr_calc_year;\n\t\t\t}\n\t\t\t\n\t\t\tdigit++;\n\t\t}\n\t\t\n\t\ttens \/= 10;\n\t}\n\t\n\treturn max_calc_year;\n}\n\nint main(void) {\n\tint i;\n\t\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &y[i]);\n\t}\n\t\n\ty[n] = 2011;\n\tz[n] = 2011;\n\tfor (i = n - 1; i >= 0; i--) {\n\t\tz[i] = calc_max_year(y[i], z[i + 1]);\n\t\tif (z[i] == -1 || z[i] < 1000) {\n\t\t\tprintf(\"No solution\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tfor (i = 0; i < n; i++) {\n\t\tprintf(\"%d\\n\", z[i]);\n\t}\n\tprintf(\"\\n\");\n\t\n\treturn 0;\n}\n\n\t\/*\n\tif (curr_year \/ 1000 == 2 && prev_calc_year \/ 1000 == 2) {\n\t\tif (prev_calc_year \/ 1000 == 2) {\n\t\t\tif (curr_year \/ 100 > 20) {\n\t\t\t\tif (curr_year % 100 <= prev_calc_year % 100) {\n\t\t\t\t\tcurr_calc_year = 2000 + curr_year % 100;\n\t\t\t\t} else {\n\t\t\t\t\tcurr_calc_year = 1000 + (curr_year % 1000);\n\t\t\t\t}\n\t\t\t} else if (curr_year \/ 100 == 20) {\n\t\t\t\tif (curr_year % 100 < 2 && prev_calc_year > 2009 && curr_year % 10 <= prev_calc_year % 10) {\n\t\t\t\t\tcurr_calc_year = 2010 + curr_year % 10;\n\t\t\t\t} else if (curr_year % 10 < 2 && curr_year < prev_calc_year) {\n\t\t\t\t\tcurr_calc_year = curr_year + (curr_year % 2);\n\t\t\t\t} else {\n\t\t\t\t\tcurr_calc_year = curr_year;\n\t\t\t\t} \/\/ 2000 2010\n\t\t\t} else {\n\t\t\t\tcurr_calc_year = 1000 + (curr_year % 1000);\n\t\t\t}\n\t\t} else {\n\t\t\tcurr_calc_year = 1000 + (curr_year % 1000);\n\t\t}\n\t} else if (curr_year > 2999 || curr_year < 1000) {\n\t\tcurr_calc_year = 1000 + (curr_year % 1000);\n\t} else if (curr_year \/ 1000 == 1 && prev_calc_year \/ 1000 == 2 && (curr_year % 1000) <= (prev_calc_year % 1000)) {\n\t\tcurr_calc_year = 2000 + (curr_year % 1000);\n\t} else if (curr_year \/ 1000 == 2 && \n\t*\/\n","description":"The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has a soporific effect even on the quill. That's why the quill often makes mistakes, especially in dates.So, at the end of the semester Professor Binns decided to collect the students' parchments with notes and check them. Ron Weasley is in a panic: Harry's notes may contain errors, but at least he has some notes, whereas Ron does not have any. Ronald also has been sleeping during the lectures and his quill had been eaten by his rat Scabbers. Hermione Granger refused to give Ron her notes, because, in her opinion, everyone should learn on their own. Therefore, Ron has no choice but to copy Harry's notes.Due to the quill's errors Harry's dates are absolutely confused: the years of goblin rebellions and other important events for the wizarding world do not follow in order, and sometimes even dates from the future occur. Now Ron wants to change some of the digits while he copies the notes so that the dates were in the chronological (i.e. non-decreasing) order and so that the notes did not have any dates strictly later than 2011, or strictly before than 1000. To make the resulting sequence as close as possible to the one dictated by Professor Binns, Ron will change no more than one digit in each date into other digit. Help him do it.","input_specification":"The first input line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000\u2009\u2264\u2009yi\u2009\u2264\u20099999).","output_specification":"Print n numbers z1, z2, ..., zn (1000\u2009\u2264\u2009zi\u2009\u2264\u20092011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0. If there are several possible solutions, print any of them. If there's no solution, print \"No solution\" (without the quotes).","notes":null,"sample_inputs":["3\n1875\n1936\n1721","4\n9999\n2000\n3000\n3011","3\n1999\n5055\n2000"],"sample_outputs":["1835\n1836\n1921","1999\n2000\n2000\n2011","No solution"],"human_solution":"#include \n#include \n#include \n\nint d[2000],n;\n\nvoid change(int ix,int min) {\n char s[10],b;\n int i,j,v,best=9999;\n if(d[ix]>9999) d[ix]=9999;\n sprintf(s,\"%d\",d[ix]);\n for(i=0;i<4;i++) {\n b=s[i];\n for(j=0;j<10;j++) {\n if(i==0 && j==0) continue;\n s[i]=j+48;\n v=strtol(s,0,10);\n if(best>v && v>=min) best=v;\n }\n s[i]=b;\n }\n d[ix]=best;\n}\n\nint main() {\n int i;\n scanf(\"%d\",&n);\n for(i=0;i\n#include \n#include \n\n#define N\t100\n#define M\t100000\n\nvoid trim(char *s) {\n\tstatic char t[128];\n\tint n, m, i;\n\n\tmemset(t, 0, sizeof t);\n\tn = strlen(s);\n\tfor (i = 0, m = 0; i < n; i++)\n\t\tif (!isspace(s[i]))\n\t\t\tt[m++] = s[i];\n\tstrcpy(s, t);\n}\n\nint isop(char c) {\n\treturn c == '[' || c == ']' || c == '(' || c == ')' || c == '+' || c == '-' || c == '*' || c == '\/';\n}\n\nint xx[M], yy[M];\n\nint replace(char *ss, char *s, char *t, int x) {\n\tstatic char s_[M + 1];\n\tint n, m, l, n_, i, change;\n\n\tn = strlen(ss);\n\tm = strlen(s);\n\tl = strlen(t);\n\tmemset(s_, 0, sizeof s_);\n\tn_ = 0;\n\tchange = 0;\n\tmemset(xx, 0, sizeof xx);\n\tfor (i = 0; i < n; )\n\t\tif (i + m <= n && strncmp(ss + i, s, m) == 0 && (i == 0 || isop(ss[i - 1])) && (i + m == n || isop(ss[i + m]))) {\n\t\t\txx[n_] = x;\n\t\t\ts_[n_++] = '[';\n\t\t\tmemcpy(s_ + n_, t, l);\n\t\t\tn_ += l;\n\t\t\ts_[n_++] = ']';\n\t\t\ti += m;\n\t\t\tchange = 1;\n\t\t} else {\n\t\t\txx[n_] = yy[i];\n\t\t\ts_[n_++] = ss[i++];\n\t\t}\n\tstrcpy(ss, s_);\n\tmemset(yy, 0, sizeof yy);\n\tmemcpy(yy, xx, n_ * sizeof *xx);\n\treturn change;\n}\n\nstatic char t1[N][128], t2[N][128];\nstatic char aa[N + 1], bb[N + 1], cc[N + 1];\nint n;\n\nvoid parse(char *ss, int x) {\n\tstatic int stack[M];\n\tint m, i, j, j_, x_, cnt, cnt_;\n\n\taa[x] = 1;\n\tmemset(yy, 0, sizeof yy);\n\tfor (i = 0; i < x; i++)\n\t\tif (replace(ss, t1[i], t2[i], i) && !aa[i]) {\n\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\treturn;\n\t\t}\n\tbb[x] = cc[x] = 0;\n\tm = strlen(ss);\n\tfor (j = 0, cnt = 0, cnt_ = 0; j < m; j++) {\n\t\tif (ss[j] == '[')\n\t\t\tstack[cnt++] = j;\n\t\telse if (ss[j] == ']') {\n\t\t\tj_ = stack[--cnt], x_ = xx[j_];\n\t\t\tif (j_ > 0) {\n\t\t\t\tif ((ss[j_ - 1] == '*' || ss[j_ - 1] == '\/') && bb[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (ss[j_ - 1] == '-' && bb[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (ss[j_ - 1] == '\/' && cc[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (j + 1 < m && (ss[j + 1] == '*' || ss[j + 1] == '\/') && bb[x_]) {\n\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (bb[x_] && cnt_ == 0)\n\t\t\t\tbb[x] = 1;\n\t\t\tif (cc[x_] && cnt_ == 0)\n\t\t\t\tcc[x] = 1;\n\t\t}\n\t\tif ((ss[j] == '+' || ss[j] == '-') && cnt_ == 0)\n\t\t\tbb[x] = 1;\n\t\telse if ((ss[j] == '*' || ss[j] == '\/') && cnt_ == 0)\n\t\t\tcc[x] = 1;\n\t\tif (ss[j] == '(')\n\t\t\tcnt_++;\n\t\telse if (ss[j] == ')')\n\t\t\tcnt_--;\n\t}\n}\n\nint main() {\n\tstatic char ss[M + 2], tt[M + 2], s[128];\n\tint i, len;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tlen = 0;\n\t\twhile (len < 7) {\n\t\t\tscanf(\"%s\", s);\n\t\t\tlen += strlen(s);\n\t\t}\n\t\tscanf(\"%s\", t1[i]);\n\t\tfgets(t2[i], 128, stdin);\n\t\ttrim(t2[i]);\n\t}\n\tfgets(ss, M + 2, stdin);\n\ttrim(ss);\n\tfor (i = 0; i <= n; i++) {\n\t\tstrcpy(tt, i < n ? t2[i] : ss);\n\t\tparse(tt, i);\n\t\tprintf(\"%d %d %d\\n\", aa[i], bb[i], cc[i]);\n\t}\n\tprintf(aa[n] ? \"OK\\n\" : \"Suspicious\\n\");\n\treturn 0;\n}\n","description":"Most C\/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:#define macro_name macro_valueAfter the macro has been declared, \"macro_name\" is replaced with \"macro_value\" each time it is met in the program (only the whole tokens can be replaced; i.e. \"macro_name\" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A \"macro_value\" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.One of the main problems arising while using macros \u2014 the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.Let's consider the following example. Say, we declared such a #define construction:#define sum x + yand further in the program the expression \"2 * sum\" is calculated. After macro substitution is performed we get \"2 * x + y\", instead of intuitively expected \"2 * (x + y)\".Let's call the situation \"suspicious\", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a \"safe\" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise \u2014 suspicious.Note that we consider the \"\/\" operation as the usual mathematical division, not the integer division like in C\/C++. That's why, for example, in the expression \"a*(b\/c)\" we can omit brackets to get the expression \"a*b\/c\".","input_specification":"The first line contains the only number n (0\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the amount of #define constructions in the given program. Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax: #define name expression where name \u2014 the macro name, expression \u2014 the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*\/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109. All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction. Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions. The input lines may contain any number of spaces anywhere, providing these spaces do not break the word \"define\" or the names of constructions and variables. In particular, there can be any number of spaces before and after the \"#\" symbol. The length of any line from the input file does not exceed 100 characters.","output_specification":"Output \"OK\", if the expression is correct according to the above given criterion, otherwise output \"Suspicious\".","notes":null,"sample_inputs":["1\n#define sum x + y\n1 * sum","1\n#define sum (x + y)\nsum - sum","4\n#define sum x + y\n#define mul a * b\n#define div a \/ b\n#define expr sum + mul * div * mul\nexpr","3\n#define SumSafe (a+b)\n#define DivUnsafe a\/b\n#define DenominatorUnsafe a*b\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)"],"sample_outputs":["Suspicious","OK","OK","Suspicious"],"human_solution":"#include \n#include \n#include \n\n#define N\t100\n#define M\t100000\n\nvoid trim(char *s) {\n\tstatic char t[128];\n\tint n, m, i;\n\n\tmemset(t, 0, sizeof t);\n\tn = strlen(s);\n\tfor (i = 0, m = 0; i < n; i++)\n\t\tif (!isspace(s[i]))\n\t\t\tt[m++] = s[i];\n\tstrcpy(s, t);\n}\n\nint isop(char c) {\n\treturn c == '[' || c == ']' || c == '(' || c == ')' || c == '+' || c == '-' || c == '*' || c == '\/';\n}\n\nint xx[M], yy[M];\n\nint replace(char *ss, char *s, char *t, int x) {\n\tstatic char s_[M + 1];\n\tint n, m, l, n_, i, change;\n\n\tn = strlen(ss);\n\tm = strlen(s);\n\tl = strlen(t);\n\tmemset(s_, 0, sizeof s_);\n\tn_ = 0;\n\tchange = 0;\n\tmemset(xx, 0, sizeof xx);\n\tfor (i = 0; i < n; )\n\t\tif (i + m <= n && strncmp(ss + i, s, m) == 0 && (i == 0 || isop(ss[i - 1])) && (i + m == n || isop(ss[i + m]))) {\n\t\t\txx[n_] = x;\n\t\t\ts_[n_++] = '[';\n\t\t\tmemcpy(s_ + n_, t, l);\n\t\t\tn_ += l;\n\t\t\ts_[n_++] = ']';\n\t\t\ti += m;\n\t\t\tchange = 1;\n\t\t} else {\n\t\t\txx[n_] = yy[i];\n\t\t\ts_[n_++] = ss[i++];\n\t\t}\n\tstrcpy(ss, s_);\n\tmemset(yy, 0, sizeof yy);\n\tmemcpy(yy, xx, n_ * sizeof *xx);\n\treturn change;\n}\n\nstatic char t1[N][128], t2[N][128];\nstatic char aa[N + 1], bb[N + 1], cc[N + 1];\nint n;\n\nvoid parse(char *ss, int x) {\n\tstatic int stack[M];\n\tint m, i, j, j_, x_, cnt, cnt_;\n\n\taa[x] = 1;\n\tmemset(yy, 0, sizeof yy);\n\tfor (i = 0; i < x; i++)\n\t\tif (replace(ss, t1[i], t2[i], i) && !aa[i]) {\n\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\treturn;\n\t\t}\n\tbb[x] = cc[x] = 0;\n\tm = strlen(ss);\n\tfor (j = 0, cnt = 0, cnt_ = 0; j < m; j++) {\n\t\tif (ss[j] == '[')\n\t\t\tstack[cnt++] = j;\n\t\telse if (ss[j] == ']') {\n\t\t\tj_ = stack[--cnt], x_ = xx[j_];\n\t\t\tif (j_ > 0) {\n\t\t\t\tif ((ss[j_ - 1] == '*' || ss[j_ - 1] == '\/') && bb[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (ss[j_ - 1] == '-' && bb[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (ss[j_ - 1] == '\/' && cc[x_]) {\n\t\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (j + 1 < m && (ss[j + 1] == '*' || ss[j + 1] == '\/') && bb[x_]) {\n\t\t\t\taa[x] = bb[x] = cc[x] = 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (bb[x_] && cnt_ == 0)\n\t\t\t\tbb[x] = 1;\n\t\t\tif (cc[x_] && cnt_ == 0)\n\t\t\t\tcc[x] = 1;\n\t\t}\n\t\tif ((ss[j] == '+' || ss[j] == '-') && cnt_ == 0)\n\t\t\tbb[x] = 1;\n\t\telse if ((ss[j] == '*' || ss[j] == '\/') && cnt_ == 0)\n\t\t\tcc[x] = 1;\n\t\tif (ss[j] == '(')\n\t\t\tcnt_++;\n\t\telse if (ss[j] == ')')\n\t\t\tcnt_--;\n\t}\n}\n\nint main() {\n\tstatic char ss[M + 2], tt[M + 2], s[128];\n\tint i, len;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tlen = 0;\n\t\twhile (len < 7) {\n\t\t\tscanf(\"%s\", s);\n\t\t\tlen += strlen(s);\n\t\t}\n\t\tscanf(\"%s\", t1[i]);\n\t\tfgets(t2[i], 128, stdin);\n\t\ttrim(t2[i]);\n\t}\n\tfgets(ss, M + 2, stdin);\n\ttrim(ss);\n\tfor (i = 0; i <= n; i++) {\n\t\tstrcpy(tt, i < n ? t2[i] : ss);\n\t\tparse(tt, i);\n\t}\n\tprintf(aa[n] ? \"OK\\n\" : \"Suspicious\\n\");\n\treturn 0;\n}\n","testcases":"[{'input': '1\\r\\n#define sum x + y\\r\\n1 * sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum (x + y)\\r\\nsum - sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum x + y\\r\\n#define mul a * b\\r\\n#define div a \/ b\\r\\n#define expr sum + mul * div * mul\\r\\nexpr\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define SumSafe (a+b)\\r\\n#define DivUnsafe a\/b\\r\\n#define DenominatorUnsafe a*b\\r\\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '0\\r\\naa + b - c * (ddd * eee \/ fff * a \/ b * c + d - b + c - (a + b)) - d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define a b\\r\\n#define c d\\r\\na + b + c + d + 1234567 -10*(2-2+1000*1000*1000*1000*1000)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define macros ( x + y ) \\r\\n # define Macros (x+y)\\r\\nmacros\/Macros\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/(a)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define a x*y\\r\\nc\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define a b*c\\r\\na\/a*a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define mul x*y\\r\\n#define bad x\/mul\\r\\n#define good x\/(mul)\\r\\ngood\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define mult a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum+difference+(sum)*(difference)-mult+mult*division+division*mult+division\/(mult+sum-(difference))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference\/division)+sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference)*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(sum)\/multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum\/(multiplication)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n#define res (0-difference)\\r\\nsum+res*multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\ndivision\/(multiplication\/(division)\/DIVISION\/(sum-division-multiplication-(difference)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define sum x + y\\r\\n#define SomeBad (2 * sum)\\r\\n#define SomePossiblyGood 0 * SomeBad + (x + x - 2*x) * SomeBad\\r\\nSomePossiblyGood\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define a 0\\r\\n#define b (a-a)*(x\/x-1)\\r\\nb-b\/b*b\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define fkdsjfslkjfsdk x\/0\\r\\n#define fkdsjfslkjfsdksdds 0\/(0-0)\\r\\nfkdsjfslkjfsdk + fkdsjfslkjfsdks + fkdsjfslkjfsdkssds\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define null x\/0\\r\\n#define some x\/x\\r\\n#define bad 1\/x\\r\\nbad\/0+0\/bad+0\/0*bad\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define MWjGY x+x*53 *x\\r\\n#define ovqZ 2\/926+x\/A\\r\\n#define uU 55-qRj*A*2\\r\\nx*A\/x-A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define zz 5+7\/x*x*9\\r\\n#define mlTL 6+x\/7+x\/x\\r\\n#define DUO 7*7-x+zz\\r\\n#define IH 6*4-x+x\\r\\n67\/(5)-IH\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Oc 9\/51+65+vN\\r\\n#define gga 53\/ 94\/x\/x\\r\\n#define ArB x\/x\/9-77-8\\r\\n#define j 76-6\/93+vN\\r\\n#define cALNN Oc+60499\\r\\n8*6-66\/x*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define fSdvwOj (W)*W+73\\r\\n#define NAZjc 7695*55-x\\r\\n#define AHGGglVwch (6-a-W)\\r\\n((5))+W+W\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define m bJJD +x \\r\\n#define yYkQNzjR (x*19)-892\\r\\n#define MNvfxqfbq (x-6*x\/8)\\r\\n#define nJZdvO 8\/4 *m\/m\\r\\n 9+m\/x+x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Sl x*7-(x)\/O\\r\\n#define srAOHccTln 3+x*2*O\\r\\n#define OFAZk 239751817\\r\\n#define JYWrOEgazV (x-O\/4)-x\\r\\n#define XsOZvalgOh 89905879\/7\\r\\nx\/Sl-(Sl)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define uYdw ((9-x-3) )\\r\\n#define fy (((x+21)))\\r\\n#define nY ((2+x)-46)\\r\\n141141432\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define GCvqH (58 )-(x)\\r\\n#define g ((x\/x+x))\\r\\n#define spst hQTJ\\r\\n#define i GCvqH\\r\\n(((x+6)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define rg (67)+((x))\\r\\n#define ya x-(6\/x)*rg\\r\\n#define anTxe 10*ya*(x)\\r\\n#define xcmo ((x)*(vT))\\r\\n#define eg ((vT)) -ya\\r\\n((x*(Ii)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define T ((b\/1 +1))\\r\\n#define pm (s)-43-(s)\\r\\n#define jkNBpvDZl ((x ))\/65\\r\\n(((58*7)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define cJitUt 21\/(4)+4+4\\r\\n#define zHwBOLIvF 4*((41\/x))\\r\\n#define GbtYVo (E)+(x+3)\\r\\n#define zTcZBaby (58)+x-x+x\\r\\n(E+E)\/8 *4\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define mBURKdeKvy 266693986\\r\\n#define nWi ( ((x))-4)\\r\\n#define iYreeOt ((7\/x+42))\\r\\n#define laLzP ((aB\/35)) \\r\\n#define dXjRJ (((B*hX)))\\r\\n(1*2+(67))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define UVMQLGvEqOxaAgRkvJH tBd\\r\\n#define QoAsBMaUcJzXai x\/x-hm\/83+8*8\/5\/hm \/x\/hm\\r\\n#define QtxtzEHCmidm 75 +491928441\\r\\n((x)\/VUpYoEdDUtLFanGyqfQR )\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define efemx 2\/1*3*69+81+10\/690445104\\r\\n#define AyjrEzAjMKZpRPfCOaO 21*9+( j*40+3*4)*ND+w-j*j+x*55\\r\\n#define YkJkHcNhXcci 85*3215\/40\/365819568\\r\\n#define MUzvOZSXJujI 9-4\/j*j-7-w*23*5+j+9-9*ND*2\/37\\r\\nND\/j*28 -1* ND+22889023\/j\/j\/j\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define QNUkjqPcGWF 6*4\/908975666-7\/10-x*7\\r\\n#define xqwhNWiiMaZOcmgiXYY 3936*(e*5*H+2)-TsA+(e)\/1-25\\r\\n#define tRsSqfqJt ((uT*82\/e)+e\/(23+(45)-9)+(50))\\r\\n#define DtIOWRkYe (8*3\/9)*e*x *60041512*2-(e)\\r\\n#define qgPgxja (4\/x+e\/uT*16358009- 6\/13*5)\\r\\ne+x*e\/84\/x+uT*H\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define lTCUUO JQmj\\r\\n#define oUeQMB (12*x+x+x)-75-(79\/1)-(7)*1\/mr\\r\\n#define LAQu xwvBtky\\r\\n8654 *1*5-mr-3*J\/oUeQMB\/x\/6\/9\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define VLuQIO 1-x\/33+ Fk+wS\/35-wS-(x*iz )\\r\\n#define BCIsIR 5*(wS)\/x\/iz\/1+x-x-4-x\/68\/x\/8*x\\r\\n#define QPUpmTiB 21-x\/895912506+2\\r\\n#define wcZLUIqJS 7\/65-x*61-(24+iz)+x+315670+x\/x\\r\\nBCIsIR\/VLuQIO\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define FDmMYOENCOKmYwYlOl 6-(L)\/((((ud\/x))\/ud-26*8-5))\\r\\n#define QkopKBjKdJxhc (6)*4\/7-L\/781844832 \\r\\n#define UjgTieUBXTSTbiLFAhkV 3*1*(52)\/6-6*65\/x+((L-56))+x+x\\r\\n#define yWVYDuqliezpKLwnI 8\/4+1+88+97946+(1)-((68))-L\/L\\r\\n#define AvvED 719901121+95\/2\/78\/1-10+37\\r\\n(1*x+ 528176190+17\/ud)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define e x *R\/5+(x)+4\/18\/x*R\/x-8+1+R\\r\\n#define GgGqGYjXoJjIezAVu (( 491563947*R))*9-e-3\/4\\r\\n#define XgznGUWMxQwh (8\/R+4*(e)+10\/4*x+24*R+21)-224\\r\\n (82493582)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define MrKSTrKhPLeJqOcEPvv (x+x\/x)\/Qdf-x-x-(2\/23)+9442-x\\r\\n#define zPHUgmIYE 10- 7*x\/x+VwRUuIRezDR*80\\r\\n#define OsfThxasHeFZCEZTfD 271456028-(x*x)-8+2*x*x*x+(x)\\r\\n#define zVYasB x\/x -x-(51)-x*x*((x)) \/x \\r\\n(x\/64-x*( (5+x+x)-(37)\/3*22))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WREol (fcdGZaLzhiFpVQmhHO)\\r\\n#define lDTNxcMqPPP 3+(57)\/x\/91540-x*71-x*6-((1))\\r\\n#define afFJVBkr ((12*x-8+9 *lDlx+7+lDlx))\\r\\n#define mYEizEWrNtRSQNCcDQrn 732480960+9+x-78-x\/1+12*x\\r\\n#define IZTmjheAahbNSNFa ((x-x*7+407643063 ))\\r\\nXQvMxLNpQnhpimNhAkfX\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define Mc x+x*55231- x\/x\/x+35\/x*(5*(x)) -5*x*(1-2-(29\/1))\\r\\n#define afSVLCdjvylSu bgqv\/6+4*x*((Mc\/1318\/x-8-4)-Mc\/Mc\/(9))\\r\\n#define ZOSV (1+2\/x+6* 174806683)-x\/x*Mc+52*x-x\\r\\nbgqv-x-6*x\/72\/(x )\/afSVLCdjvylSu\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RJIiiGQqn dmpWFcrqQeM+V-o* 55\/9*o-o\/V*V*o\\r\\n#define ElDZlrtzDkeKgsX 498718105* 3\/(y)\/(4)-(5*x)*1\\r\\n#define qwKl jHqPHX\\r\\n#define qXzAZkCuchBYR (qy*qwKl-6+5*1+2)-7-3+(38)-o*4\/4-1-V*x\/6+1*x\/o\\r\\no*((V))-o+2+((((2*V)\/V-o*V\/4)))\/o*33+y\/7 -x+x \\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WTovyGexUNjGMRJv (MQG*18-6)\/x\/x*x\/x-x*akNyw*x+x-x\/2\/x*20\\r\\n#define hpextyhVCa 70*x\/67-x*87931-(497612505-7*x-MQG)-x\\r\\n#define MRkKnCXFt x-5-21962-x\/sOmThNSS\/x\/6-4+(65+57+x+x+7-7+x\/x)\\r\\n#define ajsczBLLklBSqqh nGj-38*9 *x\/47\/8*5\/5-72\/x*x-x*x*31 \/7-44-3+64\\r\\n#define jgqfv WTovyGexUNjGMRJv\\r\\n 4+338\/x*x+13 -795*3-74*2\/4+563-x\/76401438\/83025\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define G u+13-35348\/2-(u\/u)-u\/u*u*(OC)-OC -u-u\/u*u\/9 \\r\\n#define RNRQ G*G*u+G\/755750\/G\/G +((u-6*G+6)*2)- 5*96+5\/u*275-u\\r\\n#define Zg 94363\/u*u-41+Gm*G-81\/5-1-G*G*x-(5517*5\/4)*21 +75\\r\\n406690013\/WM*G+(u+u)*Zg+2\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RMWAZhIp x*x+12+94*12*5*1-x-141915293\\r\\n#define EeguG 9-55+x\/29+x+x\/E*8*81\/x-x*75-4*17-81\/x\/6+619978*x*x\\r\\n#define HvUYEvQTyYmBGvqHSb 454574730\/644135926*x\/23+E-sy\/14\\r\\n#define BqMGcT x\/(43)+819897061-x*(7\/x)-(x)+sy-E-x*79-E+(x)\/6\/63\\r\\n76+3\/x\/8*x+E-76+sy-sy+9*6\/66\/sy-77+x-x*sy+E\/50\/64\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define cbt ((((d))+9-3+ (d)\/d\/6*SDDNqj*50\/d+d-m+8\/d\/1)) \\r\\n#define gLrUE 18+ 70*d\/3-d*d-d\/35 +33-5\/9+d-d*387+d-1\\r\\n#define AvjmK 9-d-8+(d+m+5\/2\/x*d+1)\/x\/d-5-2*(m)+d+17\/d+ 4\/52\/8\\r\\n#define SjrJ 90\/7\/5\/d+ 254877982+(m) *x-19\\r\\n#define PlykoqfDbwxR 540304590 +d*x\/11-(m+d-d-4)*(d-3-1)\/d\\r\\nd-2+1+46-29620+9-(9*3 \/d)*6*m\/d+9+(1670)\/cbt\/d+d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define BuAiJLgAlkj x-3+419032556\/409023036-(17*84)+x+8+A\\r\\n#define wU 516506880\\r\\n#define HeyDGlnaGxBaHjzelvF iRSPqHfgHw\/4-(99)*(I)+A+I-9*46*x\\r\\nI\/CRklg-HeyDGlnaGxBaHjzelvF\/3+5 \\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define SOlTohcPGckDyF ((D)\/G-83+KHGSuJFLHqD\/5)\\r\\n#define KEUXeOYpg 9+x-8-8\/x\/9-65-6+4+55*x-58\/x+84+D*2-7+D\/x-x*G\/4-2\\r\\n#define YZl (1\/67*x*6\/2*G)-D\/1595107*D+6\/x*1+D+3\/9\/x\/26-6+9 \\r\\n#define gCatFsZn uBBqilYclMhpVfKKTkGK\\r\\n(28682537+ YZl*(4*52) )*x\/8- gCatFsZn*x\/54\/7\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define iiXEqDYeyVmIYsOaO fj\/x-9-6\/x*x+ 1\/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x\/70\\r\\n#define XVgLzhoTUxoBr ( x+x\/x\/x*6-x)* x+K\/24206-2 \/5\/8-x-7\/Ww\/K-x+6 \\r\\n#define QdfRBaJk 470551685-( 54-x)-30\\r\\n#define gEJcAGnF x+x-x+(x\/x+9)\/x-41-1\/fj\/1157561+x\/x -x\/26\/x+K*x\\r\\n#define lO 7-1*(x*58 )-K*fj \/722113691\/x\/K+2\\r\\n2+4*85\/86\/x*27 \/49252-x*x\/6-83-7\/x+x+K-lO+8-K-x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define x 3\/2\\r\\n2*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define sum 1000000000 + 1000000000 + 1000000000 \\r\\n # define a b + 45 * sum \\r\\n a \\r\\n', 'output': ['Suspicious\\r\\n']}]","id":228} {"difficulty":1600,"lang":"GNU C11","lang_cluster":"C","src_uid":"c4b7265ff4332225c0d5617c3233a910","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n#include \n\nint koncni [110];\nint fab [110][110];\n\nint main(){\n\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tfor(int i = 1; i <= n; i++){\n\t\tscanf(\"%d\", &koncni[i]);\n\t}\n\n\tint a;\n\tint b;\n\n\tfor (int i = 1; i <=n; i++){\n\t\tscanf(\"%d\",&a);\n\n\t\tif (i - a >= 1){\n\t\t\tfab[i][i - a] = 1;\n\t\t\tfab[i - a][i] = 1;\n\t\t}\n\t\tif (a + i <= n){\n\t\t\tfab[i][i + a] = 1;\n\t\t\tfab[i + a][i] = 1;\n\t\t}\n\n\t}\n\t\/\/int je;\n\n\tfor (int i = 1; i <= n; i++ ){\n\t\tfor (int j = 1; j <= n; j++){\n\t\t\tfor (int z = 1; z <= n; z++){\n\t\t\t\tif ((fab[i][z] && fab[z][j])||\n\t\t\t\t\t fab[i][z] && fab [j][z]){\n\n\n\t\t\t\t\tfab[i][j] = 1;\n\t\t\t\t\tfab[j][i] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tint gor = 0;\n\tint levo = 0;\n\n\n\tfor (int i = 1; i <= n; i++){\n\t\tfab[i][i] = 1;\n\t}\n\tint je = 1;\n\n\tfor (int i = 1; i <= n; i++){\n\t\tif (fab[i][koncni[i]]==0){\n\t\t\tje = 0;\n\t\t\tbreak;\n\t\t}\n\n\n\t}\n\n\tif (je == 1){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\n\n\tprintf(\"\\n\");\n\n\tfor (int i = 1; i <= 7; i++){\n\t\tfor (int j = 1; j <= 7 ; j++ ){\n\t\t\tprintf(\"%d \",fab[i][j] );\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\n\n\t\t\n\n\n\n\treturn 0;\n}","description":"One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exchange it's value with the value of some other j-th cell, if |i\u2009-\u2009j|\u2009=\u2009di, where di is a favourite number of i-th cell. Cells make moves in any order, the number of moves is unlimited.The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to n. You are to determine whether the game could move to this state.","input_specification":"The first line contains positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of cells in the array. The second line contains n distinct integers from 1 to n \u2014 permutation. The last line contains n integers from 1 to n \u2014 favourite numbers of the cells.","output_specification":"If the given state is reachable in the described game, output YES, otherwise NO.","notes":null,"sample_inputs":["5\n5 4 3 2 1\n1 1 1 1 1","7\n4 3 5 1 2 7 6\n4 6 6 1 6 6 1","7\n4 2 5 1 3 7 6\n4 6 6 1 6 6 1"],"sample_outputs":["YES","NO","YES"],"human_solution":"#include \n\nint par[100];\n\nint find(int x)\n{\n if (par[x] == x) {\n\t return x;\n } else {\n\t return par[x] = find(par[x]);\n }\n}\n\nvoid unite(int x, int y)\n{\n x = find(x);\n y = find(y);\n\n if (x == y) return;\n\n par[x] = y;\n}\n\nint same(int x, int y)\n{\n x = find(x);\n y = find(y);\n\n if (x == y) {\n\t return 1;\n } else {\n\t return 0;\n }\n}\n\nint main()\n{\n int n, i;\n int a[100], b[100];\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n for (i = 0; i < n; i++) scanf(\"%d\", &b[i]);\n\n for (i = 0; i < n; i++) par[i] = i;\n\n for (i = 0; i < n; i++) {\n\t if (b[i] <= i) {\n\t unite(i, i - b[i]);\n\t }\n\n\t if (b[i] + i < n) {\n\t unite(i, b[i] + i);\n\t }\n }\n\n for (i = 0; i < n; i++) {\n\t if (same(i, a[i] - 1) == 0) {\n\t puts(\"NO\");\n\n\t return 0;\n\t }\n }\n\n puts(\"YES\");\n\n return 0;\n}\n","testcases":"[{'input': '5\\r\\n5 4 3 2 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7\\r\\n4 3 5 1 2 7 6\\r\\n4 6 6 1 6 6 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7\\r\\n4 2 5 1 3 7 6\\r\\n4 6 6 1 6 6 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n3 2 1 4 6 5\\r\\n3 6 1 6 6 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n3 5 1 4 6 2\\r\\n3 6 1 6 6 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 2 3 4\\r\\n1 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '71\\r\\n1 63 3 4 5 6 7 8 9 44 29 12 13 14 55 34 42 18 52 20 21 33 23 24 25 26 27 28 19 30 47 32 15 71 37 36 69 38 39 40 41 17 43 10 45 58 35 48 49 11 51 50 53 54 22 56 57 46 59 60 61 62 2 64 65 66 67 68 31 70 16\\r\\n21 45 8 62 56 53 25 22 65 34 39 43 30 63 18 18 25 10 31 64 70 33 49 70 34 21 69 25 21 4 38 41 4 36 4 28 6 48 6 25 57 11 62 48 62 69 12 14 12 70 41 2 49 30 40 37 67 12 13 22 50 35 61 42 33 30 10 47 10 65 37\\r\\n', 'output': ['YES\\r\\n']}, {'input': '76\\r\\n44 47 38 4 31 6 33 8 50 69 35 26 73 14 74 16 41 9 59 75 46 7 23 52 58 10 17 49 29 64 42 19 12 36 65 34 3 37 39 1 30 76 27 2 22 55 61 48 24 5 54 11 51 28 68 18 57 60 56 71 63 25 15 66 62 32 67 53 43 70 45 72 13 40 20 21\\r\\n54 63 9 55 65 59 4 1 42 31 63 5 28 26 19 35 50 21 39 23 40 64 45 36 74 74 70 67 53 20 19 27 13 2 71 62 6 51 2 65 61 58 55 55 32 75 54 75 48 45 40 45 7 43 72 75 54 9 32 52 8 36 33 59 57 58 68 32 71 21 63 69 7 40 28 68\\r\\n', 'output': ['NO\\r\\n']}, {'input': '82\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 59 17 18 19 20 21 22 23 24 25 26 27 28 29 61 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 16 60 30 79 63 64 65 66 67 68 69 70 71 72 73 74 75 76 82 78 62 80 81 77\\r\\n8 79 66 53 45 15 70 17 53 28 30 70 14 49 51 43 45 14 27 30 37 51 29 55 6 5 24 6 61 31 64 47 71 60 79 64 28 64 17 38 11 13 3 72 24 70 16 14 30 72 52 33 31 71 32 66 29 45 55 32 48 14 63 60 50 50 61 2 47 26 4 26 72 3 56 19 1 47 17 26 66 5\\r\\n', 'output': ['YES\\r\\n']}, {'input': '13\\r\\n13 1 12 4 6 10 7 8 9 3 11 5 2\\r\\n6 12 12 7 11 7 10 3 1 5 2 2 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n1 3 2 4 5\\r\\n1 4 1 2 4\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10\\r\\n6 2 9 4 8 7 5 10 3 1\\r\\n2 9 7 9 4 5 1 5 3 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '68\\r\\n1 2 3 46 5 6 7 8 9 63 11 57 13 14 15 16 40 18 19 20 21 22 23 24 25 26 27 28 29 35 31 32 33 34 30 36 37 64 39 17 41 12 43 52 58 4 47 44 49 50 51 48 53 54 55 56 42 59 45 60 61 62 10 38 65 66 67 68\\r\\n13 48 67 55 4 39 47 8 4 35 50 28 28 30 63 60 52 29 2 33 48 57 40 43 25 34 62 50 60 5 3 66 32 15 7 51 51 26 47 23 67 30 27 53 40 42 5 4 60 67 11 4 31 10 62 46 45 13 14 13 24 66 53 25 22 60 14 42\\r\\n', 'output': ['YES\\r\\n']}, {'input': '52\\r\\n17 35 19 41 21 51 46 45 13 10 15 43 37 30 34 12 39 20 14 48 49 3 23 6 4 26 47 18 16 5 31 36 27 29 24 11 52 38 33 42 1 8 9 32 44 7 28 22 40 50 2 25\\r\\n47 6 50 13 49 22 17 18 3 11 2 43 35 8 25 38 19 41 17 5 7 8 10 51 17 30 34 48 41 8 46 10 11 45 15 28 42 32 37 33 43 31 38 13 43 19 32 19 2 47 42 46\\r\\n', 'output': ['NO\\r\\n']}, {'input': '50\\r\\n5 2 4 31 1 10 44 24 9 38 20 27 35 14 37 46 8 18 41 34 7 22 25 45 32 43 6 47 39 15 26 48 30 23 16 36 17 21 50 40 3 11 12 19 42 29 28 49 33 13\\r\\n27 15 18 20 19 23 49 18 28 32 29 2 16 23 23 2 17 25 27 43 32 31 11 3 49 46 22 44 14 48 35 15 32 35 2 49 10 22 5 36 49 16 43 46 33 11 31 15 45 23\\r\\n', 'output': ['NO\\r\\n']}, {'input': '60\\r\\n1 2 17 4 27 6 43 26 32 10 11 12 29 14 15 16 3 44 56 20 21 22 53 24 25 8 5 28 58 7 31 9 33 57 48 36 37 38 39 30 41 50 40 35 45 46 13 18 47 55 51 52 23 54 42 19 34 49 59 60\\r\\n59 25 14 52 1 24 36 16 42 8 59 22 41 47 49 33 36 35 37 30 25 6 30 8 50 2 25 3 29 10 52 20 8 45 13 43 53 45 10 33 54 53 47 26 32 4 2 38 33 45 19 4 56 22 13 40 45 45 24 14\\r\\n', 'output': ['YES\\r\\n']}, {'input': '79\\r\\n1 2 3 67 5 6 7 60 9 71 63 12 31 57 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 64 32 79 34 35 45 37 38 39 40 41 42 43 44 36 46 47 48 11 50 51 52 74 54 55 56 14 58 59 8 61 62 49 13 65 66 4 68 72 70 10 69 73 53 75 76 77 78 33\\r\\n17 46 68 35 48 11 78 40 65 61 52 45 51 66 13 56 53 63 61 43 22 60 13 67 34 16 64 19 11 27 33 8 9 1 68 9 17 62 65 23 50 1 55 20 70 61 65 55 38 47 9 45 55 70 39 31 43 47 40 52 20 5 20 75 25 25 63 2 36 12 60 3 35 21 78 38 39 25 46\\r\\n', 'output': ['YES\\r\\n']}, {'input': '80\\r\\n39 2 33 16 36 27 65 62 40 17 44 6 13 10 43 31 66 64 63 20 59 72 9 24 12 29 77 47 71 79 50 32 55 4 35 60 7 69 14 54 3 42 15 11 75 22 28 30 49 18 46 56 51 68 5 38 25 58 73 26 61 21 37 80 19 45 53 1 70 67 23 52 41 74 34 76 57 8 48 78\\r\\n6 23 42 42 13 72 14 45 66 76 74 44 49 10 14 64 17 15 4 68 14 34 42 56 50 65 17 52 15 26 1 42 27 22 6 52 25 47 76 45 48 67 18 44 74 48 62 58 59 79 13 5 12 14 5 13 51 21 57 59 49 43 8 34 7 16 34 29 38 74 40 72 18 46 47 43 2 4 17 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '8\\r\\n5 2 3 4 8 6 1 7\\r\\n6 7 7 7 7 7 2 7\\r\\n', 'output': ['YES\\r\\n']}, {'input': '17\\r\\n1 11 3 4 5 6 7 8 9 10 2 12 13 14 15 16 17\\r\\n13 9 16 5 16 12 11 4 4 7 12 16 2 7 14 6 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '19\\r\\n7 2 17 18 4 16 1 9 12 10 8 11 6 13 14 19 3 5 15\\r\\n12 4 9 1 13 18 14 10 18 2 17 16 12 3 16 6 5 7 7\\r\\n', 'output': ['NO\\r\\n']}, {'input': '47\\r\\n1 32 29 9 47 6 8 36 37 10 11 16 2 14 38 40 15 44 19 35 18 22 23 12 17 41 5 31 26 25 4 27 33 34 42 7 24 28 45 20 46 13 43 30 21 3 39\\r\\n38 28 41 46 28 20 36 9 4 10 44 28 9 39 12 36 32 38 43 3 13 33 34 35 22 23 1 4 39 2 11 34 20 19 25 13 20 26 45 36 36 43 45 13 31 9 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1\\r\\n1\\r\\n1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n1 1\\r\\n', 'output': ['YES\\r\\n']}]","id":229} {"difficulty":1600,"lang":"GNU C","lang_cluster":"C","src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n\nint intcmp(int *a, int *b) {\n return *a - *b;\n}\n\n#define N 100001\n\nint n, m;\nint a[N];\nint c[N][2];\nint suspects[N], k;\n\nint main() {\n int i, no, x;\n while (scanf(\"%d %d\", &n, &m) != EOF) {\n no = 0;\n memset(c, 0, sizeof c);\n for (i = 1; i <= n; i++) {\n scanf(\"%d\", &a[i]);\n if (a[i] > 0) {\n c[a[i]][1]++;\n } else {\n c[-a[i]][0]++;\n no++;\n }\n }\n k = 0;\n for (i = 1; i <= n; i++)\n if (c[i][1] + no - c[i][0] == m)\n suspects[k++] = i;\n qsort(suspects, k, sizeof(int), (__compar_fn_t)intcmp);\n for (i = 1; i <= n; i++) {\n if (a[i] > 0) {\n x = a[i];\n if (k == 1 && suspects[0] == x)\n puts(\"Truth\");\n else if (!bsearch(&x, suspects, k, sizeof(int), (__compar_fn_t)intcmp))\n puts(\"Lie\");\n else\n puts(\"Not defined\");\n } else {\n x = -a[i];\n if (k == 1 && suspects[0] == x)\n puts(\"Lie\");\n else if (!bsearch(&x, suspects, k, sizeof(int), (__compar_fn_t)intcmp))\n puts(\"Truth\");\n else\n puts(\"Not defined\");\n }\n }\n }\n return 0;\n}\n","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"],"human_solution":"#include \n\nint a[100000];\nint b[100000][2];\nint c[100000];\n\nint main()\n{\n int n, m, sum = 0, p = 0, i;\n\n scanf(\"%d %d\", &n, &m);\n\n for (i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n\n if (n == m) {\n\t for (i = 0; i < n; i++) puts(\"Truth\");\n\n\t return 0;\n }\n\n for (i = 0; i < n; i++) {\n\t if (a[i] > 0) {\n\t b[a[i] - 1][0]++;\n\t } else {\n\t b[-a[i] - 1][1]++;\n\n\t sum++;\n\t }\n }\n\n for (i = 0; i < n; i++) {\n\t int x = b[i][0] + sum - b[i][1];\n\n\t if (x == m) {\n\t c[i] = 1;\n\n\t p++;\n\t }\n }\n\n for (i = 0; i < n; i++) {\n\t if (a[i] > 0) {\n\t if (c[a[i] - 1] == 1) {\n\t\t if (p == 1) {\n\t\t\t puts(\"Truth\");\n\t\t } else {\n\t\t\t puts(\"Not defined\");\n\t\t }\n\t } else {\n\t\t puts(\"Lie\");\n\t }\n\t } else {\n\t if (c[-a[i] - 1] == 0) {\n\t\t puts(\"Truth\");\n\t } else {\n\t\t if (p == 1) {\n\t\t\t puts(\"Lie\");\n\t\t } else {\n\t\t\t puts(\"Not defined\");\n\t\t }\n\t }\n\t }\n }\n\n return 0;\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":230} {"difficulty":2600,"lang":"GNU C","lang_cluster":"C","src_uid":"c7e0c6b93a2f2f43fe9da405409c91e6","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \n#include \n#include \n#include \n#include \n\n\/*---*\/\n\n#define FOR(i, b, e)\tfor(i = (b); i <= (e); i++)\n#define FORL(i, b, e)\tfor(i = (b); i < (e); i++)\n#define FORD(i, e, b)\tfor(i = (e); i >= (b); i--)\n#define FOR0(i, e)\t\tFORL(i, 0, e)\n\n#define min(a, b)\t\t(((a) < (b)) ? (a) : (b))\n#define max(a, b)\t\t(((a) > (b)) ? (a) : (b))\n#define MINA(a, b)\t\tdo { if ((a) > (b)) (a) = (b); } while(0)\n#define MAXA(a, b)\t\tdo { if ((a) < (b)) (a) = (b); } while(0)\n#define MINA2(a, b, i, j)\t\tdo { if ((a) > (b)) { (a) = (b); (i) = (j); } } while(0)\n#define MAXA2(a, b, i, j)\t\tdo { if ((a) < (b)) { (a) = (b); (i) = (j); } } while(0)\n\n#define SWAP(a, b)\t\tdo { int _t = a; a = b; b = _t; } while(0)\n#define SWAPT(a, b, t)\tdo { t _t = a; a = b; b = _t; } while(0)\n#define sqr(a)\t\t\t((a) * (a))\n\n#define INT int\n\n#define INT_CAP 0x3F3F3F3F\n\n\/*---*\/\n\n#define NMAX\t4096\n\nchar a[NMAX], b[NMAX];\nINT vv[NMAX][NMAX];\nint lasta[256], lastb[256];\n\nint tr, td, ti, te;\n\nint editdistance(int n1, int n2)\n{\n\tint i1, i2, la, lb;\n\tINT m;\n\tFOR(i2, 0, n2)\n\t\tvv[0][i2] = i2 * ti;\n\tmemset(lasta, 0xFF, sizeof(lasta));\n\tFOR(i1, 1, n1) {\n\t\tvv[i1][0] = i1 * td;\n\t\tmemset(lastb, 0xFF, sizeof(lastb));\n\t\tFOR(i2, 1, n2) {\n\t\t\tif (a[i1 - 1] == b[i2 - 1])\n\t\t\t\tm = vv[i1-1][i2-1];\n\t\t\telse \n\t\t\t\tm = vv[i1-1][i2-1] + tr;\n\t\t\tMINA(m, vv[i1-1][i2] + td);\n\t\t\tMINA(m, vv[i1][i2-1] + ti);\n\t\t\tlb = lastb[a[i1 - 1]];\n\t\t\tla = lasta[b[i2 - 1]];\n\t\t\tif (la >= 0 && lb >= 0)\n\t\t\t\tMINA(m, vv[la][lb] + te + (i2 - lb - 2) * ti + (i1 - la - 2) * ti);\n\t\t\tvv[i1][i2] = m;\n\t\t\tlastb[b[i2 - 1]] = i2 - 1;\n\t\t}\n\t\tlasta[a[i1 - 1]] = i1 - 1;\n\t}\n\treturn vv[n1][n2];\n}\n\nint main()\n{\n\tint la, lb;\n#ifndef ONLINE_JUDGE\nchar ss[1024];\nint cc;\n#endif\n#ifndef ONLINE_JUDGE\nwhile((cc = getchar()) != EOF) {\n\tungetc(cc, stdin);\n#endif\n\tscanf(\"%d %d %d %d\\n\", &ti, &td, &tr, &te);\n\tgets(a);\n\tgets(b);\n\tla = strlen(a);\n\tlb = strlen(b);\n\tprintf(\"%d\\n\", editdistance(la, lb));\n#ifndef ONLINE_JUDGE\n\tprintf(\"\\n\");\n}\n#endif\n\treturn 0;\n}\n\n","description":"You are given a sequence of balls A by your teacher, each labeled with a lowercase Latin letter 'a'-'z'. You don't like the given sequence. You want to change it into a new sequence, B that suits you better. So, you allow yourself four operations: You can insert any ball with any label into the sequence at any position. You can delete (remove) any ball from any position. You can replace any ball with any other ball. You can exchange (swap) two adjacent balls. Your teacher now places time constraints on each operation, meaning that an operation can only be performed in certain time. So, the first operation takes time ti, the second one takes td, the third one takes tr and the fourth one takes te. Also, it is given that 2\u00b7te\u2009\u2265\u2009ti\u2009+\u2009td.Find the minimal time to convert the sequence A to the sequence B.","input_specification":"The first line contains four space-separated integers ti,\u2009td,\u2009tr,\u2009te (0\u2009<\u2009ti,\u2009td,\u2009tr,\u2009te\u2009\u2264\u2009100). The following two lines contain sequences A and B on separate lines. The length of each line is between 1 and 4000 characters inclusive.","output_specification":"Print a single integer representing minimum time to convert A into B.","notes":"NoteIn the second sample, you could delete the ball labeled 'a' from the first position and then insert another 'a' at the new second position with total time 6. However exchanging the balls give total time 3.","sample_inputs":["1 1 1 1\nyoushouldnot\nthoushaltnot","2 4 10 3\nab\nba","1 10 20 30\na\nza"],"sample_outputs":["5","3","1"],"human_solution":"#include\n#include\n#include\n#define REP(i,a,b) for(i=a;i= 0) return dp[A][B];\n if(A==0 && B==0) return dp[A][B] = 0;\n if(A==0 || B==0) return dp[A][B] = cost[1] * A + cost[0] * B;\n if(a[A-1] == b[B-1]) return dp[A][B] = solve(A-1,B-1);\n\n tmp = cost[1] + solve(A-1,B);\n if(res > tmp) res = tmp;\n\n tmp = cost[0] + solve(A,B-1);\n if(res > tmp) res = tmp;\n\n tmp = cost[2] + solve(A-1,B-1);\n if(res > tmp) res = tmp;\n\n if(A>=2 && B>=2){\n j = nextA[A-1][b[B-1]-'a'];\n k = nextB[B-1][a[A-1]-'a'];\n if(j>=0 && k>=0){\n tmp = (A-j-2)*cost[1] + (B-k-2)*cost[0] + cost[3];\n tmp += solve(j,k);\n if(res > tmp) res = tmp;\n }\n }\n\n return dp[A][B] = res;\n}\n\nint main(){\n int i,j,k,l,m,n;\n\n while(scanf(\"%d%d%d%d%s%s\",cost,cost+1,cost+2,cost+3,a,b)==6){\n for(i=0;;i++) if(a[i]<' ') break; as = i;\n for(i=0;;i++) if(b[i]<' ') break; bs = i;\n\n rep(i,26) nextA[0][i] = -1;\n rep(k,as){\n nextA[k][a[k]-'a'] = k;\n rep(i,26) nextA[k+1][i] = nextA[k][i];\n }\n\n rep(i,26) nextB[0][i] = -1;\n rep(k,bs){\n nextB[k][b[k]-'a'] = k;\n rep(i,26) nextB[k+1][i] = nextB[k][i];\n }\n\n rep(i,as+1) rep(j,bs+1) dp[i][j] = -1;\n k = solve(as,bs);\n printf(\"%d\\n\",k);\n }\n\n return 0;\n}\n","testcases":"[{'input': '1 1 1 1\\r\\nyoushouldnot\\r\\nthoushaltnot\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 4 10 3\\r\\nab\\r\\nba\\r\\n', 'output': ['3\\r\\n']}, {'input': '1 10 20 30\\r\\na\\r\\nza\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 6 10 4\\r\\nmanthan\\r\\nmathmania\\r\\n', 'output': ['12\\r\\n']}, {'input': '5 1 5 3\\r\\nabhishek\\r\\naurbhishek\\r\\n', 'output': ['10\\r\\n']}, {'input': '1 1 100 1\\r\\nabcd\\r\\nwxyz\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 6 5 5\\r\\ntest\\r\\ntsar\\r\\n', 'output': ['15\\r\\n']}, {'input': '2 4 10 3\\r\\nmanthan\\r\\nnahtnam\\r\\n', 'output': ['15\\r\\n']}, {'input': '2 4 100 3\\r\\nabcd\\r\\nbade\\r\\n', 'output': ['9\\r\\n']}, {'input': '5 5 1 5\\r\\nab\\r\\nba\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 5 100 4\\r\\ntets\\r\\ntesat\\r\\n', 'output': ['7\\r\\n']}, {'input': '9 1 10 5\\r\\nabcd\\r\\ndbca\\r\\n', 'output': ['20\\r\\n']}, {'input': '2 2 10 2\\r\\nabcd\\r\\nadcb\\r\\n', 'output': ['6\\r\\n']}, {'input': '8 4 3 10\\r\\neekoowppum\\r\\njgmtlmeuigztfctikegvakfbgbafytbputmeppkuuyjkhagdsftfoueitnhjllolevgpmbtlworxojyzpfdaasckcqqdwdwwrklb\\r\\n', 'output': ['729\\r\\n']}, {'input': '5 5 1 82\\r\\nzmtuomrwesrhvudogmalwhtktfcbglnpbdntqssjcrdwlerfccmkmmhsfgaocchxdxxmeiaunhellstnhnjjmbynmqlzuupbnkrw\\r\\nglpfybikah\\r\\n', 'output': ['453\\r\\n']}, {'input': '20 21 22 84\\r\\notirbgzzphwwxqtgqyxympiumuyoupngwabrprmyhjpkgpjmez\\r\\nozvimdjwsyuacgbekgcw\\r\\n', 'output': ['872\\r\\n']}, {'input': '4 5 6 62\\r\\nqibkeavwalpn\\r\\nmaasevryyxzzqpdcgydb\\r\\n', 'output': ['89\\r\\n']}, {'input': '9 8 7 67\\r\\nejohycekbciwahqybwiy\\r\\ncpxgvbiwnuytmbwjvrzalydjjgdcmczejwesqrrh\\r\\n', 'output': ['299\\r\\n']}, {'input': '44 55 22 80\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\n', 'output': ['0\\r\\n']}, {'input': '63 9 44 72\\r\\nabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabdabd\\r\\nabdabdabdabdabdabdabdabdabdabdabtdabdabdabdabdabdabdabdabdabdabdabdabdabd\\r\\n', 'output': ['63\\r\\n']}, {'input': '1 3 4 2\\r\\nabc\\r\\ncxa\\r\\n', 'output': ['6\\r\\n']}, {'input': '1 1 1 1\\r\\nacccb\\r\\nba\\r\\n', 'output': ['4\\r\\n']}, {'input': '1 1 1 1\\r\\nab\\r\\nbca\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1 1 1\\r\\nba\\r\\nacb\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1 100 1\\r\\nafffb\\r\\nbggga\\r\\n', 'output': ['7\\r\\n']}, {'input': '1 1 1 1\\r\\nab\\r\\nbccccccccccccccccccca\\r\\n', 'output': ['20\\r\\n']}, {'input': '100 1 100 60\\r\\nacb\\r\\nba\\r\\n', 'output': ['61\\r\\n']}]","id":231} {"difficulty":1700,"lang":"GNU C11","lang_cluster":"C","src_uid":"cb47d710361979de0f975cc34fc22c7a","execute_outcome":"WRONG_ANSWER","source_code":"#include\n#include\n#define mo 1000000007\n#define MAX_M 100300\nint C[MAX_M*2]={0};\nint q[MAX_M*2]={0};\nint m,n;\nint e[MAX_M*2]={0};\nint s[MAX_M],t[MAX_M];\nint lowbit(int x)\n{\n\n\treturn (x&(x^(x-1)));\n}\nint getsum(int x)\n{\n\n\tint sum=0;\n while (x>0)\n\t{\n sum=(sum+C[x]%mo)%mo;\n\/\/\t printf(\"\/\/X:%d\\n C:%d\\n\",x,C[x]);\n\t x-=lowbit(x);\n\t}\n\treturn sum;\n}\nint add(int x,int d)\n{ \n while (x<=e[0])\n {\n\t \n C[x]=(C[x]+d)%mo;\n\t \n\t x+=lowbit(x);\n }\n\n return 0;\n\n}\n\nint qsort(int l ,int r)\n{\n\n\n\tint x,temp,i,j;\n x=q[(l+r)\/2];\n\ti=l;\n\tj=r;\n\n while(i<=j)\n {\n\n\t\twhile(q[i]x) j--;\n\t\tif (i<=j)\n\t\t{\n temp=q[i];\n\t\t\tq[i]=q[j];\n\t\t\tq[j]=temp;\n\t\t\ti++;\n\t\t\tj--;\n\t\t}\n\t}\n\tif (ix)j--;\n\t\tif (i<=j)\n\t\t{\n\t\t\ttemp=t[i];\n\t\t\tt[i]=t[j];\n\t\t\tt[j]=temp;\n\t\t\ttemp=s[i];\n\t\t\ts[i]=s[j];\n\t\t\ts[j]=temp;\n i++;\n\t\t\tj--;\n\n\t\t}\n\t}\n \tif (i=l)\n { \n\t \/\/printf(\"%d %d \\n\",l,r);\n mid=(r+l)\/2;\n\t if (e[mid]==x) return mid;\n\t if (x>e[mid]) l=mid+1;\n\t else r=mid-1; \n }\n return mid;\n\n\n}\nint main()\n{\n\/\/ int F[50004];\n \n int tot;\n int ans=0;\n int i;\n int F,tt,ss,S1,S2;\n scanf(\"%d %d\",&n,&m);\n tot=1;\n q[tot]=++n;\n q[++tot]=1;\n for (i=1;i<=m;i++) \n {\n\t scanf(\"%d %d\",&s[i],&t[i]);\n\t q[++tot]=++s[i];\n\t q[++tot]=++t[i];\n }\n \/\/=====\ufffd\ufffd\u0262\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd=====\n \/\/==\n \/\/ for (i=1;i<=tot;i++) printf(\"%d \",q[i]);printf(\"\\n\");\n\n qsort(1,tot);\n \n \/\/========================\n \/\/for (i=1;i<=tot;i++) printf(\"%d \",q[i]);printf(\"\\n\");\n e[0]=1;\n e[e[0]]=q[1];\n for (i=2;i<=tot;i++)\n\t if(e[e[0]]!=q[i])\n\t {\n\t\t e[0]++;\n\t\t e[e[0]]=q[i];\n\t }\n \/\/========================\n \/\/for (i=1;i<=e[0];i++) e[i]++;\n \/\/for (i=1;i<=e[0];i++) printf(\"%d \",e[i]);printf(\"\\n\");\n add(1,1);\n \/\/ printf(\"%d\\n\",m);\n \/\/ printf(\"%d\\n\",getsum(1));\n sort(1,m);\/\/\ufffd\ufffd\ufffd\ufffd\ufffd\u0575\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n \/\/ printf(\"ok\");\n \/\/ for (i=1;i<=m;i++) printf(\"%d %d\\n\" ,s[i],t[i]);\n for (i=1;i<=m;i++)\n {\n\t ss=serch(s[i]);\n\t \/\/ printf(\"%d ss:%d \",i,ss);\n\t tt=serch(t[i]);\n\t \/\/ printf(\"tt:%d \\n\",tt);\n\t F=0;\n\t if (ss>1 )S1=getsum(ss-1);else S1=0;\n\t S2=getsum(tt-1);\n\t F=((S2-S1)+mo)%mo;\n\t add(tt,F);\n }\n tt=serch(n);\n \/\/ printf(\"%d\\n\",tt);\n ans=getsum(tt)-getsum(tt-1);\n printf(\"%d\",ans);\n return 0;\n\n}","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"],"human_solution":"#include\n#include\n#define mo 1000000007\n#define MAX_M 100300\nint C[MAX_M*2]={0};\nint q[MAX_M*2]={0};\nint m,n;\nint e[MAX_M*2]={0};\nint s[MAX_M],t[MAX_M];\nint lowbit(int x)\n{\n\n\treturn (x&(x^(x-1)));\n}\nint getsum(int x)\n{\n\n\tint sum=0;\n while (x>0)\n\t{\n sum=(sum+C[x]%mo)%mo;\n\/\/\t printf(\"\/\/X:%d\\n C:%d\\n\",x,C[x]);\n\t x-=lowbit(x);\n\t}\n\treturn sum;\n}\nint add(int x,int d)\n{ \n while (x<=e[0])\n {\n\t \n C[x]=(C[x]+d)%mo;\n\t \n\t x+=lowbit(x);\n }\n\n return 0;\n\n}\n\nint qsort(int l ,int r)\n{\n\n\n\tint x,temp,i,j;\n x=q[(l+r)\/2];\n\ti=l;\n\tj=r;\n\n while(i<=j)\n {\n\n\t\twhile(q[i]x) j--;\n\t\tif (i<=j)\n\t\t{\n temp=q[i];\n\t\t\tq[i]=q[j];\n\t\t\tq[j]=temp;\n\t\t\ti++;\n\t\t\tj--;\n\t\t}\n\t}\n\tif (ix)j--;\n\t\tif (i<=j)\n\t\t{\n\t\t\ttemp=t[i];\n\t\t\tt[i]=t[j];\n\t\t\tt[j]=temp;\n\t\t\ttemp=s[i];\n\t\t\ts[i]=s[j];\n\t\t\ts[j]=temp;\n i++;\n\t\t\tj--;\n\n\t\t}\n\t}\n \tif (i=l)\n { \n\t \/\/printf(\"%d %d \\n\",l,r);\n mid=(r+l)\/2;\n\t if (e[mid]==x) return mid;\n\t if (x>e[mid]) l=mid+1;\n\t else r=mid-1; \n }\n return mid;\n\n\n}\nint main()\n{\n\/\/ int F[50004];\n \n int tot;\n int ans=0;\n int i;\n int F,tt,ss,S1,S2;\n scanf(\"%d %d\",&n,&m);\n tot=1;\n q[tot]=++n;\n q[++tot]=1;\n for (i=1;i<=m;i++) \n {\n\t scanf(\"%d %d\",&s[i],&t[i]);\n\t q[++tot]=++s[i];\n\t q[++tot]=++t[i];\n }\n \/\/=====\ufffd\ufffd\u0262\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd=====\n \/\/==\n \/\/ for (i=1;i<=tot;i++) printf(\"%d \",q[i]);printf(\"\\n\");\n\n qsort(1,tot);\n \n \/\/========================\n \/\/for (i=1;i<=tot;i++) printf(\"%d \",q[i]);printf(\"\\n\");\n e[0]=1;\n e[e[0]]=q[1];\n for (i=2;i<=tot;i++)\n\t if(e[e[0]]!=q[i])\n\t {\n\t\t e[0]++;\n\t\t e[e[0]]=q[i];\n\t }\n \/\/========================\n \/\/for (i=1;i<=e[0];i++) e[i]++;\n \/\/for (i=1;i<=e[0];i++) printf(\"%d \",e[i]);printf(\"\\n\");\n add(1,1);\n \/\/ printf(\"%d\\n\",m);\n \/\/ printf(\"%d\\n\",getsum(1));\n sort(1,m);\/\/\ufffd\ufffd\ufffd\ufffd\ufffd\u0575\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n \/\/ printf(\"ok\");\n \/\/ for (i=1;i<=m;i++) printf(\"%d %d\\n\" ,s[i],t[i]);\n for (i=1;i<=m;i++)\n {\n\t ss=serch(s[i]);\n\t \/\/ printf(\"%d ss:%d \",i,ss);\n\t tt=serch(t[i]);\n\t \/\/ printf(\"tt:%d \\n\",tt);\n\t F=0;\n\t if (ss>1 )S1=getsum(ss-1);else S1=0;\n\t S2=getsum(tt-1);\n\t F=((S2-S1)+mo)%mo;\n\t add(tt,F);\n }\n tt=serch(n);\n \/\/ printf(\"%d\\n\",tt);\n ans=(getsum(tt)-getsum(tt-1)+mo)%mo;\n printf(\"%d\",ans);\n return 0;\n\n}","testcases":"[{'input': '2 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 5\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 10\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n0 6\\r\\n0 7\\r\\n0 8\\r\\n0 9\\r\\n0 10\\r\\n', 'output': ['512\\r\\n']}, {'input': '6 6\\r\\n3 4\\r\\n2 3\\r\\n3 5\\r\\n0 1\\r\\n1 2\\r\\n3 6\\r\\n', 'output': ['4\\r\\n']}, {'input': '7 7\\r\\n0 1\\r\\n1 3\\r\\n2 3\\r\\n4 6\\r\\n5 7\\r\\n4 5\\r\\n5 7\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '8 8\\r\\n0 1\\r\\n4 5\\r\\n7 8\\r\\n3 4\\r\\n2 3\\r\\n6 7\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 1\\r\\n0 6\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 4\\r\\n0 3\\r\\n1 2\\r\\n4 5\\r\\n4 6\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n', 'output': ['360\\r\\n']}, {'input': '5 3\\r\\n0 1\\r\\n2 3\\r\\n4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n3 4\\r\\n4 5\\r\\n4 5\\r\\n', 'output': ['120\\r\\n']}, {'input': '8 94\\r\\n2 8\\r\\n3 8\\r\\n5 6\\r\\n1 2\\r\\n4 6\\r\\n2 7\\r\\n2 4\\r\\n3 5\\r\\n0 2\\r\\n0 1\\r\\n7 8\\r\\n0 7\\r\\n0 5\\r\\n1 4\\r\\n2 7\\r\\n3 4\\r\\n6 7\\r\\n1 5\\r\\n4 6\\r\\n4 6\\r\\n2 8\\r\\n4 5\\r\\n0 1\\r\\n3 8\\r\\n5 8\\r\\n1 3\\r\\n3 4\\r\\n1 6\\r\\n1 6\\r\\n1 7\\r\\n1 7\\r\\n1 4\\r\\n5 6\\r\\n5 7\\r\\n2 4\\r\\n3 8\\r\\n0 1\\r\\n0 4\\r\\n4 8\\r\\n1 8\\r\\n3 8\\r\\n2 4\\r\\n5 7\\r\\n2 4\\r\\n2 7\\r\\n3 8\\r\\n3 7\\r\\n0 6\\r\\n1 2\\r\\n0 2\\r\\n2 7\\r\\n0 4\\r\\n0 3\\r\\n3 6\\r\\n0 2\\r\\n5 7\\r\\n4 8\\r\\n3 6\\r\\n0 3\\r\\n3 5\\r\\n2 3\\r\\n1 8\\r\\n3 7\\r\\n0 6\\r\\n4 6\\r\\n1 8\\r\\n1 2\\r\\n3 5\\r\\n1 5\\r\\n1 2\\r\\n0 2\\r\\n0 3\\r\\n4 7\\r\\n1 4\\r\\n2 5\\r\\n5 8\\r\\n0 3\\r\\n5 7\\r\\n5 8\\r\\n0 2\\r\\n1 5\\r\\n4 6\\r\\n3 6\\r\\n5 6\\r\\n0 6\\r\\n1 7\\r\\n7 8\\r\\n2 7\\r\\n2 4\\r\\n1 7\\r\\n0 7\\r\\n1 6\\r\\n3 8\\r\\n0 7\\r\\n', 'output': ['203624961\\r\\n']}, {'input': '97 53\\r\\n21 34\\r\\n19 95\\r\\n0 6\\r\\n28 40\\r\\n26 41\\r\\n39 41\\r\\n47 85\\r\\n32 46\\r\\n2 17\\r\\n55 73\\r\\n18 67\\r\\n36 85\\r\\n77 96\\r\\n77 97\\r\\n1 53\\r\\n12 49\\r\\n9 71\\r\\n29 92\\r\\n35 89\\r\\n40 43\\r\\n5 78\\r\\n13 92\\r\\n2 97\\r\\n11 22\\r\\n4 6\\r\\n22 92\\r\\n60 87\\r\\n25 47\\r\\n10 59\\r\\n51 70\\r\\n13 95\\r\\n27 43\\r\\n5 71\\r\\n48 73\\r\\n82 94\\r\\n45 51\\r\\n85 97\\r\\n51 89\\r\\n15 66\\r\\n44 80\\r\\n78 93\\r\\n65 84\\r\\n9 75\\r\\n28 30\\r\\n39 69\\r\\n50 89\\r\\n41 77\\r\\n14 31\\r\\n12 97\\r\\n69 86\\r\\n15 18\\r\\n14 56\\r\\n38 47\\r\\n', 'output': ['478604297\\r\\n']}, {'input': '33 5\\r\\n17 18\\r\\n5 27\\r\\n18 29\\r\\n12 24\\r\\n14 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '93 69\\r\\n9 92\\r\\n31 37\\r\\n58 83\\r\\n28 93\\r\\n36 44\\r\\n22 90\\r\\n61 88\\r\\n76 83\\r\\n19 85\\r\\n25 87\\r\\n55 84\\r\\n45 47\\r\\n5 27\\r\\n54 82\\r\\n4 65\\r\\n12 81\\r\\n49 55\\r\\n16 52\\r\\n16 34\\r\\n34 44\\r\\n17 36\\r\\n62 64\\r\\n7 34\\r\\n19 21\\r\\n16 73\\r\\n3 55\\r\\n12 62\\r\\n49 91\\r\\n2 36\\r\\n47 65\\r\\n17 37\\r\\n70 80\\r\\n52 71\\r\\n59 77\\r\\n1 17\\r\\n23 81\\r\\n15 67\\r\\n38 67\\r\\n14 48\\r\\n70 82\\r\\n33 51\\r\\n31 88\\r\\n28 51\\r\\n10 54\\r\\n6 71\\r\\n37 88\\r\\n5 60\\r\\n2 91\\r\\n88 91\\r\\n30 91\\r\\n17 58\\r\\n12 72\\r\\n14 77\\r\\n34 90\\r\\n15 42\\r\\n44 47\\r\\n54 87\\r\\n84 90\\r\\n3 49\\r\\n26 71\\r\\n40 87\\r\\n71 74\\r\\n20 60\\r\\n86 92\\r\\n76 83\\r\\n40 80\\r\\n3 31\\r\\n18 33\\r\\n5 82\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 59\\r\\n4 7\\r\\n4 8\\r\\n0 4\\r\\n5 7\\r\\n6 9\\r\\n7 8\\r\\n0 9\\r\\n6 7\\r\\n4 9\\r\\n1 10\\r\\n5 6\\r\\n1 4\\r\\n0 4\\r\\n4 9\\r\\n3 6\\r\\n1 7\\r\\n4 9\\r\\n3 7\\r\\n1 2\\r\\n0 1\\r\\n4 7\\r\\n0 8\\r\\n8 10\\r\\n0 3\\r\\n2 5\\r\\n0 7\\r\\n1 8\\r\\n2 10\\r\\n0 3\\r\\n0 9\\r\\n7 8\\r\\n2 6\\r\\n1 6\\r\\n2 10\\r\\n3 10\\r\\n3 4\\r\\n0 2\\r\\n0 8\\r\\n3 8\\r\\n9 10\\r\\n1 6\\r\\n7 10\\r\\n6 9\\r\\n2 10\\r\\n2 10\\r\\n3 5\\r\\n9 10\\r\\n4 10\\r\\n0 8\\r\\n5 9\\r\\n4 6\\r\\n0 10\\r\\n6 9\\r\\n1 2\\r\\n6 7\\r\\n1 5\\r\\n0 6\\r\\n0 7\\r\\n0 6\\r\\n', 'output': ['28167561\\r\\n']}, {'input': '66 35\\r\\n49 55\\r\\n9 30\\r\\n28 54\\r\\n44 62\\r\\n55 61\\r\\n1 21\\r\\n6 37\\r\\n8 10\\r\\n26 33\\r\\n19 37\\r\\n12 23\\r\\n24 42\\r\\n34 64\\r\\n8 56\\r\\n36 40\\r\\n16 58\\r\\n21 30\\r\\n16 36\\r\\n36 38\\r\\n19 45\\r\\n26 49\\r\\n6 62\\r\\n1 11\\r\\n22 48\\r\\n33 38\\r\\n8 41\\r\\n29 53\\r\\n58 60\\r\\n27 66\\r\\n2 19\\r\\n48 53\\r\\n25 47\\r\\n48 56\\r\\n61 65\\r\\n45 46\\r\\n', 'output': ['0\\r\\n']}, {'input': '31 26\\r\\n15 21\\r\\n4 25\\r\\n5 19\\r\\n16 18\\r\\n5 23\\r\\n3 25\\r\\n7 18\\r\\n24 31\\r\\n6 9\\r\\n8 25\\r\\n18 29\\r\\n12 27\\r\\n15 16\\r\\n12 20\\r\\n2 7\\r\\n14 26\\r\\n13 22\\r\\n5 19\\r\\n5 24\\r\\n15 23\\r\\n4 7\\r\\n8 12\\r\\n14 26\\r\\n28 30\\r\\n1 30\\r\\n24 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '69 68\\r\\n49 62\\r\\n3 38\\r\\n1 43\\r\\n42 58\\r\\n12 64\\r\\n1 37\\r\\n35 59\\r\\n7 43\\r\\n2 29\\r\\n8 65\\r\\n19 47\\r\\n4 27\\r\\n41 58\\r\\n25 60\\r\\n17 37\\r\\n34 40\\r\\n16 38\\r\\n28 52\\r\\n35 63\\r\\n6 65\\r\\n57 58\\r\\n38 50\\r\\n8 28\\r\\n6 8\\r\\n10 44\\r\\n48 63\\r\\n2 42\\r\\n46 58\\r\\n26 62\\r\\n37 45\\r\\n7 22\\r\\n0 21\\r\\n19 48\\r\\n6 67\\r\\n6 15\\r\\n28 38\\r\\n19 22\\r\\n16 20\\r\\n27 40\\r\\n0 3\\r\\n33 69\\r\\n2 66\\r\\n10 24\\r\\n29 48\\r\\n26 69\\r\\n15 53\\r\\n24 34\\r\\n34 58\\r\\n20 47\\r\\n21 23\\r\\n38 68\\r\\n34 45\\r\\n60 68\\r\\n7 15\\r\\n21 34\\r\\n16 30\\r\\n14 58\\r\\n2 62\\r\\n24 66\\r\\n13 27\\r\\n24 40\\r\\n32 37\\r\\n10 37\\r\\n22 40\\r\\n44 50\\r\\n27 31\\r\\n0 44\\r\\n20 32\\r\\n', 'output': ['622740890\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '68 74\\r\\n51 54\\r\\n3 22\\r\\n12 24\\r\\n3 27\\r\\n32 42\\r\\n36 55\\r\\n60 64\\r\\n1 4\\r\\n4 23\\r\\n11 64\\r\\n54 62\\r\\n50 56\\r\\n21 34\\r\\n27 63\\r\\n15 54\\r\\n28 61\\r\\n13 57\\r\\n39 53\\r\\n12 32\\r\\n32 40\\r\\n33 67\\r\\n55 61\\r\\n33 67\\r\\n30 37\\r\\n15 49\\r\\n27 45\\r\\n21 41\\r\\n8 42\\r\\n24 63\\r\\n40 48\\r\\n28 41\\r\\n30 67\\r\\n0 4\\r\\n7 15\\r\\n27 59\\r\\n60 62\\r\\n25 65\\r\\n30 31\\r\\n38 67\\r\\n24 43\\r\\n14 64\\r\\n26 46\\r\\n8 12\\r\\n34 41\\r\\n32 67\\r\\n11 42\\r\\n11 53\\r\\n45 55\\r\\n2 47\\r\\n7 51\\r\\n30 54\\r\\n21 44\\r\\n7 52\\r\\n40 62\\r\\n16 50\\r\\n10 41\\r\\n26 65\\r\\n16 51\\r\\n6 29\\r\\n1 31\\r\\n48 54\\r\\n9 42\\r\\n33 45\\r\\n19 59\\r\\n25 37\\r\\n21 62\\r\\n20 58\\r\\n23 59\\r\\n12 61\\r\\n2 46\\r\\n19 49\\r\\n44 60\\r\\n1 20\\r\\n19 66\\r\\n', 'output': ['0\\r\\n']}, {'input': '79 68\\r\\n26 47\\r\\n55 70\\r\\n5 40\\r\\n7 45\\r\\n16 21\\r\\n31 38\\r\\n19 62\\r\\n40 55\\r\\n42 78\\r\\n60 61\\r\\n43 69\\r\\n50 73\\r\\n3 77\\r\\n2 45\\r\\n2 29\\r\\n10 58\\r\\n2 11\\r\\n62 76\\r\\n57 70\\r\\n65 73\\r\\n37 67\\r\\n9 24\\r\\n4 28\\r\\n8 16\\r\\n31 44\\r\\n10 66\\r\\n47 70\\r\\n19 45\\r\\n17 28\\r\\n5 36\\r\\n9 68\\r\\n2 35\\r\\n55 77\\r\\n51 71\\r\\n1 59\\r\\n6 33\\r\\n21 53\\r\\n39 49\\r\\n59 70\\r\\n17 44\\r\\n18 64\\r\\n49 78\\r\\n0 52\\r\\n24 56\\r\\n65 79\\r\\n19 51\\r\\n42 77\\r\\n37 78\\r\\n20 39\\r\\n47 56\\r\\n19 78\\r\\n50 78\\r\\n3 67\\r\\n37 47\\r\\n5 27\\r\\n40 51\\r\\n24 29\\r\\n50 54\\r\\n45 50\\r\\n13 76\\r\\n29 31\\r\\n0 28\\r\\n26 36\\r\\n21 44\\r\\n71 77\\r\\n55 58\\r\\n38 61\\r\\n22 44\\r\\n', 'output': ['317376853\\r\\n']}, {'input': '45 51\\r\\n2 12\\r\\n6 18\\r\\n4 17\\r\\n8 25\\r\\n16 24\\r\\n3 23\\r\\n29 31\\r\\n31 40\\r\\n7 26\\r\\n5 6\\r\\n35 37\\r\\n1 36\\r\\n9 45\\r\\n18 36\\r\\n12 27\\r\\n5 15\\r\\n11 16\\r\\n19 29\\r\\n8 23\\r\\n1 27\\r\\n0 30\\r\\n25 38\\r\\n21 44\\r\\n34 39\\r\\n10 41\\r\\n4 16\\r\\n11 36\\r\\n0 8\\r\\n15 38\\r\\n3 33\\r\\n11 31\\r\\n2 33\\r\\n5 34\\r\\n24 28\\r\\n7 32\\r\\n15 25\\r\\n2 27\\r\\n16 44\\r\\n31 40\\r\\n35 45\\r\\n13 38\\r\\n29 42\\r\\n18 23\\r\\n8 25\\r\\n13 21\\r\\n3 39\\r\\n3 41\\r\\n5 6\\r\\n13 21\\r\\n11 20\\r\\n23 42\\r\\n', 'output': ['493168232\\r\\n']}, {'input': '5 31\\r\\n0 2\\r\\n3 4\\r\\n3 5\\r\\n2 4\\r\\n1 3\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n0 2\\r\\n2 5\\r\\n1 4\\r\\n0 2\\r\\n1 3\\r\\n0 5\\r\\n2 3\\r\\n1 5\\r\\n1 2\\r\\n2 3\\r\\n0 1\\r\\n0 1\\r\\n2 4\\r\\n0 4\\r\\n1 2\\r\\n0 3\\r\\n1 2\\r\\n3 4\\r\\n0 2\\r\\n0 4\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n', 'output': ['8595\\r\\n']}, {'input': '81 52\\r\\n33 48\\r\\n59 61\\r\\n37 77\\r\\n58 73\\r\\n29 54\\r\\n1 17\\r\\n8 29\\r\\n50 73\\r\\n7 26\\r\\n35 41\\r\\n22 26\\r\\n9 22\\r\\n0 11\\r\\n40 73\\r\\n25 57\\r\\n35 55\\r\\n36 54\\r\\n29 41\\r\\n56 66\\r\\n42 77\\r\\n29 48\\r\\n41 66\\r\\n25 36\\r\\n2 55\\r\\n58 64\\r\\n0 61\\r\\n23 31\\r\\n9 61\\r\\n27 45\\r\\n2 71\\r\\n14 29\\r\\n4 31\\r\\n0 35\\r\\n31 77\\r\\n21 39\\r\\n0 54\\r\\n46 68\\r\\n18 62\\r\\n41 45\\r\\n12 28\\r\\n59 66\\r\\n39 71\\r\\n10 59\\r\\n29 77\\r\\n16 48\\r\\n13 46\\r\\n30 73\\r\\n2 41\\r\\n42 55\\r\\n19 61\\r\\n28 29\\r\\n20 42\\r\\n', 'output': ['0\\r\\n']}, {'input': '84 50\\r\\n33 46\\r\\n19 40\\r\\n51 64\\r\\n37 45\\r\\n35 81\\r\\n44 81\\r\\n6 57\\r\\n57 60\\r\\n14 53\\r\\n15 49\\r\\n4 30\\r\\n35 49\\r\\n2 51\\r\\n8 72\\r\\n15 18\\r\\n49 51\\r\\n14 49\\r\\n50 71\\r\\n41 59\\r\\n28 60\\r\\n61 81\\r\\n9 12\\r\\n34 79\\r\\n5 56\\r\\n60 67\\r\\n21 60\\r\\n39 71\\r\\n31 60\\r\\n13 35\\r\\n16 84\\r\\n17 33\\r\\n48 57\\r\\n36 61\\r\\n50 55\\r\\n5 84\\r\\n66 79\\r\\n61 70\\r\\n42 49\\r\\n19 39\\r\\n47 49\\r\\n3 82\\r\\n59 65\\r\\n8 44\\r\\n71 80\\r\\n66 77\\r\\n8 65\\r\\n1 81\\r\\n7 82\\r\\n50 74\\r\\n10 17\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 68\\r\\n77 89\\r\\n19 71\\r\\n11 46\\r\\n23 70\\r\\n16 47\\r\\n4 61\\r\\n7 96\\r\\n38 74\\r\\n79 95\\r\\n68 75\\r\\n14 86\\r\\n10 55\\r\\n7 13\\r\\n88 99\\r\\n19 21\\r\\n4 94\\r\\n17 83\\r\\n11 16\\r\\n7 50\\r\\n58 96\\r\\n4 58\\r\\n17 72\\r\\n44 56\\r\\n35 91\\r\\n50 88\\r\\n9 37\\r\\n36 52\\r\\n83 89\\r\\n8 16\\r\\n1 80\\r\\n12 75\\r\\n3 27\\r\\n92 93\\r\\n53 88\\r\\n37 49\\r\\n34 78\\r\\n31 66\\r\\n39 55\\r\\n36 94\\r\\n22 67\\r\\n47 85\\r\\n20 58\\r\\n62 98\\r\\n41 89\\r\\n85 96\\r\\n11 73\\r\\n39 95\\r\\n44 68\\r\\n25 33\\r\\n36 45\\r\\n66 70\\r\\n66 93\\r\\n17 97\\r\\n1 71\\r\\n49 53\\r\\n47 54\\r\\n19 95\\r\\n10 12\\r\\n38 57\\r\\n47 68\\r\\n21 70\\r\\n32 93\\r\\n53 71\\r\\n45 59\\r\\n27 48\\r\\n47 63\\r\\n75 76\\r\\n8 57\\r\\n', 'output': ['0\\r\\n']}, {'input': '918949684 6\\r\\n351553415 785588657\\r\\n423490842 845475457\\r\\n351553415 918949684\\r\\n740298829 785588657\\r\\n351328841 610486484\\r\\n423490842 847590951\\r\\n', 'output': ['0\\r\\n']}, {'input': '863261873 5\\r\\n137690029 666186924\\r\\n137690029 379800754\\r\\n515537329 666186924\\r\\n442925959 722302912\\r\\n137690029 863261873\\r\\n', 'output': ['0\\r\\n']}, {'input': '735324925 2\\r\\n642054038 735324925\\r\\n170935185 642054038\\r\\n', 'output': ['0\\r\\n']}, {'input': '977743286 6\\r\\n317778866 395496218\\r\\n395496218 932112884\\r\\n98371691 432544933\\r\\n440553 922085291\\r\\n440553 432544933\\r\\n586988624 922085291\\r\\n', 'output': ['0\\r\\n']}, {'input': '977700285 7\\r\\n386643627 467079072\\r\\n116215943 914856211\\r\\n15183537 386643627\\r\\n424146511 977700285\\r\\n15183537 620050423\\r\\n336304090 947990602\\r\\n116215943 914856211\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '814609521 3\\r\\n622460875 697824636\\r\\n283825432 369448402\\r\\n614658965 622460875\\r\\n', 'output': ['0\\r\\n']}, {'input': '931612300 8\\r\\n64655010 186892167\\r\\n25283092 580196656\\r\\n297609123 628681221\\r\\n25283092 186892167\\r\\n186892167 221075230\\r\\n221075230 634105512\\r\\n25283092 156293949\\r\\n86333513 156293949\\r\\n', 'output': ['0\\r\\n']}, {'input': '947714605 4\\r\\n23890708 35992029\\r\\n35992029 947714605\\r\\n93644635 629491402\\r\\n23890708 947714605\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 2\\r\\n0 500000000\\r\\n500000000 1000000000\\r\\n', 'output': ['1\\r\\n']}]","id":232} {"difficulty":2200,"lang":"GNU C","lang_cluster":"C","src_uid":"ce5cc8512359701696dba1b254c6afda","execute_outcome":"WRONG_ANSWER","source_code":"#include \n\n#define N\t19\n\nint bcnt(int x) {\n\treturn x == 0 ? 0 : bcnt(x & (x - 1)) + 1;\n}\n\nint main() {\n\tstatic int adj[N][N], dp[1 << N][N];\n\tint n, m, i_, h, i, j, v, cnt;\n\n\tscanf(\"%d%d\", &n, &m);\n\twhile (m-- > 0) {\n\t\tscanf(\"%d%d\", &i, &j);\n\t\ti--, j--;\n\t\tadj[i][j] = adj[j][i] = 1;\n\t}\n\tcnt = 0;\n\tfor (i_ = 0; i_ < n; i_++) {\n\t\tfor (v = 1 << (i_ + 1); v < 1 << n; v += 1 << (i_ + 1))\n\t\t\tfor (i = i_ + 1; i < n; i++)\n\t\t\t\tdp[v][i] = 0;\n\t\tfor (i = i_ + 1; i < n; i++)\n\t\t\tif (adj[i_][i])\n\t\t\t\tdp[1 << i][i] = 1;\n\t\tfor (h = 1; h <= n - i_ - 1; h++)\n\t\t\tfor (v = 1 << (i_ + 1); v < 1 << n; v += 1 << (i_ + 1))\n\t\t\t\tif (bcnt(v) == h)\n\t\t\t\t\tfor (i = i_ + 1; i < n; i++)\n\t\t\t\t\t\tfor (j = i_ + 1; j < n; j++)\n\t\t\t\t\t\t\tif ((v & 1 << j) == 0 && adj[i][j])\n\t\t\t\t\t\t\t\tdp[v | (1 << j)][j] += dp[v][i];\n\t\tfor (v = 1 << (i_ + 1); v < 1 << n; v += 1 << (i_ + 1))\n\t\t\tif (bcnt(v) > 1)\n\t\t\t\tfor (i = i_ + 1; i < n; i++)\n\t\t\t\t\tif ((v & 1 << i) > 0 && adj[i_][i])\n\t\t\t\t\t\tcnt += dp[v][i];\n\t}\n\tprintf(\"%d\\n\", cnt \/ 2);\n\treturn 0;\n}\n","description":"Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.","input_specification":"The first line of input contains two integers n and m (1\u2009\u2264\u2009n\u2009\u2264\u200919, 0\u2009\u2264\u2009m) \u2013 respectively the number of vertices and edges of the graph. Each of the subsequent m lines contains two integers a and b, (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n, a\u2009\u2260\u2009b) indicating that vertices a and b are connected by an undirected edge. There is no more than one edge connecting any pair of vertices.","output_specification":"Output the number of cycles in the given graph.","notes":"NoteThe example graph is a clique and contains four cycles of length 3 and three cycles of length 4.","sample_inputs":["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"],"sample_outputs":["7"],"human_solution":"#include \n#include \n\ntypedef long long ll;\n\nll dp[19][262144]; \/* at, mask *\/\nint g[32][32];\nint v,e;\nint bc[262144];\n\nvoid printmask(int mask) {\n int i;\n for(i=0;ifirst *\/\nll solve(int first,int at,int mask) {\n ll res=0;\n int i;\n if(dp[at][mask]>-1) return dp[at][mask];\n \/* can go back? only if cycle is of length >=3 *\/\n if(g[first][at] && bc[mask]>=2) res++;\n for(i=0;i>1]+(i&1);\n scanf(\"%d %d\",&v,&e);\n memset(g,0,sizeof(g));\n for(i=0;i\n#include \n#define QLEN 100007\nint n,m;\nint e[200010][2],v[200010],p[100010];\nint bgn[100010],len[100010],ban[100010],go[100010];\nint q[100010],dis[100010];\nshort vis[100010];\nvoid adde(int sn,int fn,int val,int id)\n{\n\te[id][0] = fn; e[id][1] = p[sn]; p[sn] = id; v[id] = val;\n}\nint calc(int sn,int tim)\n{\n\tint head = bgn[sn],tail = bgn[sn]+len[sn]-1,mid;\n\tif(!len[sn]) return tim;\n\twhile(head>1;\n\t\tif(ban[mid]>=tim) tail = mid;\n\t\telse head = mid+1;\n\t}\n\tif(ban[head] != tim) return tim;\n\telse return go[head];\n}\nvoid spfa()\n{\n\tint i,sn,fn,val;\n\tint head = 1,tail = 2;\n\tmemset(dis,60,sizeof(dis));\n\tq[1] = 1; dis[1] = 0; vis[1] = 1;\n\twhile(head != tail)\n\t{\n\t\tsn = q[head++];\n\t\tfor(i=p[sn];i;i=e[i][1])\n\t\t{\n\t\t\tfn = e[i][0];\n\t\t\tval = calc(sn,dis[sn])+v[i];\n\t\t\tif(dis[fn]<=val) continue;\n\t\t\tdis[fn] = val;\n\t\t\tif(vis[fn]) continue;\n\t\t\tvis[fn] = 1; q[tail++] = fn;\n\t\t\tif(tail>QLEN) tail = 1;\n\t\t}\n\t\tif(head>QLEN) head = 1;\n\t}\n}\nint main()\n{\n\tint i,j,sn,fn,val;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=m;i++)\n\t{\n\t\tscanf(\"%d%d%d\",&sn,&fn,&val);\n\t\tadde(sn,fn,val,i<<1);\n\t\tadde(fn,sn,val,i<<1|1);\n\t}\n\tbgn[0] = 1;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&len[i]);\n\t\tbgn[i] = bgn[i-1]+len[i-1];\n\t\tfor(j=bgn[i];j=bgn[i];j--) \n\t\t{\n\t\t\tif(ban[j] == ban[j+1]-1) go[j] = go[j+1];\n\t\t\telse go[j] = ban[j]+1;\n\t\t}\n\t}\n\tspfa();\n\tprintf(\"%d\",dis[n]\n#include \n#define QLEN 100007\nint n,m;\nint e[200010][2],v[200010],p[100010];\nint bgn[100010],len[100010],ban[100010],go[100010];\nint q[100010],dis[100010];\nshort vis[100010];\nvoid adde(int sn,int fn,int val,int id)\n{\n\te[id][0] = fn; e[id][1] = p[sn]; p[sn] = id; v[id] = val;\n}\nint calc(int sn,int tim)\n{\n\tint head = bgn[sn],tail = bgn[sn]+len[sn]-1,mid;\n\tif(!len[sn]) return tim;\n\twhile(head>1;\n\t\tif(ban[mid]>=tim) tail = mid;\n\t\telse head = mid+1;\n\t}\n\tif(ban[head] != tim) return tim;\n\telse return go[head];\n}\nvoid spfa()\n{\n\tint i,sn,fn,val;\n\tint head = 1,tail = 2;\n\tmemset(dis,60,sizeof(dis));\n\tq[1] = 1; dis[1] = 0; vis[1] = 1;\n\twhile(head != tail)\n\t{\n\t\tsn = q[head++];\n\t\tfor(i=p[sn];i;i=e[i][1])\n\t\t{\n\t\t\tfn = e[i][0];\n\t\t\tval = calc(sn,dis[sn])+v[i];\n\t\t\tif(dis[fn]<=val) continue;\n\t\t\tdis[fn] = val;\n\t\t\tif(vis[fn]) continue;\n\t\t\tvis[fn] = 1; q[tail++] = fn;\n\t\t\tif(tail>QLEN) tail = 1;\n\t\t}\n\t\tvis[sn] = 0;\n\t\tif(head>QLEN) head = 1;\n\t}\n}\nint main()\n{\n\tint i,j,sn,fn,val;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=m;i++)\n\t{\n\t\tscanf(\"%d%d%d\",&sn,&fn,&val);\n\t\tadde(sn,fn,val,i<<1);\n\t\tadde(fn,sn,val,i<<1|1);\n\t}\n\tbgn[0] = 1;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&len[i]);\n\t\tbgn[i] = bgn[i-1]+len[i-1];\n\t\tfor(j=bgn[i];j=bgn[i];j--) \n\t\t{\n\t\t\tif(ban[j] == ban[j+1]-1) go[j] = go[j+1];\n\t\t\telse go[j] = ban[j]+1;\n\t\t}\n\t}\n\tspfa();\n\tprintf(\"%d\",dis[n]\n\n#define M 1000000\n\ntypedef int bool;\n#define true 1\n#define false 0\n\nint n,k;\nchar str[M];\nint v[M];\n\nbool check(int d);\nint bs(int l,int r);\n\n\nint main(){\n scanf(\"%d %d\", &n, &k);\n char ch;\n for(int i=0;i= n - 1){\n break;\n }\n if(kk == k - 2){\n return false;\n }\n if(v[s + d + 1] <= s){\n return false;\n } else{\n s = v[s + d + 1];\n }\n kk++;\n }\n true;\n}\n\n\nint bs(int l,int r){\n while(l + 1 < r){\n int m = (l + r) \/ 2;\n if(check(m)){\n r = m;\n } else{\n l = m;\n }\n }\n if(check(l)){\n return l;\n } else{\n return r;\n }\n}","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"],"human_solution":"#include \n#define N 200005\n\nint n, k;\nchar a[N];\n\nint check(int x)\n{\n\tint last = 1, i, ok, cnt = k;\n\twhile (last + x < n)\n\t{\n\t\tok = 0;\n\t\tfor (i = last + x; i > last; --i)\n\t\t\tif (a[i] == '0')\n\t\t\t{\n\t\t\t\tlast = i;\n\t\t\t\tok = 1;\n\t\t\t\tif (--cnt < 0) ok = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (!ok) return 0;\n\t}\n\treturn 1;\n}\n\nint solve()\n{\n\tint l = 1, r = n - 1, mid;\n\tif (check(1)) return 1;\n\twhile (l + 1 < r)\n\t{\n\t\tmid = (l + r) >> 1;\n\t\tif (check(mid)) r = mid;\n\t\telse l = mid;\n\t}\n\treturn r;\n}\n\nint main()\n{\n\tscanf(\"%d%d%s\", &n, &k, a + 1);\n\tk -= 2;\n\tprintf(\"%d\\n\", solve() - 1);\n\treturn 0;\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":235} {"difficulty":2500,"lang":"GNU C","lang_cluster":"C","src_uid":"f6380129212b575b1a5e9861565a511a","execute_outcome":"WRONG_ANSWER","source_code":"#include \n#include \nint n,m,an = 0,am = 0,bn = 0,bm = 0;\nint sga[25][25][25][25],sgb[25][25][25][25];\nchar map[25][25];\nshort ga[25][25],gb[25][25];\nint max(int a,int b)\n{\n return a>b?a:b;\n}\nint worka(int i,int j,int ii,int jj)\n{\n int fi,fj;\n short v[700] = {0};\n \n if(i>ii||j>jj||i<=0||j<=0||ii<=0||jj<=0||i>an||j>am||ii>an||jj>am) return 0;\n if(sga[i][j][ii][jj]>=0) return sga[i][j][ii][jj];\n \n for(fi=i;fi<=ii;fi++) for(fj=j;fj<=jj;fj++)\n {\n if(ga[fi][fj] == 1)\n v[worka(i,j,ii,fj-1)^worka(i,fj+1,ii,jj)] = 1;\n else if(ga[fi][fj] == 2)\n v[worka(i,j,fi-1,jj)^worka(fi+1,j,ii,jj)] = 1;\n else if(ga[fi][fj] == 3)\n v[worka(i,j,fi-1,fj-1)^worka(i,fj+1,fi-1,jj)^worka(fi+1,j,ii,fj-1)^worka(fi+1,fj+1,ii,jj)] = 1;\n }\n for(fi=0;v[fi];fi++);\n return sga[i][j][ii][jj] = fi;\n}\nint workb(int i,int j,int ii,int jj)\n{\n int fi,fj;\n short v[700] = {0};\n \n if(i>ii||j>jj||i<=0||j<=0||ii<=0||jj<=0||i>bn||j>bm||ii>bn||jj>bm) return 0;\n if(sgb[i][j][ii][jj]>=0) return sgb[i][j][ii][jj];\n \n for(fi=i;fi<=ii;fi++) for(fj=j;fj<=jj;fj++)\n {\n if(gb[fi][fj] == 1)\n v[workb(i,j,ii,fj-1)^workb(i,fj+1,ii,jj)] = 1;\n else if(gb[fi][fj] == 2)\n v[workb(i,j,fi-1,jj)^workb(fi+1,j,ii,jj)] = 1;\n else if(gb[fi][fj] == 3)\n v[workb(i,j,fi-1,fj-1)^workb(i,fj+1,fi-1,jj)^workb(fi+1,j,ii,fj-1)^workb(fi+1,fj+1,ii,jj)] = 1;\n }\n for(fi=0;v[fi];fi++);\n return sgb[i][j][ii][jj] = fi;\n}\nint main()\n{\n int i,j,k,l,ii,jj,fi,fj,t1,t2;\n memset(sga,-1,sizeof(sga)); memset(sgb,-1,sizeof(sgb));\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++) scanf(\"%s\",map[i]+1);\n \n for(i=n;i;i--) for(j=1;j<=m;j++)\n {\n ii = (i+j-2)\/2+1;\n jj = ((j-i)-(1-n))\/2+1;\n if(((i+j)&1) == ((n+1)&1))\n {\n if(map[i][j] == 'L') ga[ii][jj] = 1;\n else if(map[i][j] == 'R') ga[ii][jj] = 2;\n else ga[ii][jj] = 3;\n an = max(an,ii); am = max(am,jj);\n }\n else\n {\n if(map[i][j] == 'L') gb[ii][jj] = 1;\n else if(map[i][j] == 'R') gb[ii][jj] = 2;\n else gb[ii][jj] = 3;\n bn = max(bn,ii); bm = max(bm,jj);\n }\n }\n if(worka(1,1,an,am)^workb(1,1,bn,bm)) printf(\"WIN\");\n else printf(\"LOSE\");\n \n return 0;\n}","description":"Recently Roma has become the happy owner of a new game World of Darkraft. This game combines elements of virtually all known genres, and on one of the later stages of the game Roma faced difficulties solving a puzzle.In this part Roma fights with a cunning enemy magician. The battle takes place on a rectangular field plaid n\u2009\u00d7\u2009m. Each cell contains one magical character: L, R or X. Initially all the squares of the field are \"active\".The players, Roma and enemy magician, take turns. Roma makes the first move. During a move a player selects one of the active cells. Then depending on the image in the character in the cell one of the following actions takes place: L \u2014 magical waves radiate from the cell to the left downwards and to the right upwards along diagonal paths. All cells on the path of the waves (including the selected cell too) become inactive. The waves continue until the next inactive cell or to the edge of the field if there are no inactive cells on the way. R \u2014 the magical waves radiate to the left upwards and to the right downwards. X \u2014 the magical waves radiate in all four diagonal directions. If the next player cannot make a move (i.e., all cells are inactive), he loses.Roma has been trying to defeat the computer opponent for three days but he just keeps losing. He asks you to help him and determine whether it is guaranteed that he can beat the opponent, or he will have to hack the game.","input_specification":"The first line contains two space-separated integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u200920). Next n lines contain m characters describing the playing field: the j-th character of the i-th line equals to the magical character of the corresponding field square.","output_specification":"On the first line print \"WIN\" if Roma can win or \"LOSE\" if it is impossible to win considering that the opponent pays optimally.","notes":"NoteIn the first test each move makes one diagonal line of the square inactive, thus it is guaranteed that Roma loses after two moves.There are three variants of making a move in the second test: to \"finish off\" the main diagonal line or any of the squares that are left. That means that after three moves the game stops and Roma wins.","sample_inputs":["2 2\nRL\nLR","2 2\nRR\nRR"],"sample_outputs":["LOSE","WIN"],"human_solution":"#include \n#include \n\nint n,m,sg[50][50][50][50][2];\nchar str[30],a[30][30];\nint dp(int l1,int l2,int r1,int r2,int o);\n\nint main(void)\n{\n \/\/freopen(\"darkraft.in\",\"r\",stdin);\n \/\/freopen(\"darkraft.out\",\"w\",stdout);\n scanf(\"%d%d\",&n,&m);\n int i,j;\n for(i=1;i<=n;i++)\n {\n scanf(\"%s\",str);\n for(j=1;j<=m;j++)\n a[i][j]=str[j-1];\n }\n memset(sg,-1,sizeof(sg));\n if(dp(0,n+m,0,n+m,0)^dp(0,n+m,0,n+m,1)) printf(\"WIN\\n\");\n else printf(\"LOSE\\n\");\n return 0;\n}\n\nint dp(int l1,int l2,int r1,int r2,int o)\n{\n if(sg[l1][l2][r1][r2][o]>=0) return sg[l1][l2][r1][r2][o];\n char f[410];\n memset(f,0,sizeof(f));\n int i,j;\n for(i=1;i<=n;i++)\n for(j=1;j<=m;j++)\n if(i+j-1>l1 && i+j-1r1 && i-j+m\n#include\n#include\n#include\n#include\n#include\n#include\n#define eps 1e-7\n#define MOD 1000000007\n#define ll long long int\n#define N 450000\nint que[N];\nint graph[1000][1000];\nint new_graph[1000][1000];\nint dist[N];\nint visited[N];\nint rear=-1;\nint front=-1;\nvoid insert_que(int x){\n que[++rear]=x;\n if(rear==0)\n front=0;\n}\nint pop_que(){\n return que[front++];\n}\nint is_empty(){\n return front>rear?1:0;\n}\nint solve(int x,int n){\n insert_que(x);\n visited[x]=1;\n while(!is_empty()){\n int get=pop_que();\n for(int i=1;i<=n;i++){\n if(!visited[i] && new_graph[get][i]){\n visited[i]=1;\n insert_que(i);\n }\n if(!visited[i] && new_graph[get][i]){\n dist[i]=dist[get]+1;\n }\n }\n }\n return dist[n]==0?-1:dist[n];\n}\nint solve1(int x,int n){\n insert_que(x);\n visited[x]=1;\n while(!is_empty()){\n int get=pop_que();\n for(int i=1;i<=n;i++){\n if(!visited[i] && graph[get][i]){\n visited[i]=1;\n insert_que(i);\n }\n if(!visited[i] && graph[get][i]){\n dist[i]=dist[get]+1;\n }\n }\n }\n return dist[n]==0?-1:dist[n];\n}\nint main(){\n int a,b,c,d;\n scanf(\"%d%d\",&a,&b);\n int flag=2;\n for(int i=0;ix1?printf(\"%d\",x):printf(\"%d\",x1);\n}","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"],"human_solution":"#include\ntypedef unsigned u;\nu A[444][444],B[444][444],(*C)[444],D[444],V[444];\nint main()\n{\n\tu i,j,k,n,q;\n\tscanf(\"%u%u\",&n,&q);\n\tfor(i=0;++i<=n;D[i]=-1)for(j=0;++j<=n;)A[i][j]=1;\n\twhile(q--)\n\t{\n\t\tscanf(\"%u%u\",&i,&j);\n\t\tA[i][j]=A[j][i]=0;\n\t\tB[i][j]=B[j][i]=1;\n\t}\n\tif(A[1][n])C=B;\n\tif(B[1][n])C=A;\n\tD[1]=0;\n\twhile(1)\n\t{\n\t\tfor(i=0,j=k=-1;++i<=n;)if(!V[i]&&D[i]D[k]+1)D[i]=D[k]+1;\n\t}\n\tprintf(\"%i\\n\",D[n]);\n\treturn 0;\n}\n","testcases":"[{'input': '4 2\\r\\n1 3\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 5\\r\\n4 2\\r\\n3 5\\r\\n4 5\\r\\n5 1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 4\\r\\n1 2\\r\\n3 2\\r\\n3 4\\r\\n5 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '20 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '381 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 1\\r\\n1 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 5\\r\\n1 3\\r\\n2 1\\r\\n3 4\\r\\n4 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '20 1\\r\\n20 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '21 1\\r\\n21 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\n100 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '400 1\\r\\n1 400\\r\\n', 'output': ['2\\r\\n']}, {'input': '5 5\\r\\n2 5\\r\\n1 2\\r\\n1 4\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['2\\r\\n']}]","id":237} {"difficulty":1600,"lang":"GNU C","lang_cluster":"C","src_uid":"ffafd385ec79aa28b8d30224baf6bcfe","execute_outcome":"WRONG_ANSWER","source_code":"#include \n\nint main()\n{\n int n, m, h, sum = 0, i;\n int s[1000];\n double d = 1;\n\n scanf(\"%d %d %d\", &n, &m, &h);\n\n for (i = 0; i < m; i++) {\n\t scanf(\"%d\", &s[i]);\n\n\t sum += s[i];\n }\n\n if (sum < n || s[h - 1] == 1) {\n\t puts(\"-1.0\\n\");\n\n\t return 0;\n }\n\n if (sum - s[h - 1] < n - 1) {\n\t puts(\"1.0\\n\");\n\n\t return 0;\n }\n\n for (i = 0; i < n - 1; i++) {\n\t d *= (double)(sum - s[h - 1] - i) \/ (sum - i - 1);\n }\n\n printf(\"%.9lf\\n\", 1 - d);\n\n return 0;\n}\n","description":"As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of n players, all of which are GUC students. However, the team might have players belonging to different departments. There are m departments in GUC, numbered from 1 to m. Herr Wafa's department has number h. For each department i, Herr Wafa knows number si \u2014 how many students who play basketball belong to this department.Herr Wafa was also able to guarantee a spot on the team, using his special powers. But since he hates floating-point numbers, he needs your help at finding the probability that he will have at least one teammate belonging to his department. Note that every possible team containing Herr Wafa is equally probable. Consider all the students different from each other.","input_specification":"The first line contains three integers n, m and h (1\u2009\u2264\u2009n\u2009\u2264\u2009100,\u20091\u2009\u2264\u2009m\u2009\u2264\u20091000,\u20091\u2009\u2264\u2009h\u2009\u2264\u2009m) \u2014 the number of players on the team, the number of departments in GUC and Herr Wafa's department, correspondingly. The second line contains a single-space-separated list of m integers si (1\u2009\u2264\u2009si\u2009\u2264\u2009100), denoting the number of students in the i-th department. Note that sh includes Herr Wafa.","output_specification":"Print the probability that Herr Wafa will have at least one teammate from his department. If there is not enough basketball players in GUC to participate in ABC, print -1. The answer will be accepted if it has absolute or relative error not exceeding 10\u2009-\u20096.","notes":"NoteIn the first example all 3 players (2 from department 1 and 1 from department 2) must be chosen for the team. Both players from Wafa's departments will be chosen, so he's guaranteed to have a teammate from his department.In the second example, there are not enough players.In the third example, there are three possibilities to compose the team containing Herr Wafa. In two of them the other player from Herr Wafa's department is part of the team.","sample_inputs":["3 2 1\n2 1","3 2 1\n1 1","3 2 1\n2 2"],"sample_outputs":["1","-1","0.666667"],"human_solution":"#include\nint main()\n{\n\tint j,i,n,m,h,temp,a,b,ans1,ans2;\n\tdouble ans;\n\tscanf(\"%d%d%d\",&n,&m,&h);\n\tb=0;\n\tfor(i=1;i<=m;i++)\n\t{\n\t\tscanf(\"%d\",&temp);\n\t\tif(i==h)\n\t\t\ta=temp-1;\n\t\telse\n\t\t\tb+=temp;\n\t}\n\tans=1;\n\tn--;\n\t\/*for(i=1,j=a;i<=a;i++,j--)\n\t{\n\t\tif(ia-n)\n\t\t\tans\/=(long double)(b+j);\n\t}*\/\n\tfor(i=0;i r = new Dictionary();\n foreach (var it in A)\n {\n foreach (var t in B)\n {\n if (t != it)\n {\n if (t % it == 0)\n {\n var d = t \/ it;\n if (!r.ContainsKey(d)) r[d] = 0;\n r[d]++;\n }\n }\n }\n }\n Console.WriteLine(r[r.Max(x=>x.Key)]);\n }\n\n static IEnumerable ReadInts(Func f = null) \n {\n var t = Console.ReadLine();\n var ret = new List();\n foreach (var it in t.Split(' '))\n ret.Add( f == null ? int.Parse(it): f(int.Parse(it)));\n return ret;\n }\n }\n}\n","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"],"human_solution":"using System;\nusing System.Linq;\nnamespace codeforces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n= int.Parse(Console.ReadLine());\n int[] a= Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int m = int.Parse(Console.ReadLine());\n int[] b= Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();\n int count = 0;\n int max = 0;\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++)\n {\n if (b[j]%a[i]==0)\n {\n int rez = b[j] \/ a[i];\n if (rez>max)\n {\n max = rez;\n count=1;\n }\n else if (rez==max)\n {\n count++;\n }\n }\n }\n }\n Console.WriteLine(count) ;\n }\n }\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":239} {"difficulty":1400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"138fd96bf5a677a6d59c20f88fd612f1","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n long n, x, y;\n string s = Console.ReadLine();\n char[] par = { ' ' };\n string[] ss = s.Split(par);\n n = Convert.ToInt64(ss[0]);\n x = Convert.ToInt64(ss[1]);\n y = Convert.ToInt64(ss[2]);\n\n if (n > y)\n {\n Console.WriteLine(-1);\n }\n else\n {\n if ((y - n + 1) * (y - n + 1) >= x)\n {\n for (int i = 0; i < n - 1; i++)\n Console.WriteLine(\"1\");\n Console.WriteLine(y - n + 1);\n }\n else Console.WriteLine(-1);\n }\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.IO;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic partial class codeforces85C\n{\n public static void C()\n {\n int i;\n string[] given = Console.ReadLine().Split(' ');\n int n = int.Parse(given[0]);\n long x = long.Parse(given[1]);\n int y = int.Parse(given[2]);\n\n if(y time || timeMin == time && distMin > dist)\n {\n timeMin = time;\n distMin = dist;\n optIndex = i;\n }\n }\n Console.WriteLine(optIndex+1);\n }\n }\n}\n","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"],"human_solution":"\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round9\n{\n class C\n {\n public static void Main()\n {\n string[] s = Console.ReadLine().Split(' ');\n int n = int.Parse(s[0]);\n double vb = double.Parse(s[1]);\n double vs = double.Parse(s[2]);\n\n s = Console.ReadLine().Split(' ');\n double[] busStopX = new double[n];\n for (int i = 0; i < n; i++)\n {\n busStopX[i] = double.Parse(s[i]);\n }\n\n s = Console.ReadLine().Split(' ');\n double xu, yu;\n xu = double.Parse(s[0]);\n yu = double.Parse(s[1]);\n\n int optIndex = -1;\n double timeMin = double.MaxValue;\n double distMin = double.MaxValue;\n for (int i = 1; i < n; i++)\n {\n double dx = xu - busStopX[i];\n double dy = yu;\n double dist = Math.Sqrt(dx * dx + dy * dy);\n double time = busStopX[i] \/ vb + dist \/ vs;\n \/\/Console.WriteLine(\"{0}, {1}\", dist, time);\n if (timeMin > time || timeMin == time && distMin > dist)\n {\n timeMin = time;\n distMin = dist;\n optIndex = i;\n }\n }\n Console.WriteLine(optIndex+1);\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":241} {"difficulty":1200,"lang":"MS C#","lang_cluster":"C#","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"RUNTIME_ERROR","source_code":"using System; using System.Linq;\n\nclass P {\n static void Main() {\n Console.ReadLine();\n var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n var left = 0;\n var props = new int[p.Length];\n foreach (var ai in a) {\n left += ai;\n for (var j = p.Length - 1; j >= 0 ; j--) if (p[j] <= left) {\n props[j]++;\n left -= p[j];\n j++;\n }\n }\n Console.WriteLine(string.Join(\" \", props));\n Console.Write(left);\n }\n}","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication10\n{\n class Program\n {\n \/*static long ch (long x)\n {\n if (x > 0)\n return ;\n else\n return ;\n }*\/\n static void Main(string[] args)\n {\n long n = Convert.ToInt64(Console.ReadLine());\n string s = Console.ReadLine();\n string[] p = s.Split(' ');\n s = Console.ReadLine();\n string[] pr = s.Split(' ');\n long bal = 0;\n long a = Convert.ToInt64(pr[0]);\n long b = Convert.ToInt64(pr[1]);\n long c = Convert.ToInt64(pr[2]);\n long d = Convert.ToInt64(pr[3]);\n long e = Convert.ToInt64(pr[4]);\n long a1 = 0;\n long b1 = 0;\n long c1 = 0;\n long d1 = 0;\n long e1 = 0;\n for (int i = 1; i <= n; i++)\n {\n bal = bal + Convert.ToInt64(p[i - 1]);\n e1 = e1 + bal \/ e;\n bal = bal % e;\n d1 = d1 + bal \/ d;\n bal = bal % d;\n c1 = c1 + bal \/ c;\n bal = bal % c;\n b1 = b1 + bal \/ b;\n bal = bal % b;\n a1 = a1 + bal \/ a;\n bal = bal % a;\n \n }\n Console.WriteLine(a1+\" \"+b1+\" \"+c1+\" \"+d1+\" \"+e1);\n Console.WriteLine(bal);\n\n }\n }\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":242} {"difficulty":1200,"lang":"MS C#","lang_cluster":"C#","src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","execute_outcome":"WRONG_ANSWER","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf\n{\n class Program\n {\n\n static void Main(string[] args)\n {\n try\n {\n int[] nk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int[] ar = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n int c = 0;\n while (ar[0] != nk[1])\n {\n bool x = false;\n for (int i = 0; i < ar.Length - 1; i++)\n {\n if (ar[i] != ar[i + 1])\n {\n if (ar[i] != nk[1])\n {\n ar[i]++;\n x = true;\n }\n }\n else if (i == ar.Length - 2)\n {\n if (ar[i] == ar[i + 1])\n {\n if (ar[i] != nk[1])\n {\n ar[i+1]++;\n x = true;\n }\n else\n {\n if (ar[i] != nk[1])\n {\n ar[i]++;\n x = true;\n }\n if (ar[i + 1] != nk[1])\n {\n ar[i + 1]++;\n x = true;\n }\n }\n }\n }\n }\n if (x)\n c++;\n \/\/for (int j = 0; j < ar.Length; j++)\n \/\/{\n \/\/ Console.Write(ar[j] + \" \");\n \/\/}\n \/\/Console.WriteLine();\n }\n Console.WriteLine(c-1);\n Console.ReadKey();\n\n }\n catch { }\n }\n \n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round59\n{\n class B\n {\n public static void Main()\n {\n int[] nk = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int n = nk[0], k = nk[1];\n int[] sol = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));\n int res = 0;\n for (; ; res++)\n {\n bool updated = false;\n for (int i = 0; i < sol.Length && sol[i] < k; i++)\n {\n if (i == sol.Length - 1 || sol[i] != sol[i + 1])\n {\n sol[i]++;\n updated = true;\n }\n }\n if (!updated)\n break;\n }\n Console.WriteLine(res);\n }\n }\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":243} {"difficulty":1500,"lang":"Mono C#","lang_cluster":"C#","src_uid":"4ecbfc792da55f458342c6eff2d5da5a","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static List roots = new List(); \n static bool[,] graph;\n static bool[,] graph2;\n static bool[] used;\n static int n;\n static int count;\n static int cycleCount = 0;\n\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n n = int.Parse(str[0]);\n int m = int.Parse(str[1]);\n used = new bool[n];\n graph = new bool[n, n];\n graph2 = new bool[n, n];\n int a;\n int b;\n\n for (int i = 0; i < m; i++)\n {\n str = Console.ReadLine().Split(' ');\n a = int.Parse(str[0]) - 1;\n b = int.Parse(str[1]) - 1;\n graph[a, b] = true;\n graph[b, a] = true;\n }\n\n Solve();\n\n if (cycleCount == 1 && count == 1)\n {\n Console.WriteLine(\"FNTAGN!\");\n } else\n {\n Console.WriteLine(\"NO\");\n }\n }\n\n static void Solve()\n {\n used = new bool [n];\n count = 0;\n\n for (int i = 0; i < n; i++)\n {\n if (!used[i])\n {\n count++;\n DFS(i);\n }\n }\n }\n\n static void DFS(int v) \n {\n used[v] = true;\n for (int j = 0; j < n; j++)\n {\n if (j != v && used[j] && graph[v, j] && !graph2[v,j])\n {\n cycleCount++;\n }\n graph2[v, j] = true;\n graph2[j, v] = true;\n if (!used[j] && graph[v,j])\n {\n DFS(j);\n }\n }\n }\n }\n}","description":"...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...Whereas on the other end of the world Pentagon is actively collecting information trying to predict the monster's behavior and preparing the secret super weapon. Due to high seismic activity and poor weather conditions the satellites haven't yet been able to make clear shots of the monster. The analysis of the first shot resulted in an undirected graph with n vertices and m edges. Now the world's best minds are about to determine whether this graph can be regarded as Cthulhu or not.To add simplicity, let's suppose that Cthulhu looks from the space like some spherical body with tentacles attached to it. Formally, we shall regard as Cthulhu such an undirected graph that can be represented as a set of three or more rooted trees, whose roots are connected by a simple cycle.It is guaranteed that the graph contains no multiple edges and self-loops. ","input_specification":"The first line contains two integers \u2014 the number of vertices n and the number of edges m of the graph (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 0\u2009\u2264\u2009m\u2009\u2264\u2009). Each of the following m lines contains a pair of integers x and y, that show that an edge exists between vertices x and y (1\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009n,\u2009x\u2009\u2260\u2009y). For each pair of vertices there will be at most one edge between them, no edge connects a vertex to itself.","output_specification":"Print \"NO\", if the graph is not Cthulhu and \"FHTAGN!\" if it is.","notes":"NoteLet us denote as a simple cycle a set of v vertices that can be numbered so that the edges will only exist between vertices number 1 and 2, 2 and 3, ..., v\u2009-\u20091 and v, v and 1.A tree is a connected undirected graph consisting of n vertices and n\u2009-\u20091 edges (n\u2009>\u20090).A rooted tree is a tree where one vertex is selected to be the root.","sample_inputs":["6 6\n6 3\n6 4\n5 1\n2 5\n1 4\n5 4","6 5\n5 6\n4 6\n3 1\n5 1\n1 2"],"sample_outputs":["FHTAGN!","NO"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round80\n{\n class B\n {\n static int[] ReadInts() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }\n\n static bool[] used;\n static List[] e;\n static Stack vis = new Stack();\n static HashSet roots = new HashSet();\n static bool find;\n static int count = 0;\n\n static int edge(int u, int v) { return Math.Max(u, v) * 1000 + Math.Min(u, v); }\n\n static bool dfs(int idx)\n {\n int prev = vis.Any() ? vis.Peek() : -1;\n used[idx] = true;\n count++;\n vis.Push(idx);\n \/\/Console.Write(\"edge: {0}:\", idx + 1);\n \/\/foreach (int i in e[idx]) Console.Write(\" {0}\", i + 1);\n \/\/Console.WriteLine();\n foreach (int i in e[idx])\n {\n \/\/Console.WriteLine(\"checked: {0} -> {1}\", idx+1, i+1);\n if (!used[i])\n {\n if (!dfs(i))\n return false;\n }\n else if (prev != i)\n {\n \/\/Console.WriteLine(\"prev: {0} != {1}\", prev+ 1, i + 1);\n if (find)\n {\n \/\/Console.WriteLine(\"infind: {0}\", roots.Contains(edge(idx, i)));\n if (!roots.Contains(edge(idx, i)))\n return false;\n continue;\n }\n find = true;\n List xs = new List();\n foreach (var v in vis)\n {\n xs.Add(v);\n if (v == i)\n break;\n }\n for (int j = 0; j < xs.Count; j++)\n {\n \/\/Console.WriteLine(\"check: {0} {1}\", xs[j], xs[j+1]);\n roots.Add(edge(xs[j], xs[(j + 1) % xs.Count]));\n }\n }\n }\n vis.Pop();\n return true;\n }\n\n static void Main()\n {\n var xs = ReadInts();\n int n = xs[0],\n m = xs[1];\n\n used = new bool[n];\n e = new List[n];\n for (int i = 0; i < n; i++)\n e[i] = new List();\n\n for (int i = 0; i < m; i++)\n {\n xs = ReadInts();\n for (int j = 0; j < 2; j++)\n e[xs[j] - 1].Add(xs[j ^ 1] - 1);\n }\n\n Console.WriteLine(dfs(0) && find && count==n ? \"FHTAGN!\" : \"NO\");\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":244} {"difficulty":1100,"lang":"MS C#","lang_cluster":"C#","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s = Console.ReadLine();\n s = Console.ReadLine();\n int l = -1, r = -1, k = 0;\n for (int i = 0; i < s.Length; i++)\n {\n\n if (s[i] == 'L')\n {\n l = i;\n if(r!=-1 && (i - r )% 2 == 0 ){k++; }\n }\n else if (s[i] == 'R')\n {\n if (r == -1 && l==-1) { k += i; }\n r = i;\n if (l!=-1 &&(i - l )% 2 == 0){k++; }\n }\n\n }\n if (l>r) k += s.Length-l-1;\n if (l == -1 && r == -1) k = s.Length;\n\n Console.WriteLine(k);\n\n }\n }\n}","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n string s = Console.ReadLine();\n int sum = 0, count = 0;\n bool r = false;\n for (int i = 0; i < n; i++)\n {\n if (s[i] == '.')\n {\n count++;\n }\n else\n {\n if (s[i] == 'L')\n {\n if (r)\n {\n if (count % 2 > 0)\n {\n sum++;\n }\n }\n r = false;\n }\n else\n {\n if (!r)\n {\n sum += count;\n }\n r = true;\n }\n count = 0;\n } \n }\n if (!r)\n {\n sum += count;\n }\n Console.Write(sum);\n }\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":245} {"difficulty":1100,"lang":"MS C#","lang_cluster":"C#","src_uid":"5d11fa8528f1dc873d50b3417bef8c79","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing static System.Console;\n\nnamespace _66B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = default(int);\n int covered = default(int), maxCovered = default(int);\n n = Int32.Parse(ReadLine());\n int[] fields = new int[n];\n string input = ReadLine();\n for(int i= 0; i < n; i++)\n {\n fields[i] = Int32.Parse(input.Split(' ')[i]);\n }\n\n for(int CurrentField = 0; CurrentField < fields.Length; CurrentField++)\n {\n covered = 1;\n for(int left = CurrentField -1; (left >= 0)&&(fields[left] < fields[left +1]); left--)\n {\n covered++;\n }\n for(int right = CurrentField +1; (right < fields.Length)&&(fields[right] < fields[right-1]); right++)\n {\n covered++;\n }\n if(covered > maxCovered)\n {\n maxCovered = covered;\n } \n }\n Write(maxCovered);\n }\n }\n}\n","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"],"human_solution":"using System;\npublic class Program\n {\n public static void Main(string[] args)\n {\n int[] data;\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\r', '\\t', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n data = new int[input.Length];\n for (int i = 1; i < input.Length; ++i)\n data[i] = int.Parse(input[i]);\n }\n int maximum = 1;\n for (int i = 2, cntr = 1, mntn=1; i < data.Length; cntr = mntn)\n {\n while(i=data[i-1])\n {\n cntr++; i++;\n }\n while(i maximum) maximum = cntr;\n }\n Console.WriteLine(maximum);\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":246} {"difficulty":1500,"lang":"MS C#","lang_cluster":"C#","src_uid":"5e055bad1da5bdc84599d6f2f89fbd12","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Collections;\nusing System.Linq;\nusing System.Numerics;\n\n\n\n\nnamespace contest\n{\n\n class contest\n {\n\n\n static void Main(string[] args)\n {\n\n\n \/\/int n = int.Parse(Console.ReadLine());\n \/\/var input = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n \/\/var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n\n \/\/int n = int.Parse(Console.ReadLine());\n \/\/var num = Console.ReadLine().Split().Select(int.Parse).ToArray();\n\n\n var n = int.Parse(Console.ReadLine());\n var input = new int[n][];\n\n var front = new Dictionary();\n var back = new Dictionary();\n var memo = new Dictionary, int>();\n for(int i =0; i< n; i++)\n {\n input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int l = input[i][0];\n int r = input[i][1];\n\n if (!front.Keys.Contains(l)) front[l] = 1;\n else front[l]++;\n\n if (!back.Keys.Contains(r)) back[r] = 1;\n else back[r]++;\n\n if (!memo.Keys.Contains(Tuple.Create(l,r))) memo[Tuple.Create(l,r)]=1;\n else memo[Tuple.Create(l, r)]++;\n\n }\n\n int num = n \/ 2 + n % 2;\n int turn = int.MaxValue;\n \n foreach(var item in front)\n {\n if (item.Value >= num)\n {\n turn = 0;\n break;\n }\n else if(back.Keys.Contains(item.Key))\n {\n int tmp = 0;\n if(memo.Keys.Contains(Tuple.Create(item.Key, item.Key)))\n {\n tmp = memo[Tuple.Create(item.Key, item.Key)];\n }\n\n if(item.Value + back[item.Key]-tmp >= num)\n {\n turn = Math.Min(turn , num - item.Value);\n }\n \n }\n }\n\n foreach (var item in back)\n {\n if (item.Value >= num)\n {\n turn = Math.Min(turn, item.Value);\n \n }\n\n if (front.Keys.Contains(item.Key))\n {\n int tmp = 0;\n if (memo.Keys.Contains(Tuple.Create(item.Key, item.Key)))\n {\n tmp = memo[Tuple.Create(item.Key, item.Key)];\n }\n\n if (item.Value + front[item.Key] - tmp >= num)\n {\n turn = Math.Min(turn, item.Value-tmp);\n }\n\n }\n }\n\n\n if (turn == int.MaxValue) turn = -1;\n \n Console.WriteLine(turn);\n \n\n\n\n }\n\n \n\n }\n\n\n \n \n}\n","description":"The Little Elephant loves to play with color cards.He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. The Little Elephant thinks that a set of cards on the table is funny if at least half of the cards have the same color (for each card the color of the upper side is considered).Help the Little Elephant to find the minimum number of moves needed to make the set of n cards funny.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of the cards. The following n lines contain the description of all cards, one card per line. The cards are described by a pair of positive integers not exceeding 109 \u2014 colors of both sides. The first number in a line is the color of the front of the card, the second one \u2014 of the back. The color of the front of the card may coincide with the color of the back of the card. The numbers in the lines are separated by single spaces.","output_specification":"On a single line print a single integer \u2014 the sought minimum number of moves. If it is impossible to make the set funny, print -1.","notes":"NoteIn the first sample there initially are three cards lying with colors 4, 4, 7. Since two of the three cards are of the same color 4, you do not need to change anything, so the answer is 0.In the second sample, you can turn the first and the fourth cards. After that three of the five cards will be of color 7.","sample_inputs":["3\n4 7\n4 7\n7 4","5\n4 7\n7 4\n2 11\n9 7\n1 1"],"sample_outputs":["0","2"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing static System.Math;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.ReadInt();\n var a = new Dictionary();\n var b = new Dictionary();\n for (int i = 0; i < n; i++)\n {\n int c1 = input.ReadInt();\n int c2 = input.ReadInt();\n AddCount(a, c1);\n if (c1 != c2)\n AddCount(b, c2);\n }\n int m = (n + 1) \/ 2;\n int ans = n;\n foreach (var c in a.Keys.Concat(b.Keys).Distinct())\n {\n int x = GetCount(a, c);\n int y = GetCount(b, c);\n if (x + y < m)\n continue;\n ans = Min(ans, Max(0, m - x));\n }\n Console.Write(ans == n ? -1 : ans);\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n\n #region Service functions\n\n private static void AddCount(Dictionary counter, T item)\n {\n int count;\n if (counter.TryGetValue(item, out count))\n counter[item] = count + 1;\n else\n counter.Add(item, 1);\n }\n\n private static int GetCount(Dictionary counter, T item)\n {\n int count;\n return counter.TryGetValue(item, out count) ? count : 0;\n }\n\n private static int GCD(int a, int b)\n {\n while (b != 0)\n {\n a %= b;\n int t = b;\n b = a;\n a = t;\n }\n return a;\n }\n\n #endregion\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int ReadInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long ReadLong()\n {\n return long.Parse(this.ReadToken());\n }\n\n public double ReadDouble()\n {\n return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadInt();\n return a;\n }\n\n public long[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = ReadDouble();\n return a;\n }\n\n public string ReadToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\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":247} {"difficulty":1100,"lang":"Mono C#","lang_cluster":"C#","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Globalization;\nnamespace eolimp\n{\n class Program\n {\n public static void Main (string[] args)\n {\t\n\t\t\tSystem.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(\"en-US\");\n\t\t\tstring []s = Console.ReadLine().Split(' ');\n\t\t\t\n\t\t\tint n = int.Parse(s[0]), b = int.Parse(s[1]),m=0;\n\t\t\ts = Console.ReadLine().Split(' ');\n\t\t\tint [] a = new int [n];\n\t\t\tdouble [] c = new double [n];\n\t\t\tfor(int i=0;i toDivide)\n possible = false;\n j++;\n }\n\n CultureInfo en = new CultureInfo(\"en-US\", false);\n \n\n if (possible == false)\n Console.WriteLine(\"-1\");\n else\n for (int i = 0; i < aArr.Length; i++ )\n {\n aArr[i] = Convert.ToString(toDivide - decimal.Parse(aArr[i]));\n Console.WriteLine((String.Format(\"{0:0.000000}\", decimal.Parse(aArr[i]), 6)).Replace(\",\", \".\"));\n \n }\n \n \n\n }\n }\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":248} {"difficulty":800,"lang":"MS C#","lang_cluster":"C#","src_uid":"69850c2af99d60711bcff5870575e15e","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _38A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n\n string[] d = Console.ReadLine().Split();\n string[] str = Console.ReadLine().Split();\n\n int a = Convert.ToInt32(str[0]);\n int b = Convert.ToInt32(str[1]);\n\n int total = 0;\n\n for (int i = a; i <= b; ++i)\n {\n total += Convert.ToInt32(d[i - 1]);\n }\n\n Console.WriteLine(total);\n }\n }\n}\n","description":"The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i\u2009+\u20091. Reaching a certain rank i having not reached all the previous i\u2009-\u20091 ranks is impossible.Vasya has just reached a new rank of a, but he dreams of holding the rank of b. Find for how many more years Vasya should serve in the army until he can finally realize his dream.","input_specification":"The first input line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100). The second line contains n\u2009-\u20091 integers di (1\u2009\u2264\u2009di\u2009\u2264\u2009100). The third input line contains two integers a and b (1\u2009\u2264\u2009a\u2009<\u2009b\u2009\u2264\u2009n). The numbers on the lines are space-separated.","output_specification":"Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.","notes":null,"sample_inputs":["3\n5 6\n1 2","3\n5 6\n1 3"],"sample_outputs":["5","11"],"human_solution":"using System;\n class Program\n {\n public static void Main(string[] args)\n {\n string[] input = Console.In.ReadToEnd().Split(new char[] { ' ', '\\r', '\\t', '\\n' }, StringSplitOptions.RemoveEmptyEntries);\n int sum = 0;\n for (int a = int.Parse(input[input.Length - 2]), b = int.Parse(input[input.Length - 1]); a < b; ++a)\n sum += int.Parse(input[a]);\n Console.WriteLine(sum);\n }\n }","testcases":"[{'input': '3\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '3\\r\\n5 6\\r\\n1 3\\r\\n', 'output': ['11\\r\\n']}, {'input': '2\\r\\n55\\r\\n1 2\\r\\n', 'output': ['55\\r\\n']}, {'input': '3\\r\\n85 78\\r\\n1 3\\r\\n', 'output': ['163\\r\\n']}, {'input': '4\\r\\n63 4 49\\r\\n2 3\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n93 83 42 56\\r\\n2 5\\r\\n', 'output': ['181\\r\\n']}, {'input': '6\\r\\n22 9 87 89 57\\r\\n1 6\\r\\n', 'output': ['264\\r\\n']}, {'input': '7\\r\\n52 36 31 23 74 78\\r\\n2 7\\r\\n', 'output': ['242\\r\\n']}, {'input': '8\\r\\n82 14 24 5 91 49 94\\r\\n3 8\\r\\n', 'output': ['263\\r\\n']}, {'input': '9\\r\\n12 40 69 39 59 21 59 5\\r\\n4 6\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n95 81 32 59 71 30 50 61 100\\r\\n1 6\\r\\n', 'output': ['338\\r\\n']}, {'input': '15\\r\\n89 55 94 4 15 69 19 60 91 77 3 94 91 62\\r\\n3 14\\r\\n', 'output': ['617\\r\\n']}, {'input': '20\\r\\n91 1 41 51 95 67 92 35 23 70 44 91 57 50 21 8 9 71 40\\r\\n8 17\\r\\n', 'output': ['399\\r\\n']}, {'input': '25\\r\\n70 95 21 84 97 39 12 98 53 24 78 29 84 65 70 22 100 17 69 27 62 48 35 80\\r\\n8 23\\r\\n', 'output': ['846\\r\\n']}, {'input': '30\\r\\n35 69 50 44 19 56 86 56 98 24 21 2 61 24 85 30 2 22 57 35 59 84 12 77 92 53 50 92 9\\r\\n1 16\\r\\n', 'output': ['730\\r\\n']}, {'input': '35\\r\\n2 34 47 15 27 61 6 88 67 20 53 65 29 68 77 5 78 86 44 98 32 81 91 79 54 84 95 23 65 97 22 33 42 87\\r\\n8 35\\r\\n', 'output': ['1663\\r\\n']}, {'input': '40\\r\\n32 88 59 36 95 45 28 78 73 30 97 13 13 47 48 100 43 21 22 45 88 25 15 13 63 25 72 92 29 5 25 11 50 5 54 51 48 84 23\\r\\n7 26\\r\\n', 'output': ['862\\r\\n']}, {'input': '45\\r\\n83 74 73 95 10 31 100 26 29 15 80 100 22 70 31 88 9 56 19 70 2 62 48 30 27 47 52 50 94 44 21 94 23 85 15 3 95 72 43 62 94 89 68 88\\r\\n17 40\\r\\n', 'output': ['1061\\r\\n']}, {'input': '50\\r\\n28 8 16 29 19 82 70 51 96 84 74 72 17 69 12 21 37 21 39 3 18 66 19 49 86 96 94 93 2 90 96 84 59 88 58 15 61 33 55 22 35 54 51 29 64 68 29 38 40\\r\\n23 28\\r\\n', 'output': ['344\\r\\n']}, {'input': '60\\r\\n24 28 25 21 43 71 64 73 71 90 51 83 69 43 75 43 78 72 56 61 99 7 23 86 9 16 16 94 23 74 18 56 20 72 13 31 75 34 35 86 61 49 4 72 84 7 65 70 66 52 21 38 6 43 69 40 73 46 5\\r\\n28 60\\r\\n', 'output': ['1502\\r\\n']}, {'input': '70\\r\\n69 95 34 14 67 61 6 95 94 44 28 94 73 66 39 13 19 71 73 71 28 48 26 22 32 88 38 95 43 59 88 77 80 55 17 95 40 83 67 1 38 95 58 63 56 98 49 2 41 4 73 8 78 41 64 71 60 71 41 61 67 4 4 19 97 14 39 20 27\\r\\n9 41\\r\\n', 'output': ['1767\\r\\n']}, {'input': '80\\r\\n65 15 43 6 43 98 100 16 69 98 4 54 25 40 2 35 12 23 38 29 10 89 30 6 4 8 7 96 64 43 11 49 89 38 20 59 54 85 46 16 16 89 60 54 28 37 32 34 67 9 78 30 50 87 58 53 99 48 77 3 5 6 19 99 16 20 31 10 80 76 82 56 56 83 72 81 84 60 28\\r\\n18 24\\r\\n', 'output': ['219\\r\\n']}, {'input': '90\\r\\n61 35 100 99 67 87 42 90 44 4 81 65 29 63 66 56 53 22 55 87 39 30 34 42 27 80 29 97 85 28 81 22 50 22 24 75 67 86 78 79 94 35 13 97 48 76 68 66 94 13 82 1 22 85 5 36 86 73 65 97 43 56 35 26 87 25 74 47 81 67 73 75 99 75 53 38 70 21 66 78 38 17 57 40 93 57 68 55 1\\r\\n12 44\\r\\n', 'output': ['1713\\r\\n']}, {'input': '95\\r\\n37 74 53 96 65 84 65 72 95 45 6 77 91 35 58 50 51 51 97 30 51 20 79 81 92 10 89 34 40 76 71 54 26 34 73 72 72 28 53 19 95 64 97 10 44 15 12 38 5 63 96 95 86 8 36 96 45 53 81 5 18 18 47 97 65 9 33 53 41 86 37 53 5 40 15 76 83 45 33 18 26 5 19 90 46 40 100 42 10 90 13 81 40 53\\r\\n6 15\\r\\n', 'output': ['570\\r\\n']}, {'input': '96\\r\\n51 32 95 75 23 54 70 89 67 3 1 51 4 100 97 30 9 35 56 38 54 77 56 98 43 17 60 43 72 46 87 61 100 65 81 22 74 38 16 96 5 10 54 22 23 22 10 91 9 54 49 82 29 73 33 98 75 8 4 26 24 90 71 42 90 24 94 74 94 10 41 98 56 63 18 43 56 21 26 64 74 33 22 38 67 66 38 60 64 76 53 10 4 65 76\\r\\n21 26\\r\\n', 'output': ['328\\r\\n']}, {'input': '97\\r\\n18 90 84 7 33 24 75 55 86 10 96 72 16 64 37 9 19 71 62 97 5 34 85 15 46 72 82 51 52 16 55 68 27 97 42 72 76 97 32 73 14 56 11 86 2 81 59 95 60 93 1 22 71 37 77 100 6 16 78 47 78 62 94 86 16 91 56 46 47 35 93 44 7 86 70 10 29 45 67 62 71 61 74 39 36 92 24 26 65 14 93 92 15 28 79 59\\r\\n6 68\\r\\n', 'output': ['3385\\r\\n']}, {'input': '98\\r\\n32 47 26 86 43 42 79 72 6 68 40 46 29 80 24 89 29 7 21 56 8 92 13 33 50 79 5 7 84 85 24 23 1 80 51 21 26 55 96 51 24 2 68 98 81 88 57 100 64 84 54 10 14 2 74 1 89 71 1 20 84 85 17 31 42 58 69 67 48 60 97 90 58 10 21 29 2 21 60 61 68 89 77 39 57 18 61 44 67 100 33 74 27 40 83 29 6\\r\\n8 77\\r\\n', 'output': ['3319\\r\\n']}, {'input': '99\\r\\n46 5 16 66 53 12 84 89 26 27 35 68 41 44 63 17 88 43 80 15 59 1 42 50 53 34 75 16 16 55 92 30 28 11 12 71 27 65 11 28 86 47 24 10 60 47 7 53 16 75 6 49 56 66 70 3 20 78 75 41 38 57 89 23 16 74 30 39 1 32 49 84 9 33 25 95 75 45 54 59 17 17 29 40 79 96 47 11 69 86 73 56 91 4 87 47 31 24\\r\\n23 36\\r\\n', 'output': ['514\\r\\n']}, {'input': '100\\r\\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 27 85 85 63\\r\\n43 92\\r\\n', 'output': ['2599\\r\\n']}, {'input': '51\\r\\n85 38 22 38 42 36 55 24 36 80 49 15 66 91 88 61 46 82 1 61 89 92 6 56 28 8 46 80 56 90 91 38 38 17 69 64 57 68 13 44 45 38 8 72 61 39 87 2 73 88\\r\\n15 27\\r\\n', 'output': ['618\\r\\n']}, {'input': '2\\r\\n3\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n6 8 22 22\\r\\n2 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '6\\r\\n3 12 27 28 28\\r\\n3 4\\r\\n', 'output': ['27\\r\\n']}, {'input': '9\\r\\n1 2 2 2 2 3 3 5\\r\\n3 7\\r\\n', 'output': ['9\\r\\n']}, {'input': '10\\r\\n1 1 1 1 1 1 1 1 1\\r\\n6 8\\r\\n', 'output': ['2\\r\\n']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3\\r\\n5 17\\r\\n', 'output': ['23\\r\\n']}, {'input': '25\\r\\n1 1 1 4 5 6 8 11 11 11 11 12 13 14 14 14 15 16 16 17 17 17 19 19\\r\\n4 8\\r\\n', 'output': ['23\\r\\n']}, {'input': '35\\r\\n1 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\\r\\n30 31\\r\\n', 'output': ['2\\r\\n']}, {'input': '45\\r\\n1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 9 9 10 10 10\\r\\n42 45\\r\\n', 'output': ['30\\r\\n']}, {'input': '50\\r\\n1 8 8 13 14 15 15 16 19 21 22 24 26 31 32 37 45 47 47 47 50 50 51 54 55 56 58 61 61 61 63 63 64 66 66 67 67 70 71 80 83 84 85 92 92 94 95 95 100\\r\\n4 17\\r\\n', 'output': ['285\\r\\n']}, {'input': '60\\r\\n1 2 4 4 4 6 6 8 9 10 10 13 14 18 20 20 21 22 23 23 26 29 30 32 33 34 35 38 40 42 44 44 46 48 52 54 56 56 60 60 66 67 68 68 69 73 73 74 80 80 81 81 82 84 86 86 87 89 89\\r\\n56 58\\r\\n', 'output': ['173\\r\\n']}, {'input': '70\\r\\n1 2 3 3 4 5 5 7 7 7 8 8 8 8 9 9 10 12 12 12 12 13 16 16 16 16 16 16 17 17 18 18 20 20 21 23 24 25 25 26 29 29 29 29 31 32 32 34 35 36 36 37 37 38 39 39 40 40 40 40 41 41 42 43 44 44 44 45 45\\r\\n62 65\\r\\n', 'output': ['126\\r\\n']}, {'input': '80\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12\\r\\n17 65\\r\\n', 'output': ['326\\r\\n']}, {'input': '90\\r\\n1 1 3 5 8 9 10 11 11 11 11 12 13 14 15 15 15 16 16 19 19 20 22 23 24 25 25 28 29 29 30 31 33 34 35 37 37 38 41 43 43 44 45 47 51 54 55 56 58 58 59 59 60 62 66 67 67 67 68 68 69 70 71 72 73 73 76 77 77 78 78 78 79 79 79 82 83 84 85 85 87 87 89 93 93 93 95 99 99\\r\\n28 48\\r\\n', 'output': ['784\\r\\n']}, {'input': '95\\r\\n2 2 3 3 4 6 6 7 7 7 9 10 12 12 12 12 13 14 15 16 17 18 20 20 20 20 21 21 21 21 22 22 22 22 22 23 23 23 25 26 26 27 27 27 28 29 29 30 30 31 32 33 34 36 37 37 38 39 39 39 42 43 43 43 45 47 48 50 50 51 52 53 54 54 54 55 55 55 58 59 60 61 61 61 61 62 62 63 64 65 66 67 67 67\\r\\n64 93\\r\\n', 'output': ['1636\\r\\n']}, {'input': '96\\r\\n1 1 2 3 3 5 8 9 9 10 10 10 11 11 11 11 11 12 13 13 13 14 15 15 16 16 17 17 17 17 18 18 20 20 20 21 21 21 23 24 24 25 25 26 27 27 27 27 29 29 29 30 30 30 32 32 32 32 32 32 33 33 34 34 34 35 35 35 36 36 37 37 37 38 39 40 41 41 41 41 42 42 43 43 45 45 45 46 46 47 47 49 50 52 52\\r\\n76 96\\r\\n', 'output': ['898\\r\\n']}, {'input': '98\\r\\n2 3 4 4 5 7 8 10 10 10 11 11 12 12 12 12 13 14 15 15 16 16 18 19 19 20 21 21 21 21 22 23 24 25 26 26 27 27 27 27 29 29 30 30 31 31 37 40 40 40 41 41 41 42 43 44 44 44 46 46 47 49 49 50 50 50 51 53 55 55 56 56 56 56 56 57 57 58 59 60 60 60 62 62 63 64 64 64 65 66 66 67 68 70 70 71 71\\r\\n8 90\\r\\n', 'output': ['3016\\r\\n']}, {'input': '99\\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\\r\\n66 95\\r\\n', 'output': ['29\\r\\n']}, {'input': '100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 16 16 16 17 17\\r\\n39 52\\r\\n', 'output': ['82\\r\\n']}, {'input': '51\\r\\n5 7 9 16 19 25 26 29 29 30 31 32 32 41 43 44 47 49 50 50 51 52 54 55 56 63 64 66 67 70 74 74 77 78 79 80 80 85 86 87 89 89 90 92 93 94 94 95 95 97\\r\\n3 44\\r\\n', 'output': ['2268\\r\\n']}]","id":249} {"difficulty":1000,"lang":"MS C#","lang_cluster":"C#","src_uid":"6e0dafeaf85e92f959c388c72e158f68","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Int32.Parse(Console.In.ReadLine());\n int a = Int32.Parse(Console.In.ReadLine());\n int b = Int32.Parse(Console.In.ReadLine());\n \n if ((a * b < n) ||\n ((a < 1) && (a > 100)) ||\n ((b < 1) && (b > 100)) ||\n ((n < 1) && (n > 10000)))\n {\n Console.Out.WriteLine(\"-1\");\n Environment.Exit(0);\n }\n\n int man = 1;\n for (int row = 0; row < a; row++)\n {\n if ((b % 2 == 0) && (row % 2 == 1))\n {\n man += (b - 1);\n for (int col = b - 1; col >= 0; col--)\n {\n if (man <= n)\n Console.Out.Write(man.ToString() + \" \");\n else\n Console.Out.Write(\"0 \");\n man--;\n }\n man += (b + 1);\n }\n else\n {\n for (int col = 0; col < b; col++)\n {\n if (man <= n)\n Console.Out.Write(man.ToString() + \" \");\n else\n Console.Out.Write(\"0 \");\n man++;\n }\n }\n Console.Out.WriteLine(\"\");\n }\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\n\nnamespace codeforces\n{\n\tclass Program\n\t{\n\t\tpublic const int Osn = 1000000007;\n\n\t\tpublic class Pair\n\t\t{\n\t\t\tpublic long First;\n\n\t\t\tpublic long Second;\n\t\t}\n\n\t\tpublic class PairComparer : IComparer\n\t\t{\n\t\t\tpublic int Compare(Pair x, Pair y)\n\t\t\t{\n\t\t\t\tif (x.First < y.First || (x.First == y.First && x.Second > y.Second))\n\t\t\t\t\treturn -1;\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\n\t\tpublic static long GetGcd(long a, long b)\n\t\t{\n\t\t\twhile (true)\n\t\t\t{\n\t\t\t\tif (b == 0)\n\t\t\t\t\treturn a;\n\t\t\t\tvar a1 = a;\n\t\t\t\ta = b;\n\t\t\t\tb = a1 % b;\n\t\t\t}\n\t\t}\n\n\t\tpublic static void WriteYesNo(bool x, string yes = \"YES\", string no = \"NO\")\n\t\t{\n\t\t\tif (x)\n\t\t\t\tConsole.WriteLine(yes);\n\t\t\telse\n\t\t\t{\n\t\t\t\tConsole.WriteLine(no);\n\t\t\t}\n\t\t}\n\n\t\tpublic static string ReadString()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tpublic static List ReadListOfInts()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(int.Parse).ToList();\n\t\t}\n\n\t\tpublic static List ReadListOfLongs()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn s.Split(' ').Select(long.Parse).ToList();\n\t\t}\n\n\t\tpublic static int ReadInt()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn int.Parse(s);\n\t\t}\n\n\t\tpublic static long ReadLong()\n\t\t{\n\t\t\tvar s = Console.ReadLine();\n\t\t\treturn long.Parse(s);\n\t\t}\n\n\t\tpublic class Vertex\n\t\t{\n\t\t\tpublic int Was;\n\n\t\t\tpublic List Edges;\n\t\t}\n\n\t\tpublic static List Graph = new List();\n\n\t\tpublic static bool Dfs(int u)\n\t\t{\n\t\t\tif (Graph[u].Was == 1) return true;\n\t\t\tif (Graph[u].Was == 2) return false;\n\t\t\tGraph[u].Was = 1;\n\t\t\tforeach (var t in Graph[u].Edges)\n\t\t\t{\n\t\t\t\tif (Dfs(t)) return true;\n\t\t\t}\n\n\t\t\tGraph[u].Was = 2;\n\t\t\treturn false;\n\t\t}\n\n\t\tpublic static bool IsPrime(int x)\n\t\t{\n\t\t\tfor (var j = 2; j * j <= x; ++j)\n\t\t\t\tif (x % j == 0)\n\t\t\t\t\treturn false;\n\t\t\treturn true;\n\t\t}\n\n\t\tpublic class LinkedVertex\n\t\t{\n\t\t\tpublic int Next;\n\n\t\t\tpublic int Prev;\n\n\t\t\tpublic int Value;\n\t\t}\n\n\n\t\tpublic static int BinarySearch(List list, int value)\n\t\t{\n\t\t\tvar l = -1;\n\t\t\tvar r = list.Count;\n\t\t\twhile (r - l > 1)\n\t\t\t{\n\t\t\t\tvar m = (r + l) \/ 2;\n\t\t\t\tif (list[m] >= value)\n\t\t\t\t\tr = m;\n\t\t\t\telse\n\t\t\t\t\tl = m;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\tprivate static void Main()\n\t\t{\n\t\t\tvar l = ReadListOfInts();\n\t\t\tvar n = l[0];\n\t\t\tvar a = l[1];\n\t\t\tvar b = l[2];\n\n\t\t\tvar ans = new int[a, b];\n\t\t\tfor (var i = 0; i < a; ++i)\n\t\t\t\tfor (var j = 0; j < b; ++j)\n\t\t\t\t\tans[i, j] = 0;\n\t\t\tvar ct = 1;\n\t\t\tvar t = 0;\n\t\t\tfor (var i = 0; i < a; ++i)\n\t\t\t\tfor (var j = 0; j < b; ++j)\n\t\t\t\t{\n\t\t\t\t\tif (ct <= n && i % 2 == j % 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tans[i, j] = ct;\n\t\t\t\t\t\tct += 2;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tct = 2;\n\t\t\tfor (var i = 0; i < a; ++i)\n\t\t\t\tfor (var j = 0; j < b; ++j)\n\t\t\t\t{\n\t\t\t\t\tif (ct <= n && i % 2 != j % 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tans[i, j] = ct;\n\t\t\t\t\t\tct += 2;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (t != n)\n\t\t\t\tConsole.WriteLine(-1);\n\t\t\telse\n\t\t\t{\n\t\t\t\tfor (var i = 0; i < a; ++i)\n\t\t\t\t{\n\t\t\t\t\tfor (var j = 0; j < b; ++j)\n\t\t\t\t\t{\n\t\t\t\t\t\tConsole.Write(\"{0} \", ans[i, j]);\n\t\t\t\t\t}\n\t\t\t\t\tConsole.WriteLine();\n\t\t\t\t}\n\t\t\t}\n\t\t\tConsole.ReadLine();\n\t\t}\n\t}\n}\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":250} {"difficulty":1100,"lang":"Mono C#","lang_cluster":"C#","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nclass Program\n {\n static void Main(string[] args)\n {\n string input = Console.In.ReadToEnd().Split(new char[] { '\\n', '\\r' }, StringSplitOptions.RemoveEmptyEntries)[1];\n char[] result;\n int i,j;\n switch(input.Length%3)\n {\n case 1:\n result = new char[input.Length + input.Length \/ 3 + 1];\n result[2] = '-';\n result[0] = input[0];\n result[1] = input[1];\n result[5] = '-';\n result[3] = input[2];\n result[4] = input[3];\n i = 6;\n j = 4;\n break;\n case 2:\n result = new char[input.Length \/ 3 + input.Length + 1];\n result[2] = '-';\n result[0] = input[0];\n result[1] = input[1];\n i = 3;\n j = 2;\n break;\n default:\n result = new char[input.Length \/ 3 + input.Length];\n j = i = 0;\n break;\n }\n for(;i int.Parse(Console_.NextString());\n static long NextLong() => long.Parse(Console_.NextString());\n static double NextDouble() => double.Parse(Console_.NextString());\n static string NextString() => Console_.NextString();\n static string NextLine() => Console.ReadLine();\n static IEnumerable OrderByRand(this IEnumerable x) => x.OrderBy(_ => xorshift);\n static long Count(this IEnumerable x, Func pred) => Enumerable.Count(x, pred);\n static IEnumerable Repeat(T v, long n) => Enumerable.Repeat(v, (int)n);\n static IEnumerable Range(long s, long c) => Enumerable.Range((int)s, (int)c);\n static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }\n static IEnumerator _xsi = _xsc();\n static IEnumerator _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }\n\n static class Console_\n {\n static Queue param = new Queue();\n public static string NextString()\n {\n if (param.Count == 0)\n {\n foreach (string item in NextLine().Split(' '))\n {\n param.Enqueue(item);\n }\n }\n return param.Dequeue();\n }\n }\n class Printer : StreamWriter\n {\n public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;\n public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }\n public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }\n }\n }\n}\nnamespace Csharp_Contest\n{\n\/*\n * #import_Matrix.cs\n *\/\n public class IntegerMatrix: Matrix\n {\n private readonly int mod;\n\n public IntegerMatrix(int size, int mod) : base(size)\n {\n this.mod = mod;\n }\n\n public override void Identity()\n {\n for (int i = 0; i < this.Size; i++)\n {\n for (int j = 0; j < this.Size; j++)\n {\n this[i, j] = (i == j) ? 1 : 0;\n }\n }\n }\n\n protected override Matrix Add(Matrix right)\n {\n IntegerMatrix temp = new IntegerMatrix(this.Size, this.mod);\n temp.Reset();\n for (int i = 0; i < this.Size; i++)\n {\n for (int j = 0; j < this.Size; j++)\n {\n temp[i, j] = (this[i, j] + right[i, j]) % this.mod;\n while (temp[i, j] >= this.mod)\n {\n temp[i, j] -= this.mod;\n }\n }\n }\n\n return temp;\n }\n\n protected override Matrix Multiply(Matrix right)\n {\n IntegerMatrix temp = new IntegerMatrix(this.Size, this.mod);\n temp.Reset();\n for (int i = 0; i < this.Size; i++)\n {\n for (int j = 0; j < this.Size; j++)\n {\n for (int k = 0; k < this.Size; k++)\n {\n temp[i, k] += (int)((1L * this[i, j] * right[j, k]) % this.mod);\n while (temp[i, k] >= this.mod)\n {\n temp[i, k] -= this.mod;\n }\n }\n }\n }\n\n return temp;\n }\n\n protected override Matrix Power(long power)\n {\n IntegerMatrix ans = new IntegerMatrix(this.Size, this.mod);\n ans.Identity();\n IntegerMatrix num = this;\n for (; power > 0; power >>= 1)\n {\n if (power % 2 == 1)\n {\n ans = (IntegerMatrix)(ans * num);\n }\n\n num = (IntegerMatrix)(num * num);\n }\n\n return ans;\n }\n }\n}\nnamespace Csharp_Contest\n{\n public abstract class Matrix\n {\n private T[,] a;\n private readonly int size;\n\n protected Matrix(int size)\n {\n this.size = size;\n this.a = new T[this.size, this.size];\n }\n\n public void Reset()\n {\n for (int i = 0; i < this.size; i++)\n {\n for (int j = 0; j < this.size; j++)\n {\n this[i, j] = default(T);\n }\n }\n }\n\n public abstract void Identity();\n\n public static Matrix operator+ (Matrix a, Matrix b)\n {\n return a.Add(b);\n }\n\n protected abstract Matrix Add(Matrix right);\n\n public static Matrix operator *(Matrix a, Matrix b)\n {\n return a.Multiply(b);\n }\n\n protected abstract Matrix Multiply(Matrix right);\n\n public static Matrix operator ^(Matrix a, long power)\n {\n return a.Power(power);\n }\n\n public static Matrix operator ^(Matrix a, int power)\n {\n return a.Power(power);\n }\n\n public T this[int i, int j]\n {\n get => this.a[i, j];\n set => this.a[i, j] = value;\n }\n\n protected abstract Matrix Power(long power);\n\n public int Size => this.size;\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":253} {"difficulty":1300,"lang":"MS C#","lang_cluster":"C#","src_uid":"88d56c1e3a7ffa94354ce0c70d8e958f","execute_outcome":"RUNTIME_ERROR","source_code":" using System;\n using System.Collections.Generic;\n using System.Globalization;\n using System.IO;\n using System.Linq;\n using System.Runtime.CompilerServices;\n using System.Runtime.InteropServices;\n using System.Threading;\n\n namespace Codeforces\n {\n class Program : IDisposable\n {\n private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());\n private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());\n\n\n private void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n var s = Console.ReadLine().Split(':');\n var hh = int.Parse(s[0]);\n string sHH = s[0], sMM = s[1];\n var mm = int.Parse(s[1]);\n if (n == 12)\n {\n if (hh < 1 || hh > 12)\n {\n sHH = string.Format(\"{0}{1}\",0,hh.ToString()[1]);\n }\n }\n else\n {\n if (hh < 1 || hh > 23)\n {\n sHH = string.Format(\"{0}{1}\", 0, hh.ToString()[1]);\n }\n }\n\n if (mm < 1 || mm > 59)\n {\n sMM = string.Format(\"{0}{1}\", 1, mm.ToString()[1]);\n }\n Console.WriteLine(\"{0}:{1}\",sHH, sMM);\n }\n\n static void Main(string[] args)\n {\n var p = new Program();\n p.Solve();\n \/\/Console.ReadLine();\n p.Dispose();\n }\n\n #region Helpers\n\n private static int ReadInt()\n {\n return int.Parse(textReader.ReadLine());\n }\n\n private static long ReadLong()\n {\n return long.Parse(textReader.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();\n }\n #endregion\n\n public void Dispose()\n {\n textReader.Close();\n textWriter.Close();\n }\n }\n }\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Text.RegularExpressions;\nusing System.Threading;\n\nnamespace Olymp\n{\n public class ProblemSolver\n {\n private Tokenizer input;\n\n public void Solve()\n {\n int n = input.NextInt();\n int[] s = input.NextToken().Split(':').Select(int.Parse).ToArray();\n if (n == 24)\n {\n if(s[0] > 23)\n s[0] %= 10;\n }\n else\n {\n if (s[0] == 0)\n s[0] = 1;\n else if(s[0] > 12)\n {\n if (s[0] % 10 == 0)\n s[0] = 10;\n else\n s[0] %= 10;\n }\n }\n if (s[1] > 59)\n {\n s[1] %= 10;\n }\n Console.Write($\"{s[0].ToString(\"00\")}:{s[1].ToString(\"00\")}\");\n }\n\n public ProblemSolver(TextReader input)\n {\n this.input = new Tokenizer(input);\n }\n }\n\n #region Service classes\n\n public class Tokenizer\n {\n private TextReader reader;\n\n public int NextInt()\n {\n var c = SkipWS();\n if (c == -1)\n throw new EndOfStreamException();\n bool isNegative = false;\n if (c == '-' || c == '+')\n {\n isNegative = c == '-';\n c = this.reader.Read();\n if (c == -1)\n throw new InvalidOperationException();\n }\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n int result = (char)c - '0';\n c = this.reader.Read();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n if (!char.IsDigit((char)c))\n throw new InvalidOperationException();\n result = result * 10 + (char)c - '0';\n c = this.reader.Read();\n }\n if (isNegative)\n result = -result;\n return result;\n }\n\n public string ReadLine()\n {\n return reader.ReadLine();\n }\n\n public long NextLong()\n {\n return long.Parse(this.NextToken());\n }\n\n public double NextDouble()\n {\n return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);\n }\n\n public int[] ReadIntArray(int n)\n {\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[] ReadLongArray(int n)\n {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = NextLong();\n return a;\n }\n\n public double[] ReadDoubleArray(int n)\n {\n double[] a = new double[n];\n for (int i = 0; i < n; i++)\n a[i] = NextDouble();\n return a;\n }\n\n public string NextToken()\n {\n var c = SkipWS();\n if (c == -1)\n return null;\n var sb = new StringBuilder();\n while (c > 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = this.reader.Read();\n }\n return sb.ToString();\n }\n\n private int SkipWS()\n {\n int c = this.reader.Read();\n if (c == -1)\n return c;\n while (c > 0 && char.IsWhiteSpace((char)c))\n c = this.reader.Read();\n return c;\n }\n\n public Tokenizer(TextReader reader)\n {\n this.reader = reader;\n }\n }\n\n class Program\n {\n public static void Main(string[] args)\n {\n var solver = new ProblemSolver(Console.In);\n solver.Solve();\n }\n }\n\n #endregion\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":254} {"difficulty":1400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"8a9adc116abbd387a6a64dd754436f8a","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round30\n{\n class A\n {\n static long pow(long x, long n)\n {\n checked\n {\n long res = 1;\n for (int i = 0; i < n; i++) res *= x;\n return res;\n }\n }\n\n public static void Main()\n {\n checked\n {\n long[] xs = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();\n long A = xs[0],\n B = xs[1],\n n = xs[2];\n A = Math.Abs(A);\n B = Math.Abs(B);\n for (long x = 0; x < 1000 && A * pow(x, n) <= B; x++)\n if (A * (int)Math.Pow(x, n) == B)\n {\n if (xs[0] < 0 && xs[1] > 0 || xs[0] > 0 && xs[1] < 0)\n x = -x;\n Console.WriteLine(x);\n return;\n }\n }\n Console.WriteLine(\"No solution\");\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace codeforces\n{\n class C\n {\n \/\/ test\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\n-1 1 1\n\");\n\n class Solver\n {\n public void Solve()\n {\n string[] ss = CF.ReadLine().Split(' ');\n int A = int.Parse(ss[0]);\n int B = int.Parse(ss[1]);\n int n = int.Parse(ss[2]);\n\n int? ans= _t(A,B,n);\n if( ans == null)\n CF.WriteLine(\"No solution\");\n else\n CF.WriteLine(ans);\n }\n\n int? _t(int A,int B,int n)\n {\n if (A == 0)\n {\n if (B == 0)\n return 5;\n return null;\n }\n\n if( B%A!= 0 )\n return null;\n\n int C= B\/A;\n\n if (C < 0 && n % 2 == 0)\n return null;\n\n if (C == 0)\n return 0;\n\n int s = Math.Sign(C);\n\n C=Math.Abs(C);\n n = Math.Abs(n);\n\n for (int x= 1; x <= 1000; x++)\n {\n int xn = x;\n for (int j = 1; j < n; j++)\n xn *= x;\n if (xn == C)\n {\n return s* x;\n }\n if (xn > C)\n break;\n }\n \n return null;\n\n }\n }\n\n \n #region test\n\n static void Main(string[] args)\n {\n new Solver().Solve();\n }\n\n static void TLE()\n {\n for (; ; ) ;\n }\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n#else\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n Console.Write(o);\n#endif\n }\n\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n\n string _test_input;\n\n List _lines;\n }\n\n #endregion\n }\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":255} {"difficulty":1400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeff\/\/#undef DEBUG\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace codeforces\n{\n class C\n {\n \/\/ test\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\n2 3\n1 2\n\");\n\n class Solver\n {\n public void Solve()\n {\n string[] ss = CF.ReadLine().Split(' ');\n int n = int.Parse(ss[0]);\n int l = int.Parse(ss[1]);\n\n List ai = new List();\n ss = CF.ReadLine().Split(' ');\n foreach (string s in ss)\n ai.Add(int.Parse(s));\n\n int c = 0;\n foreach(int a in ai )\n {\n c += (a\/l);\n }\n\n CF.WriteLine(c*l);\n\n }\n\n int[,] b;\n\n void bs(int x, int y)\n {\n if (x < 1 || x > 8)\n return;\n if (y < 1 || y > 8)\n return;\n b[x, y] = 1;\n }\n }\n \n \n #region test\n\n static void Main(string[] args)\n {\n System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(\"ru-RU\");\n\n new Solver().Solve();\n CF.Close();\n }\n\n static void TLE()\n {\n for (; ; ) ;\n }\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n \/\/return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n \/\/_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n \/\/_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n\n string _test_input;\n\n List _lines;\n\n#if DEBUG\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public CodeforcesUtils(string dummy)\n {\n \/\/_sr = new System.IO.StreamReader(\"input.txt\");\n \/\/_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n public void Close()\n {\n if( _sr!= null)\n _sr.Close();\n if( _sw != null)\n _sw.Close();\n }\n\n System.IO.StreamReader _sr=null;\n System.IO.StreamWriter _sw=null;\n \n }\n\n #endregion\n }\n}\n","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Task38C\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] container = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int n = container[0], L = container[1];\n container = Console.ReadLine().Split().Select(int.Parse).ToArray();\n \n List areas = new List();\n int max = container.Max();\n for (int i = L; i<=max;i++)\n { int count = 0;\n foreach (int item in container)\n count += item \/ i;\n\n areas.Add(count * i);\n }\n \n Console.WriteLine(areas.Count!=0? areas.Max():0);\n \/\/ Console.ReadKey();\n\n }\n }\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":256} {"difficulty":1400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"9c30697e71102ae10c55c14d9c1db006","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace olymp\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] s = Console.ReadLine().Split('.');\n if (s.Length < 2)\n {\n Console.WriteLine(\"NO\");\n return;\n }\n bool check = false;\n for (int i = 0; i < s.Length; i++)\n {\n if (i == 0 && (s[i].Length > 8 || s[i].Length == 0)) check = true;\n else if (i == s.Length - 1 && (s[i].Length > 3 || s[i].Length == 0)) check = true;\n else if (i != 0 && i != s.Length - 1 && (s[i].Length > 11 || s[i].Length == 0)) check = true;\n }\n if (check)\n {\n Console.WriteLine(\"NO\");\n }\n else\n {\n Console.WriteLine(\"YES\");\n string tmp = s[0] + '.';\n for (int i = 1; i < s.Length - 1; i++)\n {\n if (s[i].Length < 4)\n {\n tmp += s[i].Substring(0, 1);\n Console.WriteLine(tmp);\n tmp = s[i].Substring(1, s[i].Length - 1) + '.';\n }\n else\n {\n tmp += s[i].Substring(0, 3);\n Console.WriteLine(tmp);\n tmp = s[i].Substring(3, s[i].Length - 3) + '.';\n }\n }\n tmp += s[s.Length - 1];\n Console.WriteLine(tmp);\n }\n }\n }\n}\n","description":"Eudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that each file name has a form \"name.ext\", where: name is a string consisting of lowercase Latin letters, its length is from 1 to 8 characters; ext is a string consisting of lowercase Latin letters, its length is from 1 to 3 characters. For example, \"read.me\", \"example.txt\" and \"b.cpp\" are valid file names and \"version.info\", \"ntldr\" and \"contestdata.zip\" are not.Damage to the list meant that all the file names were recorded one after another, without any separators. So now Eudokimus has a single string.Eudokimus needs to set everything right as soon as possible. He should divide the resulting string into parts so that each part would be a valid file name in BerFS. Since Eudokimus has already proved that he is not good at programming, help him. The resulting file list can contain the same file names.","input_specification":"The input data consists of a single string s, its length is from 1 to 4\u00b7105 characters. The string can contain only lowercase Latin letters ('a' - 'z') and periods ('.').","output_specification":"In the first line print \"YES\" (without the quotes), if it is possible to divide s into parts as required. In this case, the following lines should contain the parts of the required partition, one per line in the order in which they appear in s. The required partition can contain the same file names. If there are multiple solutions, print any of them. If the solution does not exist, then print in a single line \"NO\" (without the quotes).","notes":null,"sample_inputs":["read.meexample.txtb.cpp","version.infontldrcontestdata.zip"],"sample_outputs":["YES\nread.m\neexample.t\nxtb.cpp","NO"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n var s = Console.ReadLine().Split('.');\n Boolean Can = true;\n int c = s.Count();\n if (c == 1)\n Can = false;\n if (s[0].Length < 1 || s[0].Length > 8)\n Can = false;\n for (int i = 1; i < c - 1; i++)\n {\n if (s[i].Length < 2 || s[i].Length > 11)\n Can = false;\n }\n if (s[c - 1].Length > 3 || s[c - 1].Length < 1)\n Can = false;\n if (!Can)\n Console.WriteLine(\"NO\");\n else\n {\n Console.WriteLine(\"YES\");\n Console.Write(s[0] + \".\");\n for (int i = 1; i < c - 1; i++)\n {\n int k = Math.Max(1, s[i].Length - 8);\n for (int j = 0; j < k; j++)\n {\n Console.Write(s[i][j]);\n }\n Console.WriteLine();\n int l = s[i].Length;\n for (int j = k; j < s[i].Length; j++)\n {\n Console.Write(s[i][j]);\n }\n Console.Write(\".\");\n }\n Console.WriteLine(s[c - 1]);\n }\n }\n }\n}\n","testcases":"[{'input': 'read.meexample.txtb.cpp\\r\\n', 'output': ['YES\\r\\nread.m\\r\\neexample.t\\r\\nxtb.cpp\\r\\n']}, {'input': 'version.infontldrcontestdata.zip\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'thisis.text.txt\\r\\n', 'output': ['YES\\r\\nthisis.t\\r\\next.txt\\r\\n']}, {'input': 'oops.t\\r\\n', 'output': ['YES\\r\\noops.t\\r\\n']}, {'input': 'thisislongfilename\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'double..dot\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'one.one.one.one.one.one.one.one.one.one\\r\\n', 'output': ['YES\\r\\none.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.one\\r\\n']}, {'input': '.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'z\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'za\\r\\n', 'output': ['NO\\r\\n']}, {'input': '..\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'xlq\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.r.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'ulmc\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'nja.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 't..kz\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'twaha\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'm..dw.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'utsvfg.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.we.voae\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'kw.gkcxk.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.c.v.hpehh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'akymwh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'jx.lqv.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'qkwtq.zw\\r\\n', 'output': ['YES\\r\\nqkwtq.zw\\r\\n']}, {'input': 'yxwvlk..b\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'ph..qlr.pt\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'cab.ab.bac\\r\\n', 'output': ['YES\\r\\ncab.a\\r\\nb.bac\\r\\n']}, {'input': 'badaba.ae\\r\\n', 'output': ['YES\\r\\nbadaba.ae\\r\\n']}, {'input': 'badabaca.mor\\r\\n', 'output': ['YES\\r\\nbadabaca.mor\\r\\n']}, {'input': 'bae.a\\r\\n', 'output': ['YES\\r\\nbae.a\\r\\n']}, {'input': 'b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\\r\\n', 'output': ['YES\\r\\nb.b\\r\\naba.e\\r\\nbpbac.i\\r\\nabaeabac.a\\r\\nbab.a\\r\\ndabacaba.a\\r\\nhcggibij.a\\r\\ndaacab.e\\r\\nbaba.a\\r\\na.a\\r\\nbacaba.d\\r\\nacabada.d\\r\\naqjcpc.j\\r\\nadab.dab\\r\\n']}, {'input': '.ab\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aa.aa.aaaabbbbccc.ddd.ee\\r\\n', 'output': ['YES\\r\\naa.a\\r\\na.aaa\\r\\nabbbbccc.d\\r\\ndd.ee\\r\\n']}, {'input': 'a.aaaa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaread.meexample.txtb.cpp\\r\\n', 'output': ['YES\\r\\naaaaread.m\\r\\neexample.t\\r\\nxtb.cpp\\r\\n']}, {'input': 'abcdabcd.a\\r\\n', 'output': ['YES\\r\\nabcdabcd.a\\r\\n']}, {'input': 'qwertyuio.qwe\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'asd.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaaaaa.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.txtaaaaaaaaa.txt\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.abcde.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.abc.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abcdefgh.aaaabcdefgh.bbb\\r\\n', 'output': ['YES\\r\\nabcdefgh.aaa\\r\\nabcdefgh.bbb\\r\\n']}, {'input': 'filename.exe\\r\\n', 'output': ['YES\\r\\nfilename.exe\\r\\n']}, {'input': '.abcd.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abc.bcdabcdabcd.abc\\r\\n', 'output': ['YES\\r\\nabc.bcd\\r\\nabcdabcd.abc\\r\\n']}, {'input': 'abc.abcde\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.cp\\r\\n', 'output': ['YES\\r\\na.cp\\r\\n']}, {'input': 'a.b.c\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.ha\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.a.a.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.a.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'qwertyui.cp\\r\\n', 'output': ['YES\\r\\nqwertyui.cp\\r\\n']}, {'input': 'ss.aaaaaaaaaaaa.aa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'name.extnamename.ext\\r\\n', 'output': ['YES\\r\\nname.ext\\r\\nnamename.ext\\r\\n']}, {'input': '.aaaa.aaa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaa.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.filena.exe\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.aaaaaaaaaaa.a\\r\\n', 'output': ['YES\\r\\na.aaa\\r\\naaaaaaaa.a\\r\\n']}, {'input': '.aa.w\\r\\n', 'output': ['NO\\r\\n']}]","id":257} {"difficulty":1100,"lang":"Mono C#","lang_cluster":"C#","src_uid":"9c90974a0bb860a5e180760042fd5045","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Linq;\n\nnamespace TaskB\n{\n class Program\n {\n static void Main(string[] args)\n {\n int[] nm = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();\n int N = nm[0];\n int M = nm[1];\n string[] strs = new string[N];\n for (int i = 0; i < N; i++)\n strs[i] = Console.ReadLine();\n bool[,] bl = new bool[N,M];\n for (int i = 0; i < N; i++)\n for (int j = 0; j < M; j++)\n {\n string s = strs[i].Remove(j,1);\n if (s.Contains(strs[i][j]))\n {\n bl[i, j] = true;\n continue;\n }\n\n for (int k = 0; k < M; k++)\n if (k != i && strs[k][j] == strs[i][j])\n {\n bl[i, j] = true;\n continue;\n }\n }\n\n string res = string.Empty;\n for (int i = 0; i < N; i++)\n for (int j = 0; j < M; j++)\n if (!bl[i, j]) res += strs[i][j];\n Console.WriteLine(res);\n }\n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Codeforces\n{\n class Program\n {\n static void Main()\n { \n var input = Console.ReadLine().Trim().Split(' ');\n var n = Int32.Parse(input[0]);\n var m = Int32.Parse(input[1]);\n\n var index = new int[n][];\n var chars = new string[n];\n\n for (int i = 0; i < n; i++)\n {\n chars[i] = Console.ReadLine();\n index[i] = new int[m];\n }\n for (int i = 0; i < n; i++)\n {\n for (int j = 0; j < m; j++) \n {\n if (index[i][j] != 1)\n {\n for (int k = i + 1; k < n; k++)\n if (chars[i][j] == chars[k][j])\n index[i][j] = index[k][j] = 1;\n }\n if (index[i][j] != 2)\n {\n for (int k = j + 1; k < m; k++)\n if (chars[i][j] == chars[i][k])\n index[i][j] = index[i][k] = 2;\n }\n }\n }\n var output = new List();\n for (int i = 0; i < n; i++)\n for (int j = 0; j < m; j++)\n if (index[i][j] == 0)\n output.Add(chars[i][j]);\n Console.WriteLine(new string(output.ToArray()));\n\n }\n }\n}\n\n","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":258} {"difficulty":1400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"a37df9b239a40473516d1525d56a0da7","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _108c\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n \/\/s = \"4 5 ABABA BCGDG AAAAA YABSA\".Split(cs, StringSplitOptions.RemoveEmptyEntries);\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n \n List[] lst = new List[m];\n for (int i = 0; i < m; i++)\n {\n lst[i] = new List();\n }\n\n for (int i = 0; i < n; i++)\n {\n string s = sc.next();\n for (int j = 0; j < m; j++)\n {\n if(!lst[j].Contains(s[j]))\n {\n lst[j].Add(s[j]);\n }\n }\n }\n\n double result = 1;\n\n for (int i = 0; i < m; i++)\n {\n result *= (long)lst[i].Count;\n }\n result = result % 1000000007;\n \n Console.WriteLine((long)result);\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _108c\n{\n class Program\n {\n class Scanner\n {\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n \/\/s = \"4 5 AAAAA BBBBB AAAAA CCCCC\".Split(cs, StringSplitOptions.RemoveEmptyEntries);\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n }\n static void Main(string[] args)\n {\n Scanner sc = new Scanner();\n int n = sc.nextInt();\n int m = sc.nextInt();\n\n \n List[] lst = new List[m];\n for (int i = 0; i < m; i++)\n {\n lst[i] = new List();\n }\n\n for (int i = 0; i < n; i++)\n {\n string s = sc.next();\n for (int j = 0; j < m; j++)\n {\n if(!lst[j].Contains(s[j]))\n {\n lst[j].Add(s[j]);\n }\n }\n }\n\n long result = 1;\n long cot = 0;\n\n for (int i = 0; i < m; i++)\n {\n result *= (long)lst[i].Count;\n cot *= (long)lst[i].Count;\n if (result \/ 1000000007 > 0)\n {\n cot += result \/ 1000000007;\n result = result % 1000000007;\n }\n }\n result = result % 1000000007;\n \n Console.WriteLine((long)result);\n }\n }\n}\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":259} {"difficulty":1500,"lang":"Mono C#","lang_cluster":"C#","src_uid":"b0301a2d79a1ec126511ed769ec0b743","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Globalization;\n\nnamespace Codeforces\n{\n class Program\n { \n static int ReadInt()\n {\n return Int32.Parse(Console.ReadLine());\n }\n static long ReadLong()\n {\n return long.Parse(Console.ReadLine());\n }\n static void ReadIntArray(out int[] array, char separator = ' ')\n {\n var input = Console.ReadLine().Split(separator);\n array = new int[input.Length];\n for (int i = 0; i < input.Length; i++)\n {\n array[i] = Int32.Parse(input[i]);\n }\n\n }\n\n static int ReadNextInt(string input, int index)\n {\n var ints = input.Split(' ');\n return Int32.Parse(ints[index]);\n }\n\n\n static void Main()\n {\n var input = Console.ReadLine();\n var n = ReadNextInt(input, 0);\n var m = ReadNextInt(input, 1);\n\n var players = new Dictionary();\n var enemies = new Dictionary>();\n for (int i = 0; i < n; i++)\n {\n players.Add(i, Console.ReadLine()); \n }\n for (int i = 0; i < m; i++)\n {\n var pair = Console.ReadLine().Split(' ');\n if (!enemies.ContainsKey(pair[0]))\n enemies[pair[0]] = new List();\n enemies[pair[0]].Add(pair[1]);\n if (!enemies.ContainsKey(pair[1]))\n enemies[pair[1]] = new List();\n enemies[pair[1]].Add(pair[0]);\n }\n int res = 0;\n var resPlaers = new List();\n var maxPlayers = new List();\n int c = 1 << n;\n int count = 0;\n bool isGood = true;\n while (--c > 0)\n {\n count = 0;\n isGood = true;\n resPlaers.Clear();\n for (int i = 0; i < n; i++)\n {\n if ((c & (1 << i)) == 0)\n continue;\n\n count++;\n resPlaers.Add(players[i]);\n\n for (int j = i + 1; j < n; j++)\n {\n if ((c & (1 << j)) == 0)\n continue;\n\n if (enemies.ContainsKey(players[i]) && enemies[players[i]].Contains(players[j]))\n {\n isGood = false;\n break;\n }\n }\n\n if (!isGood)\n break;\n }\n if (isGood)\n {\n if (res < count)\n {\n res = count;\n maxPlayers.Clear();\n maxPlayers.AddRange(resPlaers);\n }\n }\n }\n Console.WriteLine(res); \n maxPlayers.Sort(StringComparer.Create(CultureInfo.InvariantCulture, true));\n foreach (var player in maxPlayers)\n Console.WriteLine(player);\n }\n }\n}","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Globalization;\nusing System.Collections;\n\nnamespace Task\n{\n #region MyIo\n\n class MyIo : IDisposable\n {\n TextReader inputStream;\n TextWriter outputStream = Console.Out;\n\n string[] tokens;\n int pointer;\n\n public MyIo(TextReader inputStream)\n {\n this.inputStream = inputStream;\n }\n\n public string NextLine()\n {\n try\n {\n return inputStream.ReadLine();\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public string NextString()\n {\n try\n {\n while (tokens == null || pointer >= tokens.Length)\n {\n tokens = NextLine().Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n pointer = 0;\n }\n return tokens[pointer++];\n }\n catch (IOException)\n {\n return null;\n }\n }\n\n public int NextInt()\n {\n return int.Parse(NextString());\n }\n\n public long NextLong()\n {\n return long.Parse(NextString());\n }\n\n public void Print(string format, params object[] args)\n {\n outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));\n }\n\n public void PrintLine(string format, params object[] args)\n {\n Print(format, args);\n\n outputStream.WriteLine();\n }\n\n public void Print(T o)\n {\n outputStream.Write(o);\n }\n\n\n public void PrintLine(T o)\n {\n outputStream.WriteLine(o);\n }\n\n public void Close()\n {\n inputStream.Close();\n outputStream.Close();\n }\n\n void IDisposable.Dispose()\n {\n Close();\n }\n }\n #endregion\n\n class Program\n {\n #region Program\n MyIo io;\n\n public Program(MyIo io)\n {\n this.io = io;\n }\n\n static void Main(string[] args)\n {\n#if LOCAL_TEST\n using (MyIo io = new MyIo(new StreamReader(\"input.txt\")))\n#else\n using (MyIo io = new MyIo(System.Console.In))\n#endif\n\n {\n new Program(io)\n .Solve();\n\n#if LOCAL_TEST\n Console.ReadLine();\n#endif\n }\n }\n\n\n\n #endregion\n\n\n public class LexComparer : IComparer\n {\n private static readonly LexComparer lc = new LexComparer();\n\n public static LexComparer Instance\n {\n get\n {\n return lc;\n }\n }\n\n public int Compare(string x, string y)\n {\n for (int i = 0; i < Math.Min(x.Length, y.Length); i++)\n {\n if (x[i] == y[i])\n continue;\n\n return Comparer.Default.Compare(x[i], y[i]);\n }\n\n return Comparer.Default.Compare(x.Length, y.Length);\n }\n }\n \n\n void Solve()\n {\n int n = io.NextInt();\n int m = io.NextInt();\n\n\n\n\n List names = new List();\n\n\n for (int i = 0; i < n; i++)\n names.Add(io.NextString());\n\n names.Sort(LexComparer.Instance);\n\n\n\n int[] sts = new int[n];\n\n for (int i = 0; i < n; i++)\n sts[i] = (1 << (n + 1)) - 1;\n\n for (int i = 0; i < m; i++)\n {\n int x = names.BinarySearch(io.NextString(), LexComparer.Instance);\n int y = names.BinarySearch(io.NextString(), LexComparer.Instance);\n\n sts[x] &= ~(1 << y);\n sts[y] &= ~(1 << x);\n }\n\n\n int di = 0;\n int dz = 0;\n \n\n for (int i = 1 << n; i > 0; i--)\n {\n int xi = i;\n\n int z = 0;\n\n bool candidate = true;\n\n for (int j = 0; j < n; j++)\n {\n if (xi % 2 > 0)\n {\n z++;\n\n if ((i & sts[j]) != i)\n {\n candidate = false;\n break;\n }\n }\n xi >>= 1; \n }\n\n if (candidate && z >= dz)\n {\n dz = z;\n di = i;\n }\n }\n\n\n if (dz > 0)\n {\n io.PrintLine(dz);\n\n for (int i = 0; i < n; i++)\n\t\t\t {\n if (((1 << i) & di) > 0)\n io.PrintLine(names[i]);\n }\n }\n }\n\n\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":260} {"difficulty":1100,"lang":"Mono C#","lang_cluster":"C#","src_uid":"b1ef19d7027dc82d76859d64a6f43439","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Text;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace codeforces_43_B\n{\n class Program\n {\n static void Main(string[] args)\n {\n Console.SetIn(new StreamReader(\"input.txt\"));\n StringBuilder letter = new StringBuilder(Console.ReadLine().Trim());\n StringBuilder message = new StringBuilder(Console.ReadLine().Trim());\n\n Dictionary dict = new Dictionary();\n int i = -1;\n while (i < letter.Length-1)\n {\n i++;\n if (letter[i] == ' ')\n continue;\n char curChar = letter[i];\n if (dict.ContainsKey(curChar))\n {\n dict[curChar]++;\n }\n else\n {\n dict.Add(curChar, 0);\n }\n }\n bool canWrite = true;\n int j = -1;\n while (j < message.Length-1)\n {\n j++;\n if (message[j] == ' ')\n continue;\n char curChar = message[j];\n if (!dict.ContainsKey(curChar))\n {\n canWrite = false;\n break;\n }\n else\n {\n dict[curChar]--;\n }\n }\n foreach (char curChar in dict.Keys)\n if (dict[curChar] < 0)\n {\n canWrite = false;\n break;\n }\n Console.Write((canWrite) ? \"YES\" : \"NO\");\n Console.ReadKey();\n }\n }\n}\n","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"],"human_solution":"using System;\n\n\nnamespace problems\n{\n class Program\n {\n static void Main(string[] args)\n {\n char[] s1 = Console.ReadLine().ToCharArray(), s2 = Console.ReadLine().ToCharArray();\n string res = string.Empty;\n for (int i = 0; i < s2.Length; i++)\n {\n if (s2[i] != ' ')\n {\n for (int y = 0; y < s1.Length; y++)\n {\n if (s2[i] == s1[y]) { s1[y] = ' '; res = \"YES\"; break; }\n else { res = \"NO\"; }\n }\n if (res.Equals(\"NO\")) break;\n }\n }\n Console.WriteLine(res.Equals(\"NO\") ? res : \"YES\");\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":261} {"difficulty":1000,"lang":"Mono C#","lang_cluster":"C#","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Globalization;\nusing System.Threading;\nusing System.Collections;\nusing System.IO;\n\nnamespace AcmSolution\n{\n internal class Program\n {\n private static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n \/\/Console.SetIn(new StreamReader(\"gcd.in\"));\n \/\/ Console.SetOut(new StreamWriter(\"gcd.out\"));\n Do();\n \/\/Console.Out.Close();\n Console.ReadLine();\n }\n\n private static void Do()\n {\n int n = GetInt();\n int[] a = GetInts();\n Array.Sort(a);\n int subNumbers = 0;\n\n if (n == 1 && a[0] > n)\n subNumbers = 1;\n\n for (int i = 0; i < n; i++)\n {\n if (a[i]> n)\n {\n subNumbers++; \n }\n else if (i > 0 && a[i] == a[i - 1])\n subNumbers++;\n }\n\n Console.WriteLine(subNumbers);\n }\n\n #region Utils\n private const double Epsilon = 0.00000001;\n\n private static string GetStr()\n {\n return Console.ReadLine();\n }\n\n private static string[] GetStrs()\n {\n return GetStr().Split(new[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n\n private static string[] GetStrs(int cnt)\n {\n var s = new string[cnt];\n for (var i = 0; i < cnt; ++i)\n s[i] = GetStr();\n return s;\n }\n\n private static int GetInt()\n {\n return int.Parse(GetStr());\n }\n\n private static void GetInts(out int a, out int b)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n }\n\n private static void GetInts(out int a, out int b, out int c)\n {\n var q = GetInts();\n a = q[0];\n b = q[1];\n c = q[2];\n }\n\n private static int[] GetInts()\n {\n var s = GetStrs();\n var a = new int[s.Length];\n for (var i = 0; i < s.Length; ++i)\n a[i] = int.Parse(s[i]);\n return a;\n }\n\n private static long GetLong()\n {\n return long.Parse(GetStr());\n }\n\n private static IEnumerable GetLongs()\n {\n return GetStrs().Select(long.Parse);\n }\n\n private static void WriteDouble(T d)\n {\n Console.WriteLine(string.Format(\"{0:0.000000000}\", d).Replace(',', '.'));\n }\n\n private static void WL(T s)\n {\n Console.WriteLine(s);\n }\n\n private static void W(T s)\n {\n Console.Write(s);\n }\n\n private static void Assert(bool b)\n {\n if (!b) throw new Exception();\n }\n\n private static void Swap(ref T a, ref T b)\n {\n var temp = a;\n a = b;\n b = temp;\n }\n\n #endregion\n }\n}","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace CodeForces\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] a = new int[n];\n Input(a);\n Array.Sort(a);\n int count = 0;\n Array.BinarySearch(a, 1);\n for (int i = 0; i < a.Length; i++)\n {\n if (Array.BinarySearch(a, i + 1) < 0)\n count++;\n }\n Console.WriteLine(count);\n }\n static void Input(int[] l)\n {\n var input = Console.ReadLine().Split();\n for (int j = 0; j < input.Length; j++)\n {\n l[j] = Convert.ToInt32(input[j]);\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":262} {"difficulty":1200,"lang":"MS C#","lang_cluster":"C#","src_uid":"c31fed523230af1f904218b2fe0d663d","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace \u041a\u043e\u0442\u0442\u0435\u0434\u0436\u043d\u044b\u0439_\u0433\u043e\u0440\u043e\u0434\u043e\u043a\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] str = Console.ReadLine().Split(' ');\n int n = int.Parse(str[0]), t = int.Parse(str[1]);\n int[,] mas = new int[n,2];\n for (int i = 0; i < n; i++)\n {\n str = Console.ReadLine().Split(' ');\n mas[i, 0] = int.Parse(str[0]);\n mas[i, 1] = int.Parse(str[1]);\n }\n for(int i=0;i mas[j + 1, 0])\n {\n mas[j,0] += mas[j + 1,0];\n mas[j, 1] += mas[j + 1, 1];\n mas[j + 1, 0] = mas[j, 0] - mas[j + 1, 0];\n mas[j + 1, 1] = mas[j, 1] - mas[j + 1, 1];\n mas[j, 0] -= mas[j + 1, 0];\n mas[j, 1] -= mas[j + 1, 1];\n }\n int ans = 2;\n for (int i = 0; i < n-1; i++)\n {\n if (((mas[i + 1, 0] - mas[i + 1, 1] \/ 2) - (mas[i, 0] + mas[i, 1] \/ 2)) > t)\n ans += 2;\n if (((mas[i + 1, 0] - mas[i + 1, 1] \/ 2) - (mas[i, 0] + mas[i, 1] \/ 2)) == t)\n ans++;\n\n }\n Console.WriteLine(ans);\n }\n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nstatic class P {\n static int[] ToIntArray(this string val) { return val.Split().Select(int.Parse).ToArray(); }\n static void Main() {\n var line = Console.ReadLine().ToIntArray();\n int n = line[0], t = line[1], i = 0, cnt = 0;\n var list = new SortedList();\n for (; i < n; ++i) {\n var input = Console.ReadLine().ToIntArray();\n list.Add(input[0], input[1]);\n }\n\n IList keys = list.Keys, values = list.Values;\n for (i = 0; i < n - 1; ++i) {\n var val = (keys[i + 1] - keys[i]) - ((values[i + 1] + values[i]) \/ 2.0);\n if (val > t) { cnt += 2; } else if (val == t) { cnt++; }\n }\n Console.Write(cnt + 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":263} {"difficulty":1200,"lang":"Mono C#","lang_cluster":"C#","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Problems\n{\n class _8A\n {\n public static void Main()\n {\n var forward = \"forward\";\n var backward = \"backward\";\n var both = \"both\";\n var fantasy = \"fantasy\";\n var len = 25000;\n var stations = new string('a', len * 2) + new string('b', len*2);\n var a = new string('a', len);\n var b = new string('b', len);\n \/\/var stations = Console.ReadLine();\n \/\/var a = Console.ReadLine();\n \/\/var b = Console.ReadLine();\n var forw = (IsSequencePossible(stations, a, b));\n \/\/var back = (IsSequencePossible(Reverse(stations), a, b));\n var back = (IsRevSequencePossible(stations, a, b));\n \n if (forw && back)\n {\n Console.WriteLine(both);\n }\n else\n {\n if (forw) Console.WriteLine(forward);\n else if (back) Console.WriteLine(backward);\n else Console.WriteLine(fantasy);\n }\n\n }\n\n private static string Reverse(string s)\n {\n Console.WriteLine(\" start Reverse \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n string result = string.Empty;\n for (int i = s.Length - 1; i >= 0; i-- )\n {\n result += s[i];\n }\n \/\/Console.WriteLine(\" end Reverse \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n return result;\n }\n\n private static bool IsSequencePossible(string stations, string a, string b)\n {\n\n var result = false;\n var ind = FindSubstring(stations, a);\n if (ind > -1)\n {\n Console.WriteLine(\" start Substring \" + DateTime.Now.Second + \" \"+ DateTime.Now.Millisecond);\n stations = stations.Substring(ind + a.Length);\n Console.WriteLine(\" ebd Substring \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n if (FindSubstring(stations, b) > -1)\n {\n result = true;\n }\n }\n return result;\n }\n private static bool IsRevSequencePossible(string stations, string a, string b)\n {\n\n var result = false;\n var ind = FindRevSubstring(stations, a);\n if (ind > -1)\n {\n Console.WriteLine(\" start Substring \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n stations = stations.Substring(ind + a.Length);\n Console.WriteLine(\" ebd Substring \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n if (FindRevSubstring(stations, b) > -1)\n {\n result = true;\n }\n }\n return result;\n }\n private static int FindSubstring(string s, string a)\n {\n Console.WriteLine(\" start FindSubstring \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n if (s.Length < a.Length) return -1;\n ulong x = 257;\n ulong xn = 1;\n for (int i = 1; i < a.Length; i++)\n {\n xn = xn * x;\n }\n \n ulong ha = 0;\n for (int i = 0; i < a.Length; i++)\n {\n ha = ha * x + a[i];\n }\n \n ulong hs = 0;\n for (int i = 0; i < a.Length; i++)\n {\n hs = hs * x + s[i];\n }\n \n if (hs == ha) return 0;\n \n for(int i = a.Length; i < s.Length; i++)\n {\n hs = (hs - xn*s[i - a.Length]) * x + s[i];\n if (hs == ha) return i-a.Length+1;\n }\n\n return -1;\n }\n\n private static int FindRevSubstring(string s, string a)\n {\n Console.WriteLine(\" start FindSubstring \" + DateTime.Now.Second + \" \" + DateTime.Now.Millisecond);\n if (s.Length < a.Length) return -1;\n ulong x = 257;\n ulong xn = 1;\n for (int i = 1; i < a.Length; i++)\n {\n xn = xn * x;\n }\n\n ulong ha = 0;\n for (int i = 0; i < a.Length; i++)\n {\n ha = ha * x + a[i];\n }\n\n ulong hs = 0;\n for (int i = s.Length-1; i >= 0 ; i--)\n {\n hs = hs * x + s[i];\n }\n\n if (hs == ha) return 0;\n\n for (int i = s.Length-1-a.Length; i >= 0; i--)\n {\n hs = (hs - xn * s[i + a.Length]) * x + s[i];\n if (hs == ha) return i + a.Length - 1;\n }\n\n return -1;\n }\n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round8\n{\n class A\n {\n public static int Check(string s, int start, string c)\n {\n for (int i = start; i < s.Length; i++)\n {\n bool ok = true;\n for (int j = 0; j < c.Length; j++)\n {\n int k = i + j;\n if (k >= s.Length || c[j] != s[k])\n {\n ok = false;\n break;\n }\n }\n if (ok) return i;\n }\n return -1;\n }\n\n public static bool Check(string s, string c1, string c2)\n {\n#if false\n for (int i = Check(s, 0, c1); i < s.Length; i = Check(s, i+1, c1))\n {\n if (Check(s, i+1, c2) != -1)\n return true;\n }\n#endif\n int i = Check(s, 0, c1);\n if (i == -1) return false;\n return Check(s, i+c1.Length, c2) != -1;\n }\n\n public static void Main()\n {\n string s = Console.ReadLine();\n string c1 = Console.ReadLine();\n string c2 = Console.ReadLine();\n\n bool forward = Check(s, c1, c2);\n bool backward = Check(new string(s.Reverse().ToArray()), c1, c2);\n\n if (forward && backward)\n {\n Console.Write(\"both\");\n }\n else if (forward)\n {\n Console.Write(\"forward\");\n }\n else if (backward)\n {\n Console.Write(\"backward\");\n }\n else\n {\n Console.Write(\"fantasy\");\n }\n }\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":264} {"difficulty":1200,"lang":"MS C#","lang_cluster":"C#","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _217A\n{\n class Struct\n {\n public Struct(int x1, int y1, int set1)\n {\n\n \n x = x1;\n y = y1;\n set = set1;\n }\n public int x;\n public int y;\n public int set;\n\n public override string ToString()\n {\n return x + \" \" + y + \" \" + set;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var list = new List();\n\n int id = 0;\n\n for (int i = 0; i < n; i++)\n {\n \/\/Console.WriteLine(\"\u0422\u043e\u0447\u043a\u0430 \u2116\"+i);\n var strArr = Console.ReadLine().Split(' ');\n int x = int.Parse(strArr[0]);\n int y = int.Parse(strArr[1]);\n var setValue = list.Where(s => s.x == x ^ s.y == y).Select(s => s.set);\n var setElems = list.Where(s => setValue.Contains(s.set));\n foreach (var item in setElems)\n {\n item.set = id;\n }\n list.Add(new Struct(x, y, id));\n id++;\n \/\/foreach (var item in list)\n \/\/{\n \/\/ Console.WriteLine(item.ToString());\n \/\/}\n }\n Console.WriteLine(list.Select(s=>s.set).Distinct().Count()-1);\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace _217A\n{\n class Struct\n {\n public Struct(int x1, int y1, int set1)\n {\n\n \n x = x1;\n y = y1;\n set = set1;\n }\n public int x;\n public int y;\n public int set;\n\n public override string ToString()\n {\n return x + \" \" + y + \" \" + set;\n }\n }\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n var list = new List();\n\n int id = 0;\n\n for (int i = 0; i < n; i++)\n {\n \/\/Console.WriteLine(\"\u0422\u043e\u0447\u043a\u0430 \u2116\"+i);\n var strArr = Console.ReadLine().Split(' ');\n int x = int.Parse(strArr[0]);\n int y = int.Parse(strArr[1]);\n var setValue = list.Where(s => s.x == x ^ s.y == y).Select(s => s.set).ToArray();\n var setElems = list.Where(s => setValue.Contains(s.set)).ToArray();\n foreach (var item in setElems)\n {\n item.set = id;\n }\n list.Add(new Struct(x, y, id));\n id++;\n \/\/foreach (var item in list)\n \/\/{\n \/\/ Console.WriteLine(item.ToString());\n \/\/}\n }\n Console.WriteLine(list.Select(s=>s.set).Distinct().Count()-1);\n }\n }\n}\n","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":265} {"difficulty":1100,"lang":"MS C#","lang_cluster":"C#","src_uid":"d526af933b5afe9abfdf9815e9664144","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace _192B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] k = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int countDay = 0;\n int countTile = 0;\n while (countTile <= n)\n {\n if (countTile == n - 1)\n {\n countDay++;\n countTile = 0;\n }\n\n if (k[0] > countDay && countTile + 2 < n && k[countTile + 2] > countDay)\n countTile += 2;\n else if (k[0] > countDay && countTile + 1 < n && k[countTile + 1] > countDay)\n countTile += 1;\n else if (n == 1)\n continue;\n else\n break;\n }\n \n Console.WriteLine(countDay);\n }\n }\n }\n\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Codeforces192B\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] k = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();\n\n int countDay = 0;\n int countTile = 0;\n\n if (n == 1)\n {\n countDay = k[0];\n }\n else\n {\n while (countTile <= n)\n {\n if (countTile == n - 1)\n {\n countDay++;\n countTile = 0;\n }\n\n if (k[0] > countDay && countTile + 2 < n && k[countTile + 2] > countDay)\n countTile += 2;\n else if (k[0] > countDay && countTile + 1 < n && k[countTile + 1] > countDay)\n countTile += 1;\n else\n break;\n }\n }\n Console.WriteLine(countDay);\n }\n }\n}\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":266} {"difficulty":1200,"lang":"MS C#","lang_cluster":"C#","src_uid":"d90da1e932a6aa546bec4e1bd4b1fbec","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace CF317\n{\n\tinternal class Program\n\t{\n\t\tprivate static void Main(string[] args)\n\t\t{\n\t\t\tvar sr = new InputReader(Console.In);\n\t\t\t\/\/var sr = new InputReader(new StreamReader(\"input.txt\"));\n\t\t\tvar task = new Task();\n\t\t\tusing (var sw = Console.Out)\n\t\t\t\t\/\/using (var sw = new StreamWriter(\"output.txt\"))\n\t\t\t{\n\t\t\t\ttask.Solve(sr, sw);\n\t\t\t\t\/\/Console.ReadKey();\n\t\t\t}\n\t\t}\n\t}\n\n\tinternal class Task\n\t{\n\t\tpublic void Solve(InputReader sr, TextWriter sw)\n\t\t{\n\t\t\tvar input = sr.ReadArray(Int32.Parse);\n\t\t\tvar n = input[0];\n\t\t\tvar m = input[1];\n\t\t\tvar costs = sr.ReadArray(Int32.Parse);\n\t\t\tvar dict = new Dictionary>();\n\t\t\tfor (var i = 0; i < m; i++) {\n\t\t\t\tinput = sr.ReadArray(Int32.Parse);\n\t\t\t\tif (!dict.ContainsKey(input[0])) {\n\t\t\t\t\tdict.Add(input[0], new HashSet());\n\t\t\t\t}\n\t\t\t\tdict[input[0]].Add(input[1]);\n\t\t\t\tif (!dict.ContainsKey(input[1])) {\n\t\t\t\t\tdict.Add(input[1], new HashSet());\n\t\t\t\t}\n\t\t\t\tdict[input[1]].Add(input[0]);\n\t\t\t}\n\t\t\tvar maxCost = -1;\n\t\t\tfor (var i = 1; i <= n; i++) {\n\t\t\t\tfor (var j = 1; j <= n; j++) {\n\t\t\t\t\tif (dict.ContainsKey(i) && dict[i].Contains(j)) {\n\t\t\t\t\t\tfor (var k = 1; k <= n; k++) {\n\t\t\t\t\t\t\tif (i != j && i != k && j != k) {\n\t\t\t\t\t\t\t\tif (dict[i].Contains(k) && dict[j].Contains(k)) {\n\t\t\t\t\t\t\t\t\tvar curr = costs[i - 1] + costs[j - 1] + costs[k - 1];\n\t\t\t\t\t\t\t\t\tif (curr > maxCost) {\n\t\t\t\t\t\t\t\t\t\tmaxCost = curr;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsw.WriteLine(maxCost);\n\t\t}\n\t}\n}\n\ninternal class InputReader : IDisposable\n{\n\tprivate bool isDispose;\n\tprivate readonly TextReader sr;\n\n\tpublic InputReader(TextReader stream)\n\t{\n\t\tsr = stream;\n\t}\n\n\tpublic void Dispose()\n\t{\n\t\tDispose(true);\n\t\tGC.SuppressFinalize(this);\n\t}\n\n\tpublic string NextString()\n\t{\n\t\tvar result = sr.ReadLine();\n\t\treturn result;\n\t}\n\n\tpublic int NextInt32()\n\t{\n\t\treturn Int32.Parse(NextString());\n\t}\n\n\tpublic long NextInt64()\n\t{\n\t\treturn Int64.Parse(NextString());\n\t}\n\n\tpublic string[] NextSplitStrings()\n\t{\n\t\treturn NextString()\n\t\t\t.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n\t}\n\n\tpublic T[] ReadArray(Func func)\n\t{\n\t\treturn NextSplitStrings()\n\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t.ToArray();\n\t}\n\n\tpublic T[] ReadArrayFromString(Func func, string str)\n\t{\n\t\treturn\n\t\t\tstr.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)\n\t\t\t\t.Select(s => func(s, CultureInfo.InvariantCulture))\n\t\t\t\t.ToArray();\n\t}\n\n\tprotected void Dispose(bool dispose)\n\t{\n\t\tif (!isDispose) {\n\t\t\tif (dispose)\n\t\t\t\tsr.Close();\n\t\t\tisDispose = true;\n\t\t}\n\t}\n\n\t~InputReader()\n\t{\n\t\tDispose(false);\n\t}\n}","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"],"human_solution":"using System;\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass Solution\n{\n static int Main(string[] args)\n {\n var q = Console.ReadLine().Split().Select(int.Parse).ToList();\n var n = q[0]; var m = q[1];\n\n int[] p = new int[9999];\n var d = Console.ReadLine().Split().Select(int.Parse).ToArray();\n for (int i = 0; i < n; i++)\n p[i + 1] = d[i];\n\n bool[,] g = new bool[9999, 9999];\n for (int i = 0; i < m; i++)\n {\n string e = Console.ReadLine();\n int x = int.Parse(e.Split()[0]);\n int y = int.Parse(e.Split()[1]);\n g[x, y] = true;\n g[y, x] = true;\n }\n int a = int.MaxValue;\n for (int i = 1; i <= n; i++)\n for (int j = i + 1; j <= n; j++)\n for (int k = j + 1; k <= n; k++)\n if (g[i, j] && g[j, k] && g[k, i])\n a = Math.Min(a, p[i] + p[j] + p[k]);\n if (a == int.MaxValue)\n Console.WriteLine(-1);\n else\n Console.WriteLine(a);\n\n Console.Read();\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":267} {"difficulty":800,"lang":"Mono C#","lang_cluster":"C#","src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace _34A\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = Convert.ToInt32(Console.ReadLine());\n int[] container = Console.ReadLine().Split().Select(int.Parse).ToArray();\n int helper = 0,ans=999999;\n int index1 = 0, index2 = 0;\n for(int i=1;i int.Parse(ss)).ToArray();\n int c = 0;\n int max = int.MaxValue;\n int maxn = 0;\n for (; ; )\n {\n var ct = c % n;\n var nt = (c + 1) % n;\n if (Math.Abs(s[ct] - s[nt]) < max)\n {\n max = Math.Abs(s[ct] - s[nt]);\n maxn = ct;\n }\n if (nt == 0) break;\n c++;\n }\n Console.WriteLine(\"{0} {1}\", maxn % n+1, (maxn + 1) % n+1);\n }\n }\n}","testcases":"[{'input': '5\\r\\n10 12 13 15 10\\r\\n', 'output': ['5 1\\r\\n']}, {'input': '4\\r\\n10 20 30 40\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '6\\r\\n744 359 230 586 944 442\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '5\\r\\n826 747 849 687 437\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n999 999 993 969 999\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n4 24 6 1 15\\r\\n', 'output': ['3 4\\r\\n']}, {'input': '2\\r\\n511 32\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '3\\r\\n907 452 355\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['4 1\\r\\n']}, {'input': '10\\r\\n684 698 429 694 956 812 594 170 937 764\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '20\\r\\n646 840 437 946 640 564 936 917 487 752 844 734 468 969 674 646 728 642 514 695\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '30\\r\\n996 999 998 984 989 1000 996 993 1000 983 992 999 999 1000 979 992 987 1000 996 1000 1000 989 981 996 995 999 999 989 999 1000\\r\\n', 'output': ['12 13\\r\\n']}, {'input': '50\\r\\n93 27 28 4 5 78 59 24 19 134 31 128 118 36 90 32 32 1 44 32 33 13 31 10 12 25 38 50 25 12 4 22 28 53 48 83 4 25 57 31 71 24 8 7 28 86 23 80 101 58\\r\\n', 'output': ['16 17\\r\\n']}, {'input': '88\\r\\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 999 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 998 1000 1000 998 1000 999 1000 1000 1000 1000\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '99\\r\\n4 4 21 6 5 3 13 2 6 1 3 4 1 3 1 9 11 1 6 17 4 5 20 4 1 9 5 11 3 4 14 1 3 3 1 4 3 5 27 1 1 2 10 7 11 4 19 7 11 6 11 13 3 1 10 7 2 1 16 1 9 4 29 13 2 12 14 2 21 1 9 8 26 12 12 5 2 14 7 8 8 8 9 4 12 2 6 6 7 16 8 14 2 10 20 15 3 7 4\\r\\n', 'output': ['1 2\\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': ['86 87\\r\\n']}, {'input': '100\\r\\n31 75 86 68 111 27 22 22 26 30 54 163 107 75 160 122 14 23 17 26 27 20 43 58 59 71 21 148 9 32 43 91 133 286 132 70 90 156 84 14 77 93 23 18 13 72 18 131 33 28 72 175 30 86 249 20 14 208 28 57 63 199 6 10 24 30 62 267 43 479 60 28 138 1 45 3 19 47 7 166 116 117 50 140 28 14 95 85 93 43 61 15 2 70 10 51 7 95 9 25\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '100\\r\\n896 898 967 979 973 709 961 968 806 967 896 967 826 975 936 903 986 856 851 931 852 971 786 837 949 978 686 936 952 909 965 749 908 916 943 973 983 975 939 886 964 928 960 976 907 788 994 773 949 871 947 980 945 985 726 981 887 943 907 990 931 874 840 867 948 951 961 904 888 901 976 967 994 921 828 970 972 722 755 970 860 855 914 869 714 899 969 978 898 862 642 939 904 936 819 934 884 983 955 964\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '100\\r\\n994 927 872 970 815 986 952 996 965 1000 877 986 978 999 950 990 936 997 993 960 921 860 895 869 943 998 983 968 973 953 999 990 995 871 853 979 973 963 953 938 997 989 993 964 960 973 946 975 1000 962 920 746 989 957 904 965 920 979 966 961 1000 993 975 952 846 971 991 979 985 969 984 973 956 1000 952 778 983 974 956 927 995 997 980 997 1000 970 960 970 988 983 947 904 935 972 1000 863 992 996 932 967\\r\\n', 'output': ['81 82\\r\\n']}, {'input': '100\\r\\n48 108 63 21 27 8 49 21 75 8 24 42 149 18 8 28 21 18 25 35 59 70 59 33 40 1 67 34 120 82 4 115 72 87 3 15 15 63 37 12 40 27 83 14 38 20 14 58 93 10 31 3 39 6 197 77 54 16 31 146 9 49 14 8 77 82 5 11 80 116 8 61 50 24 7 103 29 11 3 3 1 12 46 24 21 131 39 29 36 2 107 40 16 99 31 41 29 48 17 17\\r\\n', 'output': ['36 37\\r\\n']}]","id":268} {"difficulty":2100,"lang":"Mono C#","lang_cluster":"C#","src_uid":"05f251de93536024c05fbd77ed01b70b","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n\n int n = int.Parse(s1.Split(' ')[0]) - 1;\n int m = int.Parse(s1.Split(' ')[1]) - 1;\n\n int min = m;\n\n if (n < m)\n {\n min = n;\n n = m;\n m = min;\n }\n\n byte[] poss = new byte[min + 1];\n\n for (int i = 0; i < poss.Length; i++)\n poss[i] = 1;\n\n for (int i = 0; i <= min; i++)\n {\n if (poss[i] == 1)\n {\n int y = i;\n int dy = 2 * n % (2 * m);\n\n do\n {\n y += dy;\n dy *= Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((y - 1) \/ m) % 2)));\n y = (Math.Abs(y) \/ m) % 2 * m + Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((Math.Abs(y) - 1) \/ m) % 2))) * Math.Abs(y % m);\n \/\/dy *= Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((y - 1) \/ m) % 2 - 1)));\n if (poss[y] == 1 && y != i)\n poss[y] = 0;\n } while (y != i);\n }\n }\n\n int cou = 0;\n\n for (int i = 0; i < poss.Length; i++)\n if (poss[i] == 1)\n cou++;\n\n Console.WriteLine(cou.ToString());\n\n Console.ReadKey();\n }\n\n }\n}\n \n","description":"Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.More formally, first one of four diagonal directions is chosen and the billiard ball moves in that direction. When it reaches the square located on the board's edge, the billiard ball reflects from it; it changes the direction of its movement by 90 degrees and continues moving. Specifically, having reached a corner square, the billiard ball is reflected twice and starts to move the opposite way. While it moves, the billiard ball can make an infinite number of reflections. At any square of its trajectory the billiard ball can stop and on that the move is considered completed. It is considered that one billiard ball a beats another billiard ball b if a can reach a point where b is located.You are suggested to find the maximal number of billiard balls, that pairwise do not beat each other and that can be positioned on a chessboard n\u2009\u00d7\u2009m in size.","input_specification":"The first line contains two integers n and m (2\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106).","output_specification":"Print a single number, the maximum possible number of billiard balls that do not pairwise beat each other. Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is preferred to use cin (also you may use the %I64d specificator).","notes":null,"sample_inputs":["3 4","3 3"],"sample_outputs":["2","3"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication3\n{\n class Program\n {\n static void Main(string[] args)\n {\n string s1 = Console.ReadLine();\n\n int n = int.Parse(s1.Split(' ')[0]) - 1;\n int m = int.Parse(s1.Split(' ')[1]) - 1;\n\n int min = m;\n\n if (n < m)\n {\n min = n;\n n = m;\n m = min;\n }\n\n byte[] poss = new byte[min + 1];\n\n for (int i = 0; i < poss.Length; i++)\n poss[i] = 1;\n\n for (int i = 0; i <= min; i++)\n {\n if (poss[i] == 1)\n {\n int y = i;\n int dy = 2 * n % (2 * m);\n\n do\n {\n y += dy;\n int k = 0;\n if (y <0) k = -1;\n else k = 1;\n dy *= k * Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((Math.Abs(y) - 1) \/ m) % 2)));\n y = (Math.Abs(y) \/ m) % 2 * m + Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((Math.Abs(y) - 1) \/ m) % 2))) * Math.Abs(y % m);\n \/\/dy *= Convert.ToInt32(Math.Pow((-1.0), Convert.ToDouble(((y - 1) \/ m) % 2 - 1)));\n if (poss[y] == 1 && y != i)\n poss[y] = 0;\n } while (!((y == i && dy >= 0) || (y == 0)));\n }\n }\n\n int cou = 0;\n\n for (int i = 0; i < poss.Length; i++)\n if (poss[i] == 1)\n cou++;\n\n Console.WriteLine(cou.ToString());\n\n Console.ReadKey();\n }\n\n }\n}\n \n","testcases":"[{'input': '3 4\\r\\n', 'output': ['2']}, {'input': '3 3\\r\\n', 'output': ['3']}, {'input': '2 2\\r\\n', 'output': ['2']}, {'input': '4 3\\r\\n', 'output': ['2']}, {'input': '2 3\\r\\n', 'output': ['2']}, {'input': '4 4\\r\\n', 'output': ['4']}, {'input': '4 6\\r\\n', 'output': ['2']}, {'input': '4 7\\r\\n', 'output': ['4']}, {'input': '5 7\\r\\n', 'output': ['3']}, {'input': '5 13\\r\\n', 'output': ['5']}, {'input': '7 10\\r\\n', 'output': ['4']}, {'input': '7 21\\r\\n', 'output': ['3']}, {'input': '7 61\\r\\n', 'output': ['7']}, {'input': '8 50\\r\\n', 'output': ['8']}, {'input': '8 8\\r\\n', 'output': ['8']}, {'input': '9 9\\r\\n', 'output': ['9']}, {'input': '9 256\\r\\n', 'output': ['2']}, {'input': '10 10\\r\\n', 'output': ['10']}, {'input': '999 999\\r\\n', 'output': ['999']}, {'input': '1000000 1000000\\r\\n', 'output': ['1000000']}, {'input': '2311 7771\\r\\n', 'output': ['211']}, {'input': '146412 710630\\r\\n', 'output': ['3572']}, {'input': '943547 987965\\r\\n', 'output': ['1347']}, {'input': '35329 689665\\r\\n', 'output': ['1537']}, {'input': '672961 948978\\r\\n', 'output': ['2']}, {'input': '524288 131072\\r\\n', 'output': ['2']}, {'input': '293492 654942\\r\\n', 'output': ['2']}, {'input': '962963 1000000\\r\\n', 'output': ['37038']}, {'input': '7 1000000\\r\\n', 'output': ['4']}, {'input': '999999 1000000\\r\\n', 'output': ['2']}, {'input': '666667 1000000\\r\\n', 'output': ['333334']}, {'input': '384 187\\r\\n', 'output': ['2']}, {'input': '238 116\\r\\n', 'output': ['2']}, {'input': '993 342\\r\\n', 'output': ['32']}, {'input': '848 271\\r\\n', 'output': ['2']}, {'input': '702 200\\r\\n', 'output': ['2']}, {'input': '9516 2202\\r\\n', 'output': ['2']}, {'input': '1498 9704\\r\\n', 'output': ['2']}, {'input': '2482 6269\\r\\n', 'output': ['2']}, {'input': '3466 4770\\r\\n', 'output': ['2']}, {'input': '4449 1336\\r\\n', 'output': ['2']}, {'input': '604630 225648\\r\\n', 'output': ['2']}, {'input': '503832 242363\\r\\n', 'output': ['2']}, {'input': '403034 430556\\r\\n', 'output': ['2']}, {'input': '302237 618749\\r\\n', 'output': ['5']}, {'input': '201439 635463\\r\\n', 'output': ['3']}, {'input': '576709 834208\\r\\n', 'output': ['562']}, {'input': '97905 599257\\r\\n', 'output': ['233']}, {'input': '364915 516421\\r\\n', 'output': ['343']}, {'input': '222403 592339\\r\\n', 'output': ['2203']}, {'input': '543425 776321\\r\\n', 'output': ['77633']}, {'input': '977965 896468\\r\\n', 'output': ['81498']}, {'input': '829981 586711\\r\\n', 'output': ['14311']}, {'input': '429181 515017\\r\\n', 'output': ['85837']}, {'input': '198441 446491\\r\\n', 'output': ['49611']}, {'input': '117806 188489\\r\\n', 'output': ['23562']}, {'input': '893011 315181\\r\\n', 'output': ['52531']}, {'input': '701905 526429\\r\\n', 'output': ['175477']}, {'input': '863029 287677\\r\\n', 'output': ['287677']}, {'input': '871866 348747\\r\\n', 'output': ['174374']}, {'input': '12 5\\r\\n', 'output': ['2']}, {'input': '21 15\\r\\n', 'output': ['3']}, {'input': '12 9\\r\\n', 'output': ['2']}, {'input': '720 972\\r\\n', 'output': ['2']}]","id":269} {"difficulty":2400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"0f49b4a5696ee71ebbc8f83d1ec3b901","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\n\npublic class Program {\n private int n;\n private int[] numbers;\n\n public void Solve() {\n string[] data;\n data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(data[1]);\n data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n numbers = new int[data.Length];\n for (int i = 0; i < n; ++i)\n numbers[i] = int.Parse(data[i]);\n Console.WriteLine(computeMinCost());\n }\n\n private int computeMinCost() {\n Array.Sort(numbers);\n if (numbers.Length > 0 && numbers[0] == 1)\n return 1;\n else if (n >= limit)\n return -1;\n int cost = 0, index = 0;\n foreach (int prime in primes) {\n if (prime >= n)\n break;\n while (index < numbers.Length && numbers[index] < prime)\n ++index;\n if (index == numbers.Length || numbers[index] != prime)\n return -1;\n ++cost;\n }\n return cost;\n }\n\n private static int limit = 1299744;\n private static bool[] isPrime;\n private static List primes;\n\n private static void computePrimes() {\n isPrime = new bool[limit];\n for (int i = 2; i < limit; ++i)\n isPrime[i] = true;\n primes = new List();\n for (int i = 2; i < limit; ++i) {\n if (isPrime[i])\n primes.Add(i);\n foreach (int prime in primes) {\n if (i * prime >= limit)\n break;\n isPrime[i * prime] = false;\n if (i % prime == 0)\n break;\n }\n }\n }\n\n public static void Main() {\n computePrimes();\n new Program().Solve();\n }\n}\n","description":"Vasya plays The Elder Trolls III: Morrowindows. He has a huge list of items in the inventory, however, there is no limits on the size of things. Vasya does not know the total amount of items but he is sure that are not more than x and not less than 2 items in his inventory. A new patch for the game appeared to view inventory in n different modes. Displaying in mode i is a partition of all inventory items on pages, each of which (except for maybe the last one) shows exactly ai items. In addition, each mode shows how many pages bi is in a complete list. Great! Perhaps this information will be enough for Vasya to find the required number. Moreover, it is very interesting, what is the fewest number of modes in which Vasya can see inventory to determine the number of items in it?Vasya cannot use the information that was received while looking on inventory in some mode for selection of next actions. I. e. Vasya chooses some set of modes first, and then sees all the results and determines the size.Knowing the number of ai, x and assuming that Vasya is very smart, check whether he can uniquely determine the number of items in his inventory, and how many modes he will need to do that if he knows numbers ai, x and he is able to know number bi after viewing items in mode i.","input_specification":"The first line contains two integers n and x (0\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20092\u2009\u2264\u2009x\u2009\u2264\u2009109). The second line contains integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009109). Some numbers among all ai may be equal.","output_specification":"Output the fewest amount of modes required to uniquely determine amount of items in the inventory. If there is no solution output \u2009-\u20091.","notes":"NoteIn the second example Vasya is not able to determine items count uniquely because 3 items, as well as 4 items, can be displayed on two pages.","sample_inputs":["2 4\n2 3","1 4\n2"],"sample_outputs":["2","-1"],"human_solution":"using System;\nusing System.Collections.Generic;\n\npublic class Program {\n private int n;\n private int[] numbers;\n\n public void Solve() {\n string[] data;\n data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n n = int.Parse(data[1]);\n data = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n numbers = new int[data.Length];\n for (int i = 0; i < numbers.Length; ++i)\n numbers[i] = int.Parse(data[i]);\n Console.WriteLine(computeMinCost());\n }\n\n private int computeMinCost() {\n Array.Sort(numbers);\n if (numbers.Length > 0 && numbers[0] == 1)\n return n == 2 ? 0 : 1;\n else if (n >= limit)\n return -1;\n int cost = 0, index = 0;\n foreach (int prime in primes) {\n if (prime >= n)\n break;\n while (index < numbers.Length && numbers[index] < prime)\n ++index;\n if (index == numbers.Length || numbers[index] != prime)\n return -1;\n ++cost;\n }\n return cost;\n }\n\n private static int limit = 1299744;\n private static bool[] isPrime;\n private static List primes;\n\n private static void computePrimes() {\n isPrime = new bool[limit];\n for (int i = 2; i < limit; ++i)\n isPrime[i] = true;\n primes = new List();\n for (int i = 2; i < limit; ++i) {\n if (isPrime[i])\n primes.Add(i);\n foreach (int prime in primes) {\n if (i * prime >= limit)\n break;\n isPrime[i * prime] = false;\n if (i % prime == 0)\n break;\n }\n }\n }\n\n public static void Main() {\n computePrimes();\n new Program().Solve();\n }\n}\n","testcases":"[{'input': '2 4\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 4\\r\\n2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n100 500\\r\\n', 'output': ['0\\r\\n']}, {'input': '0 8\\r\\n\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9 8\\r\\n2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['4\\r\\n']}, {'input': '9 8\\r\\n2 3 2 3 2 3 2 3 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '0 2\\r\\n\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 100\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000\\r\\n1000000000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 231\\r\\n176 11 13 844803802 2 99 39 199 47 103 128 218 53 102 118 180 19 41216650 106 58 46 127 475571446 56 177125309 7 75 17 151 57720101 115 827958635 329805783 179 146 193 109 568816931 149 260459535 31 197 223 163 764490292 73 89 545821177 107 491198655 139 84 31 92 19 179 118 96 71 61 79 113 216 131 5 41 143 219 802573042 167 918615685 23 227 277060833 101 229 83 191 3 173 211 210200779 59 207 29 37 67 157 58 97 271956818 181 721780748 137 89 222 329715496 43 43858073 212\\r\\n', 'output': ['50\\r\\n']}, {'input': '100 231\\r\\n179 17 53 101 186 3 193 18 157 7 107 47 662021887 211 820414833 94310859 131 54 92 59 207 73 199 87 122 45 173 23 405603540 769193750 71 115 156 89 137 998237661 925251070 29 107 676289655 191 558368835 19 113 135 61 863484300 197 103 5 41 11 186 91 267574190 31 671988056 107 926847247 227 178 139 904039123 106 83 181 73 167 97 213703748 113 176754880 173 149 13 279420756 46064623 223 82 168942142 32 211 43 182 120 109 122 62 590856356 37 127 159 79 80 229 151 67 19 156 163\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 50\\r\\n42 34 54 61 2 9 24 46 4 47 24 66 5 37 16 57 16 26 70 60 3 6 34 35 45 6 61 70 49 44 16 64 10 66 54 42 13 33 31 62 52 33 43 63 34 26 21 49 42 10 57 68 61 51 57 14 63 13 20 27 16 48 45 18 57 58 67 25 69 21 42 28 45 11 12 30 13 51 46 17 55 45 15 70 62 28 21 7 65 43 17 16 56 5 69 27 66 38 50 12\\r\\n', 'output': ['-1\\r\\n']}, {'input': '50 50\\r\\n13 21 49 5 39 16 48 14 26 48 6 23 38 27 39 18 34 42 30 33 41 37 32 4 30 45 46 23 12 48 39 7 24 39 28 3 35 17 24 12 3 6 2 2 18 38 40 30 40 14\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 2\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 1000000000\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 3\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '0 2\\r\\n\\r\\n', 'output': ['0\\r\\n']}, {'input': '0 3\\r\\n\\r\\n', 'output': ['-1\\r\\n']}]","id":270} {"difficulty":2000,"lang":"Mono C#","lang_cluster":"C#","src_uid":"13fa378c913bb7a15612327099b59f83","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace D\n{\n class Program\n {\n class AR\n {\n public long max, sum, maxl, maxr;\n }\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = int.Parse(line[0]);\n int m = int.Parse(line[1]);\n\n AR[] ar = new AR[n];\n\n for (int i = 0; i < n; i++)\n {\n line = Console.ReadLine().Split(' ');\n int size = int.Parse(line[0]);\n int[] a = new int[size];\n for (int j = 0; j < size; j++)\n a[j] = int.Parse(line[j + 1]);\n\n ar[i] = new AR();\n\n \/\/\/\/ max\n \/\/long max = int.MinValue;\n \/\/for (int j = 0; j < size; j++)\n \/\/ max = Math.Max(max, a[j]);\n \/\/ar[i].max = max;\n\n long sum = 0;\n for (int j = 0; j < size; j++)\n sum += a[j];\n ar[i].sum = sum;\n\n\n int p = 0;\n long max = long.MinValue;\n\n while (p < size && a[p] < 0)\n p++;\n\n if (p == size)\n {\n for (int j = 0; j < size; j++)\n max = Math.Max(max, a[j]);\n ar[i].max = max;\n }\n else\n {\n long cs = max = a[p];\n for (int q = p + 1; q < size; q++)\n {\n if (a[q] + cs > 0)\n {\n cs += a[q];\n max = Math.Max(max, cs);\n }\n else\n cs = 0;\n }\n ar[i].max = max;\n }\n\n long maxl = 0, suml = 0;\n for (int j = 0; j < size; j++)\n {\n suml += a[j];\n maxl = Math.Max(maxl, suml);\n }\n\n long maxr = 0, sumr = 0;\n for (int j = size - 1; j >= 0; j--)\n {\n sumr += a[j];\n maxr = Math.Max(maxr, sumr);\n }\n\n ar[i].maxl = maxl;\n ar[i].maxr = maxr;\n }\n\n int[] lg = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);\n\n long[] DPe = new long[m + 1];\n long[] DPc = new long[m + 1];\n long[] DPs = new long[m + 1];\n\n DPe[0] = long.MinValue;\n DPc[0] = long.MinValue;\n DPs[0] = ar[lg[0] - 1].maxr;\n\n for (int i = 1; i < m; i++)\n {\n int idx = lg[i] - 1;\n if (i > 1)\n {\n DPe[i] = Math.Max(DPc[i - 1], DPs[i - 1]) + ar[idx].maxl;\n DPc[i] = Math.Max(DPc[i - 1], DPs[i - 1]) + ar[idx].sum;\n }\n else\n {\n DPe[i] = DPs[i - 1] + ar[idx].maxl;\n DPc[i] = DPs[i - 1] + ar[idx].sum;\n }\n DPs[i] = ar[idx].maxr;\n }\n\n long best = long.MinValue;\n for (int i = 0; i < m; i++)\n best = Math.Max(best, ar[lg[i] - 1].max);\n\n \/\/best = Math.Max(best, ar[lg[0] - 1].maxr);\n\n for (int i = 1; i < m; i++)\n {\n best = Math.Max(best, DPe[i]);\n \/\/best = Math.Max(best, DPc[i]);\n \/\/best = Math.Max(best, DPs[i]);\n }\n\n Console.WriteLine(best);\n\n }\n }\n}\n","description":"Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.This problem is similar to a standard problem but it has a different format and constraints.In the standard problem you are given an array of integers, and you have to find one or more consecutive elements in this array where their sum is the maximum possible sum.But in this problem you are given n small arrays, and you will create one big array from the concatenation of one or more instances of the small arrays (each small array could occur more than once). The big array will be given as an array of indexes (1-based) of the small arrays, and the concatenation should be done in the same order as in this array. Then you should apply the standard problem mentioned above on the resulting big array.For example let's suppose that the small arrays are {1, 6, -2}, {3, 3} and {-5, 1}. And the indexes in the big array are {2, 3, 1, 3}. So the actual values in the big array after formatting it as concatenation of the small arrays will be {3, 3, -5, 1, 1, 6, -2, -5, 1}. In this example the maximum sum is 9.Can you help Mostafa solve this problem?","input_specification":"The first line contains two integers n and m, n is the number of the small arrays (1\u2009\u2264\u2009n\u2009\u2264\u200950), and m is the number of indexes in the big array (1\u2009\u2264\u2009m\u2009\u2264\u2009250000). Then follow n lines, the i-th line starts with one integer l which is the size of the i-th array (1\u2009\u2264\u2009l\u2009\u2264\u20095000), followed by l integers each one will be greater than or equal -1000 and less than or equal 1000. The last line contains m integers which are the indexes in the big array, and you should concatenate the small arrays in the same order, and each index will be greater than or equal to 1 and less than or equal to n. The small arrays are numbered from 1 to n in the same order as given in the input. Some of the given small arrays may not be used in big array. Note, that the array is very big. So if you try to build it straightforwardly, you will probably get time or\/and memory limit exceeded.","output_specification":"Print one line containing the maximum sum in the big array after formatting it as described above. You must choose at least one element for the sum, i. e. it cannot be empty. Please, do not use %lld specificator to write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).","notes":null,"sample_inputs":["3 4\n3 1 6 -2\n2 3 3\n2 -5 1\n2 3 1 3","6 1\n4 0 8 -3 -10\n8 3 -2 -5 10 8 -9 -5 -4\n1 0\n1 -3\n3 -8 5 6\n2 9 6\n1"],"sample_outputs":["9","8"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round67\n{\n class D\n {\n static int[] ReadInts() { return Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss)); }\n static long[] ReadILongs() { return Array.ConvertAll(Console.ReadLine().Split(' '), sss => long.Parse(sss)); }\n\n public static void Main()\n {\n var xs = ReadInts();\n int n = xs[0],\n m = xs[1];\n var ys = new long[n][];\n var len = new int[n];\n var sum = new long[n];\n var minsum = new long[n];\n var minsum2 = new long[n];\n var maxsum = new long[n];\n var maxsum2 = new long[n];\n for (int i = 0; i < n; i++)\n {\n ys[i] = ReadILongs();\n len[i] = (int)ys[i][0];\n maxsum2[i] = int.MinValue;\n for (int j = 1; j <= len[i]; j++)\n {\n sum[i] += ys[i][j];\n\n if (maxsum2[i] < sum[i] - minsum[i])\n maxsum2[i] = sum[i] - minsum[i];\n\n if (j == 1 || maxsum[i] < sum[i])\n {\n if(j > 1) minsum2[i] = minsum[i];\n maxsum[i] = sum[i];\n }\n\n if (minsum[i] > sum[i])\n minsum[i] = sum[i];\n }\n }\n xs = ReadInts();\n long min = 0, now = 0, res = long.MinValue;\n for (int i = 0; i < m; i++)\n {\n int j = xs[i] - 1;\n min = Math.Min(now + minsum2[j], min);\n res = Math.Max(now + maxsum[j] - min, res);\n res = Math.Max(maxsum2[j], res);\n min = Math.Min(now + minsum[j], min);\n now += sum[j];\n \/\/Console.WriteLine(\"{0}: {1} {2} {3} {4}\", i, res, min, max, now);\n }\n Console.WriteLine(res);\n }\n }\n}\n","testcases":"[{'input': '3 4\\r\\n3 1 6 -2\\r\\n2 3 3\\r\\n2 -5 1\\r\\n2 3 1 3\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 1\\r\\n4 0 8 -3 -10\\r\\n8 3 -2 -5 10 8 -9 -5 -4\\r\\n1 0\\r\\n1 -3\\r\\n3 -8 5 6\\r\\n2 9 6\\r\\n1\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 3\\r\\n6 6 8 -5 4 10 -2\\r\\n1 -2\\r\\n1 -10\\r\\n5 -10 10 8 -7 -10\\r\\n2 4 1\\r\\n', 'output': ['24\\r\\n']}, {'input': '7 7\\r\\n2 -8 -7\\r\\n5 2 -10 10 -2 4\\r\\n7 10 -8 9 8 9 -10 -3\\r\\n6 0 6 -9 9 -6 -9\\r\\n4 -6 -9 10 -6\\r\\n3 -8 4 10\\r\\n7 -1 -3 10 -8 -6 -3 6\\r\\n4 5 4 6 6 1 7\\r\\n', 'output': ['20\\r\\n']}, {'input': '4 8\\r\\n8 0 3 -9 -10 0 -1 6 -4\\r\\n3 -10 -7 2\\r\\n10 6 -2 -9 0 -7 -4 -7 7 -1 2\\r\\n3 -5 1 -4\\r\\n1 1 1 1 4 4 3 3\\r\\n', 'output': ['14\\r\\n']}, {'input': '2 1\\r\\n2 -4 -6\\r\\n5 6 8 3 5 -2\\r\\n1\\r\\n', 'output': ['-4\\r\\n']}, {'input': '9 4\\r\\n4 8 -2 -10 6\\r\\n10 -4 9 6 -2 -8 6 7 2 -6 2\\r\\n8 -10 1 9 9 -10 2 -10 -9\\r\\n7 3 -10 -10 -6 3 -7 0\\r\\n5 -4 -8 2 -5 2\\r\\n1 -3\\r\\n4 -9 0 7 -4\\r\\n7 4 -5 4 -8 -4 0 -1\\r\\n9 2 5 -10 4 -10 -2 6 5 10\\r\\n3 6 4 6\\r\\n', 'output': ['19\\r\\n']}, {'input': '3 1\\r\\n7 4 8 1 -7 -9 -8 -9\\r\\n10 5 -5 -5 -9 -1 7 4 -1 -4 4\\r\\n8 -7 7 4 10 -6 3 -6 9\\r\\n2\\r\\n', 'output': ['11\\r\\n']}, {'input': '7 3\\r\\n7 -9 -6 0 -6 -5 1 -9\\r\\n9 4 4 3 -6 -4 8 4 5 -6\\r\\n1 -4\\r\\n7 -3 -9 -9 1 -4 8 7\\r\\n2 6 3\\r\\n7 0 -5 -5 -2 -8 2 -1\\r\\n8 4 1 6 -7 -2 10 -8 -2\\r\\n3 1 5\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 9\\r\\n8 -10 10 3 4 -9 0 3 9\\r\\n4 9 2 -1 6\\r\\n3 -10 -10 -5\\r\\n7 10 -6 7 1 -8 3 4\\r\\n8 -8 9 3 -1 0 1 -7 -7\\r\\n1 -4\\r\\n3 2 3 2 4 4 1 1 1\\r\\n', 'output': ['68\\r\\n']}, {'input': '3 6\\r\\n3 -1 -1 -1\\r\\n4 -2 -2 -2 -2\\r\\n5 -3 -3 -3 -3 -3\\r\\n1 2 3 1 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n11 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n10 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['11\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1\\r\\n1 -1\\r\\n1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1\\r\\n1 0\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 1 0 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\n6 0 0 0 0 0 0\\r\\n6 0 0 0 0 0 0\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '14 14\\r\\n6 -1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 -1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\\r\\n', 'output': ['82\\r\\n']}]","id":271} {"difficulty":2500,"lang":"Mono C#","lang_cluster":"C#","src_uid":"1503f0379bf8d7f25c191ddea9278842","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace pro\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] x = new int[n];\n int[] y = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] sp = Console.ReadLine().Split();\n x[i] = int.Parse(sp[0]);\n y[i] = int.Parse(sp[1]);\n }\n Int64 L = x[0], R = x[1];\n if (L > R)\n {\n Int64 tmp = L;\n L = R;\n R = L;\n }\n for (int i = 0; i < n; i++)\n {\n int j = (i + 1) % n;\n Int64 a = y[j] - y[i];\n Int64 b = x[i] - x[j];\n Int64 c = - a * x[i] - b * y[i];\n if (a == 0)\n {\n if (i != 0 && b * (x[0] - x[1]) > 0)\n {\n L = R + 1;\n break;\n }\n continue;\n }\n double loc = ((double)-b * y[1] - c) \/ a;\n \/\/Console.WriteLine(\"i = \" + i + \" loc = \" + loc + \" a = \" + a);\n if (a > 0)\n {\n Int64 v = (Int64)(loc + 1 - 1e-7);\n if (L < v) L = v;\n }else\n {\n Int64 v = (Int64)(loc + 1e-7);\n if (R > v) R = v;\n }\n }\n Console.WriteLine(R - L + 1);\n }\n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace pro\n{\n class Program\n {\n static void Main(string[] args)\n {\n int n = int.Parse(Console.ReadLine());\n int[] x = new int[n];\n int[] y = new int[n];\n for (int i = 0; i < n; i++)\n {\n string[] sp = Console.ReadLine().Split();\n x[i] = int.Parse(sp[0]);\n y[i] = int.Parse(sp[1]);\n }\n Int64 L = x[0], R = x[1];\n if (L > R)\n {\n Int64 tmp = L;\n L = R;\n R = tmp;\n }\n for (int i = 0; i < n; i++)\n {\n int j = (i + 1) % n;\n Int64 a = y[j] - y[i];\n Int64 b = x[i] - x[j];\n Int64 c = - a * x[i] - b * y[i];\n if (a == 0)\n {\n if (i != 0 && b * (x[0] - x[1]) > 0)\n {\n L = R + 1;\n break;\n }\n continue;\n }\n Int64 s = -b * y[1] - c;\n if (a > 0)\n {\n Int64 v = s \/ a;\n if (v*a < s) v++;\n if (L < v) L = v;\n }else\n {\n Int64 v = s \/ a;\n if (v*a < s) v--;\n if (R > v) R = v;\n }\n }\n int ans = (int)(R - L + 1);\n if (ans < 0) ans = 0;\n Console.WriteLine(ans);\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":272} {"difficulty":2000,"lang":"MS C#","lang_cluster":"C#","src_uid":"1daa784c0eb1cde514e4319da07c8d00","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nclass ProblemC {\n static string inputFileName = \"..\/..\/input.txt\";\n static StreamReader fileReader;\n static string[] inputTokens;\n static int curInputTokenIndex;\n static string NextToken() {\n string ret = \"\";\n while (ret == \"\") {\n if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {\n string line;\n if (Type.GetType(\"HaitaoLocal\") != null) {\n if (fileReader == null) {\n fileReader = new StreamReader(inputFileName);\n }\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ReadInt() {\n return Int32.Parse(NextToken());\n }\n static string ReadString() {\n return NextToken();\n }\n static long ReadLong() {\n return Int64.Parse(NextToken());\n }\n static int[] ReadIntArray(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadInt();\n }\n return ret;\n }\n static string[] ReadStringArray(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadString();\n }\n return ret;\n }\n static long[] ReadLongArray(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadLong();\n }\n return ret;\n }\n static string DoubleToString(double d) {\n return d.ToString(new CultureInfo(\"en-US\"));\n }\n\n public static void Main(string[] args) {\n\n int N = ReadInt();\n int[] ar = ReadIntArray(N);\n for (int i = 0; i < N; i++) ar[i]--;\n int[,] dp = new int[2*N+1,N];\n for(int k=0; k<=2*N; k++) {\n for(int i=0; i= inputTokens.Length) {\n string line;\n if (Type.GetType(\"HaitaoLocal\") != null) {\n if (fileReader == null) {\n fileReader = new StreamReader(inputFileName);\n }\n line = fileReader.ReadLine();\n if (line == null) {\n throw new Exception(\"Error: out of input tokens!\");\n }\n } else {\n line = Console.ReadLine();\n }\n inputTokens = line.Split();\n curInputTokenIndex = 0;\n }\n ret = inputTokens[curInputTokenIndex++];\n }\n return ret;\n }\n static int ReadInt() {\n return Int32.Parse(NextToken());\n }\n static string ReadString() {\n return NextToken();\n }\n static long ReadLong() {\n return Int64.Parse(NextToken());\n }\n static int[] ReadIntArray(int length) {\n int[] ret = new int[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadInt();\n }\n return ret;\n }\n static string[] ReadStringArray(int length) {\n string[] ret = new string[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadString();\n }\n return ret;\n }\n static long[] ReadLongArray(int length) {\n long[] ret = new long[length];\n for (int i = 0; i < length; i++) {\n ret[i] = ReadLong();\n }\n return ret;\n }\n static string DoubleToString(double d) {\n return d.ToString(new CultureInfo(\"en-US\"));\n }\n\n public static void Main(string[] args) {\n\n int N = ReadInt();\n int[] ar = ReadIntArray(N);\n for (int i = 0; i < N; i++) ar[i]--;\n int[,] dp = new int[2 * N + 1, N];\n for (int k = 0; k <= 2 * N; k++) {\n for (int i = 0; i < N; i++) {\n if (k == 0) dp[k, i] = 1;\n else if (k == 1) dp[k, i] = ar[i];\n else dp[k, i] = ar[dp[k - 1, i]];\n }\n }\n int[] cycle = new int[N];\n\n for (int i = 0; i < N; i++) {\n cycle[i] = -1;\n }\n for (int i = 0; i < N; i++) {\n for (int k = 1; k <= N; k++) {\n if (dp[k, i] == i) { cycle[i] = k; break; }\n }\n }\n long lc = 1;\n for (int i = 0; i < N; i++) {\n \/\/Console.WriteLine(i + \" \" + cycle[i]);\n if (cycle[i] != -1) lc = lcm(lc, cycle[i]);\n }\n long ans = -1;\n if (lc < N) {\n for (int k = 1; k <= N; k++) {\n bool flag = true;\n for (int i = 0; i < N; i++) {\n if (dp[2 * k, i] != dp[k, i]) flag = false;\n }\n if (flag) { ans = k; break; }\n }\n }\n if (ans == -1) {\n ans = 0;\n while (ans < N) ans += lc;\n }\n\n Console.WriteLine(ans);\n\n }\n\n static long gcf(long a, long b) {\n while (b != 0) {\n long temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n }\n\n static long lcm(long a, long b) {\n return (a \/ gcf(a, b)) * b;\n }\n}\n","testcases":"[{'input': '4\\r\\n1 2 2 4\\r\\n', 'output': ['1']}, {'input': '3\\r\\n2 3 3\\r\\n', 'output': ['2']}, {'input': '3\\r\\n2 3 1\\r\\n', 'output': ['3']}, {'input': '1\\r\\n1\\r\\n', 'output': ['1']}, {'input': '16\\r\\n1 4 13 9 11 16 14 6 5 12 7 8 15 2 3 10\\r\\n', 'output': ['105']}, {'input': '20\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\\r\\n', 'output': ['1']}, {'input': '20\\r\\n11 14 2 10 17 5 9 6 18 3 17 7 4 15 17 1 4 14 10 11\\r\\n', 'output': ['7']}, {'input': '100\\r\\n46 7 63 48 75 82 85 90 65 23 36 96 96 29 76 67 26 2 72 76 18 30 48 98 100 61 55 74 18 28 36 89 4 65 94 48 53 19 66 77 91 35 94 97 19 45 82 56 11 23 24 51 62 85 25 11 68 19 57 92 53 31 36 28 70 36 62 78 19 10 12 35 46 74 31 79 15 98 15 80 24 59 98 96 92 1 92 16 13 73 99 100 76 52 52 40 85 54 49 89\\r\\n', 'output': ['24']}, {'input': '100\\r\\n61 41 85 52 22 82 98 25 60 35 67 78 65 69 55 86 34 91 92 36 24 2 26 15 76 99 4 95 79 31 13 16 100 83 21 90 73 32 19 33 77 40 72 62 88 43 84 14 10 9 46 70 23 45 42 96 94 38 97 58 47 93 59 51 57 7 27 74 1 30 64 3 63 49 50 54 5 37 48 11 81 44 12 17 75 71 89 39 56 20 6 8 53 28 80 66 29 87 18 68\\r\\n', 'output': ['14549535']}, {'input': '200\\r\\n63 149 34 35 56 63 5 100 167 177 59 200 136 173 169 166 55 182 77 43 183 46 141 83 174 33 197 176 147 54 40 198 105 73 36 16 25 87 178 3 105 122 168 69 163 195 72 86 5 184 85 13 198 18 185 27 101 38 128 186 8 156 10 101 146 136 140 156 93 151 5 60 106 141 151 14 28 102 173 56 112 78 78 175 161 109 137 157 31 10 38 159 9 132 132 188 189 27 120 22 20 198 79 29 177 171 165 172 155 159 89 22 136 123 9 33 153 164 92 74 121 140 101 158 159 67 17 64 115 192 150 171 144 135 185 81 18 134 75 84 1 107 102 122 1...', 'output': ['101']}, {'input': '200\\r\\n22 85 73 99 198 16 79 117 188 154 50 76 197 54 97 172 66 153 44 52 37 176 138 142 158 12 165 45 139 163 69 8 191 26 55 170 111 24 193 36 125 63 70 28 182 89 101 65 71 173 78 130 92 200 83 184 90 81 48 30 187 147 58 59 53 174 56 80 64 168 148 11 7 167 194 18 136 181 146 166 141 132 61 5 35 21 195 40 120 128 169 196 86 121 123 183 140 15 133 62 43 88 87 91 180 114 6 39 96 77 17 131 107 49 4 84 74 134 109 122 162 150 32 179 160 113 177 116 151 25 156 178 190 144 199 95 110 115 102 10 41 119 82 38 135 103...', 'output': ['14549535']}, {'input': '200\\r\\n128 28 177 136 153 147 93 97 21 186 92 195 21 26 147 10 173 83 43 111 42 100 98 2 10 43 118 83 171 167 171 173 21 66 63 193 70 78 88 179 98 167 48 190 137 165 122 163 78 34 188 152 192 54 22 16 111 136 163 100 77 199 36 97 3 118 74 16 178 68 23 149 11 17 182 43 44 166 165 43 193 149 169 159 2 33 182 148 184 67 189 69 124 118 109 101 11 52 128 71 88 12 68 118 69 21 190 111 63 102 55 173 128 96 78 153 129 172 50 40 97 146 165 153 189 167 175 84 119 67 153 43 44 86 115 114 180 3 152 169 165 54 78 128 101...', 'output': ['14549535']}, {'input': '200\\r\\n188 27 97 120 152 66 177 170 27 67 146 161 125 14 19 31 59 67 151 1 61 25 40 195 30 140 161 131 138 133 50 58 138 196 8 108 139 34 75 124 24 58 123 170 9 8 190 132 92 107 39 154 108 162 100 110 14 69 4 108 117 152 200 81 33 116 105 38 125 108 196 117 55 97 46 144 113 72 16 139 29 124 39 8 189 93 82 196 40 106 37 172 112 174 108 164 159 136 8 3 156 55 108 113 7 157 118 67 72 167 37 121 61 68 26 131 63 68 37 59 153 41 197 191 25 10 34 2 40 68 160 164 175 165 15 11 169 187 58 171 105 61 85 193 151 152 24...', 'output': ['14549535']}, {'input': '200\\r\\n70 123 121 156 34 104 150 37 154 175 83 170 11 162 105 137 166 1 175 110 48 160 104 32 91 81 164 136 128 103 101 190 186 104 109 162 26 119 21 160 57 77 195 139 115 105 198 69 121 161 52 176 199 4 87 131 188 115 114 147 27 191 189 38 73 193 65 50 30 178 77 124 155 184 115 67 102 25 53 114 186 19 53 196 85 143 27 8 72 9 162 80 173 188 188 123 71 44 50 196 22 145 64 130 129 33 65 62 119 81 99 25 58 194 61 5 95 117 28 63 63 67 20 142 144 35 130 144 98 168 73 79 118 12 185 54 133 116 150 146 175 165 109 1...', 'output': ['14549535']}, {'input': '200\\r\\n95 156 35 74 113 151 19 103 20 162 30 128 23 143 44 105 163 100 164 19 160 43 105 98 62 27 52 110 6 143 43 41 85 35 164 101 15 52 146 146 35 40 124 168 113 35 193 101 200 127 74 164 85 117 106 36 70 35 44 125 11 18 11 35 196 64 45 64 47 97 100 163 91 95 125 157 9 164 48 166 110 1 59 10 45 19 108 172 106 82 197 165 24 189 161 173 101 52 98 110 128 41 41 90 128 27 68 43 186 124 4 25 66 12 24 38 4 146 46 114 102 175 52 164 36 5 45 35 110 27 27 175 33 48 139 84 103 103 131 81 70 95 169 142 107 180 129 104...', 'output': ['8']}, {'input': '200\\r\\n1 197 169 123 20 37 14 130 27 168 144 194 86 32 139 176 42 193 167 146 147 71 100 10 47 12 155 56 49 84 160 185 120 101 68 105 191 163 102 96 34 23 107 154 69 17 116 108 30 196 46 134 89 161 72 11 18 118 200 7 189 94 13 21 181 45 36 106 133 43 8 87 138 170 148 109 187 171 136 79 57 26 131 35 198 173 110 28 93 121 44 142 63 162 172 179 158 2 24 83 61 4 16 104 141 157 25 166 5 59 145 92 80 112 111 114 67 77 149 124 174 15 186 58 38 192 140 164 150 51 50 132 19 75 40 91 22 184 55 183 90 152 62 52 135 41 ...', 'output': ['180']}, {'input': '200\\r\\n90 136 91 136 136 103 108 68 125 112 8 111 175 149 108 188 138 27 33 109 143 76 121 149 108 138 149 91 33 90 100 174 175 104 138 91 138 27 173 100 90 136 173 149 76 174 173 68 179 100 143 143 100 46 179 68 173 179 76 121 138 161 138 68 33 125 179 33 27 149 105 179 33 76 105 121 111 112 138 90 108 90 91 138 105 188 125 109 136 76 8 143 149 121 136 175 90 8 125 100 174 149 104 143 179 76 46 188 108 91 111 161 8 121 125 125 125 121 103 138 90 112 90 136 27 161 103 100 138 112 90 100 143 179 136 105 111 4...', 'output': ['15']}, {'input': '200\\r\\n21 194 138 53 92 105 199 67 161 95 105 5 144 171 197 140 199 192 193 95 106 116 157 9 94 38 34 101 149 5 19 2 190 92 132 182 17 7 154 38 137 152 30 62 186 1 164 77 187 160 192 196 51 128 192 63 37 188 25 69 166 153 180 16 137 196 140 130 200 70 9 75 11 80 124 109 132 50 174 25 108 150 157 137 199 155 39 43 93 62 17 111 52 190 17 117 194 41 150 17 27 75 41 191 31 16 85 38 167 186 172 152 141 139 125 200 5 94 116 121 190 35 130 200 37 27 129 111 197 174 182 48 72 131 192 200 200 89 5 106 172 31 172 193 ...', 'output': ['15']}, {'input': '200\\r\\n140 123 21 121 133 50 156 14 42 143 7 141 79 2 14 116 194 91 41 18 177 110 23 82 185 179 40 15 91 75 198 133 95 165 50 49 138 20 108 171 139 125 171 186 18 97 194 36 33 166 119 48 27 79 30 156 91 74 69 111 174 179 66 9 121 166 86 122 30 184 20 175 112 96 69 20 35 39 151 56 78 82 171 152 190 29 183 115 26 29 177 76 17 177 195 164 196 172 111 34 48 166 166 13 9 195 80 82 109 69 198 90 97 19 93 99 41 75 134 128 27 128 40 67 126 172 60 68 79 121 44 139 111 51 56 57 63 65 151 31 64 23 91 170 118 115 94 167...', 'output': ['15']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2 1\\r\\n', 'output': ['2']}, {'input': '5\\r\\n2 1 2 3 4\\r\\n', 'output': ['4']}, {'input': '3\\r\\n2 1 2\\r\\n', 'output': ['2']}, {'input': '4\\r\\n2 1 2 3\\r\\n', 'output': ['2']}, {'input': '6\\r\\n2 1 2 3 4 5\\r\\n', 'output': ['4']}, {'input': '4\\r\\n2 3 1 1\\r\\n', 'output': ['3']}, {'input': '5\\r\\n2 3 1 1 4\\r\\n', 'output': ['3']}, {'input': '6\\r\\n2 3 1 1 4 5\\r\\n', 'output': ['3']}, {'input': '7\\r\\n2 3 1 1 4 5 6\\r\\n', 'output': ['6']}, {'input': '8\\r\\n2 3 1 1 4 5 6 7\\r\\n', 'output': ['6']}, {'input': '200\\r\\n53 130 147 76 68 163 58 74 136 73 27 170 14 47 175 17 154 120 118 20 85 2 173 98 132 22 39 99 191 15 132 167 12 132 17 136 69 55 129 92 12 165 52 154 13 103 193 34 123 159 63 17 75 83 191 174 98 30 135 64 134 40 57 92 76 194 20 12 46 41 48 136 55 11 35 102 143 190 58 103 117 78 174 33 127 46 20 100 146 107 135 45 111 134 109 150 200 108 174 18 102 54 109 100 109 112 55 160 34 83 168 159 179 88 167 64 177 26 156 122 32 75 3 183 97 155 89 39 97 73 1 115 31 150 43 3 46 49 87 175 10 124 48 83 41 37 181 19...', 'output': ['24']}, {'input': '142\\r\\n131 32 130 139 5 11 36 2 39 92 111 91 8 14 65 82 90 72 140 80 26 124 97 15 43 77 58 132 21 68 31 45 6 69 70 79 141 27 125 78 93 88 115 104 17 55 86 28 56 117 121 136 12 59 85 95 74 18 87 22 106 112 60 119 81 66 52 14 25 127 29 103 24 48 126 30 120 107 51 47 133 129 96 138 113 37 64 114 53 73 108 62 1 123 63 57 142 76 16 4 35 54 19 110 42 116 7 10 118 9 71 49 75 23 89 99 3 137 38 98 61 128 102 13 122 33 50 94 100 105 109 134 40 20 135 46 34 41 83 67 44 84\\r\\n', 'output': ['137']}, {'input': '142\\r\\n34 88 88 88 88 88 131 53 88 130 131 88 88 130 88 131 53 130 130 34 88 88 131 130 53 88 88 34 131 130 88 131 130 34 130 53 53 34 53 34 130 34 88 88 130 88 131 130 34 53 88 34 53 88 130 53 34 53 88 131 130 34 88 88 130 88 130 130 131 131 130 53 131 130 131 130 53 34 131 34 88 53 88 53 34 130 88 88 130 53 130 34 131 130 53 131 130 88 130 131 53 130 34 130 88 53 88 88 53 88 34 131 88 131 130 53 130 130 53 130 88 88 131 53 88 53 53 34 53 130 131 130 34 131 34 53 130 88 34 34 53 34\\r\\n', 'output': ['1']}, {'input': '142\\r\\n25 46 7 30 112 34 76 5 130 122 7 132 54 82 139 97 79 112 79 79 112 43 25 50 118 112 87 11 51 30 90 56 119 46 9 81 5 103 78 18 49 37 43 129 124 90 109 6 31 50 90 20 79 99 130 31 131 62 50 84 5 34 6 41 79 112 9 30 141 114 34 11 46 92 97 30 95 112 24 24 74 121 65 31 127 28 140 30 79 90 9 10 56 88 9 65 128 79 56 37 109 37 30 95 37 105 3 102 120 18 28 90 107 29 128 137 59 62 62 77 34 43 26 5 99 97 44 130 115 130 130 47 83 53 77 80 131 79 28 98 10 52\\r\\n', 'output': ['8']}, {'input': '142\\r\\n138 102 2 111 17 64 25 11 3 90 118 120 46 33 131 87 119 9 72 141 62 116 44 136 81 122 93 106 123 62 35 17 98 49 46 124 32 67 93 90 91 99 36 46 138 5 52 73 139 2 11 97 6 9 47 56 134 134 112 90 94 55 97 98 118 37 109 31 132 58 95 98 76 76 63 7 110 28 133 50 46 136 115 57 113 55 4 96 63 66 9 52 107 17 95 78 95 118 69 105 18 10 52 94 29 36 113 86 132 39 77 42 113 116 135 93 136 39 48 119 124 35 10 133 138 45 78 107 132 130 49 28 73 85 135 4 119 38 78 116 108 125\\r\\n', 'output': ['20']}, {'input': '200\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 15...', 'output': ['1']}, {'input': '200\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 98 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 171 99 100 101 102 103 104 105 106 107 108 109 110 111 21 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 112 146 147 148 149 150 151 152 153 15...', 'output': ['4']}, {'input': '200\\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 99 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 48 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 43 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154...', 'output': ['1']}, {'input': '200\\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 195 172 53 54 55 56 57 58 59 60 61 62 157 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 24 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 ...', 'output': ['1']}, {'input': '200\\r\\n1 2 3 4 5 146 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 105 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 ...', 'output': ['1']}, {'input': '200\\r\\n162 200 92 101 102 64 138 187 22 14 36 153 23 61 133 127 135 25 73 42 11 93 180 49 179 184 9 114 56 152 120 156 175 10 63 16 85 171 129 28 7 110 72 8 77 124 128 173 19 130 96 18 37 150 155 181 117 43 167 188 27 157 125 84 134 126 172 170 169 30 186 123 161 89 82 88 115 81 69 145 44 119 94 50 31 39 116 109 80 158 60 142 70 32 191 41 76 112 17 168 24 71 189 136 35 165 131 87 122 160 1 5 55 6 111 163 46 59 182 183 68 52 65 48 199 106 99 137 3 38 197 113 20 198 107 12 104 103 86 83 97 57 9 53 121 149 141 ...', 'output': ['1415721106800']}, {'input': '200\\r\\n87 65 148 150 68 117 156 82 131 53 85 42 9 190 155 127 96 142 91 93 151 175 200 121 177 47 67 183 81 158 153 19 62 178 111 128 48 168 172 29 118 46 13 114 193 169 135 103 184 70 90 88 126 84 164 107 188 11 154 64 21 192 132 18 66 123 144 176 97 194 22 44 143 78 149 15 40 106 137 1 187 138 136 94 73 57 92 197 77 25 101 86 195 14 170 27 196 124 159 30 171 134 133 83 41 152 116 147 122 56 17 105 100 33 34 12 166 32 129 28 35 141 126 10 89 6 173 167 23 120 180 109 49 45 5 2 75 110 181 130 140 185 38 39 36...', 'output': ['707860553400']}, {'input': '200\\r\\n16 27 14 47 6 123 167 92 59 63 151 89 111 165 62 168 160 90 172 29 81 198 51 127 26 199 147 146 176 161 184 37 129 188 25 56 103 152 156 157 106 112 77 191 160 94 193 109 115 81 11 143 65 116 158 110 33 190 80 15 28 105 109 166 139 24 49 135 183 8 120 126 170 75 178 17 79 69 141 33 88 132 91 35 112 101 46 144 31 32 60 9 124 18 68 186 11 72 66 170 114 17 41 171 65 78 182 39 54 181 164 154 152 155 23 3 177 166 169 122 71 143 179 189 73 119 27 102 197 195 38 93 61 13 21 116 104 121 83 96 148 86 47 118 34...', 'output': ['707860553400']}, {'input': '200\\r\\n91 93 108 41 35 46 83 7 107 168 118 131 85 149 189 171 58 193 151 161 48 75 33 188 9 96 51 187 187 89 100 148 86 2 164 63 129 5 121 124 128 142 40 106 105 28 101 92 18 138 125 172 121 60 191 166 199 177 81 36 192 90 167 137 114 197 24 132 78 110 183 180 21 158 139 67 95 184 87 162 83 34 145 149 189 4 178 136 172 102 23 60 126 82 198 55 117 11 56 140 182 84 37 70 38 53 65 165 12 160 71 103 37 96 198 58 59 1 122 45 27 130 135 116 109 190 62 69 50 94 157 16 12 200 97 156 10 19 152 119 159 76 88 186 68 12...', 'output': ['707860553400']}, {'input': '200\\r\\n172 83 53 69 118 166 12 123 98 51 111 184 2 143 116 152 165 8 103 30 152 170 21 178 180 68 89 148 115 106 100 19 14 155 157 90 192 136 195 144 93 57 73 127 30 13 176 122 150 24 6 142 79 45 149 146 96 90 163 133 70 52 175 145 39 119 134 29 174 156 94 46 187 109 192 46 39 162 199 60 95 69 10 67 188 34 189 28 50 160 183 62 108 35 58 117 26 40 25 22 81 159 194 110 9 193 169 55 7 63 182 99 101 49 158 130 85 197 185 171 44 102 186 50 132 181 153 114 47 27 155 32 31 177 21 3 138 61 137 92 66 198 41 128 139 3...', 'output': ['707860553400']}, {'input': '200\\r\\n96 160 142 59 8 198 88 27 141 51 196 157 63 145 97 17 66 114 122 69 13 52 3 24 119 144 187 47 39 44 121 73 185 37 56 87 101 174 150 10 191 29 172 7 34 182 152 199 60 22 183 20 117 120 18 80 106 91 14 38 126 163 171 168 137 108 71 186 53 50 82 25 26 57 92 98 100 61 78 139 94 85 41 62 109 166 154 99 31 140 115 175 55 158 21 103 49 200 107 164 153 124 9 167 133 95 161 43 90 135 169 176 195 177 67 151 155 197 28 113 46 93 19 89 86 156 54 58 4 32 179 5 74 77 130 83 105 6 102 194 143 193 127 33 192 162 35 1...', 'output': ['199']}, {'input': '200\\r\\n166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 16...', 'output': ['1']}, {'input': '200\\r\\n168 178 189 57 111 171 120 199 11 96 186 146 147 37 38 190 67 63 42 64 43 29 148 21 35 17 54 47 78 2 77 55 57 116 41 76 192 124 144 3 43 178 136 60 181 70 85 159 34 122 20 137 114 26 108 57 55 120 92 168 146 152 191 13 165 199 180 106 37 150 34 58 49 64 151 119 126 159 18 24 100 55 61 187 93 44 87 144 3 139 168 152 28 74 107 125 37 86 45 182 21 188 186 112 78 152 142 42 50 191 160 36 123 142 58 150 158 134 69 63 178 64 134 141 9 154 12 55 147 67 1 189 87 193 184 29 59 116 42 25 149 63 6 193 58 93 54 9...', 'output': ['132']}, {'input': '197\\r\\n2 1 4 5 3 7 8 9 10 6 12 13 14 15 16 17 11 19 20 21 22 23 24 25 26 27 28 18 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 42 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 59 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 78 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 101 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['7420738134810']}, {'input': '171\\r\\n2 3 2 5 6 7 5 9 10 11 12 13 9 15 16 17 18 19 20 21 15 23 24 25 26 27 28 29 30 31 32 33 23 35 36 37 38 39 40 41 42 43 44 45 46 47 35 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 49 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 67 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 87 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 111 141 142 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['200560490130']}, {'input': '160\\r\\n2 1 4 5 3 7 8 9 10 6 12 13 14 15 16 17 11 19 20 21 22 23 24 25 26 27 28 18 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 42 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 59 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 78 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 101 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['200560490130']}, {'input': '9\\r\\n7 3 8 9 9 3 5 3 2\\r\\n', 'output': ['6']}, {'input': '182\\r\\n2 1 4 5 3 7 8 9 10 6 12 13 14 15 16 17 11 19 20 21 22 23 24 25 26 27 28 18 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 42 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 63 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 86 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 115 147 148 149 150 151 152 153 154 15...', 'output': ['22974421470']}, {'input': '5\\r\\n2 1 4 5 3\\r\\n', 'output': ['6']}, {'input': '7\\r\\n2 3 4 5 6 7 6\\r\\n', 'output': ['6']}, {'input': '180\\r\\n2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 18 19 20 21 22 23 24 25 17 27 28 29 30 26 32 33 34 35 36 37 31 39 40 41 42 43 44 45 46 47 48 38 50 51 52 53 54 55 56 57 58 59 60 61 49 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 62 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 79 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 98 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 121 151 152 153 154 15...', 'output': ['4813451763120']}, {'input': '197\\r\\n2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 18 19 20 21 22 23 24 25 17 27 28 29 30 26 32 33 34 35 36 37 31 39 40 41 42 43 44 45 46 47 48 38 50 51 52 53 54 55 56 57 58 59 60 61 49 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 62 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 79 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 98 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 119 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['465817912560']}, {'input': '200\\r\\n2 1 4 5 3 7 8 9 10 6 12 13 14 15 16 17 11 19 20 21 22 23 24 25 26 27 28 18 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 42 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 59 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 78 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 101 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['7420738134810']}, {'input': '200\\r\\n2 1 4 5 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 6 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153...', 'output': ['300']}, {'input': '129\\r\\n2 1 4 5 3 7 8 9 10 6 12 13 14 15 16 17 11 19 20 21 22 23 24 25 26 27 28 18 30 31 32 33 34 35 36 37 38 39 40 41 29 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 42 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 59 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 78 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 101\\r\\n', 'output': ['6469693230']}, {'input': '4\\r\\n2 3 4 1\\r\\n', 'output': ['4']}, {'input': '198\\r\\n2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 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 17 45 46 47 48 44 50 51 52 53 54 55 49 57 58 59 60 61 62 63 64 65 66 56 68 69 70 71 72 73 74 75 76 77 78 79 67 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 80 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 97 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 116 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 15...', 'output': ['14440355289360']}]","id":273} {"difficulty":2000,"lang":"MS C#","lang_cluster":"C#","src_uid":"31be4d38a8b5ea8738a65bfee24a5a21","execute_outcome":"WRONG_ANSWER","source_code":"\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _347c\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var n = readInt();\n for (int i = 0; i < n; i++)\n {\n var next = Console.ReadLine().Split('\\'').ToArray();\n var val = next[1];\n if (val.Length == 1)\n {\n var d = int.Parse(val);\n if (d == 9)\n {\n Console.WriteLine(1989);\n }\n else\n {\n Console.WriteLine(\"199{0}\", val);\n }\n }\n else if (val == \"99\")\n {\n Console.WriteLine(\"1999\");\n }\n else if (val.Length == 2)\n {\n Console.WriteLine(\"20{0}\", val);\n }\n else if (val.Length == 3)\n {\n Console.WriteLine(\"2{0}\", val);\n }\n else\n {\n var last = val.Substring(val.Length - 4, 4);\n var dc = int.Parse(last);\n if (dc >= 1000 && dc <= 2999)\n {\n var si = true;\n var any = false;\n for (int j = 0; j < val.Length - 4; j++)\n {\n any = true;\n if (val[j] != '1')\n {\n si = false;\n }\n }\n\n if (si || !any)\n {\n Console.WriteLine(\"1{0}\", val);\n }\n else\n {\n Console.WriteLine(\"{0}\", val);\n }\n }\n else\n {\n Console.WriteLine(\"{0}\", val);\n }\n }\n }\n\n \/\/var n = readInt();\n \/\/var m = readInt();\n\n \/\/var a = readIntArray();\n \/\/var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n","description":"International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string y that has never been used before. Among all such valid abbreviations they choose the shortest one and announce it to be the abbreviation of this year's competition.For example, the first three Olympiads (years 1989, 1990 and 1991, respectively) received the abbreviations IAO'9, IAO'0 and IAO'1, while the competition in 2015 received an abbreviation IAO'15, as IAO'5 has been already used in 1995.You are given a list of abbreviations. For each of them determine the year it stands for.","input_specification":"The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000)\u00a0\u2014 the number of abbreviations to process. Then n lines follow, each containing a single abbreviation. It's guaranteed that each abbreviation contains at most nine digits.","output_specification":"For each abbreviation given in the input, find the year of the corresponding Olympiad.","notes":null,"sample_inputs":["5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0","4\nIAO'9\nIAO'99\nIAO'999\nIAO'9999"],"sample_outputs":["2015\n12015\n1991\n1989\n1990","1989\n1999\n2999\n9999"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace chall_cs\n{\n class Program\n {\n static int N, pos_1, pos_2;\n static long add, target, answer;\n static string phr, abbr;\n\n\n static void Main(string[] args)\n {\n N = Convert.ToInt32(Console.ReadLine());\n\n for (int i = 0; i < N; ++i)\n {\n phr = Console.ReadLine();\n abbr = \"\";\n\n for (int j = 4; j < phr.Length; ++j)\n abbr += phr[j];\n\n\n answer = 1988;\n add = 1;\n pos_1 = 1;\n pos_2 = abbr.Length - 1;\n\n while (pos_2 >= 0)\n {\n while (true)\n {\n answer += add;\n\n if (take_dig(answer, pos_1) == abbr[pos_2] - '0')\n break;\n }\n\n pos_2 -= 1;\n pos_1 += 1;\n add *= 10;\n }\n\n\n Console.WriteLine(answer);\n }\n\n \/\/Console.ReadKey();\n }\n \n\n static long take_dig(long value, int pos)\n {\n while(value > 0)\n {\n if (pos == 1)\n break;\n\n pos -= 1;\n value \/= 10;\n }\n\n return value % 10;\n }\n }\n}","testcases":"[{'input': \"5\\r\\nIAO'15\\r\\nIAO'2015\\r\\nIAO'1\\r\\nIAO'9\\r\\nIAO'0\\r\\n\", 'output': ['2015\\r\\n12015\\r\\n1991\\r\\n1989\\r\\n1990']}, {'input': \"4\\r\\nIAO'9\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['1989\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1000\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'10\\r\\nIAO'11\\r\\nIAO'12\\r\\nIAO'13\\r\\nIAO'14\\r\\nIAO'15\\r\\nIAO'16\\r\\nIAO'17\\r\\nIAO'18\\r\\nIAO'19\\r\\nIAO'20\\r\\nIAO'21\\r\\nIAO'22\\r\\nIAO'23\\r\\nIAO'24\\r\\nIAO'25\\r\\nIAO'26\\r\\nIAO'27\\r\\nIAO'28\\r\\nIAO'29\\r\\nIAO'30\\r\\nIAO'31\\r\\nIAO'32\\r\\nIAO'33\\r\\nIAO'34\\r\\nIAO'35\\r\\nIAO'36\\r\\nIAO'37\\r\\nIAO'38\\r\\nIAO'39\\r\\nIAO'40\\r\\nIAO'41\\r\\nIAO'42\\r\\nIAO'43\\r\\nIAO'44\\r\\nIAO'45\\r\\nIAO'46\\r\\nIAO'47\\r\\nIAO'48\\r\\nIAO'49\\r\\nIAO'50\\r\\nIAO'51\\r\\nIAO'52\\r\\nIAO'53\\r\\nIAO'54\\r\\nIAO'55\\r\\nIAO'56\\r\\nIAO'57\\r\\nIAO'58\\r\\nIAO'59\\r\\nIAO'60\\r\\nIAO'61\\r\\nIAO'62\\r\\nIAO'63\\r\\nIAO...\", 'output': ['1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2010\\r\\n2011\\r\\n2012\\r\\n2013\\r\\n2014\\r\\n2015\\r\\n2016\\r\\n2017\\r\\n2018\\r\\n2019\\r\\n2020\\r\\n2021\\r\\n2022\\r\\n2023\\r\\n2024\\r\\n2025\\r\\n2026\\r\\n2027\\r\\n2028\\r\\n2029\\r\\n2030\\r\\n2031\\r\\n2032\\r\\n2033\\r\\n2034\\r\\n2035\\r\\n2036\\r\\n2037\\r\\n2038\\r\\n2039\\r\\n2040\\r\\n2041\\r\\n2042\\r\\n2043\\r\\n2044\\r\\n2045\\r\\n2046\\r\\n2047\\r\\n2048\\r\\n2049\\r\\n2050\\r\\n2051\\r\\n2052\\r\\n2053\\r\\n2054\\r\\n2055\\r\\n2056\\r\\n2057\\r\\n2058\\r\\n2059\\r\\n2060\\r\\n2061\\r\\n2062\\r\\n2063\\r\\n2064\\r\\n2065\\r\\n2066\\r\\n2067\\r\\n2068\\r\\n2069\\r\\n2070\\r\\n2071\\r\\n2072\\r\\n2073\\r\\n2074\\r\\n2075\\r\\n2076\\r\\n2077\\r\\n2078\\r\\n2079\\r\\n2080\\r\\n2081\\r\\n2082\\r\\n2083\\r\\n2084\\r\\n2...']}, {'input': \"1000\\r\\nIAO'111112940\\r\\nIAO'818187\\r\\nIAO'00078853\\r\\nIAO'11112867\\r\\nIAO'2677\\r\\nIAO'431790741\\r\\nIAO'5206510\\r\\nIAO'0003566\\r\\nIAO'11113008\\r\\nIAO'55873562\\r\\nIAO'870948497\\r\\nIAO'000019400\\r\\nIAO'00001733\\r\\nIAO'79230\\r\\nIAO'1113209\\r\\nIAO'00054768\\r\\nIAO'111113183\\r\\nIAO'000726284\\r\\nIAO'000984404\\r\\nIAO'13343\\r\\nIAO'853952489\\r\\nIAO'000042254\\r\\nIAO'000000083\\r\\nIAO'111113291\\r\\nIAO'1112892\\r\\nIAO'031211\\r\\nIAO'0000054\\r\\nIAO'88862\\r\\nIAO'000024897\\r\\nIAO'6068\\r\\nIAO'11113261\\r\\nIAO'1563400\\r\\nIAO'0000014\\r\\nIAO'1113147\\r\\nIAO'113122\\r\\nIAO'11113114\\r\\nIAO'11112873\\r\\nIAO'00...\", 'output': ['1111112940\\r\\n818187\\r\\n100078853\\r\\n111112867\\r\\n12677\\r\\n431790741\\r\\n5206510\\r\\n10003566\\r\\n111113008\\r\\n55873562\\r\\n870948497\\r\\n1000019400\\r\\n100001733\\r\\n79230\\r\\n1113209\\r\\n100054768\\r\\n111113183\\r\\n1000726284\\r\\n1000984404\\r\\n13343\\r\\n853952489\\r\\n1000042254\\r\\n1000000083\\r\\n111113291\\r\\n11112892\\r\\n1031211\\r\\n10000054\\r\\n88862\\r\\n1000024897\\r\\n6068\\r\\n11113261\\r\\n1563400\\r\\n10000014\\r\\n1113147\\r\\n113122\\r\\n11113114\\r\\n111112873\\r\\n1000000020\\r\\n2644846\\r\\n1113143\\r\\n111113142\\r\\n60064652\\r\\n33881\\r\\n99223093\\r\\n1113069\\r\\n11113003\\r\\n11112865\\r\\n100001371\\r\\n112865\\r\\n16735\\r\\n1000070394\\r\\n111113...']}, {'input': \"1000\\r\\nIAO'13042\\r\\nIAO'113044\\r\\nIAO'113014\\r\\nIAO'111112921\\r\\nIAO'3393\\r\\nIAO'11113123\\r\\nIAO'00042330\\r\\nIAO'0039790\\r\\nIAO'1112851\\r\\nIAO'09327\\r\\nIAO'11113210\\r\\nIAO'12940\\r\\nIAO'13374\\r\\nIAO'824097479\\r\\nIAO'90718\\r\\nIAO'112944\\r\\nIAO'12883\\r\\nIAO'227955125\\r\\nIAO'29726\\r\\nIAO'11113300\\r\\nIAO'373423793\\r\\nIAO'0059555\\r\\nIAO'40539982\\r\\nIAO'00000262\\r\\nIAO'000716486\\r\\nIAO'0040940\\r\\nIAO'00092502\\r\\nIAO'84551722\\r\\nIAO'931673356\\r\\nIAO'000048103\\r\\nIAO'0000009\\r\\nIAO'111113047\\r\\nIAO'111113101\\r\\nIAO'113132\\r\\nIAO'59665\\r\\nIAO'73538082\\r\\nIAO'11910636\\r\\nIAO'000000378\\r\\nIAO'...\", 'output': ['113042\\r\\n1113044\\r\\n1113014\\r\\n1111112921\\r\\n3393\\r\\n11113123\\r\\n100042330\\r\\n10039790\\r\\n11112851\\r\\n109327\\r\\n11113210\\r\\n112940\\r\\n13374\\r\\n824097479\\r\\n90718\\r\\n1112944\\r\\n112883\\r\\n227955125\\r\\n29726\\r\\n11113300\\r\\n373423793\\r\\n10059555\\r\\n40539982\\r\\n100000262\\r\\n1000716486\\r\\n10040940\\r\\n100092502\\r\\n84551722\\r\\n931673356\\r\\n1000048103\\r\\n10000009\\r\\n1111113047\\r\\n111113101\\r\\n113132\\r\\n59665\\r\\n73538082\\r\\n11910636\\r\\n1000000378\\r\\n38020058\\r\\n100000064\\r\\n100002195\\r\\n1100351\\r\\n1111113035\\r\\n111113019\\r\\n10005403\\r\\n1000000797\\r\\n100009407\\r\\n13290\\r\\n256572\\r\\n10016397\\r\\n12264\\r\\n43223192\\r\\n111...']}, {'input': \"1000\\r\\nIAO'11113273\\r\\nIAO'8976\\r\\nIAO'53105\\r\\nIAO'00013993\\r\\nIAO'000008754\\r\\nIAO'111112944\\r\\nIAO'000894307\\r\\nIAO'113081\\r\\nIAO'036408696\\r\\nIAO'11003\\r\\nIAO'111113304\\r\\nIAO'8416526\\r\\nIAO'236018\\r\\nIAO'3722798\\r\\nIAO'00000010\\r\\nIAO'112873\\r\\nIAO'37450\\r\\nIAO'000099605\\r\\nIAO'80580\\r\\nIAO'88114\\r\\nIAO'005746722\\r\\nIAO'111112971\\r\\nIAO'13301\\r\\nIAO'00000051\\r\\nIAO'11113128\\r\\nIAO'111112899\\r\\nIAO'11112865\\r\\nIAO'1112879\\r\\nIAO'12917\\r\\nIAO'13253\\r\\nIAO'11113260\\r\\nIAO'111112989\\r\\nIAO'1113163\\r\\nIAO'1113109\\r\\nIAO'4037959\\r\\nIAO'113022\\r\\nIAO'13346\\r\\nIAO'0001790\\r\\nIAO'4932\\r...\", 'output': ['11113273\\r\\n8976\\r\\n53105\\r\\n100013993\\r\\n1000008754\\r\\n1111112944\\r\\n1000894307\\r\\n1113081\\r\\n1036408696\\r\\n111003\\r\\n111113304\\r\\n8416526\\r\\n236018\\r\\n3722798\\r\\n100000010\\r\\n1112873\\r\\n37450\\r\\n1000099605\\r\\n80580\\r\\n88114\\r\\n1005746722\\r\\n1111112971\\r\\n13301\\r\\n100000051\\r\\n11113128\\r\\n1111112899\\r\\n111112865\\r\\n11112879\\r\\n112917\\r\\n13253\\r\\n11113260\\r\\n1111112989\\r\\n1113163\\r\\n1113109\\r\\n4037959\\r\\n1113022\\r\\n13346\\r\\n10001790\\r\\n4932\\r\\n36672\\r\\n18257129\\r\\n4772891\\r\\n108046895\\r\\n10007697\\r\\n113338\\r\\n113094\\r\\n12653\\r\\n785110421\\r\\n10000594\\r\\n113265\\r\\n10566285\\r\\n111112882\\r\\n569331178\\r\\n1000398068...']}, {'input': \"1000\\r\\nIAO'11113341\\r\\nIAO'000004632\\r\\nIAO'1112875\\r\\nIAO'113306\\r\\nIAO'112878\\r\\nIAO'002666131\\r\\nIAO'21605282\\r\\nIAO'1888\\r\\nIAO'13010\\r\\nIAO'000643083\\r\\nIAO'0000052\\r\\nIAO'113111\\r\\nIAO'00916\\r\\nIAO'29776\\r\\nIAO'445127275\\r\\nIAO'113287\\r\\nIAO'111112865\\r\\nIAO'4903398\\r\\nIAO'3617746\\r\\nIAO'079220\\r\\nIAO'111113067\\r\\nIAO'680662260\\r\\nIAO'1113017\\r\\nIAO'12893\\r\\nIAO'1112903\\r\\nIAO'841512029\\r\\nIAO'113315\\r\\nIAO'536013\\r\\nIAO'6624475\\r\\nIAO'13314\\r\\nIAO'000003682\\r\\nIAO'271008325\\r\\nIAO'04004\\r\\nIAO'000000049\\r\\nIAO'12876\\r\\nIAO'000009305\\r\\nIAO'0051405\\r\\nIAO'11112988\\r\\nIAO'0000...\", 'output': ['11113341\\r\\n1000004632\\r\\n11112875\\r\\n113306\\r\\n1112878\\r\\n1002666131\\r\\n21605282\\r\\n11888\\r\\n113010\\r\\n1000643083\\r\\n10000052\\r\\n113111\\r\\n100916\\r\\n29776\\r\\n445127275\\r\\n113287\\r\\n1111112865\\r\\n4903398\\r\\n3617746\\r\\n1079220\\r\\n1111113067\\r\\n680662260\\r\\n11113017\\r\\n112893\\r\\n11112903\\r\\n841512029\\r\\n113315\\r\\n536013\\r\\n6624475\\r\\n13314\\r\\n1000003682\\r\\n271008325\\r\\n104004\\r\\n1000000049\\r\\n112876\\r\\n1000009305\\r\\n10051405\\r\\n111112988\\r\\n100000087\\r\\n675909060\\r\\n316729520\\r\\n111113222\\r\\n8017601\\r\\n1111112992\\r\\n1113282\\r\\n100003907\\r\\n111113089\\r\\n11113002\\r\\n1112856\\r\\n5004571\\r\\n1113135\\r\\n1113217\\r\\n10...']}, {'input': \"1000\\r\\nIAO'5864\\r\\nIAO'112961\\r\\nIAO'000001780\\r\\nIAO'959112\\r\\nIAO'751285866\\r\\nIAO'0000050\\r\\nIAO'00007045\\r\\nIAO'4884\\r\\nIAO'380539882\\r\\nIAO'11112876\\r\\nIAO'7999\\r\\nIAO'111112869\\r\\nIAO'3825105\\r\\nIAO'9596134\\r\\nIAO'511898\\r\\nIAO'5347\\r\\nIAO'678172\\r\\nIAO'11112902\\r\\nIAO'111112873\\r\\nIAO'230800781\\r\\nIAO'8315\\r\\nIAO'11113216\\r\\nIAO'111113179\\r\\nIAO'052538046\\r\\nIAO'28240898\\r\\nIAO'000052957\\r\\nIAO'46208212\\r\\nIAO'196482\\r\\nIAO'71561148\\r\\nIAO'13139\\r\\nIAO'99827216\\r\\nIAO'000006898\\r\\nIAO'111113280\\r\\nIAO'113198\\r\\nIAO'000000592\\r\\nIAO'15005515\\r\\nIAO'017905\\r\\nIAO'13057\\r\\nIAO'...\", 'output': ['5864\\r\\n1112961\\r\\n1000001780\\r\\n959112\\r\\n751285866\\r\\n10000050\\r\\n100007045\\r\\n4884\\r\\n380539882\\r\\n111112876\\r\\n7999\\r\\n1111112869\\r\\n3825105\\r\\n9596134\\r\\n511898\\r\\n5347\\r\\n678172\\r\\n111112902\\r\\n1111112873\\r\\n230800781\\r\\n8315\\r\\n11113216\\r\\n111113179\\r\\n1052538046\\r\\n28240898\\r\\n1000052957\\r\\n46208212\\r\\n196482\\r\\n71561148\\r\\n13139\\r\\n99827216\\r\\n1000006898\\r\\n111113280\\r\\n113198\\r\\n1000000592\\r\\n15005515\\r\\n1017905\\r\\n113057\\r\\n1000406356\\r\\n10003323\\r\\n100005873\\r\\n48523888\\r\\n652368767\\r\\n1111113085\\r\\n10000508\\r\\n29819248\\r\\n100051354\\r\\n13159\\r\\n1000002187\\r\\n100031843\\r\\n236640073\\r\\n1000324050...']}, {'input': \"1000\\r\\nIAO'361770\\r\\nIAO'113005\\r\\nIAO'62083\\r\\nIAO'488606266\\r\\nIAO'0009107\\r\\nIAO'630923497\\r\\nIAO'000384651\\r\\nIAO'000000084\\r\\nIAO'0000452\\r\\nIAO'99608\\r\\nIAO'12129598\\r\\nIAO'111113174\\r\\nIAO'3486032\\r\\nIAO'00004501\\r\\nIAO'13058\\r\\nIAO'3271\\r\\nIAO'429137139\\r\\nIAO'810623070\\r\\nIAO'11113320\\r\\nIAO'566635279\\r\\nIAO'45462780\\r\\nIAO'112950\\r\\nIAO'8974\\r\\nIAO'1113211\\r\\nIAO'857197\\r\\nIAO'20622\\r\\nIAO'1112852\\r\\nIAO'00000054\\r\\nIAO'7075\\r\\nIAO'000893242\\r\\nIAO'458282728\\r\\nIAO'00007225\\r\\nIAO'749922761\\r\\nIAO'414594056\\r\\nIAO'0000102\\r\\nIAO'1113243\\r\\nIAO'00000073\\r\\nIAO'86119\\r\\nIAO...\", 'output': ['361770\\r\\n1113005\\r\\n62083\\r\\n488606266\\r\\n10009107\\r\\n630923497\\r\\n1000384651\\r\\n1000000084\\r\\n10000452\\r\\n99608\\r\\n12129598\\r\\n111113174\\r\\n3486032\\r\\n100004501\\r\\n113058\\r\\n3271\\r\\n429137139\\r\\n810623070\\r\\n11113320\\r\\n566635279\\r\\n45462780\\r\\n1112950\\r\\n8974\\r\\n1113211\\r\\n857197\\r\\n20622\\r\\n11112852\\r\\n100000054\\r\\n7075\\r\\n1000893242\\r\\n458282728\\r\\n100007225\\r\\n749922761\\r\\n414594056\\r\\n10000102\\r\\n1113243\\r\\n100000073\\r\\n86119\\r\\n10000663\\r\\n111113030\\r\\n80729821\\r\\n1113171\\r\\n9585546\\r\\n6474731\\r\\n111113281\\r\\n625883\\r\\n10003487\\r\\n1112893\\r\\n10004783\\r\\n8631847\\r\\n956537242\\r\\n11112953\\r\\n112864\\r\\n111...']}, {'input': \"1000\\r\\nIAO'56561116\\r\\nIAO'3195\\r\\nIAO'3617\\r\\nIAO'78233\\r\\nIAO'2088\\r\\nIAO'3763841\\r\\nIAO'13106\\r\\nIAO'5569\\r\\nIAO'11113132\\r\\nIAO'025391206\\r\\nIAO'773411423\\r\\nIAO'201748\\r\\nIAO'681772\\r\\nIAO'000000028\\r\\nIAO'1112863\\r\\nIAO'111112973\\r\\nIAO'16199\\r\\nIAO'11113099\\r\\nIAO'11113208\\r\\nIAO'53704746\\r\\nIAO'000000095\\r\\nIAO'111113204\\r\\nIAO'35462186\\r\\nIAO'12534514\\r\\nIAO'5833\\r\\nIAO'111113306\\r\\nIAO'112924\\r\\nIAO'000098261\\r\\nIAO'1113232\\r\\nIAO'31711\\r\\nIAO'0006799\\r\\nIAO'016878\\r\\nIAO'000047489\\r\\nIAO'1113116\\r\\nIAO'289357641\\r\\nIAO'113072\\r\\nIAO'0002934\\r\\nIAO'811655\\r\\nIAO'1089\\r\\nIAO...\", 'output': ['56561116\\r\\n3195\\r\\n3617\\r\\n78233\\r\\n12088\\r\\n3763841\\r\\n13106\\r\\n5569\\r\\n11113132\\r\\n1025391206\\r\\n773411423\\r\\n201748\\r\\n681772\\r\\n1000000028\\r\\n11112863\\r\\n1111112973\\r\\n16199\\r\\n11113099\\r\\n11113208\\r\\n53704746\\r\\n1000000095\\r\\n111113204\\r\\n35462186\\r\\n12534514\\r\\n5833\\r\\n111113306\\r\\n1112924\\r\\n1000098261\\r\\n1113232\\r\\n31711\\r\\n10006799\\r\\n1016878\\r\\n1000047489\\r\\n1113116\\r\\n289357641\\r\\n1113072\\r\\n10002934\\r\\n811655\\r\\n11089\\r\\n111112909\\r\\n247845626\\r\\n11113267\\r\\n328961645\\r\\n8604\\r\\n11112885\\r\\n100005524\\r\\n87071\\r\\n113313\\r\\n523148\\r\\n1112947\\r\\n11113147\\r\\n962252\\r\\n508616450\\r\\n11113204\\r\\n13338\\r\\n768...']}, {'input': \"936\\r\\nIAO'111112878\\r\\nIAO'1113081\\r\\nIAO'9634\\r\\nIAO'3340\\r\\nIAO'13318\\r\\nIAO'9252\\r\\nIAO'59349\\r\\nIAO'00000044\\r\\nIAO'13188\\r\\nIAO'2183251\\r\\nIAO'64419\\r\\nIAO'1113077\\r\\nIAO'7268\\r\\nIAO'11113017\\r\\nIAO'02144\\r\\nIAO'00098647\\r\\nIAO'1112994\\r\\nIAO'640859\\r\\nIAO'28931364\\r\\nIAO'113138\\r\\nIAO'62075\\r\\nIAO'000006092\\r\\nIAO'39337604\\r\\nIAO'501806880\\r\\nIAO'1113280\\r\\nIAO'113026\\r\\nIAO'9453624\\r\\nIAO'000004581\\r\\nIAO'237141\\r\\nIAO'00036975\\r\\nIAO'7058492\\r\\nIAO'048767\\r\\nIAO'958601\\r\\nIAO'112890\\r\\nIAO'8500800\\r\\nIAO'112900\\r\\nIAO'11113039\\r\\nIAO'000045541\\r\\nIAO'1112872\\r\\nIAO'111112886\\r...\", 'output': ['1111112878\\r\\n11113081\\r\\n9634\\r\\n3340\\r\\n13318\\r\\n9252\\r\\n59349\\r\\n100000044\\r\\n13188\\r\\n2183251\\r\\n64419\\r\\n11113077\\r\\n7268\\r\\n111113017\\r\\n102144\\r\\n100098647\\r\\n11112994\\r\\n640859\\r\\n28931364\\r\\n113138\\r\\n62075\\r\\n1000006092\\r\\n39337604\\r\\n501806880\\r\\n1113280\\r\\n1113026\\r\\n9453624\\r\\n1000004581\\r\\n237141\\r\\n100036975\\r\\n7058492\\r\\n1048767\\r\\n958601\\r\\n1112890\\r\\n8500800\\r\\n1112900\\r\\n111113039\\r\\n1000045541\\r\\n11112872\\r\\n1111112886\\r\\n11113233\\r\\n16735873\\r\\n7685\\r\\n1000000315\\r\\n77258\\r\\n113295\\r\\n112920\\r\\n111113042\\r\\n1109736490\\r\\n100006347\\r\\n1004729286\\r\\n912241097\\r\\n1113062\\r\\n1113060\\r\\n15631113\\r...']}, {'input': \"1\\r\\nIAO'111110\\r\\n\", 'output': ['1111110']}, {'input': \"2\\r\\nIAO'0\\r\\nIAO'00\\r\\n\", 'output': ['1990\\r\\n2000']}, {'input': \"1\\r\\nIAO'111111\\r\\n\", 'output': ['1111111']}, {'input': \"1\\r\\nIAO'111111111\\r\\n\", 'output': ['1111111111']}, {'input': \"1\\r\\nIAO'001\\r\\n\", 'output': ['3001']}, {'input': \"1\\r\\nIAO'2000\\r\\n\", 'output': ['12000']}, {'input': \"1\\r\\nIAO'11109999\\r\\n\", 'output': ['111109999']}, {'input': \"1\\r\\nIAO'11111\\r\\n\", 'output': ['111111']}, {'input': \"1\\r\\nIAO'100000\\r\\n\", 'output': ['1100000']}, {'input': \"1\\r\\nIAO'18999990\\r\\n\", 'output': ['18999990']}, {'input': \"1\\r\\nIAO'113098\\r\\n\", 'output': ['1113098']}, {'input': \"1\\r\\nIAO'111122\\r\\n\", 'output': ['1111122']}, {'input': \"1\\r\\nIAO'1110222\\r\\n\", 'output': ['11110222']}, {'input': \"1\\r\\nIAO'11133333\\r\\n\", 'output': ['11133333']}, {'input': \"1\\r\\nIAO'000000000\\r\\n\", 'output': ['1000000000']}, {'input': \"4\\r\\nIAO'3098\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['13098\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1\\r\\nIAO'11100000\\r\\n\", 'output': ['111100000']}, {'input': \"2\\r\\nIAO'15\\r\\nIAO'15\\r\\n\", 'output': ['2015\\r\\n2015']}, {'input': \"1\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999']}, {'input': \"63\\r\\nIAO'099999999\\r\\nIAO'999999999\\r\\nIAO'111113098\\r\\nIAO'111113099\\r\\nIAO'11113098\\r\\nIAO'11113099\\r\\nIAO'1113098\\r\\nIAO'1113099\\r\\nIAO'113098\\r\\nIAO'113099\\r\\nIAO'13098\\r\\nIAO'13099\\r\\nIAO'3098\\r\\nIAO'3099\\r\\nIAO'098\\r\\nIAO'099\\r\\nIAO'98\\r\\nIAO'99\\r\\nIAO'000000000\\r\\nIAO'000000001\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\nIAO'000000009\\r\\nIAO'01\\r\\nIAO'001\\r\\nIAO'0001\\r\\nIAO'02\\r\\nIAO'002\\r\\nIAO'0002\\r\\nIAO'03\\r\\nIAO'003\\r\\nIAO'0003\\r\\nIAO'0...\", 'output': ['1099999999\\r\\n999999999\\r\\n1111113098\\r\\n111113099\\r\\n111113098\\r\\n11113099\\r\\n11113098\\r\\n1113099\\r\\n1113098\\r\\n113099\\r\\n113098\\r\\n13099\\r\\n13098\\r\\n3099\\r\\n3098\\r\\n2099\\r\\n2098\\r\\n1999\\r\\n1000000000\\r\\n1000000001\\r\\n1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000\\r\\n1000000009\\r\\n2001\\r\\n3001\\r\\n10001\\r\\n2002\\r\\n3002\\r\\n10002\\r\\n2003\\r\\n3003\\r\\n10003\\r\\n2004\\r\\n3004\\r\\n10004\\r\\n2005\\r\\n3005\\r\\n10005\\r\\n2006\\r\\n3006\\r\\n10006\\r\\n2007\\r\\n3007\\r\\n10007\\r\\n2009\\r\\n3009\\r\\n10009']}, {'input': \"1\\r\\nIAO'1112121\\r\\n\", 'output': ['11112121']}, {'input': \"1\\r\\nIAO'111113098\\r\\n\", 'output': ['1111113098']}, {'input': \"1\\r\\nIAO'10005000\\r\\n\", 'output': ['110005000']}, {'input': \"1\\r\\nIAO'111378\\r\\n\", 'output': ['1111378']}, {'input': \"1\\r\\nIAO'112222\\r\\n\", 'output': ['1112222']}, {'input': \"1\\r\\nIAO'021113099\\r\\n\", 'output': ['1021113099']}, {'input': \"1\\r\\nIAO'123456789\\r\\n\", 'output': ['123456789']}, {'input': \"1\\r\\nIAO'000000001\\r\\n\", 'output': ['1000000001']}, {'input': \"1\\r\\nIAO'089\\r\\n\", 'output': ['3089']}, {'input': \"9\\r\\nIAO'0\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\n\", 'output': ['1990\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000']}, {'input': \"2\\r\\nIAO'999999999\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999\\r\\n999999999']}, {'input': \"1\\r\\nIAO'2015\\r\\n\", 'output': ['12015']}, {'input': \"1\\r\\nIAO'113097\\r\\n\", 'output': ['1113097']}, {'input': \"1\\r\\nIAO'11378\\r\\n\", 'output': ['111378']}]","id":274} {"difficulty":2200,"lang":"MS C#","lang_cluster":"C#","src_uid":"5215112549723fea3f2c1fe0049e0b2e","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _44d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void add(long pattern, int right, int n, HashSet vs)\n {\n \/\/vs.Inte\n vs.IntersectWith(generate(pattern, right, n));\n }\n\n static IEnumerable generate(long pattern, int right, int n)\n {\n var vs = Enumerable.Range(1, right).ToArray();\n\n yield return NewMethod(pattern, right, vs, n);\n\n while (true)\n {\n var can = false;\n for (int i = right - 1; i >= 0; i--)\n {\n var max = n - (right - 1 - i);\n if (vs[i] < max)\n {\n vs[i]++;\n for (int j = i + 1; j < right; j++)\n {\n vs[j] = vs[j - 1] + 1;\n }\n\n long sb = NewMethod(pattern, right, vs, n);\n\n yield return sb;\n can = true;\n break;\n }\n }\n\n if (!can)\n {\n break;\n }\n }\n \n }\n\n private static long NewMethod(long pattern, int right, int[] vs, int n)\n {\n var sb = 0L;\n for (int j = 0; j < n; j++)\n {\n sb |= (~((1L << j) & pattern));\n }\n\n for (int j = 0; j < right; j++)\n {\n sb &= ~(1L << (vs[j] - 1));\n sb |= (1L << (vs[j] - 1)) & pattern;\n \/\/sb[vs[j] - 1] = pattern[vs[j] - 1];\n }\n\n return sb;\n }\n\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var inter = new HashSet();\n\n for (int i = 0; i < m; i++)\n {\n var next = Console.ReadLine().Split(' ').ToArray();\n var line = next[0];\n var ct = int.Parse(next[1]);\n\n var pattern = 0L;\n for (int j = 0; j < n; j++)\n {\n if (line[j] == '1')\n {\n pattern |= (1L << j);\n }\n }\n\n if (i == 0)\n {\n var c = generate(pattern, ct, n).ToArray();\n \/\/foreach (var item in c)\n \/\/{\n \/\/ for (int j = 0; j < n; j++)\n \/\/ {\n \/\/ Console.Write(((1L << j) & item) != 0 ? '1' : '0');\n \/\/ }\n\n \/\/ Console.WriteLine();\n \/\/}\n\n inter.UnionWith(generate(pattern, ct, n));\n }\n else\n {\n add(pattern, ct, n, inter);\n }\n }\n\n Console.WriteLine(inter.Count);\n\n \/\/var n = readInt();\n \/\/var m = readInt();\n\n \/\/var a = readIntArray();\n \/\/var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n","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"],"human_solution":"\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace _44d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void add(long pattern, int right, int n, HashSet vs)\n {\n \/\/vs.Inte\n vs.IntersectWith(generate(pattern, right, n));\n }\n\n static IEnumerable generate(long pattern, int right, int n)\n {\n var vs = Enumerable.Range(1, right).ToArray();\n\n yield return NewMethod(pattern, right, vs, n);\n\n while (true)\n {\n var can = false;\n for (int i = right - 1; i >= 0; i--)\n {\n var max = n - (right - 1 - i);\n if (vs[i] < max)\n {\n vs[i]++;\n for (int j = i + 1; j < right; j++)\n {\n vs[j] = vs[j - 1] + 1;\n }\n\n var sb = NewMethod(pattern, right, vs, n);\n\n yield return sb;\n can = true;\n break;\n }\n }\n\n if (!can)\n {\n break;\n }\n }\n \n }\n\n private static long NewMethod(long pattern, int right, int[] vs, int n)\n {\n \/\/var init = getVal(pattern, n);\n\n var sb = 0L;\n for (int j = 0; j < n; j++)\n {\n \/\/var ff = getVal((~((1L << j) & pattern)), n);\n sb |= (((1L << j) & pattern));\n sb ^= (1L << j);\n }\n\n\n \/\/var after = getVal(sb, n);\n\n for (int j = 0; j < right; j++)\n {\n sb &= ~(1L << (vs[j] - 1));\n sb |= (1L << (vs[j] - 1)) & pattern;\n \/\/sb[vs[j] - 1] = pattern[vs[j] - 1];\n }\n\n \/\/var res = getVal(sb, n);\n \/\/return res;\n return sb;\n }\n\n static string getVal(long a, int n)\n {\n var sb = new StringBuilder();\n for (int j = 0; j < n; j++)\n {\n sb.Append(((1L << j) & a) != 0 ? '1' : '0');\n }\n\n return sb.ToString();\n }\n\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var inter = new HashSet();\n\n for (int i = 0; i < m; i++)\n {\n var next = Console.ReadLine().Split(' ').ToArray();\n var line = next[0];\n var ct = int.Parse(next[1]);\n\n var pattern = 0L;\n for (int j = 0; j < n; j++)\n {\n if (line[j] == '1')\n {\n pattern |= (1L << j);\n }\n }\n\n if (i == 0)\n {\n var c = generate(pattern, ct, n).ToArray();\n \/\/var c2 = generate(pattern, ct, n).ToArray();\n \/\/foreach (var item in c)\n \/\/{\n \/\/ for (int j = 0; j < n; j++)\n \/\/ {\n \/\/ Console.Write(((1L << j) & item) != 0 ? '1' : '0');\n \/\/ }\n\n \/\/ Console.WriteLine();\n \/\/}\n\n inter.UnionWith(c);\n }\n else\n {\n add(pattern, ct, n, inter);\n }\n }\n\n Console.WriteLine(inter.Count);\n\n \/\/var n = readInt();\n \/\/var m = readInt();\n\n \/\/var a = readIntArray();\n \/\/var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\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":275} {"difficulty":2500,"lang":"Mono C#","lang_cluster":"C#","src_uid":"5517efa2fc9362fdf342d32adac889f4","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n long[,] dp;\n long[] allLucky;\n long[] p10;\n int K;\n const long mod = 1000000007;\n void solve()\n {\n int Q = nextInt();\n K = nextInt();\n Do();\n for (int step = 1; step <= Q; step++)\n {\n string s = nextString();\n string t = nextString();\n long res = getStricklySmaller(t);\n res -= getStricklySmaller(s);\n if (isLucky(t))\n res++;\n res += mod;\n res %= mod;\n println(res);\n }\n\n }\n\n private long getStricklySmaller(string s)\n {\n int prev = -1;\n int d = 1001;\n long res = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int cur = 0; cur < s[i] - '0'; cur++)\n {\n if (cur == 0 && i == 0)\n continue;\n int nd = d;\n if ((cur == 4 || cur == 7) && prev != -1)\n nd = Math.Min(nd, i - prev);\n if (nd <= K)\n res += p10[s.Length - 1 - i];\n else\n {\n int nprev = i-prev;\n if (prev == -1)\n nprev = 1001;\n if (cur == 4 || cur == 7)\n nprev = 0;\n res += dp[nprev, s.Length - 1 - i];\n }\n res %= mod;\n }\n if (s[i] == '4' || s[i] == '7')\n {\n if (prev != -1)\n {\n d = Math.Min(d, i - prev);\n }\n prev = i;\n }\n }\n for (int i = 1; i < s.Length; i++)\n res = (res + allLucky[i]) % mod;\n return res;\n }\n void Do()\n {\n dp = new long[1002, 1002];\n allLucky = new long[1002];\n p10 = new long[1002];\n for (int i = 0; i < p10.Length; i++)\n {\n p10[i] = (i == 0) ? 1 : 10 * p10[i - 1] % mod;\n }\n for (int digits = 0; digits < p10.Length; digits++)\n for (int prev = 0; prev < p10.Length; prev++)\n {\n if (digits > 0)\n {\n long cur = 0;\n \/\/if lucky\n if (prev <= K - 1)\n {\n cur += 2*p10[digits - 1];\n }\n else\n {\n\n cur += dp[0, digits - 1];\n }\n \/\/end od luck\n \/\/not lucky\n cur += 8*dp[Math.Min(1001, prev + 1), digits - 1];\n \/\/end of not lucky\n dp[prev, digits] = cur % mod;\n }\n }\n for (int digits = 2; digits < p10.Length; digits++)\n {\n for (int first = 1; first <= 9; first++)\n {\n int prev = 1001;\n if (first == 4 || first == 7)\n {\n prev = 0;\n }\n allLucky[digits] = (allLucky[digits] + dp[prev, digits - 1]) % mod;\n }\n }\n\n }\n bool isLucky(string s)\n {\n int prev = -1;\n int d = 1001;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '4' || s[i] == '7')\n {\n if (prev != -1)\n {\n d = Math.Min(d, i - prev);\n }\n prev = i;\n }\n }\n return d <= K;\n }\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}","description":"Petya likes horse racing very much. Horses numbered from l to r take part in the races. Petya wants to evaluate the probability of victory; for some reason, to do that he needs to know the amount of nearly lucky horses' numbers. A nearly lucky number is an integer number that has at least two lucky digits the distance between which does not exceed k. Petya learned from some of his mates from Lviv that lucky digits are digits 4 and 7. The distance between the digits is the absolute difference between their positions in the number of a horse. For example, if k\u2009=\u20092, then numbers 412395497, 404, 4070400000070004007 are nearly lucky and numbers 4, 4123954997, 4007000040070004007 are not.Petya prepared t intervals [li,\u2009ri] and invented number k, common for all of them. Your task is to find how many nearly happy numbers there are in each of these segments. Since the answers can be quite large, output them modulo 1000000007 (109\u2009+\u20097).","input_specification":"The first line contains two integers t and k (1\u2009\u2264\u2009t,\u2009k\u2009\u2264\u20091000) \u2014 the number of segments and the distance between the numbers correspondingly. Next t lines contain pairs of integers li and ri (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009101000). All numbers are given without the leading zeroes. Numbers in each line are separated by exactly one space character.","output_specification":"Output t lines. In each line print one integer \u2014 the answer for the corresponding segment modulo 1000000007 (109\u2009+\u20097).","notes":"NoteIn the first sample, the four nearly lucky numbers are 44, 47, 74, 77.In the second sample, only 74 and 77 are in the given segment.","sample_inputs":["1 2\n1 100","1 2\n70 77","2 1\n1 20\n80 100"],"sample_outputs":["4","2","0\n0"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n long[,] dp;\n long[] allLucky;\n long[] p10;\n int K;\n const long mod = 1000000007;\n void solve()\n {\n int Q = nextInt();\n K = nextInt();\n Do();\n for (int step = 1; step <= Q; step++)\n {\n string s = nextString();\n string t = nextString();\n long res = getStricklySmaller(t);\n res -= getStricklySmaller(s);\n if (isLucky(t))\n res++;\n res += mod;\n res %= mod;\n println(res);\n }\n\n }\n\n private long getStricklySmaller(string s)\n {\n int prev = -1;\n int d = 1001;\n long res = 0;\n for (int i = 0; i < s.Length; i++)\n {\n for (int cur = 0; cur < s[i] - '0'; cur++)\n {\n if (cur == 0 && i == 0)\n continue;\n int nd = d;\n if ((cur == 4 || cur == 7) && prev != -1)\n nd = Math.Min(nd, i - prev);\n if (nd <= K)\n res += p10[s.Length - 1 - i];\n else\n {\n int nprev = i-prev;\n if (prev == -1)\n nprev = 1001;\n if (cur == 4 || cur == 7)\n nprev = 0;\n res += dp[nprev, s.Length - 1 - i];\n }\n res %= mod;\n }\n if (s[i] == '4' || s[i] == '7')\n {\n if (prev != -1)\n {\n d = Math.Min(d, i - prev);\n }\n prev = i;\n }\n }\n for (int i = 1; i < s.Length; i++)\n res = (res + allLucky[i]) % mod;\n return res;\n }\n void Do()\n {\n dp = new long[1002, 1002];\n allLucky = new long[1002];\n p10 = new long[1002];\n for (int i = 0; i < p10.Length; i++)\n {\n p10[i] = (i == 0) ? 1 : 10 * p10[i - 1] % mod;\n }\n for (int digits = 0; digits < p10.Length; digits++)\n for (int prev = 0; prev < p10.Length; prev++)\n {\n if (digits > 0)\n {\n long cur = 0;\n \/\/if lucky\n if (prev <= K - 1)\n {\n cur += 2*p10[digits - 1];\n }\n else\n {\n\n cur += 2*dp[0, digits - 1];\n }\n \/\/end od luck\n \/\/not lucky\n cur += 8*dp[Math.Min(1001, prev + 1), digits - 1];\n \/\/end of not lucky\n dp[prev, digits] = cur % mod;\n }\n }\n for (int digits = 2; digits < p10.Length; digits++)\n {\n for (int first = 1; first <= 9; first++)\n {\n int prev = 1001;\n if (first == 4 || first == 7)\n {\n prev = 0;\n }\n allLucky[digits] = (allLucky[digits] + dp[prev, digits - 1]) % mod;\n }\n }\n\n }\n bool isLucky(string s)\n {\n int prev = -1;\n int d = 1001;\n for (int i = 0; i < s.Length; i++)\n {\n if (s[i] == '4' || s[i] == '7')\n {\n if (prev != -1)\n {\n d = Math.Min(d, i - prev);\n }\n prev = i;\n }\n }\n return d <= K;\n }\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n return int.Parse(nextString());\n }\n long nextLong()\n {\n return long.Parse(nextString());\n }\n double nextDouble()\n {\n return double.Parse(nextString());\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}","testcases":"[{'input': '1 2\\r\\n1 100\\r\\n', 'output': ['4']}, {'input': '1 2\\r\\n70 77\\r\\n', 'output': ['2']}, {'input': '2 1\\r\\n1 20\\r\\n80 100\\r\\n', 'output': ['0\\r\\n0']}, {'input': '4 1\\r\\n1 100\\r\\n47 74\\r\\n99 100\\r\\n100 100\\r\\n', 'output': ['4\\r\\n2\\r\\n0\\r\\n0']}, {'input': '4 2\\r\\n1 1000\\r\\n477 1000\\r\\n1 747\\r\\n1 400\\r\\n', 'output': ['104\\r\\n59\\r\\n76\\r\\n16']}, {'input': '7 3\\r\\n1 1000\\r\\n47 958\\r\\n7548 9665\\r\\n1 1\\r\\n1 10\\r\\n369 852\\r\\n759 1000\\r\\n', 'output': ['104\\r\\n101\\r\\n390\\r\\n0\\r\\n0\\r\\n84\\r\\n24']}, {'input': '5 3\\r\\n6 52\\r\\n5 925\\r\\n3 505\\r\\n8 7729\\r\\n3 152\\r\\n', 'output': ['2\\r\\n100\\r\\n52\\r\\n1458\\r\\n6']}, {'input': '5 3\\r\\n5 36\\r\\n96 483264\\r\\n1 983\\r\\n410 4704\\r\\n459 441883\\r\\n', 'output': ['0\\r\\n140734\\r\\n104\\r\\n719\\r\\n114168']}, {'input': '10 1\\r\\n4487142 7207579446\\r\\n6 46386141\\r\\n943 85570\\r\\n18945 7485692032\\r\\n29 436337\\r\\n7947 616330\\r\\n45 3950\\r\\n1 886\\r\\n2391 37228988\\r\\n6 21756778\\r\\n', 'output': ['906531650\\r\\n9598004\\r\\n11882\\r\\n35716254\\r\\n57612\\r\\n96431\\r\\n285\\r\\n68\\r\\n7116744\\r\\n4150143']}, {'input': '10 6\\r\\n7 6532058\\r\\n9 38624\\r\\n17 862\\r\\n416 55370946\\r\\n5647413166 28615817435\\r\\n2 18095568006\\r\\n1287 54609229\\r\\n62458397 506415804\\r\\n747747 6916453934\\r\\n80786 111516\\r\\n', 'output': ['2639010\\r\\n7080\\r\\n98\\r\\n26522320\\r\\n505138899\\r\\n647939898\\r\\n26129986\\r\\n242512922\\r\\n954836827\\r\\n5487']}, {'input': '10 7\\r\\n7 34155917\\r\\n38812 310100504778406\\r\\n15 917\\r\\n5 1582537\\r\\n401 13795918\\r\\n32336 880713849217074095\\r\\n98 8204188017\\r\\n97 536883229\\r\\n7317 3741445\\r\\n8778048 940605899097749\\r\\n', 'output': ['14181312\\r\\n50239361\\r\\n100\\r\\n539876\\r\\n5556336\\r\\n169911076\\r\\n30612285\\r\\n293176508\\r\\n1282623\\r\\n674446984']}, {'input': '47 4\\r\\n79879514 8056369445720958130\\r\\n2 126\\r\\n9519281086115475339974091 457582591210169520014799048\\r\\n76 3459248878\\r\\n62819150826252284677955 25111261380060754196049119709\\r\\n1636611800860389133 1635934416787325842831911204\\r\\n518674227733829430263 805498780575405...', 'output': ['103685631\\r\\n4\\r\\n682073745\\r\\n651864293\\r\\n129712878\\r\\n973288796\\r\\n509010657\\r\\n141308964\\r\\n355153757\\r\\n635629792\\r\\n360313275\\r\\n736264027\\r\\n370425054\\r\\n235174890\\r\\n295277\\r\\n763428048\\r\\n616611812\\r\\n144044377\\r\\n828885625\\r\\n809573179\\r\\n594585768\\r\\n524670373\\r\\n1491511\\r\\n795988895\\r\\n9654...']}, {'input': '47 46\\r\\n50982873440200877073923 47586881561360156422409719633028\\r\\n36351 625159959025063586611\\r\\n8588161348845 8422623864381302004101586\\r\\n3048205459742956264832921 782052445682468607819532251896514169512\\r\\n884 624848351569477099580\\r\\n404261862450126 1545134312...', 'output': ['137471542\\r\\n536188666\\r\\n990099257\\r\\n223246987\\r\\n518424121\\r\\n790019927\\r\\n0\\r\\n314709275\\r\\n299215570\\r\\n195622552\\r\\n127068425\\r\\n805537614\\r\\n397952014\\r\\n19391218\\r\\n667005308\\r\\n573216379\\r\\n480562936\\r\\n428901217\\r\\n97963581\\r\\n592095030\\r\\n556488151\\r\\n765508930\\r\\n224466158\\r\\n844281842\\r\\n1...']}, {'input': '50 128\\r\\n673371126998923924 14577759444023841393174656455694304271543\\r\\n73713867948 646215144713071362576\\r\\n398875012350579219712018105970241013 2940880024545502340850613176852440743934602811164857521142012617476342\\r\\n4690344341754442374 354513249570729825979...', 'output': ['941049434\\r\\n762136568\\r\\n434066853\\r\\n451504813\\r\\n213930829\\r\\n871165560\\r\\n679300721\\r\\n789329812\\r\\n266223738\\r\\n42030718\\r\\n287265478\\r\\n917645170\\r\\n252638838\\r\\n945912395\\r\\n532119522\\r\\n597031701\\r\\n468646846\\r\\n245823319\\r\\n234317895\\r\\n327419686\\r\\n830146556\\r\\n726505646\\r\\n662749763\\r\\n2\\r\\n...']}, {'input': '5 2\\r\\n5200872906247014205 533067349587160792484950471343906362224089656940635762454564543854165778198276536311103412901871833165320\\r\\n30050 768441194002833756950398102088709464240002476497683277779020056979350565141319541961600686883453799399167443445233352...', 'output': ['370479029\\r\\n524332375\\r\\n530784717\\r\\n654517810\\r\\n724843538']}, {'input': '74 1000\\r\\n54090659878106085612617625077840318946118533494621577722924503089530714570220744482400099688560981343692556667625487623731923270972079149853265661110506210725335572743074415205831706934387733189835771007038394405255793258145 612791173047551808218...', 'output': ['287326246\\r\\n893403286\\r\\n166597527\\r\\n117571778\\r\\n250334373\\r\\n386234612\\r\\n502304719\\r\\n912253997\\r\\n450258428\\r\\n306538100\\r\\n211576513\\r\\n701230200\\r\\n914518657\\r\\n413032718\\r\\n368140265\\r\\n690050153\\r\\n14978275\\r\\n962200019\\r\\n509274465\\r\\n750512912\\r\\n140981541\\r\\n172269012\\r\\n639776139\\r\\n650...']}, {'input': '100 1000\\r\\n47017998721799493186953715462412311325362186706201073092838487129685962780740116619576638108657367153997717872269928108207598932035299453800501587208458984112826061130513208105759579961356458124142257659189902140473490945242267478229516217999840...', 'output': ['694235288\\r\\n655159\\r\\n527877261\\r\\n108844083\\r\\n803379557\\r\\n25444732\\r\\n550179261\\r\\n466788542\\r\\n961330902\\r\\n210081108\\r\\n129537551\\r\\n902346623\\r\\n666637415\\r\\n849500352\\r\\n942036799\\r\\n285594485\\r\\n48718047\\r\\n681848486\\r\\n641198914\\r\\n728171639\\r\\n183816624\\r\\n241025664\\r\\n983382313\\r\\n2737263...']}, {'input': '1000 1000\\r\\n6703359656511787714613759300061239958554498294808125383601606992582734272612079085351685434223992375515937547640394672068 43365322998954978669453636624549867502002455767118463635591957219180981801488752115637087424192781090286876562655524553150...', 'output': ['370644302\\r\\n314970758\\r\\n259187596\\r\\n682200082\\r\\n415715573\\r\\n847847254\\r\\n130236136\\r\\n7878839\\r\\n803352602\\r\\n357900063\\r\\n987084580\\r\\n877841653\\r\\n634595019\\r\\n475209249\\r\\n53303839\\r\\n687437914\\r\\n517804107\\r\\n619080455\\r\\n483935549\\r\\n666277740\\r\\n918916343\\r\\n236754757\\r\\n579376630\\r\\n88304...']}, {'input': '500 1000\\r\\n136999961057 1145730293579368681077\\r\\n3774254056262307165205440792348798676030635821971881858065730935171137385826556618200513897023963909942218758760643836611242462599475144694313535136373283218036005947136378410863565638100048963808973285757528...', 'output': ['593296691\\r\\n67989761\\r\\n326742828\\r\\n81377267\\r\\n804982346\\r\\n574021211\\r\\n855426812\\r\\n486956321\\r\\n994358664\\r\\n833544262\\r\\n526032515\\r\\n836294867\\r\\n297311404\\r\\n801154834\\r\\n598961368\\r\\n960898014\\r\\n681500673\\r\\n716193091\\r\\n62946222\\r\\n346441247\\r\\n218815739\\r\\n792061118\\r\\n6270707\\r\\n2271186...']}, {'input': '744 985\\r\\n122373431966200024509203522336732390540478248278667207616615011222045588459608379144315994773912797972175088471172702549735073638874189402726203707670043377836523385178276228465668053222946270209091371703490387660603505797203168518684862662858966...', 'output': ['931773615\\r\\n935562295\\r\\n639369229\\r\\n325814821\\r\\n643063131\\r\\n260641895\\r\\n694478330\\r\\n415246004\\r\\n193358287\\r\\n175891030\\r\\n726684981\\r\\n136116594\\r\\n376453974\\r\\n588890526\\r\\n924800921\\r\\n540498369\\r\\n872913564\\r\\n601772975\\r\\n825471302\\r\\n563742602\\r\\n657397444\\r\\n923771900\\r\\n678960200\\r\\n29...']}, {'input': '777 1\\r\\n45185234454632355698117803901418961346534819543650876280771229813636863357841487970153821039827507974163615147955909182235308592438334146848447382994204246063455483980445145746525568174167904518753227670992070726417857492770274967716426162039971629...', 'output': ['863022728\\r\\n293232833\\r\\n99795501\\r\\n263876775\\r\\n667645842\\r\\n492908462\\r\\n240718795\\r\\n940081938\\r\\n476053761\\r\\n297512842\\r\\n120281642\\r\\n679578864\\r\\n994104081\\r\\n543803632\\r\\n364043241\\r\\n48403213\\r\\n415204496\\r\\n731648222\\r\\n229717202\\r\\n4289680\\r\\n308053347\\r\\n729685613\\r\\n913145509\\r\\n578203...']}, {'input': '5 2\\r\\n12120227 12120227\\r\\n4 4\\r\\n1964 1964\\r\\n16097 16097\\r\\n6 6\\r\\n', 'output': ['0\\r\\n0\\r\\n0\\r\\n0\\r\\n0']}, {'input': '10 7\\r\\n7379566148381437993085959846884977899225525255602 7379566148381437993085959846884977899225525255602\\r\\n2198 2198\\r\\n3386773765704053573455076894 3386773765704053573455076894\\r\\n163936985340191203925655450462323485480169185605 16393698534019120392565545046...', 'output': ['1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1']}, {'input': '477 74\\r\\n7470779420021223788095546267161 7470779420021223788095546267161\\r\\n88338148842143171153384975844564986905674900218625080046245753126578075346974210710019837699009964597768396638914657671828868268585005516349996130474618500287835074231479563543662615...', 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\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': '5 7\\r\\n63369 66178\\r\\n7563308496 7636263399\\r\\n460805701238 460951568690\\r\\n795 909\\r\\n79 96\\r\\n', 'output': ['690\\r\\n53314840\\r\\n97191750\\r\\n5\\r\\n0']}, {'input': '50 7\\r\\n28185265011310759096051557087112036971005717056447940153701531810665365288681240574546645702088962158754197125497881742821625140102096251549438669612339517930513583314834166922977693804274515575129690527734989399629831949 281852650113167537861041385...', 'output': ['258979616\\r\\n16534074\\r\\n937474835\\r\\n912112774\\r\\n202605767\\r\\n267288165\\r\\n382780567\\r\\n359389951\\r\\n576522444\\r\\n55792117\\r\\n663765411\\r\\n63141314\\r\\n0\\r\\n637589529\\r\\n1\\r\\n249563298\\r\\n861273516\\r\\n509569115\\r\\n433954\\r\\n463165788\\r\\n13368170\\r\\n64435275\\r\\n774201585\\r\\n925882467\\r\\n863554991\\r\\n2\\r\\n3...']}, {'input': '747 74\\r\\n9034831781384317173161927744049401542881765253419296693598 9034831781384317173161927744049401542881766580170673612790\\r\\n31196591701440362097468521574393373658500957524893651731758355883436115882418258507736324371513275478999582592547169039428528877...', 'output': ['367631936\\r\\n55353695\\r\\n208654\\r\\n654592875\\r\\n378114474\\r\\n665094357\\r\\n30858628\\r\\n537875246\\r\\n232834104\\r\\n607343812\\r\\n24278\\r\\n806118641\\r\\n409\\r\\n321918524\\r\\n432248578\\r\\n968522782\\r\\n722530158\\r\\n256368434\\r\\n76\\r\\n698252413\\r\\n705984599\\r\\n439865233\\r\\n686873316\\r\\n683402621\\r\\n831910656\\r\\n58...']}, {'input': '1000 548\\r\\n352572272595335945187 352572272595399963958\\r\\n40282487528575010480026147416463096034791824207680864066680080867289131521623561114839331209383162108501381625214133169437895855967576852947691542827703130667183063314708886613387169715668373663450983...', 'output': ['64018772\\r\\n102201282\\r\\n538699982\\r\\n307395678\\r\\n415221340\\r\\n2566328\\r\\n877680390\\r\\n374781452\\r\\n710755733\\r\\n621748645\\r\\n836245942\\r\\n289270807\\r\\n527547466\\r\\n77639515\\r\\n775067160\\r\\n285783510\\r\\n171543819\\r\\n497433022\\r\\n655634255\\r\\n629636159\\r\\n958651596\\r\\n197916131\\r\\n444056691\\r\\n530913...']}, {'input': '20 6\\r\\n1 10\\r\\n1 100\\r\\n1 1000\\r\\n1 10000\\r\\n1 100000\\r\\n1 1000000\\r\\n1 10000000\\r\\n1 100000000\\r\\n1 1000000000\\r\\n1 10000000000\\r\\n1 10\\r\\n10 100\\r\\n100 1000\\r\\n1000 10000\\r\\n10000 100000\\r\\n100000 1000000\\r\\n1000000 10000000\\r\\n10000000 100000000\\r\\n100000000 1000000000\\r\\n1000000000000 1000...', 'output': ['0\\r\\n4\\r\\n104\\r\\n1808\\r\\n26272\\r\\n344640\\r\\n4232832\\r\\n48619776\\r\\n538626560\\r\\n839250397\\r\\n0\\r\\n4\\r\\n100\\r\\n1704\\r\\n24464\\r\\n318368\\r\\n3888192\\r\\n44386944\\r\\n490006784\\r\\n999174974']}, {'input': '1 1\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0']}, {'input': '1000 2\\r\\n1 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n853398792\\r\\n85...']}, {'input': '1000 774\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n572500042\\r\\n57...']}, {'input': '1 1\\r\\n1 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['380258531']}, {'input': '1000 2\\r\\n1 47747744477447774747474777444747447447744747747747774747747774444474474744447744747447474747774777477777774774477744777744747747744474447474777777477477744777747744744474444444747474744744774747744477777444444777777474474744744777744444747747474...', 'output': ['214069746\\r\\n163559900\\r\\n820313652\\r\\n463851106\\r\\n207718762\\r\\n511476810\\r\\n250502024\\r\\n268853848\\r\\n499333190\\r\\n624703783\\r\\n691494563\\r\\n660608060\\r\\n299708288\\r\\n522885469\\r\\n295777236\\r\\n4525867\\r\\n624334313\\r\\n484730950\\r\\n801197616\\r\\n539549285\\r\\n695611246\\r\\n599780307\\r\\n631044441\\r\\n3075...']}, {'input': '1000 7\\r\\n1 77447777477777777444747774777774744474477444774444447477744444774744777444744477444744774474477474447744744747747447747747777747447444444474477744444744747774474747477777747474774774474777474747477447777747747744477474474774744474477477747774444...', 'output': ['370736527\\r\\n734186257\\r\\n292488132\\r\\n93209722\\r\\n424133344\\r\\n352732065\\r\\n940528111\\r\\n504166073\\r\\n553080879\\r\\n291192581\\r\\n724238591\\r\\n283907169\\r\\n535950500\\r\\n347167267\\r\\n272627719\\r\\n426534504\\r\\n533277478\\r\\n610964551\\r\\n357554670\\r\\n424877314\\r\\n395273028\\r\\n284484136\\r\\n726088952\\r\\n311...']}, {'input': '5 1\\r\\n1 100000\\r\\n47 100000\\r\\n20 100000\\r\\n200 100000\\r\\n1000 100000\\r\\n', 'output': ['13472\\r\\n13471\\r\\n13472\\r\\n13464\\r\\n13400']}, {'input': '1000 1000\\r\\n1 47744477447774774774477444477747777777744777747474474747774747747744477744477774744744777444744474474774747474444444447444747744777447447474477474477744444777744774744747744747747744744477447744477777477477747774774474447447447774777744744777...', 'output': ['477283884\\r\\n526764656\\r\\n737568297\\r\\n412797329\\r\\n639039245\\r\\n565379181\\r\\n244872611\\r\\n575891152\\r\\n343293536\\r\\n481327180\\r\\n872427666\\r\\n672077532\\r\\n945861888\\r\\n307274437\\r\\n976464400\\r\\n147048560\\r\\n488144120\\r\\n564554791\\r\\n520409856\\r\\n448418522\\r\\n804390881\\r\\n925891575\\r\\n503793138\\r\\n61...']}, {'input': '1000 666\\r\\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...', 'output': ['917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n917913088\\r\\n91...']}, {'input': '1000 666\\r\\n77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...', '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\\n...']}, {'input': '1000 1\\r\\n1 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n380258531\\r\\n38...']}, {'input': '1000 400\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n623020686\\r\\n62...']}, {'input': '1000 600\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n199792575\\r\\n19...']}, {'input': '1000 500\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n185021071\\r\\n18...']}, {'input': '1000 900\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n867326441\\r\\n86...']}, {'input': '1000 998\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n870554565\\r\\n87...']}, {'input': '1000 999\\r\\n1 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n63...']}, {'input': '1000 1000\\r\\n1 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n630910843\\r\\n63...']}, {'input': '1000 1\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 2\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 400\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 600\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 500\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 900\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 998\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 999\\r\\n10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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': '1000 1000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['0\\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...']}]","id":276} {"difficulty":2400,"lang":"Mono C#","lang_cluster":"C#","src_uid":"566adc43d2d6df257c26c5f5495a5745","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\n\n\n\nclass Program\n{\n const long inf = int.MaxValue;\n\tvoid solve()\n\t{\n\n string[] s = Console.ReadLine().Split(' ');\n \n long b = 0;\n long c=0;\n foreach (char ch in s[2])\n {\n c = (10 * c + ch - '0');\n }\n foreach (char ch in s[0])\n b = (10 * b + ch - '0') % c;\n long ret = 1;\n long p = b;\n char[] t = s[1].ToCharArray();\n for (int i = t.Length - 1; i >= 0; i--)\n {\n if (t[i] == '0')\n t[i] = '9';\n else\n {\n t[i]--;\n break;\n }\n }\n for (int i = t.Length - 1; i >= 0; i--)\n {\n long np = 1;\n for (int j = 0; j < t[i] - '0'; j++)\n np = (np * p) % c;\n ret *= np;\n ret %= c;\n for (int j = t[i] - '0'; j <= '9'; j++)\n np = (p * np) % c;\n p = np;\n }\n ret = ret * (b - 1 + c) % c;\n if (ret == 0)\n ret = c;\n println(ret);\n\n\n\t}\n\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n\n\n\n\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n Console.WriteLine(Doublenum);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput(); \n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n new Program().solve();\n }\n}\n\n\n","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\u2009\u2264\u2009b\u2009<\u200910106, 1\u2009\u2264\u2009n\u2009<\u200910106, 1\u2009\u2264\u2009c\u2009\u2264\u2009109). 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.","output_specification":"In the only line output the amount of numbers written on the same page as the last number.","notes":"NoteIn 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.","sample_inputs":["2 3 3","2 3 4"],"sample_outputs":["1","4"],"human_solution":"using System;\nusing System.Diagnostics;\nusing System.Collections.Generic;\n\nnamespace A\n{\n class Program\n {\n public static void Main(string[] argv)\n {\n String[] s = Console.ReadLine().Split(' ');\n String b = s[0];\n String n = s[1];\n long c = long.Parse(s[2]);\n long bb = 0;\n foreach(char i in b){\n bb = (bb*10 + (int)(i - '0' ))%c;\n }\n long tbb = (bb + c - 1) % c;\n long ret = 1;\n long ki = bb;\n bool isan = true;\n for (int i = n.Length - 1; i >= 0; i--)\n {\n int nn = (int)(n[i]-'0');\n if (isan == true)\n {\n if (nn == 0)\n {\n nn = 9;\n }\n else\n {\n nn--;\n isan = false;\n }\n }\n for (int j = 0; j < nn; j++)\n {\n ret = (ret * ki) % c;\n }\n long nki = 1;\n for (int j = 0; j < 10; j++)\n {\n nki = (nki * ki) % c;\n }\n ki = nki;\n }\n \/\/Console.WriteLine(tbb + \" \" + ret + \" \" + bb);\n long count = (tbb * ret) % c;\n if (count == 0) count = c;\n Console.WriteLine(count);\n }\n }\n}\n","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":277} {"difficulty":1900,"lang":"Mono C#","lang_cluster":"C#","src_uid":"6214a85d2be0a908dcbfe089327cf51a","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n\n int n = nextInt();\n int m = nextInt();\n int k = nextInt();\n int[] x = new int[k];\n int[] y = new int[k];\n for (int i = 0; i < k; i++)\n {\n x[i] = nextInt();\n y[i] = nextInt();\n }\n string res = \"NO\";\n for (int i = 0; i < k; i++)\n if (can(x[i], y[i], n, m))\n res = \"YES\";\n println(res);\n }\n\n private bool can(int x, int y, int n, int m)\n {\n if (x <= 8 || y <= 8 || n - x + 1 <= 8 || m - y + 1 <= 8)\n return true;\n else\n return false;\n }\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}\n\n\n","description":"Volodya and Vlad play the following game. There are k pies at the cells of n\u2009\u2009\u00d7\u2009\u2009m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at the border of the board of length 1 (between two knots of the board) so that Volodya is not able to move the pie outside the board through this edge anymore. The question is: will Volodya win this game? We suppose both players follow the optimal strategy.","input_specification":"First line contains 3 integers, separated by space: 1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100 \u2014 dimensions of the board and 0\u2009\u2264\u2009k\u2009\u2264\u2009100 \u2014 the number of pies. Each of the next k lines contains 2 integers, separated by space: 1\u2009\u2264\u2009x\u2009\u2264\u2009n, 1\u2009\u2264\u2009y\u2009\u2264\u2009m \u2014 coordinates of the corresponding pie. There could be more than one pie at a cell. ","output_specification":"Output only one word: \"YES\" \u2014 if Volodya wins, \"NO\" \u2014 otherwise.","notes":null,"sample_inputs":["2 2 1\n1 2","3 4 0","100 50 2\n50 25\n50 25"],"sample_outputs":["YES","NO","NO"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round51\n{\n class C\n {\n public static void Main()\n {\n Scanner scanner = Scanner.FromConsole();\n int n = scanner.NextInt(), m = scanner.NextInt();\n int k = scanner.NextInt();\n int nearest = int.MaxValue;\n for (int i = 0; i < k; i++)\n {\n int x = scanner.NextInt(),\n y = scanner.NextInt();\n int minx = Math.Min(x, n - x + 1),\n miny = Math.Min(y, m - y + 1);\n nearest = Math.Min(nearest, Math.Min(minx, miny));\n }\n Console.WriteLine(nearest < 6 ? \"YES\" : \"NO\");\n }\n\n #region Scanner\n public class Scanner : IDisposable\n {\n const int MAX_BUFFER_SIZE = 1024 * 1024 * 16;\n const string DELIMITER = \" \\r\\n\\t\";\n\n System.IO.TextReader stream;\n int pos = 0, len = 0;\n bool endStream = false;\n int BufferSize = MAX_BUFFER_SIZE;\n char[] buffer = new char[MAX_BUFFER_SIZE];\n\n public enum Option { Buffering, NoBuffering }\n\n public Scanner(System.IO.TextReader stream, Option bufferingOption)\n {\n this.stream = stream;\n if (bufferingOption == Option.NoBuffering) BufferSize = 1;\n }\n\n void ReadBuffer()\n {\n pos = 0;\n len = stream.ReadBlock(buffer, 0, BufferSize);\n endStream = len == 0;\n }\n\n void SkipDelimiter()\n {\n while (!endStream && IsDelimiter(Peek())) NextChar();\n }\n\n static bool IsDelimiter(char c)\n {\n return DELIMITER.Contains(c);\n }\n\n bool Continue(char c)\n {\n return !endStream && !IsDelimiter(c);\n }\n\n char Peek()\n {\n if (pos >= len) ReadBuffer();\n return buffer[pos];\n }\n\n public char NextChar()\n {\n if (pos >= len) ReadBuffer();\n return buffer[pos++];\n }\n\n public string NextString()\n {\n SkipDelimiter();\n StringBuilder res = new StringBuilder();\n for (char c = NextChar(); Continue(c); c = NextChar()) res.Append(c);\n return res.ToString();\n }\n\n public int NextInt()\n {\n SkipDelimiter();\n int res = 0;\n char c = NextChar();\n int sign = 1;\n if (c == '-') { sign = -1; c = NextChar(); }\n for (; Continue(c); c = NextChar())\n res = res * 10 + (c - '0');\n return sign * res;\n }\n\n public long NextLong()\n {\n SkipDelimiter();\n long res = 0;\n char c = NextChar();\n long sign = 1;\n if (c == '-') { sign = -1; c = NextChar(); }\n for (; Continue(c); c = NextChar())\n res = res * 10 + (c - '0');\n return sign * res;\n }\n\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n\n public int[] NextInts(int n)\n {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) res[i] = NextInt();\n return res;\n }\n\n public long[] NextLongs(int n)\n {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) res[i] = NextLong();\n return res;\n }\n\n public double[] NextDoubles(int n)\n {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) res[i] = NextDouble();\n return res;\n }\n\n public string[] NextStrings(int n)\n {\n string[] res = new string[n];\n for (int i = 0; i < n; i++) res[i] = NextString();\n return res;\n }\n\n public static Scanner FromString(string s)\n {\n return new Scanner(new System.IO.StreamReader(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(s))), Option.Buffering);\n }\n\n public static Scanner FromFile(string path)\n {\n return new Scanner(new System.IO.StreamReader(path), Option.Buffering);\n }\n\n public static Scanner FromConsole()\n {\n return new Scanner(Console.In, Option.Buffering);\n }\n\n public void Dispose()\n {\n stream.Close();\n }\n }\n #endregion\n }\n}\n","testcases":"[{'input': '2 2 1\\r\\n1 2\\r\\n', 'output': ['YES']}, {'input': '3 4 0\\r\\n', 'output': ['NO']}, {'input': '100 50 2\\r\\n50 25\\r\\n50 25\\r\\n', 'output': ['NO']}, {'input': '20 20 4\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n', 'output': ['NO']}, {'input': '15 15 1\\r\\n8 8\\r\\n', 'output': ['NO']}, {'input': '8 8 2\\r\\n4 4\\r\\n5 5\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 96\\r\\n51 96\\r\\n', 'output': ['YES']}, {'input': '100 100 2\\r\\n50 95\\r\\n51 95\\r\\n', 'output': ['NO']}, {'input': '20 20 1\\r\\n16 10\\r\\n', 'output': ['YES']}, {'input': '20 20 4\\r\\n15 9\\r\\n15 10\\r\\n15 11\\r\\n15 12\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 6\\r\\n', 'output': ['NO']}, {'input': '11 11 1\\r\\n6 5\\r\\n', 'output': ['YES']}, {'input': '35 13 20\\r\\n13 8\\r\\n19 8\\r\\n24 7\\r\\n20 6\\r\\n23 7\\r\\n23 6\\r\\n30 7\\r\\n29 7\\r\\n7 7\\r\\n6 8\\r\\n9 8\\r\\n29 6\\r\\n20 7\\r\\n25 6\\r\\n19 6\\r\\n23 8\\r\\n26 6\\r\\n12 6\\r\\n15 7\\r\\n6 8\\r\\n', 'output': ['NO']}, {'input': '50 17 27\\r\\n17 8\\r\\n19 6\\r\\n25 8\\r\\n30 10\\r\\n22 10\\r\\n30 9\\r\\n25 8\\r\\n27 6\\r\\n19 7\\r\\n29 11\\r\\n39 8\\r\\n31 8\\r\\n39 8\\r\\n40 7\\r\\n11 8\\r\\n30 11\\r\\n32 8\\r\\n31 11\\r\\n36 12\\r\\n10 11\\r\\n32 8\\r\\n8 7\\r\\n7 12\\r\\n17 11\\r\\n27 7\\r\\n8 8\\r\\n23 12\\r\\n', 'output': ['NO']}, {'input': '24 29 22\\r\\n16 6\\r\\n14 22\\r\\n7 15\\r\\n11 17\\r\\n12 22\\r\\n10 13\\r\\n12 22\\r\\n12 13\\r\\n6 16\\r\\n12 21\\r\\n11 11\\r\\n9 13\\r\\n18 22\\r\\n7 20\\r\\n13 6\\r\\n6 14\\r\\n17 10\\r\\n9 13\\r\\n7 23\\r\\n14 11\\r\\n7 22\\r\\n8 12\\r\\n', 'output': ['NO']}, {'input': '32 45 3\\r\\n12 30\\r\\n27 9\\r\\n14 27\\r\\n', 'output': ['NO']}, {'input': '35 15 63\\r\\n6 6\\r\\n14 9\\r\\n7 6\\r\\n25 6\\r\\n25 8\\r\\n13 9\\r\\n18 7\\r\\n20 8\\r\\n30 10\\r\\n25 10\\r\\n7 7\\r\\n18 8\\r\\n11 10\\r\\n12 6\\r\\n8 8\\r\\n6 9\\r\\n21 9\\r\\n27 10\\r\\n28 8\\r\\n28 9\\r\\n7 9\\r\\n28 9\\r\\n10 10\\r\\n29 10\\r\\n25 8\\r\\n28 7\\r\\n22 6\\r\\n13 9\\r\\n14 7\\r\\n23 9\\r\\n20 8\\r\\n28 10\\r\\n22 7\\r\\n12 8\\r\\n13 7\\r\\n27 9\\r\\n17 8\\r\\n10 8\\r\\n19 10\\r\\n6 10\\r\\n26 6\\r\\n19 8\\r\\n28 9\\r\\n15 9\\r\\n14 7\\r\\n25 10\\r\\n17 8\\r\\n21 8\\r\\n29 6\\r\\n7 6\\r\\n16 10\\r\\n7 10\\r\\n25 7\\r\\n9 9\\r\\n30 9\\r\\n23 8\\r\\n28 8\\r\\n7 10\\r\\n12 6\\r\\n20 9\\r\\n24 8\\r\\n6 6\\r\\n26 7\\r\\n', 'output': ['NO']}, {'input': '41 50 37\\r\\n21 24\\r\\n20 32\\r\\n10 12\\r\\n35 7\\r\\n8 19\\r\\n30 22\\r\\n21 11\\r\\n35 12\\r\\n7 8\\r\\n16 10\\r\\n13 39\\r\\n6 43\\r\\n31 12\\r\\n16 14\\r\\n25 32\\r\\n27 21\\r\\n6 34\\r\\n22 26\\r\\n7 41\\r\\n18 13\\r\\n24 19\\r\\n9 44\\r\\n36 21\\r\\n17 16\\r\\n36 24\\r\\n6 31\\r\\n19 20\\r\\n12 19\\r\\n27 36\\r\\n6 31\\r\\n11 13\\r\\n19 9\\r\\n20 12\\r\\n25 25\\r\\n18 27\\r\\n17 36\\r\\n8 16\\r\\n', 'output': ['NO']}, {'input': '96 95 31\\r\\n14 23\\r\\n70 47\\r\\n11 77\\r\\n53 66\\r\\n63 87\\r\\n3 14\\r\\n57 44\\r\\n65 69\\r\\n80 74\\r\\n49 6\\r\\n57 86\\r\\n75 8\\r\\n2 32\\r\\n75 21\\r\\n14 51\\r\\n56 46\\r\\n77 6\\r\\n17 89\\r\\n87 3\\r\\n21 18\\r\\n70 67\\r\\n47 64\\r\\n13 47\\r\\n61 33\\r\\n56 30\\r\\n28 2\\r\\n65 18\\r\\n17 90\\r\\n44 77\\r\\n54 26\\r\\n32 70\\r\\n', 'output': ['YES']}, {'input': '80 51 47\\r\\n67 41\\r\\n74 7\\r\\n68 41\\r\\n6 2\\r\\n19 38\\r\\n37 28\\r\\n65 4\\r\\n6 25\\r\\n39 11\\r\\n19 34\\r\\n47 36\\r\\n62 26\\r\\n27 44\\r\\n70 45\\r\\n24 33\\r\\n41 2\\r\\n13 10\\r\\n3 17\\r\\n78 35\\r\\n53 46\\r\\n62 47\\r\\n33 17\\r\\n17 49\\r\\n2 3\\r\\n47 38\\r\\n72 35\\r\\n4 8\\r\\n32 21\\r\\n52 43\\r\\n67 12\\r\\n28 22\\r\\n53 34\\r\\n36 11\\r\\n45 45\\r\\n32 12\\r\\n5 11\\r\\n6 3\\r\\n55 21\\r\\n73 4\\r\\n55 21\\r\\n36 13\\r\\n48 18\\r\\n19 8\\r\\n70 24\\r\\n43 45\\r\\n59 50\\r\\n58 7\\r\\n', 'output': ['YES']}, {'input': '25 92 38\\r\\n21 36\\r\\n20 18\\r\\n9 29\\r\\n18 77\\r\\n10 58\\r\\n10 39\\r\\n5 3\\r\\n21 51\\r\\n11 78\\r\\n16 32\\r\\n24 71\\r\\n15 17\\r\\n23 23\\r\\n25 59\\r\\n18 57\\r\\n11 2\\r\\n16 35\\r\\n1 47\\r\\n20 59\\r\\n19 54\\r\\n11 55\\r\\n4 33\\r\\n15 41\\r\\n17 18\\r\\n16 67\\r\\n4 15\\r\\n5 23\\r\\n3 24\\r\\n20 70\\r\\n5 87\\r\\n11 1\\r\\n23 66\\r\\n21 83\\r\\n2 32\\r\\n17 22\\r\\n2 26\\r\\n16 42\\r\\n24 15\\r\\n', 'output': ['YES']}, {'input': '67 41 68\\r\\n35 16\\r\\n66 14\\r\\n1 15\\r\\n43 6\\r\\n26 17\\r\\n30 13\\r\\n42 11\\r\\n32 20\\r\\n66 14\\r\\n15 35\\r\\n35 6\\r\\n12 11\\r\\n25 9\\r\\n39 37\\r\\n31 14\\r\\n52 11\\r\\n4 32\\r\\n17 14\\r\\n32 1\\r\\n58 31\\r\\n30 20\\r\\n7 23\\r\\n13 3\\r\\n27 25\\r\\n60 27\\r\\n56 39\\r\\n60 39\\r\\n11 5\\r\\n33 14\\r\\n29 12\\r\\n13 34\\r\\n30 16\\r\\n25 16\\r\\n64 25\\r\\n47 6\\r\\n33 36\\r\\n14 40\\r\\n19 38\\r\\n57 34\\r\\n67 8\\r\\n10 13\\r\\n7 36\\r\\n22 24\\r\\n6 33\\r\\n23 40\\r\\n13 19\\r\\n65 6\\r\\n14 37\\r\\n37 21\\r\\n27 12\\r\\n41 36\\r\\n60 15\\r\\n27 11\\r\\n23 33\\r\\n67 40\\r\\n45 39\\r\\n1 41\\r\\n50 21\\r\\n28 38\\r\\n20 24\\r\\n41 34\\r\\n43 35\\r\\n51 5\\r\\n59 37\\r\\n27 4\\r\\n28 17\\r\\n63 20\\r\\n1 9\\r\\n', 'output': ['YES']}, {'input': '14 95 49\\r\\n11 48\\r\\n9 12\\r\\n1 18\\r\\n7 54\\r\\n11 20\\r\\n9 82\\r\\n12 1\\r\\n12 84\\r\\n1 13\\r\\n2 13\\r\\n12 57\\r\\n13 15\\r\\n12 18\\r\\n9 47\\r\\n13 14\\r\\n10 14\\r\\n13 94\\r\\n7 46\\r\\n14 14\\r\\n6 46\\r\\n7 95\\r\\n9 29\\r\\n13 15\\r\\n6 76\\r\\n8 60\\r\\n6 27\\r\\n9 63\\r\\n5 39\\r\\n5 70\\r\\n10 59\\r\\n5 75\\r\\n3 19\\r\\n9 32\\r\\n13 59\\r\\n5 13\\r\\n4 5\\r\\n13 80\\r\\n10 62\\r\\n13 65\\r\\n5 25\\r\\n4 81\\r\\n7 12\\r\\n10 94\\r\\n8 55\\r\\n7 61\\r\\n11 58\\r\\n7 77\\r\\n12 14\\r\\n12 47\\r\\n', 'output': ['YES']}, {'input': '15 96 22\\r\\n4 7\\r\\n7 40\\r\\n13 30\\r\\n8 53\\r\\n6 78\\r\\n5 9\\r\\n15 35\\r\\n3 13\\r\\n5 31\\r\\n2 9\\r\\n13 50\\r\\n11 17\\r\\n4 2\\r\\n10 91\\r\\n11 74\\r\\n14 49\\r\\n8 30\\r\\n10 66\\r\\n12 44\\r\\n6 19\\r\\n9 62\\r\\n15 50\\r\\n', 'output': ['YES']}, {'input': '19 19 50\\r\\n11 16\\r\\n4 11\\r\\n5 12\\r\\n19 19\\r\\n7 16\\r\\n15 10\\r\\n8 17\\r\\n8 1\\r\\n11 10\\r\\n5 19\\r\\n5 14\\r\\n17 6\\r\\n12 15\\r\\n18 17\\r\\n17 14\\r\\n10 5\\r\\n15 11\\r\\n8 8\\r\\n5 8\\r\\n18 18\\r\\n7 11\\r\\n8 4\\r\\n11 9\\r\\n6 16\\r\\n1 15\\r\\n19 13\\r\\n5 12\\r\\n10 10\\r\\n4 19\\r\\n12 4\\r\\n8 14\\r\\n19 9\\r\\n7 1\\r\\n19 11\\r\\n15 8\\r\\n4 19\\r\\n19 9\\r\\n6 7\\r\\n15 7\\r\\n2 16\\r\\n12 9\\r\\n3 18\\r\\n17 10\\r\\n3 5\\r\\n11 7\\r\\n12 6\\r\\n4 15\\r\\n19 4\\r\\n17 15\\r\\n3 10\\r\\n', 'output': ['YES']}, {'input': '93 40 43\\r\\n14 15\\r\\n58 9\\r\\n72 15\\r\\n40 40\\r\\n46 20\\r\\n17 26\\r\\n31 26\\r\\n91 36\\r\\n24 28\\r\\n32 27\\r\\n51 10\\r\\n2 35\\r\\n73 7\\r\\n6 33\\r\\n59 21\\r\\n59 39\\r\\n33 8\\r\\n22 21\\r\\n77 20\\r\\n30 38\\r\\n76 35\\r\\n40 6\\r\\n48 31\\r\\n67 29\\r\\n30 24\\r\\n6 16\\r\\n39 27\\r\\n24 29\\r\\n14 16\\r\\n5 25\\r\\n76 14\\r\\n61 25\\r\\n85 13\\r\\n60 9\\r\\n80 7\\r\\n49 19\\r\\n35 20\\r\\n90 31\\r\\n57 40\\r\\n67 27\\r\\n3 27\\r\\n21 16\\r\\n21 38\\r\\n', 'output': ['YES']}, {'input': '70 50 62\\r\\n31 22\\r\\n41 21\\r\\n31 47\\r\\n2 46\\r\\n22 8\\r\\n6 4\\r\\n45 32\\r\\n40 29\\r\\n10 11\\r\\n62 40\\r\\n70 26\\r\\n48 25\\r\\n13 44\\r\\n53 22\\r\\n3 8\\r\\n41 19\\r\\n13 8\\r\\n21 41\\r\\n66 20\\r\\n34 34\\r\\n41 48\\r\\n9 35\\r\\n23 26\\r\\n29 30\\r\\n39 27\\r\\n58 11\\r\\n35 2\\r\\n67 3\\r\\n59 23\\r\\n41 10\\r\\n54 9\\r\\n10 18\\r\\n23 44\\r\\n5 2\\r\\n37 30\\r\\n31 24\\r\\n2 21\\r\\n2 36\\r\\n34 5\\r\\n59 44\\r\\n7 4\\r\\n23 22\\r\\n47 27\\r\\n14 50\\r\\n54 50\\r\\n6 4\\r\\n64 1\\r\\n29 5\\r\\n5 37\\r\\n60 50\\r\\n58 45\\r\\n70 4\\r\\n4 46\\r\\n68 43\\r\\n62 34\\r\\n15 12\\r\\n16 2\\r\\n70 21\\r\\n59 8\\r\\n13 27\\r\\n25 41\\r\\n13 20\\r\\n', 'output': ['YES']}, {'input': '61 96 15\\r\\n27 36\\r\\n19 64\\r\\n27 53\\r\\n59 63\\r\\n48 56\\r\\n55 30\\r\\n10 23\\r\\n6 79\\r\\n32 74\\r\\n7 51\\r\\n29 65\\r\\n60 16\\r\\n43 74\\r\\n40 80\\r\\n14 31\\r\\n', 'output': ['YES']}, {'input': '87 50 62\\r\\n34 31\\r\\n42 21\\r\\n2 23\\r\\n20 25\\r\\n57 39\\r\\n46 26\\r\\n59 46\\r\\n29 33\\r\\n32 35\\r\\n79 41\\r\\n54 19\\r\\n65 7\\r\\n41 6\\r\\n40 23\\r\\n8 41\\r\\n2 31\\r\\n56 5\\r\\n37 33\\r\\n63 23\\r\\n79 4\\r\\n85 27\\r\\n53 38\\r\\n58 21\\r\\n16 11\\r\\n15 46\\r\\n33 39\\r\\n38 6\\r\\n27 41\\r\\n6 15\\r\\n25 47\\r\\n58 16\\r\\n28 50\\r\\n43 38\\r\\n48 20\\r\\n5 48\\r\\n31 6\\r\\n8 18\\r\\n40 10\\r\\n32 29\\r\\n44 20\\r\\n42 46\\r\\n63 21\\r\\n18 10\\r\\n28 49\\r\\n66 26\\r\\n64 28\\r\\n73 23\\r\\n16 29\\r\\n48 12\\r\\n23 21\\r\\n84 14\\r\\n10 45\\r\\n75 37\\r\\n80 3\\r\\n75 24\\r\\n31 25\\r\\n8 42\\r\\n67 22\\r\\n80 45\\r\\n8 31\\r\\n16 28\\r\\n49 34\\r\\n', 'output': ['YES']}, {'input': '23 100 53\\r\\n16 63\\r\\n16 31\\r\\n8 31\\r\\n4 86\\r\\n8 43\\r\\n8 27\\r\\n21 6\\r\\n13 49\\r\\n11 54\\r\\n5 86\\r\\n1 41\\r\\n19 14\\r\\n2 98\\r\\n15 76\\r\\n6 25\\r\\n6 57\\r\\n2 45\\r\\n6 98\\r\\n10 27\\r\\n16 74\\r\\n22 72\\r\\n22 13\\r\\n22 20\\r\\n15 63\\r\\n18 17\\r\\n14 32\\r\\n14 32\\r\\n2 28\\r\\n7 46\\r\\n23 16\\r\\n20 64\\r\\n18 17\\r\\n3 69\\r\\n22 77\\r\\n2 98\\r\\n11 20\\r\\n22 17\\r\\n21 8\\r\\n19 77\\r\\n19 13\\r\\n18 25\\r\\n9 24\\r\\n18 83\\r\\n19 27\\r\\n7 37\\r\\n16 19\\r\\n9 60\\r\\n11 70\\r\\n3 30\\r\\n4 84\\r\\n9 54\\r\\n22 33\\r\\n3 22\\r\\n', 'output': ['YES']}, {'input': '36 89 27\\r\\n21 66\\r\\n3 60\\r\\n11 32\\r\\n10 81\\r\\n30 31\\r\\n27 62\\r\\n11 81\\r\\n24 41\\r\\n30 6\\r\\n13 45\\r\\n34 86\\r\\n26 46\\r\\n9 62\\r\\n8 86\\r\\n17 56\\r\\n4 86\\r\\n25 36\\r\\n23 72\\r\\n18 55\\r\\n18 87\\r\\n22 67\\r\\n18 12\\r\\n19 75\\r\\n21 60\\r\\n16 49\\r\\n33 63\\r\\n26 12\\r\\n', 'output': ['YES']}, {'input': '93 93 50\\r\\n7 5\\r\\n73 91\\r\\n66 55\\r\\n12 24\\r\\n82 46\\r\\n38 49\\r\\n86 72\\r\\n51 69\\r\\n17 73\\r\\n9 85\\r\\n86 69\\r\\n65 2\\r\\n40 88\\r\\n92 26\\r\\n45 80\\r\\n74 45\\r\\n4 55\\r\\n57 93\\r\\n80 70\\r\\n49 69\\r\\n29 46\\r\\n67 38\\r\\n46 12\\r\\n16 87\\r\\n62 3\\r\\n79 62\\r\\n29 45\\r\\n58 30\\r\\n48 4\\r\\n76 73\\r\\n14 68\\r\\n31 8\\r\\n49 85\\r\\n73 78\\r\\n18 7\\r\\n87 56\\r\\n82 54\\r\\n52 73\\r\\n29 71\\r\\n87 74\\r\\n75 84\\r\\n45 28\\r\\n47 57\\r\\n44 53\\r\\n21 5\\r\\n86 5\\r\\n57 51\\r\\n45 9\\r\\n93 8\\r\\n82 43\\r\\n', 'output': ['YES']}, {'input': '11 38 21\\r\\n2 21\\r\\n2 28\\r\\n7 19\\r\\n9 18\\r\\n7 25\\r\\n8 4\\r\\n3 23\\r\\n2 32\\r\\n5 34\\r\\n10 36\\r\\n8 21\\r\\n4 6\\r\\n6 6\\r\\n4 35\\r\\n8 34\\r\\n10 18\\r\\n11 4\\r\\n10 2\\r\\n10 13\\r\\n4 37\\r\\n2 29\\r\\n', 'output': ['YES']}, {'input': '26 11 59\\r\\n13 6\\r\\n18 6\\r\\n12 6\\r\\n18 6\\r\\n21 6\\r\\n19 6\\r\\n12 6\\r\\n7 6\\r\\n6 6\\r\\n16 6\\r\\n7 6\\r\\n9 6\\r\\n19 6\\r\\n19 6\\r\\n15 6\\r\\n16 6\\r\\n16 6\\r\\n18 6\\r\\n17 6\\r\\n8 6\\r\\n13 6\\r\\n18 6\\r\\n11 6\\r\\n21 6\\r\\n9 6\\r\\n19 6\\r\\n20 6\\r\\n8 6\\r\\n20 6\\r\\n14 6\\r\\n11 6\\r\\n18 6\\r\\n7 6\\r\\n16 6\\r\\n19 6\\r\\n6 6\\r\\n6 6\\r\\n7 6\\r\\n13 6\\r\\n9 6\\r\\n16 6\\r\\n9 6\\r\\n15 6\\r\\n12 6\\r\\n17 6\\r\\n16 6\\r\\n9 6\\r\\n11 6\\r\\n10 6\\r\\n16 6\\r\\n14 6\\r\\n15 6\\r\\n7 6\\r\\n20 6\\r\\n7 6\\r\\n8 6\\r\\n17 6\\r\\n14 6\\r\\n14 6\\r\\n', 'output': ['NO']}, {'input': '30 84 35\\r\\n20 60\\r\\n23 21\\r\\n14 24\\r\\n24 72\\r\\n13 76\\r\\n25 35\\r\\n11 64\\r\\n15 57\\r\\n9 55\\r\\n14 66\\r\\n10 24\\r\\n13 68\\r\\n11 8\\r\\n19 43\\r\\n11 14\\r\\n16 26\\r\\n11 22\\r\\n10 26\\r\\n15 66\\r\\n17 65\\r\\n21 34\\r\\n7 61\\r\\n24 64\\r\\n18 16\\r\\n22 18\\r\\n12 9\\r\\n10 40\\r\\n8 24\\r\\n16 52\\r\\n10 9\\r\\n7 17\\r\\n21 78\\r\\n18 75\\r\\n10 45\\r\\n16 29\\r\\n', 'output': ['NO']}, {'input': '100 77 53\\r\\n62 72\\r\\n23 51\\r\\n42 8\\r\\n66 33\\r\\n62 16\\r\\n28 53\\r\\n72 54\\r\\n71 34\\r\\n30 26\\r\\n91 28\\r\\n27 37\\r\\n81 47\\r\\n22 40\\r\\n42 23\\r\\n92 46\\r\\n36 37\\r\\n86 70\\r\\n62 22\\r\\n20 9\\r\\n46 36\\r\\n86 67\\r\\n46 61\\r\\n33 30\\r\\n68 49\\r\\n44 57\\r\\n34 7\\r\\n89 36\\r\\n48 39\\r\\n47 62\\r\\n76 56\\r\\n22 41\\r\\n7 52\\r\\n16 8\\r\\n70 50\\r\\n52 27\\r\\n27 17\\r\\n44 30\\r\\n66 44\\r\\n62 10\\r\\n95 37\\r\\n94 39\\r\\n91 68\\r\\n12 49\\r\\n85 55\\r\\n63 28\\r\\n64 15\\r\\n75 31\\r\\n93 26\\r\\n53 51\\r\\n53 55\\r\\n66 65\\r\\n38 36\\r\\n40 15\\r\\n', 'output': ['NO']}, {'input': '66 94 26\\r\\n11 75\\r\\n46 72\\r\\n55 74\\r\\n34 10\\r\\n33 84\\r\\n25 11\\r\\n13 23\\r\\n27 73\\r\\n45 22\\r\\n54 34\\r\\n53 63\\r\\n28 8\\r\\n57 46\\r\\n26 78\\r\\n52 46\\r\\n32 38\\r\\n22 55\\r\\n17 71\\r\\n56 18\\r\\n9 60\\r\\n31 54\\r\\n6 84\\r\\n59 57\\r\\n60 81\\r\\n51 49\\r\\n41 77\\r\\n', 'output': ['NO']}, {'input': '68 100 18\\r\\n17 85\\r\\n10 77\\r\\n59 55\\r\\n29 46\\r\\n25 74\\r\\n55 11\\r\\n37 16\\r\\n57 61\\r\\n26 11\\r\\n11 88\\r\\n19 18\\r\\n28 38\\r\\n32 12\\r\\n36 49\\r\\n32 6\\r\\n57 45\\r\\n30 6\\r\\n59 95\\r\\n', 'output': ['NO']}, {'input': '28 61 4\\r\\n12 18\\r\\n21 31\\r\\n14 52\\r\\n6 36\\r\\n', 'output': ['NO']}, {'input': '11 73 1\\r\\n4 67\\r\\n', 'output': ['YES']}, {'input': '11 79 0\\r\\n', 'output': ['NO']}, {'input': '11 23 1\\r\\n11 9\\r\\n', 'output': ['YES']}, {'input': '25 11 0\\r\\n', 'output': ['NO']}, {'input': '39 11 1\\r\\n18 3\\r\\n', 'output': ['YES']}, {'input': '69 11 0\\r\\n', 'output': ['NO']}, {'input': '18 15 45\\r\\n6 7\\r\\n7 14\\r\\n12 3\\r\\n17 1\\r\\n15 3\\r\\n7 11\\r\\n9 3\\r\\n7 11\\r\\n15 4\\r\\n8 1\\r\\n12 2\\r\\n17 7\\r\\n14 15\\r\\n2 9\\r\\n12 4\\r\\n14 9\\r\\n18 8\\r\\n2 2\\r\\n17 1\\r\\n7 9\\r\\n2 4\\r\\n16 1\\r\\n12 7\\r\\n17 10\\r\\n4 1\\r\\n18 13\\r\\n10 13\\r\\n9 12\\r\\n14 1\\r\\n1 6\\r\\n3 10\\r\\n6 2\\r\\n15 3\\r\\n4 8\\r\\n14 6\\r\\n5 14\\r\\n8 11\\r\\n8 13\\r\\n6 7\\r\\n16 9\\r\\n2 7\\r\\n17 14\\r\\n17 11\\r\\n7 9\\r\\n15 8\\r\\n', 'output': ['YES']}, {'input': '16 18 70\\r\\n14 17\\r\\n16 8\\r\\n14 1\\r\\n7 1\\r\\n5 3\\r\\n7 5\\r\\n15 15\\r\\n15 2\\r\\n8 17\\r\\n12 12\\r\\n8 7\\r\\n10 16\\r\\n16 6\\r\\n14 7\\r\\n2 7\\r\\n12 4\\r\\n1 9\\r\\n6 9\\r\\n1 10\\r\\n10 13\\r\\n7 11\\r\\n2 2\\r\\n9 5\\r\\n3 10\\r\\n14 7\\r\\n4 5\\r\\n2 7\\r\\n7 16\\r\\n5 7\\r\\n7 14\\r\\n14 6\\r\\n10 16\\r\\n8 1\\r\\n4 14\\r\\n3 15\\r\\n8 11\\r\\n3 16\\r\\n12 1\\r\\n10 12\\r\\n13 3\\r\\n14 17\\r\\n5 5\\r\\n6 8\\r\\n13 10\\r\\n11 13\\r\\n3 5\\r\\n15 7\\r\\n10 3\\r\\n6 12\\r\\n13 15\\r\\n7 5\\r\\n3 8\\r\\n7 18\\r\\n6 7\\r\\n15 1\\r\\n9 6\\r\\n6 17\\r\\n11 2\\r\\n2 17\\r\\n7 16\\r\\n6 6\\r\\n2 18\\r\\n2 10\\r\\n5 16\\r\\n7 17\\r\\n3 8\\r\\n15 2\\r\\n11 11\\r\\n5 13\\r\\n16 1\\r\\n', 'output': ['YES']}, {'input': '14 20 68\\r\\n6 7\\r\\n2 15\\r\\n4 6\\r\\n10 18\\r\\n6 9\\r\\n14 14\\r\\n5 18\\r\\n9 15\\r\\n5 15\\r\\n2 9\\r\\n9 13\\r\\n10 17\\r\\n4 2\\r\\n12 12\\r\\n6 19\\r\\n7 13\\r\\n10 11\\r\\n1 1\\r\\n3 16\\r\\n7 6\\r\\n8 16\\r\\n10 17\\r\\n1 13\\r\\n12 11\\r\\n13 13\\r\\n2 20\\r\\n14 12\\r\\n11 18\\r\\n10 8\\r\\n12 4\\r\\n13 7\\r\\n13 11\\r\\n1 1\\r\\n10 6\\r\\n14 17\\r\\n1 2\\r\\n11 5\\r\\n6 12\\r\\n13 2\\r\\n4 3\\r\\n8 19\\r\\n12 8\\r\\n8 7\\r\\n5 1\\r\\n2 10\\r\\n11 10\\r\\n12 19\\r\\n2 10\\r\\n8 4\\r\\n12 13\\r\\n3 15\\r\\n8 8\\r\\n5 9\\r\\n14 15\\r\\n5 19\\r\\n7 7\\r\\n1 16\\r\\n6 12\\r\\n11 18\\r\\n5 13\\r\\n1 12\\r\\n10 14\\r\\n4 5\\r\\n2 8\\r\\n3 20\\r\\n14 7\\r\\n6 3\\r\\n4 18\\r\\n', 'output': ['YES']}, {'input': '19 13 83\\r\\n5 2\\r\\n12 11\\r\\n5 6\\r\\n3 11\\r\\n17 8\\r\\n10 8\\r\\n3 10\\r\\n9 10\\r\\n16 3\\r\\n15 12\\r\\n14 2\\r\\n11 8\\r\\n18 6\\r\\n15 10\\r\\n11 12\\r\\n2 1\\r\\n15 3\\r\\n16 3\\r\\n1 7\\r\\n15 7\\r\\n2 9\\r\\n11 13\\r\\n18 9\\r\\n4 7\\r\\n13 4\\r\\n7 4\\r\\n3 1\\r\\n14 8\\r\\n4 5\\r\\n5 7\\r\\n8 3\\r\\n17 2\\r\\n18 2\\r\\n16 3\\r\\n10 12\\r\\n6 2\\r\\n3 6\\r\\n5 2\\r\\n10 3\\r\\n18 9\\r\\n14 3\\r\\n3 6\\r\\n6 5\\r\\n12 8\\r\\n7 12\\r\\n2 11\\r\\n6 6\\r\\n18 6\\r\\n14 4\\r\\n3 10\\r\\n3 2\\r\\n13 3\\r\\n12 9\\r\\n2 10\\r\\n15 6\\r\\n1 5\\r\\n9 12\\r\\n6 12\\r\\n4 6\\r\\n18 3\\r\\n7 2\\r\\n9 13\\r\\n3 10\\r\\n19 13\\r\\n6 7\\r\\n5 1\\r\\n4 10\\r\\n12 13\\r\\n8 12\\r\\n15 1\\r\\n4 3\\r\\n3 8\\r\\n4 8\\r\\n3 7\\r\\n4 13\\r\\n8 7\\r\\n7 13\\r\\n2 8\\r\\n14 6\\r\\n12 1\\r\\n16 8\\r\\n9 4\\r\\n5 8\\r\\n', 'output': ['YES']}, {'input': '13 19 1\\r\\n6 10\\r\\n', 'output': ['NO']}, {'input': '14 17 0\\r\\n', 'output': ['NO']}, {'input': '20 19 5\\r\\n7 14\\r\\n14 12\\r\\n7 12\\r\\n15 9\\r\\n12 6\\r\\n', 'output': ['NO']}, {'input': '17 15 3\\r\\n10 7\\r\\n12 6\\r\\n8 6\\r\\n', 'output': ['NO']}, {'input': '14 17 4\\r\\n9 9\\r\\n8 7\\r\\n8 12\\r\\n7 9\\r\\n', 'output': ['NO']}, {'input': '15 11 0\\r\\n', 'output': ['NO']}, {'input': '14 16 4\\r\\n6 11\\r\\n6 8\\r\\n8 6\\r\\n6 7\\r\\n', 'output': ['NO']}, {'input': '16 16 0\\r\\n', 'output': ['NO']}, {'input': '19 20 2\\r\\n10 14\\r\\n8 11\\r\\n', 'output': ['NO']}, {'input': '13 15 1\\r\\n7 10\\r\\n', 'output': ['NO']}, {'input': '11 100 4\\r\\n6 10\\r\\n6 20\\r\\n6 30\\r\\n6 80\\r\\n', 'output': ['NO']}, {'input': '100 11 2\\r\\n40 6\\r\\n70 6\\r\\n', 'output': ['NO']}, {'input': '100 11 5\\r\\n20 6\\r\\n30 6\\r\\n43 7\\r\\n78 6\\r\\n89 6\\r\\n', 'output': ['YES']}, {'input': '20 20 5\\r\\n10 6\\r\\n6 8\\r\\n16 11\\r\\n11 11\\r\\n7 15\\r\\n', 'output': ['YES']}, {'input': '30 30 5\\r\\n7 15\\r\\n24 11\\r\\n15 15\\r\\n8 24\\r\\n9 6\\r\\n', 'output': ['NO']}]","id":278} {"difficulty":2200,"lang":"MS C#","lang_cluster":"C#","src_uid":"7225266f663699ff7e16b726cadfe9ee","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nnamespace ConsoleApplication2\n{\n class Program\n {\n private static int ReadInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n private static int[] ReadIntArray()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n int[] ans = new int[tmp.Length];\n for (int i = 0; i < tmp.Length; i++) ans[i] = int.Parse(tmp[i]);\n return ans;\n }\n\n private static long[] ReadLongArray()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n long[] ans = new long[tmp.Length];\n for (int i = 0; i < tmp.Length; i++) ans[i] = long.Parse(tmp[i]);\n return ans;\n }\n\n private static string[] ReadStringArray()\n {\n string[] tmp = Console.ReadLine().Split(' ');\n return tmp;\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n\n\n private static long Simulate(long h1, long a1, long x1, long y1, List visits1,\n long h2, long a2, long x2, long y2, List visits2)\n {\n long iterations = m + m + m;\n for (long i = 0; i <= iterations; i++)\n {\n if (h1 == a1) visits1.Add(i);\n if (h2 == a2) visits2.Add(i);\n if (h1 == a1 && h2 == a2) return i;\n h1 = (h1 * x1 + y1) % m;\n h2 = (h2 * x2 + y2) % m;\n }\n\n return - 1;\n }\n\n private static int Count;\n private static long m;\n private static List Visits1= new List();\n private static List Visits2 =new List();\n static void Main(string[] args)\n {\/*\n m = 1007;\n Visits = new List();\n GetList(111, 77, 15, 23);*\/\n\n\n m = ReadInt();\n int[] tmp = ReadIntArray();\n long h1 = tmp[0];long a1 = tmp[1];\n tmp = ReadIntArray();\n long x1 = tmp[0]; long y1 = tmp[1];\n tmp = ReadIntArray();\n long h2 = tmp[0]; long a2 = tmp[1];\n tmp = ReadIntArray();\n long x2 = tmp[0]; long y2 = tmp[1];\n\n long ans = Simulate(h1, a1, x1, y1, Visits1,\n h2, a2, x2, y2, Visits2);\n\n if (ans > -1)\n {\n Console.Write(ans);\n return;\n }\n\n if (Visits1.Count == 0 || Visits2.Count == 0)\n {\n Console.Write(-1);\n return;\n }\n \n if (Visits1.Count == 1)\n {\n if (Visits2.Contains(Visits1[0]))\n {\n Console.WriteLine(Visits1[0]);\n }\n else\n {\n Console.WriteLine(-1);\n }\n return;\n }\n\n if (Visits2.Count == 1)\n {\n if (Visits1.Contains(Visits2[0]))\n {\n Console.WriteLine(Visits2[0]);\n }\n else\n {\n Console.WriteLine(-1);\n }\n return;\n }\n\n long c1 = Visits1[Visits1.Count - 1] - Visits1[Visits1.Count - 2];\n long c2 = Visits2[Visits2.Count - 1] - Visits2[Visits2.Count - 2];\n long d1 = Visits1[Visits1.Count - 1];\n long d2 = Visits2[Visits2.Count - 1];\n\n if (c1 < c2)\n {\n long qwe = c1;\n c1 = c2;\n c2 = qwe;\n\n qwe = d1;\n d1 = d2;\n d2 = qwe;\n }\n\n \/\/long iteration = Math.Max\n for (long i = 0; i <= 5000000; i++)\n {\n long sum = d1 + c1 * i;\n\n if (sum % c2 == d2)\n {\n Console.Write(sum);\n return;\n }\n }\n\n Console.Write(-1); \n }\n\n private const int BufferSize = 1 << 16;\n private static readonly StreamReader consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n private static readonly StreamWriter consoleWriter = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);\n\n private static int ReadInt123()\n {\n int ans = 0;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + chr - '0';\n }\n }\n }\n}\n","description":"Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar. So, if height of Xaniar is h1 and height of Abol is h2, after one second height of Xaniar will become and height of Abol will become where x1,\u2009y1,\u2009x2 and y2 are some integer numbers and denotes the remainder of a modulo b.Mike is a competitive programmer fan. He wants to know the minimum time it takes until height of Xania is a1 and height of Abol is a2.Mike has asked you for your help. Calculate the minimum time or say it will never happen.","input_specification":"The first line of input contains integer m (2\u2009\u2264\u2009m\u2009\u2264\u2009106). The second line of input contains integers h1 and a1 (0\u2009\u2264\u2009h1,\u2009a1\u2009<\u2009m). The third line of input contains integers x1 and y1 (0\u2009\u2264\u2009x1,\u2009y1\u2009<\u2009m). The fourth line of input contains integers h2 and a2 (0\u2009\u2264\u2009h2,\u2009a2\u2009<\u2009m). The fifth line of input contains integers x2 and y2 (0\u2009\u2264\u2009x2,\u2009y2\u2009<\u2009m). It is guaranteed that h1\u2009\u2260\u2009a1 and h2\u2009\u2260\u2009a2.","output_specification":"Print the minimum number of seconds until Xaniar reaches height a1 and Abol reaches height a2 or print -1 otherwise.","notes":"NoteIn the first sample, heights sequences are following:Xaniar: Abol: ","sample_inputs":["5\n4 2\n1 1\n0 1\n2 3","1023\n1 2\n1 0\n1 2\n1 1"],"sample_outputs":["3","-1"],"human_solution":"\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Mike_and_Frog\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int m = Next();\n int h1 = Next(), a1 = Next();\n int x1 = Next(), y1 = Next();\n int h2 = Next(), a2 = Next();\n int x2 = Next(), y2 = Next();\n\n\n long index1_1 = -1;\n int index1_2 = -1;\n\n\n for (int i = 1; i < 2*m; i++)\n {\n h1 = (int) (((long) x1*h1 + y1)%m);\n if (h1 == a1)\n {\n if (index1_1 == -1)\n {\n index1_1 = i;\n }\n else\n {\n if (index1_2 == -1)\n {\n index1_2 = (int) (i - index1_1);\n }\n else\n {\n break;\n }\n }\n }\n }\n\n long index2_1 = -1;\n int index2_2 = -1;\n\n for (int i = 1; i < 2*m; i++)\n {\n h2 = (int) (((long) x2*h2 + y2)%m);\n if (h2 == a2)\n {\n if (index2_1 == -1)\n {\n index2_1 = i;\n }\n else\n {\n if (index2_2 == -1)\n {\n index2_2 = (int) (i - index2_1);\n }\n else\n {\n break;\n }\n }\n }\n }\n\n if (index1_1 == index2_1)\n {\n writer.WriteLine(index1_1);\n writer.Flush();\n return;\n }\n\n if (index1_2 == -1 && index2_2 == -1)\n {\n writer.WriteLine(-1);\n writer.Flush();\n return;\n }\n\n for (int i = 0; i < m; i++)\n {\n while (index1_2 > 0 && index1_1 < index2_1)\n {\n index1_1 += index1_2;\n }\n\n if (index1_1 == index2_1)\n {\n writer.WriteLine(index1_1);\n writer.Flush();\n return;\n }\n\n while (index2_2 > 0 && index2_1 < index1_1)\n {\n index2_1 += index2_2;\n }\n\n if (index1_1 == index2_1)\n {\n writer.WriteLine(index1_1);\n writer.Flush();\n return;\n }\n }\n\n writer.WriteLine(\"-1\");\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n int res = 0;\n do\n {\n c = reader.Read();\n if (c == -1)\n return res;\n } while (c < '0' || c > '9');\n res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}","testcases":"[{'input': '5\\r\\n4 2\\r\\n1 1\\r\\n0 1\\r\\n2 3\\r\\n', 'output': ['3']}, {'input': '1023\\r\\n1 2\\r\\n1 0\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['-1']}, {'input': '1023\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n', 'output': ['512']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n1 0\\r\\n0 1\\r\\n', 'output': ['-1']}, {'input': '17\\r\\n15 12\\r\\n15 12\\r\\n12 14\\r\\n1 11\\r\\n', 'output': ['-1']}, {'input': '29\\r\\n4 0\\r\\n1 1\\r\\n25 20\\r\\n16 0\\r\\n', 'output': ['170']}, {'input': '91\\r\\n9 64\\r\\n75 32\\r\\n60 81\\r\\n35 46\\r\\n', 'output': ['5']}, {'input': '91\\r\\n38 74\\r\\n66 10\\r\\n40 76\\r\\n17 13\\r\\n', 'output': ['-1']}, {'input': '100\\r\\n11 20\\r\\n99 31\\r\\n60 44\\r\\n45 64\\r\\n', 'output': ['3']}, {'input': '9999\\r\\n4879 6224\\r\\n63 7313\\r\\n4279 6583\\r\\n438 1627\\r\\n', 'output': ['4']}, {'input': '10000\\r\\n8681 4319\\r\\n9740 5980\\r\\n24 137\\r\\n462 7971\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n76036 94415\\r\\n34870 43365\\r\\n56647 26095\\r\\n88580 30995\\r\\n', 'output': ['5']}, {'input': '100000\\r\\n90861 77058\\r\\n96282 30306\\r\\n45940 25601\\r\\n17117 48287\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n220036 846131\\r\\n698020 485511\\r\\n656298 242999\\r\\n766802 905433\\r\\n', 'output': ['5297']}, {'input': '1000000\\r\\n536586 435396\\r\\n748740 34356\\r\\n135075 790803\\r\\n547356 534911\\r\\n', 'output': ['9958']}, {'input': '1000000\\r\\n661647 690400\\r\\n864868 326304\\r\\n581148 452012\\r\\n327910 197092\\r\\n', 'output': ['1021']}, {'input': '1000000\\r\\n233404 949288\\r\\n893747 751429\\r\\n692094 57207\\r\\n674400 583468\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n358465 242431\\r\\n977171 267570\\r\\n170871 616951\\r\\n711850 180241\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n707719 502871\\r\\n60595 816414\\r\\n649648 143990\\r\\n525107 66615\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n192005 690428\\r\\n971158 641039\\r\\n974183 1882\\r\\n127579 312317\\r\\n', 'output': ['470479']}, {'input': '999983\\r\\n420528 808305\\r\\n387096 497121\\r\\n596163 353326\\r\\n47177 758204\\r\\n', 'output': ['548500']}, {'input': '999983\\r\\n651224 992349\\r\\n803017 393514\\r\\n258455 402487\\r\\n888310 244420\\r\\n', 'output': ['126531']}, {'input': '999983\\r\\n151890 906425\\r\\n851007 9094\\r\\n696594 968184\\r\\n867017 157783\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n380412 325756\\r\\n266945 907644\\r\\n318575 83081\\r\\n786616 603671\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n570797 704759\\r\\n723177 763726\\r\\n978676 238272\\r\\n708387 89886\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n408725 408721\\r\\n1 1\\r\\n378562 294895\\r\\n984270 0\\r\\n', 'output': ['499981500166']}, {'input': '999983\\r\\n639420 639416\\r\\n1 1\\r\\n507684 954997\\r\\n466316 0\\r\\n', 'output': ['499981500166']}, {'input': '999983\\r\\n867942 867939\\r\\n1 1\\r\\n963840 536667\\r\\n899441 0\\r\\n', 'output': ['999964000320']}, {'input': '999961\\r\\n664221 931770\\r\\n530542 936292\\r\\n885122 515424\\r\\n868560 472225\\r\\n', 'output': ['-1']}, {'input': '999961\\r\\n744938 661980\\r\\n845908 76370\\r\\n237399 381935\\r\\n418010 938769\\r\\n', 'output': ['203332']}, {'input': '999961\\r\\n89288 89284\\r\\n1 1\\r\\n764559 727291\\r\\n999322 0\\r\\n', 'output': ['999920001595']}, {'input': '1000000\\r\\n661703 661699\\r\\n1 1\\r\\n425192 823944\\r\\n854093 0\\r\\n', 'output': ['-1']}, {'input': '100019\\r\\n98811 98807\\r\\n1 1\\r\\n91322 14787\\r\\n72253 0\\r\\n', 'output': ['10003600319']}, {'input': '524288\\r\\n199980 199978\\r\\n1 1\\r\\n236260 325076\\r\\n81773 0\\r\\n', 'output': ['-1']}, {'input': '524288\\r\\n47283 489031\\r\\n305624 183135\\r\\n141146 335913\\r\\n519614 150715\\r\\n', 'output': ['19']}, {'input': '524288\\r\\n83398 33987\\r\\n158854 211502\\r\\n36433 18758\\r\\n218812 517001\\r\\n', 'output': ['-1']}, {'input': '912488\\r\\n681639 518634\\r\\n168348 212018\\r\\n255428 4970\\r\\n31726 664998\\r\\n', 'output': ['34838']}, {'input': '129081\\r\\n128454 36771\\r\\n116353 2940\\r\\n95311 22200\\r\\n579 118683\\r\\n', 'output': ['68409']}, {'input': '129081\\r\\n45717 106320\\r\\n121816 69841\\r\\n5161 4872\\r\\n102076 100020\\r\\n', 'output': ['-1']}, {'input': '4\\r\\n1 2\\r\\n1 1\\r\\n0 1\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '3\\r\\n1 0\\r\\n1 1\\r\\n1 2\\r\\n2 0\\r\\n', 'output': ['5']}, {'input': '3\\r\\n0 2\\r\\n1 0\\r\\n2 0\\r\\n2 1\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n0 1\\r\\n0 1\\r\\n0 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n1 1\\r\\n0 1\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 1\\r\\n1 1\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n0 1\\r\\n1 1\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n1 0\\r\\n1 1\\r\\n1 0\\r\\n1 1\\r\\n', 'output': ['999999']}, {'input': '1000000\\r\\n2 1\\r\\n1 1\\r\\n2 0\\r\\n1 2\\r\\n', 'output': ['999999']}, {'input': '6\\r\\n1 2\\r\\n3 5\\r\\n0 2\\r\\n4 2\\r\\n', 'output': ['1']}, {'input': '545\\r\\n26 40\\r\\n477 97\\r\\n454 394\\r\\n15 264\\r\\n', 'output': ['90']}, {'input': '3\\r\\n1 0\\r\\n0 1\\r\\n0 2\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '1376\\r\\n1227 1349\\r\\n313 193\\r\\n1113 361\\r\\n1314 23\\r\\n', 'output': ['338']}, {'input': '1376\\r\\n1322 1320\\r\\n1 1\\r\\n776 495\\r\\n38 0\\r\\n', 'output': ['-1']}, {'input': '1376\\r\\n152 405\\r\\n1083 1328\\r\\n76 856\\r\\n49 629\\r\\n', 'output': ['-1']}, {'input': '1392\\r\\n1060 796\\r\\n512 242\\r\\n1386 1346\\r\\n1310 1199\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n5827 41281\\r\\n41285 70821\\r\\n99199 42807\\r\\n65667 94952\\r\\n', 'output': ['13770']}, {'input': '100000\\r\\n51157 27741\\r\\n40564 90740\\r\\n45270 52367\\r\\n31585 92150\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n70525 70522\\r\\n1 1\\r\\n89465 30265\\r\\n33279 0\\r\\n', 'output': ['-1']}, {'input': '10\\r\\n1 6\\r\\n7 9\\r\\n1 4\\r\\n4 0\\r\\n', 'output': ['1']}, {'input': '10\\r\\n9 6\\r\\n0 8\\r\\n3 0\\r\\n2 7\\r\\n', 'output': ['-1']}, {'input': '10\\r\\n4 2\\r\\n1 1\\r\\n7 3\\r\\n9 0\\r\\n', 'output': ['-1']}, {'input': '6\\r\\n5 1\\r\\n1 1\\r\\n3 1\\r\\n3 0\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n3 1\\r\\n1 1\\r\\n8 1\\r\\n2 0\\r\\n', 'output': ['499981500168']}, {'input': '18\\r\\n3 9\\r\\n3 0\\r\\n1 3\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '18\\r\\n1 3\\r\\n3 0\\r\\n3 9\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '16\\r\\n1 0\\r\\n2 0\\r\\n1 2\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '16\\r\\n8 0\\r\\n2 0\\r\\n1 4\\r\\n2 0\\r\\n', 'output': ['2']}, {'input': '999983\\r\\n2 1\\r\\n2 0\\r\\n1 0\\r\\n1 1\\r\\n', 'output': ['499982500152']}, {'input': '324\\r\\n2 54\\r\\n3 0\\r\\n27 108\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '999993\\r\\n499997 1\\r\\n2 3\\r\\n1 4\\r\\n1 1\\r\\n', 'output': ['39325724721']}, {'input': '999983\\r\\n1 37827\\r\\n1 1\\r\\n2 192083\\r\\n3 0\\r\\n', 'output': ['404303164556']}, {'input': '41222\\r\\n30759 26408\\r\\n31332 39118\\r\\n5026 25812\\r\\n1 9030\\r\\n', 'output': ['58900566']}, {'input': '100007\\r\\n2 1\\r\\n2 0\\r\\n3 1\\r\\n1 1\\r\\n', 'output': ['434330399']}, {'input': '8\\r\\n0 4\\r\\n4 4\\r\\n1 4\\r\\n2 0\\r\\n', 'output': ['2']}]","id":279} {"difficulty":2600,"lang":"Mono C#","lang_cluster":"C#","src_uid":"73291724a4609ddd4cc8a92c77e8496f","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace _37E\n{\n\tclass Vertex\n\t{\n\t\tpublic int V;\n\t\tpublic char Color;\n\t\tpublic HashSet Adjast = new HashSet();\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn V.ToString() + \"(\" + Color + \")\";\n\t\t}\n\t}\n\n\tclass Solver\n\t{\n\t\tpublic int N { get; set; }\n\t\tpublic int M { get; set; }\n\t\tpublic string[] Board { get; set; }\n\t\tint[,] Mask;\n\t\tDictionary Graph = new Dictionary();\n\n\t\tpublic Solver(int N, int M, string[] board)\n\t\t{\n\t\t\tthis.N = N;\n\t\t\tthis.M = M;\n\t\t\tBoard = board;\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tMask = new int[N, M];\n\n\t\t\tint Areas = Fill();\n\n\t\t\tbool[] prepared = new bool[Areas+1];\n\n\t\t\tfor (int i = 1; i <= Areas; i++)\n\t\t\t{\n\t\t\t\tGraph.Add(i, new Vertex() { V = i });\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < Mask.GetLength(0); i++)\n\t\t\t\tfor (int j = 0; j < Mask.GetLength(1); j++)\n\t\t\t\t{\n\t\t\t\t\tif (!prepared[Mask[i, j]])\n\t\t\t\t\t{\n\t\t\t\t\t\tbool[,] walked = new bool[Mask.GetLength(0), Mask.GetLength(1)];\n\t\t\t\t\t\tprepared[Mask[i, j]] = true;\n\t\t\t\t\t\tFillAdjast(walked, i, j);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tint max = -1;\n\n\t\t\tforeach (var v in Graph)\n\t\t\t{\n\t\t\t\t\/\/genereate Wave\n\t\t\t\tbool[] walked2 = new bool[Areas + 1];\n\t\t\t\twalked2[v.Value.V] = true;\n\t\t\t\tList wave = new List();\n\t\t\t\twave.Add(v.Value);\n\t\t\t\tbool startBlack = v.Value.Color == 'B';\n\n\t\t\t\tif (startBlack && max < 0)\n\t\t\t\t\tmax = 0;\n\n\t\t\t\tbool needBreak;\n\t\t\t\tfor (int i = 1; i < Areas; i++)\n\t\t\t\t{\n\t\t\t\t\tList newWave = new List();\n\t\t\t\t\tneedBreak = true;\n\t\t\t\t\tforeach (var vinwave in wave)\n\t\t\t\t\t\tforeach (var adj in vinwave.Adjast)\n\t\t\t\t\t\t\tif (!walked2[adj.V])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twalked2[adj.V] = true;\n\t\t\t\t\t\t\t\tnewWave.Add(adj);\n\t\t\t\t\t\t\t\tneedBreak = false;\n\t\t\t\t\t\t\t\tif (startBlack && adj.Color == 'B' && i > max)\n\t\t\t\t\t\t\t\t\tmax = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\twave = newWave;\n\t\t\t\t\tif (needBreak)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tConsole.WriteLine((max + 2)\/2);\n\t\t}\n\n\t\tprivate void FillAdjast(bool[,] walked, int i, int j)\n\t\t{\n\t\t\tif (walked[i, j])\n\t\t\t\treturn;\n\n\t\t\twalked[i, j] = true;\n\t\t\tint c = Mask[i, j];\n\t\t\tGraph[c].Color = Board[i][j];\n\n\t\t\tif (i > 0)\n\t\t\t{\n\t\t\t\tif (Mask[i - 1, j] == c)\n\t\t\t\t\tFillAdjast(walked, i - 1, j);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i - 1, j]]);\n\t\t\t}\n\t\t\tif (j > 0)\n\t\t\t{\n\t\t\t\tif (Mask[i, j-1] == c)\n\t\t\t\t\tFillAdjast(walked, i , j-1);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i, j-1]]);\n\t\t\t}\n\t\t\tif (i < N-1)\n\t\t\t{\n\t\t\t\tif (Mask[i + 1, j] == c)\n\t\t\t\t\tFillAdjast(walked, i + 1, j);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i + 1, j]]);\n\t\t\t}\n\t\t\tif (j < M-1)\n\t\t\t{\n\t\t\t\tif (Mask[i , j + 1] == c)\n\t\t\t\t\tFillAdjast(walked, i , j + 1);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i, j + 1]]);\n\t\t\t}\n\t\t}\n\n\t\tprivate int Fill()\n\t\t{\n\t\t\tint k = 1;\n\t\t\tfor (int i = 0; i < Mask.GetLength(0); i++)\n\t\t\t\tfor (int j = 0; j < Mask.GetLength(1); j++)\n\t\t\t\t\tif (Mask[i, j] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tFillPart(i, j, k);\n\t\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\treturn k - 1;\n\t\t}\n\n\t\tprivate void FillPart(int i, int j, int k)\n\t\t{\n\t\t\tchar c = Board[i][j];\n\t\t\tMask[i, j] = k;\n\n\t\t\tif (i > 0 && Mask[i - 1, j] == 0 && Board[i - 1][j] == c)\n\t\t\t\tFillPart(i - 1, j, k);\n\n\t\t\tif (j > 0 && Mask[i, j - 1] == 0 && Board[i][j - 1] == c)\n\t\t\t\tFillPart(i, j - 1, k);\n\n\t\t\tif (i < Mask.GetLength(0)-1 && Mask[i + 1, j] == 0 && Board[i + 1][j] == c)\n\t\t\t\tFillPart(i + 1, j, k);\n\n\t\t\tif (j < Mask.GetLength(1)-1 && Mask[i, j + 1] == 0 && Board[i][j + 1] == c)\n\t\t\t\tFillPart(i, j + 1, k);\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\t\/\/static StreamReader inStream = new StreamReader(\"input.txt\");\n\t\t\/\/static string ReadLine()\n\t\t\/\/{\n\t\t\/\/ return inStream.ReadLine();\n\t\t\/\/}\n\n\t\tstatic string ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] arg1 = ReadLine().Split();\n\t\t\tint N = int.Parse(arg1[0]);\n\t\t\tint M = int.Parse(arg1[1]);\n\n\t\t\tstring[] board = new string[N];\n\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tboard[i] = ReadLine();\n\t\t\t}\n\n\t\t\tnew Solver(N, M, board).Solve();\n\t\t}\n\n\t}\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace _37E\n{\n\tclass Vertex\n\t{\n\t\tpublic int V;\n\t\tpublic char Color;\n\t\tpublic HashSet Adjast = new HashSet();\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\treturn V.ToString() + \"(\" + Color + \")\";\n\t\t}\n\t}\n\n\tclass Solver\n\t{\n\t\tpublic int N { get; set; }\n\t\tpublic int M { get; set; }\n\t\tpublic string[] Board { get; set; }\n\t\tint[,] Mask;\n\t\tDictionary Graph = new Dictionary();\n\n\t\tpublic Solver(int N, int M, string[] board)\n\t\t{\n\t\t\tthis.N = N;\n\t\t\tthis.M = M;\n\t\t\tBoard = board;\n\t\t}\n\n\t\tpublic void Solve()\n\t\t{\n\t\t\tMask = new int[N, M];\n\n\t\t\tint Areas = Fill();\n\n\t\t\tbool[] prepared = new bool[Areas+1];\n\n\t\t\tfor (int i = 1; i <= Areas; i++)\n\t\t\t{\n\t\t\t\tGraph.Add(i, new Vertex() { V = i });\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < Mask.GetLength(0); i++)\n\t\t\t\tfor (int j = 0; j < Mask.GetLength(1); j++)\n\t\t\t\t{\n\t\t\t\t\tif (!prepared[Mask[i, j]])\n\t\t\t\t\t{\n\t\t\t\t\t\tbool[,] walked = new bool[Mask.GetLength(0), Mask.GetLength(1)];\n\t\t\t\t\t\tprepared[Mask[i, j]] = true;\n\t\t\t\t\t\tFillAdjast(walked, i, j);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tint min = int.MaxValue;\n\n\t\t\tforeach (var v in Graph)\n\t\t\t{\n\t\t\t\t\/\/genereate Wave\n\t\t\t\tbool[] walked2 = new bool[Areas + 1];\n\t\t\t\twalked2[v.Value.V] = true;\n\t\t\t\tList wave = new List();\n\t\t\t\twave.Add(v.Value);\n\t\t\t\tbool startBlack = v.Value.Color == 'B';\n\n\t\t\t\tint max = -1;\n\n\t\t\t\tif (startBlack && max < 0)\n\t\t\t\t\tmax = 0;\n\n\t\t\t\tbool needBreak;\n\t\t\t\tfor (int i = 1; i < Areas; i++)\n\t\t\t\t{\n\t\t\t\t\tList newWave = new List();\n\t\t\t\t\tneedBreak = true;\n\t\t\t\t\tforeach (var vinwave in wave)\n\t\t\t\t\t\tforeach (var adj in vinwave.Adjast)\n\t\t\t\t\t\t\tif (!walked2[adj.V])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\twalked2[adj.V] = true;\n\t\t\t\t\t\t\t\tnewWave.Add(adj);\n\t\t\t\t\t\t\t\tneedBreak = false;\n\t\t\t\t\t\t\t\tif (adj.Color == 'B' && i > max)\n\t\t\t\t\t\t\t\t\tmax = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\twave = newWave;\n\t\t\t\t\tif (needBreak)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (min > max)\n\t\t\t\t\tmin = max;\n\t\t\t}\n\n\t\t\tConsole.WriteLine(min + 1);\n\t\t}\n\n\t\tprivate void FillAdjast(bool[,] walked, int i, int j)\n\t\t{\n\t\t\tif (walked[i, j])\n\t\t\t\treturn;\n\n\t\t\twalked[i, j] = true;\n\t\t\tint c = Mask[i, j];\n\t\t\tGraph[c].Color = Board[i][j];\n\n\t\t\tif (i > 0)\n\t\t\t{\n\t\t\t\tif (Mask[i - 1, j] == c)\n\t\t\t\t\tFillAdjast(walked, i - 1, j);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i - 1, j]]);\n\t\t\t}\n\t\t\tif (j > 0)\n\t\t\t{\n\t\t\t\tif (Mask[i, j-1] == c)\n\t\t\t\t\tFillAdjast(walked, i , j-1);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i, j-1]]);\n\t\t\t}\n\t\t\tif (i < N-1)\n\t\t\t{\n\t\t\t\tif (Mask[i + 1, j] == c)\n\t\t\t\t\tFillAdjast(walked, i + 1, j);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i + 1, j]]);\n\t\t\t}\n\t\t\tif (j < M-1)\n\t\t\t{\n\t\t\t\tif (Mask[i , j + 1] == c)\n\t\t\t\t\tFillAdjast(walked, i , j + 1);\n\t\t\t\telse\n\t\t\t\t\tGraph[c].Adjast.Add(Graph[Mask[i, j + 1]]);\n\t\t\t}\n\t\t}\n\n\t\tprivate int Fill()\n\t\t{\n\t\t\tint k = 1;\n\t\t\tfor (int i = 0; i < Mask.GetLength(0); i++)\n\t\t\t\tfor (int j = 0; j < Mask.GetLength(1); j++)\n\t\t\t\t\tif (Mask[i, j] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tFillPart(i, j, k);\n\t\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\treturn k - 1;\n\t\t}\n\n\t\tprivate void FillPart(int i, int j, int k)\n\t\t{\n\t\t\tchar c = Board[i][j];\n\t\t\tMask[i, j] = k;\n\n\t\t\tif (i > 0 && Mask[i - 1, j] == 0 && Board[i - 1][j] == c)\n\t\t\t\tFillPart(i - 1, j, k);\n\n\t\t\tif (j > 0 && Mask[i, j - 1] == 0 && Board[i][j - 1] == c)\n\t\t\t\tFillPart(i, j - 1, k);\n\n\t\t\tif (i < Mask.GetLength(0)-1 && Mask[i + 1, j] == 0 && Board[i + 1][j] == c)\n\t\t\t\tFillPart(i + 1, j, k);\n\n\t\t\tif (j < Mask.GetLength(1)-1 && Mask[i, j + 1] == 0 && Board[i][j + 1] == c)\n\t\t\t\tFillPart(i, j + 1, k);\n\t\t}\n\t}\n\n\tclass Program\n\t{\n\t\t\/\/static StreamReader inStream = new StreamReader(\"input.txt\");\n\t\t\/\/static string ReadLine()\n\t\t\/\/{\n\t\t\/\/ return inStream.ReadLine();\n\t\t\/\/}\n\n\t\tstatic string ReadLine()\n\t\t{\n\t\t\treturn Console.ReadLine();\n\t\t}\n\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tstring[] arg1 = ReadLine().Split();\n\t\t\tint N = int.Parse(arg1[0]);\n\t\t\tint M = int.Parse(arg1[1]);\n\n\t\t\tstring[] board = new string[N];\n\n\t\t\tfor (int i = 0; i < N; i++)\n\t\t\t{\n\t\t\t\tboard[i] = ReadLine();\n\t\t\t}\n\n\t\t\tnew Solver(N, M, board).Solve();\n\t\t}\n\n\t}\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":280} {"difficulty":1800,"lang":"Mono C#","lang_cluster":"C#","src_uid":"77b5f83cdadf4b0743618a46b646a849","execute_outcome":"WRONG_ANSWER","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\npublic class Program\n{\n public static void Main(string[] args)\n {\n var input = Console.ReadLine();\n\n System.Console.WriteLine(Solve(input));\n }\n\n private static string Solve(string input)\n {\n var n = input.Length;\n if (n % 2 != 0)\n {\n return Generate(0, String.Empty, n + 1);\n }\n\n var result = new char[n];\n var foors = 0;\n var sevens = 0;\n for (int i = 0; i < n; ++i)\n {\n if (input[i] < '4')\n {\n var prefix = new string(result, 0, i);\n if (foors < n \/ 2)\n {\n prefix = prefix + '4';\n ++foors;\n }\n else\n {\n prefix = prefix + '7';\n }\n return Generate(foors, prefix, n);\n }\n\n if (input[i] == '4')\n {\n if (foors < n \/ 2)\n {\n result[i] = '4';\n ++foors;\n continue;\n }\n else\n {\n result[i] = '7';\n return Generate(foors, new string(result, 0, i + 1), n);\n }\n }\n\n if (input[i] < '7')\n {\n if (sevens < n \/ 2)\n {\n var prefix = new string(result, 0, i) + '7';\n return Generate(foors, prefix, n);\n }\n return FindLeft(input, result, i - 1, sevens, foors);\n }\n\n if (input[i] == '7')\n {\n if (sevens < n \/ 2)\n {\n result[i] = '7';\n ++sevens;\n continue;\n }\n return FindLeft(input, result, i - 1, sevens, foors);\n }\n\n if (input[i] > '7')\n {\n return FindLeft(input, result, i - 1, sevens, foors);\n }\n }\n return new string(result);\n }\n\n private static string FindLeft(string input, char[] result, int start, int sevens, int foors)\n {\n int n = input.Length;\n for (int i= start; i >= 0; --i)\n {\n if (result[i] == '7')\n {\n --sevens;\n }\n else\n {\n --foors;\n if (sevens < n \/ 2)\n {\n result[i] = '7';\n return Generate(foors, new string(result, 0, i), n);\n }\n }\n }\n return Generate(0, \"\", n + 2);\n }\n\n private static string Generate(int foors, string prefix, int size)\n {\n var realSize = size - prefix.Length;\n\n return prefix + new String('4', size\/2 - foors) +\n new String('7', realSize - size \/ 2 + foors);\n }\n}\n","description":"Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.One day Petya came across a positive integer n. Help him to find the least super lucky number which is not less than n.","input_specification":"The only line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910100000). This number doesn't have leading zeroes.","output_specification":"Output the least super lucky number that is more than or equal to n.","notes":null,"sample_inputs":["4500","47"],"sample_outputs":["4747","47"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round77\n{\n class B\n {\n static string s;\n static char[] cs;\n static char[] val = new char[2] { '4', '7' };\n static bool dfs2(int i, int c4, int c7, bool eq)\n {\n if (i >= s.Length)\n return c4 == c7;\n for (int j = 0; j < 2; j++)\n {\n if (eq && val[j] < s[i])\n continue;\n cs[i] = val[j];\n if (dfs2(i + 1, c4 + 1 - j, c7 + j, eq && s[j] == cs[i]))\n return true;\n }\n return false;\n }\n static bool dfs()\n {\n Stack sc = new Stack();\n Stack si = new Stack();\n Stack s4 = new Stack();\n Stack s7 = new Stack();\n Stack seq = new Stack();\n\n si.Push(0);\n s4.Push(0);\n s7.Push(0);\n seq.Push(true);\n\n while (si.Any())\n {\n int i = si.Pop(),\n c4 = s4.Pop(),\n c7 = s7.Pop();\n if (i > 0) cs[i - 1] = sc.Pop();\n bool eq = seq.Pop();\n if (Math.Min(c4, c7) + s.Length - i < Math.Max(c4, c7))\n continue;\n if (i >= s.Length)\n {\n if (c4 == c7)\n return true;\n continue;\n }\n for (int j = 1; j >= 0; j--)\n {\n if (eq && val[j] < s[i])\n continue;\n sc.Push(val[j]);\n si.Push(i + 1);\n s4.Push(c4 + 1 - j);\n s7.Push(c7 + j);\n seq.Push(eq && s[i] == val[j]);\n }\n }\n return false;\n }\n\n public static void Main()\n {\n s = Console.ReadLine();\n cs = s.ToCharArray();\n if (s.Length%2 == 0 && dfs())\n Console.WriteLine(new string(cs));\n else\n {\n int len = s.Length;\n if (len % 2 == 0) len = len \/ 2 + 1;\n else if (len % 2 == 1) len = (len + 1) \/ 2;\n for (int i = 0; i < len * 2; i++)\n Console.Write(i < len ? '4' : '7');\n Console.WriteLine();\n }\n return;\n for (int t = 7700; t <= 7900; t++)\n {\n \/\/s = '1' + \"\".PadLeft(99999, '0');\n Console.Write(t + \":\");\n s = t.ToString();\n cs = s.ToCharArray();\n if (dfs())\n Console.WriteLine(new string(cs));\n else\n {\n int len = s.Length;\n if (len % 2 == 0) len = len \/ 2 + 2;\n if (len % 2 == 1) len = (len + 1) \/ 2;\n for (int i = 0; i < len * 2; i++)\n Console.Write(i < len ? '4' : '7');\n Console.WriteLine();\n }\n }\n }\n }\n}\n","testcases":"[{'input': '4500\\r\\n', 'output': ['4747']}, {'input': '47\\r\\n', 'output': ['47']}, {'input': '1\\r\\n', 'output': ['47']}, {'input': '12\\r\\n', 'output': ['47']}, {'input': '4587\\r\\n', 'output': ['4747']}, {'input': '100\\r\\n', 'output': ['4477']}, {'input': '1007\\r\\n', 'output': ['4477']}, {'input': '99999999\\r\\n', 'output': ['4444477777']}, {'input': '491020945\\r\\n', 'output': ['4444477777']}, {'input': '1000000000\\r\\n', 'output': ['4444477777']}, {'input': '777777\\r\\n', 'output': ['44447777']}, {'input': '474\\r\\n', 'output': ['4477']}, {'input': '85469\\r\\n', 'output': ['444777']}, {'input': '7474747\\r\\n', 'output': ['44447777']}, {'input': '2145226\\r\\n', 'output': ['44447777']}, {'input': '5556585\\r\\n', 'output': ['44447777']}, {'input': '87584777\\r\\n', 'output': ['4444477777']}, {'input': '77777777\\r\\n', 'output': ['4444477777']}, {'input': '999999999\\r\\n', 'output': ['4444477777']}, {'input': '74477744\\r\\n', 'output': ['74477744']}, {'input': '444444444\\r\\n', 'output': ['4444477777']}, {'input': '467549754\\r\\n', 'output': ['4444477777']}, {'input': '147474747\\r\\n', 'output': ['4444477777']}, {'input': '555\\r\\n', 'output': ['4477']}, {'input': '100000\\r\\n', 'output': ['444777']}, {'input': '74777443\\r\\n', 'output': ['74777444']}, {'input': '4700007\\r\\n', 'output': ['44447777']}, {'input': '70070077\\r\\n', 'output': ['74444777']}, {'input': '123\\r\\n', 'output': ['4477']}, {'input': '7474\\r\\n', 'output': ['7474']}, {'input': '3696\\r\\n', 'output': ['4477']}, {'input': '888999577\\r\\n', 'output': ['4444477777']}, {'input': '10\\r\\n', 'output': ['47']}, {'input': '7\\r\\n', 'output': ['47']}, {'input': '50\\r\\n', 'output': ['74']}, {'input': '70\\r\\n', 'output': ['74']}, {'input': '74700\\r\\n', 'output': ['444777']}, {'input': '1024\\r\\n', 'output': ['4477']}, {'input': '73\\r\\n', 'output': ['74']}, {'input': '74710000\\r\\n', 'output': ['74744477']}, {'input': '444000000\\r\\n', 'output': ['4444477777']}, {'input': '4\\r\\n', 'output': ['47']}, {'input': '9\\r\\n', 'output': ['47']}, {'input': '99\\r\\n', 'output': ['4477']}, {'input': '48\\r\\n', 'output': ['74']}, {'input': '47474749\\r\\n', 'output': ['47474774']}, {'input': '47474774\\r\\n', 'output': ['47474774']}, {'input': '4777\\r\\n', 'output': ['7447']}, {'input': '7748\\r\\n', 'output': ['444777']}, {'input': '7773\\r\\n', 'output': ['444777']}, {'input': '19\\r\\n', 'output': ['47']}, {'input': '447777\\r\\n', 'output': ['474477']}, {'input': '49102094540227023300\\r\\n', 'output': ['74444444444777777777']}, {'input': '5594108733309806863211189515406929423407691887690557101598403485\\r\\n', 'output': ['7444444444444444444444444444444447777777777777777777777777777777']}, {'input': '7004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\\r\\n', 'output': ['7444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777']}, {'input': '795193728547733389463100378996233822835539327235483308682350676991954960294227364128385843182064933115\\r\\n', 'output': ['44444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777']}, {'input': '301382122197829808656613399420562764951572481833611230329075722481445978197842266439897625476362443656208649761035811772798756428618345007502378773513842734025400853676294262578640304874925665385620969733222114618795094220591624183177469045899618693581145...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777...']}, {'input': '61136338618684683458627308377793588546921041456473994251912971721612136383004772112243903436104509483190819343988300672009142812305068378720235800534191119843225949741796417107434937387267716981006150\\r\\n', 'output': ['74444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '526555890263119757633581621127083649847999764998329920328269766380711569281960840938078129331361539566687989563999315450947936329766384488609919296219937144991099500640739013558146241313903998769582963313684489892860656024874983638946463602603155256425277...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '359656337541570495535596692229036259138254295823773970608128157371326871668822859017267990233481525685137411515967174122395178508313541575185680538495137474161755451361511571745220633267878230944078217117373968887816250287108233790111105819421028764137532...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '572644857441140132421942747255807096805833305988086651340125855451991940035910944789722427227294827027423470359892571133559384095618773815550517606000346420892372228681350021976702338348174987065145549051119174000209319265682197997993522951757272212868453...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '599043573683856104439027643553996864930172922718193050579593140227265178809688641609079296226771746172586906362910466768194741605144777924396663290857511643060746702001318791356965828356639557730036143569264957358282516093427951005380589561898704535396465...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '247259917508033213329978700283436668925247349911687193751028546114460357462478790255716737901707817670038312409017368066801666150751218179935380115953926567959905844497912181784285489131602039421150091916944721889647073139381764961167817095360280389484951...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '839620233495334132140284749179933728711264780360341030526632441846802069795764116073504594438594457833637801964773168792432938493451846064048747603976565118198470436524623419276851413981369466457677912349027626603111552645792829970978344696298865655093856...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '680596233458569705465788423601042606237639114567090011249598812263852966370382067929765546670849148288633237610391397762455232677946335852511925659516087753908296796929375220974649508429653365375822834301794663206129356594668028542246627939025276788153158...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '251195069320073844235711294718028207393569940221659141396708541865689557466668672109186992674326781218861247057053201231685981997834330221004024396276028929267033460032996060897703746809689125932584345383640925182401678896271015230499718586573789843987788...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '761398305203150236975810733176741477690360342026700695511540431700019398059040240867278292976897516645258464666995990149873433263594134554632116631317180648687891414039623144815436037002580704356809617411407023961980506764832917585434636502804912905328498...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774744777447\\r\\n', 'output': ['47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774747444444']}, {'input': '474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...', 'output': ['474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...']}, {'input': '474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...', 'output': ['474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...']}, {'input': '474777447477447774447777477444444747747747447474\\r\\n', 'output': ['474777447477447774447777477444444747747747447474']}, {'input': '461001134113023432513011122343276211132220003240540222441103160000437733232012500416111120731670263033701324623732441101023212322443134346315261012722222743233150523000143442220341502606460146270134003634627333143211007443113522314276144143340341430143230...', 'output': ['474444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777...']}, {'input': '414040460104241705103467732322410111321456730102020342430447445322177312253032133644400342076533221343224404112502131222170054211644126072412470310430200141260034460144143540431202361331322041450253407233440277130463330457165225132033131042410126100430407...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '727232045443164232004017336043067463233151253714716613434254723160000202600033757135233430131262002216223006210031640423201430416112231443425112013542002206442316216776311521427140132300426022306005202343334263322252201723173422722342103312344415331042666...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '760050172623445531303514402404000453124043133314471023027427761214614333104305332076164340144631326474433457030103502004715470012152121033505020102443110207300251363403253465111002515041024441041734352700440201030057344766451306606446421552040607420521422...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '720436431603034224320442372001212510164126522343011034262272200353230224346331046602377325243216215330412012427335500104321345532642412347545001411531332021334123306344234016051314420246202102414203133224252614423643403321763474626264064113646266130410002...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '426342607733614324413262740153004344321256222204510610145710022363007103202274030024040036131051033604742752314041224033411122373061741300054114163017140071446041107041741712206725450474064445140032402223102027224117312572027504124513573253231023762244202...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '441426001203051411643330002074010670721702321221243423230413241430525145273160403026542614300404436511601050126044121140333023404113141304404071336127011413306725435344236142100431033013230372450632043170073742425215642477306747410130704114202673234310654...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '35881905331681060827588553219538774024143083787975\\r\\n', 'output': ['44444444444444444444444447777777777777777777777777']}, {'input': '221020945402270233\\r\\n', 'output': ['444444444777777777']}, {'input': '241925018843248944336317949908388280315030601139576419352009710\\r\\n', 'output': ['4444444444444444444444444444444477777777777777777777777777777777']}, {'input': '4747474749\\r\\n', 'output': ['4747474774']}, {'input': '4747474774\\r\\n', 'output': ['4747474774']}, {'input': '3013821221978298086566133994205627649515724818336112303290757224814459781978422664398976254763624436562086497610358117727987564286183450075023787735138427340254008536762942625786403048749256653856209697332221146187950942205916241831774690458996186935811456404646236811789323768094876439465157084437560869871534201872523316846066992005560637882936334830809562078292624820844581233002526363149920224836479222262916962782197253590084513766536500009545403848192852426840541772058312141715889523051768312545350261070...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095357456864075250350735474301206523459172092665900965024129501630212966373988276932458849720393142004789869863743947961634907491797090041095838600303393556660079821519800685499052949978754418782241756597476926001413610822\\r\\n', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '5265558902631197576335816211270836498479997649983299203282697663807115692819608409380781293313615395666879895639993154509479363297663844886099192962199371449910995006407390135581462413139039987695829633136844898928606560248749836389464636026031552564252776327042072298610617772243834598332162690748633207236969041724992007258192157728677438052313486235695862788037296077269680985036263600247647374629140798940789379173021966313171953036235465755249249349065588163665746988251674366396383356070298502792947466713...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777...']}, {'input': '3596563375415704955355966922290362591382542958237739706081281573713268716688228590172679902334815256851374115159671741223951785083135415751856805384951374741617554513615115717452206332678782309440782171173739688878162502871082337901111058194210287641375328321235138624970843264230764727843223826146695894944571949545534783868546502523064898132419756343994188739630388305452374652571869884004139669269195491829709213403240366852784169546315949980917580948827513268536333560882563219185621140487441192415658128617...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777...']}, {'input': '5726448574411401324219427472558070968058333059880866513401258554519919400359109447897224272272948270274234703598925711335593840956187738155505176060003464208923722286813500219767023383481749870651455490511191740002093192656821979979935229517572722128684530242954677937234591639406543933921393584264553545070143510487963371156151075456239168079565282696851129149944325844339105076033547064540551247638951814277551769210366429591454283731387498854711853954565721620718568555448566595137725509109332252115921107203...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '5990435736838561044390276435539968649301729227181930505795931402272651788096886416090792962267717461725869063629104667681947416051447779243966632908575116430607467020013187913569658283566395577300361435692649573582825160934279510053805895618987045353964652438415121521068998564380519093332511770138915257948823516733390947075234854837912395897801204371957935278919199141471017746475157107091718499034401345614491523186724536626759825908841655120909548134640392154155024958848688514381127156723306686142535904807...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2472599175080332133299787002834366689252473499116871937510285461144603574624787902557167379017078176700383124090173680668016661507512181799353801159539265679599058444979121817842854891316020394211500919169447218896470731393817649611678170953602803894849517883798001665873931988068465608543987110990620640454899877545013197911975636074148285314482378625396130600088011743729453908525253667227663343466686616610128874683718113351607968872115913521074131076370144031597411535573153579775091402069013643224352002479...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '8396202334953341321402847491799337287112647803603410305266324418468020697957641160735045944385944578336378019647731687924329384934518460640487476039765651181984704365246234192768514139813694664576779123490276266031115526457928299709783446962988656550938563101917862878595537323788552972891863126714533416299412474952579427903233129500323585762201601802564293323199559674719189685477525001035239872876588633701351714662714644096537402039123293674231599097097956316608817023792841428845669676574868899825758178518...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '6805962334585697054657884236010426062376391145670900112495988122638529663703820679297655466708491482886332376103913977624552326779463358525119256595160877539082967969293752209746495084296533653758228343017946632061293565946680285422466279390252767881531582735704699071143669422644336968482382677106022399295637510889604714980327995172374864896407671392923337387454990017068101183306428486980166073734527006537387203654449441786013360168869241661513482001715603896843364061058570081267383864631499192030880596537...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2511950693200738442357112947180282073935699402216591413967085418656895574666686721091869926743267812188612470570532012316859819978343302210040243962760289292670334600329960608977037468096891259325843453836409251824016788962710152304997185865737898439877887665625262554006537881302950580590900934811683942391523983645058003891082579895256399594935068519494662565495158772269671887381021945464668681033132607900056573893415318336141793708024175405900967030037580867660423018691831554218206650833841038096395350137...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7613983052031502369758107331767414776903603420267006955115404317000193980590402408672782929768975166452584646669959901498734332635941345546321166313171806486878914140396231448154360370025807043568096174114070239619805067648329175854346365028049129053284984982094781973576835614806790810052616175491607897251065650265496025729051267373813224944263285375404887693716580635399939451526346010073722573695141235877186593577711475661141697689325152326767250660976204600043646233903382400942251821223989309887136900392...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...', 'output': ['4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...']}, {'input': '4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...', 'output': ['4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...']}, {'input': '4610011341130234325130111223432762111322200032405402224411031600004377332320125004161111207316702630337013246237324411010232123224431343463152610127222227432331505230001434422203415026064601462701340036346273331432110074431135223142761441433403414301432300263254301342131314327333745711213130421310313153504022700431534463141461236322033420140324202221402036761452134031253152442133141307046425107520\\r\\n', 'output': ['4744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '4140404601042417051034677323224101113214567301020203424304474453221773122530321336444003420765332213432244041125021312221700542116441260724124703104302001412600344601441435404312023613313220414502534072334402771304633304571652251320331310424101261004304075374341521421213431444010345255301410427664006112171147304147414021032230112024371431030230211332144647141336330201232340274043176313363306203143143420202461614040333610320140211530650627220442443122474573314472441637432355242111427372260743512211432352324...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7272320454431642320040173360430674632331512537147166134342547231600002026000337571352334301312620022162230062100316404232014304161122314434251120135420022064423162167763115214271401323004260223060052023433342633222522017231734227223421033123444153310426667264302040331032026321520406511056740224275234001143006323052333100544512431030133206341373241120141060440704012522372022053074013122120274015714341024302030004110272242301204335417411205430677420405031104224343443240223045046313235710010210003114400336475...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7600501726234455313035144024040004531240431333144710230274277612146143331043053320761643401446313264744334570301035020047154700121521210335050201024431102073002513634032534651110025150410244410417343527004402010300573447664513066064464215520406074205214222343114043142412273020421377253243110620014436121404500771137511233760012006402033231502312100073241421352114435005014246543751701710202010230321640610322330631312626422141150613214347310443346043015202321371147023021620400403263046403221244613123231203343...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7204364316030342243204423720012125101641265223430110342622722003532302243463310466023773252432162153304120124273355001043213455326424123475450014115313320213341233063442340160513144202462021024142031332242526144236434033217634746262640641136462661304100020044130530077371134061073024742255331246024125370622716322573071422227565311144002201243263420524414022474133745113604130724342326413154222423705403222607041123443073072420032111321133031032304144221530342320240122207474336312334520713332404562603314106212...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4263426077336143244132627401530043443212562222045106101457100223630071032022740300240400361310510336047427523140412240334111223730617413000541141630171400714460411070417417122067254504740644451400324022231020272241173125720275041245135732532310237622442021065674523445122245743317651014334372303244764351060045303423334400540434301336711037334036440040171461247051614213340233532460744331716563503417401244460317076543432605147203215122030412404612732361200631033373176171433253451540047013520215046204003724412...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4414260012030514116433300020740106707217023212212434232304132414305251452731604030265426143004044365116010501260441211403330234041131413044040713361270114133067254353442361421004310330132303724506320431700737424252156424773067474101307041142026732343106545212113601021220631163242300103556005021044402433002261262331206453254012030562324716247141475702031003434671133441345640611313467121053644271311043217043007103133201241115601351331010302104120237725041014351211121613224266301712106122174311623455402201175...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}]","id":281} {"difficulty":2500,"lang":"MS C#","lang_cluster":"C#","src_uid":"85f43628bec7e9b709273c34b894df6b","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.IO;\nusing System.Text;\n\nnamespace Marbles\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n string s = reader.ReadLine();\n s = \"*\" + reader.ReadLine() + \"*\";\n string t = \"*\" + reader.ReadLine() + \"*\";\n\n int n = s.Length - 2;\n if (Op(s[n - 1]) == t[n - 1])\n {\n writer.WriteLine(\"NO\");\n writer.Flush();\n return;\n }\n\n int index2 = 1;\n int index1 = 1;\n\n int p1 = 1;\n int p2 = 1;\n\n for (int i = 0; i < 10; i++)\n {\n for (; index1 < n; index1++)\n {\n if (t[index2] == s[index1])\n index2++;\n else if (t[index2 - 1] == Op(s[index1]))\n index2--;\n }\n\n if (index2 == n)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n\n for (; index2 < n; index2++)\n {\n if (t[index2] == s[index1])\n index1++;\n else if (s[index1 - 1] == Op(t[index2]))\n index1--;\n }\n\n if (index1 == n)\n {\n writer.WriteLine(\"YES\");\n writer.Flush();\n return;\n }\n\n if (p1 == index1 || p2 == index2)\n {\n break;\n }\n\n p1 = index1;\n p2 = index2;\n }\n\n writer.WriteLine(\"NO\");\n writer.Flush();\n }\n\n private static char Op(char c)\n {\n switch (c)\n {\n case 'N':\n return 'S';\n case 'S':\n return 'N';\n case 'W':\n return 'E';\n case 'E':\n return 'W';\n }\n return '1';\n }\n }\n}","description":"In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a side.One example of a grid path is (0,\u20090)\u2009\u2192\u2009(0,\u20091)\u2009\u2192\u2009(0,\u20092)\u2009\u2192\u2009(1,\u20092)\u2009\u2192\u2009(1,\u20091)\u2009\u2192\u2009(0,\u20091)\u2009\u2192\u2009(\u2009-\u20091,\u20091). Note that squares in this sequence might be repeated, i.e. path has self intersections.Movement within a grid path is restricted to adjacent squares within the sequence. That is, from the i-th square, one can only move to the (i\u2009-\u20091)-th or (i\u2009+\u20091)-th squares of this path. Note that there is only a single valid move from the first and last squares of a grid path. Also note, that even if there is some j-th square of the path that coincides with the i-th square, only moves to (i\u2009-\u20091)-th and (i\u2009+\u20091)-th squares are available. For example, from the second square in the above sequence, one can only move to either the first or third squares.To ensure that movement is not ambiguous, the two grid paths will not have an alternating sequence of three squares. For example, a contiguous subsequence (0,\u20090)\u2009\u2192\u2009(0,\u20091)\u2009\u2192\u2009(0,\u20090) cannot occur in a valid grid path.One marble is placed on the first square of each grid path. Genos wants to get both marbles to the last square of each grid path. However, there is a catch. Whenever he moves one marble, the other marble will copy its movement if possible. For instance, if one marble moves east, then the other marble will try and move east as well. By try, we mean if moving east is a valid move, then the marble will move east.Moving north increases the second coordinate by 1, while moving south decreases it by 1. Similarly, moving east increases first coordinate by 1, while moving west decreases it.Given these two valid grid paths, Genos wants to know if it is possible to move both marbles to the ends of their respective paths. That is, if it is possible to move the marbles such that both marbles rest on the last square of their respective paths.","input_specification":"The first line of the input contains a single integer n (2\u2009\u2264\u2009n\u2009\u2264\u20091\u2009000\u2009000)\u00a0\u2014 the length of the paths. The second line of the input contains a string consisting of n\u2009-\u20091 characters (each of which is either 'N', 'E', 'S', or 'W')\u00a0\u2014 the first grid path. The characters can be thought of as the sequence of moves needed to traverse the grid path. For example, the example path in the problem statement can be expressed by the string \"NNESWW\". The third line of the input contains a string of n\u2009-\u20091 characters (each of which is either 'N', 'E', 'S', or 'W')\u00a0\u2014 the second grid path.","output_specification":"Print \"YES\" (without quotes) if it is possible for both marbles to be at the end position at the same time. Print \"NO\" (without quotes) otherwise. In both cases, the answer is case-insensitive.","notes":"NoteIn the first sample, the first grid path is the one described in the statement. Moreover, the following sequence of moves will get both marbles to the end: NNESWWSWSW.In the second sample, no sequence of moves can get both marbles to the end.","sample_inputs":["7\nNNESWW\nSWSWSW","3\nNN\nSS"],"sample_outputs":["YES","NO"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Marbles\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n reader.ReadLine();\n List s = reader.ReadLine().ToCharArray().ToList();\n s.Reverse();\n for (int i = 0; i < s.Count; i++)\n {\n s[i] = Op(s[i]);\n }\n\n s.AddRange(reader.ReadLine().ToCharArray());\n\n var pi = new int[s.Count];\n\n for (int i = 1; i < s.Count; ++i)\n {\n int j = pi[i - 1];\n while (j > 0 && s[i] != s[j])\n j = pi[j - 1];\n if (s[i] == s[j]) ++j;\n pi[i] = j;\n }\n\n writer.WriteLine(pi[pi.Length - 1] == 0 ? \"YES\" : \"NO\");\n writer.Flush();\n }\n\n\n private static char Op(char c)\n {\n switch (c)\n {\n case 'N':\n return 'S';\n case 'S':\n return 'N';\n case 'W':\n return 'E';\n case 'E':\n return 'W';\n }\n return '1';\n }\n }\n}","testcases":"[{'input': '7\\r\\nNNESWW\\r\\nSWSWSW\\r\\n', 'output': ['YES']}, {'input': '3\\r\\nNN\\r\\nSS\\r\\n', 'output': ['NO']}, {'input': '3\\r\\nES\\r\\nNW\\r\\n', 'output': ['NO']}, {'input': '5\\r\\nWSSE\\r\\nWNNE\\r\\n', 'output': ['NO']}, {'input': '2\\r\\nE\\r\\nE\\r\\n', 'output': ['YES']}, {'input': '2\\r\\nW\\r\\nS\\r\\n', 'output': ['YES']}, {'input': '2\\r\\nS\\r\\nN\\r\\n', 'output': ['NO']}, {'input': '100\\r\\nWNWWSWWSESWWWSSSSWSSEENWNWWWWNNENESWSESSENEENNWWWWWSSWSWSENESWNEENESWWNNEESESWSEEENWWNWNNWWNNWWWWSW\\r\\nEESEESSENWNWWWNWWNWWNWWSWNNWNWNWSWNNEENWSWNNESWSWNWSESENWSWSWWWWNNEESSSWSSESWWSSWSSWSWNEEESWWSSSSEN\\r\\n', 'output': ['NO']}, {'input': '200\\r\\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\\r\\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSENWWNENESESWNENNESWNWNNENNWWWSENWSWSSSENNWWNEESENNESEESSEESWWWWWWNWNNNESESWSSEEEESWNENWSESEEENWNNWWNWNNNNWWSSWNEENENEEEEEE\\r\\n', 'output': ['YES']}, {'input': '300\\r\\nESWSEEENWSWNWSWNNNWWWSWSENESSWSSWSENWNEESSSENENEEESSSENNWWNWWSSEEESWNWWWSESWSSSENNNEESEENENWWNNWSSWWSSWWNWWWNEEEENNNWNNWWSSSSESWSESWWNESSWNNNENWSENEESEENWSWNNNEEEESWSSSWWNESEEESWWWNNESESSWSSWWWSSESWNENNESENNWSEESEENEESESSSESWNWNWNEEESSSSSENENWWNNWWSWSSWSEENWSSSSWSESEEESESENWSSWWNWSENNWSSSWNWNENENNN\\r\\nSESSWNWWNNWWNWSSWNWSWWWNWWSWWNWNNENESSEESSSESEEENESENESESEEESEESWSWNNWNWSEENWNESESESWNEEESEEENWSSESSESWNESWWNESEESSEEENENENNNESWWNNNWNNWWWWNENWNNWSESWWSWSWWNNNENNESWSESSEENESSESESWNWNNWNESEENEEESENNWSWNWNE...', 'output': ['NO']}, {'input': '400\\r\\nSSWWNNNENWNNWSSWSWNWSSWNWWWNEESWWWSESWSSSWWWNWNESESWNWWSWNEENEEESSSWNWWNESEENESWSENWWNWWWWSSSSWWWWNNENESWSWSEESENESWWSSWSEEENESWSENEESEEENWNNESSWNWWNEEEEESSESEENNWWSESWWNWSESSSESSSSESEENNENWNNWNENWWWNWWNWNWSWSENNWWNNEESSSSWWNWNWSEESSSSWSEESWSENESENWWSESSSEENNNWNNNWWSSENWWSENNENWWNWWWSWWNWWWNENWNENEENEENEESSWSSWNENWNENENNENNWSWNNESENWNWWSESWNNESSWNNWWNWSSENWSESENNEEEEEESESSWSSEESSENWWWWNEENNNWNENN\\r\\nNWWSENEESWNNESESWNENWWNNENESWNWSWSWWWNNESESEENEENEEEESSWWNWSESWSSEEEENNWSENWWNNWNNEESEEEEEENENENENEEENWWW...', 'output': ['YES']}, {'input': '500\\r\\nWWNNESWWNNENNENESESSESESENNWWSWSWWSSEEEEEENENWWSWSSEENESWSWNWWWNWSESWSWWSENEENENWNWWWSEEENNWWSWSESESSENENWSSEESWNNNWWSSENEENNESSEENWSSSSWSWWWWSENNENEESSWWNENESWSEESESSWNWWWWWWSEEESSWWWWNWSSEENENNESEEEESWNEESEENWWSSWNNNWNEEENWWNEENNNESWSWWNESWNEENNWNESSSWNESWSENNNNEEESENWNESESSENWSWNWWSWNWWNWNENENNNWSEENNENWWSESSWSSWNESESWWWWWNNEEENESSSWNNWWWSSEENNEEESSSWWNESWNWWNWSESSWSESSEEESWWSWNESWWNNESWSSWSWNWNWNNEESSSEESSEEESWNEENNNWSEENEESENWWWWWNNWWWWNNNESSSWNENNNWWNEESWSSSWSENESESSSSEESENNEENNNEESSESEES\\r\\nNNWSS...', 'output': ['NO']}, {'input': '500\\r\\nWNWNNWSSSSWNWWSENNEEESEEEEESSSEESWNNEESSESESESWNESSWWWNWWSSSENWNWSSESSESEEEENNESWNNNNENWSSWSESSESSESSESSSWWNWNWWSWNNWNNNNNWNWNEESSSSSENWNEENEEESESWWNEESENWSWWSSWNWNNWNNWWWWWSENWSSENENENNEEENNWWSSSSWWSWWWWWSESSEESSSSENENEEENNNWSENNNENWWWSSENESWWNWWWWSSSSSWSEENEEEEENWWSWNNNNNWSEEESSESSSESSSENNNNESSESWNWNWSSSESSWSSSSWNEEEENNESEEEEENESEEESSEENNESESESSSWSEESWSWWNENEESWNENWWSWSSSESWSWWSENWWSESSWNENNWSESSEEENENESWWWNNWSWNWSWWSSSEEENEEEEEENEENESEESESEENEENENNNNNNENWWSWSESWWWSWNWSESSWSESWNWSENNENENNWSES\\r\\nWNNWW...', 'output': ['NO']}, {'input': '999999\\r\\nNENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENEN...', 'output': ['YES']}, {'input': '1000000\\r\\nNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNWNW...', 'output': ['YES']}, {'input': '999997\\r\\nSESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESES...', 'output': ['NO']}, {'input': '999998\\r\\nSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWSWS...', 'output': ['NO']}, {'input': '999999\\r\\nENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENENE...', 'output': ['NO']}, {'input': '1000000\\r\\nESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESESES...', 'output': ['NO']}, {'input': '1000000\\r\\nWNWWNNWNNESSWWWSENEESEEEEENENWNWWSSESESWSEESESSENWSWWSWNENWNNENEESESEESWSESWWNNNWSSSWNNENESWWWWNEESESEEESWWWNENENWSWNEENWSENWWWNNWSENNNNNEEEESWNNESEESSSSSWWNENWWWWWSENNNENENWNWWSWSWSSWWSENENWSWSWWWNWNENENNEENENWNNWSWNWSSWSEESESSWNWWNNWWWWSSESSSWSEESENENWWWSWNWNNNENWSWWNNWNWWWSSSESESWNWNNENNESWWSWNESWWSSSSENNESWWSWNESESENNWSSSESENENEESWSEESWNENESWWWSWNNENNWSENNNENWNENWWSWNNESSEENNNEESWNEESWNENWSWWSWWWNNEEESSWWNENWNEENNENWWNENNNESSESSSWWSWNNNWNWNNNENNNNWNWSEEESWNNNWWSWNNNNWSWWWSWWNESWSWWWNNNWNWNNENN...', 'output': ['NO']}, {'input': '1000000\\r\\nWWSENEEENNNNWWNWSESEENWWWWNWWNNWNNESSESESWSWNNWNESSSSSSWWWSWSESSSEENENNNWNEENWNNENNENNENESSWNENWWNESSWWWNNNENNWWNNENWNESWWWNNEENNWSENWNNEENENEENEENNNWNNNWSWSESSENNEEENEEENWNWSWWSENWSEENNWWNWNWSSSSEESEENWNESWSWNESWSWSSENWNNWWSWWNNENNENNENESENWWWNWWSWWWWNEESEESWNENESWWSSENWNNESSENWSEESWWNWWSSWSSWNNNNWWNNNWWSWNWWWWNWNESESSWWNNEEENNWNNEEENNNWWNNNNEESEESESENEESESENEESWSWWSSSSEESWSSSWNWWSSESEEEEESEEEEESWWSWSWSWNENNENWWSESENESESEEESSESWNNEENWWNWNENEEESENESSSWNWWNNENNWNESENWNWWNENNNWNENWNWNWSENESENWNNENNE...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWSESSSSWNWNNENWNESSSWNWNESESSESWWWSEEESSESEESSESSEEESESWNNWWSSSEESWNWWWSWSSWNNENNENENEESENNNWNENWSSSEESSWNNNESESEEEESSENNNESWSWSWWSESSSSWWWNESSWSENEESSESESSSWSEESSENNNWNEESSSESWWSENENENWWWWNNEEEENNNNEESSSWWNEEESWNENENESWNNWSWNNENEENESEEESEENNWSSWWWSSSSWWNWNNNENWNWSSSSSENEEESSESWWWWSEESENNNENESEESENWSENWWWNNWSWNENWWSSWSWWWWWSWSENENNENEENWWSSENENESESWWNEENESWWSWWSESSESWNNEEENENESESSEESWSSSWSESSSSESSWSWNNESSSWWWSWNWSWWSWNENESWNNWNEENWWWWWSWSEEEEEENNESWSWSWNWWSWWWWWSSWWSSSWNENNESWWWSSSWSESEENENNESSSEN...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWWNWWNEENNNNNWWWNNWWNWSEEENWNENENWSSEESSEEESWWSSENWWSWWWSESENEESEESWNWSSESWWSWSWNNEEENWWWNWNWWNNWNEESSENWSESWWWSESSSSSWNESEENENWSSWWWSSENESESSESWSEESSSSESENNWNENEENWNWSWSWNNNNNWWNWNWSEEENWWSEEENNENNESENWSENNWWWWNNNENENWWWSEENWWNNWWNWWWNWSWNENESWWNNNESENWSEESSEENNNWNWWSSWWNNESWSWWSSEESWSWWNWWWSWSWWWSWWSSENESSWNWNEESSEEENWWSWSSWNNEEENNNENWNESESSWWSSWSWNWWWWSWSWNNWWSWSSSWSSWSENNWSWNWNNEENNENWNESESWSSSWSSWNWWWSSSEEESWWWWWNWSESENEEESENWNNWSWWSSSSENNEENWSSESEESWSSSSENEEENESENNEESWWNESWSSWWSWWSWSWNWWSWNW...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWNNNNNWSESEESWWWSWNWWSWSWNEEENWNNESWWWSSSESWNNNESWSENEESWWNWNWSWNWSESWNESWSENWNNWWNESENNEEENWWSENWSENEEENWSWSSWWSWWNESSSENNNWWNENWWNESWSSWSEESENWNWNNEESSWSSSWWNENWWWNEESSWWNNWNWSWNNWSESSSWWSSSEESESENWNNNWSSWWNWWWWSWNNNNNWWNWWNNNWNNEENWSSENEESWWNEEENWWWSESEEEESESSWNWWWSWSWNEENENEENNEESSEEENEESWSSSWSSWNNNEESESSSEEESWSSEEEENENNWWNNNESESSSSEENWSENNNWSSSESEEEENWNESSWNNWSESEESWNWNENEENENESENNENWNWSWSEESEENNWSESENESWSWSWNWSSENWWNNNESWWSWSWSSSWWSWSSENWNWWWSENEESSWWWSWWNENESENENWSWNWNWSEENEESWSSEESSENWSENW...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWWWWWWWNWNWWSESEESWWWSESEEENEEEENEESSSEENNWNNWSSESSWWWNESWNEESSSWSSSWWWSESEENENWWWSSEENNENNWSWSSSSSWSENWSESENNNENENWNESEENNENWSWSWNEENNWSWSESSWSWSWNNENWWSESSEESSWWSWWNEEEENWNNWSEESWSSWWWWNESSSSWSEEEESENWSENEENWNEESWNWWNENWSWNESWNEESSWSESSSWWWWNENNNWSENNWWWNWWWNWSSENNEENEESWNESEEEENWSSSESSSEESSENNWWWSWSWWNNENESENNWNNNEEEENNWSWWSENESSWWSSSWNNENEENWSEENWWWSSWWNWNEESEENENENENWSWNENWWSENWWNNESSWSESSWSWNWWWWSWWNEESSSWNEEEEESEESENWWSSESSSWNESENWNENWSSSWNEEEESWNNENENNWNWSESWWSSENENWWWSEEESSSSEESEENNWNWWSE...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWSWSSSWSEENWWNWNWWSESESESWWNNEEENNNWNESWSESEENENESWSENESESSEENNENENEENWNESWSSESWSSESSWSEEEENEENEEENNNNNEEEEENNENENEEENNWWWNESWWNNWWWWNWSENNESSENENWSSEENENESWWNENENNWNWWWNNWSENESSSSSWWWWWNESEESENNWNWWSSWSSESESWNWWNNESESWSSWWWNNENWSWNNWSEESSWNESENNNWNWNNWSESWWSESEESEEESESWSSWNWWNEEESWSSESWNENESSWSENWWNWNWSWWSWSWNWNEESEESSWSSEEENWSWNWWNENWNWWNWNWSENWSWSEEESSWWWWWWSSSEEEESESEENNEENEEENENNENNNESWWWSENNWNESWWNNESSENNWSWNWNNNEEEENWWSESSWNNNNESWNWNNNENNENESSSWWWWNENENWNWWSEEENWWWSEESSENENEESSWSWNESWNWWSES...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWSSWWSSSSSSWWNWSSESENEENNWSESEESWWSWSWWWSSWNESESESSESWNNENNNNWWNNWNWNWWNWSESENEEENWSSEESSWWWNNENNWNNEENENEESWSWNNNNNNEENNEENWWSWWSEEENNENWSWNEESENWWSSENWNWNNWSSESEEEEEEEENWNNEEENEESWNWNEESSSEEEEESSENNESWWNNENWSWNNWSEENNEESSENWNENWWNEENNESWNEEENNESENWWSEENWNNNWNESESWNENWWNNWNWNNWWWSWNENESWWNENWSENENESENENNNWWNNNNWNWSWNEEENNNWWSWWWSWWWWNESSESEESWNEESSSSESSESWSWWWSWWSEESENEENESWWWWWSWSSESSESSWSEEENNWSWWNWNNWNNWSENWSESWSWNENESESWNNNENENNWWNWWNWNENENNWWWSWNWNNNNENESESSWSSSWNWNENWSENNEESWNEEENNNWWSSSWNN...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nWWWNNWSSWSEESEESSWNWSESWSSEEENESSWNNNNWSSWNEENWSSWWNNNEENWWWNNWSESEESWNWSSWNNNEEENENESWWSSWWNENNNEESESWNWWNWNENEENENWWNWSSWNWWWNWSWWNESSEEESWWNNWSESSSWSSWSWNNESWWWNENNWWNNENEESWSEESSSSENNNNWSENNWSSEEENEESSSENNWSWNNWSSWWNWNNENEENNNNEEEENWWWNESWNESESSWSSSWNNENNNESWNNNWNEENENWWSSEESWSESESEESENWSSWNEESSWSWWWNWWWSSENNNENENNNNENWNESSSWSSESWSSWNENNEENWNESWNNNENWNENENNWWNNESESWSSWWSWNWWNNNWSSESESESESEESEEEESWWWSSENWNNESEEESSWWNWNNNNESWNWNNNNENEESWSWSSWSEESWWWNNWNEENNWSSWSESSENWSEENNEENEESSSWWWNWNESWWSENNN...', 'output': ['NO', 'YES']}, {'input': '1000000\\r\\nNEESEESWWWNNNNESWWNWNWNNEESSWSSEENNNWWWSWNESWSSESEEEESSSESSWSENNWNENNWNWWNWWNNEEENEENWWNNWSENWSSSWSWWWNEEESWSWSSWWSSWWWNWSEESSEEENNWNESSWWSWWNWNNWSWWNNNEEEESSWNWNWSWSWSWWSWWNENEEEESSWWNWSWSWWNWNNWNWSSESEENEENENWSWWWWNNENNNWWSSSWNEEESWWSENNEESESESEESESSENESEEENESEEEEENNESEESESSWNESWWSWNESESWSWSSWSSENNNWNWWSSEEENNNNENNWWSSSSWNENWSSESENNNWSWSESEESENNESWSWNESSENNNWNWSSEEENWSEESWSSESWNESSESESENNWNNNESSEEESEENNESWNWNNNENESSWWSSWNNNNENWSSSSSENWNNENEENWNESSENWNWSSWWWNWWWSSSENESESENENWWNWWSWNNWSWSWNENWWWNE...', 'output': ['NO']}, {'input': '11\\r\\nWWNNNNWNWN\\r\\nENWSWWSSEE\\r\\n', 'output': ['YES']}, {'input': '1000000\\r\\nWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW...', 'output': ['NO']}, {'input': '12\\r\\nWNNWSWWSSSE\\r\\nNESWNNNWSSS\\r\\n', 'output': ['YES']}]","id":282} {"difficulty":1800,"lang":"MS C#","lang_cluster":"C#","src_uid":"a3a337c7b919e7dfd7ff45ebf59681b5","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Online_Meeting\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n var nn = new int[n + 1];\n var op = new int[m];\n var id = new int[m];\n\n for (int i = 0; i < m; i++)\n {\n op[i] = Next();\n id[i] = Next();\n\n if (op[i] == 1)\n {\n if (nn[id[i]] == 0)\n {\n nn[id[i]] = 1;\n }\n }\n else\n {\n if (nn[id[i]] == 0)\n {\n nn[id[i]] = 2;\n }\n }\n }\n\n for (int i = 1; i < nn.Length; i++)\n {\n if (nn[i] == 0)\n nn[i] = 3;\n }\n\n int count2 = nn.Count(t => t == 2);\n\n if (count2 == 0)\n {\n int id3 = id[0];\n int count3 = 1;\n bool ok = true;\n for (int i = 1; i < m; i++)\n {\n if (op[i] == 1)\n {\n count3++;\n if (count3 == 1)\n {\n if (id[i] != id3)\n {\n ok = false;\n break;\n }\n }\n }\n else\n {\n count3--;\n if (count3 == 0)\n {\n if (id[i] != id3)\n {\n ok = false;\n break;\n }\n }\n }\n }\n if (ok)\n {\n nn[id3] = 3;\n }\n }\n else\n {\n for (int i = 1; i <= n; i++)\n {\n if (nn[i] == 2)\n {\n nn[i] = 3;\n }\n }\n int id4 = -1;\n for (int i = 0; i < m; i++)\n {\n if (op[i] == 1)\n {\n count2++;\n if (count2 == 1)\n {\n if (id4 >= 0)\n {\n if (id[i] != id4)\n id4 = -2;\n }\n }\n }\n else\n {\n count2--;\n if (nn[id[i]] == 3)\n nn[id[i]] = 2;\n if (count2 == 0)\n {\n if (nn[id[i]] == 2)\n {\n if (id4 == -1)\n id4 = id[i];\n else\n {\n if (id4 != id[i])\n {\n id4 = -2;\n }\n }\n }\n else id4 = -2;\n }\n }\n }\n if (id4 > 0)\n nn[id4] = 3;\n }\n\n int count = nn.Count(t => t == 3);\n\n writer.WriteLine(count);\n\n if (count > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n if (nn[i] == 3)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n }\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n do\n {\n c = reader.Read();\n if (c == '-')\n return -1;\n if (c == '+')\n return 1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}","description":"Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the project, the F company conducts shared online meetings in a Spyke chat.One day the director of the F company got hold of the records of a part of an online meeting of one successful team. The director watched the record and wanted to talk to the team leader. But how can he tell who the leader is? The director logically supposed that the leader is the person who is present at any conversation during a chat meeting. In other words, if at some moment of time at least one person is present on the meeting, then the leader is present on the meeting.You are the assistant director. Given the 'user logged on'\/'user logged off' messages of the meeting in the chronological order, help the director determine who can be the leader. Note that the director has the record of only a continuous part of the meeting (probably, it's not the whole meeting).","input_specification":"The first line contains integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009105) \u2014 the number of team participants and the number of messages. Each of the next m lines contains a message in the format: '+ id': the record means that the person with number id (1\u2009\u2264\u2009id\u2009\u2264\u2009n) has logged on to the meeting. '- id': the record means that the person with number id (1\u2009\u2264\u2009id\u2009\u2264\u2009n) has logged off from the meeting. Assume that all the people of the team are numbered from 1 to n and the messages are given in the chronological order. It is guaranteed that the given sequence is the correct record of a continuous part of the meeting. It is guaranteed that no two log on\/log off events occurred simultaneously.","output_specification":"In the first line print integer k (0\u2009\u2264\u2009k\u2009\u2264\u2009n) \u2014 how many people can be leaders. In the next line, print k integers in the increasing order \u2014 the numbers of the people who can be leaders. If the data is such that no member of the team can be a leader, print a single number 0.","notes":null,"sample_inputs":["5 4\n+ 1\n+ 2\n- 2\n- 1","3 2\n+ 1\n- 2","2 4\n+ 1\n- 1\n+ 2\n- 2","5 6\n+ 1\n- 1\n- 3\n+ 3\n+ 4\n- 4","2 4\n+ 1\n- 2\n+ 2\n- 1"],"sample_outputs":["4\n1 3 4 5","1\n3","0","3\n2 3 5","0"],"human_solution":"\ufeffusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nnamespace Online_Meeting\n{\n internal class Program\n {\n private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);\n private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);\n\n private static void Main(string[] args)\n {\n int n = Next();\n int m = Next();\n\n var nn = new int[n + 1];\n var op = new int[m];\n var id = new int[m];\n\n for (int i = 0; i < m; i++)\n {\n op[i] = Next();\n id[i] = Next();\n\n if (op[i] == 1)\n {\n if (nn[id[i]] == 0)\n {\n nn[id[i]] = 1;\n }\n }\n else\n {\n if (nn[id[i]] == 0)\n {\n nn[id[i]] = 2;\n }\n }\n }\n\n for (int i = 1; i < nn.Length; i++)\n {\n if (nn[i] == 0)\n nn[i] = 3;\n }\n\n int count2 = nn.Count(t => t == 2);\n\n if (count2 == 0)\n {\n int id3 = id[0];\n int count3 = 1;\n bool ok = true;\n for (int i = 1; i < m; i++)\n {\n if (op[i] == 1)\n {\n count3++;\n if (count3 == 1)\n {\n if (id[i] != id3)\n {\n ok = false;\n break;\n }\n }\n }\n else\n {\n count3--;\n if (count3 == 0)\n {\n if (id[i] != id3)\n {\n ok = false;\n break;\n }\n }\n else if (id[i] == id3)\n {\n ok = false;\n break;\n }\n }\n }\n if (ok)\n {\n nn[id3] = 3;\n }\n }\n else\n {\n for (int i = 1; i <= n; i++)\n {\n if (nn[i] == 2)\n {\n nn[i] = 3;\n }\n }\n int id4 = -1;\n for (int i = 0; i < m; i++)\n {\n if (op[i] == 1)\n {\n count2++;\n if (count2 == 1)\n {\n if (id4 >= 0)\n {\n if (id[i] != id4)\n id4 = -2;\n }\n }\n }\n else\n {\n count2--;\n if (nn[id[i]] == 3)\n nn[id[i]] = 2;\n if (count2 == 0)\n {\n if (nn[id[i]] == 2)\n {\n if (id4 == -1)\n id4 = id[i];\n else\n {\n if (id4 != id[i])\n {\n id4 = -2;\n }\n }\n }\n else id4 = -2;\n }\n }\n }\n if (id4 > 0)\n nn[id4] = 3;\n }\n\n int count = nn.Count(t => t == 3);\n\n writer.WriteLine(count);\n\n if (count > 0)\n {\n for (int i = 1; i <= n; i++)\n {\n if (nn[i] == 3)\n {\n writer.Write(i);\n writer.Write(' ');\n }\n }\n }\n\n writer.Flush();\n }\n\n private static int Next()\n {\n int c;\n do\n {\n c = reader.Read();\n if (c == '-')\n return -1;\n if (c == '+')\n return 1;\n } while (c < '0' || c > '9');\n int res = c - '0';\n while (true)\n {\n c = reader.Read();\n if (c < '0' || c > '9')\n return res;\n res *= 10;\n res += c - '0';\n }\n }\n }\n}","testcases":"[{'input': '5 4\\r\\n+ 1\\r\\n+ 2\\r\\n- 2\\r\\n- 1\\r\\n', 'output': ['4\\r\\n1 3 4 5', '4\\r\\n1 3 4 5']}, {'input': '3 2\\r\\n+ 1\\r\\n- 2\\r\\n', 'output': ['1\\r\\n3']}, {'input': '2 4\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n', 'output': ['0']}, {'input': '5 6\\r\\n+ 1\\r\\n- 1\\r\\n- 3\\r\\n+ 3\\r\\n+ 4\\r\\n- 4\\r\\n', 'output': ['3\\r\\n2 3 5', '3\\r\\n2 3 5']}, {'input': '2 4\\r\\n+ 1\\r\\n- 2\\r\\n+ 2\\r\\n- 1\\r\\n', 'output': ['0']}, {'input': '1 1\\r\\n+ 1\\r\\n', 'output': ['1\\r\\n1']}, {'input': '2 1\\r\\n- 2\\r\\n', 'output': ['2\\r\\n1 2', '2\\r\\n1 2']}, {'input': '3 5\\r\\n- 1\\r\\n+ 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 3\\r\\n', 'output': ['1\\r\\n1']}, {'input': '10 8\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n- 3\\r\\n+ 3\\r\\n+ 7\\r\\n- 7\\r\\n+ 9\\r\\n', 'output': ['6\\r\\n3 4 5 6 8 10', '6\\r\\n3 4 5 6 8 10']}, {'input': '5 5\\r\\n+ 5\\r\\n+ 2\\r\\n+ 3\\r\\n+ 4\\r\\n+ 1\\r\\n', 'output': ['1\\r\\n5']}, {'input': '5 4\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n+ 2\\r\\n', 'output': ['4\\r\\n1 3 4 5', '4\\r\\n1 3 4 5']}, {'input': '10 3\\r\\n+ 1\\r\\n+ 2\\r\\n- 7\\r\\n', 'output': ['7\\r\\n3 4 5 6 8 9 10', '7\\r\\n3 4 5 6 8 9 10']}, {'input': '100000 100000\\r\\n- 97206\\r\\n- 31301\\r\\n+ 86484\\r\\n- 23618\\r\\n+ 25336\\r\\n+ 28357\\r\\n+ 87099\\r\\n- 60544\\r\\n+ 82642\\r\\n+ 11099\\r\\n+ 94956\\r\\n- 60825\\r\\n- 37553\\r\\n- 76184\\r\\n- 54594\\r\\n+ 72814\\r\\n- 44189\\r\\n+ 85838\\r\\n+ 50840\\r\\n- 51139\\r\\n+ 5347\\r\\n+ 59730\\r\\n- 81768\\r\\n- 49690\\r\\n- 38700\\r\\n- 76820\\r\\n- 79981\\r\\n- 54516\\r\\n- 3715\\r\\n+ 34248\\r\\n+ 43009\\r\\n- 67638\\r\\n- 65234\\r\\n- 57119\\r\\n+ 91678\\r\\n+ 85568\\r\\n- 6980\\r\\n- 53390\\r\\n- 97247\\r\\n+ 97431\\r\\n- 62212\\r\\n- 38181\\r\\n- 90079\\r\\n+ 90747\\r\\n- 53819\\r\\n+ 99543\\r\\n- 40505\\r\\n+ 54609\\r\\n+ 66069\\r\\n- 2104\\r\\n- 82117\\r\\n- 38649\\r\\n+ 67995\\r\\n+ 8953\\r\\n- 68768\\r\\n+ 8018...', 'output': ['36964\\r\\n5 12 14 15 16 17 19 21 23 27 29 32 36 38 39 42 43 50 53 55 58 59 61 64 65 66 68 70 72 75 78 79 81 82 86 87 88 93 94 95 97 100 102 103 106 107 108 110 112 115 116 117 118 119 120 121 122 129 130 134 136 137 138 139 145 148 149 151 152 153 156 157 159 160 168 169 170 171 172 174 179 183 185 191 194 196 198 200 202 208 214 216 217 219 220 221 222 224 225 226 228 231 232 233 234 237 238 240 246 251 254 258 259 262 263 264 265 267 268 269 271 273 275 278 280 282 287 294 299 300 301 302 303 304 308 311 31...', '36964\\r\\n5 12 14 15 16 17 19 21 23 27 29 32 36 38 39 42 43 50 53 55 58 59 61 64 65 66 68 70 72 75 78 79 81 82 86 87 88 93 94 95 97 100 102 103 106 107 108 110 112 115 116 117 118 119 120 121 122 129 130 134 136 137 138 139 145 148 149 151 152 153 156 157 159 160 168 169 170 171 172 174 179 183 185 191 194 196 198 200 202 208 214 216 217 219 220 221 222 224 225 226 228 231 232 233 234 237 238 240 246 2...']}, {'input': '1 20\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n', 'output': ['1\\r\\n1']}, {'input': '20 1\\r\\n- 16\\r\\n', 'output': ['20\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20', '20\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20']}, {'input': '50 20\\r\\n- 6\\r\\n+ 40\\r\\n- 3\\r\\n- 23\\r\\n+ 31\\r\\n- 27\\r\\n- 40\\r\\n+ 25\\r\\n+ 29\\r\\n- 41\\r\\n- 16\\r\\n+ 23\\r\\n+ 20\\r\\n+ 13\\r\\n- 45\\r\\n+ 40\\r\\n+ 24\\r\\n+ 22\\r\\n- 23\\r\\n+ 17\\r\\n', 'output': ['34\\r\\n1 2 4 5 7 8 9 10 11 12 14 15 18 19 21 26 28 30 32 33 34 35 36 37 38 39 42 43 44 46 47 48 49 50', '34\\r\\n1 2 4 5 7 8 9 10 11 12 14 15 18 19 21 26 28 30 32 33 34 35 36 37 38 39 42 43 44 46 47 48 49 50']}, {'input': '20 50\\r\\n+ 5\\r\\n+ 11\\r\\n- 5\\r\\n+ 6\\r\\n- 16\\r\\n- 13\\r\\n+ 5\\r\\n+ 7\\r\\n- 8\\r\\n- 7\\r\\n- 10\\r\\n+ 10\\r\\n- 20\\r\\n- 19\\r\\n+ 17\\r\\n- 2\\r\\n+ 2\\r\\n+ 19\\r\\n+ 18\\r\\n- 2\\r\\n- 6\\r\\n- 5\\r\\n+ 6\\r\\n+ 4\\r\\n- 14\\r\\n+ 14\\r\\n- 9\\r\\n+ 15\\r\\n- 17\\r\\n- 15\\r\\n+ 2\\r\\n+ 5\\r\\n- 2\\r\\n+ 9\\r\\n- 11\\r\\n+ 2\\r\\n- 19\\r\\n+ 7\\r\\n+ 12\\r\\n+ 16\\r\\n+ 19\\r\\n- 18\\r\\n- 2\\r\\n+ 18\\r\\n- 9\\r\\n- 10\\r\\n+ 9\\r\\n+ 13\\r\\n- 14\\r\\n- 16\\r\\n', 'output': ['2\\r\\n1 3', '2\\r\\n1 3']}, {'input': '100 100\\r\\n+ 85\\r\\n- 17\\r\\n- 65\\r\\n+ 5\\r\\n+ 86\\r\\n- 16\\r\\n- 85\\r\\n+ 14\\r\\n- 31\\r\\n+ 31\\r\\n+ 6\\r\\n- 48\\r\\n+ 8\\r\\n- 79\\r\\n+ 48\\r\\n- 36\\r\\n- 1\\r\\n- 30\\r\\n+ 50\\r\\n+ 12\\r\\n+ 55\\r\\n+ 100\\r\\n+ 40\\r\\n- 81\\r\\n+ 96\\r\\n- 56\\r\\n- 14\\r\\n- 51\\r\\n- 54\\r\\n- 52\\r\\n+ 69\\r\\n- 38\\r\\n- 74\\r\\n+ 62\\r\\n- 9\\r\\n+ 67\\r\\n+ 60\\r\\n+ 93\\r\\n+ 18\\r\\n- 55\\r\\n- 48\\r\\n- 34\\r\\n+ 79\\r\\n+ 82\\r\\n+ 58\\r\\n- 67\\r\\n+ 20\\r\\n- 27\\r\\n- 7\\r\\n+ 98\\r\\n- 11\\r\\n- 99\\r\\n- 4\\r\\n+ 77\\r\\n- 6\\r\\n+ 16\\r\\n- 89\\r\\n+ 7\\r\\n- 50\\r\\n- 43\\r\\n- 60\\r\\n- 91\\r\\n+ 27\\r\\n+ 53\\r\\n- 64\\r\\n+ 67\\r\\n+ 4\\r\\n+ 64\\r\\n+ 72\\r\\n+ 54\\r\\n- 53\\r\\n+ 85\\r\\n+ 37\\r\\n- 62\\r\\n- 8\\r\\n+ 75\\r\\n- 7\\r\\n+ 13\\r\\n+ 42\\r\\n+ 17\\r\\n- 13\\r\\n- 45\\r\\n+ 29\\r\\n- 37\\r\\n- 21\\r\\n+ 1...', 'output': ['34\\r\\n2 3 15 19 22 23 25 26 28 32 33 35 39 41 44 46 49 57 59 61 63 66 68 70 71 73 76 78 80 84 87 88 90 97', '34\\r\\n2 3 15 19 22 23 25 26 28 32 33 35 39 41 44 46 49 57 59 61 63 66 68 70 71 73 76 78 80 84 87 88 90 97']}, {'input': '300 300\\r\\n+ 80\\r\\n- 71\\r\\n+ 212\\r\\n+ 299\\r\\n+ 128\\r\\n+ 255\\r\\n- 120\\r\\n- 69\\r\\n- 167\\r\\n- 230\\r\\n+ 142\\r\\n- 183\\r\\n+ 171\\r\\n- 244\\r\\n- 1\\r\\n+ 74\\r\\n- 76\\r\\n- 78\\r\\n+ 235\\r\\n- 73\\r\\n- 232\\r\\n+ 104\\r\\n+ 91\\r\\n+ 27\\r\\n+ 157\\r\\n+ 247\\r\\n+ 180\\r\\n- 58\\r\\n- 89\\r\\n- 119\\r\\n- 184\\r\\n+ 140\\r\\n+ 243\\r\\n+ 138\\r\\n- 193\\r\\n- 277\\r\\n+ 267\\r\\n+ 198\\r\\n- 146\\r\\n+ 254\\r\\n- 189\\r\\n+ 21\\r\\n- 237\\r\\n- 2\\r\\n+ 121\\r\\n+ 95\\r\\n+ 37\\r\\n- 59\\r\\n- 161\\r\\n- 174\\r\\n- 201\\r\\n- 153\\r\\n+ 60\\r\\n- 140\\r\\n- 173\\r\\n- 121\\r\\n+ 269\\r\\n+ 132\\r\\n- 212\\r\\n- 97\\r\\n+ 186\\r\\n+ 296\\r\\n+ 260\\r\\n+ 188\\r\\n- 246\\r\\n+ 286\\r\\n- 87\\r\\n+ 151\\r\\n+ 162\\r\\n+ 33\\r\\n- 61\\r\\n+ 62\\r\\n- 289\\r\\n+ 30\\r\\n- 122\\r\\n- 3...', 'output': ['118\\r\\n3 4 5 6 7 8 9 10 11 12 14 15 16 18 19 22 24 29 38 40 41 42 43 44 46 50 52 53 55 56 64 66 67 68 75 77 79 84 88 90 93 94 103 105 106 107 108 109 111 113 114 117 123 124 125 127 130 133 135 136 139 144 145 150 155 158 164 166 168 175 176 178 182 190 191 192 195 200 203 204 205 206 208 211 215 216 217 218 226 228 229 233 239 240 241 248 252 256 257 259 262 263 264 265 268 270 271 272 278 279 281 283 288 291 292 294 295 297', '118\\r\\n3 4 5 6 7 8 9 10 11 12 14 15 16 18 19 22 24 29 38 40 41 42 43 44 46 50 52 53 55 56 64 66 67 68 75 77 79 84 88 90 93 94 103 105 106 107 108 109 111 113 114 117 123 124 125 127 130 133 135 136 139 144 145 150 155 158 164 166 168 175 176 178 182 190 191 192 195 200 203 204 205 206 208 211 215 216 217 218 226 228 229 233 239 240 241 248 252 256 257 259 262 263 264 265 268 270 271 272 278 279 281 ...']}, {'input': '1000 100000\\r\\n- 320\\r\\n+ 564\\r\\n+ 462\\r\\n+ 178\\r\\n- 846\\r\\n- 437\\r\\n- 879\\r\\n+ 673\\r\\n+ 228\\r\\n+ 885\\r\\n+ 720\\r\\n+ 594\\r\\n+ 626\\r\\n+ 522\\r\\n+ 944\\r\\n- 955\\r\\n- 885\\r\\n+ 46\\r\\n+ 43\\r\\n- 598\\r\\n+ 341\\r\\n+ 442\\r\\n- 553\\r\\n+ 796\\r\\n- 593\\r\\n+ 20\\r\\n- 590\\r\\n- 18\\r\\n+ 448\\r\\n- 328\\r\\n+ 148\\r\\n+ 410\\r\\n+ 661\\r\\n+ 735\\r\\n- 845\\r\\n- 863\\r\\n+ 274\\r\\n+ 332\\r\\n- 652\\r\\n- 691\\r\\n- 755\\r\\n- 722\\r\\n+ 186\\r\\n- 9\\r\\n- 880\\r\\n+ 955\\r\\n+ 254\\r\\n+ 162\\r\\n+ 455\\r\\n- 696\\r\\n- 435\\r\\n- 70\\r\\n- 565\\r\\n+ 922\\r\\n- 79\\r\\n- 90\\r\\n+ 629\\r\\n- 442\\r\\n+ 617\\r\\n+ 42\\r\\n+ 942\\r\\n- 441\\r\\n+ 736\\r\\n+ 672\\r\\n+ 211\\r\\n- 528\\r\\n- 422\\r\\n+ 676\\r\\n- 672\\r\\n- 355\\r\\n+ 202\\r\\n- 282\\r\\n- 83...', 'output': ['0']}, {'input': '100000 1000\\r\\n- 98875\\r\\n+ 47736\\r\\n+ 32490\\r\\n+ 45292\\r\\n- 97768\\r\\n+ 33977\\r\\n+ 79100\\r\\n- 35155\\r\\n- 60085\\r\\n+ 85558\\r\\n+ 42510\\r\\n+ 15624\\r\\n- 71369\\r\\n+ 31451\\r\\n+ 23446\\r\\n- 57194\\r\\n+ 17386\\r\\n- 4952\\r\\n+ 48202\\r\\n- 1718\\r\\n+ 72736\\r\\n- 95612\\r\\n+ 81281\\r\\n- 77453\\r\\n- 78095\\r\\n+ 57269\\r\\n- 38322\\r\\n- 5227\\r\\n- 98047\\r\\n- 78417\\r\\n+ 38227\\r\\n+ 52593\\r\\n- 85143\\r\\n- 44287\\r\\n+ 89211\\r\\n- 93915\\r\\n+ 52092\\r\\n+ 99566\\r\\n- 99615\\r\\n- 53257\\r\\n- 97013\\r\\n+ 2827\\r\\n- 24824\\r\\n- 54938\\r\\n- 51274\\r\\n+ 63014\\r\\n+ 24538\\r\\n+ 94218\\r\\n- 47423\\r\\n+ 29356\\r\\n- 50044\\r\\n- 76347\\r\\n- 43261\\r\\n- 51662\\r\\n+ 37430\\r\\n- 95400...', 'output': ['99007\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 12...', '99007\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 ...']}, {'input': '100000 100000\\r\\n- 97325\\r\\n+ 40025\\r\\n+ 995\\r\\n- 33226\\r\\n- 11880\\r\\n- 25742\\r\\n- 66716\\r\\n+ 8893\\r\\n+ 11805\\r\\n+ 11688\\r\\n+ 3073\\r\\n+ 46331\\r\\n+ 4248\\r\\n+ 99931\\r\\n- 47980\\r\\n- 28616\\r\\n- 65761\\r\\n+ 48025\\r\\n+ 60759\\r\\n+ 15204\\r\\n- 47045\\r\\n+ 2453\\r\\n+ 98397\\r\\n- 5011\\r\\n- 63181\\r\\n+ 82112\\r\\n- 3514\\r\\n- 1431\\r\\n- 55716\\r\\n- 65326\\r\\n+ 1926\\r\\n- 67667\\r\\n- 30100\\r\\n- 9713\\r\\n+ 81564\\r\\n+ 44106\\r\\n+ 82408\\r\\n- 15963\\r\\n+ 57240\\r\\n- 97309\\r\\n- 58122\\r\\n- 10815\\r\\n+ 52660\\r\\n- 75151\\r\\n+ 7397\\r\\n- 13936\\r\\n- 91305\\r\\n- 963\\r\\n+ 70948\\r\\n+ 1696\\r\\n- 38515\\r\\n+ 7035\\r\\n- 91984\\r\\n+ 4001\\r\\n- 52653\\r\\n+ 54042\\r\\n- 97397\\r\\n...', 'output': ['36657\\r\\n3 4 9 10 12 14 15 22 23 24 29 31 32 36 37 39 41 45 46 54 62 63 65 67 69 74 79 81 82 84 85 86 87 92 93 96 101 102 105 106 110 115 118 119 121 123 136 141 142 143 145 151 152 159 160 162 166 167 170 173 177 178 179 185 192 195 196 198 202 205 207 208 209 211 213 216 217 221 222 228 232 234 236 239 244 249 250 251 255 257 258 263 265 270 274 281 283 286 287 290 291 292 293 300 301 303 305 306 307...', '36657\\r\\n3 4 9 10 12 14 15 22 23 24 29 31 32 36 37 39 41 45 46 54 62 63 65 67 69 74 79 81 82 84 85 86 87 92 93 96 101 102 105 106 110 115 118 119 121 123 136 141 142 143 145 151 152 159 160 162 166 167 170 173 177 178 179 185 192 195 196 198 202 205 207 208 209 211 213 216 217 221 222 228 232 234 236 239 244 249 250 251 255 257 258 263 265 270 274 281 283 286 287 290 291 292 293 300 301 303 305 306 307 308 311 314 316 318 326 327 328 329 330 338 339 342 349 350 353 355 358 360 364 365 377 378 379 383 385 391...']}, {'input': '100000 100000\\r\\n+ 23037\\r\\n- 54430\\r\\n- 19142\\r\\n- 28562\\r\\n+ 45774\\r\\n+ 14330\\r\\n+ 42506\\r\\n+ 3943\\r\\n+ 5395\\r\\n- 41225\\r\\n- 31107\\r\\n- 66550\\r\\n+ 29752\\r\\n- 65858\\r\\n+ 77136\\r\\n+ 27397\\r\\n- 35691\\r\\n+ 72248\\r\\n- 25836\\r\\n- 8215\\r\\n+ 71831\\r\\n- 97855\\r\\n+ 31156\\r\\n- 54737\\r\\n- 83178\\r\\n+ 62701\\r\\n- 64004\\r\\n+ 17559\\r\\n+ 38959\\r\\n- 59286\\r\\n- 50297\\r\\n+ 42799\\r\\n+ 63699\\r\\n- 83309\\r\\n- 88592\\r\\n- 63772\\r\\n+ 7939\\r\\n+ 7113\\r\\n+ 58788\\r\\n- 36067\\r\\n- 13483\\r\\n- 45565\\r\\n+ 27123\\r\\n- 90569\\r\\n- 34584\\r\\n+ 12733\\r\\n+ 99993\\r\\n+ 7697\\r\\n+ 29398\\r\\n+ 21471\\r\\n+ 7122\\r\\n+ 41218\\r\\n+ 84081\\r\\n- 97399\\r\\n- 67419\\r\\n+ 22910\\r...', 'output': ['36804\\r\\n5 6 12 16 17 25 26 29 31 32 36 37 38 39 41 47 48 50 51 53 57 59 61 63 65 66 67 69 71 81 82 85 88 90 96 97 99 102 105 106 108 110 111 117 121 125 126 127 128 132 134 139 141 144 145 151 158 160 162 163 165 166 167 169 170 171 173 174 175 176 179 181 182 184 186 187 188 190 214 223 224 227 230 231 238 240 242 245 246 248 250 254 255 258 262 264 265 266 268 270 271 274 276 281 282 283 284 286 287...', '36804\\r\\n5 6 12 16 17 25 26 29 31 32 36 37 38 39 41 47 48 50 51 53 57 59 61 63 65 66 67 69 71 81 82 85 88 90 96 97 99 102 105 106 108 110 111 117 121 125 126 127 128 132 134 139 141 144 145 151 158 160 162 163 165 166 167 169 170 171 173 174 175 176 179 181 182 184 186 187 188 190 214 223 224 227 230 231 238 240 242 245 246 248 250 254 255 258 262 264 265 266 268 270 271 274 276 281 282 283 284 286 287 288 292 297 306 307 316 317 318 319 323 326 330 336 337 338 339 340 343 344 347 348 349 351 355 356 358 360...']}, {'input': '100000 100000\\r\\n+ 65101\\r\\n+ 93027\\r\\n- 13097\\r\\n- 74841\\r\\n- 79667\\r\\n+ 86566\\r\\n+ 18295\\r\\n- 39536\\r\\n- 25736\\r\\n- 87115\\r\\n+ 83334\\r\\n- 10961\\r\\n+ 71609\\r\\n- 48137\\r\\n+ 65748\\r\\n- 69282\\r\\n- 13461\\r\\n+ 4310\\r\\n- 83073\\r\\n- 68522\\r\\n- 39722\\r\\n+ 44202\\r\\n+ 39722\\r\\n- 3964\\r\\n- 26235\\r\\n+ 45112\\r\\n- 3058\\r\\n- 35275\\r\\n+ 91136\\r\\n- 81186\\r\\n- 46166\\r\\n- 24229\\r\\n- 89408\\r\\n+ 3605\\r\\n- 11014\\r\\n- 6188\\r\\n- 62280\\r\\n- 80001\\r\\n+ 41791\\r\\n+ 53443\\r\\n- 95137\\r\\n+ 96379\\r\\n- 84027\\r\\n- 24940\\r\\n- 10230\\r\\n+ 49556\\r\\n+ 4628\\r\\n+ 99306\\r\\n+ 59857\\r\\n+ 92927\\r\\n+ 28164\\r\\n+ 45183\\r\\n- 93629\\r\\n+ 3567\\r\\n- 24039\\r\\n- 55982\\r...', 'output': ['36779\\r\\n3 5 8 9 11 12 14 15 18 21 22 24 26 28 30 33 37 38 53 56 58 62 76 78 80 81 83 85 95 97 98 104 105 111 113 117 118 121 124 125 126 129 134 136 137 145 146 147 150 157 158 160 162 164 169 171 175 181 187 189 191 195 197 201 202 204 208 210 212 213 216 217 222 229 234 235 239 240 247 248 252 253 254 255 257 260 264 265 268 269 273 276 281 285 288 289 293 294 297 298 306 310 320 323 326 332 333 334 335 343 346 348 349 351 352 355 357 358 364 369 372 375 378 379 380 381 383 384 385 387 388 389 392 394 395...', '36779\\r\\n3 5 8 9 11 12 14 15 18 21 22 24 26 28 30 33 37 38 53 56 58 62 76 78 80 81 83 85 95 97 98 104 105 111 113 117 118 121 124 125 126 129 134 136 137 145 146 147 150 157 158 160 162 164 169 171 175 181 187 189 191 195 197 201 202 204 208 210 212 213 216 217 222 229 234 235 239 240 247 248 252 253 254 255 257 260 264 265 268 269 273 276 281 285 288 289 293 294 297 298 306 310 320 323 326 332 333 334 ...']}, {'input': '100000 100000\\r\\n+ 90813\\r\\n- 56488\\r\\n+ 31244\\r\\n- 94369\\r\\n+ 46265\\r\\n+ 75153\\r\\n- 10436\\r\\n+ 67290\\r\\n+ 70269\\r\\n- 16652\\r\\n+ 27720\\r\\n- 55371\\r\\n+ 29817\\r\\n- 54607\\r\\n- 78552\\r\\n- 43871\\r\\n+ 74878\\r\\n- 95829\\r\\n+ 23958\\r\\n+ 45180\\r\\n- 48156\\r\\n- 15412\\r\\n+ 72481\\r\\n- 18924\\r\\n- 66276\\r\\n+ 88615\\r\\n- 9849\\r\\n- 41975\\r\\n- 40710\\r\\n+ 38693\\r\\n+ 22849\\r\\n- 44006\\r\\n- 63603\\r\\n+ 54694\\r\\n- 26839\\r\\n- 46209\\r\\n- 26298\\r\\n- 62660\\r\\n- 61884\\r\\n- 54128\\r\\n- 81102\\r\\n- 7223\\r\\n+ 19154\\r\\n- 63837\\r\\n+ 21662\\r\\n+ 85463\\r\\n- 76152\\r\\n+ 13327\\r\\n- 22106\\r\\n+ 85213\\r\\n+ 43663\\r\\n- 44175\\r\\n+ 60436\\r\\n+ 59329\\r\\n+ 88439\\r\\n- 3...', 'output': ['36761\\r\\n1 2 6 7 8 12 14 15 19 25 29 30 31 32 34 36 38 40 42 43 47 59 60 62 63 65 66 70 71 72 76 77 79 80 81 84 85 86 87 90 91 98 99 100 101 104 106 107 108 113 116 120 123 126 127 128 134 140 144 147 152 154 157 158 159 165 169 172 176 177 181 183 184 185 195 196 199 203 208 210 212 215 216 219 220 221 224 229 230 234 243 245 246 247 248 249 258 262 265 268 269 271 272 274 276 277 279 280 281 283 28...', '36761\\r\\n1 2 6 7 8 12 14 15 19 25 29 30 31 32 34 36 38 40 42 43 47 59 60 62 63 65 66 70 71 72 76 77 79 80 81 84 85 86 87 90 91 98 99 100 101 104 106 107 108 113 116 120 123 126 127 128 134 140 144 147 152 154 157 158 159 165 169 172 176 177 181 183 184 185 195 196 199 203 208 210 212 215 216 219 220 221 224 229 230 234 243 245 246 247 248 249 258 262 265 268 269 271 272 274 276 277 279 280 281 283 284 286 288 289 290 293 297 298 300 304 305 306 311 317 319 320 329 330 331 332 333 340 344 345 346 349 354 355 ...']}, {'input': '100000 100000\\r\\n+ 49229\\r\\n+ 95085\\r\\n+ 16686\\r\\n- 73352\\r\\n- 80159\\r\\n+ 47389\\r\\n- 86225\\r\\n+ 2883\\r\\n- 90610\\r\\n+ 46189\\r\\n- 55754\\r\\n+ 99782\\r\\n+ 55322\\r\\n+ 20534\\r\\n+ 50812\\r\\n+ 59004\\r\\n+ 12104\\r\\n- 20051\\r\\n+ 81195\\r\\n- 5487\\r\\n+ 16047\\r\\n- 10815\\r\\n- 5239\\r\\n- 9194\\r\\n- 53569\\r\\n+ 93396\\r\\n- 53988\\r\\n+ 41751\\r\\n- 67057\\r\\n+ 49004\\r\\n+ 3924\\r\\n+ 86434\\r\\n+ 21394\\r\\n+ 28291\\r\\n+ 33866\\r\\n+ 8979\\r\\n- 19126\\r\\n+ 53810\\r\\n+ 63433\\r\\n- 92887\\r\\n- 69167\\r\\n- 41972\\r\\n+ 93617\\r\\n+ 46551\\r\\n- 48849\\r\\n+ 84260\\r\\n- 68488\\r\\n- 87357\\r\\n- 80556\\r\\n+ 88636\\r\\n- 12270\\r\\n+ 69845\\r\\n- 68885\\r\\n+ 52727\\r\\n- 11046\\r\\n- 12489...', 'output': ['36630\\r\\n8 9 10 11 13 14 15 18 19 28 29 31 32 34 35 36 38 40 41 42 45 48 49 51 56 57 58 59 62 65 67 69 71 72 73 75 78 79 80 81 83 90 91 97 98 101 102 105 110 112 113 114 115 116 124 129 131 134 136 137 138 139 144 146 148 150 153 155 160 162 163 164 165 167 173 176 179 183 185 187 188 195 202 203 204 206 207 209 210 211 213 219 223 224 225 229 236 237 239 245 246 248 249 251 252 253 255 257 261 262 2...', '36630\\r\\n8 9 10 11 13 14 15 18 19 28 29 31 32 34 35 36 38 40 41 42 45 48 49 51 56 57 58 59 62 65 67 69 71 72 73 75 78 79 80 81 83 90 91 97 98 101 102 105 110 112 113 114 115 116 124 129 131 134 136 137 138 139 144 146 148 150 153 155 160 162 163 164 165 167 173 176 179 183 185 187 188 195 202 203 204 206 207 209 210 211 213 219 223 224 225 229 236 237 239 245 246 248 249 251 252 253 255 257 261 262 263 265 267 269 273 274 276 278 282 283 284 291 292 296 298 305 307 309 312 313 316 317 318 320 321 326 327 329...']}, {'input': '100 100000\\r\\n- 100\\r\\n+ 3\\r\\n+ 100\\r\\n- 62\\r\\n+ 50\\r\\n+ 48\\r\\n- 69\\r\\n+ 14\\r\\n+ 10\\r\\n- 71\\r\\n- 68\\r\\n+ 11\\r\\n- 2\\r\\n- 93\\r\\n+ 66\\r\\n- 42\\r\\n- 72\\r\\n- 19\\r\\n- 73\\r\\n+ 86\\r\\n- 100\\r\\n- 45\\r\\n- 51\\r\\n- 41\\r\\n+ 87\\r\\n- 94\\r\\n+ 93\\r\\n- 91\\r\\n- 10\\r\\n+ 99\\r\\n+ 94\\r\\n+ 51\\r\\n- 59\\r\\n- 44\\r\\n- 66\\r\\n- 65\\r\\n- 36\\r\\n- 18\\r\\n+ 12\\r\\n- 94\\r\\n- 81\\r\\n+ 52\\r\\n+ 10\\r\\n- 17\\r\\n+ 23\\r\\n- 89\\r\\n- 46\\r\\n+ 59\\r\\n+ 30\\r\\n+ 69\\r\\n- 59\\r\\n- 35\\r\\n- 90\\r\\n- 99\\r\\n+ 26\\r\\n+ 91\\r\\n+ 42\\r\\n+ 75\\r\\n- 16\\r\\n+ 96\\r\\n+ 36\\r\\n+ 72\\r\\n+ 94\\r\\n- 96\\r\\n+ 20\\r\\n- 12\\r\\n+ 12\\r\\n- 26\\r\\n- 51\\r\\n- 49\\r\\n+ 46\\r\\n+ 41\\r\\n- 32\\r\\n- 41\\r\\n- 50\\r\\n- 82\\r\\n+ 32\\r\\n- 95\\r\\n- 55\\r\\n- 12\\r\\n+ 96\\r\\n- 30\\r\\n- 14\\r\\n...', 'output': ['0']}, {'input': '1000 100000\\r\\n- 320\\r\\n+ 564\\r\\n+ 462\\r\\n+ 178\\r\\n- 846\\r\\n- 437\\r\\n- 879\\r\\n+ 673\\r\\n+ 228\\r\\n+ 885\\r\\n+ 720\\r\\n+ 594\\r\\n+ 626\\r\\n+ 522\\r\\n+ 944\\r\\n- 955\\r\\n- 885\\r\\n+ 46\\r\\n+ 43\\r\\n- 598\\r\\n+ 341\\r\\n+ 442\\r\\n- 553\\r\\n+ 796\\r\\n- 593\\r\\n+ 20\\r\\n- 590\\r\\n- 18\\r\\n+ 448\\r\\n- 328\\r\\n+ 148\\r\\n+ 410\\r\\n+ 661\\r\\n+ 735\\r\\n- 845\\r\\n- 863\\r\\n+ 274\\r\\n+ 332\\r\\n- 652\\r\\n- 691\\r\\n- 755\\r\\n- 722\\r\\n+ 186\\r\\n- 9\\r\\n- 880\\r\\n+ 955\\r\\n+ 254\\r\\n+ 162\\r\\n+ 455\\r\\n- 696\\r\\n- 435\\r\\n- 70\\r\\n- 565\\r\\n+ 922\\r\\n- 79\\r\\n- 90\\r\\n+ 629\\r\\n- 442\\r\\n+ 617\\r\\n+ 42\\r\\n+ 942\\r\\n- 441\\r\\n+ 736\\r\\n+ 672\\r\\n+ 211\\r\\n- 528\\r\\n- 422\\r\\n+ 676\\r\\n- 672\\r\\n- 355\\r\\n+ 202\\r\\n- 282\\r\\n- 83...', 'output': ['0']}, {'input': '5000 100000\\r\\n+ 2289\\r\\n- 786\\r\\n+ 952\\r\\n+ 1112\\r\\n- 4732\\r\\n+ 3272\\r\\n+ 3128\\r\\n+ 2819\\r\\n- 3699\\r\\n- 572\\r\\n+ 447\\r\\n- 1355\\r\\n- 406\\r\\n- 2909\\r\\n+ 3998\\r\\n+ 1918\\r\\n- 2852\\r\\n- 2377\\r\\n+ 2018\\r\\n- 587\\r\\n+ 4386\\r\\n- 3469\\r\\n- 4977\\r\\n+ 2873\\r\\n- 351\\r\\n- 2770\\r\\n- 1892\\r\\n- 2806\\r\\n- 4450\\r\\n- 4565\\r\\n+ 1255\\r\\n- 2504\\r\\n- 3953\\r\\n- 508\\r\\n+ 2633\\r\\n- 543\\r\\n+ 3795\\r\\n+ 2583\\r\\n+ 522\\r\\n+ 4112\\r\\n- 254\\r\\n+ 1548\\r\\n+ 1943\\r\\n+ 4930\\r\\n- 4304\\r\\n+ 3881\\r\\n- 823\\r\\n- 4947\\r\\n- 3809\\r\\n- 1525\\r\\n- 680\\r\\n- 4083\\r\\n+ 3310\\r\\n+ 3494\\r\\n+ 3793\\r\\n- 4367\\r\\n- 1031\\r\\n+ 1851\\r\\n+ 4273\\r\\n+ 4126\\r\\n- 817\\r\\n- 450\\r\\n+ 957\\r\\n- 2631\\r\\n+ ...', 'output': ['0']}, {'input': '30 100\\r\\n- 23\\r\\n+ 5\\r\\n+ 7\\r\\n+ 6\\r\\n+ 9\\r\\n+ 26\\r\\n- 30\\r\\n- 10\\r\\n+ 20\\r\\n+ 25\\r\\n- 7\\r\\n+ 29\\r\\n+ 27\\r\\n+ 30\\r\\n+ 7\\r\\n+ 16\\r\\n- 12\\r\\n+ 10\\r\\n+ 11\\r\\n- 17\\r\\n+ 8\\r\\n- 30\\r\\n- 21\\r\\n- 25\\r\\n- 9\\r\\n- 8\\r\\n- 10\\r\\n- 5\\r\\n+ 30\\r\\n+ 14\\r\\n- 13\\r\\n- 24\\r\\n+ 17\\r\\n+ 12\\r\\n+ 8\\r\\n+ 21\\r\\n+ 23\\r\\n- 6\\r\\n- 3\\r\\n- 7\\r\\n- 27\\r\\n- 23\\r\\n- 15\\r\\n- 16\\r\\n- 17\\r\\n- 12\\r\\n+ 19\\r\\n- 11\\r\\n- 19\\r\\n- 30\\r\\n+ 2\\r\\n+ 10\\r\\n- 10\\r\\n+ 10\\r\\n+ 30\\r\\n- 21\\r\\n- 30\\r\\n- 4\\r\\n+ 12\\r\\n+ 25\\r\\n+ 28\\r\\n+ 30\\r\\n- 28\\r\\n+ 6\\r\\n- 2\\r\\n+ 15\\r\\n+ 19\\r\\n- 26\\r\\n+ 21\\r\\n+ 22\\r\\n+ 18\\r\\n+ 24\\r\\n- 25\\r\\n- 6\\r\\n- 19\\r\\n+ 19\\r\\n- 14\\r\\n- 10\\r\\n- 8\\r\\n+ 27\\r\\n- 29\\r\\n- 27\\r\\n+ 16\\r\\n+ 13\\r\\n- 21\\r\\n+ 21\\r\\n+ 10\\r\\n+...', 'output': ['1\\r\\n1']}, {'input': '100 5\\r\\n- 60\\r\\n- 58\\r\\n+ 25\\r\\n- 32\\r\\n+ 86\\r\\n', 'output': ['95\\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 26 27 28 29 30 31 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 59 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100', '95\\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 26 27 28 29 30 31 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 59 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 87 88 89 90 91 92 93 94 95 96 97 98 99 100']}, {'input': '700 600\\r\\n- 95\\r\\n- 469\\r\\n- 147\\r\\n+ 171\\r\\n- 467\\r\\n+ 388\\r\\n- 85\\r\\n+ 589\\r\\n+ 262\\r\\n- 190\\r\\n- 80\\r\\n+ 257\\r\\n+ 333\\r\\n+ 188\\r\\n- 397\\r\\n+ 114\\r\\n+ 239\\r\\n+ 538\\r\\n- 424\\r\\n+ 381\\r\\n+ 622\\r\\n- 412\\r\\n- 346\\r\\n- 255\\r\\n- 66\\r\\n+ 351\\r\\n+ 175\\r\\n+ 29\\r\\n+ 55\\r\\n+ 448\\r\\n- 143\\r\\n+ 338\\r\\n+ 286\\r\\n+ 462\\r\\n- 340\\r\\n- 411\\r\\n+ 220\\r\\n+ 319\\r\\n+ 201\\r\\n- 49\\r\\n+ 228\\r\\n- 444\\r\\n+ 428\\r\\n+ 125\\r\\n- 239\\r\\n- 406\\r\\n+ 505\\r\\n+ 14\\r\\n- 609\\r\\n- 221\\r\\n+ 47\\r\\n- 551\\r\\n- 437\\r\\n- 416\\r\\n+ 551\\r\\n- 575\\r\\n- 235\\r\\n- 236\\r\\n- 89\\r\\n- 151\\r\\n+ 137\\r\\n+ 202\\r\\n- 23\\r\\n+ 694\\r\\n- 566\\r\\n- 62\\r\\n+ 476\\r\\n+ 194\\r\\n+ 527\\r\\n+ 372\\r\\n+ 383\\r\\n+ 266\\r\\n- 665\\r\\n+ 2...', 'output': ['309\\r\\n1 2 3 5 7 8 10 20 21 22 25 26 30 32 35 36 38 39 43 44 45 46 51 52 53 56 57 58 61 64 76 86 88 90 91 93 94 98 99 101 104 106 108 111 112 113 116 118 120 121 122 124 126 127 130 132 134 135 139 140 145 148 149 154 157 159 160 163 164 166 167 168 170 172 173 176 177 178 179 180 181 183 184 186 187 195 196 207 210 211 212 217 218 223 225 229 230 233 238 242 244 245 246 248 249 252 254 258 263 268 269 272 273 275 277 281 282 284 285 287 288 289 290 292 294 295 298 299 302 303 304 305 306 310 312 320 325 326...', '309\\r\\n1 2 3 5 7 8 10 20 21 22 25 26 30 32 35 36 38 39 43 44 45 46 51 52 53 56 57 58 61 64 76 86 88 90 91 93 94 98 99 101 104 106 108 111 112 113 116 118 120 121 122 124 126 127 130 132 134 135 139 140 145 148 149 154 157 159 160 163 164 166 167 168 170 172 173 176 177 178 179 180 181 183 184 186 187 195 196 207 210 211 212 217 218 223 225 229 230 233 238 242 244 245 246 248 249 252 254 258 263 268 2...']}, {'input': '4 4\\r\\n+ 2\\r\\n- 1\\r\\n- 3\\r\\n- 2\\r\\n', 'output': ['1\\r\\n4']}, {'input': '3 3\\r\\n- 2\\r\\n+ 1\\r\\n+ 2\\r\\n', 'output': ['1\\r\\n3']}, {'input': '5 4\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n+ 4\\r\\n', 'output': ['1\\r\\n5']}, {'input': '6 6\\r\\n- 5\\r\\n- 6\\r\\n- 3\\r\\n- 1\\r\\n- 2\\r\\n- 4\\r\\n', 'output': ['1\\r\\n4']}, {'input': '10 7\\r\\n- 8\\r\\n+ 1\\r\\n+ 2\\r\\n+ 3\\r\\n- 2\\r\\n- 3\\r\\n- 1\\r\\n', 'output': ['6\\r\\n4 5 6 7 9 10', '6\\r\\n4 5 6 7 9 10']}, {'input': '10 7\\r\\n- 8\\r\\n+ 1\\r\\n+ 2\\r\\n+ 3\\r\\n- 2\\r\\n- 3\\r\\n- 1\\r\\n', 'output': ['6\\r\\n4 5 6 7 9 10', '6\\r\\n4 5 6 7 9 10']}, {'input': '100000 100000\\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- 51\\r\\n- 52\\r\\n- 53\\r\\n- 54\\r\\n- 55\\r\\n- 56\\r\\n- 57\\r\\n- 58\\r\\n- 59\\r\\n- 60\\r\\n- 61\\r\\n- 62\\r\\n- 63\\r\\n- 64\\r\\n- 65\\r\\n- 66\\r\\n- 67\\r\\n- 68\\r\\n- 69\\r\\n- 70\\r\\n- 71\\r\\n- 72\\r\\n- 73\\r\\n- 74\\r\\n- 75\\r\\n- 76\\r\\n- 77\\r\\n- 78\\r\\n- 79\\r\\n- 80\\r\\n- 81\\r\\n- 82\\r\\n- 83\\r\\n- 84\\r\\n-...', 'output': ['1\\r\\n100000']}, {'input': '100000 100000\\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+ 51\\r\\n+ 52\\r\\n+ 53\\r\\n+ 54\\r\\n+ 55\\r\\n+ 56\\r\\n+ 57\\r\\n+ 58\\r\\n+ 59\\r\\n+ 60\\r\\n+ 61\\r\\n+ 62\\r\\n+ 63\\r\\n+ 64\\r\\n+ 65\\r\\n+ 66\\r\\n+ 67\\r\\n+ 68\\r\\n+ 69\\r\\n+ 70\\r\\n+ 71\\r\\n+ 72\\r\\n+ 73\\r\\n+ 74\\r\\n+ 75\\r\\n+ 76\\r\\n+ 77\\r\\n+ 78\\r\\n+ 79\\r\\n+ 80\\r\\n+ 81\\r\\n+ 82\\r\\n+ 83\\r\\n+ 84\\r\\n+...', 'output': ['1\\r\\n1']}, {'input': '100000 100000\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n-...', 'output': ['100000\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153...', '100000\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 1...']}, {'input': '99999 99999\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1...', 'output': ['99999\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 12...', '99999\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 ...']}, {'input': '4 10\\r\\n+ 2\\r\\n- 1\\r\\n- 2\\r\\n- 3\\r\\n+ 3\\r\\n+ 2\\r\\n+ 4\\r\\n- 2\\r\\n+ 2\\r\\n+ 1\\r\\n', 'output': ['1\\r\\n3']}, {'input': '4 9\\r\\n+ 2\\r\\n- 1\\r\\n- 2\\r\\n- 3\\r\\n+ 3\\r\\n+ 2\\r\\n+ 4\\r\\n- 2\\r\\n+ 2\\r\\n', 'output': ['1\\r\\n3']}, {'input': '10 8\\r\\n+ 1\\r\\n- 1\\r\\n- 4\\r\\n+ 4\\r\\n+ 3\\r\\n+ 7\\r\\n- 7\\r\\n+ 9\\r\\n', 'output': ['6\\r\\n2 4 5 6 8 10', '6\\r\\n2 4 5 6 8 10']}, {'input': '10 6\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 3\\r\\n', 'output': ['8\\r\\n1 4 5 6 7 8 9 10', '8\\r\\n1 4 5 6 7 8 9 10']}, {'input': '10 5\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n- 3\\r\\n', 'output': ['9\\r\\n1 3 4 5 6 7 8 9 10', '9\\r\\n1 3 4 5 6 7 8 9 10']}, {'input': '10 11\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n- 3\\r\\n- 4\\r\\n+ 5\\r\\n- 5\\r\\n- 6\\r\\n+ 6\\r\\n+ 7\\r\\n', 'output': ['4\\r\\n6 8 9 10', '4\\r\\n6 8 9 10']}, {'input': '10 10\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n- 3\\r\\n- 4\\r\\n+ 5\\r\\n- 5\\r\\n- 6\\r\\n+ 6\\r\\n', 'output': ['5\\r\\n6 7 8 9 10', '5\\r\\n6 7 8 9 10']}, {'input': '10 9\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n- 3\\r\\n- 4\\r\\n+ 5\\r\\n- 5\\r\\n- 6\\r\\n', 'output': ['5\\r\\n6 7 8 9 10', '5\\r\\n6 7 8 9 10']}, {'input': '10 12\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n- 3\\r\\n- 4\\r\\n+ 5\\r\\n- 5\\r\\n- 6\\r\\n+ 6\\r\\n+ 7\\r\\n- 7\\r\\n', 'output': ['4\\r\\n6 8 9 10', '4\\r\\n6 8 9 10']}, {'input': '2 2\\r\\n- 1\\r\\n+ 1\\r\\n', 'output': ['2\\r\\n1 2', '2\\r\\n1 2']}, {'input': '7 4\\r\\n- 2\\r\\n- 3\\r\\n+ 3\\r\\n- 6\\r\\n', 'output': ['4\\r\\n1 4 5 7', '4\\r\\n1 4 5 7']}, {'input': '2 3\\r\\n+ 1\\r\\n+ 2\\r\\n- 1\\r\\n', 'output': ['0']}, {'input': '50000 100000\\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+ 51\\r\\n+ 52\\r\\n+ 53\\r\\n+ 54\\r\\n+ 55\\r\\n+ 56\\r\\n+ 57\\r\\n+ 58\\r\\n+ 59\\r\\n+ 60\\r\\n+ 61\\r\\n+ 62\\r\\n+ 63\\r\\n+ 64\\r\\n+ 65\\r\\n+ 66\\r\\n+ 67\\r\\n+ 68\\r\\n+ 69\\r\\n+ 70\\r\\n+ 71\\r\\n+ 72\\r\\n+ 73\\r\\n+ 74\\r\\n+ 75\\r\\n+ 76\\r\\n+ 77\\r\\n+ 78\\r\\n+ 79\\r\\n+ 80\\r\\n+ 81\\r\\n+ 82\\r\\n+ 83\\r\\n+ 84\\r\\n+ ...', 'output': ['1\\r\\n1']}, {'input': '100000 100000\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n-...', 'output': ['100000\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153...', '100000\\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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 1...']}, {'input': '100000 100000\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 1\\r\\n-...', 'output': ['99998\\r\\n3 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124...', '99998\\r\\n3 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 ...']}, {'input': '100000 100000\\r\\n+ 92156\\r\\n- 92156\\r\\n+ 25831\\r\\n- 25831\\r\\n+ 67328\\r\\n- 67328\\r\\n+ 57453\\r\\n- 57453\\r\\n+ 5100\\r\\n- 5100\\r\\n+ 80267\\r\\n- 80267\\r\\n+ 37511\\r\\n- 37511\\r\\n+ 12849\\r\\n- 12849\\r\\n+ 55444\\r\\n- 55444\\r\\n+ 84188\\r\\n- 84188\\r\\n+ 18439\\r\\n- 18439\\r\\n+ 41058\\r\\n- 41058\\r\\n+ 74325\\r\\n- 74325\\r\\n+ 74762\\r\\n- 74762\\r\\n+ 23684\\r\\n- 23684\\r\\n+ 97591\\r\\n- 97591\\r\\n+ 93089\\r\\n- 93089\\r\\n+ 75110\\r\\n- 75110\\r\\n+ 11921\\r\\n- 11921\\r\\n+ 55853\\r\\n- 55853\\r\\n+ 78943\\r\\n- 78943\\r\\n+ 14563\\r\\n- 14563\\r\\n+ 60276\\r\\n- 60276\\r\\n+ 89567\\r\\n- 89567\\r\\n+ 14149\\r\\n- 14149\\r\\n+ 97592\\r\\n- 97592\\r\\n+ 29798\\r\\n- 29798\\r\\n+ 7403\\r\\n- 74...', 'output': ['60676\\r\\n1 3 5 9 10 11 12 13 14 15 16 17 19 22 24 25 26 27 28 29 30 31 32 33 36 38 39 41 43 46 47 48 49 51 52 53 54 55 56 59 60 62 63 64 66 68 69 70 71 72 73 76 77 78 79 83 84 85 87 90 91 92 93 95 99 102 109 110 111 112 113 114 115 116 117 121 123 124 125 126 128 129 130 132 135 138 140 142 143 144 145 147 149 151 153 157 158 159 160 163 165 168 170 171 172 173 182 183 185 186 187 188 190 191 192...', '60676\\r\\n1 3 5 9 10 11 12 13 14 15 16 17 19 22 24 25 26 27 28 29 30 31 32 33 36 38 39 41 43 46 47 48 49 51 52 53 54 55 56 59 60 62 63 64 66 68 69 70 71 72 73 76 77 78 79 83 84 85 87 90 91 92 93 95 99 102 109 110 111 112 113 114 115 116 117 121 123 124 125 126 128 129 130 132 135 138 140 142 143 144 145 147 149 151 153 157 158 159 160 163 165 168 170 171 172 173 182 183 185 186 187 188 190 191 192 194 196 199 205 208 210 212 213 214 217 218 220 223 224 230 231 232 233 235 238 239 240 241 242 243 244 245 246 2...']}, {'input': '5 5\\r\\n- 2\\r\\n+ 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 4\\r\\n', 'output': ['2\\r\\n3 5', '2\\r\\n3 5']}, {'input': '5 3\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n', 'output': ['3\\r\\n3 4 5', '3\\r\\n3 4 5']}, {'input': '4 4\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n', 'output': ['2\\r\\n3 4']}]","id":283} {"difficulty":1600,"lang":"MS C#","lang_cluster":"C#","src_uid":"a6cba17c5ddb93f6741e00280fb6c54c","execute_outcome":"RUNTIME_ERROR","source_code":"using System; \nusing System.Collections.Generic; \nusing System.Linq;\nstruct block {public int size { get; set; }public int offset { get; set; }public int index { get; set; }}\nclass P {\n static int _memory_size;\n static List _memory = new List();\n static int _global_index = 0;\n static void Main() {\n var input = Console.ReadLine().Split().Select(int.Parse);\n int t = input.First(), i = 0;\n _memory_size = input.Last();\n for (; i < t; ++i) {\n var row = Console.ReadLine().Split();\n string type = row[0];\n switch (type) {\n case \"alloc\": {\n alloc(int.Parse(row[1]));\n break;\n }\n case \"defragment\": {\n defragment();\n break;\n }\n case \"erase\": {\n erase(int.Parse(row[1]));\n break;\n }\n }\n }\n }\n\n static void defragment() {\n int cnt = _memory.Count, i = 0;\n for (; i < cnt; i++) {\n block block = _memory[i];\n if (i == 0) {\n block.offset = 0;\n } else { var prev_block = _memory[i - 1]; block.offset = prev_block.offset + prev_block.size; }\n }\n }\n\n static void erase(int index) {\n var block = find_block(index);\n if (block.HasValue) {_memory.Remove(block.Value);} else { Console.WriteLine(\"ILLEGAL_ERASE_ARGUMENT\"); }\n }\n\n static block? find_block(int index) {\n var blocks = _memory.Where(x => x.index == index);\n if (blocks.Count() == 0) {\n return null;\n } else { return blocks.First(); }\n }\n\n static void alloc(int size) {\n var block = insert_block(size);\n if (block.HasValue) {\n block block_ = block.Value;\n Console.WriteLine(block_.index);\n _memory.Add(block_);\n _memory = _memory.OrderBy(x => x.offset).ToList();\n } else { Console.WriteLine(\"NULL\"); }\n }\n\n static block? insert_block(int size) {\n int found_offset = -1, cnt = _memory.Count, i = 0;\n if (get_first_empty_size(0) >= size) { found_offset = 0; }\n if (found_offset < 0) {\n for (; i < cnt; ++i) {\n var block_seek = _memory[i].offset + _memory[i].size;\n if (get_first_empty_size(block_seek) >= size) { found_offset = block_seek; break; }\n }\n }\n if (found_offset >= 0) {\n _global_index++;\n return new block() {\n index = _global_index,\n offset = found_offset,\n size = size\n };\n }\n return null;\n }\n\n static int get_first_empty_size(int seek) {\n var blocks = _memory.Where(x => x.offset >= seek);\n return (blocks.Count() == 0 ? _memory_size : blocks.First().offset) - seek;\n }\n}","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2009\u2264\u2009t\u2009\u2264\u2009100;1\u2009\u2264\u2009m\u2009\u2264\u2009100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2009\u2264\u2009n\u2009\u2264\u2009100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. ","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6"],"sample_outputs":["1\n2\nNULL\n3"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nstruct block {\n public int size { get; set; }\n public int offset { get; set; }\n public int index { get; set; }\n}\n\nclass P {\n\n static int _memory_size;\n static List _memory = new List();\n static int _global_index = 0;\n\n static void Main() {\n var input = Console.ReadLine().Split().Select(int.Parse);\n int t = input.First(), i = 0;\n _memory_size = input.Last();\n for (; i < t; ++i) {\n var row = Console.ReadLine().Split();\n string type = row[0];\n switch (type) {\n case \"alloc\": {\n alloc(int.Parse(row[1]));\n break;\n }\n case \"defragment\": {\n defragment();\n break;\n }\n case \"erase\": {\n erase(int.Parse(row[1]));\n break;\n }\n }\n }\n }\n\n static void defragment() {\n int cnt = _memory.Count, i = 0;\n for (; i < cnt; i++) {\n block block = _memory[i];\n if (i == 0) {\n block.offset = 0;\n } else { var prev_block = _memory[i - 1]; block.offset = prev_block.offset + prev_block.size; }\n _memory[i] = block;\n }\n }\n\n static void erase(int index) {\n var block = find_block(index);\n if (block.HasValue) {\n _memory.Remove(block.Value);\n } else { Console.WriteLine(\"ILLEGAL_ERASE_ARGUMENT\"); }\n }\n\n static block? find_block(int index) {\n var blocks = _memory.Where(x => x.index == index);\n if (blocks.Count() == 0) {\n return null;\n } else { return blocks.First(); }\n }\n\n static void alloc(int size) {\n var block = insert_block(size);\n if (block.HasValue) {\n Console.WriteLine(block.Value.index);\n _memory.Add(block.Value);\n _memory = _memory.OrderBy(x => x.offset).ToList();\n } else { Console.WriteLine(\"NULL\"); }\n }\n\n static block? insert_block(int size) {\n int found_offset = -1;\n if (get_first_empty_size(0) >= size) { found_offset = 0; }\n if (found_offset < 0) {\n for (int i = 0; i < _memory.Count; i++) {\n var block_seek = _memory[i].offset + _memory[i].size;\n var block_size = get_first_empty_size(block_seek);\n if (block_size >= size) { found_offset = block_seek; break; }\n }\n }\n if (found_offset >= 0) {\n _global_index++;\n return new block() {\n index = _global_index,\n offset = found_offset,\n size = size\n };\n }\n return null;\n }\n\n static int get_first_empty_size(int seek) {\n var blocks = _memory.Where(x => x.offset >= seek);\n return (blocks.Count() == 0 ? _memory_size : blocks.First().offset) - seek;\n }\n}","testcases":"[{'input': '6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': '6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n', 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n', 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n', 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': '22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': '7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': '3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': '8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n', 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': '10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":284} {"difficulty":2300,"lang":"Mono C#","lang_cluster":"C#","src_uid":"aad7ebf4fa919fae78bfc878e47e483c","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n int mod = 400;\n void solve()\n {\n testIt();\n long n = nextLong();\n long m = nextLong();\n println(fast(n,m));\n\n\n\n\n }\n\n private void testIt()\n {\n Random rand = new Random();\n for (int test = 1; ; test++)\n {\n int n = rand.Next() % mod + 1;\n int m = rand.Next() % mod + 1;\n long num = fast(n, m);\n if (num != slow(n, m))\n {\n slow(n, m);\n fast(n, m);\n }\n\n\n Console.WriteLine(test + \" \" + num);\n }\n }\n\n private long fast(long n, long m)\n {\n long irrational = 0;\n long[] cnt;\n cnt = new long[2*(n + 10)];\n\n for (long b = 1; b <= n; b++)\n {\n long x = b * b;\n long max = x - 1;\n long min;\n if (m > x)\n min = 0;\n else\n min = x - m;\n long x1=(long)Math.Round(Math.Sqrt(min))-2;\n if (x1 < 0)\n x1 = 0;\n while (x1 * x1 < min)\n x1++;\n long x2=(long)Math.Round(Math.Sqrt(max))+2;\n while (x2 * x2 > max)\n x2--;\n long cur;\n if (x1 <= x2)\n cur = x2 - x1 + 1;\n else\n cur = 0;\n irrational += max - min + 1 - cur;\n if (x1 <= x2)\n {\n x1 += -b;\n x2 += -b;\n x1 = -x1;\n x2 = -x2;\n cnt[x2]++;\n cnt[x1 + 1]--;\n }\n\n \/\/\n x1 = (long)Math.Round(Math.Sqrt(min)) - 2;\n if (x1 < 0)\n x1 = 0;\n while (x1 * x1 < min)\n x1++;\n x2 = (long)Math.Round(Math.Sqrt(max)) + 2;\n while (x2 * x2 > max)\n x2--;\n if (x1 <= x2)\n {\n x1 = -x1;\n x2 = -x2;\n x1 += -b;\n x2 += -b;\n x1 = -x1;\n x2 = -x2;\n cnt[x1]++;\n cnt[x2 + 1]--;\n }\n }\n irrational *= 2;\n long res = irrational;\n for (int i = 1; i < cnt.Length; i++)\n cnt[i] += cnt[i - 1];\n for (int i = 0; i < cnt.Length; i++)\n if (cnt[i] > 0)\n res++;\n return res;\n }\n long slow(long n, long m)\n {\n long res = 0;\n Dictionary d = new Dictionary();\n \n for (long b = 1; b <= n; b++)\n for (long c = 1; c <= m; c++)\n {\n if (b * b - c < 0)\n continue;\n long del = b * b - c;\n if (!isSquare(del))\n res += 2;\n else\n {\n long x = -b + (long)Math.Round(Math.Sqrt(del));\n d[x] = null;\n x = -b - (long)Math.Round(Math.Sqrt(del));\n d[x] = null;\n }\n }\n return res + d.Count;\n }\n private bool isSquare(long n)\n {\n long x =(long)Math.Round( Math.Sqrt(n));\n return x * x == n;\n }\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}\n\n\n","description":"A schoolboy Petya studies square equations. The equations that are included in the school curriculum, usually look simple: x2\u2009+\u20092bx\u2009+\u2009c\u2009=\u20090 where b, c are natural numbers.Petya noticed that some equations have two real roots, some of them have only one root and some equations don't have real roots at all. Moreover it turned out that several different square equations can have a common root.Petya is interested in how many different real roots have all the equations of the type described above for all the possible pairs of numbers b and c such that 1\u2009\u2264\u2009b\u2009\u2264\u2009n, 1\u2009\u2264\u2009c\u2009\u2264\u2009m. Help Petya find that number.","input_specification":"The single line contains two integers n and m. (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u20095000000).","output_specification":"Print a single number which is the number of real roots of the described set of equations.","notes":"NoteIn the second test from the statement the following equations are analysed: b\u2009=\u20091, c\u2009=\u20091: x2\u2009+\u20092x\u2009+\u20091\u2009=\u20090; The root is x\u2009=\u2009\u2009-\u20091 b\u2009=\u20091, c\u2009=\u20092: x2\u2009+\u20092x\u2009+\u20092\u2009=\u20090; No roots Overall there's one rootIn the second test the following equations are analysed: b\u2009=\u20091, c\u2009=\u20091: x2\u2009+\u20092x\u2009+\u20091\u2009=\u20090; The root is x\u2009=\u2009\u2009-\u20091 b\u2009=\u20091, c\u2009=\u20092: x2\u2009+\u20092x\u2009+\u20092\u2009=\u20090; No roots b\u2009=\u20091, c\u2009=\u20093: x2\u2009+\u20092x\u2009+\u20093\u2009=\u20090; No roots b\u2009=\u20092, c\u2009=\u20091: x2\u2009+\u20094x\u2009+\u20091\u2009=\u20090; The roots are b\u2009=\u20092, c\u2009=\u20092: x2\u2009+\u20094x\u2009+\u20092\u2009=\u20090; The roots are b\u2009=\u20092, c\u2009=\u20093: x2\u2009+\u20094x\u2009+\u20093\u2009=\u20090; The roots are x1\u2009=\u2009\u2009-\u20093,\u2009x2\u2009=\u2009\u2009-\u20091 b\u2009=\u20093, c\u2009=\u20091: x2\u2009+\u20096x\u2009+\u20091\u2009=\u20090; The roots are b\u2009=\u20093, c\u2009=\u20092: x2\u2009+\u20096x\u2009+\u20092\u2009=\u20090; The roots are b\u2009=\u20093, c\u2009=\u20093: x2\u2009+\u20096x\u2009+\u20093\u2009=\u20090; The roots are Overall there are 13 roots and as the root \u2009-\u20091 is repeated twice, that means there are 12 different roots.","sample_inputs":["3 3","1 2"],"sample_outputs":["12","1"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n int mod = 400;\n void solve()\n {\n \/\/testIt();\n long n = nextLong();\n long m = nextLong();\n println(fast(n,m));\n\n\n\n\n }\n\n private void testIt()\n {\n Random rand = new Random();\n for (int test = 1; ; test++)\n {\n int n = rand.Next() % mod + 1;\n int m = rand.Next() % mod + 1;\n long num = fast(n, m);\n if (num != slow(n, m))\n {\n slow(n, m);\n fast(n, m);\n }\n\n\n Console.WriteLine(test + \" \" + num);\n }\n }\n\n private long fast(long n, long m)\n {\n long irrational = 0;\n long[] cnt;\n cnt = new long[2*(n + 10)];\n\n for (long b = 1; b <= n; b++)\n {\n long x = b * b;\n long max = x - 1;\n long min;\n if (m > x)\n min = 0;\n else\n min = x - m;\n long x1=(long)Math.Round(Math.Sqrt(min))-2;\n if (x1 < 0)\n x1 = 0;\n while (x1 * x1 < min)\n x1++;\n long x2=(long)Math.Round(Math.Sqrt(max))+2;\n while (x2 * x2 > max)\n x2--;\n long cur;\n if (x1 <= x2)\n cur = x2 - x1 + 1;\n else\n cur = 0;\n irrational += max - min + 1 - cur;\n if (x1 <= x2)\n {\n x1 += -b;\n x2 += -b;\n x1 = -x1;\n x2 = -x2;\n cnt[x2]++;\n cnt[x1 + 1]--;\n }\n\n \/\/\n x1 = (long)Math.Round(Math.Sqrt(min)) - 2;\n if (x1 < 0)\n x1 = 0;\n while (x1 * x1 < min)\n x1++;\n x2 = (long)Math.Round(Math.Sqrt(max)) + 2;\n while (x2 * x2 > max)\n x2--;\n if (x1 <= x2)\n {\n x1 = -x1;\n x2 = -x2;\n x1 += -b;\n x2 += -b;\n x1 = -x1;\n x2 = -x2;\n cnt[x1]++;\n cnt[x2 + 1]--;\n }\n }\n irrational *= 2;\n long res = irrational;\n for (int i = 1; i < cnt.Length; i++)\n cnt[i] += cnt[i - 1];\n for (int i = 0; i < cnt.Length; i++)\n if (cnt[i] > 0)\n res++;\n return res;\n }\n long slow(long n, long m)\n {\n long res = 0;\n Dictionary d = new Dictionary();\n \n for (long b = 1; b <= n; b++)\n for (long c = 1; c <= m; c++)\n {\n if (b * b - c < 0)\n continue;\n long del = b * b - c;\n if (!isSquare(del))\n res += 2;\n else\n {\n long x = -b + (long)Math.Round(Math.Sqrt(del));\n d[x] = null;\n x = -b - (long)Math.Round(Math.Sqrt(del));\n d[x] = null;\n }\n }\n return res + d.Count;\n }\n private bool isSquare(long n)\n {\n long x =(long)Math.Round( Math.Sqrt(n));\n return x * x == n;\n }\n\n \/\/\/\/\/\/\/\/\/\/\/\/\n private void println(int[] ar)\n {\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i]);\n else\n print(ar[i] + \" \");\n }\n }\n private void println(int[] ar, bool add)\n {\n int A = 0;\n if (add)\n A++;\n for (int i = 0; i < ar.Length; i++)\n {\n if (i == ar.Length - 1)\n println(ar[i] + A);\n else\n print((ar[i] + A) + \" \");\n }\n }\n\n private void println(string Stringst)\n {\n Console.WriteLine(Stringst);\n }\n private void println(char charnum)\n {\n Console.WriteLine(charnum);\n }\n private void println(int Intnum)\n {\n Console.WriteLine(Intnum);\n }\n private void println(long Longnum)\n {\n Console.WriteLine(Longnum);\n }\n private void println(double Doublenum)\n {\n string s = Doublenum.ToString(CultureInfo.InvariantCulture);\n Console.WriteLine(s);\n }\n\n private void print(string Stringst)\n {\n Console.Write(Stringst);\n }\n private void print(int Intnum)\n {\n Console.Write(Intnum);\n }\n private void print(char charnum)\n {\n Console.Write(charnum);\n }\n private void print(long Longnum)\n {\n Console.Write(Longnum);\n }\n private void print(double Doublenum)\n {\n Console.Write(Doublenum);\n }\n\n\n string[] inputLine = new string[0];\n int inputInd = 0;\n string nextLine()\n {\n return Console.ReadLine();\n }\n void readInput()\n {\n if (inputInd != inputLine.Length)\n throw new Exception();\n inputInd = 0;\n inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);\n if (inputLine.Length == 0)\n readInput();\n\n }\n int nextInt()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return int.Parse(inputLine[inputInd++]);\n }\n long nextLong()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return long.Parse(inputLine[inputInd++]);\n }\n double nextDouble()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return double.Parse(inputLine[inputInd++]);\n }\n string nextString()\n {\n if (inputInd == inputLine.Length)\n readInput();\n return inputLine[inputInd++];\n }\n static void Main(string[] args)\n {\n Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n new Program().solve();\n }\n}\n\n\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":285} {"difficulty":1600,"lang":"Mono C#","lang_cluster":"C#","src_uid":"b263917e47e1c84340bcb1c77999fd7e","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ConsoleApplication1\n{\n class Program\n {\n static void Main(string[] args)\n {\n int Count = int.Parse(Console.ReadLine());\n int[] Numb = new int[10];\n int Sum = 0; bool clow = false;\n String[] Input = Console.ReadLine().Split(' ');\n for (int i = 0; i < Count; i++)\n {\n int t = int.Parse(Input[i]);\n Numb[t]++;\n Sum += t;\n }\n if (Numb[0] != 0)\n {\n for (int i = 9; i > -1; i--)\n {\n if ((Numb[i] != 0) && (i > 4))\n {\n break;\n }\n else\n {\n if ((Numb[i] > 1) && (i > 0))\n {\n break;\n }\n else\n {\n if (i == 0)\n {\n Console.Write(0);\n clow = true;\n }\n }\n }\n }\n if (clow!=true)\n {\n if ((Sum % 3 != 0) && (Sum > 9))\n {\n if (Sum % 3 == 1)\n {\n bool flag = false;\n for (int i = 1; i < 10; i += 3)\n {\n if (Numb[i] != 0)\n {\n Numb[i]--;\n flag = true;\n break;\n }\n }\n if (flag != true)\n {\n int m = 0;\n for (int i = 2; i < 10; i += 3)\n {\n if (m != 2)\n {\n while ((Numb[i] > 0) || (m != 2))\n {\n Numb[i]--;\n m++;\n }\n }\n else\n {\n if (m == 2)\n {\n break;\n }\n }\n }\n }\n }\n else\n {\n if (Sum % 3 == 2)\n {\n bool flag = false;\n for (int i = 2; i < 10; i += 3)\n {\n if (Numb[i] != 0)\n {\n Numb[i]--;\n flag = true;\n break;\n }\n }\n if (flag != true)\n {\n int m = 0;\n for (int i = 1; i < 10; i += 3)\n {\n if (m != 2)\n {\n while ((Numb[i] > 0) || (m != 2))\n {\n Numb[i]--;\n m++;\n }\n }\n else\n {\n if (m == 2)\n {\n break;\n }\n }\n }\n }\n }\n }\n }\n }\n for (int i = 9; i > -1; i--)\n {\n while (Numb[i] != 0)\n {\n Console.Write(i);\n Numb[i]--;\n }\n }\n }\n else\n {\n if (clow == false)\n {\n Console.Write(-1);\n }\n }\n \n }\n }\n}\n","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. ","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.","notes":"NoteIn the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.","sample_inputs":["1\n0","11\n3 4 5 4 5 3 5 3 4 4 0","8\n3 2 5 1 5 2 2 3"],"sample_outputs":["0","5554443330","-1"],"human_solution":"\ufeff\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Linq;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace Solution\n{\n class Solution\n {\n public void Solve()\n {\n var n = int.Parse(Console.ReadLine());\n\n var list = new List();\n {\n var ds = Console.ReadLine().Split(' ');\n foreach (var v in ds)\n {\n var d = int.Parse(v);\n list.Add(d);\n }\n }\n\n if (!list.Contains(0))\n {\n Console.WriteLine(\"-1\");\n return;\n }\n list.Remove(0);\n\n if (list.Sum() % 3 == 0)\n {\n _o(list);\n return;\n }\n\n for (int i = 1; i <= 9; i++)\n {\n if (!list.Contains(i))\n continue;\n\n if ((list.Sum() - i) % 3 == 0)\n {\n list.Remove(i);\n _o(list);\n return;\n }\n }\n\n for (int i = 1; i <= 9; i++)\n {\n if (!list.Contains(i))\n continue;\n \n list.Remove(i);\n\n for (int j = 1; j <= i; j++)\n {\n if (!list.Contains(j))\n continue;\n\n if ((list.Sum() -j) % 3 == 0)\n {\n list.Remove(j);\n _o(list);\n return;\n }\n }\n\n list.Add(i);\n }\n\n Console.WriteLine(\"-1\");\n }\n\n void _o(List ds)\n {\n if (ds.Sum() != 0)\n {\n ds.Sort();\n ds.Reverse();\n foreach (var v in ds)\n {\n Console.Write(v);\n }\n }\n Console.WriteLine(\"0\");\n }\n\n\n#if !DEBUG\n static void Main(string[] args)\n {\n new Solution().Solve();\n }\n#endif\n }\n}\n","testcases":"[{'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n', 'output': ['5554443330\\r\\n']}, {'input': '8\\r\\n3 2 5 1 5 2 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n5 5 4 1 5 5 5 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n', 'output': ['33322222200\\r\\n']}, {'input': '12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n3 6 1 6 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n', 'output': ['999666330\\r\\n']}, {'input': '5\\r\\n9 6 6 6 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 2 2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n3 3 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '7\\r\\n3 3 2 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '6\\r\\n0 3 3 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 1 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 4 4 4 4\\r\\n', 'output': ['444330\\r\\n']}, {'input': '7\\r\\n0 3 3 2 2 4 4\\r\\n', 'output': ['4433220\\r\\n']}, {'input': '7\\r\\n4 2 3 3 0 0 0\\r\\n', 'output': ['4332000\\r\\n']}, {'input': '4\\r\\n1 1 0 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n3 0 2 2\\r\\n', 'output': ['30\\r\\n']}, {'input': '8\\r\\n3 3 3 5 5 0 0 0\\r\\n', 'output': ['333000\\r\\n']}, {'input': '8\\r\\n3 3 6 3 0 7 7 9\\r\\n', 'output': ['963330\\r\\n']}, {'input': '9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 0\\r\\n', 'output': ['90\\r\\n']}, {'input': '10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n', 'output': ['32222220\\r\\n']}, {'input': '10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n', 'output': ['31111110\\r\\n']}, {'input': '10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n', 'output': ['44444430\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 4 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 4 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '3\\r\\n2 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['3210\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n8 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 8 5 6\\r\\n', 'output': ['600\\r\\n']}, {'input': '4\\r\\n5 8 3 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n1 4 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n2 2 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n3 2 5 0 0\\r\\n', 'output': ['300\\r\\n']}, {'input': '4\\r\\n5 3 2 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '5\\r\\n0 0 0 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 3 5 8\\r\\n', 'output': ['30\\r\\n']}]","id":286} {"difficulty":1900,"lang":"MS C#","lang_cluster":"C#","src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf_BooksExposition\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(line[0]);\n int k = Convert.ToInt32(line[1]);\n line = Console.ReadLine().Split(' ');\n int[] nums = line.Select(s => Convert.ToInt32(s)).ToArray();\n\n \/\/int k = 5;\n \/\/int[] nums = new int[] { 8, 19,14, 10, 13,8};\n int l;\n var list = BooksExposition(k, nums, out l);\n Console.WriteLine(l + \" \" + list.Count);\n foreach (int i in list)\n {\n Console.WriteLine((i + 1) + \" \" + (i + l));\n\n\n }\n\n\n\n }\n\n private static List BooksExposition(int k, int[] nums, out int l)\n {\n LinkedList maxlist = new LinkedList();\n LinkedList minlist = new LinkedList();\n\n l = 1;\n\n maxlist.AddLast(0);\n minlist.AddLast(0);\n int i = 0;\n List results = new List();\n results.Add(0);\n for (int j = 1; j < nums.Length; j++)\n {\n while (maxlist.Count > 0 && nums[j] > nums[maxlist.Last.Value])\n {\n maxlist.RemoveLast();\n }\n if (maxlist.Count == 0 || nums[j] != nums[maxlist.Last.Value])\n maxlist.AddLast(j);\n\n while (minlist.Count > 0 && nums[j] < nums[minlist.Last.Value])\n {\n minlist.RemoveLast();\n }\n if (minlist.Count == 0 || nums[j] != nums[minlist.Last.Value])\n minlist.AddLast(j);\n\n while (nums[maxlist.First.Value] - nums[minlist.First.Value] > k)\n {\n if (minlist.First.Value < maxlist.First.Value)\n {\n i = minlist.First.Value + 1;\n minlist.RemoveFirst();\n }\n else\n {\n i = maxlist.First.Value + 1;\n maxlist.RemoveFirst();\n if (minlist.First.Value == maxlist.First.Value)\n minlist.RemoveFirst();\n }\n\n }\n\n if (j - i + 1 > l)\n {\n l = j - i + 1;\n results.Clear();\n results.Add(i);\n }\n else if (j - i + 1 == l)\n {\n results.Add(i);\n }\n }\n return results;\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace cf_BooksExposition\n{\n class Program\n {\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split(' ');\n int n = Convert.ToInt32(line[0]);\n int k = Convert.ToInt32(line[1]);\n line = Console.ReadLine().Split(' ');\n int[] nums = line.Select(s => Convert.ToInt32(s)).ToArray();\n\n \/\/int k = 793;\n\n\n \/\/int[] nums = new int[] {98580,27440,3719,73977,34819,64092,89939,75329,72884,66502,17464,73662,6666,47984,45348};\n int l;\n var list = BooksExposition(k, nums, out l);\n Console.WriteLine(l + \" \" + list.Count);\n foreach (int i in list)\n {\n Console.WriteLine((i + 1) + \" \" + (i + l));\n }\n\n\n\n }\n\n private static List BooksExposition(int k, int[] nums, out int l)\n {\n LinkedList maxlist = new LinkedList();\n LinkedList minlist = new LinkedList();\n\n l = 1;\n\n maxlist.AddLast(0);\n minlist.AddLast(0);\n int i = 0;\n List results = new List();\n results.Add(0);\n for (int j = 1; j < nums.Length; j++)\n {\n while (maxlist.Count > 0 && nums[j] > nums[maxlist.Last.Value])\n {\n maxlist.RemoveLast();\n }\n\n maxlist.AddLast(j);\n\n while (minlist.Count > 0 && nums[j] < nums[minlist.Last.Value])\n {\n minlist.RemoveLast();\n }\n\n minlist.AddLast(j);\n\n while (nums[maxlist.First.Value] - nums[minlist.First.Value] > k)\n {\n if (minlist.First.Value < maxlist.First.Value)\n {\n i = minlist.First.Value + 1;\n minlist.RemoveFirst();\n while (maxlist.First.Value < i)\n maxlist.RemoveFirst();\n }\n else\n {\n i = maxlist.First.Value + 1;\n maxlist.RemoveFirst();\n while (minlist.First.Value < i)\n minlist.RemoveFirst();\n }\n }\n\n if (j - i + 1 > l)\n {\n l = j - i + 1;\n results.Clear();\n results.Add(i);\n }\n else if (j - i + 1 == l)\n {\n results.Add(i);\n }\n }\n return results;\n }\n }\n}\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":287} {"difficulty":1800,"lang":"Mono C#","lang_cluster":"C#","src_uid":"bfbd7a73e65d240ee7e8c83cc68ca0a1","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeff\/\/#undef DEBUG\n\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Diagnostics;\n\nnamespace codeforces\n{\n class C\n {\n \/\/ test\n static CodeforcesUtils CF = new CodeforcesUtils(\n@\"\n3\n1 2 4\n\");\n\n class Solver\n {\n public void Solve()\n {\n \/\/\n int n = int.Parse(CF.ReadLine());\n string[] ss = CF.ReadLine().Split(' ');\n List ns = new List();\n foreach (string s in ss)\n {\n ns.Add(int.Parse(s));\n }\n \/\/\n int a = ns[ns.Count - 1] + 2;\n int b = ns.Count+1;\n\n for (int i = 0; i < ns.Count; i++)\n {\n int a1 = ns[i] + 1;\n int b1 = i + 1;\n\n if (a1 * b == a * b1)\n {\n CF.WriteLine(\"unique\");\n CF.WriteLine(ns[ns.Count-1]+1);\n return;\n }\n }\n CF.WriteLine(\"not unique\");\n }\n }\n \n \n #region test\n\n static void Main(string[] args)\n {\n System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(\"ru-RU\");\n\n new Solver().Solve();\n CF.Close();\n }\n\n static void TLE()\n {\n for (; ; ) ;\n }\n\n class CodeforcesUtils\n {\n public string ReadLine()\n {\n#if DEBUG\n if (_lines == null)\n {\n _lines = new List();\n string[] ss = _test_input.Replace(\"\\n\", \"\").Split('\\r');\n for (int i = 0; i < ss.Length; i++)\n {\n if (\n (i == 0 || i == ss.Length - 1) &&\n ss[i].Length == 0\n )\n continue;\n\n _lines.Add(ss[i]);\n }\n }\n\n string s = null;\n if (_lines.Count > 0)\n {\n s = _lines[0];\n _lines.RemoveAt(0);\n }\n return s;\n\n#else\n \/\/return _sr.ReadLine();\n return Console.In.ReadLine();\n#endif\n }\n\n public void WriteLine(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.WriteLine(o);\n#else\n \/\/_sw.WriteLine(o);\n Console.WriteLine(o);\n#endif\n }\n\n public void Write(object o)\n {\n#if DEBUG\n System.Diagnostics.Trace.Write(o);\n#else\n \/\/_sw.Write(o);\n Console.Write(o);\n#endif\n }\n\n\n string _test_input;\n\n List _lines;\n\n#if DEBUG\n public CodeforcesUtils(string test_input)\n {\n _test_input = test_input;\n }\n#else\n\n public CodeforcesUtils(string dummy)\n {\n \/\/_sr = new System.IO.StreamReader(\"input.txt\");\n \/\/_sw = new System.IO.StreamWriter(\"output.txt\");\n }\n#endif\n\n public void Close()\n {\n if( _sr!= null)\n _sr.Close();\n if( _sw != null)\n _sw.Close();\n }\n\n System.IO.StreamReader _sr=null;\n System.IO.StreamWriter _sw=null;\n \n }\n\n #endregion\n }\n}\n","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round45\n{\n class C\n {\n public static void Main()\n {\n Scanner scanner = Scanner.FromConsole();\n int n = scanner.NextInt();\n int[] stop = new int[n+1];\n stop[0] = 0;\n for (int i = 0; i < n; i++) stop[i + 1] = scanner.NextInt();\n\n double min = 10, max = double.MaxValue;\n for (int i = 1; i <= n; i++)\n {\n min = Math.Max(min, stop[i] * 10 \/ (double)i);\n max = Math.Min(max, (stop[i] + 1) * 10 \/ (double)i);\n }\n double eps = 1e-9;\n if ((int)(min \/ 10 * (n + 1) + eps) != (int)(max \/ 10 * (n + 1) - eps))\n {\n Console.Write(\"not unique\");\n return;\n }\n Console.WriteLine(\"unique\");\n Console.WriteLine((int)(min \/ 10 * (n + 1) + eps));\n }\n\n #region Scanner\n public class Scanner : IDisposable\n {\n const int MAX_BUFFER_SIZE = 1024 * 1024 * 16;\n const string DELIMITER = \" \\r\\n\\t\";\n\n System.IO.TextReader stream;\n int pos = 0, len = 0;\n bool endStream = false;\n int BufferSize = MAX_BUFFER_SIZE;\n char[] buffer = new char[MAX_BUFFER_SIZE];\n\n public enum Option { Buffering, NoBuffering }\n\n public Scanner(System.IO.TextReader stream, Option bufferingOption)\n {\n this.stream = stream;\n if (bufferingOption == Option.NoBuffering) BufferSize = 1;\n }\n\n void ReadBuffer()\n {\n pos = 0;\n len = stream.ReadBlock(buffer, 0, BufferSize);\n endStream = len == 0;\n }\n\n void SkipDelimiter()\n {\n while (!endStream && IsDelimiter(Peek())) NextChar();\n }\n\n static bool IsDelimiter(char c)\n {\n return DELIMITER.Contains(c);\n }\n\n bool Continue(char c)\n {\n return !endStream && !IsDelimiter(c);\n }\n\n char Peek()\n {\n if (pos >= len) ReadBuffer();\n return buffer[pos];\n }\n\n public char NextChar()\n {\n if (pos >= len) ReadBuffer();\n return buffer[pos++];\n }\n\n public string NextString()\n {\n SkipDelimiter();\n StringBuilder res = new StringBuilder();\n for (char c = NextChar(); Continue(c); c = NextChar()) res.Append(c);\n return res.ToString();\n }\n\n public int NextInt()\n {\n SkipDelimiter();\n int res = 0;\n char c = NextChar();\n int sign = 1;\n if (c == '-') { sign = -1; c = NextChar(); }\n for (; Continue(c); c = NextChar())\n res = res * 10 + (c - '0');\n return sign * res;\n }\n\n public long NextLong()\n {\n SkipDelimiter();\n long res = 0;\n char c = NextChar();\n long sign = 1;\n if (c == '-') { sign = -1; c = NextChar(); }\n for (; Continue(c); c = NextChar())\n res = res * 10 + (c - '0');\n return sign * res;\n }\n\n public double NextDouble()\n {\n return double.Parse(NextString());\n }\n\n public int[] NextInts(int n)\n {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) res[i] = NextInt();\n return res;\n }\n\n public long[] NextLongs(int n)\n {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) res[i] = NextLong();\n return res;\n }\n\n public double[] NextDoubles(int n)\n {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) res[i] = NextDouble();\n return res;\n }\n\n public string[] NextStrings(int n)\n {\n string[] res = new string[n];\n for (int i = 0; i < n; i++) res[i] = NextString();\n return res;\n }\n\n public static Scanner FromString(string s)\n {\n return new Scanner(new System.IO.StreamReader(new System.IO.MemoryStream(Encoding.ASCII.GetBytes(s))), Option.Buffering);\n }\n\n public static Scanner FromFile(string path)\n {\n return new Scanner(new System.IO.StreamReader(path), Option.Buffering);\n }\n\n public static Scanner FromConsole()\n {\n return new Scanner(Console.In, Option.Buffering);\n }\n\n public void Dispose()\n {\n stream.Close();\n }\n }\n #endregion\n }\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":288} {"difficulty":1900,"lang":"MS C#","lang_cluster":"C#","src_uid":"c1de33ee9bb05db090c4d23ec9994f72","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n task.Solve();\n }\n\n private void Solve()\n {\n string text;\n long k;\n Input.Next(out text);\n Input.Next(out k);\n long n = text.Length;\n\n var corrections = new long[n, n + 1];\n\n for (var i = 0; i < n; i++)\n for (var j = i + 1; j < n; j++)\n for (var t = 0; t < (j - i + 1) \/ 2; t++)\n corrections[i, j - i + 1] += text[i + t] == text[j - t] ? 0 : 1;\n\n var dp = new long[n + 1, k + 1];\n for (var i = 0; i <= n; i++)\n {\n for (var j = 0; j <= k; j++)\n dp[i, j] = long.MaxValue \/ 2;\n dp[i, 0] = 0;\n dp[i, 1] = corrections[0, i];\n }\n for (var i = 0; i <= k; i++) dp[0, i] = 0;\n\n for (var count = 1; count < k; count++)\n {\n for (var l = 0; l <= n; l++)\n {\n for (var len = 1; l + len <= n; len++)\n {\n dp[l + len, count + 1] = Math.Min(dp[l + len, count + 1], dp[l, count] + corrections[l, len]);\n }\n }\n }\n\n var min = long.MaxValue;\n var minIndex = -1;\n for (var i = 1; i <= k; i++)\n if (dp[n, i] < min)\n {\n min = dp[n, i];\n minIndex = i;\n }\n Console.WriteLine(min);\n\n var prev = n;\n var answers = new List();\n for (var j = 1; j <= minIndex; j++)\n {\n var m = 100000L;\n for (var i = prev - 1; i > 0; i--)\n {\n if (dp[i, minIndex - j] + corrections[i, prev - i] > min) continue;\n m = i;\n }\n answers.Add(text.Substring((int)m, (int)(prev - m)));\n prev = m;\n min = dp[m, minIndex - j];\n }\n if (prev > 0) answers.Add(text.Substring(0, (int)(prev)));\n\n answers.Reverse();\n for (var i = 0; i < answers.Count; i++)\n answers[i] = answers[i].Substring(0, (answers[i].Length + 1)\/2) + new string(answers[i].Substring(0, (answers[i].Length)\/2).Reverse().ToArray());\n \n Console.WriteLine(string.Join(\"+\", answers));\n }\n }\n\n #region Input\n\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return !string.IsNullOrEmpty(_line);\n }\n\n public static bool Next(out long a)\n {\n bool ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static List Numbers()\n {\n Next();\n if (string.IsNullOrEmpty(_line)) return new List();\n return _line.Split(' ').Select(long.Parse).ToList();\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n #endregion\n}","description":"Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite game Fur2 and didn't have enough time to do the literature task. As Innocentius didn't want to get an F, he decided to do the task and read the book called \"Storm and Calm\" during the IT and Math lessons (he never used to have problems with these subjects). When the IT teacher Mr. Watkins saw this, he decided to give Innocentius another task so that the boy concentrated more on the lesson and less \u2014 on the staff that has nothing to do with IT. Mr. Watkins said that a palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. A concatenation of strings a, b is a string ab that results from consecutive adding of string b to string a. Of course, Innocentius knew it all but the task was much harder than he could have imagined. Mr. Watkins asked change in the \"Storm and Calm\" the minimum number of characters so that the text of the book would also be a concatenation of no more than k palindromes. Innocentius can't complete the task and therefore asks you to help him.","input_specification":"The first input line contains a non-empty string s which is the text of \"Storm and Calm\" (without spaces). The length of the string s does not exceed 500 characters. String s consists of uppercase and lowercase Latin letters. The second line contains a single number k (1\u2009\u2264\u2009k\u2009\u2264\u2009|s|, where |s| represents the length of the string s).","output_specification":"Print on the first line the minimum number of changes that Innocentius will have to make. Print on the second line the string consisting of no more than k palindromes. Each palindrome should be non-empty and consist of uppercase and lowercase Latin letters. Use the character \"+\" (ASCII-code 43) to separate consecutive palindromes. If there exist several solutions, print any of them. The letters' case does matter, that is an uppercase letter is not considered equivalent to the corresponding lowercase letter.","notes":null,"sample_inputs":["abacaba\n1","abdcaba\n2","abdcaba\n5","abacababababbcbabcd\n3"],"sample_outputs":["0\nabacaba","1\nabdcdba","0\na+b+d+c+aba","1\nabacaba+babab+bcbabcb"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Codeforces.TaskD\n{\n public class Task\n {\n public static void Main()\n {\n var task = new Task();\n task.Solve();\n }\n\n private void Solve()\n {\n string text;\n long k;\n Input.Next(out text);\n Input.Next(out k);\n long n = text.Length;\n\n var corrections = new long[n, n + 1];\n\n for (var i = 0; i < n; i++)\n for (var j = i + 1; j < n; j++)\n for (var t = 0; t < (j - i + 1) \/ 2; t++)\n corrections[i, j - i + 1] += text[i + t] == text[j - t] ? 0 : 1;\n\n var dp = new long[n + 1, k + 1];\n for (var i = 0; i <= n; i++)\n {\n for (var j = 0; j <= k; j++)\n dp[i, j] = long.MaxValue \/ 2;\n dp[i, 0] = 0;\n dp[i, 1] = corrections[0, i];\n }\n for (var i = 0; i <= k; i++) dp[0, i] = 0;\n\n for (var count = 1; count < k; count++)\n {\n for (var l = 0; l <= n; l++)\n {\n for (var len = 1; l + len <= n; len++)\n {\n dp[l + len, count + 1] = Math.Min(dp[l + len, count + 1], dp[l, count] + corrections[l, len]);\n }\n }\n }\n\n var min = long.MaxValue;\n var minIndex = -1;\n for (var i = 1; i <= k; i++)\n if (dp[n, i] < min)\n {\n min = dp[n, i];\n minIndex = i;\n }\n Console.WriteLine(min);\n\n var prev = n;\n var answers = new List();\n for (var j = 1; j < minIndex; j++)\n {\n var m = 100000L;\n for (var i = prev - 1; i > 0; i--)\n {\n if (dp[i, minIndex - j] + corrections[i, prev - i] > min) continue;\n m = i;\n }\n answers.Add(text.Substring((int)m, (int)(prev - m)));\n prev = m;\n min = dp[m, minIndex - j];\n }\n answers.Add(text.Substring(0, (int)(prev)));\n\n answers.Reverse();\n for (var i = 0; i < answers.Count; i++)\n answers[i] = answers[i].Substring(0, (answers[i].Length + 1)\/2) + new string(answers[i].Substring(0, (answers[i].Length)\/2).Reverse().ToArray());\n \n Console.WriteLine(string.Join(\"+\", answers));\n }\n }\n\n #region Input\n\n public class Input\n {\n private static string _line;\n\n public static bool Next()\n {\n _line = Console.ReadLine();\n return !string.IsNullOrEmpty(_line);\n }\n\n public static bool Next(out long a)\n {\n bool ok = Next();\n a = ok ? long.Parse(_line) : 0;\n return ok;\n }\n\n public static bool Next(out long a, out long b)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n }\n else\n {\n a = b = 0;\n }\n\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n }\n else\n {\n a = b = c = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n }\n else\n {\n a = b = c = d = 0;\n }\n return ok;\n }\n\n public static bool Next(out long a, out long b, out long c, out long d, out long e)\n {\n bool ok = Next();\n if (ok)\n {\n long[] array = _line.Split(' ').Select(long.Parse).ToArray();\n a = array[0];\n b = array[1];\n c = array[2];\n d = array[3];\n e = array[4];\n }\n else\n {\n a = b = c = d = e = 0;\n }\n return ok;\n }\n\n public static List Numbers()\n {\n Next();\n if (string.IsNullOrEmpty(_line)) return new List();\n return _line.Split(' ').Select(long.Parse).ToList();\n }\n\n public static bool Next(out string value)\n {\n value = string.Empty;\n if (!Next()) return false;\n value = _line;\n return true;\n }\n }\n\n #endregion\n}","testcases":"[{'input': 'abacaba\\r\\n1\\r\\n', 'output': ['0\\r\\nabacaba\\r\\n']}, {'input': 'abdcaba\\r\\n2\\r\\n', 'output': ['1\\r\\nabdcdba\\r\\n']}, {'input': 'abdcaba\\r\\n5\\r\\n', 'output': ['0\\r\\na+b+d+c+aba\\r\\n']}, {'input': 'abacababababbcbabcd\\r\\n3\\r\\n', 'output': ['1\\r\\nabacaba+babab+bcbabcb\\r\\n']}, {'input': 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n1\\r\\n', 'output': ['0\\r\\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n']}, {'input': 'abcabcabcabcxyzxyzxyzxyz\\r\\n5\\r\\n', 'output': ['7\\r\\na+b+cabcaacbac+xyzxyzzyxzyx\\r\\n']}, {'input': 'aaaaaabbbbbb\\r\\n1\\r\\n', 'output': ['6\\r\\naaaaaaaaaaaa\\r\\n']}, {'input': 'abcdefg\\r\\n7\\r\\n', 'output': ['0\\r\\na+b+c+d+e+f+g\\r\\n']}, {'input': 'xxxyyyzzz\\r\\n2\\r\\n', 'output': ['3\\r\\nxxxyyyxxx\\r\\n']}, {'input': 'zpbdnUpuVzOCzkgMmOXMgnrWrrHAylLovxRLSkRyRlsyZXUYBXZqjpWiHhjwEnNhJTBEFqSvgoSzcDSnNJXdDEyJwyxyEZdtTKcm\\r\\n30\\r\\n', 'output': ['22\\r\\nz+pbddbp+u+V+zOOz+k+gMmOmMg+n+rWr+r+H+A+y+l+L+o+v+x+RLSLR+yRlRy+ZXUYUXZ+qjpWiHhjwEwjhHiWpjq+SvgvS+z+c+D+SnNnS+dDEyJwwJyEDd+tTKTt\\r\\n']}, {'input': 'a\\r\\n1\\r\\n', 'output': ['0\\r\\na\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n1\\r\\n', 'output': ['200\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': 'y\\r\\n1\\r\\n', 'output': ['0\\r\\ny\\r\\n']}, {'input': 'NbdjyyjdbN\\r\\n1\\r\\n', 'output': ['0\\r\\nNbdjyyjdbN\\r\\n']}, {'input': 'ttniaiCiCp\\r\\n5\\r\\n', 'output': ['0\\r\\ntt+n+iai+CiC+p\\r\\n']}, {'input': 'GCDnnDCzmNvNmzQQmTzYWtwEaWiiWaEwtWYzTmsDODszuzRWcOzWmhmWzOcWRzuzhhTWawwaWTywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n10\\r\\n', 'output': ['0\\r\\nG+CDnnDC+zmNvNmz+QQ+mTzYWtwEaWiiWaEwtWYzTm+sDODs+zuzRWcOzWmhmWzOcWRzuz+hh+TWawwaWT+ywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n']}, {'input': 'SWPEISxfnvQhDdWMUMDDFAgnjkoNpKZJWgeftsapnfTiTULMcl\\r\\n50\\r\\n', 'output': ['0\\r\\nS+W+P+E+I+S+x+f+n+v+Q+h+D+d+W+MUM+DD+F+A+g+n+j+k+o+N+p+K+Z+J+W+g+e+f+t+s+a+p+n+f+TiT+U+L+M+c+l\\r\\n']}, {'input': 'QBJXFByWnwnwyusOgBKpUqxTjfEJaPrRYUHItEVI\\r\\n3\\r\\n', 'output': ['14\\r\\nQBJXFByWnwnWyBFXJBQ+pUqxTjfEEfjTxqUp+ItEtI\\r\\n']}, {'input': 'YGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n1\\r\\n', 'output': ['0\\r\\nYGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n']}, {'input': 'QsAQXXlArrAlXaBSSBaX\\r\\n4\\r\\n', 'output': ['1\\r\\nQssQ+XX+lArrAl+XaBSSBaX\\r\\n']}, {'input': 'npRAxpncpgQqTHHTqQgpcSbYEhvKBPRDUjnXznRXnjUDRPlKvhEYbNgrtVweZIhmyEqEymhItDwVtrgN\\r\\n5\\r\\n', 'output': ['5\\r\\nnpRARpn+cpgQqTHHTqQgpc+S+bYEhvKBPRDUjnXznzXnjUDRPBKvhEYb+NgrtVweZIhmyEqEymhIZewVtrgN\\r\\n']}, {'input': 'WdYlPYGSNSGYPlYdWpIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhzVWOelUjtrMyIpZassaZBSohcqchoSBZKgKZlhMOXMoMXOMZGZvvRkqSOmHWZxSxZWHmOSrkRvvWPW\\r\\n10\\r\\n', 'output': ['3\\r\\nWdYlPYGSNSGYPlYdW+pIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhiVWOelUjtrMyIp+ZassaZ+BSohcqchoSB+ZKgKZ+ll+MOXMoMXOM+ZGZ+vvRkqSOmHWZxSxZWHmOSqkRvv+WPW\\r\\n']}, {'input': 'vbjmuTEWtvQvdMHTuUogvaWmqiwwPmJaupYrqhRfiRRifqhVMxMWIJPPJBnyJkToeUUdAfjoXzCTyMBVUMyTPyXYYBxmcHNTBcCcmxRXwOtmsbwXHKccOHtPtWWvCtMCkcMlfMTRhazNVkeWNCaPRP\\r\\n20\\r\\n', 'output': ['37\\r\\nvbjmuTEWtvQvtWETumjbv+aWmqiwiqmWa+u+p+YrY+hRfiRRifRh+VMxMV+IJPPJI+nyJyn+oeUUdUUeo+XzCTyMBVBMyTCzX+YY+BxmcHNTTNHcmxB+XwOtmtOwX+HKccKH+tPt+WW+vCtMCkCMtCv+TRhazNVkkVNzahRT\\r\\n']}, {'input': 'DdHqZfmOqjEoTvmDQiiRFdfMzfRjLUCwFYdfBaZvNPlocnwtkBKmzVGPBxJhmxnDlCOlqiZoKXWgzXundzeEaRbYpqbTtPEnGgRzpdXLmNThaJSBzPglWuywvRkzaQEUHzPVfZOiFOZxymgmAAdnks\\r\\n20\\r\\n', 'output': ['53\\r\\nDdD+qZffZq+jEj+TvmDQiiRFdfMzfRfzMfdFRiiQDmvT+PlocnwtktwncolP+BxJhJxB+D+lCCl+qiZiq+XWgWX+undzeEaRbYbRaEezdnu+gRzpdXLmNNmLXdpzRg+lWuyuWl+kzaQEQazk+VfZOiiOZfV+mgm+AA+d+nkn\\r\\n']}, {'input': 'gwsEqXXqEswgETtttTEmQakaBmHOiOHwQQwzWuylXwwfuufwwXlyuWzxVeQQeVMRAUZDMBggBMDZUARDPGKKGPDUUDKDQQNENtiWLLLLWitNlKvvKlNJbJjijQvFOFvQXwKKKKwKznTmTnzKuNxlxNucynmmnymMqBqMmTUnCjCnUTEqFKSmQQmSKFqAmKNNKmARRoRR\\r\\n30\\r\\n', 'output': ['2\\r\\ngwsEqXXqEswg+ETtttTE+mQakaQm+HOiOH+wQQw+zWuylXwwfuufwwXlyuWz+xVeQQeVx+RAUZDMBggBMDZUAR+DPGKKGPD+UU+DKD+QQ+NEN+tiWLLLLWit+NlKvvKlN+JbJ+jij+QvFOFvQ+X+wKKKKw+KznTmTnzK+uNxlxNu+c+ynmmny+mMqBqMm+TUnCjCnUT+E+qFKSmQQmSKFq+AmKNNKmA+RRoRR\\r\\n']}, {'input': 'eVxEoJPwziDXrGUnqlbhwhbloeUGrXDYzwPwtExVeoLVCZZZZCVLoCRzukaOmLtpRJRSzNIbXAlTtsoUyyerrtYlAXgIEzSRJRFtLmVakuzcCwtKUmLeAmuAeLmUKtwxJVRmekiKrArArHJqemRVJxSllejgLHybDDbyULgjFoLdYsXOtmjnZvQkiiikQvZnjmuOXsOdLnFEpepefnxilxnEnpepfUjQOjIoAtmtRRCqnRRtmtAoIGOQjP\\r\\n10\\r\\n', 'output': ['30\\r\\neVxEoJPwziDXrGUnqlbhwhblqnUGrXDizwPJoExVe+oLVCZZZZCVLo+CRzukaOmLtpRJRSzNIbXAlTtsoUyyUostTlAXbINzSRJRptLmOakuzRC+wtKUmLeAmmAeLmUKtw+xJVRmekiKrArArKikemRVJx+SllS+jgLHybDDbyHLgj+FoLdYsXOtmjnZvQkiiikQvZnjmtOXsYdLoF+EpepefnxiixnfepepE+UjQOjIoAtmtRRCqCRRtmtAoIjOQjU\\r\\n']}, {'input': 'wRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n1\\r\\n', 'output': ['0\\r\\nwRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n']}, {'input': 'fgYTcOUewXjIIjXweUbcTogfniuXbkOCWRKsWCOkbXAinbubBYxyQQyxYBKypwIvfItIfvIwpyKRfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWkzmBwXcDzWXXwIBQJEVbYQVDLHExeXAHuJXfxoilFOXzbbzRKeliocpOvyNOycwdHjbbjHdwcyONhvOWcIYhQbnwnbFNYIxPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgLZyLHZAJNwSzuKJPLfOtJMitSaTYyBeygPxkiRVhIVSCIvJvvJGICSVWhVRpBCiPWNVCnlnCVNWPiCDVBqKHFWufvpwsswyvfuWFHKqBVD\\r\\n13\\r\\n', 'output': ['38\\r\\nfgYTcOUewXjIIjXweUOcTYgf+niuXbkOCWRKRWCOkbXuin+bub+BYxyQQyxYB+KypwIvfItIfvIwpyK+RfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWWzmBoXcDzWXYwIBQJnVbWQVBUnAxeXcHTJXfR+oilFOXzbbzXOFlio+cpOvyNOycwdHjbbjHdwcyONyvOpc+IYhQbnwnbQhYI+xPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgNZyaHZAJfwBzuKJPLzOtRFitSQUYyBcygPx+kiRVhIVSCIvJvvJvICSVIhVRik+CiPWNVCnlnCVNWPiC+DVBqKHFWufvpwsswpvfuWFHKqBVD\\r\\n']}, {'input': 'anZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n1\\r\\n', 'output': ['0\\r\\nanZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n']}, {'input': 'sODJlDMHKskoUnPqUoksKHMDTJDOqqutqYPGWYqtulMAbgQcBSzSjfoiYyjIbrZxzughddhguzxZubIQeYiofjSziBcQgbAMWcckXcWUUWcXkpkSDTHeNNeHTDSkpgguDk\\r\\n94\\r\\n', 'output': ['0\\r\\ns+O+D+J+l+D+M+H+K+s+k+o+U+n+P+q+U+o+k+s+K+H+M+D+T+J+D+O+qq+u+t+q+Y+P+G+W+Y+q+t+u+l+M+A+b+g+Q+c+B+SzS+j+f+o+i+Y+y+j+I+b+r+ZxzughddhguzxZ+u+b+I+Q+e+Y+i+o+f+j+S+z+i+B+c+Q+g+b+A+M+W+cc+kXcWUUWcXk+pkSDTHeNNeHTDSkp+gg+u+D+k\\r\\n']}, {'input': 'eAfVVOAwrZUBZrddkqHxmfuTbSDozpObTuffxEpkUvphyFhwaFhhiKhZeGEVvWGUkGptGBdMHTYYQcCdHBHDdYdDotouzzDrMHuuHMrELXcuoGpTmUUnoNzUfUmTpGoFcXLEkcYsCmcTvuoSmIDIjO\\r\\n101\\r\\n', 'output': ['4\\r\\ne+A+f+VV+O+A+w+r+Z+U+B+Z+r+dd+k+q+H+x+m+f+u+T+b+S+D+o+z+p+O+b+T+u+ff+x+E+p+k+U+v+p+h+y+F+h+w+a+F+hh+i+K+h+Z+e+G+E+V+v+W+G+U+k+G+p+t+G+B+d+M+H+T+YY+Q+c+C+d+HBH+DdYdD+oto+u+zz+D+rMHuuHMr+ELXcuoGpTmUUnoNonUUmTpGoucXLE+k+c+Y+s+C+m+c+T+v+u+o+S+m+IDI+j+O\\r\\n']}, {'input': 'kKBYQwipkLMkqjltKKagWfXynkXOHfHsbthvYsUyAsAfWcbjOlFFaICcpmBVBiteGerPiKjdMZqwdyirPDgJdJOHonMXWkvRVFKxkXCeqUsjeSMZpgMUPRRTiQGfGbySUIJnsnGprQFmFrZJfylAGB\\r\\n114\\r\\n', 'output': ['5\\r\\nk+K+B+Y+Q+w+i+p+kLLk+q+j+l+t+KK+a+g+W+f+XynyX+O+HfH+sbthtbs+U+y+AsA+f+W+c+b+j+O+l+FF+a+I+C+c+p+m+BVB+i+t+eGe+r+P+i+K+j+d+M+Z+q+w+d+y+i+r+P+D+g+JdJ+O+H+o+n+M+X+W+k+v+R+V+F+K+x+k+X+C+e+q+U+s+j+e+S+MZpZM+U+P+RR+T+i+Q+GfG+b+y+S+U+I+J+nsn+G+p+r+Q+FmF+r+Z+J+f+y+l+A+G+B\\r\\n']}, {'input': 'tjTBpykkypBTjIexukbkuxeSJNRzEEzRNJScwVwDrUozZYYZzoUruauBzjssNzBbSSbXUWcjUvUjcWUePndNNdxxDFSiPnvjiijvnPiSFDxxAyaayAYzjBBjzBuWItiDUDNfawfwafNDUDiuIWuBjAWRPiPRWAtXewGGwTXtTTvejJJjtvJJFyjyFDDXaWwvCCCvwWaX\\r\\n182\\r\\n', 'output': ['0\\r\\nt+jTBpykkypBTj+I+exukbkuxe+SJNRzEEzRNJS+c+wVw+D+rUozZYYZzoUr+uau+B+z+j+ss+N+z+B+bSSb+X+UWcjUvUjcWU+e+P+n+dNNd+xxDFSiPnvjiijvnPiSFDxx+AyaayA+Y+zjBBjz+B+u+W+I+t+iDUDNfawfwafNDUDi+u+I+W+u+B+j+AWRPiPRWA+t+X+e+wGGw+T+X+t+TT+v+e+jJJj+t+v+JJ+FyjyF+DD+XaWwvCCCvwWaX\\r\\n']}, {'input': 'zQQziKpcCZVKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXTodxZMezrlsBlGUZWMrMiKVuCcGGLQYgqifBVjvGoGSjVBfiqsYQLGLGqeWyuxJhhJHuyNeqwrNQuOvlsJBlokJcZujGRrnJRmmRJuWRGjuhcJkYIBJslVOuyNrQolfIepLARflumuIjUoKZeoBQdYGxYvFDFvYSGsdnaoeZKMUjIXmulfRBLyeIfloglNoaRXNeNXRkoNegAA\\r\\n41\\r\\n', 'output': ['21\\r\\nzQQz+i+K+p+c+C+Z+VKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXPodxZMezrlsvlGUZvMrMiKV+u+C+c+GG+LQYgqifBVjvGoGvjVBfiqgYQL+GLG+q+e+W+y+u+x+JhhJ+H+u+y+N+e+q+w+rNQuOvlsJBlokJcZujGRrnJRmmRJnrRGjuZcJkolBJslvOuQNr+Q+olfIepLARflumuIjUoKZeoBQdYGxYvFDFvYxGYdQBoeZKoUjIumulfRALpeIflo+g+l+NoaRXNeNXRaoN+e+g+AA\\r\\n']}, {'input': 'NIwgwfTKMVQyCQXyWNtvjwlPpwjkDDnRdNdyvdtSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwUJFViLADpYhJslnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJStrvydNdRnDDkjwpPlwjvtNWUXQCyQVMKTfwgwIN\\r\\n85\\r\\n', 'output': ['2\\r\\nN+I+wgw+f+T+K+M+V+Q+y+C+Q+X+y+W+N+t+v+j+w+l+P+p+w+j+k+DD+n+R+dNd+y+v+d+tSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwxJFViLADpYhJulnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJSt+r+v+y+dNd+R+n+DD+k+j+w+p+P+l+w+j+v+t+N+W+U+X+Q+C+y+Q+V+M+K+T+f+wgw+I+N\\r\\n']}, {'input': 'acaoDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzOjIRmrFjORuyxAZhRDoBjNJGNMFFMTQsNjBtTTtZFZPBRzKnGvYUuwyWixoqSkxBJqoWiWTIuUYvGnKzRoaITJjRiuIIifpNwnOBGBOnwNpfiIIukajjQbplxlpbQiDLNLCZCzfxLxyJnMEMrdQKBbWWqaOXdGORUHwXcadcXwHMROGAXOaqMKpBKQdLMAGIJyxLxfHCZCLNLDyewSmLIRpACnNONNnCApVILmSweyFofWbAfttMArOnrMdNysgofPNujqwwJJwCqjuDPfngsyNdsXnOrAMtmfAaWPoFYRhBmMgLgXmvxBY\\r\\n131\\r\\n', 'output': ['16\\r\\naca+oDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzSjIzJrFjOyuyxqZhRDo+B+j+N+J+G+N+MFFM+T+Q+s+N+j+B+tTTt+ZFZ+P+B+R+z+K+n+G+v+Y+U+u+w+y+W+i+x+o+q+S+k+x+B+J+q+o+WiW+T+I+u+U+Y+v+G+n+K+z+R+o+a+I+T+J+j+R+i+uIIifpNwnOBGBOnwNpfiIIu+k+a+jj+QbplxlpbQ+i+D+LNL+CZC+z+f+xLx+y+J+n+MEM+r+d+Q+K+B+b+WW+qaOXdGORUHwXcaacXwHUROGdXOaq+M+K+p+B+K+Q+d+L+M+A+G+I+J+y+xLx+f+H+CZC+LNL+D+yewSmLIRpACnNOONnCApRILmSwey+F+o+f+W+b+AfttMArOnrMdNysgofPNujqwwJJwwqjuNPfogsyNdMrnOrAMttfA+a+W+P+o+F+Y+R+h+B+m+M+gLg+X+m+v+x+B+Y\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n400\\r\\n', 'output': ['0\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': 'aa\\r\\n1\\r\\n', 'output': ['0\\r\\naa\\r\\n']}, {'input': 'aA\\r\\n1\\r\\n', 'output': ['1\\r\\naa\\r\\n']}, {'input': 'aA\\r\\n2\\r\\n', 'output': ['0\\r\\na+A\\r\\n']}]","id":289} {"difficulty":1600,"lang":"Mono C#","lang_cluster":"C#","src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF156B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"..\/..\/input5.txt\");\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\t\t\tvar ints = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t\tbyte[] peoples = new byte[ints[0]];\n\t\t\tint rightPeoplesCount = ints[1];\n\t\t\tint[] opinions = peoples.Select(i => int.Parse(reader.ReadLine())).ToArray();\n\t\t\t\n\t\t\tHashSet impossibleMurders = new HashSet();\n\t\t\tint lastPossibleSolution = -1;\n\t\t\tfor (int i = 0; i < peoples.Length; i++) {\n\t\t\t\tint countTruth = 0;\n\t\t\t\t\/\/ is it unpossible\n\t\t\t\tforeach (var opinion in opinions) {\n\t\t\t\t\tif (opinion > 0) {\n\t\t\t\t\t\tif (opinion == i + 1)\n\t\t\t\t\t\t\tcountTruth++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (-opinion != i + 1) \n\t\t\t\t\t\t\tcountTruth++;\n\t\t\t\t\t}\n\t\t\t\t\tif (countTruth > rightPeoplesCount)\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (countTruth != rightPeoplesCount)\n\t\t\t\t\timpossibleMurders.Add(i + 1);\n\t\t\t\telse\n\t\t\t\t\tlastPossibleSolution = i + 1;\n\n\t\t\t}\n\n\t\t\tif (impossibleMurders.Count == peoples.Length - 1) {\n\t\t\t\tfor (int i = 0; i < opinions.Length; i++) {\n\t\t\t\t\tif (opinions[i] == lastPossibleSolution)\n\t\t\t\t\t\tpeoples[i] = 2;\n\t\t\t\t\telse\n\t\t\t\t\t\tpeoples[i] = 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (int i = 0; i < opinions.Length; i++) {\n\t\t\t\t\tif (opinions[i] > 0 && impossibleMurders.Contains(opinions[i]))\n\t\t\t\t\t\tpeoples[i] = 1;\n\t\t\t\t\tif (opinions[i] < 0 && impossibleMurders.Contains(-opinions[i]))\n\t\t\t\t\t\tpeoples[i] = 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar answrs = new string[]{\"Not defined\", \"Lie\", \"Truth\" };\n\t\t\tArray.ForEach(peoples, i => Console.WriteLine(answrs[i]));\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\n\t\t}\n\t}\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace CF156B {\n\tclass Program {\n\t\tstatic void Main(string[] args) {\n\n#if DEBUG\n\t\t\tTextReader reader = new StreamReader(\"..\/..\/input11.txt\");\n#else\n\t\t\tTextReader reader = Console.In;\n#endif\n\t\t\tvar ints = reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n\t\t\tbyte[] peoples = new byte[ints[0]];\n\t\t\tint rightPeoplesCount = ints[1];\n\t\t\tint[] peoplesLoveMe = new int[peoples.Length];\n\t\t\tint[] peoplesHateMe = new int[peoples.Length];\n\t\t\tint[] opinions = peoples.Select(i => int.Parse(reader.ReadLine())).ToArray();\n\t\t\tbool[] impossibleMurders = new bool[peoples.Length];\n\t\t\tint impossibleMurdersCount = 0;\n\t\t\tint lastPossibleSolution = -1;\n\t\t\tint hates=0;\n\t\t\t\n\t\t\tfor (int i = 0; i < opinions.Length; i++) {\n\t\t\t\tif (opinions[i] > 0) {\n\t\t\t\t\tpeoplesLoveMe[opinions[i] - 1]++;\n\t\t\t\t} else {\n\t\t\t\t\tpeoplesHateMe[-opinions[i] - 1]++;\n\t\t\t\t\thates++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < peoples.Length; i++) {\n\t\t\t\tint truthCount = peoplesLoveMe[i];\n\t\t\t\ttruthCount += hates - peoplesHateMe[i];\n\t\t\t\tif (truthCount != rightPeoplesCount) {\n\t\t\t\t\timpossibleMurders[i] = true;\n\t\t\t\t\timpossibleMurdersCount++;\n\t\t\t\t} else {\n\t\t\t\t\tlastPossibleSolution = i + 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (impossibleMurdersCount == peoples.Length - 1) {\n\t\t\t\tfor (int i = 0; i < opinions.Length; i++) {\n\t\t\t\t\tif (opinions[i] > 0) {\n\t\t\t\t\t\tif (opinions[i] == lastPossibleSolution)\n\t\t\t\t\t\t\tpeoples[i] = 2;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpeoples[i] = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (-opinions[i] == lastPossibleSolution)\n\t\t\t\t\t\t\tpeoples[i] = 1;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpeoples[i] = 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (int i = 0; i < opinions.Length; i++) {\n\t\t\t\t\tif (opinions[i] > 0 && impossibleMurders[opinions[i] - 1])\n\t\t\t\t\t\tpeoples[i] = 1;\n\t\t\t\t\tif (opinions[i] < 0 && impossibleMurders[-opinions[i] - 1])\n\t\t\t\t\t\tpeoples[i] = 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar answrs = new string[]{\"Not defined\", \"Lie\", \"Truth\" };\n\t\t\tArray.ForEach(peoples, i => Console.WriteLine(answrs[i]));\n\n#if DEBUG\n\t\t\tConsole.ReadKey();\n#endif\n\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":290} {"difficulty":1900,"lang":"Mono C#","lang_cluster":"C#","src_uid":"cb082cbe9b34a45da851b6764bbc30c3","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Text;\n\nclass Fffuuuu {\n\n Char[] last;\n\n Int32 Have(Int32 dig, Int32 delta, Int32[] stat) {\n Int32 have = 0;\n if (dig - delta >= 0) {\n have += stat[dig - delta];\n }\n if (dig + delta < 10) {\n have += stat[dig + delta];\n }\n return have;\n }\n\n Int32 Pick(String str, Int32 dig, Int32[] stat, Int32 toChange) {\n Int32[] accDist = new Int32[10];\n toChange -= stat[dig];\n for (Int32 pick, dist = 1; toChange != 0; ++dist) {\n if (dig - dist >= 0) {\n pick = Math.Min(toChange, stat[dig - dist]);\n accDist[dist] += pick;\n toChange -= pick;\n }\n if (dig + dist < 10) {\n pick = Math.Min(toChange, stat[dig + dist]);\n accDist[dist] += pick;\n toChange -= pick;\n }\n }\n\n Int32 score = 0;\n for (Int32 delta, cur, i = 0; i < str.Length; ++i) {\n cur = str[i] & 0xf;\n delta = Math.Abs(cur - dig);\n if (accDist[delta] != 0) {\n if (cur > dig || accDist[delta] == Have(dig, delta, stat)) {\n score += delta;\n --accDist[delta];\n --stat[cur];\n cur = dig;\n } else {\n --stat[cur];\n }\n }\n last[i] = (Char) (cur | 0x30);\n }\n\n return score;\n }\n\n public Fffuuuu() {\n Int32 toChange = Int32.Parse(Console.ReadLine().Split(' ')[1]);\n String str = Console.ReadLine();\n Int32[] stat = new Int32[10];\n for (Int32 i = 0; i < str.Length; ++stat[str[i++] & 0xf]) { }\n\n Int32 best = -1;\n String bestString = String.Empty;\n last = new Char[str.Length];\n for (Int32 one, dig = 0; dig < 10; ++dig) {\n one = Pick(str, dig, (Int32[]) stat.Clone(), toChange);\n if (best < 0 || best > one || (best == one && (new String(last).CompareTo(bestString) < 0))) {\n best = one;\n bestString = new String(last);\n }\n }\n Console.WriteLine(best);\n Console.WriteLine(bestString);\n }\n\n static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"in.txt\"));\n#endif\n new Fffuuuu();\n }\n\n}","description":"A car number in Berland consists of exactly n digits. A number is called beautiful if it has at least k equal digits. Vasya wants to change the digits in his car's number so that the number became beautiful. To replace one of n digits Vasya has to pay the sum of money, equal to the absolute difference between the old digit and the new one.Help Vasya: find the minimum sum of money he should pay to make the number of his car beautiful. You should also find the resulting beautiful number. If there are several such numbers, then print the lexicographically minimum one.","input_specification":"The first line contains two space-separated integers n and k (2\u2009\u2264\u2009n\u2009\u2264\u2009104,\u20092\u2009\u2264\u2009k\u2009\u2264\u2009n) which represent how many digits the number has and how many equal digits a beautiful number should have. The second line consists of n digits. It describes the old number of Vasya's car. It is guaranteed that the number contains no spaces and only contains digits.","output_specification":"On the first line print the minimum sum of money Vasya needs to change the number. On the second line print the car's new number. If there are several solutions, print the lexicographically minimum one.","notes":"NoteIn the first sample replacing the second digit with an \"8\" costs |9\u2009-\u20098|\u2009=\u20091. Replacing the fifth digit with an \"8\" costs the same. Replacing the sixth digit costs |6\u2009-\u20098|\u2009=\u20092. As a result, Vasya will pay 1\u2009+\u20091\u2009+\u20092\u2009=\u20094 for a beautiful number \"888188\".The lexicographical comparison of strings is performed by the < operator in modern programming languages. The string x is lexicographically smaller than the string y, if there exists such i (1\u2009\u2264\u2009i\u2009\u2264\u2009n), that xi\u2009<\u2009yi, and for any j (1\u2009\u2264\u2009j\u2009<\u2009i) xj\u2009=\u2009yj. The strings compared in this problem will always have the length n.","sample_inputs":["6 5\n898196","3 2\n533","10 6\n0001112223"],"sample_outputs":["4\n888188","0\n533","3\n0000002223"],"human_solution":"\ufeffusing System;\nusing System.Text;\n\nclass Fffuuuu {\n\n Char[] last;\n\n Int32 Have(Int32 dig, Int32 delta, Int32[] stat) {\n Int32 have = 0;\n if (dig - delta >= 0) {\n have += stat[dig - delta];\n }\n if (dig + delta < 10) {\n have += stat[dig + delta];\n }\n return have;\n }\n\n Int32 Pick(String str, Int32 dig, Int32[] stat, Int32 toChange) {\n Int32[] accDist = new Int32[10];\n toChange -= stat[dig];\n for (Int32 pick, dist = 1; toChange > 0; ++dist) {\n if (dig - dist >= 0) {\n pick = Math.Min(toChange, stat[dig - dist]);\n accDist[dist] += pick;\n toChange -= pick;\n }\n if (dig + dist < 10) {\n pick = Math.Min(toChange, stat[dig + dist]);\n accDist[dist] += pick;\n toChange -= pick;\n }\n }\n\n Int32 score = 0;\n for (Int32 delta, cur, i = 0; i < str.Length; ++i) {\n cur = str[i] & 0xf;\n delta = Math.Abs(cur - dig);\n if (accDist[delta] != 0) {\n if (cur > dig || accDist[delta] == Have(dig, delta, stat)) {\n score += delta;\n --accDist[delta];\n --stat[cur];\n cur = dig;\n } else {\n --stat[cur];\n }\n }\n last[i] = (Char) (cur | 0x30);\n }\n\n return score;\n }\n\n public Fffuuuu() {\n Int32 toChange = Int32.Parse(Console.ReadLine().Split(' ')[1]);\n String str = Console.ReadLine();\n Int32[] stat = new Int32[10];\n for (Int32 i = 0; i < str.Length; ++stat[str[i++] & 0xf]) { }\n\n Int32 best = -1;\n String bestString = String.Empty;\n last = new Char[str.Length];\n for (Int32 one, dig = 0; dig < 10; ++dig) {\n one = Pick(str, dig, (Int32[]) stat.Clone(), toChange);\n if (best < 0 || best > one || (best == one && (new String(last).CompareTo(bestString) < 0))) {\n best = one;\n bestString = new String(last);\n }\n }\n Console.WriteLine(best);\n Console.WriteLine(bestString);\n }\n\n static void Main() {\n#if DEBUG\n Console.SetIn(new System.IO.StreamReader(\"in.txt\"));\n#endif\n new Fffuuuu();\n }\n\n}","testcases":"[{'input': '6 5\\r\\n898196\\r\\n', 'output': ['4\\r\\n888188\\r\\n']}, {'input': '3 2\\r\\n533\\r\\n', 'output': ['0\\r\\n533\\r\\n']}, {'input': '10 6\\r\\n0001112223\\r\\n', 'output': ['3\\r\\n0000002223\\r\\n']}, {'input': '16 14\\r\\n6124258626539246\\r\\n', 'output': ['22\\r\\n4444448444449444\\r\\n']}, {'input': '45 32\\r\\n293440596342887581257444442930778730382520372\\r\\n', 'output': ['44\\r\\n393333393333883383337333333933778733383333373\\r\\n']}, {'input': '24 5\\r\\n438088068198972282890781\\r\\n', 'output': ['0\\r\\n438088068198972282890781\\r\\n']}, {'input': '16 14\\r\\n6124258626539246\\r\\n', 'output': ['22\\r\\n4444448444449444\\r\\n']}, {'input': '82 80\\r\\n2119762952003918195325258677229419698255491250839396799769357665825441616335532825\\r\\n', 'output': ['184\\r\\n5555555555005555555555555555555555555555555555555555555555555555555555555555555555\\r\\n']}, {'input': '45 32\\r\\n293440596342887581257444442930778730382520372\\r\\n', 'output': ['44\\r\\n393333393333883383337333333933778733383333373\\r\\n']}, {'input': '490 406\\r\\n6937620658350546677982121486389899418322368306416898602098608742746618866398816281683487378363055175834430809130055167725989297432631546167569254739009984031319216325885901155975051308675689263659830423003844586142203356046853592049537849615230121968733935503099047499243659967467210261734604823020656447423321550183799772473757948538911374517796361954090889656392709554559699998961074109288895345641132806900327583681875693131517858168659050373933110409335022047853526996256346106200848216\\r\\n', 'output': ['823\\r\\n6666660666660666666666161666666666616666666606616666606066606666666616666666616661666666666666066166666660606160066166666666666666661666166666666666006666061616616666666601166666061606666666666666660666006666666166606666066666666066666666616660161666666666606066066666666666666666610661666606666060666666666661660166666666666666666666611666616666661666060666666666606666666666666661066106666666666661166606600666666661666666666666666666666060666666660606666066066666666666666666606600666666\\r\\n']}, {'input': '356 339\\r\\n90713123988967376077374685385857243899541739889434281713194182070073947448051066204296405724136030046475387234588789683960244522406704483328080177635790417478469563537849906260100031272024144948352721319113584314778607455620696032294129842532911886401415747087765570443593673103700483651161340044647214751601613569664275752937177165137014927765832674935091\\r\\n', 'output': ['769\\r\\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444944444444444444444444444444444494444444449444444449944444444444444444444944444444449444444444444444444444494444494449444444944444444444444444444444444494444444444444444444444444444444444444444449444444444944444444444444944444444444944494\\r\\n']}, {'input': '156 81\\r\\n154048888528343996517566504808882818609764630684954673234602444413507803713170523618021219782031130705466944034778721589983846786551930214111097548781325421\\r\\n', 'output': ['99\\r\\n144048888448444994414444404808884818409444440484944444444404444414404804414140444418041419784041140704444944044778741489984844784441940414111097448781444441\\r\\n']}, {'input': '100 100\\r\\n1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000\\r\\n', 'output': ['250\\r\\n4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444\\r\\n']}, {'input': '2 2\\r\\n11\\r\\n', 'output': ['0\\r\\n11\\r\\n']}, {'input': '2 2\\r\\n09\\r\\n', 'output': ['9\\r\\n00\\r\\n']}, {'input': '2 2\\r\\n80\\r\\n', 'output': ['8\\r\\n00\\r\\n']}, {'input': '5 2\\r\\n11233\\r\\n', 'output': ['0\\r\\n11233\\r\\n']}, {'input': '5 4\\r\\n11233\\r\\n', 'output': ['3\\r\\n11113\\r\\n']}, {'input': '4 3\\r\\n1335\\r\\n', 'output': ['2\\r\\n1333\\r\\n']}, {'input': '8 4\\r\\n22294777\\r\\n', 'output': ['2\\r\\n22274777\\r\\n']}, {'input': '3 2\\r\\n531\\r\\n', 'output': ['2\\r\\n331\\r\\n']}, {'input': '10 8\\r\\n2222221134\\r\\n', 'output': ['2\\r\\n2222221224\\r\\n']}, {'input': '5 4\\r\\n34445\\r\\n', 'output': ['1\\r\\n34444\\r\\n']}, {'input': '6 5\\r\\n223333\\r\\n', 'output': ['1\\r\\n233333\\r\\n']}, {'input': '8 6\\r\\n88899999\\r\\n', 'output': ['1\\r\\n88999999\\r\\n']}, {'input': '5 4\\r\\n12221\\r\\n', 'output': ['1\\r\\n12222\\r\\n']}, {'input': '200 150\\r\\n34567484444444444444768934769793476984376983476983469347693847683947689347239485723985723452390458290385902385902385285490238459028350934902834908239048590328590234890283459023520354820938590238534533\\r\\n', 'output': ['232\\r\\n44444444444444444444444944449494444944444944444944449444494444444944449444449444444944444444490444490444904444904444444490444449044440944904444904449044490444490444890484449044440444840948490448444444\\r\\n']}, {'input': '5 4\\r\\n21122\\r\\n', 'output': ['1\\r\\n21222\\r\\n']}]","id":291} {"difficulty":1700,"lang":"Mono C#","lang_cluster":"C#","src_uid":"cb47d710361979de0f975cc34fc22c7a","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace B\n{\n class bus\n {\n public int s, t;\n }\n\n class Program\n {\n const int mod = 1000000007;\n static int n, m;\n static bus[] buses;\n static Dictionary mem = new Dictionary();\n static int [] dp;\n static int t;\n\n static int countfrom(int p, int b)\n {\n if (p == t)\n return 1;\n\n if (dp[p] != -1)\n return dp[p];\n \n int ways = 0;\n for (int i = b + 1; i < m; i++)\n {\n if (p >= buses[i].s && p < buses[i].t)\n {\n ways += countfrom(buses[i].t, i);\n ways %= mod;\n }\n }\n\n dp[p] = ways;\n return ways;\n }\n\n static void Main(string[] args)\n {\n string[] line = Console.ReadLine().Split();\n n = int.Parse(line[0]);\n m = int.Parse(line[1]);\n\n buses = new bus[m];\n for (int i = 0; i < m; i++)\n {\n buses[i] = new bus();\n line = Console.ReadLine().Split();\n buses[i].s = int.Parse(line[0]);\n buses[i].t = int.Parse(line[1]);\n }\n\n \n SortedDictionary distinct = new SortedDictionary();\n distinct[0] = 0;\n distinct[n] = 0;\n\n for (int i = 0; i < buses.Length; i++)\n {\n distinct[buses[i].s] = 0;\n distinct[buses[i].t] = 0;\n }\n\n List keys = distinct.Keys.ToList();\n keys.Sort();\n\n int curr = 0;\n for (int i = 0; i < keys.Count; i++)\n distinct[keys[i]] = curr++;\n\n for (int i = 0; i < buses.Length; i++)\n {\n buses[i].s = distinct[buses[i].s];\n buses[i].t = distinct[buses[i].t];\n }\n\n t = distinct[n];\n\n dp = new int[t + 1];\n for (int i = 0; i < dp.Length; i++)\n dp[i] = -1;\n\n Array.Sort(buses, (x, y) => x.t.CompareTo(y.t));\n Console.WriteLine(countfrom(0, -1));\n }\n }\n}\n","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"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.IO;\n\nnamespace Codeforces\n{\n#if _ONLINE_JUDGE_\n\t[OnlineJudge.Task(\"Codeforces 101B\")]\n#endif\n\tclass Task101B\n\t{\n\t\tprivate InputTokenizer input = new InputTokenizer();\n\t\tprivate TextWriter output = Console.Out;\n\n\t\tclass FenwickTree\n\t\t{\n\t\t\tprivate long[] _data;\n\t\t\tprivate int _size;\n\n\t\t\tpublic FenwickTree(int size)\n\t\t\t{\n\t\t\t\t_size = size;\n\t\t\t\t_data = new long[_size];\n\t\t\t}\n\n\t\t\tpublic FenwickTree(IEnumerable values)\n\t\t\t{\n\t\t\t\t_size = values.Count();\n\t\t\t\t_data = new long[_size];\n\n\t\t\t\tint i = 0;\n\t\t\t\tforeach (long x in values) Increment(i++, x);\n\t\t\t}\n\n\t\t\tpublic long Sum(int high)\n\t\t\t{\n\t\t\t\tif (high < 0) return 0;\n\t\t\t\tlong answer = 0;\n\t\t\t\tfor (; high >= 0; high = (high & (high + 1)) - 1)\n\t\t\t\t\tanswer += _data[high];\n\t\t\t\treturn answer;\n\t\t\t}\n\n\t\t\tpublic long Sum(int low, int high)\n\t\t\t{\n\t\t\t\treturn Sum(high) - Sum(low - 1);\n\t\t\t}\n\n\t\t\tpublic void Increment(int index, long increment)\n\t\t\t{\n\t\t\t\tfor (; index < _size; index |= index + 1)\n\t\t\t\t\t_data[index] += increment;\n\t\t\t}\n\t\t}\n\n\t\tstruct T\n\t\t{\n\t\t\tpublic int a, b;\n\t\t}\n\n\t\tprivate void Solve()\n\t\t{\n\t\t\tint n, m;\n\n\t\t\tinput.Line().Read(out n).Read(out m);\n\n\t\t\tvar f = new SortedDictionary();\n\n\t\t\tvar tmp = new T[m];\n\t\t\tfor (int i = 0; i < m; ++i)\n\t\t\t{\n\t\t\t\tinput.Line().Read(out tmp[i].a).Read(out tmp[i].b);\n\t\t\t\tf[tmp[i].a] = 0;\n\t\t\t\tf[tmp[i].b] = 0;\n\t\t\t}\n\n\t\t\tf[0] = 0;\n\t\t\tf[n] = 0;\n\n\t\t\tvar keys = f.Keys.ToArray();\n\t\t\tint g = 0;\n\t\t\tfor (int i = 0; i < keys.Length; ++g) {\n\t\t\t\tf[keys[i]] = g;\n\t\t\t\t++i;\n\t\t\t\twhile (i < keys.Length && keys[i - 1] == keys[i]) ++i;\n\t\t\t}\n\n\t\t\tArray.Sort(tmp, (l, r) => l.b - r.b);\n\n\t\t\tvar ft = new FenwickTree(g);\n\n\t\t\tft.Increment(0, 1);\n\t\t\tfor (int i = 0; i < m; ++i)\n\t\t\t{\n\t\t\t\tft.Increment(f[tmp[i].b], ft.Sum(f[tmp[i].a], f[tmp[i].b] - 1) % 1000000007);\n\t\t\t}\n\n\t\t\toutput.WriteLine(ft.Sum(f[n], f[n]) % 1000000007);\n\t\t}\n\n\t\tpublic static void Main()\n\t\t{\n\t\t\tvar obj = new Task101B();\n\t\t\tobj.Solve();\n\t\t}\n\n\t\t#region\n\t\tprivate class InputTokenizer\n\t\t{\n\t\t\tprivate List _tokens = new List();\n\t\t\tprivate int _offset = 0;\n\n\t\t\tpublic InputTokenizer()\n\t\t\t{\n\t\t\t}\n\n\t\t\tpublic InputTokenizer String(String s)\n\t\t\t{\n\t\t\t\t_tokens.AddRange(s.Split(new char[] { ' ', '\\n', '\\t', '\\r' }, StringSplitOptions.RemoveEmptyEntries));\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Line()\n\t\t\t{\n\t\t\t\treturn String(Console.In.ReadLine());\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out int v)\n\t\t\t{\n\t\t\t\tv = int.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out int[] v)\n\t\t\t{\n\t\t\t\tv = new int[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out long v)\n\t\t\t{\n\t\t\t\tv = long.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out long[] v)\n\t\t\t{\n\t\t\t\tv = new long[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out ulong v)\n\t\t\t{\n\t\t\t\tv = ulong.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out ulong[] v)\n\t\t\t{\n\t\t\t\tv = new ulong[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out double v)\n\t\t\t{\n\t\t\t\tv = double.Parse(_tokens[_offset++]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out double[] v)\n\t\t\t{\n\t\t\t\tv = new double[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(out string v)\n\t\t\t{\n\t\t\t\tv = _tokens[_offset++];\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tpublic InputTokenizer Read(int n, out string[] v)\n\t\t\t{\n\t\t\t\tv = new string[n];\n\t\t\t\tfor (int i = 0; i < n; ++i) Read(out v[i]);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\t#endregion\n\t}\n}\n","testcases":"[{'input': '2 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 5\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 10\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n0 6\\r\\n0 7\\r\\n0 8\\r\\n0 9\\r\\n0 10\\r\\n', 'output': ['512\\r\\n']}, {'input': '6 6\\r\\n3 4\\r\\n2 3\\r\\n3 5\\r\\n0 1\\r\\n1 2\\r\\n3 6\\r\\n', 'output': ['4\\r\\n']}, {'input': '7 7\\r\\n0 1\\r\\n1 3\\r\\n2 3\\r\\n4 6\\r\\n5 7\\r\\n4 5\\r\\n5 7\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '8 8\\r\\n0 1\\r\\n4 5\\r\\n7 8\\r\\n3 4\\r\\n2 3\\r\\n6 7\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 1\\r\\n0 6\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 4\\r\\n0 3\\r\\n1 2\\r\\n4 5\\r\\n4 6\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n', 'output': ['360\\r\\n']}, {'input': '5 3\\r\\n0 1\\r\\n2 3\\r\\n4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n3 4\\r\\n4 5\\r\\n4 5\\r\\n', 'output': ['120\\r\\n']}, {'input': '8 94\\r\\n2 8\\r\\n3 8\\r\\n5 6\\r\\n1 2\\r\\n4 6\\r\\n2 7\\r\\n2 4\\r\\n3 5\\r\\n0 2\\r\\n0 1\\r\\n7 8\\r\\n0 7\\r\\n0 5\\r\\n1 4\\r\\n2 7\\r\\n3 4\\r\\n6 7\\r\\n1 5\\r\\n4 6\\r\\n4 6\\r\\n2 8\\r\\n4 5\\r\\n0 1\\r\\n3 8\\r\\n5 8\\r\\n1 3\\r\\n3 4\\r\\n1 6\\r\\n1 6\\r\\n1 7\\r\\n1 7\\r\\n1 4\\r\\n5 6\\r\\n5 7\\r\\n2 4\\r\\n3 8\\r\\n0 1\\r\\n0 4\\r\\n4 8\\r\\n1 8\\r\\n3 8\\r\\n2 4\\r\\n5 7\\r\\n2 4\\r\\n2 7\\r\\n3 8\\r\\n3 7\\r\\n0 6\\r\\n1 2\\r\\n0 2\\r\\n2 7\\r\\n0 4\\r\\n0 3\\r\\n3 6\\r\\n0 2\\r\\n5 7\\r\\n4 8\\r\\n3 6\\r\\n0 3\\r\\n3 5\\r\\n2 3\\r\\n1 8\\r\\n3 7\\r\\n0 6\\r\\n4 6\\r\\n1 8\\r\\n1 2\\r\\n3 5\\r\\n1 5\\r\\n1 2\\r\\n0 2\\r\\n0 3\\r\\n4 7\\r\\n1 4\\r\\n2 5\\r\\n5 8\\r\\n0 3\\r\\n5 7\\r\\n5 8\\r\\n0 2\\r\\n1 5\\r\\n4 6\\r\\n3 6\\r\\n5 6\\r\\n0 6\\r\\n1 7\\r\\n7 8\\r\\n2 7\\r\\n2 4\\r\\n1 7\\r\\n0 7\\r\\n1 6\\r\\n3 8\\r\\n0 7\\r\\n', 'output': ['203624961\\r\\n']}, {'input': '97 53\\r\\n21 34\\r\\n19 95\\r\\n0 6\\r\\n28 40\\r\\n26 41\\r\\n39 41\\r\\n47 85\\r\\n32 46\\r\\n2 17\\r\\n55 73\\r\\n18 67\\r\\n36 85\\r\\n77 96\\r\\n77 97\\r\\n1 53\\r\\n12 49\\r\\n9 71\\r\\n29 92\\r\\n35 89\\r\\n40 43\\r\\n5 78\\r\\n13 92\\r\\n2 97\\r\\n11 22\\r\\n4 6\\r\\n22 92\\r\\n60 87\\r\\n25 47\\r\\n10 59\\r\\n51 70\\r\\n13 95\\r\\n27 43\\r\\n5 71\\r\\n48 73\\r\\n82 94\\r\\n45 51\\r\\n85 97\\r\\n51 89\\r\\n15 66\\r\\n44 80\\r\\n78 93\\r\\n65 84\\r\\n9 75\\r\\n28 30\\r\\n39 69\\r\\n50 89\\r\\n41 77\\r\\n14 31\\r\\n12 97\\r\\n69 86\\r\\n15 18\\r\\n14 56\\r\\n38 47\\r\\n', 'output': ['478604297\\r\\n']}, {'input': '33 5\\r\\n17 18\\r\\n5 27\\r\\n18 29\\r\\n12 24\\r\\n14 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '93 69\\r\\n9 92\\r\\n31 37\\r\\n58 83\\r\\n28 93\\r\\n36 44\\r\\n22 90\\r\\n61 88\\r\\n76 83\\r\\n19 85\\r\\n25 87\\r\\n55 84\\r\\n45 47\\r\\n5 27\\r\\n54 82\\r\\n4 65\\r\\n12 81\\r\\n49 55\\r\\n16 52\\r\\n16 34\\r\\n34 44\\r\\n17 36\\r\\n62 64\\r\\n7 34\\r\\n19 21\\r\\n16 73\\r\\n3 55\\r\\n12 62\\r\\n49 91\\r\\n2 36\\r\\n47 65\\r\\n17 37\\r\\n70 80\\r\\n52 71\\r\\n59 77\\r\\n1 17\\r\\n23 81\\r\\n15 67\\r\\n38 67\\r\\n14 48\\r\\n70 82\\r\\n33 51\\r\\n31 88\\r\\n28 51\\r\\n10 54\\r\\n6 71\\r\\n37 88\\r\\n5 60\\r\\n2 91\\r\\n88 91\\r\\n30 91\\r\\n17 58\\r\\n12 72\\r\\n14 77\\r\\n34 90\\r\\n15 42\\r\\n44 47\\r\\n54 87\\r\\n84 90\\r\\n3 49\\r\\n26 71\\r\\n40 87\\r\\n71 74\\r\\n20 60\\r\\n86 92\\r\\n76 83\\r\\n40 80\\r\\n3 31\\r\\n18 33\\r\\n5 82\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 59\\r\\n4 7\\r\\n4 8\\r\\n0 4\\r\\n5 7\\r\\n6 9\\r\\n7 8\\r\\n0 9\\r\\n6 7\\r\\n4 9\\r\\n1 10\\r\\n5 6\\r\\n1 4\\r\\n0 4\\r\\n4 9\\r\\n3 6\\r\\n1 7\\r\\n4 9\\r\\n3 7\\r\\n1 2\\r\\n0 1\\r\\n4 7\\r\\n0 8\\r\\n8 10\\r\\n0 3\\r\\n2 5\\r\\n0 7\\r\\n1 8\\r\\n2 10\\r\\n0 3\\r\\n0 9\\r\\n7 8\\r\\n2 6\\r\\n1 6\\r\\n2 10\\r\\n3 10\\r\\n3 4\\r\\n0 2\\r\\n0 8\\r\\n3 8\\r\\n9 10\\r\\n1 6\\r\\n7 10\\r\\n6 9\\r\\n2 10\\r\\n2 10\\r\\n3 5\\r\\n9 10\\r\\n4 10\\r\\n0 8\\r\\n5 9\\r\\n4 6\\r\\n0 10\\r\\n6 9\\r\\n1 2\\r\\n6 7\\r\\n1 5\\r\\n0 6\\r\\n0 7\\r\\n0 6\\r\\n', 'output': ['28167561\\r\\n']}, {'input': '66 35\\r\\n49 55\\r\\n9 30\\r\\n28 54\\r\\n44 62\\r\\n55 61\\r\\n1 21\\r\\n6 37\\r\\n8 10\\r\\n26 33\\r\\n19 37\\r\\n12 23\\r\\n24 42\\r\\n34 64\\r\\n8 56\\r\\n36 40\\r\\n16 58\\r\\n21 30\\r\\n16 36\\r\\n36 38\\r\\n19 45\\r\\n26 49\\r\\n6 62\\r\\n1 11\\r\\n22 48\\r\\n33 38\\r\\n8 41\\r\\n29 53\\r\\n58 60\\r\\n27 66\\r\\n2 19\\r\\n48 53\\r\\n25 47\\r\\n48 56\\r\\n61 65\\r\\n45 46\\r\\n', 'output': ['0\\r\\n']}, {'input': '31 26\\r\\n15 21\\r\\n4 25\\r\\n5 19\\r\\n16 18\\r\\n5 23\\r\\n3 25\\r\\n7 18\\r\\n24 31\\r\\n6 9\\r\\n8 25\\r\\n18 29\\r\\n12 27\\r\\n15 16\\r\\n12 20\\r\\n2 7\\r\\n14 26\\r\\n13 22\\r\\n5 19\\r\\n5 24\\r\\n15 23\\r\\n4 7\\r\\n8 12\\r\\n14 26\\r\\n28 30\\r\\n1 30\\r\\n24 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '69 68\\r\\n49 62\\r\\n3 38\\r\\n1 43\\r\\n42 58\\r\\n12 64\\r\\n1 37\\r\\n35 59\\r\\n7 43\\r\\n2 29\\r\\n8 65\\r\\n19 47\\r\\n4 27\\r\\n41 58\\r\\n25 60\\r\\n17 37\\r\\n34 40\\r\\n16 38\\r\\n28 52\\r\\n35 63\\r\\n6 65\\r\\n57 58\\r\\n38 50\\r\\n8 28\\r\\n6 8\\r\\n10 44\\r\\n48 63\\r\\n2 42\\r\\n46 58\\r\\n26 62\\r\\n37 45\\r\\n7 22\\r\\n0 21\\r\\n19 48\\r\\n6 67\\r\\n6 15\\r\\n28 38\\r\\n19 22\\r\\n16 20\\r\\n27 40\\r\\n0 3\\r\\n33 69\\r\\n2 66\\r\\n10 24\\r\\n29 48\\r\\n26 69\\r\\n15 53\\r\\n24 34\\r\\n34 58\\r\\n20 47\\r\\n21 23\\r\\n38 68\\r\\n34 45\\r\\n60 68\\r\\n7 15\\r\\n21 34\\r\\n16 30\\r\\n14 58\\r\\n2 62\\r\\n24 66\\r\\n13 27\\r\\n24 40\\r\\n32 37\\r\\n10 37\\r\\n22 40\\r\\n44 50\\r\\n27 31\\r\\n0 44\\r\\n20 32\\r\\n', 'output': ['622740890\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '68 74\\r\\n51 54\\r\\n3 22\\r\\n12 24\\r\\n3 27\\r\\n32 42\\r\\n36 55\\r\\n60 64\\r\\n1 4\\r\\n4 23\\r\\n11 64\\r\\n54 62\\r\\n50 56\\r\\n21 34\\r\\n27 63\\r\\n15 54\\r\\n28 61\\r\\n13 57\\r\\n39 53\\r\\n12 32\\r\\n32 40\\r\\n33 67\\r\\n55 61\\r\\n33 67\\r\\n30 37\\r\\n15 49\\r\\n27 45\\r\\n21 41\\r\\n8 42\\r\\n24 63\\r\\n40 48\\r\\n28 41\\r\\n30 67\\r\\n0 4\\r\\n7 15\\r\\n27 59\\r\\n60 62\\r\\n25 65\\r\\n30 31\\r\\n38 67\\r\\n24 43\\r\\n14 64\\r\\n26 46\\r\\n8 12\\r\\n34 41\\r\\n32 67\\r\\n11 42\\r\\n11 53\\r\\n45 55\\r\\n2 47\\r\\n7 51\\r\\n30 54\\r\\n21 44\\r\\n7 52\\r\\n40 62\\r\\n16 50\\r\\n10 41\\r\\n26 65\\r\\n16 51\\r\\n6 29\\r\\n1 31\\r\\n48 54\\r\\n9 42\\r\\n33 45\\r\\n19 59\\r\\n25 37\\r\\n21 62\\r\\n20 58\\r\\n23 59\\r\\n12 61\\r\\n2 46\\r\\n19 49\\r\\n44 60\\r\\n1 20\\r\\n19 66\\r\\n', 'output': ['0\\r\\n']}, {'input': '79 68\\r\\n26 47\\r\\n55 70\\r\\n5 40\\r\\n7 45\\r\\n16 21\\r\\n31 38\\r\\n19 62\\r\\n40 55\\r\\n42 78\\r\\n60 61\\r\\n43 69\\r\\n50 73\\r\\n3 77\\r\\n2 45\\r\\n2 29\\r\\n10 58\\r\\n2 11\\r\\n62 76\\r\\n57 70\\r\\n65 73\\r\\n37 67\\r\\n9 24\\r\\n4 28\\r\\n8 16\\r\\n31 44\\r\\n10 66\\r\\n47 70\\r\\n19 45\\r\\n17 28\\r\\n5 36\\r\\n9 68\\r\\n2 35\\r\\n55 77\\r\\n51 71\\r\\n1 59\\r\\n6 33\\r\\n21 53\\r\\n39 49\\r\\n59 70\\r\\n17 44\\r\\n18 64\\r\\n49 78\\r\\n0 52\\r\\n24 56\\r\\n65 79\\r\\n19 51\\r\\n42 77\\r\\n37 78\\r\\n20 39\\r\\n47 56\\r\\n19 78\\r\\n50 78\\r\\n3 67\\r\\n37 47\\r\\n5 27\\r\\n40 51\\r\\n24 29\\r\\n50 54\\r\\n45 50\\r\\n13 76\\r\\n29 31\\r\\n0 28\\r\\n26 36\\r\\n21 44\\r\\n71 77\\r\\n55 58\\r\\n38 61\\r\\n22 44\\r\\n', 'output': ['317376853\\r\\n']}, {'input': '45 51\\r\\n2 12\\r\\n6 18\\r\\n4 17\\r\\n8 25\\r\\n16 24\\r\\n3 23\\r\\n29 31\\r\\n31 40\\r\\n7 26\\r\\n5 6\\r\\n35 37\\r\\n1 36\\r\\n9 45\\r\\n18 36\\r\\n12 27\\r\\n5 15\\r\\n11 16\\r\\n19 29\\r\\n8 23\\r\\n1 27\\r\\n0 30\\r\\n25 38\\r\\n21 44\\r\\n34 39\\r\\n10 41\\r\\n4 16\\r\\n11 36\\r\\n0 8\\r\\n15 38\\r\\n3 33\\r\\n11 31\\r\\n2 33\\r\\n5 34\\r\\n24 28\\r\\n7 32\\r\\n15 25\\r\\n2 27\\r\\n16 44\\r\\n31 40\\r\\n35 45\\r\\n13 38\\r\\n29 42\\r\\n18 23\\r\\n8 25\\r\\n13 21\\r\\n3 39\\r\\n3 41\\r\\n5 6\\r\\n13 21\\r\\n11 20\\r\\n23 42\\r\\n', 'output': ['493168232\\r\\n']}, {'input': '5 31\\r\\n0 2\\r\\n3 4\\r\\n3 5\\r\\n2 4\\r\\n1 3\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n0 2\\r\\n2 5\\r\\n1 4\\r\\n0 2\\r\\n1 3\\r\\n0 5\\r\\n2 3\\r\\n1 5\\r\\n1 2\\r\\n2 3\\r\\n0 1\\r\\n0 1\\r\\n2 4\\r\\n0 4\\r\\n1 2\\r\\n0 3\\r\\n1 2\\r\\n3 4\\r\\n0 2\\r\\n0 4\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n', 'output': ['8595\\r\\n']}, {'input': '81 52\\r\\n33 48\\r\\n59 61\\r\\n37 77\\r\\n58 73\\r\\n29 54\\r\\n1 17\\r\\n8 29\\r\\n50 73\\r\\n7 26\\r\\n35 41\\r\\n22 26\\r\\n9 22\\r\\n0 11\\r\\n40 73\\r\\n25 57\\r\\n35 55\\r\\n36 54\\r\\n29 41\\r\\n56 66\\r\\n42 77\\r\\n29 48\\r\\n41 66\\r\\n25 36\\r\\n2 55\\r\\n58 64\\r\\n0 61\\r\\n23 31\\r\\n9 61\\r\\n27 45\\r\\n2 71\\r\\n14 29\\r\\n4 31\\r\\n0 35\\r\\n31 77\\r\\n21 39\\r\\n0 54\\r\\n46 68\\r\\n18 62\\r\\n41 45\\r\\n12 28\\r\\n59 66\\r\\n39 71\\r\\n10 59\\r\\n29 77\\r\\n16 48\\r\\n13 46\\r\\n30 73\\r\\n2 41\\r\\n42 55\\r\\n19 61\\r\\n28 29\\r\\n20 42\\r\\n', 'output': ['0\\r\\n']}, {'input': '84 50\\r\\n33 46\\r\\n19 40\\r\\n51 64\\r\\n37 45\\r\\n35 81\\r\\n44 81\\r\\n6 57\\r\\n57 60\\r\\n14 53\\r\\n15 49\\r\\n4 30\\r\\n35 49\\r\\n2 51\\r\\n8 72\\r\\n15 18\\r\\n49 51\\r\\n14 49\\r\\n50 71\\r\\n41 59\\r\\n28 60\\r\\n61 81\\r\\n9 12\\r\\n34 79\\r\\n5 56\\r\\n60 67\\r\\n21 60\\r\\n39 71\\r\\n31 60\\r\\n13 35\\r\\n16 84\\r\\n17 33\\r\\n48 57\\r\\n36 61\\r\\n50 55\\r\\n5 84\\r\\n66 79\\r\\n61 70\\r\\n42 49\\r\\n19 39\\r\\n47 49\\r\\n3 82\\r\\n59 65\\r\\n8 44\\r\\n71 80\\r\\n66 77\\r\\n8 65\\r\\n1 81\\r\\n7 82\\r\\n50 74\\r\\n10 17\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 68\\r\\n77 89\\r\\n19 71\\r\\n11 46\\r\\n23 70\\r\\n16 47\\r\\n4 61\\r\\n7 96\\r\\n38 74\\r\\n79 95\\r\\n68 75\\r\\n14 86\\r\\n10 55\\r\\n7 13\\r\\n88 99\\r\\n19 21\\r\\n4 94\\r\\n17 83\\r\\n11 16\\r\\n7 50\\r\\n58 96\\r\\n4 58\\r\\n17 72\\r\\n44 56\\r\\n35 91\\r\\n50 88\\r\\n9 37\\r\\n36 52\\r\\n83 89\\r\\n8 16\\r\\n1 80\\r\\n12 75\\r\\n3 27\\r\\n92 93\\r\\n53 88\\r\\n37 49\\r\\n34 78\\r\\n31 66\\r\\n39 55\\r\\n36 94\\r\\n22 67\\r\\n47 85\\r\\n20 58\\r\\n62 98\\r\\n41 89\\r\\n85 96\\r\\n11 73\\r\\n39 95\\r\\n44 68\\r\\n25 33\\r\\n36 45\\r\\n66 70\\r\\n66 93\\r\\n17 97\\r\\n1 71\\r\\n49 53\\r\\n47 54\\r\\n19 95\\r\\n10 12\\r\\n38 57\\r\\n47 68\\r\\n21 70\\r\\n32 93\\r\\n53 71\\r\\n45 59\\r\\n27 48\\r\\n47 63\\r\\n75 76\\r\\n8 57\\r\\n', 'output': ['0\\r\\n']}, {'input': '918949684 6\\r\\n351553415 785588657\\r\\n423490842 845475457\\r\\n351553415 918949684\\r\\n740298829 785588657\\r\\n351328841 610486484\\r\\n423490842 847590951\\r\\n', 'output': ['0\\r\\n']}, {'input': '863261873 5\\r\\n137690029 666186924\\r\\n137690029 379800754\\r\\n515537329 666186924\\r\\n442925959 722302912\\r\\n137690029 863261873\\r\\n', 'output': ['0\\r\\n']}, {'input': '735324925 2\\r\\n642054038 735324925\\r\\n170935185 642054038\\r\\n', 'output': ['0\\r\\n']}, {'input': '977743286 6\\r\\n317778866 395496218\\r\\n395496218 932112884\\r\\n98371691 432544933\\r\\n440553 922085291\\r\\n440553 432544933\\r\\n586988624 922085291\\r\\n', 'output': ['0\\r\\n']}, {'input': '977700285 7\\r\\n386643627 467079072\\r\\n116215943 914856211\\r\\n15183537 386643627\\r\\n424146511 977700285\\r\\n15183537 620050423\\r\\n336304090 947990602\\r\\n116215943 914856211\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '814609521 3\\r\\n622460875 697824636\\r\\n283825432 369448402\\r\\n614658965 622460875\\r\\n', 'output': ['0\\r\\n']}, {'input': '931612300 8\\r\\n64655010 186892167\\r\\n25283092 580196656\\r\\n297609123 628681221\\r\\n25283092 186892167\\r\\n186892167 221075230\\r\\n221075230 634105512\\r\\n25283092 156293949\\r\\n86333513 156293949\\r\\n', 'output': ['0\\r\\n']}, {'input': '947714605 4\\r\\n23890708 35992029\\r\\n35992029 947714605\\r\\n93644635 629491402\\r\\n23890708 947714605\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 2\\r\\n0 500000000\\r\\n500000000 1000000000\\r\\n', 'output': ['1\\r\\n']}]","id":292} {"difficulty":2200,"lang":"MS C#","lang_cluster":"C#","src_uid":"ce5cc8512359701696dba1b254c6afda","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeff#if DEBUG\nusing System.Reflection;\nusing System.Threading.Tasks;\n#endif\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Numerics;\nusing System.Globalization;\n\n\nnamespace b11d\n{\n class Program\n {\n static string _inputFilename = \"input.txt\";\n static string _outputFilename = \"output.txt\";\n static bool _useFileInput = false;\n\n\n static void Main(string[] args)\n {\n StreamWriter file = null;\n#if DEBUG\n\t\t\tConsole.SetIn(getInput());\n#else\n if (_useFileInput)\n {\n Console.SetIn(File.OpenText(_inputFilename));\n file = new StreamWriter(_outputFilename);\n Console.SetOut(file);\n }\n#endif\n\n try\n {\n solution();\n }\n finally\n {\n if (_useFileInput)\n {\n file.Close();\n }\n }\n }\n\n static void solution()\n {\n #region SOLUTION\n var d = readIntArray();\n var n = d[0];\n var m = d[1];\n var g = new List[n];\n for (int i = 0; i < n; i++)\n {\n g[i] = new List();\n }\n\n for (int i = 0; i < m; i++)\n {\n d = readIntArray();\n var from = d[0] - 1;\n var to = d[1] - 1;\n g[from].Add(to);\n g[to].Add(from);\n }\n\n var max = 0;\n for (int i = 0; i < n; i++)\n {\n max |= 1 << i;\n }\n\n var dp = new int[max + 1, n + 1];\n for (int i = 0; i < max + 1; i++)\n {\n for (int j = 0; j < n + 1; j++)\n {\n dp[i, j] = 0;\n }\n }\n\n for (int i = 0; i < n; i++)\n {\n var mask = 1 << i;\n dp[mask, i] = 1;\n }\n\n for (int i = 1; i < max + 1; i++)\n {\n var f = true;\n for (int j = n - 1; j >= 0; j--)\n {\n var val = (i & (1 << j)) != 0;\n if (!val)\n {\n continue;\n }\n\n if (f)\n {\n f = false;\n continue;\n }\n\n var msk = 1 << j;\n var wth = i ^ msk;\n var ps = g[j];\n foreach (var p in ps)\n {\n if ((wth & (1 << p)) != 0)\n {\n var val1 = dp[wth, p];\n dp[i, j] += val1;\n \/\/if (val1 != -1)\n \/\/{\n \/\/ if (dp[i, j] == -1)\n \/\/ {\n \/\/ dp[i, j] = 0;\n \/\/ }\n\n \n \/\/}\n }\n }\n }\n }\n\n var tc = 0;\n for (int i = 1; i < max + 1; i++)\n {\n var count = 0;\n var first = -1;\n for (int j = n - 1; j >= 0; j--)\n {\n if ((i & (1 << j)) != 0)\n {\n count++;\n if (first == -1)\n {\n first = j;\n }\n }\n }\n\n if (count < 3)\n {\n continue;\n }\n\n var gs = g[first];\n for (int j = n - 1; j >= 0; j--)\n {\n if ((i & (1 << j)) == 0)\n {\n continue;\n }\n\n if (j == first)\n {\n continue;\n }\n\n foreach (var ps in gs)\n {\n if (ps == j)\n {\n \/\/if (dp[i, j] == -1)\n \/\/{\n \/\/ throw new InvalidOperationException();\n \/\/}\n\n tc += dp[i, j];\n }\n }\n }\n }\n\n Console.WriteLine(tc \/ 2);\n\n \/\/var n = readInt();\n \/\/var m = readInt();\n\n \/\/var a = readIntArray();\n \/\/var b = readIntArray();\n #endregion\n }\n\n static int readInt()\n {\n return int.Parse(Console.ReadLine());\n }\n\n static long readLong()\n {\n return long.Parse(Console.ReadLine());\n }\n\n static int[] readIntArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();\n }\n\n static long[] readLongArray()\n {\n return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();\n }\n\n#if DEBUG\n\t\tstatic StreamReader getInput()\n\t\t{\n\t\t\tvar resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];\n\t\t\tvar resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);\n\n\t\t\treturn new StreamReader(resource);\n\t\t}\n#endif\n }\n}\n","description":"Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.","input_specification":"The first line of input contains two integers n and m (1\u2009\u2264\u2009n\u2009\u2264\u200919, 0\u2009\u2264\u2009m) \u2013 respectively the number of vertices and edges of the graph. Each of the subsequent m lines contains two integers a and b, (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n, a\u2009\u2260\u2009b) indicating that vertices a and b are connected by an undirected edge. There is no more than one edge connecting any pair of vertices.","output_specification":"Output the number of cycles in the given graph.","notes":"NoteThe example graph is a clique and contains four cycles of length 3 and three cycles of length 4.","sample_inputs":["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"],"sample_outputs":["7"],"human_solution":"\ufeffusing System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\n\n\nclass Program\n{\n\n void solve()\n {\n int n = nextInt();\n bool[,] g = new bool[n, n];\n int m = nextInt();\n for (int i = 0; i < m; i++)\n {\n int a = nextInt();\n int b = nextInt();\n a--;\n b--;\n g[a, b] = g[b, a] = true;\n\n }\n long ret = 0;\n for (int f = 0; f < n; f++)\n {\n long[,] dp = new long[f, 1 < 0)\n for (int j = 0; j < f; j++)\n if ((set & (1 << j)) > 0 && g[i, j])\n dp[i, set] += dp[j, set ^ (1 << i)];\n for(int i=0;i 0 && (set!=1<= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = -sign;\n c = Read();\n }\n int len = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = checked(res * 10 - c);\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return checked(res * sign);\n }\n\n public long ReadLong()\n {\n long res = 0;\n int sign = -1;\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n if (c == '-')\n {\n sign = -sign;\n c = Read();\n }\n int len = 0;\n checked\n {\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n if ((uint)(c -= 48) >= 10) throw new InvalidDataException();\n len++;\n res = res * 10 - c;\n c = Read();\n }\n if (len == 0) throw new InvalidDataException();\n Back();\n return res * sign;\n }\n }\n\n public double ReadDouble()\n {\n int c;\n do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));\n\n int sign = 1;\n if (c == '-')\n {\n sign = -1;\n c = Read();\n }\n\n sb.Length = 0;\n while (c >= 0 && !char.IsWhiteSpace((char)c))\n {\n sb.Append((char)c);\n c = Read();\n }\n\n Back();\n double res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);\n return res * sign;\n }\n\n public string ReadLine()\n {\n int c = Read();\n sb.Length = 0;\n while (c != -1 && c != 13 && c != 10)\n {\n sb.Append((char)c);\n c = Read();\n }\n if (c == 13)\n {\n c = Read();\n if (c != 10) Back();\n }\n return sb.ToString();\n }\n\n public bool EOF\n {\n get\n {\n if (Read() == -1) return true;\n Back();\n return false;\n }\n }\n\n public bool SeekEOF\n {\n get\n {\n L0:\n int c = Read();\n if (c == -1) return true;\n if (char.IsWhiteSpace((char)c)) goto L0;\n Back();\n return false;\n }\n }\n }\n\n static void pe()\n {\n Console.WriteLine(\"???\");\n Environment.Exit(0);\n }\n\n static void re()\n {\n Environment.Exit(55);\n }\n\n static int nosol()\n {\n Console.WriteLine(\"ERROR\");\n return 0;\n }\n\n static Stopwatch sw = Stopwatch.StartNew();\n\n static StringBuilder sb = new StringBuilder();\n static Random rand = new Random(52345235);\n\n static void Swap(ref T a, ref T b)\n {\n T t = a;\n a = b;\n b = t;\n }\n const double PI = Math.PI;\n const double PI2 = PI * 2;\n\n public struct PointD\n {\n public double X, Y;\n\n public const double eps = 1e-8;\n\n public override string ToString()\n {\n return string.Format(\"{0} : {1}\", X, Y);\n }\n\n public string ToString(string format)\n {\n return X.ToString(format, CultureInfo.InvariantCulture) + \" \" + Y.ToString(format, CultureInfo.InvariantCulture);\n }\n\n public PointD(double x, double y) { X = x; Y = y; }\n\n public PointD(Program.Parser parser) : this(parser.ReadDouble(), parser.ReadDouble()) { }\n\n \/\/\/ Rotates point clockwise<\/summary>\n public PointD Rotate(double angle)\n {\n double cos = Math.Cos(angle);\n double sin = -Math.Sin(angle);\n return new PointD(X * cos - Y * sin, X * sin + Y * cos);\n }\n\n public override bool Equals(object obj)\n {\n if (obj is PointD)\n {\n PointD otherD = (PointD)obj;\n return Math.Abs(otherD.X - X) + Math.Abs(otherD.Y - Y) < eps;\n }\n return false;\n }\n\n public override int GetHashCode()\n {\n throw new NotSupportedException();\n \/\/return X.GetHashCode() ^ Y.GetHashCode();\n }\n\n public static PointD operator +(PointD p1, PointD p2) { return new PointD(p1.X + p2.X, p1.Y + p2.Y); }\n public static PointD operator -(PointD p1, PointD p2) { return new PointD(p1.X - p2.X, p1.Y - p2.Y); }\n public PointD Add(double dx, double dy) { return new PointD(X + dx, Y + dy); }\n\n public double Atan2 { get { return Math.Atan2(Y, X); } }\n\n public double Dist2() { return X * X + Y * Y; }\n }\n\n public struct VectorD\n {\n public const double eps = 1e-12;\n public double X, Y;\n\n public override string ToString()\n {\n return string.Format(\"{0} : {1}\", X, Y);\n }\n\n public bool Equals(VectorD other)\n {\n return Math.Abs(X - other.X) + Math.Abs(Y - other.Y) < eps;\n }\n\n public VectorD(double x, double y)\n {\n X = x; Y = y;\n }\n\n public VectorD(PointD start, PointD end)\n {\n X = end.X - start.X;\n Y = end.Y - start.Y;\n }\n\n public static double operator *(VectorD v1, VectorD v2)\n {\n return (v1.Y * v2.X - v1.X * v2.Y);\n }\n\n public static double ScalarProduct(VectorD v1, VectorD v2)\n {\n return (v1.X * v2.X + v1.Y * v2.Y);\n }\n\n public double Length { get { return Math.Sqrt(X * X + Y * Y); } }\n public double Length2 { get { return (X * X + Y * Y); } }\n\n \/\/\/ \n \/\/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u0433\u043e\u043b (-pi;pi], \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u043f\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c v1 \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u0432\u043f\u0430\u043b \u0441 v2. \n \/\/\/ <\/summary>\n public static double Angle(VectorD v1, VectorD v2)\n {\n double sin = v1 * v2;\n double cos = ScalarProduct(v1, v2);\n\n if (sin > eps)\n {\n if (cos > eps) return Math.Atan(sin \/ cos);\n else if (cos < -eps) return PI + Math.Atan(sin \/ cos);\n else return PI \/ 2;\n }\n else if (sin < -eps)\n {\n if (cos > eps) return Math.Atan(sin \/ cos);\n else if (cos < -eps) return PI + Math.Atan(sin \/ cos);\n else return -PI \/ 2;\n }\n else\n {\n if (cos > eps) return 0;\n else if (cos < -eps) return PI;\n else throw new Exception(\"zero vector\");\n }\n }\n }\n\n public static class ConvexHull\n {\n \/\/ Notes:\n \/\/ pts is not affected.\n \/\/ PointD[] can be any indexable type.\n \/\/ \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0432\u044b\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.\n\n static int[] p;\n static PointD[] pts;\n static double[] a;\n\n class PointComparer : IComparer\n {\n public int Compare(int p1, int p2)\n {\n double da = a[p1] - a[p2];\n if (Math.Abs(da) > 1e-9) return Math.Sign(da);\n return Math.Sign(pts[p1].Dist2() - pts[p2].Dist2());\n }\n }\n\n public static List Do(PointD[] pts)\n {\n List ch = new List();\n if (pts.Length == 0) return ch;\n\n ConvexHull.pts = pts;\n p = new int[pts.Length];\n for (int i = 0; i < pts.Length; i++) p[i] = i;\n\n int m = 0;\n for (int i = 1; i < pts.Length; i++)\n if (pts[i].Y < pts[m].Y || pts[i].Y == pts[m].Y && pts[i].X < pts[m].X)\n m = i;\n p[0] = m; p[m] = 0;\n\n a = new double[pts.Length];\n for (int i = 1; i < pts.Length; i++) a[p[i]] = (pts[p[i]] - pts[m]).Atan2;\n\n Array.Sort(p, 1, pts.Length - 1, new PointComparer());\n\n \/\/ \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0442\u043e\u0447\u043a\u0438 m.\n int j;\n for (j = 1; j < pts.Length - 1; j++)\n if (pts[p[j]].Dist2() == 0) p[j] = -1;\n else break;\n\n \/\/ \"\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u043a \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0443\u0433\u043b\u043e\u043c, \u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u0443\u044e \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e.\"\n \/\/ \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u043c\u0441\u044f \u043e\u0442 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432.\n for (; j < pts.Length - 1; j++)\n if (Math.Abs(a[p[j + 1]] - a[p[j]]) < 1e-9)\n p[j] = -1;\n\n ch.Add(p[0]);\n j = 1;\n while (ch.Count < 3)\n {\n if (j == p.Length) return ch;\n if (p[j++] >= 0) ch.Add(p[j - 1]);\n }\n\n for (; j < p.Length; j++)\n {\n while (j < p.Length && p[j] < 0) j++;\n if (j == pts.Length) return ch; \/\/ \u0432\u0440\u043e\u0434\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c\n\n while (true)\n {\n PointD p1 = pts[ch[ch.Count - 2]];\n PointD p2 = pts[ch[ch.Count - 1]];\n PointD p3 = pts[p[j]];\n var v12 = new VectorD(p2, p1);\n var v23 = new VectorD(p3, p2);\n if (v12 * v23 < 0) break;\n\n ch.RemoveAt(ch.Count - 1);\n }\n ch.Add(p[j]);\n }\n\n return ch;\n }\n\n public static void test()\n {\n List pts = new List();\n pts.Add(new PointD(1, 1));\n pts.Add(new PointD(0, 0));\n pts.Add(new PointD(2, 2));\n pts.Add(new PointD(10, 0));\n var ch = Do(pts.ToArray());\n var chpts = new List();\n foreach (var p in ch)\n chpts.Add(pts[p]);\n }\n }\n\n static int Main(string[] args)\n {\n Geometry.ConvexHull.test();\n\n \/\/Console.SetIn(File.OpenText(\"_input\"));\n Parser parser = new Parser();\n\n int n = parser.ReadInt();\n PointD[] pts = new PointD[n * 4];\n for (int i = 0; i < n; i++)\n {\n PointD p = new PointD(parser);\n pts[i * 4] = p.Add(1, 0);\n pts[i * 4 + 1] = p.Add(-1, 0);\n pts[i * 4 + 2] = p.Add(0, 1);\n pts[i * 4 + 3] = p.Add(0, -1);\n }\n\n\n var ch = ConvexHull.Do(pts);\n int res = 0;\n for (int i = 0; i < ch.Count; i++)\n {\n int j = (i + 1) % ch.Count;\n res += Math.Max(\n Math.Abs((int)(pts[ch[j]].X - pts[ch[i]].X)),\n Math.Abs((int)(pts[ch[j]].Y - pts[ch[i]].Y)));\n }\n\n Console.WriteLine(res);\n return 0;\n }\n }\n}","description":"The Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be chased off them. For that a young player Vasya decided to make the shepherd run round the cows along one and the same closed path. It is very important that the cows stayed strictly inside the area limited by the path, as otherwise some cows will sooner or later be eaten. To be absolutely sure in the cows' safety, Vasya wants the path completion time to be minimum.The new game is launched for different devices, including mobile phones. That's why the developers decided to quit using the arithmetics with the floating decimal point and use only the arithmetics of integers. The cows and the shepherd in the game are represented as points on the plane with integer coordinates. The playing time is modeled by the turns. During every turn the shepherd can either stay where he stands or step in one of eight directions: horizontally, vertically, or diagonally. As the coordinates should always remain integer, then the length of a horizontal and vertical step is equal to 1, and the length of a diagonal step is equal to . The cows do not move. You have to minimize the number of moves the shepherd needs to run round the whole herd.","input_specification":"The first line contains an integer N which represents the number of cows in the herd (1\u2009\u2264\u2009N\u2009\u2264\u2009105). Each of the next N lines contains two integers Xi and Yi which represent the coordinates of one cow of (|Xi|,\u2009|Yi|\u2009\u2264\u2009106). Several cows can stand on one point.","output_specification":"Print the single number \u2014 the minimum number of moves in the sought path.","notes":"NotePicture for the example test: The coordinate grid is painted grey, the coordinates axes are painted black, the cows are painted red and the sought route is painted green. ","sample_inputs":["4\n1 1\n5 1\n5 3\n1 3"],"sample_outputs":["16"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace ProgrammingContest.Codeforces.Round47\n{\n class C\n {\n static bool LeftRotate(Pair[] ps, int len)\n {\n int i = len - 2;\n long x1 = ps[i - 1].first, x2 = ps[i].first, x3 = ps[i + 1].first,\n y1 = ps[i-1].second, y2 = ps[i].second, y3 = ps[i+1].second;\n long cp = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);\n return cp >= 0;\n }\n\n static Pair[] ConvexHull(Pair[] ps)\n {\n if(ps.Length < 3) return ps;\n int ul = 0;\n Pair[] upper = new Pair[ps.Length];\n upper[ul++] = ps[0]; upper[ul++] = ps[1];\n for (int i = 2; i < ps.Length; i++)\n {\n upper[ul++] = ps[i];\n while (ul >= 3 && LeftRotate(upper, ul))\n {\n upper[ul - 2] = upper[ul - 1];\n ul--;\n }\n }\n\n int ll = 0;\n var lower = new Pair[ps.Length];\n lower[ll++] = ps[ps.Length - 1]; lower[ll++] = ps[ps.Length - 2];\n for (int i = ps.Length-3; i >= 0; i--)\n {\n lower[ll++] = ps[i];\n while (ll >= 3 && LeftRotate(lower, ll))\n {\n lower[ll-2] = lower[ll-1];\n ll--;\n }\n }\n Pair[] res = new Pair[ul + ll - 2];\n int p = 0;\n for (int i = 0; i < ul; i++) res[p++] = upper[i];\n for (int i = 1; i < ll - 1; i++) res[p++] = lower[i];\n return res;\n }\n\n public static void Main()\n {\n int n = int.Parse(Console.ReadLine());\n var ps = new Pair[n];\n for (int i = 0; i < n; i++)\n {\n int[] xy = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();\n ps[i].first = xy[0];\n ps[i].second = xy[1];\n }\n\n Array.Sort(ps);\n var ps2 = ConvexHull(ps);\n#if false\n Console.WriteLine();\n for (int i = 0; i < ps2.Length; i++)\n Console.WriteLine(\"{0} {1}\", ps2[i].first, ps2[i].second);\n#endif\n long[] dx = new long[] { 0, 0, -1, 1 }, dy = new long[] { -1, 1, 0, 0 };\n var ps3 = new Pair[ps2.Length * 4];\n for (int i = 0; i < ps2.Length; i++)\n for (int j = 0; j < 4; j++)\n {\n ps3[i * 4 + j].first = ps2[i].first + dx[j];\n ps3[i * 4 + j].second = ps2[i].second + dy[j];\n }\n\n Array.Sort(ps3);\n var ps4 = ConvexHull(ps3);\n\n long res = 0;\n for (int i = 0, m = ps4.Length; i < m; i++)\n {\n long dx_ = Math.Abs(ps4[i].first - ps4[(i + 1) % m].first),\n dy_ = Math.Abs(ps4[i].second - ps4[(i + 1) % m].second);\n res += Math.Max(dx_, dy_);\n }\n Console.WriteLine(res);\n }\n\n #region Pair\n public static class Pair\n {\n public static Pair Create(T1 t1, T2 t2)\n where T1 : IComparable, IEquatable\n where T2 : IComparable, IEquatable\n {\n return new Pair(t1, t2);\n }\n }\n\n public struct Pair : IComparable>\n where T1 : IComparable, IEquatable\n where T2 : IComparable, IEquatable\n {\n public T1 first;\n public T2 second;\n\n public Pair(T1 t1, T2 t2)\n {\n first = t1;\n second = t2;\n }\n\n public static bool operator <(Pair lhs, Pair rhs)\n {\n int comp = lhs.first.CompareTo(rhs.first);\n if (comp < 0 || comp == 0 && lhs.second.CompareTo(rhs.second) < 0) return true;\n return false;\n }\n\n public static bool operator >(Pair lhs, Pair rhs)\n {\n return !(lhs < rhs || lhs == rhs);\n }\n\n public static bool operator ==(Pair lhs, Pair rhs)\n {\n return lhs.first.Equals(rhs.first) && lhs.second.Equals(rhs.second);\n }\n\n public static bool operator !=(Pair lhs, Pair rhs)\n {\n return !(lhs == rhs);\n }\n\n public int CompareTo(Pair p)\n {\n if (this < p) return -1;\n if (this > p) return 1;\n return 0;\n }\n\n public override bool Equals(object obj)\n {\n return base.Equals(obj);\n }\n public override int GetHashCode()\n {\n return base.GetHashCode();\n }\n }\n #endregion\n }\n}\n","testcases":"[{'input': '4\\r\\n1 1\\r\\n5 1\\r\\n5 3\\r\\n1 3\\r\\n', 'output': ['16\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n5 0\\r\\n0 5\\r\\n', 'output': ['19\\r\\n']}, {'input': '5\\r\\n0 0\\r\\n7 7\\r\\n7 5\\r\\n5 7\\r\\n1 1\\r\\n', 'output': ['22\\r\\n']}, {'input': '5\\r\\n1 0\\r\\n-1 0\\r\\n1 0\\r\\n-1 0\\r\\n0 0\\r\\n', 'output': ['8\\r\\n']}, {'input': '9\\r\\n1 0\\r\\n-1 0\\r\\n1 0\\r\\n-1 0\\r\\n0 0\\r\\n1 1\\r\\n-1 -1\\r\\n1 -1\\r\\n-1 1\\r\\n', 'output': ['12\\r\\n']}, {'input': '5\\r\\n-10 10\\r\\n-10 -10\\r\\n10 -10\\r\\n9 8\\r\\n1 2\\r\\n', 'output': ['81\\r\\n']}, {'input': '1\\r\\n7 -10\\r\\n', 'output': ['4\\r\\n']}, {'input': '3\\r\\n7 -10\\r\\n7 -10\\r\\n7 -10\\r\\n', 'output': ['4\\r\\n']}, {'input': '2\\r\\n-10 0\\r\\n-10 7\\r\\n', 'output': ['18\\r\\n']}, {'input': '5\\r\\n-10 0\\r\\n-10 7\\r\\n-10 0\\r\\n-10 7\\r\\n-10 0\\r\\n', 'output': ['18\\r\\n']}, {'input': '11\\r\\n0 0\\r\\n3 0\\r\\n1 0\\r\\n2 0\\r\\n1 0\\r\\n5 0\\r\\n3 0\\r\\n10 0\\r\\n6 0\\r\\n-1 0\\r\\n2 0\\r\\n', 'output': ['26\\r\\n']}, {'input': '10\\r\\n1 0\\r\\n1 -3\\r\\n1 5\\r\\n1 -2\\r\\n1 5\\r\\n1 -2\\r\\n1 -2\\r\\n1 -2\\r\\n1 -2\\r\\n1 -2\\r\\n', 'output': ['20\\r\\n']}, {'input': '6\\r\\n1 0\\r\\n2 1\\r\\n10 9\\r\\n-1 -2\\r\\n2 1\\r\\n-1 -2\\r\\n', 'output': ['26\\r\\n']}, {'input': '6\\r\\n5 0\\r\\n0 5\\r\\n10 -5\\r\\n-5 10\\r\\n2 3\\r\\n3 2\\r\\n', 'output': ['34\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n2 0\\r\\n0 2\\r\\n', 'output': ['10\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n1 0\\r\\n0 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n2 0\\r\\n0 1\\r\\n', 'output': ['9\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n2 1\\r\\n0 2\\r\\n', 'output': ['10\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n2 0\\r\\n1 2\\r\\n', 'output': ['10\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n2 1\\r\\n1 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n3 1\\r\\n2 3\\r\\n', 'output': ['12\\r\\n']}, {'input': '3\\r\\n10 0\\r\\n0 20\\r\\n33 30\\r\\n', 'output': ['87\\r\\n']}, {'input': '4\\r\\n0 2\\r\\n2 0\\r\\n3 5\\r\\n5 3\\r\\n', 'output': ['14\\r\\n']}, {'input': '5\\r\\n0 2\\r\\n2 0\\r\\n3 5\\r\\n5 3\\r\\n6 3\\r\\n', 'output': ['16\\r\\n']}, {'input': '8\\r\\n0 2\\r\\n3 0\\r\\n5 3\\r\\n2 5\\r\\n2 2\\r\\n3 3\\r\\n2 2\\r\\n2 2\\r\\n', 'output': ['16\\r\\n']}, {'input': '4\\r\\n0 3\\r\\n3 0\\r\\n5 3\\r\\n2 5\\r\\n', 'output': ['15\\r\\n']}, {'input': '10\\r\\n2 0\\r\\n1 1\\r\\n0 2\\r\\n4 0\\r\\n0 4\\r\\n3 8\\r\\n5 8\\r\\n7 8\\r\\n8 7\\r\\n8 4\\r\\n', 'output': ['26\\r\\n']}, {'input': '4\\r\\n-1000000 -1000000\\r\\n1000000 1000000\\r\\n-1000000 1000000\\r\\n1000000 -1000000\\r\\n', 'output': ['8000004\\r\\n']}, {'input': '4\\r\\n-1000000 -999993\\r\\n999991 999997\\r\\n-999998 999996\\r\\n999994 -1000000\\r\\n', 'output': ['7999973\\r\\n']}, {'input': '11\\r\\n-1000000 -999993\\r\\n999991 999997\\r\\n1 3\\r\\n1 3\\r\\n0 0\\r\\n-999998 999996\\r\\n-1 3\\r\\n4 5\\r\\n-999998 999996\\r\\n6 7\\r\\n999994 -1000000\\r\\n', 'output': ['7999973\\r\\n']}, {'input': '2\\r\\n-1000000 -1000000\\r\\n999999 999999\\r\\n', 'output': ['4000002\\r\\n']}, {'input': '2\\r\\n-1000000 -1000000\\r\\n999999 1000000\\r\\n', 'output': ['4000004\\r\\n']}, {'input': '3\\r\\n1 -1\\r\\n-1 -1\\r\\n-1 1\\r\\n', 'output': ['10\\r\\n']}, {'input': '3\\r\\n2 2\\r\\n1 -2\\r\\n0 2\\r\\n', 'output': ['14\\r\\n']}, {'input': '3\\r\\n1 -1\\r\\n1 2\\r\\n-2 -2\\r\\n', 'output': ['14\\r\\n']}, {'input': '3\\r\\n0 2\\r\\n-1 1\\r\\n2 -1\\r\\n', 'output': ['11\\r\\n']}, {'input': '3\\r\\n2 1\\r\\n1 2\\r\\n-2 0\\r\\n', 'output': ['12\\r\\n']}, {'input': '3\\r\\n0 2\\r\\n2 1\\r\\n2 1\\r\\n', 'output': ['8\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n0 2\\r\\n0 -1\\r\\n', 'output': ['10\\r\\n']}, {'input': '4\\r\\n-1 -2\\r\\n2 -1\\r\\n-1 -1\\r\\n-1 0\\r\\n', 'output': ['12\\r\\n']}, {'input': '4\\r\\n2 1\\r\\n1 1\\r\\n-1 2\\r\\n-2 -2\\r\\n', 'output': ['15\\r\\n']}, {'input': '4\\r\\n1 2\\r\\n0 1\\r\\n0 3\\r\\n-1 -3\\r\\n', 'output': ['16\\r\\n']}, {'input': '4\\r\\n1 -1\\r\\n0 -2\\r\\n0 1\\r\\n-1 0\\r\\n', 'output': ['10\\r\\n']}, {'input': '5\\r\\n-2 2\\r\\n2 -3\\r\\n2 3\\r\\n2 1\\r\\n2 -3\\r\\n', 'output': ['19\\r\\n']}, {'input': '5\\r\\n-3 -3\\r\\n-3 3\\r\\n1 0\\r\\n-2 2\\r\\n0 -1\\r\\n', 'output': ['18\\r\\n']}, {'input': '6\\r\\n2 -1\\r\\n-2 1\\r\\n-1 -1\\r\\n0 2\\r\\n2 -2\\r\\n-2 0\\r\\n', 'output': ['15\\r\\n']}, {'input': '8\\r\\n3 -1\\r\\n1 -1\\r\\n0 2\\r\\n-2 -2\\r\\n1 -2\\r\\n1 -2\\r\\n3 2\\r\\n3 2\\r\\n', 'output': ['19\\r\\n']}, {'input': '20\\r\\n9 0\\r\\n11 6\\r\\n13 4\\r\\n7 3\\r\\n9 0\\r\\n10 4\\r\\n11 4\\r\\n11 2\\r\\n9 0\\r\\n9 1\\r\\n9 0\\r\\n10 4\\r\\n13 4\\r\\n10 6\\r\\n10 6\\r\\n9 0\\r\\n9 1\\r\\n10 2\\r\\n10 4\\r\\n12 3\\r\\n', 'output': ['17\\r\\n']}, {'input': '30\\r\\n-4 0\\r\\n-4 0\\r\\n-5 2\\r\\n-1 3\\r\\n-3 3\\r\\n-3 4\\r\\n-1 2\\r\\n-3 3\\r\\n-2 4\\r\\n-4 0\\r\\n-1 -1\\r\\n-2 2\\r\\n-2 2\\r\\n-5 1\\r\\n-1 3\\r\\n-1 -1\\r\\n-5 1\\r\\n-1 -1\\r\\n-3 1\\r\\n-3 0\\r\\n-5 2\\r\\n-2 -1\\r\\n-4 0\\r\\n-1 4\\r\\n-5 2\\r\\n-1 -1\\r\\n-1 3\\r\\n-4 1\\r\\n-3 4\\r\\n-3 -1\\r\\n', 'output': ['18\\r\\n']}, {'input': '40\\r\\n6 -14\\r\\n12 -13\\r\\n13 -16\\r\\n12 -13\\r\\n12 -13\\r\\n7 -13\\r\\n13 -16\\r\\n11 -15\\r\\n6 -14\\r\\n5 -14\\r\\n13 -14\\r\\n8 -17\\r\\n9 -13\\r\\n10 -10\\r\\n6 -13\\r\\n6 -15\\r\\n7 -12\\r\\n10 -11\\r\\n14 -14\\r\\n12 -12\\r\\n6 -14\\r\\n6 -14\\r\\n9 -15\\r\\n12 -13\\r\\n5 -14\\r\\n13 -16\\r\\n7 -12\\r\\n11 -17\\r\\n12 -13\\r\\n14 -14\\r\\n10 -11\\r\\n10 -18\\r\\n6 -15\\r\\n9 -14\\r\\n10 -14\\r\\n15 -15\\r\\n8 -13\\r\\n13 -15\\r\\n8 -17\\r\\n13 -13\\r\\n', 'output': ['24\\r\\n']}, {'input': '50\\r\\n-10 4\\r\\n5 4\\r\\n-4 4\\r\\n0 4\\r\\n-11 2\\r\\n-10 6\\r\\n-3 2\\r\\n-2 -3\\r\\n-2 -5\\r\\n5 -4\\r\\n0 -3\\r\\n5 -4\\r\\n-13 3\\r\\n-9 3\\r\\n1 -4\\r\\n-1 3\\r\\n0 5\\r\\n-7 2\\r\\n-9 5\\r\\n0 4\\r\\n4 5\\r\\n-2 -5\\r\\n4 4\\r\\n-9 1\\r\\n-9 6\\r\\n3 -2\\r\\n2 -4\\r\\n-10 6\\r\\n-2 -3\\r\\n-7 2\\r\\n2 5\\r\\n-2 6\\r\\n-2 6\\r\\n2 5\\r\\n2 -4\\r\\n5 2\\r\\n-5 -2\\r\\n4 4\\r\\n2 -4\\r\\n2 -4\\r\\n5 3\\r\\n5 1\\r\\n3 -1\\r\\n-10 4\\r\\n4 -5\\r\\n-4 2\\r\\n-5 -2\\r\\n-2 2\\r\\n-1 4\\r\\n3 5\\r\\n', 'output': ['48\\r\\n']}, {'input': '60\\r\\n22 -7\\r\\n25 -2\\r\\n21 5\\r\\n21 2\\r\\n26 1\\r\\n19 1\\r\\n21 0\\r\\n21 2\\r\\n29 -5\\r\\n18 -3\\r\\n27 -3\\r\\n29 -5\\r\\n23 -4\\r\\n29 -5\\r\\n22 0\\r\\n19 -1\\r\\n23 0\\r\\n21 -5\\r\\n24 -1\\r\\n21 -4\\r\\n19 1\\r\\n24 3\\r\\n19 3\\r\\n25 -7\\r\\n24 -3\\r\\n30 -5\\r\\n24 -3\\r\\n27 -7\\r\\n20 -5\\r\\n16 -1\\r\\n25 -5\\r\\n19 -3\\r\\n18 -1\\r\\n17 -1\\r\\n19 1\\r\\n18 2\\r\\n28 -5\\r\\n24 0\\r\\n25 2\\r\\n22 1\\r\\n29 -5\\r\\n22 -1\\r\\n19 1\\r\\n28 -2\\r\\n29 -2\\r\\n22 -4\\r\\n21 0\\r\\n22 -4\\r\\n21 -5\\r\\n19 3\\r\\n22 -1\\r\\n21 5\\r\\n27 -4\\r\\n30 -3\\r\\n30 -5\\r\\n22 3\\r\\n19 2\\r\\n26 -1\\r\\n23 3\\r\\n22 -4\\r\\n', 'output': ['35\\r\\n']}, {'input': '20\\r\\n-118 -4\\r\\n-114 -8\\r\\n-86 40\\r\\n-77 38\\r\\n-128 24\\r\\n-114 -8\\r\\n-107 24\\r\\n-63 15\\r\\n-114 -8\\r\\n-138 34\\r\\n-136 53\\r\\n-116 37\\r\\n-62 14\\r\\n-116 37\\r\\n-112 10\\r\\n-146 25\\r\\n-83 42\\r\\n-62 14\\r\\n-107 11\\r\\n-138 34\\r\\n', 'output': ['200\\r\\n']}, {'input': '30\\r\\n220065 650176\\r\\n-85645 309146\\r\\n245761 474510\\r\\n297068 761230\\r\\n39280 454823\\r\\n65372 166746\\r\\n316557 488319\\r\\n220065 650176\\r\\n245761 474510\\r\\n65372 166746\\r\\n-8475 -14722\\r\\n327177 312018\\r\\n371695 397843\\r\\n343097 243895\\r\\n-113462 117273\\r\\n-8189 440841\\r\\n327177 312018\\r\\n-171241 288713\\r\\n-147691 268033\\r\\n265028 425605\\r\\n208512 456240\\r\\n97333 6791\\r\\n-109657 297156\\r\\n-109657 297156\\r\\n-176591 87288\\r\\n-120815 31512\\r\\n120019 546293\\r\\n3773 19061\\r\\n161901 442125\\r\\n-50681 429871\\r\\n', 'output': ['1727359\\r\\n']}, {'input': '50\\r\\n139 201\\r\\n115 37\\r\\n206 8\\r\\n115 37\\r\\n167 201\\r\\n189 1\\r\\n167 201\\r\\n141 201\\r\\n141 201\\r\\n115 37\\r\\n78 81\\r\\n167 201\\r\\n126 201\\r\\n78 91\\r\\n103 186\\r\\n208 169\\r\\n85 67\\r\\n208 153\\r\\n78 97\\r\\n208 89\\r\\n126 26\\r\\n141 201\\r\\n208 42\\r\\n166 41\\r\\n78 124\\r\\n156 1\\r\\n181 201\\r\\n78 129\\r\\n208 169\\r\\n208 52\\r\\n78 85\\r\\n128 201\\r\\n167 201\\r\\n208 23\\r\\n100 52\\r\\n148 4\\r\\n116 199\\r\\n208 122\\r\\n173 201\\r\\n167 201\\r\\n153 1\\r\\n176 1\\r\\n170 194\\r\\n78 132\\r\\n206 8\\r\\n208 23\\r\\n208 67\\r\\n208 116\\r\\n78 161\\r\\n142 160\\r\\n', 'output': ['515\\r\\n']}, {'input': '60\\r\\n-20 179\\r\\n-68 0\\r\\n-110 68\\r\\n-22 177\\r\\n47 140\\r\\n-49 -4\\r\\n-106 38\\r\\n-23 22\\r\\n20 193\\r\\n47 173\\r\\n-23 22\\r\\n-100 32\\r\\n-97 29\\r\\n47 124\\r\\n-49 -4\\r\\n20 193\\r\\n-20 179\\r\\n-50 149\\r\\n-59 -7\\r\\n4 193\\r\\n-23 22\\r\\n-97 29\\r\\n-23 22\\r\\n-66 133\\r\\n47 167\\r\\n-61 138\\r\\n-49 -4\\r\\n-91 108\\r\\n-110 84\\r\\n47 166\\r\\n-110 77\\r\\n-99 100\\r\\n-23 22\\r\\n-59 -7\\r\\n47 128\\r\\n46 91\\r\\n9 193\\r\\n-110 86\\r\\n-49 -4\\r\\n8 193\\r\\n2 47\\r\\n-35 164\\r\\n-100 32\\r\\n47 114\\r\\n-56 -7\\r\\n47 148\\r\\n14 193\\r\\n20 65\\r\\n47 171\\r\\n47 171\\r\\n-110 53\\r\\n47 93\\r\\n20 65\\r\\n-35 164\\r\\n-50 149\\r\\n-25 174\\r\\n9 193\\r\\n47 150\\r\\n-49 -4\\r\\n-110 44\\r\\n', 'output': ['446\\r\\n']}, {'input': '54\\r\\n-2 0\\r\\n-2 0\\r\\n3 -3\\r\\n-3 -6\\r\\n-5 -5\\r\\n-1 -4\\r\\n2 5\\r\\n-4 2\\r\\n2 5\\r\\n-5 5\\r\\n5 3\\r\\n3 1\\r\\n-2 1\\r\\n4 4\\r\\n-4 4\\r\\n-3 2\\r\\n-5 -4\\r\\n2 4\\r\\n4 2\\r\\n-2 1\\r\\n4 -1\\r\\n5 4\\r\\n-2 1\\r\\n-5 5\\r\\n-3 -1\\r\\n-4 -1\\r\\n1 -4\\r\\n-2 -2\\r\\n3 -3\\r\\n2 6\\r\\n-5 3\\r\\n-1 4\\r\\n5 -1\\r\\n2 -4\\r\\n2 -2\\r\\n1 4\\r\\n-5 5\\r\\n0 4\\r\\n-5 3\\r\\n-4 -2\\r\\n3 -2\\r\\n3 -1\\r\\n-4 -1\\r\\n5 5\\r\\n4 5\\r\\n3 -3\\r\\n1 2\\r\\n2 5\\r\\n-2 -4\\r\\n-5 5\\r\\n-4 1\\r\\n2 4\\r\\n-3 -4\\r\\n1 6\\r\\n', 'output': ['40\\r\\n']}, {'input': '35\\r\\n3 -3\\r\\n1 4\\r\\n-3 -3\\r\\n2 -2\\r\\n0 -1\\r\\n-1 -1\\r\\n2 5\\r\\n0 -1\\r\\n1 3\\r\\n-3 -5\\r\\n1 -1\\r\\n3 5\\r\\n1 -3\\r\\n3 -5\\r\\n-1 3\\r\\n2 -3\\r\\n1 -1\\r\\n-3 5\\r\\n-3 -2\\r\\n2 -2\\r\\n1 -6\\r\\n-3 5\\r\\n-1 1\\r\\n1 -3\\r\\n1 4\\r\\n3 4\\r\\n-1 -1\\r\\n0 -5\\r\\n3 -2\\r\\n-3 -4\\r\\n3 6\\r\\n1 4\\r\\n-2 1\\r\\n2 -3\\r\\n2 -6\\r\\n', 'output': ['37\\r\\n']}, {'input': '43\\r\\n-1 2\\r\\n2 -3\\r\\n-2 0\\r\\n2 -1\\r\\n0 1\\r\\n0 0\\r\\n1 -3\\r\\n0 -2\\r\\n0 2\\r\\n2 0\\r\\n-1 2\\r\\n2 -3\\r\\n1 2\\r\\n1 0\\r\\n1 -3\\r\\n-2 -3\\r\\n2 -3\\r\\n-2 0\\r\\n0 -3\\r\\n1 -2\\r\\n-2 -3\\r\\n1 1\\r\\n2 -3\\r\\n2 1\\r\\n-1 -3\\r\\n1 2\\r\\n1 -3\\r\\n-1 2\\r\\n0 1\\r\\n0 -1\\r\\n0 -3\\r\\n2 1\\r\\n1 0\\r\\n-2 -3\\r\\n0 -2\\r\\n1 1\\r\\n-2 2\\r\\n-2 -3\\r\\n-2 3\\r\\n-1 0\\r\\n1 -1\\r\\n2 2\\r\\n-1 -2\\r\\n', 'output': ['23\\r\\n']}, {'input': '61\\r\\n0 -5\\r\\n0 3\\r\\n0 -1\\r\\n0 -4\\r\\n0 6\\r\\n0 -1\\r\\n0 -3\\r\\n0 6\\r\\n0 5\\r\\n0 -5\\r\\n0 1\\r\\n0 2\\r\\n0 5\\r\\n0 -3\\r\\n0 1\\r\\n0 -6\\r\\n0 -3\\r\\n0 3\\r\\n0 -3\\r\\n0 -5\\r\\n0 2\\r\\n0 1\\r\\n0 5\\r\\n0 3\\r\\n0 -2\\r\\n0 -2\\r\\n0 -3\\r\\n0 -6\\r\\n0 -4\\r\\n0 -2\\r\\n0 0\\r\\n0 -1\\r\\n0 -5\\r\\n0 -6\\r\\n0 6\\r\\n0 0\\r\\n0 -5\\r\\n0 1\\r\\n0 2\\r\\n0 -2\\r\\n0 -5\\r\\n0 6\\r\\n0 -3\\r\\n0 4\\r\\n0 5\\r\\n0 2\\r\\n0 -6\\r\\n0 -3\\r\\n0 2\\r\\n0 1\\r\\n0 -2\\r\\n0 -4\\r\\n0 -2\\r\\n0 4\\r\\n0 -1\\r\\n0 6\\r\\n0 0\\r\\n0 -1\\r\\n0 -3\\r\\n0 -4\\r\\n0 -3\\r\\n', 'output': ['28\\r\\n']}, {'input': '57\\r\\n-8 0\\r\\n-2 0\\r\\n-2 0\\r\\n-7 0\\r\\n-8 0\\r\\n0 0\\r\\n8 0\\r\\n8 0\\r\\n3 0\\r\\n-2 0\\r\\n-3 0\\r\\n6 0\\r\\n-7 0\\r\\n-9 0\\r\\n-2 0\\r\\n-4 0\\r\\n-8 0\\r\\n0 0\\r\\n6 0\\r\\n7 0\\r\\n3 0\\r\\n0 0\\r\\n9 0\\r\\n0 0\\r\\n-9 0\\r\\n3 0\\r\\n8 0\\r\\n0 0\\r\\n6 0\\r\\n-4 0\\r\\n8 0\\r\\n10 0\\r\\n-7 0\\r\\n3 0\\r\\n-1 0\\r\\n8 0\\r\\n3 0\\r\\n1 0\\r\\n6 0\\r\\n3 0\\r\\n-8 0\\r\\n4 0\\r\\n-8 0\\r\\n-2 0\\r\\n1 0\\r\\n6 0\\r\\n7 0\\r\\n-6 0\\r\\n-2 0\\r\\n-2 0\\r\\n-8 0\\r\\n-8 0\\r\\n2 0\\r\\n0 0\\r\\n10 0\\r\\n4 0\\r\\n-8 0\\r\\n', 'output': ['42\\r\\n']}]","id":295} {"difficulty":2000,"lang":"Mono C#","lang_cluster":"C#","src_uid":"e33b0a752dc1aba25da21e20435e3fe2","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\n\nclass Program\n{\n private static bool Can(int k, string s, int d)\n {\n int prev = 0;\n int pos = 0;\n k -= 2;\n while (true)\n {\n if (k == 0)\n {\n if (s.Length - pos - 2 > d) return false;\n\n return true;\n }\n\n k--;\n pos += d + 1;\n if (pos >= s.Length) return true;\n\n while (pos > prev && s[pos] == '1') pos--;\n\n if (pos == prev) return false;\n }\n\n return true;\n }\n\n private static void Main(string[] args)\n {\n int n = RI();\n int k = RI();\n\n var s = new string(ReadStringLine());\n\n if (Can(k, s, 0))\n {\n Console.WriteLine(0);\n return;\n }\n\n int l = 0;\n int r = n;\n while (r - l > 1)\n {\n var mid = (l + r) \/ 2;\n if (Can(k, s, mid))\n r = mid;\n else\n l = mid;\n }\n\n Console.WriteLine(r);\n }\n\n private const int Mod = 1000000000 + 7;\n\n #region Data Read\n private static char ReadSign()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans == '+' || ans == '-' || ans == '?')\n return (char)ans;\n }\n }\n\n private static long GCD(long a, long b)\n {\n if (a % b == 0) return b;\n return GCD(b, a % b);\n }\n\n private static List[] ReadGraph(int n, int m)\n {\n List[] g = new List[n];\n for (int i = 0; i < g.Length; i++) g[i] = new List();\n for (int i = 0; i < m; i++)\n {\n int a = RI() - 1;\n int b = RI() - 1;\n\n g[a].Add(b);\n g[b].Add(a);\n }\n\n return g;\n }\n\n private static int[,] ReadGraphAsMatrix(int n, int m)\n {\n int[,] matrix = new int[n + 1, n + 1];\n for (int i = 0; i < m; i++)\n {\n int a = RI();\n int b = RI();\n matrix[a, b] = matrix[b, a] = 1;\n }\n\n return matrix;\n }\n\n private static void Sort(ref int a, ref int b)\n {\n if (a > b) Swap(ref a, ref b);\n }\n\n private static void Swap(ref int a, ref int b)\n {\n int tmp = a;\n a = b;\n b = tmp;\n }\n\n private const int BufferSize = 1 << 16;\n private static StreamReader consoleReader;\n private static MemoryStream testData;\n\n private static int RI()\n {\n int ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static ulong RUL()\n {\n ulong ans = 0;\n int chr;\n do\n {\n chr = consoleReader.Read();\n if (chr == -1)\n return 0;\n } while (chr < '0' || chr > '9');\n\n ans = (uint)(chr - '0');\n while (true)\n {\n chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans;\n ans = ans * 10 + (uint)(chr - '0');\n }\n }\n\n private static long RL()\n {\n long ans = 0;\n int mul = 1;\n do\n {\n ans = consoleReader.Read();\n if (ans == -1)\n return 0;\n if (ans == '-') mul = -1;\n } while (ans < '0' || ans > '9');\n\n ans -= '0';\n while (true)\n {\n int chr = consoleReader.Read();\n if (chr < '0' || chr > '9')\n return ans * mul;\n ans = ans * 10 + chr - '0';\n }\n }\n\n private static int[] RIA(int n)\n {\n int[] ans = new int[n];\n for (int i = 0; i < n; i++)\n ans[i] = RI();\n return ans;\n }\n\n private static long[] RLA(int n)\n {\n long[] ans = new long[n];\n for (int i = 0; i < n; i++)\n ans[i] = RL();\n return ans;\n }\n\n private static char[] ReadWord()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n List s = new List();\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s.ToArray();\n }\n\n private static char[] ReadString(int n)\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));\n\n char[] s = new char[n];\n int pos = 0;\n do\n {\n s[pos++] = (char)ans;\n if (pos == n) break;\n ans = consoleReader.Read();\n } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));\n\n return s;\n }\n\n private static char[] ReadStringLine()\n {\n int ans;\n\n do\n {\n ans = consoleReader.Read();\n } while (ans == 10 || ans == 13);\n\n List s = new List();\n\n do\n {\n s.Add((char)ans);\n ans = consoleReader.Read();\n } while (ans != 10 && ans != 13 && ans != -1);\n\n return s.ToArray();\n }\n\n private static char ReadLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))\n return (char)ans;\n }\n }\n private static char ReadNonLetter()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))\n return (char)ans;\n }\n }\n\n private static char ReadAnyOf(IEnumerable allowed)\n {\n while (true)\n {\n char ans = (char)consoleReader.Read();\n if (allowed.Contains(ans))\n return ans;\n }\n }\n\n private static char ReadDigit()\n {\n while (true)\n {\n int ans = consoleReader.Read();\n if (ans >= '0' && ans <= '9')\n return (char)ans;\n }\n }\n\n private static int ReadDigitInt()\n {\n return ReadDigit() - (int)'0';\n }\n\n private static char ReadAnyChar()\n {\n return (char)consoleReader.Read();\n }\n\n private static string DoubleToString(double x)\n {\n return x.ToString(CultureInfo.InvariantCulture);\n }\n\n private static double DoubleFromString(string x)\n {\n return double.Parse(x, CultureInfo.InvariantCulture);\n }\n\n static Program()\n {\n \/\/Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;\n consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);\n }\n\n private static void PushTestData(StringBuilder sb)\n {\n PushTestData(sb.ToString());\n }\n private static void PushTestData(string data)\n {\n#if TOLYAN_TEST\n if (testData == null)\n {\n testData = new MemoryStream();\n consoleReader = new StreamReader(testData);\n }\n\n var pos = testData.Position;\n var bytes = Encoding.UTF8.GetBytes(data);\n testData.Write(bytes, 0, bytes.Length);\n testData.Flush();\n testData.Position = pos;\n#endif\n }\n #endregion\n}","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"],"human_solution":"using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\n\nclass CS\n{\n static List lst;\n static int n, k;\n\n static bool Check(int t)\n {\n int last = 0;\n int remain = k - 1;\n for (int i = 1; i < lst.Count; i++)\n {\n if (lst[i] - last > t + 1) return false;\n if (i == lst.Count - 1 || lst[i + 1] - last > t + 1)\n {\n last = lst[i];\n if (remain-- == 0)\n {\n return false;\n }\n }\n }\n return true;\n }\n\n static void Main(string[] args)\n {\n var line = Console.ReadLine().Split();\n n = int.Parse(line[0]);\n k = int.Parse(line[1]);\n var dat = Console.ReadLine().Trim();\n\n lst = new List();\n for (int i = 0; i < dat.Length; i++)\n {\n if (dat[i] == '0') lst.Add(i);\n }\n\n int lo = 0, hi = n, ans = n + 1;\n while (lo <= hi)\n {\n int mid = (lo + hi) \/ 2;\n if (Check(mid))\n {\n ans = mid;\n hi = mid - 1;\n }\n else lo = mid + 1;\n }\n Console.WriteLine(ans);\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":296} {"difficulty":1800,"lang":"Mono C#","lang_cluster":"C#","src_uid":"e9c486e2d942700e0644dff29b6e3be6","execute_outcome":"RUNTIME_ERROR","source_code":"using System;\nusing System.Collections.Generic;\n\nnamespace Task2\n{\n class Program\n {\n private struct Spell\n {\n public int N;\n public int pow;\n public int dmg;\n\n public static Spell NullSpell\n {\n get { return new Spell() {N = -1, dmg = -1, pow = -1}; }\n }\n }\n\n private struct Cast\n {\n\n public int time;\n public int spell;\n }\n\n static void Main(string[] args)\n {\n string line;\n\n line = Console.ReadLine();\n string[] arg1 = line.Split();\n\n int N = int.Parse(arg1[0]);\n int max = int.Parse(arg1[1]);\n int reg = int.Parse(arg1[2]);\n\n List spells = new List();\n\n for (int i = 0; i < N; i++)\n {\n line = Console.ReadLine();\n string[] arg2 = line.Split();\n\n int pow = int.Parse(arg2[0]);\n int dmg = int.Parse(arg2[1]);\n\n spells.Add(new Spell() {N = i + 1, pow = pow, dmg = dmg});\n }\n\n spells.Sort( (x, y) => y.dmg.CompareTo(x.dmg)); \/\/sort desc\n\n List usedSpells = new List();\n\n int currentDmg = 0;\n int currentHp = max;\n int currentTime = 0;\n\n do\n {\n currentHp -= currentDmg;\n\n currentHp += reg;\n if (currentHp > max)\n currentHp = max;\n\n Spell spell = GetBestSpell(currentHp, max, spells);\n if (spell.Equals(Spell.NullSpell))\n {\n if (reg >= currentDmg && currentHp > 0)\n {\n OutNoSolution();\n return;\n }\n }\n else\n {\n currentDmg += spell.dmg;\n spells.Remove(spell);\n\n usedSpells.Add(new Cast() {spell = spell.N, time = currentTime});\n }\n\n if (currentHp <= 0)\n {\n OutSolution(usedSpells, currentTime);\n return;\n }\n\n currentTime++;\n } while (true);\n }\n\n private static void OutNoSolution()\n {\n Console.WriteLine(\"NO\");\n\n }\n\n private static void OutSolution(List usedSpells, int time)\n {\n Console.WriteLine(\"YES\");\n Console.WriteLine(\"{0} {1}\", time, usedSpells.Count);\n\n foreach (var cast in usedSpells)\n {\n Console.WriteLine(\"{0} {1}\", cast.time, cast.spell);\n }\n }\n\n private static Spell GetBestSpell(int currentHp, int max, List spells)\n {\n for (int i = 0; i < spells.Count; i++)\n if ((long)currentHp * 100 <= (long)spells[i].pow * max)\n {\n return spells[i];\n }\n\n return Spell.NullSpell;\n }\n }\n}\n","description":"Vasya\u2019s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.While playing the game Petya found spell scrolls and now he is about to use them. Let\u2019s describe the way fighting goes on this level:1) The boss has two parameters: max \u2014 the initial amount of health and reg \u2014 regeneration rate per second.2) Every scroll also has two parameters: powi \u2014 spell power measured in percents \u2014 the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than powi percent of health the scroll cannot be used); and dmgi the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmgi of damage per second upon him until the end of the game.During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can\u2019t have more than max of health), then the player may use another scroll (no more than one per second).The boss is considered to be defeated if at the end of a second he has nonpositive (\u2009\u2264\u20090) amount of health.Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.","input_specification":"The first line contains three integers N, max and reg (1\u2009\u2264\u2009N,\u2009max,\u2009reg\u2009\u2264\u20091000) \u2013\u2013 the amount of scrolls and the parameters of the boss. The next N lines contain two integers powi and dmgi each \u2014 the parameters of the i-th scroll (0\u2009\u2264\u2009powi\u2009\u2264\u2009100, 1\u2009\u2264\u2009dmgi\u2009\u2264\u20092000). ","output_specification":"In case Petya can\u2019t complete this level, output in the single line NO. Otherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds. Output scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.","notes":null,"sample_inputs":["2 10 3\n100 3\n99 1","2 100 10\n100 11\n90 9"],"sample_outputs":["NO","YES\n19 2\n0 1\n10 2"],"human_solution":"\ufeffusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\n\n\n\nclass Program\n{\n\n void solve()\n {\n int n = nextInt();\n int max = nextInt();\n int reg = nextInt();\n int[] p = new int[n];\n int[] dam = new int[n];\n for (int i = 0; i < n; i++)\n {\n p[i] = nextInt();\n dam[i] = nextInt();\n }\n int t = 0;\n int[] who = new int[2002];\n for (int i = 0; i < who.Length; i++)\n who[i] = -1;\n bool[] used = new bool[n];\n int v = max;\n while (true)\n {\n if (t >= 40000)\n break;\n for (int i = 0; i < n; i++)\n {\n if (used[i])\n {\n v -= dam[i];\n }\n }\n v += reg;\n if (v >= max)\n v = max;\n if (v <= 0)\n break;\n int z = -1;\n int best = -1;\n for (int i = 0; i < n; i++)\n {\n if (used[i])\n continue;\n if (v * 100 <= p[i] * max)\n {\n if (best < dam[i])\n {\n best = dam[i];\n z = i;\n }\n }\n }\n if (z != -1)\n {\n used[z] = true;\n who[t] = z;\n }\n t++;\n }\n if (v <= 0)\n {\n println(\"YES\");\n int cnt = 0;\n for (int i = 0; i < n; i++)\n if (used[i])\n cnt++;\n println(t+\" \"+cnt);\n for(int i=0;i 1)\n {\n int mid = (ok + ng) \/ 2;\n long p2Num = 0;\n int p2 = mid;\n\n long preNum = 1;\n int pre = 0;\n bool flag = true;\n NGcnt = OKcnt = 0;\n\n foreach (var now in A)\n {\n while(now > preNum)\n {\n if (p2Num != 0)\n {\n for (int i = 0; i < p2; i++)\n {\n OKar[OKcnt++] = p2Num;\n }\n }\n p2 = pre;\n p2Num = preNum;\n pre = 0;\n preNum *= 2;\n }\n if(p2 >= 1 && now == preNum)\n {\n pre++;\n p2--;\n }\n else\n {\n NGar[NGcnt++] = now;\n }\n\n }\n\n for (int i = 0; i < p2; i++)\n {\n OKar[OKcnt++] = p2Num;\n }\n for (int i = 0; i < pre; i++)\n {\n OKar[OKcnt++] = preNum;\n }\n\n int o = 0;\n int nn = 0;\n while(o < OKcnt && nn < NGcnt)\n {\n if (OKar[o] * 2 >= NGar[nn]) nn++;\n o++;\n }\n\n if (nn < NGcnt) flag = false;\n\n if (flag) ok = mid;\n else ng = mid;\n }\n\n if (ok == MAX) Console.WriteLine(-1);\n else\n {\n for (int i = ok; i <= count1; i++)\n {\n Console.Write(i + \" \");\n }\n Console.WriteLine();\n }\n }\n}\n\nclass Scanner\n{\n string[] s;\n int i;\n\n char[] cs = new char[] { ' ' };\n\n public Scanner()\n {\n s = new string[0];\n i = 0;\n }\n\n public string next()\n {\n if (i < s.Length) return s[i++];\n string st = Console.ReadLine();\n while (st == \"\") st = Console.ReadLine();\n s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);\n i = 0;\n return s[i++];\n }\n\n public int nextInt()\n {\n return int.Parse(next());\n }\n\n public long nextLong()\n {\n return long.Parse(next());\n }\n\n public double nextDouble()\n {\n return double.Parse(next());\n }\n\n}","description":"It can be shown that any positive integer x can be uniquely represented as x\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u2009...\u2009+\u20092k\u2009-\u20091\u2009+\u2009r, where k and r are integers, k\u2009\u2265\u20090, 0\u2009<;\u2009r\u2009\u2264\u20092k. Let's call that representation prairie partition of x.For example, the prairie partitions of 12, 17, 7 and 1 are: 12\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u20095,17\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u20098\u2009+\u20092,7\u2009=\u20091\u2009+\u20092\u2009+\u20094,1\u2009=\u20091. Alice took a sequence of positive integers (possibly with repeating elements), replaced every element with the sequence of summands in its prairie partition, arranged the resulting numbers in non-decreasing order and gave them to Borys. Now Borys wonders how many elements Alice's original sequence could contain. Find all possible options!","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105)\u00a0\u2014 the number of numbers given from Alice to Borys. The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u20091012; a1\u2009\u2264\u2009a2\u2009\u2264\u2009...\u2009\u2264\u2009an)\u00a0\u2014 the numbers given from Alice to Borys.","output_specification":"Output, in increasing order, all possible values of m such that there exists a sequence of positive integers of length m such that if you replace every element with the summands in its prairie partition and arrange the resulting numbers in non-decreasing order, you will get the sequence given in the input. If there are no such values of m, output a single integer -1.","notes":"NoteIn the first example, Alice could get the input sequence from [6,\u200920] as the original sequence.In the second example, Alice's original sequence could be either [4,\u20095] or [3,\u20093,\u20093].","sample_inputs":["8\n1 1 2 2 3 4 5 8","6\n1 1 1 2 2 2","5\n1 2 4 4 4"],"sample_outputs":["2","2 3","-1"],"human_solution":"\ufeffnamespace ZT.Contests.Codeforces\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using System.Linq;\n\n internal static class Program\n {\n public static void Main(string[] args)\n {\n var solver = new PrairiePartition();\n var input = new TextInputHelper(Console.In);\n solver.DoWork(input);\n }\n }\n\n internal class PrairiePartition : CFSolver\n {\n \/\/ 2^(ValueU2-1) should be larger than the largest value\n private const int ValueU2 = 42;\n\n public PrairiePartition(RunType runType = RunType.ReadUntilNoInput) : base(runType) { }\n\n public override void Solve(InputHelper input)\n {\n var n = input.Read();\n var a = new long[n];\n for (var i = 0; i < n; ++i) a[i] = input.Read();\n\n var sum = new int[ValueU2]; \/\/ count of number no less than 2^j\n var b = new int[ValueU2]; \/\/ count of number equal to 2^j\n for (int j = ValueU2 - 1, i = n - 1; j >= 0; --j)\n {\n var c = 1L << j;\n for (; i >= 0 && a[i] > c; --i) ;\n sum[j] = n - i - 1;\n var qi = i;\n for (; i >= 0 && a[i] >= c; --i) ;\n b[j] = qi - i;\n }\n \/\/Console.WriteLine($\"sum: {string.Join(\" \", sum)}\\nb: {string.Join(\" \", b)}\");\n var res = new List();\n for (var r = (b[0] + 1) \/ 2; r <= b[0]; ++r)\n {\n var u = new int[ValueU2];\n var v = new int[ValueU2];\n \/\/Console.WriteLine($\"check {r}\");\n Func cal = null;\n cal = (j, c) =>\n {\n if (j == ValueU2 - 1) return true; \/\/ 2^(ValueU2-1) is larger than the largest element\n u[j] = Math.Min(c, b[j]);\n if (!cal(j + 1, u[j])) return false;\n var d = sum[j] - sum[j + 1] - u[j + 1];\n v[j] = v[j + 1] + d;\n \/\/Console.WriteLine($\"\\t{j}: {u[j]} {v[j]} ({d})\");\n return u[j] >= v[j];\n };\n if (cal(0, r) && u[0] - v[0] >= b[0] - u[0]) res.Add(r);\n }\n Console.WriteLine(res.Any() ? string.Join(\" \", res) : \"-1\");\n }\n }\n\n internal abstract class CFSolver\n {\n public const long Mod = 1000000007;\n\n public CFSolver(RunType runType)\n {\n RunType = runType;\n }\n\n public RunType RunType { get; private set; }\n\n public void DoWork(InputHelper input)\n {\n Func shouldRun;\n\n switch (RunType)\n {\n case RunType.ReadRunTimeFromInput:\n shouldRun = GetShouldRun(input.Read());\n break;\n case RunType.ReadUntilNoInput:\n shouldRun = () => input.HasNext();\n break;\n default:\n shouldRun = GetShouldRun(1);\n break;\n }\n\n while (shouldRun())\n {\n Solve(input);\n }\n }\n\n public abstract void Solve(InputHelper input);\n\n private static Func GetShouldRun(int n) { return () => n-- > 0; }\n }\n\n public enum RunType\n {\n Single,\n ReadRunTimeFromInput,\n ReadUntilNoInput,\n }\n\n public abstract class InputHelper\n {\n private bool any;\n private IEnumerator cur;\n\n public T Read()\n {\n if (!HasNext()) { throw new InvalidOperationException(\"no more data\"); }\n var r = (T)Convert.ChangeType(cur.Current, typeof(T));\n any = false;\n return r;\n }\n\n public bool HasNext()\n {\n while (!any)\n {\n if (cur != null && cur.MoveNext()) break;\n var next = GetNextGroup();\n if (next == null) { return false; }\n cur = next.GetEnumerator();\n any = cur.MoveNext();\n }\n\n return any = true;\n }\n\n protected abstract IEnumerable GetNextGroup();\n }\n\n public class TextInputHelper : InputHelper\n {\n private TextReader reader;\n\n public TextInputHelper(TextReader reader) { this.reader = reader; }\n\n protected override IEnumerable GetNextGroup()\n {\n if (reader == null) { return null; }\n var cur = reader;\n reader = null;\n return ReadWordsToEnd(cur);\n }\n\n public static IEnumerable ReadWordsToEnd(TextReader reader)\n {\n while (true)\n {\n var lines = ReadWords(reader);\n if (lines == null) yield break;\n foreach (string word in lines) yield return word;\n }\n }\n\n public static IEnumerable ReadWords(TextReader reader)\n {\n string line = reader.ReadLine();\n return line == null ? null : line.Split(new char[] { ' ', '\\t' }, StringSplitOptions.RemoveEmptyEntries);\n }\n }\n}\n","testcases":"[{'input': '8\\r\\n1 1 2 2 3 4 5 8\\r\\n', 'output': ['2']}, {'input': '6\\r\\n1 1 1 2 2 2\\r\\n', 'output': ['2 3']}, {'input': '5\\r\\n1 2 4 4 4\\r\\n', 'output': ['-1']}, {'input': '20\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 8 8 10 10 11\\r\\n', 'output': ['4']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2\\r\\n', 'output': ['9 10 11 12 13 14 15 16 17']}, {'input': '25\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 8 13 15 16 16 31 32 36 41 55\\r\\n', 'output': ['-1']}, {'input': '25\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 9 16 16 32 40 43 53 61 64 128\\r\\n', 'output': ['-1']}, {'input': '45\\r\\n1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 8 8 8 8 8 8 16 16 16 16 16 32 32 32 32 32 41 64 64 64 64 128 128 128 256 256 512\\r\\n', 'output': ['5']}, {'input': '100\\r\\n1 1 1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 4 6 8 8 8 8 8 8 8 10 16 16 16 16 16 16 16 17 22 24 24 30 32 32 32 32 32 32 48 62 64 64 65 65 67 70 74 88 89 98 99 101 101 109 121 127 128 128 137 143 152 153 155 156 160 161 170 183 186 196 196 214 220 226 228 230 238 240 241 245 249 249 250 253 254 256 256 512 1024 1703\\r\\n', 'output': ['-1']}, {'input': '101\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 7 8 8 8 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 128 128 128 128 128 128 128 128 239 256 256 256 256 256 373 512 512 512 512 695 1024 1024 1024\\r\\n', 'output': ['11 12']}, {'input': '101\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 5 8 8 8 8 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 26 32 32 32 32 32 32 32 32 49 58 64 64 64 64 64 64 122 128 128 128 128 128 128 256 256 256 256 256 491 512 512 512 512 718 1024 1024 1024 2935 3123\\r\\n', 'output': ['-1']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3...', '-1', '3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3...', '7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7...', '3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3...', '5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5...', '3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280', '3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3...', '14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 1...', '37514 37515 37516 37517 37518 37519 37520 37521 37522 37523 37524 37525 37526 37527 37528 37529 37530 37531 37532 37533 37534 37535 37536 37537 37538 37539 37540 37541 37542 37543 37544 37545 37546 37547 37548 37549 37550 37551 37552 37553 37554 37555 37556 37557 37558 37559 37560 37561 37562 37563 37564 37565 37566 37567 37568 37569 37570 37571 37572 37573 37574 37575 37576 37577 37578 37579 37580 37581 37582 37583 37584 37585 37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 37598 3...', '5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5...', '3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3...', '3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3...', '41638 41639 41640 41641 41642 41643 41644 41645 41646 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 41662 41663 41664 41665 41666 41667 41668 41669 41670 41671 41672 41673 41674 41675 41676 41677 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 41700 41701 41702 41703 41704 41705 41706 41707 41708 41709 41710 41711 41712 41713 41714 41715 41716 41717 41718 41719 41720 41721 41722 4...', '9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9...', '7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7...', '7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7...', '2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565', '5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5...', '3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3...', '19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 1...', '3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3...', '19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 1...', '50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 50025 50026 50027 50028 50029 50030 50031 50032 50033 50034 50035 50036 50037 50038 50039 50040 50041 50042 50043 50044 50045 50046 50047 50048 50049 50050 50051 50052 50053 50054 50055 50056 50057 50058 50059 50060 50061 50062 50063 50064 50065 50066 50067 50068 50069 50070 50071 50072 50073 50074 50075 50076 50077 50078 50079 50080 50081 50082 50083 50084 5...', '5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6...', '3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3...', '3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3...']}, {'input': '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 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 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 6 6 6 8 8 8 8 8 8 8 8 11 13 14\\r\\n', 'output': ['27 28 29 30 31 32 33 34 35 36 37 38']}, {'input': '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 1 1 1 1 1 1...', 'output': ['14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 50025 50026 50027 50028 50029 50030 50031 50032 50033 50034 50035 50036 50037 50038 50039 50040 50041 50042 50043 50044 50045 50046 50047 50048 50049 50050 50051 50052 50053 50054 50055 50056 50057 50058 50059 50060 50061 50062 50063 50064 50065 50066 50067 50068 50069 50070 50071 50072 50073 50074 50075 50076 50077 50078 50079 50080 50081 50082 50083 50084 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['41638 41639 41640 41641 41642 41643 41644 41645 41646 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 41662 41663 41664 41665 41666 41667 41668 41669 41670 41671 41672 41673 41674 41675 41676 41677 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 41700 41701 41702 41703 41704 41705 41706 41707 41708 41709 41710 41711 41712 41713 41714 41715 41716 41717 41718 41719 41720 41721 41722 4...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['37514 37515 37516 37517 37518 37519 37520 37521 37522 37523 37524 37525 37526 37527 37528 37529 37530 37531 37532 37533 37534 37535 37536 37537 37538 37539 37540 37541 37542 37543 37544 37545 37546 37547 37548 37549 37550 37551 37552 37553 37554 37555 37556 37557 37558 37559 37560 37561 37562 37563 37564 37565 37566 37567 37568 37569 37570 37571 37572 37573 37574 37575 37576 37577 37578 37579 37580 37581 37582 37583 37584 37585 37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 37598 3...']}, {'input': '99995\\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 1 ...', 'output': ['-1', '10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 1...']}, {'input': '99995\\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 1 ...', 'output': ['10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280']}, {'input': '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 1 1 1 1 1 1...', 'output': ['2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['-1']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5...']}, {'input': '1\\r\\n1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1 2']}, {'input': '1\\r\\n2\\r\\n', 'output': ['-1']}, {'input': '1\\r\\n1000000000000\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n1 1000000000000\\r\\n', 'output': ['-1']}, {'input': '40\\r\\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888\\r\\n', 'output': ['1']}, {'input': '41\\r\\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888 1000000000000\\r\\n', 'output': ['1']}, {'input': '41\\r\\n1 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888\\r\\n', 'output': ['1 2']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6...']}, {'input': '99000\\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 1 ...', 'output': ['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 5039 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 5094 5095 5096 5097 5098 5099 5100 5101 5102 5...', '5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5...', '20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 2...']}, {'input': '99000\\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 1 ...', 'output': ['5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5...']}, {'input': '99000\\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 1 ...', 'output': ['20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 2...']}, {'input': '99990\\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 1 ...', 'output': ['20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 2...']}, {'input': '96\\r\\n1 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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8 8 8 8 8 8 8 8 8 8 8 9 12 12 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 18 21\\r\\n', 'output': ['-1']}, {'input': '99979\\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 1 ...', 'output': ['-1']}, {'input': '99976\\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 1 ...', 'output': ['-1']}, {'input': '99981\\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 1 ...', 'output': ['-1']}, {'input': '99982\\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 1 ...', 'output': ['-1']}, {'input': '99998\\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 1 ...', 'output': ['-1']}, {'input': '99997\\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 1 ...', 'output': ['-1']}, {'input': '99974\\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 1 ...', 'output': ['-1']}, {'input': '99994\\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 1 ...', 'output': ['-1']}, {'input': '99984\\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 1 ...', 'output': ['-1']}, {'input': '99977\\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 1 ...', 'output': ['-1']}, {'input': '99975\\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 1 ...', 'output': ['-1']}, {'input': '99989\\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 1 ...', 'output': ['-1']}]","id":298} {"difficulty":900,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"102667eaa3aee012fef70f4192464674","execute_outcome":"RUNTIME_ERROR","source_code":"require 'set'\nrequire 'rational'\nrequire 'mathn'\ninclude Math\n$stdin = File.open(\".\/input.txt\", \"r\") if ENV[\"USER\"] == \"new\"\n# ====================================\n\ngets\nfront = gets.split.map &:to_i\ngets\nback = gets.split.map &:to_i\n\nhash = Hash.new( 0 )\n\nfront_x.each{|v1|\n back_x.each{|v2|\n next if v1 % v2 != 0\n \n hash[back_x \/ front_x]+=1\n }\n}","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"],"human_solution":"gets\na = gets.split.map &:to_i\ngets\nb = gets.split.map &:to_i\n\nc = b.product(a).map{ |bi,aj| bi*1.0\/aj }.select{ |i| i%1 == 0 }\nputs c.count c.max\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":299} {"difficulty":1000,"lang":"Ruby 3","lang_cluster":"Ruby","src_uid":"102_B","execute_outcome":"WRONG_ANSWER","source_code":"x=gets\r\ni = 0\r\nwhile x.size > 1 do\r\n x=x.split('').map(&:to_i).sum.to_s\r\n i+=1\r\nend\r\np i\r\n","description":"Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many times can Gerald put a spell on it until the number becomes one-digit?","input_specification":"The first line contains the only integer n (0\u2264n\u226410^100000). It is guaranteed that n doesn't contain any leading zeroes.\n","output_specification":"Print the number of times a number can be replaced by the sum of its digits until it only contains one digit.\n","notes":"In the first sample the number already is one-digit \u2014 Herald can't cast a spell.\nThe second test contains number 10. After one casting of a spell it becomes 1, and here the process is completed. Thus, Gerald can only cast the spell once.\nThe third test contains number 991. As one casts a spell the following transformations take place: 991\u219219\u219210\u21921. After three transformations the number becomes one-digit.\n","sample_inputs":["0\n","10\n","991\n"],"sample_outputs":["0\n","1\n","3\n"],"human_solution":"x=gets.to_i.to_s\r\ni = 0\r\nwhile x.size > 1 do\r\n x=x.split('').map(&:to_i).sum.to_s\r\n i+=1\r\nend\r\np i\r\n","testcases":"[{'input': ['0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['991\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['99\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['123456789\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['32\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['86\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['34\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['28\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['23\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['57\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['29\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['353869285\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['549548646\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['858893424\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['644818852\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['360322525\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['122937520\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['288403032\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['677257481\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['58059561\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['211288847\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['339900034079539584\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['784084029310269952\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['774730557264864000\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['478233807148352256\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['165646874056812544\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['477533739511673792\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['660119944377002240\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['448375218506078080\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['77213334785795616\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['165767221702271872\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['156161456146164104103460452045416165146141414651641564105461465156445621465146514562146145465165145145614561465145614561\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['0\\r\\n']}]","id":300} {"difficulty":1100,"lang":"Ruby 3","lang_cluster":"Ruby","src_uid":"110_B","execute_outcome":"WRONG_ANSWER","source_code":"def ga = gets.split.map!(&:to_i)\ndef gi = gets.to_i\ndef giga = [gi, ga]\ndef gigs = [gi, gs]\ndef gs = gets.strip\ndef gss = gs.split\ndef o(x) = puts(x)\ndef pa(a, d = ' ') = puts(a * d)\ndef pan(a) = pa(a, \"\\n\")\ndef yn(p) = p ? 'YES' : 'NO'\ndef ync(p) = p ? 'Yes' : 'No'\ndef hz(d = 0) = Hash.new(d)\ndef rqr(*a) = a.each { require _1 }\nclass Set def z = size end\nclass Array\n def r! = reverse!\n def f = first\n def l = last\n def sh = shift\n def j(...) = join(...)\n def pc = pack('c*')\n def psum!(s = 0) = map! { s += _1 }\n def lbound(x) = bsearch { _1 >= x }\n def lbound_index(x) = bsearch_index { _1 >= x }\n def hoare!(...) = shuffle!.sort!(...)\n def z = size\nend\nmodule Enumerable\n def e(...) = each(...)\n def ei(...) = each_index(...)\n def re(...) = reverse_each(...)\n def ec(...) = each_cons(...)\n def es(...) = each_slice(...)\n def wo(...) = with_object(...)\n def wi(...) = with_index(...)\n def ewi(...) = each_with_index(...)\n def ewo(...) = each_with_object(...)\n def fold(...) = reduce(...)\nend\nclass String\n def i(...) = to_i(...)\n def e(...) = each_char(...)\n def eb(...) = each_byte(...)\n def b = bytes\n def r = reverse\n def z = size\nend\nclass Numeric\n def f = to_f\n def i = to_i\n def s(...) = to_s(...)\n def sqrt = Math.sqrt(self)\n def isqrt = Integer.sqrt(self)\nend\nclass Integer\n def p = pred\n def n = succ\n def t(...) = times(...)\n def popcount = loop.reduce((raise if (x = self) < 0; 0)) \\\n { | r | break r if x < 1; r += x & 1; x >>= 1; r }\n def ctz = loop.reduce((raise if (x = self) <= 0; 0)) \\\n { | r | break r if x[0] == 1; x >>= 1; r.n }\nend\nclass Hash\n def ek(...) = each_key(...)\n def ev(...) = each_value(...)\n def kmin = ek.min\n def kmax = ek.max\n def vmin = ev.min\n def vmax = ev.max\n def d(...) = delete(...)\n def z = size\nend\nclass MSet < Hash\n def <<(x) = (self[x] = (self[x] || 0).n; self)\n def d(x) = (self.delete x if (self[x] && self[x] -= 1) == 0)\nend\ndef fio(a = 'input.txt', b = 'output.txt')\n $stdin = File.open a, 'rb'\n $stdout = File.open b, 'wb'\nend\nrqr 'set', 'prime'\nclass Set def d(...) = delete(...) end\nclass Prime\n def self.at_least(x) =\n loop { Prime.prime?(x) ? (break x) : x += 1 }\nend\nRC = \/(.)\\1*\/\n\n################################################################\n# #\n# https:\/\/github.com\/alantudyk\/Stop #\n# #\n################################################################\n\no ('abcd' + ?a * 1e5)[...gi]\n\n################################################################\n# #\n# https:\/\/github.com\/alantudyk\/Stop #\n# #\n################################################################\n\n","description":"Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya recently learned to determine whether a string of lowercase Latin letters is lucky. For each individual letter all its positions in the string are written out in the increasing order. This results in 26 lists of numbers; some of them can be empty. A string is considered lucky if and only if in each list the absolute difference of any two adjacent numbers is a lucky number. For example, let's consider string \"zbcdzefdzc\". The lists of positions of equal letters are: b: 2 c: 3,10 d: 4,8 e: 6 f: 7 z: 1,5,9 Lists of positions of letters a, g, h, ..., y are empty.This string is lucky as all differences are lucky numbers. For letters z: 5-1=4, 9-5=4, for letters c: 10-3=7, for letters d: 8-4=4. Note that if some letter occurs only once in a string, it doesn't influence the string's luckiness after building the lists of positions of equal letters. The string where all the letters are distinct is considered lucky.Find the lexicographically minimal lucky string whose length equals n.","input_specification":"The single line contains a positive integer n (1\u2264n\u226410^5) \u2014 the length of the sought string.\n","output_specification":"Print on the single line the lexicographically minimal lucky string whose length equals n.\n","notes":"The lexical comparison of strings is performed by the < operator in modern programming languages. String a is lexicographically less than string b if exists such i (1\u2264i\u2264n), that ai= x }\n def lbound_index(x) = bsearch_index { _1 >= x }\n def hoare!(...) = shuffle!.sort!(...)\n def z = size\nend\nmodule Enumerable\n def e(...) = each(...)\n def ei(...) = each_index(...)\n def re(...) = reverse_each(...)\n def ec(...) = each_cons(...)\n def es(...) = each_slice(...)\n def wo(...) = with_object(...)\n def wi(...) = with_index(...)\n def ewi(...) = each_with_index(...)\n def ewo(...) = each_with_object(...)\n def fold(...) = reduce(...)\nend\nclass String\n def i(...) = to_i(...)\n def e(...) = each_char(...)\n def eb(...) = each_byte(...)\n def b = bytes\n def r = reverse\n def z = size\nend\nclass Numeric\n def f = to_f\n def i = to_i\n def s(...) = to_s(...)\n def sqrt = Math.sqrt(self)\n def isqrt = Integer.sqrt(self)\nend\nclass Integer\n def p = pred\n def n = succ\n def t(...) = times(...)\n def popcount = loop.reduce((raise if (x = self) < 0; 0)) \\\n { | r | break r if x < 1; r += x & 1; x >>= 1; r }\n def ctz = loop.reduce((raise if (x = self) <= 0; 0)) \\\n { | r | break r if x[0] == 1; x >>= 1; r.n }\nend\nclass Hash\n def ek(...) = each_key(...)\n def ev(...) = each_value(...)\n def kmin = ek.min\n def kmax = ek.max\n def vmin = ev.min\n def vmax = ev.max\n def d(...) = delete(...)\n def z = size\nend\nclass MSet < Hash\n def <<(x) = (self[x] = (self[x] || 0).n; self)\n def d(x) = (self.delete x if (self[x] && self[x] -= 1) == 0)\nend\ndef fio(a = 'input.txt', b = 'output.txt')\n $stdin = File.open a, 'rb'\n $stdout = File.open b, 'wb'\nend\nrqr 'set', 'prime'\nclass Set def d(...) = delete(...) end\nclass Prime\n def self.at_least(x) =\n loop { Prime.prime?(x) ? (break x) : x += 1 }\nend\nRC = \/(.)\\1*\/\n\n################################################################\n# #\n# https:\/\/github.com\/alantudyk\/Stop #\n# #\n################################################################\n\no ('abcd' * 25e3)[...gi]\n\n################################################################\n# #\n# https:\/\/github.com\/alantudyk\/Stop #\n# #\n################################################################\n\n","testcases":"[{'input': ['5\\r\\n'], 'output': ['abcda\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['abc\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['abcdabcd\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['abcdabcdab\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['abcdabcdabcdabcd\\r\\n']}, {'input': ['64\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\\r\\n']}, {'input': ['128\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd\\r\\n']}, {'input': ['47\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabc\\r\\n']}, {'input': ['74\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdab\\r\\n']}, {'input': ['477\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcda\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['a\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['ab\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['abcdabc\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['abcd\\r\\n']}, {'input': ['99\\r\\n'], 'output': ['abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabc\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['abcdab\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['abcdabcda\\r\\n']}]","id":301} {"difficulty":1200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","execute_outcome":"RUNTIME_ERROR","source_code":"n, vb, vs = gets.split.map{|i| i.to_f}\nx = gets.split.map{|i| i.to_i}\nxu, yu = gets.split.map{|i| i.to_i}\nans = [1e100, -1, -1]\n1.upto(x.length - 1) do |i|\n\td = (xu - x[i]) ** 2 + yu ** 2\n\tt = x[i] \/ vb + Math.sqrt(d) \/ vs\n\tans = [d, t, i] if t < ans[0] - 1e-8 || (t < ans[0] + 1e-8 && d < ans[1])\nend\np ans[2] + 1\n","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"],"human_solution":"n,vb,vs = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nar = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nxu,yu = gets.chomp.split(\/ \/).map!{|x| x.to_i}\n\nmint = 0\nmind = 0\nidx = 0\nfor i in 1..n-1\n\twk = (ar[i]-xu).abs\n\twkt = ar[i].to_f\/vb+Math.sqrt(wk*wk + yu*yu)\/vs\n\tif idx == 0 || mint > wkt\n\t\tmint = wkt\n\t\tmind = wk\n\t\tidx = i+1\n\telsif mint == wkt\n\t\tif mind > wk\n\t\t\tmint = wkt\n\t\t\tmind = wk\n\t\t\tidx = i+1\n\t\tend\n\tend\nend\nputs idx\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":302} {"difficulty":1200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"RUNTIME_ERROR","source_code":"gets\nbats = gets.split.map &:to_i\nprizes = gets.split.map &:to_i\nscore = 0\nres = prizes.map{0}\nfor bat in bats\n score += bat\n\n can = prizes.select{ |prize| prize <= score }\n break if can.empty?\n res[prizes.index(can.max)] += score \/ can.max\n score %= can.max\n \nend\nputs res.join \" \"\nputs score","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"],"human_solution":"def koukan()\n return -1 if $sum < $aa[0]\n 5.downto(1) { |i|\n return i-1 if $aa[i-1] <= $sum\n }\nend\n\n$n = gets.chomp.to_i\n$sa = gets.chomp.split(\/ \/).map!{|x| x.to_i}\n$aa = gets.chomp.split(\/ \/).map!{|x| x.to_i}\n$sum = 0\n$suma = Array.new(5).map!{|x| x = 0}\nfor i in 0..$n-1\n $sum += $sa[i]\n while (true)\n if $sum > $aa[4]\n wka = $sum.divmod($aa[4])\n $suma[4] += wka[0]\n $sum -= $aa[4] * wka[0]\n end\n ret = koukan()\n break if ret < 0\n $suma[ret] += 1\n $sum -= $aa[ret]\n end\nend\nputs $suma.join(\" \")\nputs $sum\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":303} {"difficulty":1200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","execute_outcome":"RUNTIME_ERROR","source_code":"k=gets.split[1].to_i\na=gets.split.map(&:to_i)\n\nranks=Array.new(104,0)\na.each{|i| ranks[i]+=1}\nans=0\nn=a.length\nloop do\n if ranks[k]==n then\n puts ans\n exit\n end\n next_rank=Array.new(104,0)\n 1.upto(k-1){|a|\n next_rank[a]+=ranks[a]\/2\n next_rank[a+1]+=(ranks[a]+1)\/2\n }\n next_rank[k]+=ranks[k]\n ranks=next_rank\n ans+=1\nend\n\n","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"],"human_solution":"k=gets.split[1].to_i\na=gets.split.map(&:to_i)\n\nranks=Array.new(104,0)\na.each{|i| ranks[i]+=1}\nans=0\nn=a.length\nloop do\n if ranks[k]==n then\n puts ans\n exit\n end\n next_rank=Array.new(104,0)\n 1.upto(k-1){|a|\n next_rank[a]+=[ranks[a]-1,0].max\n next_rank[a+1]+=[ranks[a],1].min\n }\n next_rank[k]+=ranks[k]\n ranks=next_rank\n ans+=1\nend\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":304} {"difficulty":1500,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"4ecbfc792da55f458342c6eff2d5da5a","execute_outcome":"RUNTIME_ERROR","source_code":"$n,$m=gets.split.map &:to_i\n$e=Array.new($n+1){[]}\n$m.times{a,b=gets.split.map &:to_i;$e[a]<2&&$n==$m&&dfs(1) ? \"FHTAGN!\" : \"NO\"","description":"...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...Whereas on the other end of the world Pentagon is actively collecting information trying to predict the monster's behavior and preparing the secret super weapon. Due to high seismic activity and poor weather conditions the satellites haven't yet been able to make clear shots of the monster. The analysis of the first shot resulted in an undirected graph with n vertices and m edges. Now the world's best minds are about to determine whether this graph can be regarded as Cthulhu or not.To add simplicity, let's suppose that Cthulhu looks from the space like some spherical body with tentacles attached to it. Formally, we shall regard as Cthulhu such an undirected graph that can be represented as a set of three or more rooted trees, whose roots are connected by a simple cycle.It is guaranteed that the graph contains no multiple edges and self-loops. ","input_specification":"The first line contains two integers \u2014 the number of vertices n and the number of edges m of the graph (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 0\u2009\u2264\u2009m\u2009\u2264\u2009). Each of the following m lines contains a pair of integers x and y, that show that an edge exists between vertices x and y (1\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009n,\u2009x\u2009\u2260\u2009y). For each pair of vertices there will be at most one edge between them, no edge connects a vertex to itself.","output_specification":"Print \"NO\", if the graph is not Cthulhu and \"FHTAGN!\" if it is.","notes":"NoteLet us denote as a simple cycle a set of v vertices that can be numbered so that the edges will only exist between vertices number 1 and 2, 2 and 3, ..., v\u2009-\u20091 and v, v and 1.A tree is a connected undirected graph consisting of n vertices and n\u2009-\u20091 edges (n\u2009>\u20090).A rooted tree is a tree where one vertex is selected to be the root.","sample_inputs":["6 6\n6 3\n6 4\n5 1\n2 5\n1 4\n5 4","6 5\n5 6\n4 6\n3 1\n5 1\n1 2"],"sample_outputs":["FHTAGN!","NO"],"human_solution":"n,m = gets.split(' ').map(&:to_i)\n\nsm = [];\nn.times do |i| sm[i] = [] end\n\nm.times do\n a,b = gets.split(' ').map(&:to_i)\n a -= 1\n b -= 1\n sm[a][b] = 1\nend\n\np = []\n$q = 0\ndef rec(id,p,sm,n)\n p[id] |= 0\n if p[id] == 1 then return end\n p[id] = 1\n $q += 1\n n.times do |i|\n sm[id][i] |= 0\n if sm[id][i] == 1 or sm[i][id] == 1 then\n rec(i,p,sm,n)\n end\n end\nend\n\nrec(0,p,sm,n)\nif($q == n and $q == m) then puts('FHTAGN!');\nelse puts('NO');\nend\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":305} {"difficulty":1100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/ruby\ngets\ns=gets.chomp\nloop{\n\tt=s.dup\n\tt.size.times{|i|\n\t\tr=0= a[i-1]\n s1[i] = s1[i-1]+1\n end\nend\n\ns2 = [0]*n\n(n-2).downto(1) do |i|\n if a[i] >= a[i+1]\n s2[i] = s2[i+1]+1\n end\nend\n\np s1.zip(s2).map{|x,y| x+y+1}.max\n","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"],"human_solution":"n=gets.to_i\na=[nil,]\nm=1\na+=gets.split.map{|v| v.to_i}\n\nfor i in 1..n do\n c=1\n (i+1..n).each do |j|\n\tif a[j]<=a[j-1] then c+=1\n\telse break\n\tend\n end\n \n (1..i-1).reverse_each do |j|\n if a[j]<=a[j+1] then c+=1\n\telse break\n\tend\n end\n \n if c>m then num=i; m=c; end\nend\n\nputs m","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":307} {"difficulty":1500,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"5e055bad1da5bdc84599d6f2f89fbd12","execute_outcome":"RUNTIME_ERROR","source_code":"s2 = (gets.to_i+1)\/2\na = gets(p).scan(\/(\\S+) (\\S+)\/)\naf,al = a.transpose\n\nas = a.flatten.sort.each_slice(a.size\/2).map(&:first)\nx = as.select{ |i|\n a.count{ |j,k| j == i || k == i } >= s2\n}\n\np x.empty? ? -1 : [(\n a1 = af.group_by{|i|i}\n s2 - x.map{ |i| a1[i] ? a1[i].size : 0 }.max\n #s2 - x.map{ |i| af.count i }.max\n), 0].max","description":"The Little Elephant loves to play with color cards.He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. The Little Elephant thinks that a set of cards on the table is funny if at least half of the cards have the same color (for each card the color of the upper side is considered).Help the Little Elephant to find the minimum number of moves needed to make the set of n cards funny.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of the cards. The following n lines contain the description of all cards, one card per line. The cards are described by a pair of positive integers not exceeding 109 \u2014 colors of both sides. The first number in a line is the color of the front of the card, the second one \u2014 of the back. The color of the front of the card may coincide with the color of the back of the card. The numbers in the lines are separated by single spaces.","output_specification":"On a single line print a single integer \u2014 the sought minimum number of moves. If it is impossible to make the set funny, print -1.","notes":"NoteIn the first sample there initially are three cards lying with colors 4, 4, 7. Since two of the three cards are of the same color 4, you do not need to change anything, so the answer is 0.In the second sample, you can turn the first and the fourth cards. After that three of the five cards will be of color 7.","sample_inputs":["3\n4 7\n4 7\n7 4","5\n4 7\n7 4\n2 11\n9 7\n1 1"],"sample_outputs":["0","2"],"human_solution":"s=(gets.to_i+1)\/2\na=gets(p).scan \/(\\S+) (.+)\/\nx=a.flatten.sort.each_slice([a.size\/2,1].max).map(&:first).select{|i|a.count{|j,k|j==i||k==i}>=s}\np x[0]?[s-x.map{|i|a.map(&:first).count i}.max,0].max: -1\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":308} {"difficulty":1100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"RUNTIME_ERROR","source_code":"k = gets.chomp.split(\" \")\nn = k[0].to_i\nb = k[1].to_f\nm = gets.chomp.split(\" \")\nsum = 0\n\nfor i in(0..n-1)\n\tm[i] = m[i].to_f\n\tsum += m[i]\nend\n\n\n\nfor i in(0..n-1)\n\tif b\/n < m[i] then\n\t\tputs -1\n\t\tbreak\n\tend\n\n\tm[i] = (b+sum)\/n - m[i]\n\tputs m[i]\nend","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"],"human_solution":"n,b = gets.chomp.split(\/ \/).map!{|x| x.to_i}\na = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nma = a.max\naf = []\nwk = 0\nfor i in 0..a.length-1\n af << (ma - a[i])\n wk += af[i]\nend\nif wk > b\n puts \"-1\"\nelse\n wkf = (b - wk).to_f \/ a.length\n for i in 0..af.length-1\n puts format(\"%.6f\",(wkf+af[i]))\n end\nend\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":309} {"difficulty":1300,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"6cfd3b0a403212ec68bac1667bce9ef1","execute_outcome":"RUNTIME_ERROR","source_code":"require 'pry'\ndef read_ints; gets.chomp.split.map(&:to_i) end\nn = read_ints[0]\ncurrent = 0\nmax = 0\ncurrent_stack = []\nn.times do\n\tline = gets.chomp.split\n\tif(line[0]=='+')\n\t\t#new man come\n\t\tcurrent+=1\n\t\tcurrent_stack<max\n\telse\n\t\t#man come out\n\t\tman_id = line[1].to_i\n\t\tif(current_stack.include? man_id)\n\t\t\tcurrent_stack.delete(man_id)\n\t\t\tcurrent-=1\n\t\telse #was there from begging\n\t\t\tmax+=1\n\t\tend\n\tend\nend\nputs max","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"],"human_solution":"#!\/usr\/bin\/ruby\nh={}\ncap=cur=0\ngets.to_i.times{\n\tx,y=gets.split\n\ty=y.to_i\n\tif x=='+' && !h[y]\n\t\tcur+=1\n\t\th[y]=1\n\telsif x=='-' && h[y]\n\t\tcur-=1\n\t\th[y]=nil\n\telsif x=='-' && !h[y]\n\t\tcap+=1\n\tend\n\tcap=[cap,cur].max\n}\np cap","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":310} {"difficulty":1100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"RUNTIME_ERROR","source_code":"gets\nw=gets\nif w.size%2==0\n\tputs w.scan(\/..\/)*'-'\nelse\n\tputs [w[0,3],*w[3..-1].scan(\/..\/)]*'-'\nend","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"],"human_solution":"d=gets.to_i\nw=gets\nif d%2==0\n\tputs w.scan(\/..\/)*'-'\nelse\n\tputs [w[0,3],*w[3..-1].scan(\/..\/)]*'-'\nend","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":311} {"difficulty":800,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"WRONG_ANSWER","source_code":"n, j = gets.to_i, 1; (1...n).each { |i| puts (j+=i)%n }","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"],"human_solution":"puts (1...n=gets.to_i).map{|i|i*(i+1)\/2%n+1}*' '\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":312} {"difficulty":1500,"lang":"Ruby 3","lang_cluster":"Ruby","src_uid":"75_B","execute_outcome":"WRONG_ANSWER","source_code":"\r\n\r\n\r\n\r\n\r\n\r\nname = gets.chomp\r\nnumb = gets.to_i\r\n\r\ns_hash = Hash.new\r\narr = []\r\nnumb.times do |j|\r\n\tl = \"\"\r\n\tt = \"\"\r\n\ts = gets.chomp\r\n\tn = s.size - 1\r\n\tcnt = 0\r\n\tfor i in 1..n\r\n\t\tif s[i] == ' '\r\n\t\t\tl = s[0,i]\r\n\t\t\tbreak\r\n\t\tend\r\n\tend\r\n\tm = l.size \r\n\tif s[m + 1,6] == \"posted\"\r\n\t\tfor i in (m + 11)..n\r\n\t\t\tif s[i] == ' '\r\n\t\t\t\tt = s[m + 11,i - m - 13]\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\tend\r\n\t\tputs t\r\n\t\tif t == name or l == name\r\n\t\t\tcnt = 15\r\n\t\tend\r\n\t\tif s_hash[\"#{l}\"] == nil and l != name\r\n\t\t\tarr << l\r\n\t\tend\r\n\r\n\t\tif s_hash[\"#{t}\"] == nil and t != name\r\n\t\t\tarr << t\r\n\t\tend\r\n\r\n\t\ts_hash[\"#{l}\"] = s_hash[\"#{l}\"].to_i + cnt\r\n\t\ts_hash[\"#{t}\"] = s_hash[\"#{t}\"].to_i + cnt\r\n\tend\r\n\r\n\tif s[m + 1,9] == \"commented\"\r\n\t\tfor i in (m + 14)..n\r\n\t\t\tif s[i] == ' '\r\n\t\t\t\tt = s[m + 14,i - m - 16]\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\tif t == name or l == name\r\n\t\t\tcnt = 10\r\n\t\tend\r\n\t\tif s_hash[\"#{l}\"] == nil and l != name\r\n\t\t\tarr << l\r\n\t\tend\r\n\r\n\t\tif s_hash[\"#{t}\"] == nil and t != name\r\n\t\t\tarr << t\r\n\t\tend\r\n\r\n\t\ts_hash[\"#{l}\"] = s_hash[\"#{l}\"].to_i + cnt\r\n\t\ts_hash[\"#{t}\"] = s_hash[\"#{t}\"].to_i + cnt\r\n\tend\r\n\r\n\t\tif s[m + 1,5] == \"likes\"\r\n\t\tfor i in (m + 7)..n\r\n\t\t\tif s[i] == ' '\r\n\t\t\t\tt = s[m + 7,i - m - 9]\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\tend\r\n\t\tif t == name or l == name\r\n\t\t\tcnt = 5\r\n\t\tend\r\n\t\tif s_hash[\"#{l}\"] == nil and l != name\r\n\t\t\tarr << l\r\n\t\tend\r\n\r\n\t\tif s_hash[\"#{t}\"] == nil and t != name\r\n\t\t\tarr << t\r\n\t\tend\r\n\r\n\t\ts_hash[\"#{l}\"] = s_hash[\"#{l}\"].to_i + cnt\r\n\t\ts_hash[\"#{t}\"] = s_hash[\"#{t}\"].to_i + cnt\r\n\tend\r\n\r\n\t\r\n\t\r\nend\r\n\r\narr.sort!\r\n\r\n\r\narr.sort_by! {|element| [-s_hash[\"#{element}\"].to_i, -element] }\r\n\r\nc = arr.size\r\n\r\n\r\nc.times do |i|\r\n\tputs arr[i]\r\nend\r\n\r\n","description":"Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described).This priority factor will be affected by three types of actions: 1. \"X posted on Y's wall\" (15 points), 2. \"X commented on Y's post\" (10 points), 3. \"X likes Y's post\" (5 points). X and Y will be two distinct names. And each action will increase the priority factor between X and Y (and vice versa) by the above value of points (the priority factor between X and Y is the same as the priority factor between Y and X).You will be given n actions with the above format (without the action number and the number of points), and you have to print all the distinct names in these actions sorted according to the priority factor with you.","input_specification":"The first line contains your name. The second line contains an integer n, which is the number of actions (1\u2264n\u2264100). Then n lines follow, it is guaranteed that each one contains exactly 1 action in the format given above. There is exactly one space between each two words in a line, and there are no extra spaces. All the letters are lowercase. All names in the input will consist of at least 1 letter and at most 10 small Latin letters.\n","output_specification":"Print m lines, where m is the number of distinct names in the input (excluding yourself). Each line should contain just 1 name. The names should be sorted according to the priority factor with you in the descending order (the highest priority factor should come first). If two or more names have the same priority factor, print them in the alphabetical (lexicographical) order.\nNote, that you should output all the names that are present in the input data (excluding yourself), even if that person has a zero priority factor.\nThe lexicographical comparison is performed by the standard \"<\" operator in modern programming languages. The line a is lexicographically smaller than the line b, if either a is the prefix of b, or if exists such an i (1\u2264i\u2264min(|a|,|b|)), that ai 12\n hour %= 10\n hour = 10 if hour == 0\nelsif format == 24 and hour >= 24\n hour %= 10\nend\nif minute >= 60\n minute %= 10\nend\nputs \"%02d:%02d\" % [hour, minute]\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":314} {"difficulty":1400,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"8a9adc116abbd387a6a64dd754436f8a","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/ruby\na,b,n=gets.split.map(&:to_i)\nif a==0\n\tputs b==0 ? 1 : 'No solution'\n\texit\nend\nif a<0 then a=-a;b=-b end\nsign=1\nif b<0\n\tsign=-1 if n.odd?\n\tb=-b\nend\nr=(b.to_f\/a)**(1.0\/n)+1e-7\nif (r-r.to_i).abs>1e-7 then puts 'No solution';exit end\np r.to_i*sign","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"],"human_solution":"mas = gets.split(\" \")\na = mas[0].to_i\nb = mas[1].to_i\nn = mas[2].to_i\n\nif (a == 0 && b == 0)\n puts 5\n exit\nend\n\nif ((a == 0) || (b % a != 0) || (b \/ a < 0 && n % 2 == 0))\n puts \"No solution\"\n exit\nend\n\nresult = ((b\/a).abs)**(1.0\/n)\n\n# \/b\/erd\nif (result - result.round).abs < 0.000000001\n if (b\/a < 0)\n print \"-\"\n end\n print result.round.to_s.split(\".\")[0]\nelse\n puts \"No solution\"\nend\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":315} {"difficulty":1500,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"9642368dc4ffe2fc6fe6438c7406c1bd","execute_outcome":"RUNTIME_ERROR","source_code":"def solve(a)\n return a if a < 10\n l, r = a, a % 10\n while l >= 10\n l \/= 10\n end\n ans = a \/ 10 + 9\n ans -= 1 if r > l\n return ans\nend\n\nl, r = gets.split.map { |i| i.to_i }\nputs solve(r) - solve(rl - 1)\n","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"],"human_solution":"l,r = gets.split\n\nk=0\n\nl1 = l.clone\nr1 = r.clone\n\nl1[-1] = l1[0]\nif l1.to_ir.to_i then\n r1=(r1.to_i-10).to_s\n r1[-1]=r1[0]\nend\n\ndef count(b,e,x)\n (e-b+1)*(10**([x-2 ,0].max))\nend\n\ndef ans(s)\n z=0\n (1..s.length-1).each do |por|\n z+=count(1,9,por) \n end\n z+=count(1,s[0].to_i-1,s.length)+s[1..-2].to_i+1\nend\nk+=ans(r1)\nk-=ans(l1)\nk+=1\nputs k\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":316} {"difficulty":1400,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"RUNTIME_ERROR","source_code":"n,l=gets.split.map(&:to_i)\nans=0\na=gets.split.map(&:to_i)\na.each{|b|\n ans+=b\/l\n}\np ans*l\n","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"n,l = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nar = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nar.sort!\nar.reverse!\nmaxsum = 0\nfor j in l..ar[0]\n\tsum = 0\n\tfor i in 0..ar.length-1\n\t\tif ar[i] >= j\n\t\t\tdv = ar[i] \/ j\n\t\t\tsum += dv * j\n\t\tend\n\tend\n\tmaxsum = sum if maxsum < sum\nend\nputs maxsum","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":317} {"difficulty":800,"lang":"Ruby 3","lang_cluster":"Ruby","src_uid":"99_A","execute_outcome":"WRONG_ANSWER","source_code":"x, y = gets.strip.split(?.)\r\nif x % 10 == 9\r\n puts 'GOTO Vasilisa.'\r\nelse\r\n puts x.to_i + (y[0] > ?4 ? 1 : 0)\r\nend","description":"In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the Kingdom healers had already had three appointments with the merchants who were asked to sell, say, exactly 0.273549107 beer barrels. To deal with the problem somehow, the King issued an order obliging rounding up all numbers to the closest integer to simplify calculations. Specifically, the order went like this: If a number's integer part does not end with digit 9 and its fractional part is strictly less than 0.5, then the rounded up number coincides with the number\u2019s integer part. If a number's integer part does not end with digit 9 and its fractional part is not less than 0.5, the rounded up number is obtained if we add 1 to the last digit of the number\u2019s integer part. If the number\u2019s integer part ends with digit 9, to round up the numbers one should go to Vasilisa the Wise. In the whole Kingdom she is the only one who can perform the tricky operation of carrying into the next position. Merchants found the algorithm very sophisticated and they asked you (the ACMers) to help them. Can you write a program that would perform the rounding according to the King\u2019s order?","input_specification":"The first line contains a single number to round up \u2014 the integer part (a non-empty set of decimal digits that do not start with 0 \u2014 with the exception of a case when the set consists of a single digit \u2014 in this case 0 can go first), then follows character \u00ab.\u00bb (a dot), and then follows the fractional part (any non-empty set of decimal digits). The number's length does not exceed 1000 characters, including the dot. There are no other characters in the input data.\n","output_specification":"If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message \"GOTO Vasilisa.\" (without the quotes).\n","notes":null,"sample_inputs":["0.0\n","1.49\n","1.50\n","2.71828182845904523536\n","3.14159265358979323846\n","12345678901234567890.1\n","123456789123456789.999\n"],"sample_outputs":["0","1","2","3","3","12345678901234567890","GOTO Vasilisa."],"human_solution":"x, y = gets.strip.split(?.); x = x.to_i\r\nputs x % 10 == 9 ? 'GOTO Vasilisa.' : x + (y[0] > ?4 ? 1 : 0)","testcases":"[{'input': ['0.0\\r\\n'], 'output': ['0']}, {'input': ['1.49\\r\\n'], 'output': ['1']}, {'input': ['1.50\\r\\n'], 'output': ['2']}, {'input': ['2.71828182845904523536\\r\\n'], 'output': ['3']}, {'input': ['3.14159265358979323846\\r\\n'], 'output': ['3']}, {'input': ['12345678901234567890.1\\r\\n'], 'output': ['12345678901234567890']}, {'input': ['123456789123456789.999\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['12345678901234567890.9\\r\\n'], 'output': ['12345678901234567891']}, {'input': ['123456789123456788.999\\r\\n'], 'output': ['123456789123456789']}, {'input': ['9.000\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['0.1\\r\\n'], 'output': ['0']}, {'input': ['0.2\\r\\n'], 'output': ['0']}, {'input': ['0.3\\r\\n'], 'output': ['0']}, {'input': ['0.4\\r\\n'], 'output': ['0']}, {'input': ['0.5\\r\\n'], 'output': ['1']}, {'input': ['0.6\\r\\n'], 'output': ['1']}, {'input': ['0.7\\r\\n'], 'output': ['1']}, {'input': ['0.8\\r\\n'], 'output': ['1']}, {'input': ['0.9\\r\\n'], 'output': ['1']}, {'input': ['1.0\\r\\n'], 'output': ['1']}, {'input': ['1.1\\r\\n'], 'output': ['1']}, {'input': ['1.2\\r\\n'], 'output': ['1']}, {'input': ['1.3\\r\\n'], 'output': ['1']}, {'input': ['1.4\\r\\n'], 'output': ['1']}, {'input': ['1.5\\r\\n'], 'output': ['2']}, {'input': ['1.6\\r\\n'], 'output': ['2']}, {'input': ['1.7\\r\\n'], 'output': ['2']}, {'input': ['1.8\\r\\n'], 'output': ['2']}, {'input': ['1.9\\r\\n'], 'output': ['2']}, {'input': ['2.0\\r\\n'], 'output': ['2']}, {'input': ['2.1\\r\\n'], 'output': ['2']}, {'input': ['2.2\\r\\n'], 'output': ['2']}, {'input': ['2.3\\r\\n'], 'output': ['2']}, {'input': ['2.4\\r\\n'], 'output': ['2']}, {'input': ['2.5\\r\\n'], 'output': ['3']}, {'input': ['2.6\\r\\n'], 'output': ['3']}, {'input': ['2.7\\r\\n'], 'output': ['3']}, {'input': ['2.8\\r\\n'], 'output': ['3']}, {'input': ['2.9\\r\\n'], 'output': ['3']}, {'input': ['3.0\\r\\n'], 'output': ['3']}, {'input': ['3.1\\r\\n'], 'output': ['3']}, {'input': ['3.2\\r\\n'], 'output': ['3']}, {'input': ['3.3\\r\\n'], 'output': ['3']}, {'input': ['3.4\\r\\n'], 'output': ['3']}, {'input': ['3.5\\r\\n'], 'output': ['4']}, {'input': ['3.6\\r\\n'], 'output': ['4']}, {'input': ['3.7\\r\\n'], 'output': ['4']}, {'input': ['3.8\\r\\n'], 'output': ['4']}, {'input': ['3.9\\r\\n'], 'output': ['4']}, {'input': ['4.0\\r\\n'], 'output': ['4']}, {'input': ['4.1\\r\\n'], 'output': ['4']}, {'input': ['4.2\\r\\n'], 'output': ['4']}, {'input': ['4.3\\r\\n'], 'output': ['4']}, {'input': ['4.4\\r\\n'], 'output': ['4']}, {'input': ['4.5\\r\\n'], 'output': ['5']}, {'input': ['4.6\\r\\n'], 'output': ['5']}, {'input': ['4.7\\r\\n'], 'output': ['5']}, {'input': ['4.8\\r\\n'], 'output': ['5']}, {'input': ['4.9\\r\\n'], 'output': ['5']}, {'input': ['5.0\\r\\n'], 'output': ['5']}, {'input': ['5.1\\r\\n'], 'output': ['5']}, {'input': ['5.2\\r\\n'], 'output': ['5']}, {'input': ['5.3\\r\\n'], 'output': ['5']}, {'input': ['5.4\\r\\n'], 'output': ['5']}, {'input': ['5.5\\r\\n'], 'output': ['6']}, {'input': ['5.6\\r\\n'], 'output': ['6']}, {'input': ['5.7\\r\\n'], 'output': ['6']}, {'input': ['5.8\\r\\n'], 'output': ['6']}, {'input': ['5.9\\r\\n'], 'output': ['6']}, {'input': ['6.0\\r\\n'], 'output': ['6']}, {'input': ['6.1\\r\\n'], 'output': ['6']}, {'input': ['6.2\\r\\n'], 'output': ['6']}, {'input': ['6.3\\r\\n'], 'output': ['6']}, {'input': ['6.4\\r\\n'], 'output': ['6']}, {'input': ['6.5\\r\\n'], 'output': ['7']}, {'input': ['6.6\\r\\n'], 'output': ['7']}, {'input': ['6.7\\r\\n'], 'output': ['7']}, {'input': ['6.8\\r\\n'], 'output': ['7']}, {'input': ['6.9\\r\\n'], 'output': ['7']}, {'input': ['7.0\\r\\n'], 'output': ['7']}, {'input': ['7.1\\r\\n'], 'output': ['7']}, {'input': ['7.2\\r\\n'], 'output': ['7']}, {'input': ['7.3\\r\\n'], 'output': ['7']}, {'input': ['7.4\\r\\n'], 'output': ['7']}, {'input': ['7.5\\r\\n'], 'output': ['8']}, {'input': ['7.6\\r\\n'], 'output': ['8']}, {'input': ['7.7\\r\\n'], 'output': ['8']}, {'input': ['7.8\\r\\n'], 'output': ['8']}, {'input': ['7.9\\r\\n'], 'output': ['8']}, {'input': ['8.0\\r\\n'], 'output': ['8']}, {'input': ['8.1\\r\\n'], 'output': ['8']}, {'input': ['8.2\\r\\n'], 'output': ['8']}, {'input': ['8.3\\r\\n'], 'output': ['8']}, {'input': ['8.4\\r\\n'], 'output': ['8']}, {'input': ['8.5\\r\\n'], 'output': ['9']}, {'input': ['8.6\\r\\n'], 'output': ['9']}, {'input': ['8.7\\r\\n'], 'output': ['9']}, {'input': ['8.8\\r\\n'], 'output': ['9']}, {'input': ['8.9\\r\\n'], 'output': ['9']}, {'input': ['9.0\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.1\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.2\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.3\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.4\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.5\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.6\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.7\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.8\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['9.9\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['609942239104813108618306232517836377583566292129955473517174437591594761209877970062547641606473593416245554763832875919009472288995880898848455284062760160557686724163817329189799336769669146848904803188614226720978399787805489531837751080926098.1664915772983166314490532653577560222779830866949001942720729759794777105570672781798092416748052690224813237139640723361527601154465287615917169132637313918577673651098507390501962\\r\\n'], 'output': ['609942239104813108618306232517836377583566292129955473517174437591594761209877970062547641606473593416245554763832875919009472288995880898848455284062760160557686724163817329189799336769669146848904803188614226720978399787805489531837751080926098']}, {'input': ['7002108534951820589946967018226114921984364117669853212254634761258884835434844673935047882480101006606512119541798298905598015607366335061012709906661245805358900665571472645463994925687210711492820804158354236327017974683658305043146543214454877759341394.20211856263503281388748282682120712214711232598021393495443628276945042110862480888110959179019986486690931930108026302665438087068150666835901617457150158918705186964935221768346957536540345814875615118637945520917367155931078965\\r\\n'], 'output': ['7002108534951820589946967018226114921984364117669853212254634761258884835434844673935047882480101006606512119541798298905598015607366335061012709906661245805358900665571472645463994925687210711492820804158354236327017974683658305043146543214454877759341394']}, {'input': ['1950583094879039694852660558765931995628486712128191844305265555887022812284005463780616067.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['1950583094879039694852660558765931995628486712128191844305265555887022812284005463780616068']}, {'input': ['718130341896330596635811874410345440628950330.500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['718130341896330596635811874410345440628950331']}, {'input': ['927925904158088313481229162503626281882161630091489367140850985555900173018122871746924067186432044676083646964286435457446768031295712712803570690846298544912543439221596866052681116386179629036945370280722.500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['927925904158088313481229162503626281882161630091489367140850985555900173018122871746924067186432044676083646964286435457446768031295712712803570690846298544912543439221596866052681116386179629036945370280723']}, {'input': ['68289614863244584294178637364598054554769889.500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['7536521504744364134984603189602839063535643888645969434165019366202558753840519.4999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['646188694587964249318078225173.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['646188694587964249318078225174']}, {'input': ['7017472758334494297677068672222822550374695787171163207025095950296957261530.50\\r\\n'], 'output': ['7017472758334494297677068672222822550374695787171163207025095950296957261531']}, {'input': ['259085737066615534998640212505663524594409165063310128108448186246980628179842202905722595400477937071746695941939306735605849342959111887834258250883469840846714848774368.50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['259085737066615534998640212505663524594409165063310128108448186246980628179842202905722595400477937071746695941939306735605849342959111887834258250883469840846714848774369']}, {'input': ['682500858233333594535201113441004740771119672961581796618069185960107115823662126812159957094407454522028503739299.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['GOTO Vasilisa.']}, {'input': ['41203422675619090661099806687619.49999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['GOTO Vasilisa.']}]","id":318} {"difficulty":1400,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"9c30697e71102ae10c55c14d9c1db006","execute_outcome":"WRONG_ANSWER","source_code":"ss = gets.chomp\nif ss.slice(ss.length-1) == \".\"\n puts \"NO\"\n exit\nend\ns = ss.split(\".\")\nret = []\npp = \"\"\nfor i in 0..s.length-1\n if s[i].length <= 0\n ret = nil\n break\n end\n if i == 0\n if s[i].length > 8\n ret = nil\n break\n end\n pp = s[i]\n elsif i == s.length-1\n if s[i].length > 3\n ret = nil\n break\n end\n ret << pp + \".\" + s[i]\n else\n if s[i].length > 11 || s[i].length <= 1\n ret = nil\n break\n end\n if s[i].length == 2\n ret << pp + \".\" + s[i].slice(0,1)\n pp = s[i].slice(1,1)\n elsif s[i].length == 3\n ret << pp + \".\" + s[i].slice(0,2)\n pp = s[i].slice(2,1)\n else\n ret << pp + \".\" + s[i].slice(0,3)\n pp = s[i].slice(3,s[i].length-3)\n end\n end\nend\n\nif ret == nil\n puts \"NO\"\nelse\n puts \"YES\"\n for i in 0..ret.length-1\n puts ret[i]\n end\nend\n\n\n","description":"Eudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that each file name has a form \"name.ext\", where: name is a string consisting of lowercase Latin letters, its length is from 1 to 8 characters; ext is a string consisting of lowercase Latin letters, its length is from 1 to 3 characters. For example, \"read.me\", \"example.txt\" and \"b.cpp\" are valid file names and \"version.info\", \"ntldr\" and \"contestdata.zip\" are not.Damage to the list meant that all the file names were recorded one after another, without any separators. So now Eudokimus has a single string.Eudokimus needs to set everything right as soon as possible. He should divide the resulting string into parts so that each part would be a valid file name in BerFS. Since Eudokimus has already proved that he is not good at programming, help him. The resulting file list can contain the same file names.","input_specification":"The input data consists of a single string s, its length is from 1 to 4\u00b7105 characters. The string can contain only lowercase Latin letters ('a' - 'z') and periods ('.').","output_specification":"In the first line print \"YES\" (without the quotes), if it is possible to divide s into parts as required. In this case, the following lines should contain the parts of the required partition, one per line in the order in which they appear in s. The required partition can contain the same file names. If there are multiple solutions, print any of them. If the solution does not exist, then print in a single line \"NO\" (without the quotes).","notes":null,"sample_inputs":["read.meexample.txtb.cpp","version.infontldrcontestdata.zip"],"sample_outputs":["YES\nread.m\neexample.t\nxtb.cpp","NO"],"human_solution":"s = gets.chop\na = (s + '_' * 8).split('.')\nif s[-1] != '.' && a.size > 1 && (1..8).cover?(a[0].size) && a[1..-1].all?{|_| (2..11).cover?(_.size)}\n puts :YES\n (1...a.size).each do |i|\n n = [1, a[i].size - 8].max\n puts \"#{a[i - 1]}.#{a[i].slice!(0, n)}\"\n end\nelse\n puts :NO\nend\n","testcases":"[{'input': 'read.meexample.txtb.cpp\\r\\n', 'output': ['YES\\r\\nread.m\\r\\neexample.t\\r\\nxtb.cpp\\r\\n']}, {'input': 'version.infontldrcontestdata.zip\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'thisis.text.txt\\r\\n', 'output': ['YES\\r\\nthisis.t\\r\\next.txt\\r\\n']}, {'input': 'oops.t\\r\\n', 'output': ['YES\\r\\noops.t\\r\\n']}, {'input': 'thisislongfilename\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'double..dot\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'one.one.one.one.one.one.one.one.one.one\\r\\n', 'output': ['YES\\r\\none.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.o\\r\\nne.one\\r\\n']}, {'input': '.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'z\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'za\\r\\n', 'output': ['NO\\r\\n']}, {'input': '..\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'xlq\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.r.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'ulmc\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'nja.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 't..kz\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'twaha\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'm..dw.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'utsvfg.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.we.voae\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'kw.gkcxk.\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.c.v.hpehh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'akymwh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'jx.lqv.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'qkwtq.zw\\r\\n', 'output': ['YES\\r\\nqkwtq.zw\\r\\n']}, {'input': 'yxwvlk..b\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'ph..qlr.pt\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'cab.ab.bac\\r\\n', 'output': ['YES\\r\\ncab.a\\r\\nb.bac\\r\\n']}, {'input': 'badaba.ae\\r\\n', 'output': ['YES\\r\\nbadaba.ae\\r\\n']}, {'input': 'badabaca.mor\\r\\n', 'output': ['YES\\r\\nbadabaca.mor\\r\\n']}, {'input': 'bae.a\\r\\n', 'output': ['YES\\r\\nbae.a\\r\\n']}, {'input': 'b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\\r\\n', 'output': ['YES\\r\\nb.b\\r\\naba.e\\r\\nbpbac.i\\r\\nabaeabac.a\\r\\nbab.a\\r\\ndabacaba.a\\r\\nhcggibij.a\\r\\ndaacab.e\\r\\nbaba.a\\r\\na.a\\r\\nbacaba.d\\r\\nacabada.d\\r\\naqjcpc.j\\r\\nadab.dab\\r\\n']}, {'input': '.ab\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aa.aa.aaaabbbbccc.ddd.ee\\r\\n', 'output': ['YES\\r\\naa.a\\r\\na.aaa\\r\\nabbbbccc.d\\r\\ndd.ee\\r\\n']}, {'input': 'a.aaaa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaread.meexample.txtb.cpp\\r\\n', 'output': ['YES\\r\\naaaaread.m\\r\\neexample.t\\r\\nxtb.cpp\\r\\n']}, {'input': 'abcdabcd.a\\r\\n', 'output': ['YES\\r\\nabcdabcd.a\\r\\n']}, {'input': 'qwertyuio.qwe\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'asd.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaaaaa.\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.txtaaaaaaaaa.txt\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.abcde.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.abc.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abcdefgh.aaaabcdefgh.bbb\\r\\n', 'output': ['YES\\r\\nabcdefgh.aaa\\r\\nabcdefgh.bbb\\r\\n']}, {'input': 'filename.exe\\r\\n', 'output': ['YES\\r\\nfilename.exe\\r\\n']}, {'input': '.abcd.cpp\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abc.bcdabcdabcd.abc\\r\\n', 'output': ['YES\\r\\nabc.bcd\\r\\nabcdabcd.abc\\r\\n']}, {'input': 'abc.abcde\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.cp\\r\\n', 'output': ['YES\\r\\na.cp\\r\\n']}, {'input': 'a.b.c\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.ha\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.a.a.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.a.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'qwertyui.cp\\r\\n', 'output': ['YES\\r\\nqwertyui.cp\\r\\n']}, {'input': 'ss.aaaaaaaaaaaa.aa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'name.extnamename.ext\\r\\n', 'output': ['YES\\r\\nname.ext\\r\\nnamename.ext\\r\\n']}, {'input': '.aaaa.aaa\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaa.a\\r\\n', 'output': ['NO\\r\\n']}, {'input': '.filena.exe\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'a.aaaaaaaaaaa.a\\r\\n', 'output': ['YES\\r\\na.aaa\\r\\naaaaaaaa.a\\r\\n']}, {'input': '.aa.w\\r\\n', 'output': ['NO\\r\\n']}]","id":319} {"difficulty":1100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"9c90974a0bb860a5e180760042fd5045","execute_outcome":"RUNTIME_ERROR","source_code":"#=================================\n# Better be sure than sorry. \n#=================================\n$stdin=File.open(\".\/input.txt\",\"r\") if ENV[\"LOGNAME\"]==\"skydos\"\nrequire 'prime'\nrequire 'mathn'\n#=================================\n\nn,m=gets.split.map(&:to_i)\n\nboard_main=[]\nboard_copy=[]\nn.times{\n\tline = gets.strip.split(\/\/)\n\tboard_main << line\n\tboard_copy << line.dup\n}\n\nfor i in 0...n\n\tfor j in 0...m\n\t\tch = board_main[i][j]\n\t\t\n\t\t# rows\n\t\tcount=0\n\t\tfor row_index in 0...n\n\t\t\tcount+=1 if board_main[row_index][j]==ch\n\t\tend\n\t\t\n\t\tif count!=1\n\t\t\tfor row_index in 0...n\n\t\t\t\tboard_copy[row_index][j]=\"_\" if board_main[row_index][j]==ch\n\t\t\tend\n\t\tend\n\t\t\n\t\t# cols\n\t\tcount=0\n\t\tfor col_index in 0...m\n\t\t\tcount+=1 if board_main[i][col_index]==ch\n\t\tend\n\t\t\n\t\tif count!=1\n\t\t\tfor col_index in 0...m\n\t\t\t\tboard_copy[i][col_index]=\"_\" if board_main[i][col_index]==ch\n\t\t\tend\n\t\tend\n\tend\nend\n\nfor i in 0...n\n\tfor j in 0...m\n\t\tprint board_copy[i][j]\n\tend\n\tputs\nend\n","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"],"human_solution":"n,m = gets.chomp.split(\/ \/).map!{|x| x.to_i}\nbd = Array.new(n)\nbdf = Array.new(n)\nfor i in 0..n-1\n\tbd[i] = gets.chomp.split(\/\/)\n\tbdf[i] = Array.new(m)\nend\n\nfor i in 0..n-1\n\tfor j in 0..m-1\n\t\tbdf[i][j] = true\n\tend\nend\n\nfor i in 0..n-1\n\th = Hash.new\n\tfor j in 0..m-1\n\t\tif h.key?(bd[i][j])\n\t\t\th[bd[i][j]] += 1\n\t\telse\n\t\t\th[bd[i][j]] = 1\n\t\tend\n\tend\n\tfor j in 0..m-1\n\t\tbdf[i][j] = false if h[bd[i][j]] > 1\n\tend\nend\n\nfor j in 0..m-1\n\th = Hash.new\n\tfor i in 0..n-1\n\t\tif h.key?(bd[i][j])\n\t\t\th[bd[i][j]] += 1\n\t\telse\n\t\t\th[bd[i][j]] = 1\n\t\tend\n\tend\n\tfor i in 0..n-1\n\t\tbdf[i][j] = false if h[bd[i][j]] > 1\n\tend\nend\n\nfor i in 0..n-1\n\tfor j in 0..m-1\n\t\tprint bd[i][j] if bdf[i][j] == true\n\tend\nend\n\nputs \"\"\n","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":320} {"difficulty":1400,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"a37df9b239a40473516d1525d56a0da7","execute_outcome":"WRONG_ANSWER","source_code":"inp = gets.split(\" \")\nn = inp[0].to_i\nm = inp[1].to_i\nl = Array.new(m){[]}\nfor i in 0..(n-1)\n inp = gets\n for j in 0..(m-1)\n l[j] << inp[j]\n end\nend\n\ncount = 1\nl.each do |arr|\n arr.sort!\n #p arr\n unq = 1\n curr = 0\n while curr < (n - 1)\n if arr[curr] != arr[curr+1]\n unq += 1\n\tend\n\tcurr += 1\n end\n #puts unq\n count *= unq\nend\n\nputs count","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"],"human_solution":"require 'set'\n\nn,m = gets.chomp.split(\/ \/).map!{|x| x.to_i}\ns = []\nfor i in 0..n-1\n\ts << gets.chomp\nend\nret = 1\nfor i in 0..m-1\n\tws = Set.new\n\tfor j in 0..n-1\n\t\tws.add(s[j][i])\n\tend\n\tret *= ws.length\nend\nret %= 1000000007\nputs ret","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":321} {"difficulty":1000,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"WRONG_ANSWER","source_code":"s, cnt, k = gets.chomp, Array.new(26, 0), gets.to_i\ns.chars {|c| cnt[c.ord - 97] += 1}\ncnt.reject! {|c| c.zero?}\nputs k > s.length ? :impossible : k - cnt.length\n","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"],"human_solution":"s=gets.chomp\nn=gets.to_i\nputs s.sizeb[0]}.each_cons(2){|(l,r)|amount+=r[0]-l[1]<=>t}\nputs amount+n-1\n","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"],"human_solution":"# Problem A\n# by vi002\n\nn, t = gets.split.map { |v| v.to_i }\ndata = Array.new(n) { gets.split.map { |v| v.to_i } }.sort\n\nresult = 2\n(0 ... n - 1).each do |pos|\n distance = 2 * (data[pos + 1].first - data[pos].first)\n distance -= data[pos][1] + data[pos + 1][1]\n result += 2 if distance > 2 * t\n result += 1 if distance == 2 * t\nend\n\nputs result\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":324} {"difficulty":1200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"class Drift\n attr_reader :x, :y\n attr_accessor :zone\n def initialize(x, y)\n @x = x\n @y = y\n @zone = nil;\n end\nend\n\nn = gets.to_i\nmap = Array.new(n)\nfor i in 0...n\n input = gets.split\n map[i] = Drift.new(input[0].to_i, input[1].to_i)\nend\n\nz = 0\nfor i in 0...n\n if map[i].zone == nil\n map[i].zone = z\n for j in (i+1)...n\n map[j].zone = z unless map[i].x != map[j].x && map[i].y != map[j].y\n end\n z += 1\n end\nend\nprint z-1","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"],"human_solution":"class Drift\n attr_reader :x, :y\n attr_accessor :zone, :adj\n def initialize(x, y)\n @x = x\n @y = y\n @zone = nil\n @adj = Array.new\n end\nend\n\nclass Map\n attr_accessor :d, :n\n def initialize\n @d = Array.new\n @n = 0\n end\n def add(x, y)\n d << Drift.new(x, y)\n for i in 0...@n\n if d[i].x == d[@n].x || d[i].y == d[@n].y\n d[i].adj << @n\n d[@n].adj << i\n end\n end\n @n += 1\n end\n def at(n)\n @d[n]\n end\n def dfs(n, z)\n d[n].zone = z\n for i in d[n].adj\n dfs(i, z) if d[i].zone == nil\n end\n end\nend\n\nn = gets.to_i\nmap = Map.new\nfor i in 0...n\n x, y = gets.split(\" \").map(&:to_i)\n map.add(x, y)\nend\nz = 0\nfor i in 0...map.n\n if map.at(i).zone == nil\n map.dfs(i, z)\n z += 1\n end\nend\nprint z-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":325} {"difficulty":1100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"d526af933b5afe9abfdf9815e9664144","execute_outcome":"RUNTIME_ERROR","source_code":"\ufeffn = gets.chomp.to_i\na = gets.chomp.split(\" \").map{|e| e.to_i}\n\na << 0\na << 0\n\ndays = 0\nloop do\n bang = false\n for i in 0 .. (n - 2) do\n bang = true if ! ((a[i] > 0 and (a[i + 1] > 0 or a[i + 2] > 0)) or (a[i] == 0 and a[i + 1] > 0)) \n end\n \n break if bang\n \n days += 1\n \n a.map!{|e|\n e > 0 ? e -= 1 : e\n } \nend\n\nputs days\n","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"],"human_solution":"\ufeffn = gets.chomp.to_i\na = gets.chomp.split(\" \").map{|e| e.to_i}\n\ndays = 0\nloop do\n break if a[0] == 0 or a[-1] == 0\n \n bang = false\n for i in 1 .. (n - 2) do\n bang = true if a[i] == 0 and a[i + 1] == 0\n end\n break if bang\n \n days += 1\n \n a.map!{|e|\n e > 0 ? e -= 1 : e\n } \nend\n\nputs days\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":326} {"difficulty":1200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"d90da1e932a6aa546bec4e1bd4b1fbec","execute_outcome":"RUNTIME_ERROR","source_code":"sn, sm = gets.chop.split(\/\\s+\/)\n\ncount = sn.to_i\ncountRelation = sm.to_i\n\ncosts = Array.new(0)\nscosts = gets.chop.split(\/\\s+\/)\n(0..count-1).each { |i|\n costs[i] = scosts[i].to_i\n}\n\nrelations = Array.new()\n(0..count-1).each { |i|\n relations[i] = Array.new()\n (0..count-1).each { |j|\n relations[i][j] = false\n }\n}\n\n(0..countRelation-1).each { |i|\n su, sv = gets.chop.split(\/\\s+\/)\n u = su.to_i - 1;\n v = sv.to_i - 1;\n relations[u][v] = true\n relations[v][u] = true\n}\n\nsolves = Array.new(0)\n\n(0..count-2).each { |row|\n (row..count-2).each { |col|\n if (relations[row][col] == true and relations[row][col+1] == true and relations[row+1][col+1] == true)\n solves[solves.length] = costs[row] + costs[col] + costs[col+1]\n end\n }\n}\n\nif (solves.length > 0)\n puts solves.min\nelse\n puts \"-1\"\nend","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"],"human_solution":"\nn,m=gets.split.map(&:to_i)\na=gets.split.map(&:to_i)\ng=Array.new(n){Array.new(n,0)}\nm.times{\n p,q=gets.split.map(&:to_i)\n g[p-1][q-1]=g[q-1][p-1]=1\n}\nans=9999999999\n0.upto(n-1){|i|\n (i+1).upto(n-1){|j|\n if g[i][j]==0 then\n next\n end\n (j+1).upto(n-1){|k|\n if g[i][k]==0 || g[j][k]==0 then\n next\n end\n ans=[ans,a[i]+a[j]+a[k]].min\n }\n }\n}\nputs (ans>=999999999)?-1:ans\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":327} {"difficulty":800,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","execute_outcome":"RUNTIME_ERROR","source_code":"tot, min, min_index, input = gets.to_i, 20000, -1, gets.split(' ').map{|n| n.to_i}\ninput.each_cons(2).to_a.each_with_index { |(a, b), index| min, min_index = (a - b).abs, index if (((a - b).abs) < min) }\nmin_index = tot - 1 if (min > (input[0] - input[input.length - 1]).abs)\nmax_index = (min_index == tot - 1) ? 0 : min_index + 1\np (min_index + 1).to_s + ' ' + (max_index + 1).to_s","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"],"human_solution":"n = gets.chomp.to_i\ns = gets.chomp\nsa = s.split(\/ \/)\nsa.map!{|x| x.to_i}\n\nmindiff = (sa[1]-sa[0]).abs\nminidx1 = 1\nminidx2 = 2\n\nfor i in 1..n-1\n\tj = i+1\n\tj = 0 if j >= n\n\twk = (sa[i]-sa[j]).abs\n\tif wk < mindiff\n\t\tmindiff = wk\n\t\tminidx1 = i+1\n\t\tminidx2 = j+1\n\tend\nend\n\nputs minidx1.to_s + \" \" + minidx2.to_s","testcases":"[{'input': '5\\r\\n10 12 13 15 10\\r\\n', 'output': ['5 1\\r\\n']}, {'input': '4\\r\\n10 20 30 40\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '6\\r\\n744 359 230 586 944 442\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '5\\r\\n826 747 849 687 437\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n999 999 993 969 999\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n4 24 6 1 15\\r\\n', 'output': ['3 4\\r\\n']}, {'input': '2\\r\\n511 32\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '3\\r\\n907 452 355\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['4 1\\r\\n']}, {'input': '10\\r\\n684 698 429 694 956 812 594 170 937 764\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '20\\r\\n646 840 437 946 640 564 936 917 487 752 844 734 468 969 674 646 728 642 514 695\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '30\\r\\n996 999 998 984 989 1000 996 993 1000 983 992 999 999 1000 979 992 987 1000 996 1000 1000 989 981 996 995 999 999 989 999 1000\\r\\n', 'output': ['12 13\\r\\n']}, {'input': '50\\r\\n93 27 28 4 5 78 59 24 19 134 31 128 118 36 90 32 32 1 44 32 33 13 31 10 12 25 38 50 25 12 4 22 28 53 48 83 4 25 57 31 71 24 8 7 28 86 23 80 101 58\\r\\n', 'output': ['16 17\\r\\n']}, {'input': '88\\r\\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 999 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 998 1000 1000 998 1000 999 1000 1000 1000 1000\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '99\\r\\n4 4 21 6 5 3 13 2 6 1 3 4 1 3 1 9 11 1 6 17 4 5 20 4 1 9 5 11 3 4 14 1 3 3 1 4 3 5 27 1 1 2 10 7 11 4 19 7 11 6 11 13 3 1 10 7 2 1 16 1 9 4 29 13 2 12 14 2 21 1 9 8 26 12 12 5 2 14 7 8 8 8 9 4 12 2 6 6 7 16 8 14 2 10 20 15 3 7 4\\r\\n', 'output': ['1 2\\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': ['86 87\\r\\n']}, {'input': '100\\r\\n31 75 86 68 111 27 22 22 26 30 54 163 107 75 160 122 14 23 17 26 27 20 43 58 59 71 21 148 9 32 43 91 133 286 132 70 90 156 84 14 77 93 23 18 13 72 18 131 33 28 72 175 30 86 249 20 14 208 28 57 63 199 6 10 24 30 62 267 43 479 60 28 138 1 45 3 19 47 7 166 116 117 50 140 28 14 95 85 93 43 61 15 2 70 10 51 7 95 9 25\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '100\\r\\n896 898 967 979 973 709 961 968 806 967 896 967 826 975 936 903 986 856 851 931 852 971 786 837 949 978 686 936 952 909 965 749 908 916 943 973 983 975 939 886 964 928 960 976 907 788 994 773 949 871 947 980 945 985 726 981 887 943 907 990 931 874 840 867 948 951 961 904 888 901 976 967 994 921 828 970 972 722 755 970 860 855 914 869 714 899 969 978 898 862 642 939 904 936 819 934 884 983 955 964\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '100\\r\\n994 927 872 970 815 986 952 996 965 1000 877 986 978 999 950 990 936 997 993 960 921 860 895 869 943 998 983 968 973 953 999 990 995 871 853 979 973 963 953 938 997 989 993 964 960 973 946 975 1000 962 920 746 989 957 904 965 920 979 966 961 1000 993 975 952 846 971 991 979 985 969 984 973 956 1000 952 778 983 974 956 927 995 997 980 997 1000 970 960 970 988 983 947 904 935 972 1000 863 992 996 932 967\\r\\n', 'output': ['81 82\\r\\n']}, {'input': '100\\r\\n48 108 63 21 27 8 49 21 75 8 24 42 149 18 8 28 21 18 25 35 59 70 59 33 40 1 67 34 120 82 4 115 72 87 3 15 15 63 37 12 40 27 83 14 38 20 14 58 93 10 31 3 39 6 197 77 54 16 31 146 9 49 14 8 77 82 5 11 80 116 8 61 50 24 7 103 29 11 3 3 1 12 46 24 21 131 39 29 36 2 107 40 16 99 31 41 29 48 17 17\\r\\n', 'output': ['36 37\\r\\n']}]","id":328} {"difficulty":2100,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"05f251de93536024c05fbd77ed01b70b","execute_outcome":"RUNTIME_ERROR","source_code":"n,m=gets.chomp.split.collect{|a| a.to_i -1}\nputs (n.gcd(m)+1)","description":"Let's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue moving.More formally, first one of four diagonal directions is chosen and the billiard ball moves in that direction. When it reaches the square located on the board's edge, the billiard ball reflects from it; it changes the direction of its movement by 90 degrees and continues moving. Specifically, having reached a corner square, the billiard ball is reflected twice and starts to move the opposite way. While it moves, the billiard ball can make an infinite number of reflections. At any square of its trajectory the billiard ball can stop and on that the move is considered completed. It is considered that one billiard ball a beats another billiard ball b if a can reach a point where b is located.You are suggested to find the maximal number of billiard balls, that pairwise do not beat each other and that can be positioned on a chessboard n\u2009\u00d7\u2009m in size.","input_specification":"The first line contains two integers n and m (2\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106).","output_specification":"Print a single number, the maximum possible number of billiard balls that do not pairwise beat each other. Please do not use the %lld specificator to read or write 64-bit numbers in C++. It is preferred to use cin (also you may use the %I64d specificator).","notes":null,"sample_inputs":["3 4","3 3"],"sample_outputs":["2","3"],"human_solution":"n,m=gets.chomp.split.collect{|a| a.to_i}\nputs ((n-1).gcd(m-1)+1)","testcases":"[{'input': '3 4\\r\\n', 'output': ['2']}, {'input': '3 3\\r\\n', 'output': ['3']}, {'input': '2 2\\r\\n', 'output': ['2']}, {'input': '4 3\\r\\n', 'output': ['2']}, {'input': '2 3\\r\\n', 'output': ['2']}, {'input': '4 4\\r\\n', 'output': ['4']}, {'input': '4 6\\r\\n', 'output': ['2']}, {'input': '4 7\\r\\n', 'output': ['4']}, {'input': '5 7\\r\\n', 'output': ['3']}, {'input': '5 13\\r\\n', 'output': ['5']}, {'input': '7 10\\r\\n', 'output': ['4']}, {'input': '7 21\\r\\n', 'output': ['3']}, {'input': '7 61\\r\\n', 'output': ['7']}, {'input': '8 50\\r\\n', 'output': ['8']}, {'input': '8 8\\r\\n', 'output': ['8']}, {'input': '9 9\\r\\n', 'output': ['9']}, {'input': '9 256\\r\\n', 'output': ['2']}, {'input': '10 10\\r\\n', 'output': ['10']}, {'input': '999 999\\r\\n', 'output': ['999']}, {'input': '1000000 1000000\\r\\n', 'output': ['1000000']}, {'input': '2311 7771\\r\\n', 'output': ['211']}, {'input': '146412 710630\\r\\n', 'output': ['3572']}, {'input': '943547 987965\\r\\n', 'output': ['1347']}, {'input': '35329 689665\\r\\n', 'output': ['1537']}, {'input': '672961 948978\\r\\n', 'output': ['2']}, {'input': '524288 131072\\r\\n', 'output': ['2']}, {'input': '293492 654942\\r\\n', 'output': ['2']}, {'input': '962963 1000000\\r\\n', 'output': ['37038']}, {'input': '7 1000000\\r\\n', 'output': ['4']}, {'input': '999999 1000000\\r\\n', 'output': ['2']}, {'input': '666667 1000000\\r\\n', 'output': ['333334']}, {'input': '384 187\\r\\n', 'output': ['2']}, {'input': '238 116\\r\\n', 'output': ['2']}, {'input': '993 342\\r\\n', 'output': ['32']}, {'input': '848 271\\r\\n', 'output': ['2']}, {'input': '702 200\\r\\n', 'output': ['2']}, {'input': '9516 2202\\r\\n', 'output': ['2']}, {'input': '1498 9704\\r\\n', 'output': ['2']}, {'input': '2482 6269\\r\\n', 'output': ['2']}, {'input': '3466 4770\\r\\n', 'output': ['2']}, {'input': '4449 1336\\r\\n', 'output': ['2']}, {'input': '604630 225648\\r\\n', 'output': ['2']}, {'input': '503832 242363\\r\\n', 'output': ['2']}, {'input': '403034 430556\\r\\n', 'output': ['2']}, {'input': '302237 618749\\r\\n', 'output': ['5']}, {'input': '201439 635463\\r\\n', 'output': ['3']}, {'input': '576709 834208\\r\\n', 'output': ['562']}, {'input': '97905 599257\\r\\n', 'output': ['233']}, {'input': '364915 516421\\r\\n', 'output': ['343']}, {'input': '222403 592339\\r\\n', 'output': ['2203']}, {'input': '543425 776321\\r\\n', 'output': ['77633']}, {'input': '977965 896468\\r\\n', 'output': ['81498']}, {'input': '829981 586711\\r\\n', 'output': ['14311']}, {'input': '429181 515017\\r\\n', 'output': ['85837']}, {'input': '198441 446491\\r\\n', 'output': ['49611']}, {'input': '117806 188489\\r\\n', 'output': ['23562']}, {'input': '893011 315181\\r\\n', 'output': ['52531']}, {'input': '701905 526429\\r\\n', 'output': ['175477']}, {'input': '863029 287677\\r\\n', 'output': ['287677']}, {'input': '871866 348747\\r\\n', 'output': ['174374']}, {'input': '12 5\\r\\n', 'output': ['2']}, {'input': '21 15\\r\\n', 'output': ['3']}, {'input': '12 9\\r\\n', 'output': ['2']}, {'input': '720 972\\r\\n', 'output': ['2']}]","id":329} {"difficulty":2600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"0ef5e0621f13107d0c8786766ae2ac56","execute_outcome":"WRONG_ANSWER","source_code":"A = a = gets.to_i\n\nx = 0\nwhile a % 12 == 0\n\ta \/= 12\n\tx += 1\nend\n\nb = [2, 13]\n300.times{b.push 13 * b[-1] - 12 * b[-2]}\ny = 0\ny += 1 while b[y] < a\n\nif b[y] != a\n\tputs :NO\nelse\n\tz = 2 * x + y\n\tc = []\n\t(0 .. z \/ 2).each{|i| c << b[z - 2 * i] * 12 ** i if i != x}\n\tputs :YES\n\tp 1, z + 1, c.size, *c\nend\n","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"],"human_solution":"A = a = gets.to_i\n\nx = 0\nwhile a % 12 == 0\n\ta \/= 12\n\tx += 1\nend\n\nb = [2, 13]\n999.times{b.push 13 * b[-1] - 12 * b[-2]}\ny = 0\ny += 1 while b[y] < a\n\nif b[y] != a\n\tputs :NO\nelse\n\tz = 2 * x + y\n\tc = []\n\t(z \/ 2).downto(0){|i| c << b[z - 2 * i] * 12 ** i if i != x}\n\tputs :YES\n\tp 1, z + 1, c.size, *c\nend\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":330} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"139_B","execute_outcome":"WRONG_ANSWER","source_code":"def calculate_cost(room, wallpapers)\n min_cost = Float::INFINITY\n\n # Calculate the perimeter of the room\n perimeter = 2 * (room[0] + room[1])\n\n # Iterate through each wallpaper type\n wallpapers.each do |wallpaper|\n # Calculate the number of rolls required\n rolls = (perimeter.to_f \/ wallpaper[1]).ceil\n\n # Calculate the cost of rolls\n cost = rolls * wallpaper[2]\n\n # Update the minimum cost if necessary\n min_cost = [min_cost, cost].min\n end\n\n min_cost\nend\n\n# Calculate the minimum total cost for all rooms\ntotal_cost = rooms.map { |room| calculate_cost(room, wallpapers) }.sum\n\n# Print the minimum total cost\nputs total_cost\n","description":"Having bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has n rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height of the walls in meters (different rooms can have different dimensions, including height).Boris chose m types of wallpaper to paper the walls of the rooms with (but it is not necessary to use all the types). Each type of wallpaper is sold in rolls of a fixed length and width (the length, naturally, shows how long the unfolded roll will be). In addition, for each type we know the price of one roll of this type.The wallpaper of each type contains strips running along the length of the roll. When gluing the strips must be located strictly vertically (so the roll cannot be rotated, even if the length is less than the width). Besides, a roll can be cut in an arbitrary manner, but the joints of glued pieces should also be vertical. In addition, each room should be papered by only one type of wallpaper. And pieces of the same roll cannot be used to paper different rooms. That is, for each room the rolls are purchased separately. Also, some rolls can be used not completely.After buying an apartment Boris is short of cash, so he wants to spend the minimum money on wallpaper. Help him.","input_specification":"The first line contains a positive integer n (1\u2264n\u2264500) \u2014 the number of rooms in Boris's apartment.\nEach of the next n lines contains three space-separated positive integers \u2014 the length, width and height of the walls in a given room in meters, respectively.\nThe next line contains a positive integer m (1\u2264m\u2264500) \u2014 the number of available wallpaper types.\nEach of the following m lines contains three space-separated positive integers \u2014 the length and width in meters of a given wallpaper and the price of one roll, respectively.\nAll numbers in the input data do not exceed 500. It is guaranteed that each room can be papered using these types of wallpaper.\n","output_specification":"Print a single number \u2014 the minimum total cost of the rolls.\n","notes":"Note to the sample:\nThe total length of the walls (the perimeter) of the room is 20 m.\nOne roll of the first type can be cut into pieces to get three vertical 1 meter wide strips, ergo you need 7 rolls of this type, the price equals 700.\nA roll of the second type can be cut into pieces to get five 2 meter wide strips, we need 2 rolls, the price is 640.\nOne roll of the third type can immediately paper 19 meters out of 20, but we cannot use other types and we have to buy a second roll, the price is 1000.\n","sample_inputs":["1\n5 5 3\n3\n10 1 100\n15 2 320\n3 19 500\n"],"sample_outputs":["640\n"],"human_solution":"def min_cost_of_wallpaper(n, rooms, m, wallpapers)\n costs = Array.new(n, Float::INFINITY)\n n.times do |i|\n l, w, h = rooms[i]\n perimeter = 2 * (l + w)\n m.times do |j|\n roll_len, roll_wid, price = wallpapers[j]\n strips_per_roll = roll_len \/ h\n if strips_per_roll >= 1\n rolls_needed = (perimeter.to_f \/ (strips_per_roll * roll_wid)).ceil\n cost = rolls_needed * price\n costs[i] = [costs[i], cost].min\n end\n end\n end\n costs.sum.to_s\nend\n\nn = gets.to_i\nrooms = Array.new(n) { gets.split.map(&:to_i) }\nm = gets.to_i\nwallpapers = Array.new(m) { gets.split.map(&:to_i) }\nputs min_cost_of_wallpaper(n, rooms, m, wallpapers)\n","testcases":"[{'input': ['1\\r\\n5 5 3\\r\\n3\\r\\n10 1 100\\r\\n15 2 320\\r\\n3 19 500\\r\\n'], 'output': ['640\\r\\n']}, {'input': ['1\\r\\n9 10 7\\r\\n1\\r\\n7 1 3\\r\\n'], 'output': ['114\\r\\n']}, {'input': ['1\\r\\n6 9 5\\r\\n3\\r\\n8 5 10\\r\\n8 5 2\\r\\n6 3 7\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['1\\r\\n3 3 10\\r\\n3\\r\\n5 5 1\\r\\n9 9 2\\r\\n10 1 500\\r\\n'], 'output': ['6000\\r\\n']}, {'input': ['3\\r\\n29 30 29\\r\\n30 15 28\\r\\n27 30 23\\r\\n3\\r\\n30 27 21\\r\\n11 24 30\\r\\n25 20 12\\r\\n'], 'output': ['261\\r\\n']}, {'input': ['5\\r\\n4 4 1\\r\\n3 1 4\\r\\n4 1 3\\r\\n5 1 1\\r\\n1 1 1\\r\\n5\\r\\n5 3 3\\r\\n4 3 4\\r\\n5 2 3\\r\\n2 1 5\\r\\n3 1 3\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['10\\r\\n57 66 71\\r\\n14 30 28\\r\\n100 56 45\\r\\n22 24 76\\r\\n64 7 65\\r\\n26 80 9\\r\\n15 62 23\\r\\n63 46 34\\r\\n86 20 58\\r\\n10 33 2\\r\\n1\\r\\n86 9 99\\r\\n'], 'output': ['13959\\r\\n']}, {'input': ['5\\r\\n98 97 79\\r\\n88 82 82\\r\\n93 90 86\\r\\n70 76 75\\r\\n72 88 89\\r\\n10\\r\\n13 10 97\\r\\n100 8 77\\r\\n39 5 87\\r\\n50 10 71\\r\\n17 9 74\\r\\n65 8 100\\r\\n74 8 94\\r\\n60 6 70\\r\\n67 6 90\\r\\n97 7 71\\r\\n'], 'output': ['16555\\r\\n']}, {'input': ['10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10 10 10\\r\\n10\\r\\n4 10 10\\r\\n10 10 10\\r\\n7 10 10\\r\\n6 10 10\\r\\n7 10 10\\r\\n4 10 10\\r\\n4 10 10\\r\\n2 10 10\\r\\n7 10 10\\r\\n7 10 10\\r\\n'], 'output': ['400\\r\\n']}, {'input': ['1\\r\\n95 83 81\\r\\n10\\r\\n41 85 94\\r\\n95 97 95\\r\\n84 89 99\\r\\n23 85 86\\r\\n93 90 98\\r\\n55 84 82\\r\\n80 88 94\\r\\n32 83 98\\r\\n5 85 85\\r\\n48 98 100\\r\\n'], 'output': ['380\\r\\n']}, {'input': ['20\\r\\n110 466 472\\r\\n112 153 152\\r\\n424 492 490\\r\\n348 366 113\\r\\n208 337 415\\r\\n491 448 139\\r\\n287 457 403\\r\\n444 382 160\\r\\n325 486 284\\r\\n447 454 136\\r\\n216 412 418\\r\\n217 208 228\\r\\n109 436 291\\r\\n293 382 421\\r\\n483 339 174\\r\\n213 327 183\\r\\n278 268 147\\r\\n181 424 457\\r\\n388 289 430\\r\\n174 269 305\\r\\n20\\r\\n221 4 334\\r\\n257 4 331\\r\\n444 3 127\\r\\n492 3 391\\r\\n154 4 389\\r\\n362 4 346\\r\\n264 3 448\\r\\n347 5 296\\r\\n416 5 496\\r\\n407 3 400\\r\\n133 3 140\\r\\n189 3 111\\r\\n272 3 262\\r\\n115 5 274\\r\\n128 3 230\\r\\n488 5 214\\r\\n458 3 428\\r\\n54 4 440\\r\\n191 5 160\\r\\n228 5 139\\r\\n'], 'output': ['959915\\r\\n']}, {'input': ['1\\r\\n500 500 500\\r\\n1\\r\\n500 500 500\\r\\n'], 'output': ['2000\\r\\n']}, {'input': ['1\\r\\n1 1 1\\r\\n1\\r\\n1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n500 500 1\\r\\n1\\r\\n1 1 500\\r\\n'], 'output': ['1000000\\r\\n']}]","id":331} {"difficulty":2000,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"13fa378c913bb7a15612327099b59f83","execute_outcome":"RUNTIME_ERROR","source_code":"\nsmall_size, big_indexes = gets.chomp.split.map{|s| s.to_i}\nsmalls = []\nsmall_size.times do\n array = gets.chomp.split.map{|s| s.to_i}\n array.shift\n sum = r_sum = 0\n left = right = max = -1001\n tmp = 0\n array.size.times do |i|\n sum += array[i]\n r_sum += array[-i - 1]\n left = [sum, left].max\n right = [r_sum, right].max\n max = [max, array[i]].max\n tmp += array[i]\n if tmp < 0\n tmp = 0\n else\n max = [max, tmp].max\n end\n end\n small = {\n :sum => sum,\n :left => left,\n :right => right,\n :max => max,\n }\n smalls << small\nend\nmax = -1001\ntmp = 0\ngets.chomp.split.map{|s| s.to_i}.each do |i|\n i -= 1\n max = [max, smalls[i][:max]].max\n max = [max, tmp + smalls[i][:left]].max if tmp > 0\n tmp = [0, [smalls[i][:right], tmp + smalls[i][:sum]].max].max\nend\nputs max\n","description":"Ahmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.This problem is similar to a standard problem but it has a different format and constraints.In the standard problem you are given an array of integers, and you have to find one or more consecutive elements in this array where their sum is the maximum possible sum.But in this problem you are given n small arrays, and you will create one big array from the concatenation of one or more instances of the small arrays (each small array could occur more than once). The big array will be given as an array of indexes (1-based) of the small arrays, and the concatenation should be done in the same order as in this array. Then you should apply the standard problem mentioned above on the resulting big array.For example let's suppose that the small arrays are {1, 6, -2}, {3, 3} and {-5, 1}. And the indexes in the big array are {2, 3, 1, 3}. So the actual values in the big array after formatting it as concatenation of the small arrays will be {3, 3, -5, 1, 1, 6, -2, -5, 1}. In this example the maximum sum is 9.Can you help Mostafa solve this problem?","input_specification":"The first line contains two integers n and m, n is the number of the small arrays (1\u2009\u2264\u2009n\u2009\u2264\u200950), and m is the number of indexes in the big array (1\u2009\u2264\u2009m\u2009\u2264\u2009250000). Then follow n lines, the i-th line starts with one integer l which is the size of the i-th array (1\u2009\u2264\u2009l\u2009\u2264\u20095000), followed by l integers each one will be greater than or equal -1000 and less than or equal 1000. The last line contains m integers which are the indexes in the big array, and you should concatenate the small arrays in the same order, and each index will be greater than or equal to 1 and less than or equal to n. The small arrays are numbered from 1 to n in the same order as given in the input. Some of the given small arrays may not be used in big array. Note, that the array is very big. So if you try to build it straightforwardly, you will probably get time or\/and memory limit exceeded.","output_specification":"Print one line containing the maximum sum in the big array after formatting it as described above. You must choose at least one element for the sum, i. e. it cannot be empty. Please, do not use %lld specificator to write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).","notes":null,"sample_inputs":["3 4\n3 1 6 -2\n2 3 3\n2 -5 1\n2 3 1 3","6 1\n4 0 8 -3 -10\n8 3 -2 -5 10 8 -9 -5 -4\n1 0\n1 -3\n3 -8 5 6\n2 9 6\n1"],"sample_outputs":["9","8"],"human_solution":"\nsmall_size, big_indexes = gets.chomp.split.map{|s| s.to_i}\nsmalls = []\nsmall_size.times do\n array = gets.chomp.split.map{|s| s.to_i}\n array.shift\n sum = r_sum = 0\n left = right = max = -1001\n tmp = 0\n array.size.times do |i|\n sum += array[i]\n r_sum += array[-i - 1]\n left = sum if sum > left\n right = r_sum if r_sum > right\n max = array[i] if array[i] > max\n tmp += array[i]\n if tmp < 0\n tmp = 0\n else\n max = tmp if tmp > max\n end\n end\n small = {\n :sum => sum,\n :left => left,\n :right => right,\n :max => max,\n }\n smalls << small\nend\nmax = -1001\ntmp = 0\ngets.chomp.split.map{|s| s.to_i}.each do |i|\n i -= 1\n max = smalls[i][:max] if smalls[i][:max] >= max\n max = tmp + smalls[i][:left] if tmp + smalls[i][:left] > max\n tmp += smalls[i][:sum]\n tmp = smalls[i][:right] if smalls[i][:right] > tmp\n tmp = 0 if tmp < 0\nend\nputs max\n","testcases":"[{'input': '3 4\\r\\n3 1 6 -2\\r\\n2 3 3\\r\\n2 -5 1\\r\\n2 3 1 3\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 1\\r\\n4 0 8 -3 -10\\r\\n8 3 -2 -5 10 8 -9 -5 -4\\r\\n1 0\\r\\n1 -3\\r\\n3 -8 5 6\\r\\n2 9 6\\r\\n1\\r\\n', 'output': ['8\\r\\n']}, {'input': '4 3\\r\\n6 6 8 -5 4 10 -2\\r\\n1 -2\\r\\n1 -10\\r\\n5 -10 10 8 -7 -10\\r\\n2 4 1\\r\\n', 'output': ['24\\r\\n']}, {'input': '7 7\\r\\n2 -8 -7\\r\\n5 2 -10 10 -2 4\\r\\n7 10 -8 9 8 9 -10 -3\\r\\n6 0 6 -9 9 -6 -9\\r\\n4 -6 -9 10 -6\\r\\n3 -8 4 10\\r\\n7 -1 -3 10 -8 -6 -3 6\\r\\n4 5 4 6 6 1 7\\r\\n', 'output': ['20\\r\\n']}, {'input': '4 8\\r\\n8 0 3 -9 -10 0 -1 6 -4\\r\\n3 -10 -7 2\\r\\n10 6 -2 -9 0 -7 -4 -7 7 -1 2\\r\\n3 -5 1 -4\\r\\n1 1 1 1 4 4 3 3\\r\\n', 'output': ['14\\r\\n']}, {'input': '2 1\\r\\n2 -4 -6\\r\\n5 6 8 3 5 -2\\r\\n1\\r\\n', 'output': ['-4\\r\\n']}, {'input': '9 4\\r\\n4 8 -2 -10 6\\r\\n10 -4 9 6 -2 -8 6 7 2 -6 2\\r\\n8 -10 1 9 9 -10 2 -10 -9\\r\\n7 3 -10 -10 -6 3 -7 0\\r\\n5 -4 -8 2 -5 2\\r\\n1 -3\\r\\n4 -9 0 7 -4\\r\\n7 4 -5 4 -8 -4 0 -1\\r\\n9 2 5 -10 4 -10 -2 6 5 10\\r\\n3 6 4 6\\r\\n', 'output': ['19\\r\\n']}, {'input': '3 1\\r\\n7 4 8 1 -7 -9 -8 -9\\r\\n10 5 -5 -5 -9 -1 7 4 -1 -4 4\\r\\n8 -7 7 4 10 -6 3 -6 9\\r\\n2\\r\\n', 'output': ['11\\r\\n']}, {'input': '7 3\\r\\n7 -9 -6 0 -6 -5 1 -9\\r\\n9 4 4 3 -6 -4 8 4 5 -6\\r\\n1 -4\\r\\n7 -3 -9 -9 1 -4 8 7\\r\\n2 6 3\\r\\n7 0 -5 -5 -2 -8 2 -1\\r\\n8 4 1 6 -7 -2 10 -8 -2\\r\\n3 1 5\\r\\n', 'output': ['9\\r\\n']}, {'input': '6 9\\r\\n8 -10 10 3 4 -9 0 3 9\\r\\n4 9 2 -1 6\\r\\n3 -10 -10 -5\\r\\n7 10 -6 7 1 -8 3 4\\r\\n8 -8 9 3 -1 0 1 -7 -7\\r\\n1 -4\\r\\n3 2 3 2 4 4 1 1 1\\r\\n', 'output': ['68\\r\\n']}, {'input': '3 6\\r\\n3 -1 -1 -1\\r\\n4 -2 -2 -2 -2\\r\\n5 -3 -3 -3 -3 -3\\r\\n1 2 3 1 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n11 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n10 -1 -1 -1 10 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['11\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1\\r\\n1 -1\\r\\n1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1\\r\\n1 0\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 1 1 1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 1 1 1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 -1 -1 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n6 -1 -1 0 1 0 -1\\r\\n6 -1 -1 -1 -1 -1 -1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\n6 0 0 0 0 0 0\\r\\n6 0 0 0 0 0 0\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '14 14\\r\\n6 -1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 1\\r\\n6 1 1 1 1 1 -1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\\r\\n', 'output': ['82\\r\\n']}]","id":332} {"difficulty":1900,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"21_A","execute_outcome":"WRONG_ANSWER","source_code":"def is_jabber_id(string)\n # Check if the string matches the pattern for a Jabber ID\n if string =~ \/^[\\w]{1,16}@[a-zA-Z0-9_.]{1,16}(\\\/[\\w]{1,16})?$\/\n return \"YES\"\n else\n return \"NO\"\n end\nend\n\n# Read the input\ninput = gets.chomp\n\n# Check if the input is a correct Jabber ID\nresult = is_jabber_id(input)\n\n# Print the result\nputs result\n\n","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"],"human_solution":"def is_jabber_id(str)\n # Check if the string matches the pattern for Jabber ID\n pattern = \/^([a-zA-Z0-9_]{1,16})@(([a-zA-Z0-9_]{1,16})\\.)*([a-zA-Z0-9_]{1,16})(\\\/([a-zA-Z0-9_]{1,16}))?$\/\n if str.match?(pattern)\n return 'YES'\n else\n return 'NO'\n end\nend\n\n# Read the input\ninput = gets.chomp\n# Call the function and print the result\nputs is_jabber_id(input)","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":333} {"difficulty":2700,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"293_D","execute_outcome":"RUNTIME_ERROR","source_code":"def polygon_area(vertices)\n n = vertices.length\n area = 0\n\n (0...n).each do |i|\n x1, y1 = vertices[i]\n x2, y2 = vertices[(i + 1) % n]\n area += (x1 * y2 - x2 * y1)\n end\n\n area.abs \/ 2.0\nend\n\ndef expected_area(n, vertices)\n polygon = []\n vertices.each do |vertex|\n polygon << vertex.split.map(&:to_i)\n end\n\n total_points = 0\n total_area = 0\n\n polygon.each_with_index do |vertex, i|\n x1, y1 = vertex\n x2, y2 = polygon[(i + 1) % n]\n\n min_x = [x1, x2].min\n max_x = [x1, x2].max\n min_y = [y1, y2].min\n max_y = [y1, y2].max\n\n total_points += (max_x - min_x + 1) * (max_y - min_y + 1)\n total_area += polygon_area([vertex, polygon[(i + 1) % n]])\n end\n\n total_area \/ total_points\nend\n\ninput = gets.chomp.split(\"\\n\")\nn = input[0].to_i\nvertices = input[1..-1]\n\nputs expected_area(n, vertices)\n","description":"Ksusha is a vigorous mathematician. She is keen on absolutely incredible mathematical riddles. Today Ksusha came across a convex polygon of non-zero area. She is now wondering: if she chooses a pair of distinct points uniformly among all integer points (points with integer coordinates) inside or on the border of the polygon and then draws a square with two opposite vertices lying in the chosen points, what will the expectation of this square's area be?A pair of distinct points is chosen uniformly among all pairs of distinct points, located inside or on the border of the polygon. Pairs of points p,q (p\u2260q) and q,p are considered the same.Help Ksusha! Count the required expectation.","input_specification":"The first line contains integer n (3\u2264n\u226410^5) \u2014 the number of vertices of Ksusha's convex polygon. Next n lines contain the coordinates of the polygon vertices in clockwise or counterclockwise order. The i-th line contains integers xi,yi (|xi|,|yi|\u226410^6) \u2014 the coordinates of the vertex that goes i-th in that order.\n","output_specification":"Print a single real number \u2014 the required expected area. \nThe answer will be considered correct if its absolute and relative error doesn't exceed 10^-6.\n","notes":null,"sample_inputs":["3\n0 0\n5 5\n5 0\n","4\n-1 3\n4 5\n6 2\n3 -5\n","3\n17 136\n859 937\n16 641\n"],"sample_outputs":["4.6666666667\n","8.1583333333\n","66811.3704155169\n"],"human_solution":"def polygon_area(vertices)\n n = vertices.length\n sum = 0\n for i in 0...n\n j = (i+1)%n\n sum += vertices[i][0]*vertices[j][1] - vertices[j][0]*vertices[i][1]\n end\n return sum.abs\/2.0\nend\n\ndef sum_squares(n)\n return n*(n+1)*(2*n+1)\/6\nend\n\ndef solve(n, vertices)\n vertices.sort_by! {|x, y| [x, y]}\n x_values = vertices.map {|x, y| x}.uniq\n y_values = Array.new(x_values.length, 0)\n x_values.each_with_index do |x, i|\n y_values[i] = vertices.select {|vx, vy| vx == x}.map {|vx, vy| vy}.sort\n end\n total_sum = 0\n total_count = 0\n x_values.each_with_index do |x, i|\n count = y_values[i].length\n sum = y_values[i].sum\n total_sum += sum_squares(x)*(2*count-sum) + sum_squares(n-x-1)*(2*count-sum)\n total_count += count*count\n end\n return total_sum\/total_count.to_f\nend\n\nlines = gets.chomp.split('\\n').map {|line| line.split.map(&:to_i)}\nn = lines.shift[0]\nvertices = lines\nputs '%.10f' % solve(n, vertices)\n","testcases":"[{'input': ['3\\r\\n0 0\\r\\n5 5\\r\\n5 0\\r\\n'], 'output': ['4.6666666667\\r\\n']}, {'input': ['4\\r\\n-1 3\\r\\n4 5\\r\\n6 2\\r\\n3 -5\\r\\n'], 'output': ['8.1583333333\\r\\n']}, {'input': ['3\\r\\n17 136\\r\\n859 937\\r\\n16 641\\r\\n'], 'output': ['66811.3704155169\\r\\n']}, {'input': ['6\\r\\n-29 6\\r\\n-28 27\\r\\n-2 18\\r\\n13 9\\r\\n20 -18\\r\\n19 -27\\r\\n'], 'output': ['308.2856838963\\r\\n']}, {'input': ['7\\r\\n-29 5\\r\\n-20 13\\r\\n-4 22\\r\\n8 20\\r\\n21 9\\r\\n16 -29\\r\\n-23 -30\\r\\n'], 'output': ['339.3631202393\\r\\n']}, {'input': ['8\\r\\n-18 -20\\r\\n16 -28\\r\\n29 -29\\r\\n29 25\\r\\n15 27\\r\\n-19 30\\r\\n-28 18\\r\\n-30 -16\\r\\n'], 'output': ['499.5660003682\\r\\n']}, {'input': ['6\\r\\n13 -22\\r\\n26 -11\\r\\n30 12\\r\\n22 19\\r\\n-10 24\\r\\n-29 6\\r\\n'], 'output': ['293.0788486799\\r\\n']}, {'input': ['6\\r\\n13 -22\\r\\n26 -11\\r\\n30 12\\r\\n22 19\\r\\n-10 24\\r\\n-29 6\\r\\n'], 'output': ['293.0788486799\\r\\n']}, {'input': ['6\\r\\n16 -23\\r\\n28 -4\\r\\n24 4\\r\\n14 14\\r\\n-13 5\\r\\n-27 -4\\r\\n'], 'output': ['209.4794108807\\r\\n']}, {'input': ['9\\r\\n-30 -17\\r\\n-30 -12\\r\\n-28 24\\r\\n-21 29\\r\\n8 29\\r\\n18 14\\r\\n26 -11\\r\\n9 -29\\r\\n-25 -30\\r\\n'], 'output': ['451.0823539138\\r\\n']}, {'input': ['4\\r\\n-1000000 -1000000\\r\\n-1000000 1000000\\r\\n1000000 1000000\\r\\n1000000 -1000000\\r\\n'], 'output': ['666667333333.5008500000\\r\\n']}, {'input': ['4\\r\\n1000 1000\\r\\n-1000 1000\\r\\n-1000 -1000\\r\\n1000 -1000\\r\\n'], 'output': ['667333.5000000000\\r\\n']}, {'input': ['6\\r\\n-30 30\\r\\n21 30\\r\\n29 5\\r\\n27 -7\\r\\n13 -20\\r\\n-24 -30\\r\\n'], 'output': ['470.6151913267\\r\\n']}, {'input': ['7\\r\\n-16 -30\\r\\n18 -12\\r\\n23 -1\\r\\n-3 5\\r\\n-20 5\\r\\n-22 1\\r\\n-23 -27\\r\\n'], 'output': ['206.0253957422\\r\\n']}, {'input': ['5\\r\\n-30 3\\r\\n-27 27\\r\\n25 19\\r\\n22 11\\r\\n-9 -19\\r\\n'], 'output': ['269.9315435441\\r\\n']}, {'input': ['5\\r\\n-12 -21\\r\\n25 12\\r\\n2 28\\r\\n-25 24\\r\\n-26 -16\\r\\n'], 'output': ['281.2625079157\\r\\n']}, {'input': ['6\\r\\n-14 2\\r\\n11 28\\r\\n15 -2\\r\\n15 -28\\r\\n13 -30\\r\\n9 -26\\r\\n'], 'output': ['200.7414038240\\r\\n']}, {'input': ['4\\r\\n-4 -20\\r\\n10 6\\r\\n-7 23\\r\\n-27 -17\\r\\n'], 'output': ['165.4239773277\\r\\n']}, {'input': ['4\\r\\n-13 -21\\r\\n22 -14\\r\\n19 -2\\r\\n-20 27\\r\\n'], 'output': ['216.0781961373\\r\\n']}, {'input': ['8\\r\\n22 -28\\r\\n29 -1\\r\\n28 9\\r\\n26 14\\r\\n19 22\\r\\n-3 29\\r\\n-9 26\\r\\n-29 -14\\r\\n'], 'output': ['364.5501756826\\r\\n']}, {'input': ['21\\r\\n-999896 -977584\\r\\n-981090 -998920\\r\\n-955737 -999433\\r\\n-836670 -999598\\r\\n-131267 -999903\\r\\n873713 -999850\\r\\n988083 -997441\\r\\n997685 -976930\\r\\n998079 -967700\\r\\n999138 -906399\\r\\n999967 -779494\\r\\n999875 608972\\r\\n998802 997105\\r\\n997089 999540\\r\\n891311 999873\\r\\n46007 999962\\r\\n-991551 999757\\r\\n-999301 968587\\r\\n-999579 875737\\r\\n-999730 549856\\r\\n-999960 51168\\r\\n'], 'output': ['666126548753.4934100000\\r\\n']}, {'input': ['28\\r\\n-999858 -784428\\r\\n-999517 -939769\\r\\n-999016 -999730\\r\\n-947991 -999977\\r\\n583432 -999987\\r\\n867592 -999817\\r\\n964501 -998866\\r\\n996003 -995533\\r\\n998716 -984290\\r\\n999618 -770526\\r\\n999783 -567026\\r\\n999971 -186389\\r\\n999952 107304\\r\\n999801 823582\\r\\n998874 906964\\r\\n997851 952716\\r\\n995210 986155\\r\\n990112 999169\\r\\n958740 999772\\r\\n855833 999915\\r\\n-86160 999966\\r\\n-983466 999718\\r\\n-986557 998983\\r\\n-992779 997480\\r\\n-999153 910765\\r\\n-999678 633173\\r\\n-999792 567889\\r\\n-999874 -13740\\r\\n'], 'output': ['666134075600.9432400000\\r\\n']}, {'input': ['23\\r\\n-998149 -915915\\r\\n-995073 -944069\\r\\n-987635 -988407\\r\\n-951050 -993464\\r\\n-922353 -996259\\r\\n-897593 -998630\\r\\n-395571 -999848\\r\\n891364 -999885\\r\\n998896 -999857\\r\\n999954 -241069\\r\\n999992 665232\\r\\n999954 972998\\r\\n997503 995272\\r\\n918826 998906\\r\\n805190 999725\\r\\n-160875 999945\\r\\n-868222 999408\\r\\n-910092 998323\\r\\n-989088 995823\\r\\n-996325 994987\\r\\n-999234 862952\\r\\n-999462 618604\\r\\n-999999 -892066\\r\\n'], 'output': ['665633654239.2791700000\\r\\n']}, {'input': ['28\\r\\n-999992 -308892\\r\\n-999961 -775849\\r\\n-999942 -893083\\r\\n-999456 -939329\\r\\n-999012 -979265\\r\\n-997835 -988395\\r\\n-989576 -999615\\r\\n-707413 -999804\\r\\n-356518 -999960\\r\\n425690 -999948\\r\\n816619 -999822\\r\\n996426 -999657\\r\\n998911 -998620\\r\\n999895 -957899\\r\\n999936 -732657\\r\\n999772 776916\\r\\n999714 916237\\r\\n997146 988196\\r\\n996127 992122\\r\\n985658 999257\\r\\n878494 999690\\r\\n700248 999995\\r\\n-73464 999954\\r\\n-462535 999888\\r\\n-996558 999759\\r\\n-999198 954171\\r\\n-999766 940472\\r\\n-1000000 740830\\r\\n'], 'output': ['666355240785.8159200000\\r\\n']}, {'input': ['31\\r\\n-999895 -680066\\r\\n-999346 -911069\\r\\n-997066 -995888\\r\\n-933871 -999458\\r\\n-859686 -999993\\r\\n915737 -999963\\r\\n980078 -999252\\r\\n991475 -998112\\r\\n997928 -987831\\r\\n998589 -957777\\r\\n999526 -904903\\r\\n999931 -256314\\r\\n999918 618991\\r\\n999004 979093\\r\\n994226 996559\\r\\n992378 997893\\r\\n985535 998354\\r\\n842908 999545\\r\\n497158 999818\\r\\n58368 999831\\r\\n-524382 999768\\r\\n-870707 999721\\r\\n-896847 999681\\r\\n-930692 999452\\r\\n-960753 999218\\r\\n-994745 997730\\r\\n-998380 996409\\r\\n-999326 941484\\r\\n-999695 880174\\r\\n-999953 516095\\r\\n-999959 432711\\r\\n'], 'output': ['666145135876.4697300000\\r\\n']}, {'input': ['29\\r\\n-999821 -886199\\r\\n-996548 -965159\\r\\n-995362 -987300\\r\\n-981634 -998332\\r\\n-908076 -999145\\r\\n-527101 -999912\\r\\n446850 -999985\\r\\n816225 -999959\\r\\n938653 -998846\\r\\n974582 -992905\\r\\n997351 -984725\\r\\n998758 -966579\\r\\n999674 -891109\\r\\n999991 -582065\\r\\n999947 570950\\r\\n999860 851333\\r\\n999509 915545\\r\\n998980 973970\\r\\n998488 994168\\r\\n990799 998749\\r\\n736579 999807\\r\\n176123 999895\\r\\n-889019 999998\\r\\n-919642 999796\\r\\n-952356 998373\\r\\n-974729 997284\\r\\n-994908 993778\\r\\n-999862 963244\\r\\n-999863 157789\\r\\n'], 'output': ['666005823973.8520500000\\r\\n']}, {'input': ['26\\r\\n-999979 -518088\\r\\n-999921 118990\\r\\n-999886 336599\\r\\n-999749 963071\\r\\n-999613 971778\\r\\n-997505 993563\\r\\n-988075 999871\\r\\n-724057 999931\\r\\n338004 999963\\r\\n939763 999692\\r\\n979017 999536\\r\\n997778 999063\\r\\n999010 994592\\r\\n999549 991252\\r\\n999866 130647\\r\\n999941 -152592\\r\\n999901 -975591\\r\\n998258 -992117\\r\\n992764 -999373\\r\\n845158 -999949\\r\\n592531 -999958\\r\\n-810995 -999934\\r\\n-988512 -999694\\r\\n-995382 -992825\\r\\n-997701 -979912\\r\\n-999550 -923898\\r\\n'], 'output': ['666361287504.7856400000\\r\\n']}, {'input': ['21\\r\\n-999986 557566\\r\\n-999907 933716\\r\\n-999221 982044\\r\\n-991618 996837\\r\\n-989578 998869\\r\\n-959290 999999\\r\\n941636 999993\\r\\n982544 999663\\r\\n999879 996043\\r\\n999991 618961\\r\\n999916 -733361\\r\\n999799 -901915\\r\\n999501 -995358\\r\\n995904 -999369\\r\\n883475 -999921\\r\\n355631 -999988\\r\\n-521129 -999838\\r\\n-777567 -999730\\r\\n-996849 -999383\\r\\n-999891 -926971\\r\\n-999957 -555457\\r\\n'], 'output': ['666453766184.6291500000\\r\\n']}, {'input': ['28\\r\\n-999950 -887483\\r\\n-999941 -898020\\r\\n-999541 -954162\\r\\n-998380 -979624\\r\\n-996809 -989471\\r\\n-974206 -998846\\r\\n-814103 -999939\\r\\n-562253 -999986\\r\\n38935 -999954\\r\\n949101 -999859\\r\\n967558 -998977\\r\\n974753 -998193\\r\\n980440 -995185\\r\\n995399 -975723\\r\\n999674 -949939\\r\\n999839 -915815\\r\\n999975 -114127\\r\\n999981 971763\\r\\n999561 997999\\r\\n989473 999261\\r\\n917401 999944\\r\\n-468594 999853\\r\\n-693444 999675\\r\\n-914976 999234\\r\\n-997478 996529\\r\\n-999955 951845\\r\\n-999982 144675\\r\\n-999992 -224003\\r\\n'], 'output': ['666225623675.0599400000\\r\\n']}, {'input': ['3\\r\\n217949 72327\\r\\n20730 141135\\r\\n667478 391012\\r\\n'], 'output': ['22999661597.9780430000\\r\\n']}, {'input': ['6\\r\\n-476965 -162114\\r\\n-528389 -150910\\r\\n-582349 -113696\\r\\n-668732 17055\\r\\n-505653 187057\\r\\n-320725 378075\\r\\n'], 'output': ['19121483829.0815730000\\r\\n']}, {'input': ['7\\r\\n682441 915628\\r\\n544253 794138\\r\\n613454 689307\\r\\n748362 488382\\r\\n785654 635758\\r\\n813511 747405\\r\\n740114 896236\\r\\n'], 'output': ['11812099113.1972260000\\r\\n']}, {'input': ['11\\r\\n-66147 342486\\r\\n-84392 250625\\r\\n-79482 200009\\r\\n114303 -75951\\r\\n143385 -63417\\r\\n228821 15223\\r\\n234858 79257\\r\\n222911 116017\\r\\n174646 182146\\r\\n101613 255473\\r\\n27282 308745\\r\\n'], 'output': ['15436765129.4917530000\\r\\n']}]","id":334} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"34_D","execute_outcome":"WRONG_ANSWER","source_code":"def find_new_representation(n, r1, r2, roads)\n new_representation = []\n old_representation = roads.split.map(&:to_i)\n\n # Find the path from the old capital to the new capital\n path = [r2]\n while path.last != r1\n path << old_representation[path.last - 2]\n end\n\n # Reverse the path to get the new representation\n path.reverse.each_cons(2) do |a, b|\n new_representation << b\n end\n\n new_representation.join(' ')\nend\n\ninput = gets.chomp.split\nn = input[0].to_i\nr1 = input[1].to_i\nr2 = input[2].to_i\nroads = gets.chomp\n\noutput = find_new_representation(n, r1, r2, roads)\nputs output\n","description":"There are n cities in Berland. Each city has its index \u2014 an integer number from 1 to n. The capital has index r1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital to each city, i.e. the road map looks like a tree. In Berland's chronicles the road map is kept in the following way: for each city i, different from the capital, there is kept number pi \u2014 index of the last city on the way from the capital to i.Once the king of Berland Berl XXXIV decided to move the capital from city r1 to city r2. Naturally, after this the old representation of the road map in Berland's chronicles became incorrect. Please, help the king find out a new representation of the road map in the way described above.","input_specification":"The first line contains three space-separated integers n, r1, r2 (2\u2264n\u22645\u00b710^4,1\u2264r1\u2260r2\u2264n) \u2014 amount of cities in Berland, index of the old capital and index of the new one, correspondingly.\nThe following line contains n-1 space-separated integers \u2014 the old representation of the road map. For each city, apart from r1, there is given integer pi \u2014 index of the last city on the way from the capital to city i. All the cities are described in order of increasing indexes.\n","output_specification":"Output n-1 numbers \u2014 new representation of the road map in the same format.\n","notes":null,"sample_inputs":["3 2 3\n2 2\n","6 2 4\n6 1 2 4 2\n"],"sample_outputs":["2 3 ","6 4 1 4 2 "],"human_solution":"n, r1, r2 = gets.split.map(&:to_i)\ngraph = Array.new(n+1) {[]}\nold_map = gets.split.map(&:to_i)\n\nold_map.insert(r1-1, 0)\n\n(1..n).each do |i|\n graph[i] << old_map[i-1]\n graph[old_map[i-1]] << i if old_map[i-1] != 0\nend\n\nvisited = Array.new(n+1, false)\nnew_map = Array.new(n+1, 0)\n\nqueue = [r2]\nvisited[r2] = true\n\nwhile !queue.empty?\n current_city = queue.shift\n graph[current_city].each do |neighbour|\n unless visited[neighbour]\n new_map[neighbour] = current_city\n visited[neighbour] = true\n queue << neighbour\n end\n end\nend\n\n(1..n).each { |i| print \"#{new_map[i]} \" if i != r2 }\n","testcases":"[{'input': ['3 2 3\\r\\n2 2\\r\\n'], 'output': ['2 3 ']}, {'input': ['6 2 4\\r\\n6 1 2 4 2\\r\\n'], 'output': ['6 4 1 4 2 ']}, {'input': ['7 7 6\\r\\n7 7 5 5 7 7\\r\\n'], 'output': ['7 7 5 5 7 6 ']}, {'input': ['4 2 3\\r\\n2 1 3\\r\\n'], 'output': ['3 1 3 ']}, {'input': ['5 5 4\\r\\n5 4 1 5\\r\\n'], 'output': ['5 4 1 4 ']}, {'input': ['6 2 1\\r\\n4 1 2 2 2\\r\\n'], 'output': ['4 1 1 2 2 ']}, {'input': ['2 1 2\\r\\n1\\r\\n'], 'output': ['2 ']}, {'input': ['2 2 1\\r\\n2\\r\\n'], 'output': ['1 ']}, {'input': ['3 1 3\\r\\n1 2\\r\\n'], 'output': ['2 3 ']}, {'input': ['10 4 3\\r\\n5 6 9 10 1 9 6 8 4\\r\\n'], 'output': ['6 6 10 1 8 9 9 3 5 ']}, {'input': ['100 62 42\\r\\n45 66 13 18 93 47 83 19 41 66 5 70 16 29 54 28 65 91 92 24 90 54 7 40 77 53 68 58 70 65 68 30 94 80 16 18 69 21 94 1 99 61 97 2 69 15 79 38 61 46 88 32 57 84 35 18 17 77 38 91 84 2 53 54 68 19 13 78 62 16 63 17 76 49 28 45 94 13 35 69 37 56 12 41 95 70 57 24 45 84 87 65 14 76 95 94 31 67 5\\r\\n'], 'output': ['45 66 13 18 93 47 83 19 41 66 5 84 16 29 54 28 65 91 92 24 90 54 7 40 77 53 68 58 70 65 68 30 94 80 16 18 69 21 94 1 99 97 2 69 15 79 38 61 46 88 32 57 84 35 18 17 77 38 91 42 70 2 53 54 68 19 13 78 12 16 63 17 76 49 28 45 94 13 35 69 37 56 61 41 95 70 57 24 45 84 87 65 14 76 95 94 31 67 5 ']}]","id":335} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"46_C","execute_outcome":"COMPILATION_ERROR","source_code":"def minimal_swaps(input)\n n = input[0].to_i\n positions = input[1].strip.chars\n\n # Count the number of hamsters and tigers\n hamster_count = positions.count('H')\n tiger_count = positions.count('T')\n\n # If all hamsters or all tigers are already together, no swaps needed\n return '0' if hamster_count == n || tiger_count == n\n\n # Find the maximum number of hamsters or tigers together\n max_count = [hamster_count, tiger_count].max\n\n # Find the minimum number of swaps needed to achieve the goal\n min_swaps = n\n\n # Iterate through each possible starting position\n (0..n-1).each do |start|\n # Count the number of swaps needed for this starting position\n swaps = 0\n (0..max_count-1).each do |i|\n current = positions[(start + i) % n]\n swaps += 1 if (current == 'H' && i >= tiger_count) || (current == 'T' && i >= hamster_count)\n end\n min_swaps = [min_swaps, swaps].min\n end\n\n min_swaps.to_s\nend\n\ninput = gets.chomp.split('\\n')\noutput = minimal_swaps(input)\nputs output\n","description":"Today there is going to be an unusual performance at the circus \u2014 hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together. The trainer swaps the animals in pairs not to create a mess. He orders two animals to step out of the circle and swap places. As hamsters feel highly uncomfortable when tigers are nearby as well as tigers get nervous when there's so much potential prey around (consisting not only of hamsters but also of yummier spectators), the trainer wants to spend as little time as possible moving the animals, i.e. he wants to achieve it with the minimal number of swaps. Your task is to help him.","input_specification":"The first line contains number n (2\u2264n\u22641000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols \"H\" and \"T\". The \"H\"s correspond to hamsters and the \"T\"s correspond to tigers. It is guaranteed that at least one hamster and one tiger are present on the arena. The animals are given in the order in which they are located circle-wise, in addition, the last animal stands near the first one.\n","output_specification":"Print the single number which is the minimal number of swaps that let the trainer to achieve his goal.\n","notes":"In the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then \u2014 the tiger in position 9 with the hamster in position 7.\n","sample_inputs":["3\nHTH\n","9\nHTHTHTHHT\n"],"sample_outputs":["0\n","2\n"],"human_solution":"def min_swaps\n n = gets.to_i\n s = gets.chomp.split('')\n tigers = s.count('T')\n hamsters = s.count('H')\n min_swaps = tigers\n s = s * 2\n (0...n).each do |i|\n tigers_in_range = s[i...(i+hamsters)].count('T')\n min_swaps = [min_swaps, tigers_in_range].min\n end\n puts min_swaps\nend\n\nmin_swaps\n","testcases":"[{'input': ['3\\r\\nHTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9\\r\\nHTHTHTHHT\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\nTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\nHTTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\nHTHT\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\nTTTHTTT\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\nHHTHHTHH\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['13\\r\\nHTTTHHHTTTTHH\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\nTTHTHTHHTHTTHHTTTHHH\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['35\\r\\nTTTTTTHTTHTTTTTHTTTTTTTTTTTHTHTTTTT\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['120\\r\\nTTTTTTTHTHTHTTTTTHTHTTTTHTTTTTTTTTTTTTTTTTTTTHTTHTTTTHTTHTTTTTTTTTTTTTTTHTTTTTTHTHTTHTTTTTTHTTTTTTTTTHTTHTTTTHTTTHTTTTTH\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['19\\r\\nHHHHHHHHHHHHHTTTHHH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['87\\r\\nHTHHTTHHHHTHHHHHTTTHHTHHHHTTTTHHHTTHHTHTHTHHTTHTHHTHTHTTHHHTTTTTHTTHHHHHHTHHTHHTHTTHTHH\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['178\\r\\nTHHHTHTTTHTTHTTHHHHHTTTHTTHHTHTTTHTHTTTTTHHHTHTHHHTHHHTTTTTTTTHHHHTTHHTHHHHTHTTTHHHHHHTHHTHTTHTHTTTTTTTTTHHTTHHTHTTHHTHHHHHTTHHTTHHTTHHHTTHHTTTTHTHHHTHTTHTHTTTHHHHTHHTHHHTHTTTTTT\\r\\n'], 'output': ['40\\r\\n']}]","id":336} {"difficulty":2200,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"5215112549723fea3f2c1fe0049e0b2e","execute_outcome":"RUNTIME_ERROR","source_code":"n, m = gets.split.map(&:to_i)\na = []\nm.times do |t|\n\ts, c = gets.split\n\ts = s.to_i(2)\n\tc = c.to_i\n\tif t.zero? then\n\t\ta = [*0..n-1].combination(c).to_a.map{|i| i.map{|j| 1 << j}.inject{|x, y| x ^ y} || 0}\n\telse\n\t\ta.reject!{|i| (i ^ s).to_s(2).count('1') != c}\n\tend\nend\np a.size\n\n__END__\n: || 0\n","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"],"human_solution":"$b = 4096.times.to_a.map{|i| i.to_s(2).count('1')}\n\ndef bits(x)\n\t$b[x & 4095] + $b[(x >> 12) & 4095] + $b[x >> 24]\nend\n\nn, m = gets.split.map(&:to_i)\na = []\nm.times do |t|\n\ts, c = gets.split\n\ts = s.to_i(2)\n\tc = c.to_i\n\tif t.zero? then\n\t\t[*0..n-1].combination(c).each do |i|\n\t\t\ta << s\n\t\t\ti.each{|j| a[-1] ^= 1 << j}\n\t\tend\n\telse\n\t\ta.reject!{|i| bits(i ^ s) != c}\n\tend\nend\np a.size\n\n__END__\n: || 0\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":337} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"52_B","execute_outcome":"RUNTIME_ERROR","source_code":"def count_square_triangles(n, m, field)\n count = 0\n \n for i in 0..n-1\n for j in 0..m-1\n if field[i][j] == '*'\n for k in i+1..n-1\n for l in j+1..m-1\n if field[k][l] == '*' && field[i][l] == '*' && field[k][j] == '*'\n count += 1\n end\n end\n end\n end\n end\n end\n \n return count\nend\n\ninput = gets.chomp.split('\\n')\nn, m = input[0].split.map(&:to_i)\nfield = input[1..-1]\n\nresult = count_square_triangles(n, m, field)\nputs result\n","description":"You are given a n\u00d7m field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A right triangle is a triangle in which one angle is a right angle (that is, a 90 degree angle).","input_specification":"The first line contains two positive integer numbers n and m (1\u2264n,m\u22641000). The following n lines consist of m characters each, describing the field. Only '.' and '*' are allowed.\n","output_specification":"Output a single number \u2014 total number of square triangles in the field. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","notes":null,"sample_inputs":["2 2\n**\n*.\n","3 4\n*..*\n.**.\n*.**\n"],"sample_outputs":["1\n","9\n"],"human_solution":"\nn, m = gets.split.map(&:to_i)\nfield = Array.new(n){Array.new(m, 0)}\nrows = Array.new(n, 0)\ncols = Array.new(m, 0)\n\nn.times do |i|\n line = gets.chomp.chars\n m.times do |j|\n if line[j] == '*'\n field[i][j] = 1\n rows[i] += 1\n cols[j] += 1\n end\n end\nend\n\ncount = 0\nn.times do |i|\n m.times do |j|\n if field[i][j] == 1\n count += (rows[i] - 1) * (cols[j] - 1)\n end\n end\nend\n\nputs count\n","testcases":"[{'input': ['2 2\\r\\n**\\r\\n*.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 4\\r\\n*..*\\r\\n.**.\\r\\n*.**\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3 2\\r\\n..\\r\\n..\\r\\n*.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 2\\r\\n**\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 3\\r\\n*.*\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 2\\r\\n*.\\r\\n**\\r\\n.*\\r\\n..\\r\\n.*\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 3\\r\\n.*.\\r\\n**.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n**.\\r\\n..*\\r\\n*.*\\r\\n*.*\\r\\n*..\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['4 2\\r\\n**\\r\\n**\\r\\n.*\\r\\n**\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['5 2\\r\\n**\\r\\n**\\r\\n**\\r\\n*.\\r\\n*.\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['2 3\\r\\n***\\r\\n.*.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 2\\r\\n.*\\r\\n.*\\r\\n..\\r\\n..\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['13 26\\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': ['65889\\r\\n']}, {'input': ['2 1\\r\\n.\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n*\\r\\n*\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\n*\\r\\n'], 'output': ['0\\r\\n']}]","id":338} {"difficulty":1700,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"53_B","execute_outcome":"RUNTIME_ERROR","source_code":"def cut_area(h, w)\n max_area = 0\n cut_height = 0\n cut_width = 0\n\n # Iterate through all possible cut heights\n (0..Math.log2(h).to_i).each do |i|\n height = 2**i\n # Calculate the corresponding cut width based on height-to-width ratio\n width = (height * (1.25)).to_i\n # Check if the width is within the limits and adjust if necessary\n width = [width, w].min\n # Calculate the area of the cut\n area = height * width\n\n # Update the maximum area and cut dimensions if the current area is larger\n if area > max_area\n max_area = area\n cut_height = height\n cut_width = width\n end\n end\n\n [cut_height, cut_width]\nend\n\n# Read input from standard input\ninput = gets.chomp.split.map(&:to_i)\nh = input[0]\nw = input[1]\n\n# Call the cut_area function and print the result\nresult = cut_area(h, w)\nputs result.join(' ')\n","description":"One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the height\/width quotient) can vary from 0.8 to 1.25 inclusively. Besides, at least one side of the cut area should have a size, equal to some power of number 2 (2^x for some integer x). If those rules don't indicate the size of the cut are clearly, then the way with which the cut part possesses the largest area is chosen. Of course, both sides of the cut area should be integer. If there are several answers to this problem, you should choose the answer with the maximal height.","input_specification":"The first line contains a pair of integers h and w (1\u2264h,w\u226410^9) which are the height and width of the uploaded photo in pixels.\n","output_specification":"Print two integers which are the height and width of the cut area.\n","notes":null,"sample_inputs":["2 1\n","2 2\n","5 5\n"],"sample_outputs":["1 1\n","2 2\n","5 4\n"],"human_solution":"def find_cut_area(h, w)\n max_height = 0\n max_width = 0\n max_area = 0\n\n (0..30).each do |i|\n size = 2 ** i\n break if size > h\n\n width = [w, (size \/ 0.8).floor].min\n next if width < size * 0.8 || width > size * 1.25\n\n area = size * width\n if area > max_area\n max_area = area\n max_height = size\n max_width = width\n end\n end\n\n (0..30).each do |i|\n size = 2 ** i\n break if size > w\n\n height = [h, (size \/ 0.8).floor].min\n next if height < size * 0.8 || height > size * 1.25\n\n area = size * height\n if area > max_area || (area == max_area && height > max_height)\n max_area = area\n max_height = height\n max_width = size\n end\n end\n\n return max_height, max_width\nend\n\nh, w = gets.split.map(&:to_i)\nheight, width = find_cut_area(h, w)\nputs \"#{height} #{width}\"\n","testcases":"[{'input': ['2 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['2 2\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['5 4\\r\\n']}, {'input': ['9 10\\r\\n'], 'output': ['8 10\\r\\n']}, {'input': ['15 13\\r\\n'], 'output': ['10 8\\r\\n']}, {'input': ['47 46\\r\\n'], 'output': ['40 32\\r\\n']}, {'input': ['99 100\\r\\n'], 'output': ['80 64\\r\\n']}, {'input': ['939 887\\r\\n'], 'output': ['640 512\\r\\n']}, {'input': ['4774 4806\\r\\n'], 'output': ['4096 4806\\r\\n']}, {'input': ['39271 49032\\r\\n'], 'output': ['32768 40960\\r\\n']}, {'input': ['483242 484564\\r\\n'], 'output': ['327680 262144\\r\\n']}, {'input': ['4939191 4587461\\r\\n'], 'output': ['4939191 4194304\\r\\n']}, {'input': ['9909199 9945873\\r\\n'], 'output': ['8388608 9945873\\r\\n']}, {'input': ['49829224 49889315\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49728622 49605627\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49934587 49239195\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48298903 49928606\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49874820 49474021\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48945079 49798393\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['99692141 99232337\\r\\n'], 'output': ['83886080 67108864\\r\\n']}, {'input': ['998557701 924591072\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['644590722 593296648\\r\\n'], 'output': ['644590722 536870912\\r\\n']}, {'input': ['792322809 775058858\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['971840165 826141527\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['944976601 976175854\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['1000000000 1000000000\\r\\n'], 'output': ['671088640 536870912\\r\\n']}]","id":339} {"difficulty":1700,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"5ce8de80c6953cd1e6e6eefd9ad35f7e","execute_outcome":"WRONG_ANSWER","source_code":"s = gets.chomp\nst = []\nseq = []\nrev = {}\nrev[')'] = '('\nrev[']'] = '['\ni = 0\ns.each_char do |c|\n if (c == '(' || c == '[')\n st.push([i, c])\n elsif (st.size() > 0 && (c == ')' || c == ']') && rev[c] == st.last[1])\n seq.push(st.last)\n seq.push([i, c])\n st.pop\n else\n while (st.size() > 0)\n st.pop\n end\n end\n i += 1\nend\nseq.sort!\nres = \"\", mx = -1, prv = -1, c = 0, t = \"\"\nfor i in seq\n # puts \"#{i[0]} #{i[1]}\"\n if (i[0] - prv == 1 || prv == -1)\n c += 1 if (i[1] == '[')\n t += i[1]\n else\n if (mx < c)\n mx = c\n res = t.dup\n t = \"\"\n c = 0\n c += 1 if (i[1] == '[')\n t += i[1]\n end\n end\n prv = i[0]\nend\n\nif (mx < c)\n mx = c\n res = t.dup\nend\nputs mx, res\n\n","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"],"human_solution":"A,B,C,D=[?[,?],?(,?)].map(&:ord)\ndef match(c,d)\n\treturn 1 if (c==A)&&(d==B)\n\treturn 0 if (c==C)&&(d==D)\n\tfalse\nend\nt=gets.chomp\ns=t.bytes.each_with_index.map.to_a\nsize=s.size\ntable=Array.new(size+1)\nstack=[]\ns.each{|chr|\n\tord,idx=chr\n\tif (ord==A)||(ord==C)||stack.empty?\n\t\tstack.push chr\n\telse\n\t\tif m=match(stack.last.first,ord)\n\t\t\t_ord,_idx=stack.pop\n\t\t\ttable[idx]=0\n\t\t\ttable[_idx]=m\n\t\telse\n\t\t\tstack.push chr\n\t\tend\n\tend\n}\nmax=0\nsum=0\n_l=l=r=0\ntable.each_with_index{|n,idx|\n\tif n\n\t\tsum+=n\n\telse\n\t\tif sum>max\n\t\t\tmax=sum\n\t\t\tl=_l\n\t\t\tr=idx-1\n\t\tend\n\t\tsum=0\n\t\t_l=idx+1\n\tend\n}\nputs max\nputs max==0 ? \"\" : t[l..r]","testcases":"[{'input': '([])\\r\\n', 'output': ['1\\r\\n([])\\r\\n']}, {'input': '(((\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': '(][)\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': '(()[))()[]\\r\\n', 'output': ['1\\r\\n()[]\\r\\n']}, {'input': '(][](](][[(][\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '((])(]]))(](((()[[()[[[)([]()])[(]][)]])[]]()[()[[[[(([[)\\r\\n', 'output': ['1\\r\\n[]()\\r\\n']}, {'input': '](]][)]()][[])[()(][)]))[)[]()()])[([((([[(([)][(])](][])([([)())))([(([][))[)()]][[])()[)](][[((]](](])]][(][[()(]][[)][])(][]))[])[)[(])[)()()[[))((()]]([([[(]))][(]())))))[[]]][][))[)])])()((((([[](([[()(([[()](([[([[(](]([)]())))[)]([]\\r\\n', 'output': ['2\\r\\n[[]]\\r\\n']}, {'input': '[(()[])]()[()[]]\\r\\n', 'output': ['4\\r\\n[(()[])]()[()[]]\\r\\n']}, {'input': '([])()[()]()()[(([])[]()[()([])()[][]()])]\\r\\n', 'output': ['9\\r\\n([])()[()]()()[(([])[]()[()([])()[][]()])]\\r\\n']}, {'input': '[()][([[]])][[[]()]][()[]]()()([[][]][[]][](()))[[[(())]]][]()(([([])(([[[]]()])(()))]((())))([()]([()[[[]([][[[[][(())([[]()])]]][[(())]([])]()][[](())]()[])]()[][]]([[]])[]])[(()[()((()[][()]))][])[]()()([]())](()[][][])()()[]()))[]()[]\\r\\n', 'output': ['61\\r\\n[()][([[]])][[[]()]][()[]]()()([[][]][[]][](()))[[[(())]]][]()(([([])(([[[]]()])(()))]((())))([()]([()[[[]([][[[[][(())([[]()])]]][[(())]([])]()][[](())]()[])]()[][]]([[]])[]])[(()[()((()[][()]))][])[]()()([]())](()[][][])()()[]()))[]()[]\\r\\n']}, {'input': '(][(](][[(][(\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': ')[)][)))((([[)]((]][)[)((]([)[)(([)[)]][([\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': '][([))][[))[[((]][([(([[)]]])([)][([([[[[([))]])][[[[[([)]]([[(((]([(](([([[)[(]])(][(((][)[[)][)(][[)[[)])))[)]))]])[([[))(([(]][))([(]]][(])]))))))[[[[[([[([)[[[)[(([)[[(][((([(([([(([))[[[[[[([(](])(][[)[)(](]])]]]((([))(])[[)[))[([[[[(]][)[([(]](([)([[)[[([))[)\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': '()]])()()]\\r\\n', 'output': ['0\\r\\n\\r\\n']}, {'input': '[([[)[(()[])[()][]()[[[)()[][[[()[]]]()]][\\r\\n', 'output': ['5\\r\\n()[][[[()[]]]()]\\r\\n']}, {'input': '[()][][][][]()[)])))[(]()[]([)(])[)(])()[))][)]()[][][]][][)(((([))))[)[))]]([[[)[())))[(][(()[()[(]())]])([[)[)[[())[()[]()[[[[])][))](()()())()](((((([(()]][[)([)([]]))(()[((]]())[]])][)()(][]][][(([])]]((]])([[][)])(][)][([[[[(][()(][[(\\r\\n', 'output': ['5\\r\\n[()][][][][]()\\r\\n']}, {'input': '(([])\\r\\n', 'output': ['1\\r\\n([])\\r\\n']}, {'input': '()()([]]\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '([[[]]))\\r\\n', 'output': ['2\\r\\n[[]]\\r\\n']}, {'input': '[[]\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '((((([]((((((((((\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '(((((([](((((((\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '[[])\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '((()))([]\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '([]\\r\\n', 'output': ['1\\r\\n[]\\r\\n']}, {'input': '[]())])([)][[[]])))][])([]([]()]]))))())[[([))()(])))]][)[][[])(][()()]]](]][])[[))((]][)[)(]))([])((]([)([])]]]]]]][)[[[]]([[[]]][(][][])()[[([](])(]]((]([[)])]])([)(][([)(([))(]([)[[](([(](][[)()(][\\r\\n', 'output': ['3\\r\\n[[[]]]\\r\\n']}]","id":340} {"difficulty":1800,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"77b5f83cdadf4b0743618a46b646a849","execute_outcome":"WRONG_ANSWER","source_code":"num = gets.chomp\n\nnum_of_four = 0\nnum_of_seven = 0\nans_num = \"\"\nlen = num.length\n\ndef get_bigger len\n ans_num = \"4\"\n append_times = len \/ 2\n append_times.times { ans_num << \"4\" }\n append_times.times { ans_num << \"7\" }\n ans_num << \"7\"\nend\n\ndef get_rest(ans_num, len, num_of_four, num_of_seven)\n rest_four = len \/ 2 - num_of_four\n rest_seven = len \/ 2 - num_of_seven\n rest_four.times { ans_num << \"4\" }\n rest_seven.times { ans_num << \"7\" }\n return ans_num\nend\n\nif num[0] > \"7\" || len % 2 == 1\n ans_num = ans_num << (get_bigger len)\n\nelse\n index = len\n for i in 0...len\n if num[i] == \"4\" #many 4\n num_of_four = num_of_four + 1\n if num_of_four > len \/ 2\n num_of_four = num_of_four - 1\n index = i\n break\n end\n\n elsif num[i] == \"7\" #many 7\n num_of_seven = num_of_seven + 1\n if num_of_seven > len \/ 2\n num_of_seven = num_of_seven - 1\n index = i\n break\n end\n\n else\n index = i\n break\n end\n end\n \n if index == len\n ans_num = num\n elsif num[index] <= \"4\"\n ans_num = ans_num << num[0...index]\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n\n elsif num[index] < \"7\"\n if len \/ 2 - num_of_seven != 0\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n else\n index = index - 1\n while index >= 0\n if num[index] == \"4\"\n num_of_four = num_of_four - 1\n break if len \/ 2 - num_of_seven != 0\n end\n num_of_seven = num_of_seven - 1\n index = index - 1\n end\n if index == -1\n ans_num = get_bigger len\n else\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n end\n end\n else\n index = index - 1\n while index >= 0\n if num[index] == \"4\"\n num_of_four = num_of_four - 1\n break if len \/ 2 - num_of_seven != 0\n end\n num_of_seven = num_of_seven - 1\n index = index - 1\n end\n if index == -1\n ans_num = get_bigger len\n else\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n end\n end\nend\n\nputs ans_num\n","description":"Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.One day Petya came across a positive integer n. Help him to find the least super lucky number which is not less than n.","input_specification":"The only line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910100000). This number doesn't have leading zeroes.","output_specification":"Output the least super lucky number that is more than or equal to n.","notes":null,"sample_inputs":["4500","47"],"sample_outputs":["4747","47"],"human_solution":"num = gets.chomp\n\nnum_of_four = 0\nnum_of_seven = 0\nans_num = \"\"\nlen = num.length\n\ndef get_bigger len\n ans_num = \"4\"\n append_times = len \/ 2\n append_times.times { ans_num << \"4\" }\n append_times.times { ans_num << \"7\" }\n ans_num << \"7\"\nend\n\ndef get_rest(ans_num, len, num_of_four, num_of_seven)\n rest_four = len \/ 2 - num_of_four\n rest_seven = len \/ 2 - num_of_seven\n rest_four.times { ans_num << \"4\" }\n rest_seven.times { ans_num << \"7\" }\n return ans_num\nend\n\ndef operation_with_seven(index, num, num_of_four, num_of_seven, len)\n ans_num = \"\"\n index = index - 1\n while index >= 0\n if num[index] == \"4\"\n num_of_four = num_of_four - 1\n break if len \/ 2 - num_of_seven > 0\n else\n num_of_seven = num_of_seven - 1\n end\n index = index - 1\n end\n if index == -1\n ans_num = get_bigger len\n else\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n end\n return ans_num\nend\n\nif num[0] > \"7\" || len % 2 == 1\n ans_num = ans_num << (get_bigger len)\n\nelse\n index = len\n for i in 0...len\n if num[i] == \"4\" #many 4\n num_of_four = num_of_four + 1\n if num_of_four > len \/ 2\n num_of_four = num_of_four - 1\n index = i\n break\n end\n\n elsif num[i] == \"7\" #many 7\n num_of_seven = num_of_seven + 1\n if num_of_seven > len \/ 2\n num_of_seven = num_of_seven - 1\n index = i\n break\n end\n\n else\n index = i\n break\n end\n end\n \n if index == len\n ans_num = num\n elsif num[index] <= \"4\"\n ans_num = ans_num << num[0...index]\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n\n elsif num[index] < \"7\"\n if len \/ 2 - num_of_seven > 0\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n else\n ans_num = operation_with_seven index, num, num_of_four, num_of_seven, len\n end\n else\n ans_num = operation_with_seven index, num, num_of_four, num_of_seven, len\n end\nend\n\nputs ans_num","testcases":"[{'input': '4500\\r\\n', 'output': ['4747']}, {'input': '47\\r\\n', 'output': ['47']}, {'input': '1\\r\\n', 'output': ['47']}, {'input': '12\\r\\n', 'output': ['47']}, {'input': '4587\\r\\n', 'output': ['4747']}, {'input': '100\\r\\n', 'output': ['4477']}, {'input': '1007\\r\\n', 'output': ['4477']}, {'input': '99999999\\r\\n', 'output': ['4444477777']}, {'input': '491020945\\r\\n', 'output': ['4444477777']}, {'input': '1000000000\\r\\n', 'output': ['4444477777']}, {'input': '777777\\r\\n', 'output': ['44447777']}, {'input': '474\\r\\n', 'output': ['4477']}, {'input': '85469\\r\\n', 'output': ['444777']}, {'input': '7474747\\r\\n', 'output': ['44447777']}, {'input': '2145226\\r\\n', 'output': ['44447777']}, {'input': '5556585\\r\\n', 'output': ['44447777']}, {'input': '87584777\\r\\n', 'output': ['4444477777']}, {'input': '77777777\\r\\n', 'output': ['4444477777']}, {'input': '999999999\\r\\n', 'output': ['4444477777']}, {'input': '74477744\\r\\n', 'output': ['74477744']}, {'input': '444444444\\r\\n', 'output': ['4444477777']}, {'input': '467549754\\r\\n', 'output': ['4444477777']}, {'input': '147474747\\r\\n', 'output': ['4444477777']}, {'input': '555\\r\\n', 'output': ['4477']}, {'input': '100000\\r\\n', 'output': ['444777']}, {'input': '74777443\\r\\n', 'output': ['74777444']}, {'input': '4700007\\r\\n', 'output': ['44447777']}, {'input': '70070077\\r\\n', 'output': ['74444777']}, {'input': '123\\r\\n', 'output': ['4477']}, {'input': '7474\\r\\n', 'output': ['7474']}, {'input': '3696\\r\\n', 'output': ['4477']}, {'input': '888999577\\r\\n', 'output': ['4444477777']}, {'input': '10\\r\\n', 'output': ['47']}, {'input': '7\\r\\n', 'output': ['47']}, {'input': '50\\r\\n', 'output': ['74']}, {'input': '70\\r\\n', 'output': ['74']}, {'input': '74700\\r\\n', 'output': ['444777']}, {'input': '1024\\r\\n', 'output': ['4477']}, {'input': '73\\r\\n', 'output': ['74']}, {'input': '74710000\\r\\n', 'output': ['74744477']}, {'input': '444000000\\r\\n', 'output': ['4444477777']}, {'input': '4\\r\\n', 'output': ['47']}, {'input': '9\\r\\n', 'output': ['47']}, {'input': '99\\r\\n', 'output': ['4477']}, {'input': '48\\r\\n', 'output': ['74']}, {'input': '47474749\\r\\n', 'output': ['47474774']}, {'input': '47474774\\r\\n', 'output': ['47474774']}, {'input': '4777\\r\\n', 'output': ['7447']}, {'input': '7748\\r\\n', 'output': ['444777']}, {'input': '7773\\r\\n', 'output': ['444777']}, {'input': '19\\r\\n', 'output': ['47']}, {'input': '447777\\r\\n', 'output': ['474477']}, {'input': '49102094540227023300\\r\\n', 'output': ['74444444444777777777']}, {'input': '5594108733309806863211189515406929423407691887690557101598403485\\r\\n', 'output': ['7444444444444444444444444444444447777777777777777777777777777777']}, {'input': '7004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\\r\\n', 'output': ['7444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777']}, {'input': '795193728547733389463100378996233822835539327235483308682350676991954960294227364128385843182064933115\\r\\n', 'output': ['44444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777']}, {'input': '301382122197829808656613399420562764951572481833611230329075722481445978197842266439897625476362443656208649761035811772798756428618345007502378773513842734025400853676294262578640304874925665385620969733222114618795094220591624183177469045899618693581145...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777...']}, {'input': '61136338618684683458627308377793588546921041456473994251912971721612136383004772112243903436104509483190819343988300672009142812305068378720235800534191119843225949741796417107434937387267716981006150\\r\\n', 'output': ['74444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '526555890263119757633581621127083649847999764998329920328269766380711569281960840938078129331361539566687989563999315450947936329766384488609919296219937144991099500640739013558146241313903998769582963313684489892860656024874983638946463602603155256425277...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '359656337541570495535596692229036259138254295823773970608128157371326871668822859017267990233481525685137411515967174122395178508313541575185680538495137474161755451361511571745220633267878230944078217117373968887816250287108233790111105819421028764137532...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '572644857441140132421942747255807096805833305988086651340125855451991940035910944789722427227294827027423470359892571133559384095618773815550517606000346420892372228681350021976702338348174987065145549051119174000209319265682197997993522951757272212868453...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '599043573683856104439027643553996864930172922718193050579593140227265178809688641609079296226771746172586906362910466768194741605144777924396663290857511643060746702001318791356965828356639557730036143569264957358282516093427951005380589561898704535396465...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '247259917508033213329978700283436668925247349911687193751028546114460357462478790255716737901707817670038312409017368066801666150751218179935380115953926567959905844497912181784285489131602039421150091916944721889647073139381764961167817095360280389484951...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '839620233495334132140284749179933728711264780360341030526632441846802069795764116073504594438594457833637801964773168792432938493451846064048747603976565118198470436524623419276851413981369466457677912349027626603111552645792829970978344696298865655093856...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '680596233458569705465788423601042606237639114567090011249598812263852966370382067929765546670849148288633237610391397762455232677946335852511925659516087753908296796929375220974649508429653365375822834301794663206129356594668028542246627939025276788153158...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '251195069320073844235711294718028207393569940221659141396708541865689557466668672109186992674326781218861247057053201231685981997834330221004024396276028929267033460032996060897703746809689125932584345383640925182401678896271015230499718586573789843987788...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '761398305203150236975810733176741477690360342026700695511540431700019398059040240867278292976897516645258464666995990149873433263594134554632116631317180648687891414039623144815436037002580704356809617411407023961980506764832917585434636502804912905328498...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774744777447\\r\\n', 'output': ['47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774747444444']}, {'input': '474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...', 'output': ['474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...']}, {'input': '474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...', 'output': ['474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...']}, {'input': '474777447477447774447777477444444747747747447474\\r\\n', 'output': ['474777447477447774447777477444444747747747447474']}, {'input': '461001134113023432513011122343276211132220003240540222441103160000437733232012500416111120731670263033701324623732441101023212322443134346315261012722222743233150523000143442220341502606460146270134003634627333143211007443113522314276144143340341430143230...', 'output': ['474444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777...']}, {'input': '414040460104241705103467732322410111321456730102020342430447445322177312253032133644400342076533221343224404112502131222170054211644126072412470310430200141260034460144143540431202361331322041450253407233440277130463330457165225132033131042410126100430407...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '727232045443164232004017336043067463233151253714716613434254723160000202600033757135233430131262002216223006210031640423201430416112231443425112013542002206442316216776311521427140132300426022306005202343334263322252201723173422722342103312344415331042666...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '760050172623445531303514402404000453124043133314471023027427761214614333104305332076164340144631326474433457030103502004715470012152121033505020102443110207300251363403253465111002515041024441041734352700440201030057344766451306606446421552040607420521422...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '720436431603034224320442372001212510164126522343011034262272200353230224346331046602377325243216215330412012427335500104321345532642412347545001411531332021334123306344234016051314420246202102414203133224252614423643403321763474626264064113646266130410002...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '426342607733614324413262740153004344321256222204510610145710022363007103202274030024040036131051033604742752314041224033411122373061741300054114163017140071446041107041741712206725450474064445140032402223102027224117312572027504124513573253231023762244202...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '441426001203051411643330002074010670721702321221243423230413241430525145273160403026542614300404436511601050126044121140333023404113141304404071336127011413306725435344236142100431033013230372450632043170073742425215642477306747410130704114202673234310654...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '35881905331681060827588553219538774024143083787975\\r\\n', 'output': ['44444444444444444444444447777777777777777777777777']}, {'input': '221020945402270233\\r\\n', 'output': ['444444444777777777']}, {'input': '241925018843248944336317949908388280315030601139576419352009710\\r\\n', 'output': ['4444444444444444444444444444444477777777777777777777777777777777']}, {'input': '4747474749\\r\\n', 'output': ['4747474774']}, {'input': '4747474774\\r\\n', 'output': ['4747474774']}, {'input': '3013821221978298086566133994205627649515724818336112303290757224814459781978422664398976254763624436562086497610358117727987564286183450075023787735138427340254008536762942625786403048749256653856209697332221146187950942205916241831774690458996186935811456404646236811789323768094876439465157084437560869871534201872523316846066992005560637882936334830809562078292624820844581233002526363149920224836479222262916962782197253590084513766536500009545403848192852426840541772058312141715889523051768312545350261070...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095357456864075250350735474301206523459172092665900965024129501630212966373988276932458849720393142004789869863743947961634907491797090041095838600303393556660079821519800685499052949978754418782241756597476926001413610822\\r\\n', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '5265558902631197576335816211270836498479997649983299203282697663807115692819608409380781293313615395666879895639993154509479363297663844886099192962199371449910995006407390135581462413139039987695829633136844898928606560248749836389464636026031552564252776327042072298610617772243834598332162690748633207236969041724992007258192157728677438052313486235695862788037296077269680985036263600247647374629140798940789379173021966313171953036235465755249249349065588163665746988251674366396383356070298502792947466713...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777...']}, {'input': '3596563375415704955355966922290362591382542958237739706081281573713268716688228590172679902334815256851374115159671741223951785083135415751856805384951374741617554513615115717452206332678782309440782171173739688878162502871082337901111058194210287641375328321235138624970843264230764727843223826146695894944571949545534783868546502523064898132419756343994188739630388305452374652571869884004139669269195491829709213403240366852784169546315949980917580948827513268536333560882563219185621140487441192415658128617...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777...']}, {'input': '5726448574411401324219427472558070968058333059880866513401258554519919400359109447897224272272948270274234703598925711335593840956187738155505176060003464208923722286813500219767023383481749870651455490511191740002093192656821979979935229517572722128684530242954677937234591639406543933921393584264553545070143510487963371156151075456239168079565282696851129149944325844339105076033547064540551247638951814277551769210366429591454283731387498854711853954565721620718568555448566595137725509109332252115921107203...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '5990435736838561044390276435539968649301729227181930505795931402272651788096886416090792962267717461725869063629104667681947416051447779243966632908575116430607467020013187913569658283566395577300361435692649573582825160934279510053805895618987045353964652438415121521068998564380519093332511770138915257948823516733390947075234854837912395897801204371957935278919199141471017746475157107091718499034401345614491523186724536626759825908841655120909548134640392154155024958848688514381127156723306686142535904807...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2472599175080332133299787002834366689252473499116871937510285461144603574624787902557167379017078176700383124090173680668016661507512181799353801159539265679599058444979121817842854891316020394211500919169447218896470731393817649611678170953602803894849517883798001665873931988068465608543987110990620640454899877545013197911975636074148285314482378625396130600088011743729453908525253667227663343466686616610128874683718113351607968872115913521074131076370144031597411535573153579775091402069013643224352002479...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '8396202334953341321402847491799337287112647803603410305266324418468020697957641160735045944385944578336378019647731687924329384934518460640487476039765651181984704365246234192768514139813694664576779123490276266031115526457928299709783446962988656550938563101917862878595537323788552972891863126714533416299412474952579427903233129500323585762201601802564293323199559674719189685477525001035239872876588633701351714662714644096537402039123293674231599097097956316608817023792841428845669676574868899825758178518...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '6805962334585697054657884236010426062376391145670900112495988122638529663703820679297655466708491482886332376103913977624552326779463358525119256595160877539082967969293752209746495084296533653758228343017946632061293565946680285422466279390252767881531582735704699071143669422644336968482382677106022399295637510889604714980327995172374864896407671392923337387454990017068101183306428486980166073734527006537387203654449441786013360168869241661513482001715603896843364061058570081267383864631499192030880596537...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2511950693200738442357112947180282073935699402216591413967085418656895574666686721091869926743267812188612470570532012316859819978343302210040243962760289292670334600329960608977037468096891259325843453836409251824016788962710152304997185865737898439877887665625262554006537881302950580590900934811683942391523983645058003891082579895256399594935068519494662565495158772269671887381021945464668681033132607900056573893415318336141793708024175405900967030037580867660423018691831554218206650833841038096395350137...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7613983052031502369758107331767414776903603420267006955115404317000193980590402408672782929768975166452584646669959901498734332635941345546321166313171806486878914140396231448154360370025807043568096174114070239619805067648329175854346365028049129053284984982094781973576835614806790810052616175491607897251065650265496025729051267373813224944263285375404887693716580635399939451526346010073722573695141235877186593577711475661141697689325152326767250660976204600043646233903382400942251821223989309887136900392...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...', 'output': ['4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...']}, {'input': '4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...', 'output': ['4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...']}, {'input': '4610011341130234325130111223432762111322200032405402224411031600004377332320125004161111207316702630337013246237324411010232123224431343463152610127222227432331505230001434422203415026064601462701340036346273331432110074431135223142761441433403414301432300263254301342131314327333745711213130421310313153504022700431534463141461236322033420140324202221402036761452134031253152442133141307046425107520\\r\\n', 'output': ['4744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '4140404601042417051034677323224101113214567301020203424304474453221773122530321336444003420765332213432244041125021312221700542116441260724124703104302001412600344601441435404312023613313220414502534072334402771304633304571652251320331310424101261004304075374341521421213431444010345255301410427664006112171147304147414021032230112024371431030230211332144647141336330201232340274043176313363306203143143420202461614040333610320140211530650627220442443122474573314472441637432355242111427372260743512211432352324...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7272320454431642320040173360430674632331512537147166134342547231600002026000337571352334301312620022162230062100316404232014304161122314434251120135420022064423162167763115214271401323004260223060052023433342633222522017231734227223421033123444153310426667264302040331032026321520406511056740224275234001143006323052333100544512431030133206341373241120141060440704012522372022053074013122120274015714341024302030004110272242301204335417411205430677420405031104224343443240223045046313235710010210003114400336475...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7600501726234455313035144024040004531240431333144710230274277612146143331043053320761643401446313264744334570301035020047154700121521210335050201024431102073002513634032534651110025150410244410417343527004402010300573447664513066064464215520406074205214222343114043142412273020421377253243110620014436121404500771137511233760012006402033231502312100073241421352114435005014246543751701710202010230321640610322330631312626422141150613214347310443346043015202321371147023021620400403263046403221244613123231203343...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7204364316030342243204423720012125101641265223430110342622722003532302243463310466023773252432162153304120124273355001043213455326424123475450014115313320213341233063442340160513144202462021024142031332242526144236434033217634746262640641136462661304100020044130530077371134061073024742255331246024125370622716322573071422227565311144002201243263420524414022474133745113604130724342326413154222423705403222607041123443073072420032111321133031032304144221530342320240122207474336312334520713332404562603314106212...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4263426077336143244132627401530043443212562222045106101457100223630071032022740300240400361310510336047427523140412240334111223730617413000541141630171400714460411070417417122067254504740644451400324022231020272241173125720275041245135732532310237622442021065674523445122245743317651014334372303244764351060045303423334400540434301336711037334036440040171461247051614213340233532460744331716563503417401244460317076543432605147203215122030412404612732361200631033373176171433253451540047013520215046204003724412...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4414260012030514116433300020740106707217023212212434232304132414305251452731604030265426143004044365116010501260441211403330234041131413044040713361270114133067254353442361421004310330132303724506320431700737424252156424773067474101307041142026732343106545212113601021220631163242300103556005021044402433002261262331206453254012030562324716247141475702031003434671133441345640611313467121053644271311043217043007103133201241115601351331010302104120237725041014351211121613224266301712106122174311623455402201175...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}]","id":341} {"difficulty":2500,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"98e3182f047a7e7b10be7f207b219267","execute_outcome":"WRONG_ANSWER","source_code":"$numAs=Array.new(1, 0)\n$numBs=Array.new(1, 0)\n$numAs1=Array.new(1, 0)\n$numBs1=Array.new(1, 0)\n\ndef f(a, b, c, d)\n nA=[b-a+1, $numAs[b]].min\n nB=$numBs[b]-$numBs[a-1]\n nA1=[d-c+1, $numAs1[d]].min\n nB1=$numBs1[d]-$numBs1[c-1]\n# print nA, nB, nA1, nB1, \"\\n\"\n if (nB==nB1)\n if (nA>=nA1 && (nA%3)==(nA1%3))\n print 1\n else\n print 0\n end\n elsif (nB=nA1)\n print 1\n else\n print 0\n end\n else\n print 0\n end\nend\n\ns=gets \ns1=gets \nn=gets.to_i\n(0..s.length-1).each{|x| $numBs.push($numBs[x]+(s[x]==\"B\" || s[x]==\"C\" ? 1 : 0 ))}\n(0..s1.length-1).each{|x| $numBs1.push($numBs1[x]+(s1[x]==\"B\" || s1[x]==\"C\" ? 1 : 0 ))}\n(0..s.length-1).each{|x| $numAs.push(s[x]=='A' ? $numAs[x]+1 : 0)}\n(0..s1.length-1).each{|x| $numAs1.push(s1[x]=='A' ? $numAs1[x]+1 : 0)}\nt=Array.new\nfor i in 0...n\n t=gets.split(' ').collect{|x| x.to_i}\n f(t[0], t[1], t[2], t[3])\nend\n\n\n","description":"Alice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: A BC B AC C AB AAA empty string Note that a substring is one or more consecutive characters. For given queries, determine whether it is possible to obtain the target string from source.","input_specification":"The first line contains a string S (1\u2009\u2264\u2009|S|\u2009\u2264\u2009105). The second line contains a string T (1\u2009\u2264\u2009|T|\u2009\u2264\u2009105), each of these strings consists only of uppercase English letters 'A', 'B' and 'C'. The third line contains the number of queries Q (1\u2009\u2264\u2009Q\u2009\u2264\u2009105). The following Q lines describe queries. The i-th of these lines contains four space separated integers ai, bi, ci, di. These represent the i-th query: is it possible to create T[ci..di] from S[ai..bi] by applying the above transitions finite amount of times? Here, U[x..y] is a substring of U that begins at index x (indexed from 1) and ends at index y. In particular, U[1..|U|] is the whole string U. It is guaranteed that 1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009|S| and 1\u2009\u2264\u2009c\u2009\u2264\u2009d\u2009\u2264\u2009|T|.","output_specification":"Print a string of Q characters, where the i-th character is '1' if the answer to the i-th query is positive, and '0' otherwise.","notes":"NoteIn the first query we can achieve the result, for instance, by using transitions .The third query asks for changing AAB to A\u00a0\u2014 but in this case we are not able to get rid of the character 'B'.","sample_inputs":["AABCCBAAB\nABCB\n5\n1 3 1 2\n2 2 2 4\n7 9 1 1\n3 4 2 3\n4 5 1 3"],"sample_outputs":["10011"],"human_solution":"$numAs=Array.new(1, 0)\n$numBs=Array.new(1, 0)\n$numAs1=Array.new(1, 0)\n$numBs1=Array.new(1, 0)\n\ndef f(a, b, c, d)\n nA=[b-a+1, $numAs[b]].min\n nB=$numBs[b]-$numBs[a-1]\n nA1=[d-c+1, $numAs1[d]].min\n nB1=$numBs1[d]-$numBs1[c-1]\n# print nA, nB, nA1, nB1, \"\\n\"\n if (nB==nB1)\n if (nA>=nA1 && (nA%3)==(nA1%3))\n print 1\n else\n print 0\n end\n elsif (nB=nA1)\n print 1\n else\n print 0\n end\n else\n print 0\n end\nend\n\ns=gets \ns1=gets \nn=gets.to_i\n(0..s.length-1).each{|x| $numBs.push($numBs[x]+(s[x]==\"B\" || s[x]==\"C\" ? 1 : 0 ))}\n(0..s1.length-1).each{|x| $numBs1.push($numBs1[x]+(s1[x]==\"B\" || s1[x]==\"C\" ? 1 : 0 ))}\n(0..s.length-1).each{|x| $numAs.push(s[x]=='A' ? $numAs[x]+1 : 0)}\n(0..s1.length-1).each{|x| $numAs1.push(s1[x]=='A' ? $numAs1[x]+1 : 0)}\nt=Array.new\nfor i in 0...n\n t=gets.split(' ').collect{|x| x.to_i}\n f(t[0], t[1], t[2], t[3])\nend\n\n\n","testcases":"[{'input': 'AABCCBAAB\\r\\nABCB\\r\\n5\\r\\n1 3 1 2\\r\\n2 2 2 4\\r\\n7 9 1 1\\r\\n3 4 2 3\\r\\n4 5 1 3\\r\\n', 'output': ['10011']}, {'input': 'AAAAAA\\r\\nAAAAAA\\r\\n30\\r\\n3 4 1 2\\r\\n3 3 4 4\\r\\n5 6 3 4\\r\\n3 3 2 3\\r\\n6 6 1 5\\r\\n2 4 4 6\\r\\n1 6 2 5\\r\\n6 6 3 4\\r\\n3 5 1 4\\r\\n4 5 3 6\\r\\n2 3 2 4\\r\\n3 4 4 4\\r\\n6 6 4 6\\r\\n3 3 2 5\\r\\n1 5 3 3\\r\\n4 6 1 2\\r\\n6 6 6 6\\r\\n3 3 3 4\\r\\n6 6 6 6\\r\\n5 6 4 4\\r\\n6 6 5 5\\r\\n2 3 1 4\\r\\n3 6 4 5\\r\\n3 5 6 6\\r\\n4 5 2 6\\r\\n5 6 6 6\\r\\n1 4 2 5\\r\\n4 5 2 5\\r\\n4 5 1 3\\r\\n2 2 4 6\\r\\n', 'output': ['111001000000000010101000001000']}, {'input': 'A\\r\\nA\\r\\n1\\r\\n1 1 1 1\\r\\n', 'output': ['1']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n10000\\r\\n64 79 89 99\\r\\n11 80 46 89\\r\\n33 45 11 20\\r\\n75 84 24 100\\r\\n13 20 87 92\\r\\n19 51 27 93\\r\\n7 9 25 99\\r\\n5 82 2 29\\r\\n70 76 7 31\\r\\n46 46 40 47\\r\\n78 94 6 79\\r\\n75 84 68 91\\r\\n93 100 13 46\\r\\n56 99 56 91\\r\\n14 100 39 80\\r\\n47 65 73 95\\r\\n80 93 69 96\\r\\n73 80 93 99\\r\\n75 83 87 90\\r\\n74 94 39 74\\r\\n96 98 14 53\\r\\n25 54 25 83\\r\\n73 100 48 80\\r\\n84 ...', 'output': ['0010000000000010000000000100000000100000000000000010000010000000000000010100000000010000000100000000001010001000000010000000100000000000000000000000010101100000000110001000100100010000100000000111010000000001010010000011100000000010000000000001000000010001000101010010010100000010000000000000001010000010000010000000001010010000010100000010001000000000101100010000001000000010011000000010000001000000111100001000010000010110010001000000000000000100000010000001100101000000000010010010100000000010000100001100000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['0000000000000110000110000001101000000000010100000000001011000000001001000000010000100000000000000100000100010000100001001010000010000001000000000000010000000000000101100000011000000000000000100001000001000000000001000100000100010001000000010000000010001010010000101010001100000000100100000000001000001010000011110000000000000000000011001000000000000001000000010000011000000100000000000000000000010110000000000000001000000000000000000000000111000000000000000000000110000000000010000000000000010100000100000000100...', '1001000000001000001000010000001000011000000000000000000001000000001000001000001000000010000100100001000001000000001001000000100100011100100001101000000100000001100101000000000000100010000000000010000000000000000000000000000000100000010010000000000011001000000000100000000000100100000000000000001000000010100100000000000001000010000010100110001000000000000000001000000000010000100000010000001010000000100001000000000000100000100000000000000000000000000000110000000000100100101100000000101000100000000000000011110...', '1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', '1001001001110001000000000001000111000000100000100001100011000100110000000000000000000000000010000000100011000110001000000100000000000000100111000000001010000010010000000001000000000000001010000000000110000100010000100010000000100000100000111000000001101000000000010000010101010000000000000100010000000100000010011000000011000011000000110000000000000001000100100000100000001000000100010000000000000000000000000000100000100000000000000000000000001000000001010100000000100001000010000000000001011000010000000010000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1001000000001000001000010000001000011000000000000000000001000000001000001000001000000010000100100001000001000000001001000000100100011100100001101000000100000001100101000000000000100010000000000010000000000000000000000000000000100000010010000000000011001000000000100000000000100100000000000000001000000010100100000000000001000010000010100110001000000000000000001000000000010000100000010000001010000000100001000000000000100000100000000000000000000000000000110000000000100100101100000000101000100000000000000011110...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['0000000000000110000110000001101000000000010100000000001011000000001001000000010000100000000000000100000100010000100001001010000010000001000000000000010000000000000101100000011000000000000000100001000001000000000001000100000100010001000000010000000010001010010000101010001100000000100100000000001000001010000011110000000000000000000011001000000000000001000000010000011000000100000000000000000000010110000000000000001000000000000000000000000111000000000000000000000110000000000010000000000000010100000100000000100...']}, {'input': 'CCBACACBCCCBBAAC\\r\\nCACCAAABAACBBBBAC\\r\\n20\\r\\n7 7 2 15\\r\\n3 11 14 15\\r\\n4 9 6 12\\r\\n10 15 13 17\\r\\n10 16 5 14\\r\\n14 15 12 16\\r\\n16 16 16 16\\r\\n3 15 9 14\\r\\n10 12 8 12\\r\\n15 15 9 10\\r\\n14 15 8 15\\r\\n7 14 17 17\\r\\n15 15 17 17\\r\\n15 15 5 9\\r\\n4 14 12 17\\r\\n13 15 8 12\\r\\n1 4 2 2\\r\\n6 13 17 17\\r\\n11 14 5 11\\r\\n15 16 2 9\\r\\n', 'output': ['00001100101000010000']}, {'input': 'BBCCCCCCBABAACCCABCABACCACACAAABBBCBACBBAACACCBCCACABCAAABCCACBACACAABAACABABABAACABCBBCBCCACBCCBABBCBBAACBBBBBCBCCCCCBBBBBCBACBCACBAAACABAABCBBCCABABCBABAACAACACAAACCBABCCCBBBCACCCCACAAACBAABBAACCBACBBCAAACBACBACCABCCBBBCCBAACAAAABCABACCBBAABCAACABACCBBBCBCCBBCAAAAABACBBAAACCCCACCACBBCCCBAAAACABABACBCCBABCABBAACACABBAABCCBACABAAACAABBCABBCBCBCAAACBBAAAACABBCBBABBBCCCBBACABAAAAABBCCBCCACCBCAABBACAABBBCCBCCCBBCBABCBBABBACCBAAACCABCCBAABAABACCBCBACBCCBABBCBBCBCAACCBCCAABCCCCBACCBACCCAACCCBCCCAACAAACAAACAAABA...', 'output': ['0000100000000100000000010100000000001000000000100110000100000001000100000000010100000000100010000101000001000000000000000000000000000000100000001000100000000000000001001010110000000000000000010000000000000000000000001000000000000000010001011000001000000000000000000001000010010100001001000000000000000000000000010000100000000010000000001001001001101001000100000000010000000100100010001000000000000000000010000000000000000010100001001010000000011011100000000000000000000000000001010010000000100000100010000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBACABBCBBABCAAABCABAACCABACBACBCABABBAABBBABABAACBCAABABCCACBCBAAAACBACBCBCCABCCBBBABAACBBACCCCCBCCACCBCBCCBABBCCABABBABBCBBCCCBABCACBBCCCCBACABCAACBCCCCCCAAACCCCACAAACCAAACCABBBAACCCACCAABBAAABAACBCCCAABACBABBBAAAACCABABCCBBBCCAABAAABCBBABACBBBACACABABCCABBCAACACBACACCBBBCBCAACCCACBABCCBBCBABCBCCCABCABCAABCCCBCCBAAACBABBCCCCCAABBBBBCBBABACCACABBABAACBCAACCCBBBABABCABAABCCCCACCBBBBCAAAABBBCBBBBCAABAABAAABCABCCBCCCBCCBBBBBAABCAAACCCABCAACCAABCBBABCCACCACCBCCACACBBBCACBAABBABABBAAABCCBBCCCBABACACCCCBCABCBBA...', 'output': ['0100000000000100001000000000000001100000010010000000000010010001010001001100100000000000000100011000010000010000100000000011000110000000000100101000000100000000000010000110001010000001001000000000000100000110000000110000000001001010011100000001000001000000000101001000000001000000000011000000011000000000100000000011000000000000000000000100000010000010010011100000000000101000000100010100010000100010000000000110000001000100000001000100000110000000010000010010000000000000000101010100100100000000000000000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AABCBCBBBCCBCAABABCBACBCCBCCBCAACCBCCBCBBABABAACABABBCAAABAABCBACBBCCBAAACBABBBCCBABCCBCCBCACCBABCCCAACAACABCCABCCBABCCCCBBCBCAACBBBBAAABABACACCBCCBABACBCBBCBBBCCABABBBCBCACBABCACBABCBCAABAAAACAACCABCCBABAABABBBABBAABABCCACCCCBACCBAABBCACACCBBABAAACBABBBBCABBCBCACCCABBCBACBCBABCBAABBCCBBABACBBCBCBBBABBCBACCABBCCCCABAAACCABBCBACCBAABAACCBCCBACBCBBCAABCCAABBABCAACAAABCBCCBACCACABABACBACBCAABCABCBBBCBACBABBABBABCCACACBCBCABCBBAAACBACAACAAAAABBABBBBCCCAAABACBCCBABBAAABCBCBBBAABCCCACBAABBBCCBACCABCCABBCABACCBBB...', 'output': ['0000000011010100001000010010101000001101000001000001000000010000000000000100100100001000000100000000000100000100000001010000000001100000000000010100100010010100100000100010000000010100000000000000001000000101000000101000000100010001000000010010100000000000000001000000010000010000000000001001000000111000000100010000000000001011100100000000001000001010000000000000001000000100000101010000000000000100001010000001000000000000001000001000000000000010100001000100010000010001100000000000000000001010001100000001000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BACAABBCCACACABCACACCBACABAAAACCABCAABAABCABBCABBCABABBBCBCCBACABBABABBCBAABCBBCBABAAACCBCABBBABBACCABBCABBCACCACBAAAACAAAAABBBAAACCABBAAACBCCCBACCCCABACCACBBBBBABBCBCABCCBACABBABABCCAACACACBCBCABAACACBCCACCAABCCACACACACACBBBCBCCBBCBBAABABCABBCBCBCBBBCCABBAABCBABBBCBAAACCBBBACBACBBACAAABCCCBACBABCABCAAAABABABBCAAAABACABACBAABACCCACCBCCBCCCABBABCBCABCCCBBBCAABCBBBCCBCBBBCCAACABCCACBCCAACBBBABCAACBCCAAACCCCBABAACBCBCACBCBBBBCBBCABBCBCACBABBACCCABABAABCCCCCAACABBABACBBCAACCBBABACCCABCCBACCABBBBBBBACAAABAACCBA...', 'output': ['0000000000001000110000101000001000100001000000110000000100001100000000000000000000000100100010100000001000001100110000101000010001110001100000000010000000000000011000010000000001000010000000000000000000010010000010100001000000000001100001100010001100000100000000010000000000001001000000000101000000000001010000011000111000000000001000000101000010000100000000001000000010001000100011010000011000000110000010100010100001000000010010000000000000111000010010000010001100000001001000000100000000000000010000100011000...']}, {'input': 'ABAAAAAA\\r\\nABABBAAAAAA\\r\\n5\\r\\n3 8 4 11\\r\\n3 8 3 11\\r\\n2 8 2 11\\r\\n1 8 1 11\\r\\n1 8 2 11\\r\\n', 'output': ['00111']}, {'input': 'ABC\\r\\nABC\\r\\n9\\r\\n1 1 1 1\\r\\n1 1 2 2\\r\\n1 1 3 3\\r\\n2 2 1 1\\r\\n2 2 2 2\\r\\n2 2 3 3\\r\\n3 3 1 1\\r\\n3 3 2 2\\r\\n3 3 3 3\\r\\n', 'output': ['100011011']}, {'input': 'A\\r\\nBB\\r\\n1\\r\\n1 1 1 2\\r\\n', 'output': ['1']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CCABCCBACBBABACACCCACCACCCCAACAAAACCABACBBBBBCCACAABABABBAAAAAABABCACABBAABCBBACAABABAAAACABACCCAABCCCBCBCCBBACCCBACBBACACBCBBBCBACBBCCBCBCBABAABBAAACBABCAAAACCBCBBCCBAABBBBAACBACBBABCCABBACABCABBCCABABAABCBACCBBACACAACBCAACCBCACACBCCCBCACABAABAABBACCAACBCCABABACBCBBCAAAABBCAACAACACBAAABBCACACCBCBAABABCBCCBACACCCCABBCBCCCBAABAABACBCACCACABBCBCCBBAACBACBBAABCAACBCBACBBCABABAACAAAABCACBBABAAABAACABBACCBCAABBCBAAAACACCCAACBCBCAAACCCCBACBCACCCBCBABACBBACABBBBBCBCCCCCCBAACCBAACCBCABAACBCAAABCACBAAAAABCBBCACCBBB...', 'output': ['0111000100000001100001010100000100010100000011000010000000000000000000001000100000011101001010011000000100000100011100100011000000110000010011110000000000000000000000000000001010000000000001010101000000111001000100000001011110010000010000100000000101001000000100000000000010010100000000011101110000000000010010000100100010100001000000000010000001000001000000000001010010000000001010000000001000000010000000101100110000010001001000000001001000000000001010001000100010000000011000000000100000000101010010000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBBBAABBCCCACBBBBCABBCCAACABCBCCACCCBBAABAABCACCBAABCABCCCACCACCCCACAACACCAAACCCAACAABBBCABBACBCCABCCACBBAAACABBAACCCACBBCBAAACBCAACABAABCCCABACBBABBBCAAACCCBAABBBCABCAAAACABBCABABCCBBBACCAACBBBAAAACBAACACBAABABBBCAACCACAACCAACCBBCAAABCABABCBCAACCABBABBCBCABCAACAACCBBBBBACAABCABCABAACAABCACCABACCACABACCAAAACACBAABCBBCCABBBCABAACAAACCCCBBACAABACCABABCBBBCBBABACAACACABCAACCCBBAABBABBBACCBBBAAAABCAABACCCBBABCCABAABCCCCCABBBCBABCCACBCCAACBCCABACBCBBBBBBCACBBCCCBCBAABAACACAAABAAAAABABAAACCBCBBBACBCCCAACCAACCBBA...', 'output': ['1000000000101010000000000000001010000000000000100000100010000010101000000011000000000000001000000100001000000000000000000000000001000001000000100110000100000000011000011000100001000000000000100000000001000100000000000111000010100000011100100000000000000011100010000000010000000000000000000100000000011010000000000000001000010001001100000001001000101000000100010010101000000000000010000000001000000000000000000000010001000000000101000000000101000000100000100000000100010001000100100000100000000100000100000000010...']}, {'input': 'BBAACCBACACBCCCBBAAC\\r\\nCACCAAABAACBBBBACABC\\r\\n1\\r\\n3 10 6 13\\r\\n', 'output': ['0']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBCCCCBAAACACBCCACCABABBCCCACAABACCBBBABACBBCABBCBCABABCCACACABAACBBAABBBAABCCCACABCBCCCCBCCABABBBACABBACCCBCCAACABCBAAABBCBCACAAABCCBBABACABBBBCBCACBACBBBCBBABBCBCACCACCCBCABABBCAAABCCCABACCBACBCCAACBACBABBACBCABAABBACBCBBACAABBAACCBAAACCBCBBCABBCABBCCBBCCACAAAACBCCCACABBABCABAABCCBAACBBAACACBCACCCAABBCBBACCCBBAACBBBBCCBBBBBCABBCACBBACBCCCCBBBABCACACBBCBCBACBCCACCACACBCBCACABCCCACABBACBCCBBBABBBABBBACCCACAAAAAACBCBBCBBAACBCCAABCCABCCCAABABABBBBABCBBBCAABCCAACBBAACCCCBBBACCCCBAABBCCCCCBAACCBABABBACCCABCCBB...', 'output': ['0000000000000000000000001100000110000000110001010010100001000100000001001000000000000010101001000000001100000110000101000000000000000000001001111000000010000100001000000100010000000010000001000010000000000000000010000010010001000100000100000000000000001011000000011100100100000101000000000000000000001000100001000000000101010000001100000100000000000000000001000100000001000010000100110110000000000000010010001000001100101000001000000000010011100000010010000000010000000000000010100011000000000000000000010000010...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCACAABBABBCCBAACBABACABACBCCBCBABCCCCBAACACCCCAABCAAABABBACABABACABAABBCAAABCBABCACCAAABBBCAABBABACABBCCBAAACACCACCCBCABABACCAABCBAACACAACABBBBBABBACACABCBAABCABBAAAACBABBCBCBCBABACBBBABBBBCBCAABAAACBCACAAACCBACAAACCCBCAABBBBBCBBBBABBBBCACAAAAAACBCBCCBCACAACBCABCBACBABBAAAACABCBCABCAACBABBCCAAABBCCACACBCACCCBBBBBCBBAAABAABCBAABCCBBCAABCCAAAAACABBABBBBCACABACAAAABBACAABBCAAABABABCBBACBABBCBCCAACBCCACABAAACCBAABBCAACBBCABBBBCBBAACABBABAABCBAABBCACCACBACACAACCCBACCCCBAAAACBABBABBCCCBCCAABCABCCACCBACAAACCCAAA...', 'output': ['1000000000010000000001000110000000000000000101010010000001011001000100000010000000010011001010000010100010010000100011001000010001010001000000000011000000000001000000100100101100000000000001000101110000010000000100010001101100010011000001000100011000000000001001000000000010100001000000101001001010110100001001000100000000000001000000010000101001000100000101011000001001000100000011111000001110000010000000001000010000010100000000000000100000001010000000000000000100000001111010000000001010000100000000100110000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CCAACCCCACBCBAABCCABAABCBCCBAAAAACCBBBACCBCACCCBBBCACCBAAACCACBABACAAACABCABCABBACCCBBBBACCCCCBAABCAACCCABBCBACBACBBAAACCCABBBCBCACCBAAACBCBCABAAABBBBBBABBCCBBAABCAABBAACCCBCCAABCBBABBACBAABCABCBBCBBACCCACACCBCACBBAABBCBCBACCBCBBABABCACBACAABAAACCCBAAACBAACCCBBBBBACAAACCABCAAACBAABCCBACABCAACBBBAABBCCCBAABBCAABCCBBCBACBCAAAABABBAAABBCAACCBCCACCCACACCBBCBCBCCCABBBABBBACACABBCAACBABCCBABBACBCAABACACCABBBBAACBBBABCCBAABBCBBABBAAAACABCAACBCBAACABACABAAABBCBCBBCBACBACCCCBABCAACCACCACCCAABABBBCCBBBBBBABBBBAACBBB...', 'output': ['0000000000100000000010000000010000101101111000000100100000100010101101010000100010001000000010001000000100000001000000000001000000110000000100010000000100000000001011110000000001100000000000100001010000101000000000110000000000010011000000000100101110000100000000100000000000101100011000010000000000000000000100000000000000110000000100010010000000000000100100100100000001100001000100000000000100100001011011010000000000000000010000000000000000100000100001000011000000110000100000010001000010100000000001000010000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBCBABCBCABCBABCBBACCCCCCABCACCABBAAABBACAACCCBABCCABBCBCBACCCABBAABACCBACCCBAAABBBCCBCCACAACACACBCACAABAACACABACCBBCBBBCCCCCBAAACCAABCABACCBCCBCACACBBACBAABBCBCCCAABCAAABCACCBCBACABBABACCAABACAACBBCACBBACBACACCBBCABCCBBBACAAACABBBCACCACBAABBCBAAABAABBABAACBCBBACABBCCAAABACCBAAABBCBACAABACBCCABBBCACCBBACBABBBAABCCACCAAABCAAAAABAACCCACABBBCAAAACABCCBACBBBCCCBBAAACCACBBACACCBACBCABABCBCCCABAAAACCAACAACCAABCCACBABACAABBAACBCBAAABBACBCBBBACCACAABCABCBBCAACBBACBCBCABBBCCBCABABABCACACCACCAABBAACACABAAACBBAABCBAA...', 'output': ['0100000010101000000000000010001000000100100001000010011000000100000000000010000100000100000100010110110001000000000000010000000100001000000001011000000000000010100100000000000000000100000000000000000110000100110001001000001001000100011100001010000000000001000101101000000010110011000100000100000010100100010000001000000010000000010000010000000000000011101001110000000000010000000000000001010000100100001100000000001000100010000000000000001001000000110000000000000000000000000010000000000100100001000100000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AACBCCCCABBCCACCACAACBBAAACBAAACCBACCBBCCCCAABBCCACCBABBAAACCABCCABBAAABCAABABAAABCBAAAABACABACCCCCACABABBBCABBAABAABCACACBBBAACBCACBAACBBCCBCCABCCBAACABBBCBACCCBCBAABACCAACCACACCBBABBBCAAABBCBBBCABBAABABABCCCACAAABBABBCACBBCCABBACBBCCBCBCBBBCACCAACCACBAAACBCBBAAACAABABCACCCCBBCBCAABAABACAACCBCCBAACBBCBBCBCBCCACACACCAAACBACBAABBBABCACACBBABABBCBAACCCBBCCCAAABCBBCBBCBBCCBBCACABABACCACAAAACACCBCBAABBCBCCCCCACAAACCCBBABAAABBCAAAAAAABABAABCCBBBCCCABBBBAABCBBCABBBBCCACBBCABCBACCCCACAABBCACBACCAABAABCABCCBAACCBB...', 'output': ['0000000000100000100000000000010000000000010011000100001000000100010010000100000010000010000000000100100010000010000000000000000000000000000000000000000000011101000000000000000000000001010101010011000100000000000000011001000000001000100001100001100000000010000000000000000000001000000100000000000000000000000000000100000000000100000000100010000000000010000000000100100000100010001001000000000000011001000001000000000000000000000100011000011000000100001000100000001001010000010000000001000000100000100100000000001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ACBBBBCACBCBCBACBBBACCAABABCACBBBAACABBAABBACCABACABCCBCABBAACAABBAACCBABCCACCCBBABCBCCAACBABCBBCBABBBBBBAACCAACBBBCBAAABBAABCCACBABBBAAACACBABCCBABCCCACBABAABBCAAAABACBBBCBCABBCACBCBBBAACCBACBBACAACAABCBBBCCABABBAABBACCBBBAAACCBBACCABCBCBCCAACACCBAAACABCBCBBCCABAACCCBABAACCBACBACBCABAAACACBCBABCBBBAAACCAACCBCACACBAACAACBACBCABBCAAAABBBBACBCBACACBCCBAABCBABBCCACCBBBCBABCCBBBABACACCCACBACBCCABABBBAACBCCBABCABBBACBBAABACBAABBCACBBACCACABCBABCAACBABCABBCBABABBAABABAABAABCACAAABBABBACABBCBBABABCCBABBACACCAABAA...', 'output': ['0000010001000000000000000001001001000100010001000000001000000010000000000000100000010001000000010000000000000000100000000000100001000000000100000000101000000000110100000010010001000010000010000000000000000000100000010000010101000010000000100000000000000010100000000110100000000010010001001000110000001100000101000100000000100010000000100000000100000000000010000000001000101001100000000000001000010001101100111000001110100000000100000000010000000010000000000000000000000000011000011000000010001000000000010100000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBCBCACBCCCBCBBABCBBBBBACAACAAAABCABCBCBAACBCACABBABBCBCBCACCABBCCBBCBCCCACCBCBBCAACAAABCCAABACCBCCBBCBABBBCABCBCBABCABCBCCBACCBABBACBCACCCACABCABACABAABBCACBBABCAABBBCBAACCCACCCBCCBAABBBBCCACACBBCCCABBBCCBACCCAACBBCCCACACABCAAABCABAACABAACCAAAAACCCCBABACBCBBCCACCBACAABCCCCACAAABBCBBCBCAAAACCCCABAABCABBCBCBCABCABBBBABBBAABCCCABAACAACBAABAAAAACABCCCBCBCBCCBCABCBCCCBBACCAAABCCCBCAACACBACCCABCBCCABBAABAABCBAACBBBAABAABBAAACCCCCCBCCACABBBABBBCAABBBAAABABBBCACCBCBACCAABACBBCABBBBABBCBCCABCBBABBBCAACBACABBBCACCC...', 'output': ['0000100001000000000000000000000000100000100000010000000000010000100000011100000000000000010001000000000000100000010000000000000001000010001000011000000000000000000010000001001000000110000001000000010000001001011100000001000111000000000000000010001100010000000000000010000000000001000000000001000000011000110101100000000100000000000110000000000100000010000000001010100100000000100100100000001110000000000000100100000100100000100000001000000000000000000000000001000011000000000001000110101000000100011010000100001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ABCCBBAAAACACBCBCCBCBCCAAACACCBACCBAABBCAABACACCCCAAACBAABCCABACBCCBCCCBBCBACAACBCBBBBBCBABAAABABCCCACCACCAABBCACBABABABCCBCBBABBBBBBCACBACBCABBAACABBACCBABCCCBBABBBCCCCCCCAABABCAACCABCACCACCABAAAACCBCACAAACCAACACCBABBCBBBBCACACBBAABABBCBBCACCCCCABBCCACACCBABCBABCCCCCBCBBCCCCABAACACBAACACBCBBACBCCAACCACBCAABBBABBCABABAAACABACABABACBBABBBCCBAABAACCCCBCCBBCCCCABCBABBBCAACBCCCABAABCBCAABACCABABAABCBCBCAAAABCABCABABBCAABCBACBCCACCBCBCBBCABBBCBCCBABCBACBBCBCABABABAABCCACAACAAACAAABAABABCBBCABAAAABABBABBBBBAAAAA...', 'output': ['0000000000100010001000000111100001101000000001000000001000010000100000000010001100010000000110100100000010001000100100110000001000000000011000100001010100000000010100001000100001100000000000000101000000000011000001000000000000100000100000010000000110000001111000100001011010000000000010000000000000000111000001000000001000001000000001101000111000101000100001000000000001000011000011000111010010000100001100000010000000000001000010010000011010001100000100000100000010001100000000000010001000010100100010000001000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CABCACCBABCABBCCBCBAABBBCBABCBAACABCABCBACABCCBBAAAACBBACCBCABBAAAAAABBAACCABBABACABCBCABBCBACAAACBCAABCCBBBBCBCCACBCABCCBABABAACABAAABAABABACCABACBCCBCBBCCBBCBACBBABAACACCCABACCBCAAAABBABABAAABBCCAACCABABABBABACBBBBACBCACBABBBBBAAAABACCBABBACBCBAAACABACCCCBBCBBBBAAABBBCCABCBBCBBABBCBBCABBBCBBAACBAABCCACACABBAABCCABABCBCCAAACBCCBBBAACBABCCCCABAACACBCACCCBBACAAAAABACCACBABABCABBCCAABBCCABCABABAAAACCBCBABCCAACABBCBBBCBBBCAABABBACBCBBCBACAAABBCBABCABCAABBACBBBCBACBBBCAABACBBACCCCBABBABCBABBBBCCCCCCACCCCBBAACB...', 'output': ['0000000010000001000000000001001000000000010011000010001100001100001000001000000000000000001001001000010100000000000001000010000100000000000000000010100000000000000100110100001010000011000001000100000000110010000001100101001000000001000000000001000010000000010000000010000110000000110000001000000011000010000000000100100010100000000100000001000000010010000001000100000001000001100001000000100000000100100000000001100000010000000101010000001110000000100010000000000000110100000000000000011000100000000001000011110...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ACBABBCCACBACBAABCBBCCABABCBBABCCCAABBCAABBBCCAABACABBBBBACCCCBCCACCCBCCCABCACCCCBCBBCABACBBCACCACBCABBBACCBCAABCACBABABAACAAAACABCBBBCAACACABCCAABCACCCABBBABAAABBCBCBABCBCBBCBAAACACAAABBCAACACAABBAABACBBBCCBBBABCCBCABABCCABABCCCCCBBBCAAABBBABACCBBCCBCBCBCBBAABBCACAAABCABCBBBAAAABCAABBBAACBCBCBCAACCABBCBBACBCCAACAABBABCABAAACACCCCAACBBBBBABAAAABCBCCCBBCCCCABAACABACACAABAAACACBCACCCBBBABBBBBBBBCAACAAABCCBBACABBBBBCBCBBCAABCAAABCABBACCBABABACCBCBACCABACCABACBBCABCAACABBCBCACCCACBACCCACABACAACAABBCABCAABCABAA...', 'output': ['0011101101000000001010000000000000000000010000000100100001000100100001100000000000000100000000100000001000100001100010000000000101000100000010000110100000000100000000001001000000010001000000000000000100000000100000001000001001110000000000001100010110001000000101010010000000010000000000110000010000000000001000001000001000000010000000110001000010001000000001000011000110000000001001000000100000000000000110000000001100000000001000110000000010010001010000000000101100101010001100010000100000000100100001100000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBCBACCBBABACBBBABBCCCCCCBACABABCBBCBBCBCAACAACCCACABACBACBBCACABABCABCAACBACCCCBBBACABCCCABCAAACAACBBCBAAACABAACCCACCBABABBCAABBACAACBCCACABBAACCABBBCABCCCCCABCCBCBAACABAABBCBBCBABAACBCBBCCCABBBBABBCACCCACBBBCBBCABCCCBCBACCCABBCACACCBBABABCAACCBABACCAABBCCAAAAACACCBCBABBBBBCBACBCBAAAABCCCABBAAACCBCACAAACACABCCBACCBBACACBACBBACCAACABABCBABACACAACCCBBCBCACABACAACCCCACBCABBBCBAABCBBACCCCCBCACBCCCBAAACCBABBABBBCACCBBBBAAABAACBBAACCCBACBACABABBBBBBABAAAABBABCCBACBCAACCCCBACABABBCCABCABCCCBABBCBCBCACCAAACBBACCB...', 'output': ['0000010000000001100000000000000000000000000000010000001000100000000000000001100010000000000000100100000000000000001000000011000000010000000010000000111000000010100000000101000000000000001000000000000010000000100000100100000011010000000000000100010000010100000100010010000010010000010101000100101000000000001010000110001100000010010010000000000100100100000100000000000000000100001001000010000100001000000100000100000010000101000001100010010000000000100000000000100001000000010000100011001000000000010110010001000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ABBBBAACBABCCABCACBACBAAABCCAABBCBBBCBCACCBCCBBBCBCCACBACBBCBABAACCAABAACCBBBCCCBACAABCACABCBCABABACBCAABBCABBBACCBABACBBCCABABBCAABABBBBBAAABACBCCCCACAACAACBBBCCBCBBBCAACAABCBACACCCAAABCBCBBAACCCBBBCBBBAABABACCAABCABAABACBCACCCCCCCAACCCBBACAAACAAACCABABACBACACBACBABBAAACCAAABBACACCBABCABABCABBBAABBCBCCCACBACBCCABBBBACBAAABBBAACBCCAABBBAABCACAABCABCCABCAABBCCCBBCBBABBACCACBCCACAAACCBAACBBCCACABCCABCACCCCBBCBAACBBABCAAAACBCCCACCAABBCCBAACBACAABBCCACCAACCABAAAAABBCCBCAABBAACCCAACCCBABBBCAAABAACBCBCCBBABCACCA...', 'output': ['0000001101000000000000010001000010000000000100000000000000000001000011101000000010010000000111000100011000000010101000000100000000000000001001000000100001000001000000000000000000100100100010000000000000000000000110010000000000001000000000000000000000000000000101001000000000000000100000000000000001100000000000001000001000000000000000100000001001000010000000001000010001000100000110000000010000000110100000000001101000000000000011000000000000100000100000100000000001000001001000001000000010100011000110001000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CCBCABAAACBCCBCACBBACCBABABACCABAABABBABCAACABBCABCCBCCABBCBBBCBCCAACAABBCBACABABABACCABAAACBABCABACAABCBAAACBABCCBACBBABBCBBCBCAAABCCAAACABAAABCCCCACACCACBBBCABBCABCBCCCBBCCACACABCAACCCAACABCBABCABBABBCABBCBBCAABBBCCCCBBBAABBACABACCBBACCCABACCCCBBBBBBBBACBCCBCBBBCACABBBBBBBABCABBABCBBACCAACACCACCABCBBABBAAAAACAAABCBCACCCCBABAACBCAABABABCAABCCACBCBBABBABACCBBBACCACBCCBBBCAAABBABACAACCBBBBCAABAABCACBCACACABBCAACCABBAACABCBBCCCAAAABCABBBACCCBAAABCBBCACCBBACBABAAACBBBAABAABBABCCACCABCABBAACACCCAAAACBBCBBACACB...', 'output': ['0010000000011000010001000000010000110001100000000000000000000000000100000100001000000010000100000000010000000000001000001100000000100101000010000000000000000000000000000001000010100010010101000000101101010000110000100010001000000100000100000000110100000000000000010000000000000000011000000000010100000010101110000100000010000110010000000000000000001001000000000001001000000000100000000101000001000100010010010000000000110000000000100001001000001000000000100000000001000011100001000000000000100000000010000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCCCBAACBABBBBCBBCBCBBABAACCCABAABCBABCABCAAACABCCCCBCCBAABCABBCBCCCAACAAAABBABCAABAACBCAABCAABACBCCAAABCCCBCAABCBACBCCBCBACACCBBABCBCBCCCCCBABACBBBBCBCCABCACCABCAABACCBABBBAAACCBACBABABBCCCBBABCBBCCACBCCCAAABABCCCBCABACACACABBAAABBBBABAAABBBBCBBBAABCCCBACBBCBCBBBCBBCBBCCABCBBCBCCBCBAAAABBCCAAACBBABBACBACCAAAACCBCBCCBCBBCAAABBABCBCBACBBBCBBACAAABCACCCBCCAACAABBABCBCCAABCAACCACBCACCAAACBBABACBBACCCCBABBBBCBBCBAABBABBACBCCCCAABBCCCBAAACCAAABCCACCAACCBCACACBCAABABAABBABBBBCACABABAAACBCAABCBCBCACCCABACCCBCABCA...', 'output': ['0101000001000000000001000000000000010001001100100000010000001100001100000110000001000001100000111101100000000010100100000010010000000100001000001001000100100011100011001011000000000000000100010000001000001000000000000100010000001110010000010000000010000000001001100000001001000000000001010000000010010100000010000000101010000101100001000000000000000010100000000101000000000001011000101000100000100010000000110011000101000000000000110110000100000000000010000001100000001111100000000000000011001000010101100000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCACACAABBACBBCCBCBABCCAABBBCCAABACACBACBBABACAAACBBABBBCBCBABCBAABBAAAABCBCAABACACCBBCACCCABBCBCCCAABABCCCCAACCCCAACBCACACBABCABCCBCABBBAACBCACABBCCABCBAABCBABABAACBACBBAABCAAAAABCACACABACCABCABAACCBCABCAACACACCAABACACBBBCCBABCABBCCCACAACCCABABCCCBBBAAAAABACBABCABACBABACBAACBCACACBAABBCABACACCACAABBABCCAACCBCBABBACCBACCBCCBBABBACBBCBBCBBBAACBACBAAACBBACABACAACBBABCCCBCCCCAABABACBABACAACBABCCCCCBBAAABACBCCAAAAACBCBAABCAABCBAACABABBABBBCAACBCBCCACABACCCABAAACBAABACBCCBAAABABACBCABCABCACAAACBACBACCCAABBCABCB...', 'output': ['1000100001000010111000000000000001000000000000100000000000000100000000010000101100000001000000000000000000101000000010010000000000000100000010000000000110000100000000001000000000000111000000000000100010000011000000010000000001000100000100000000000000000000000000010011100100000001001000000000000000010010000000010001000000000000000001001101100010001010100000000101000001000000001000100010100000000000000000000000000001010100000000000010100011000000000000000100000000001011001000000000100001010001000000000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AABCABAAAACACBCCBCBABAABBBBCCBBBAACBABCAABCACCCCABABBACCACBCCCBBBACCCAABACACACBACCABCACCAABCAABBABABCBACBACACCBCBBABCBCBBCBABAABBBCCCBACABAABBACCACCBABCCCCABACBAAABBBCCAABABABACACACCCCBACCCAABCCCAACCAAAACAABBBACCBABCCCBCCACCCBACABBBCBCCCBCCCCABCCAACBBACACBBBCAABBBCCACCBBCABABABABBAABCBBCABCBABCABBBBACBBACCCAABBCCCCBABBCCBCBBAABBACBBABCBABBABABBCABABCACCCCBABBBBCBBCAAACBBCCCCCCBBAACABACAAAAABCACBBBABBBABCBBABBBBBABBABBBBCACBBBABCABACBBBCCCCBBACACCCCBACACABBBCBBBAAAABBBABABBCABCCBBBCABABACCCABAAABCBBBCABBBBB...', 'output': ['1100001000000000000000000001000000010000000000000010000100010000000010001000100100000011010011010011100000000000000001010000101010000000000000000000000110010000000100000000000000001001000000000000010100101100000000000001000000001100100000001000000000010000000000100100010100000100000010010000000010000011000000000000000000101000000000001000001010010000100011010000000011110000001000000000000010000100000100000000100100000000000000100001000000001000000011011100000001000000000000000000000000000001111100000100010...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCACCABBBBCBCBCCABCBAACBABCBBCCAACCCCBABCABAACCBCBAABCBCCBACCCCAABACCCABCCABCCBABBABABAAACAACAABBCCBCCBBCCAAAABBBAAAABAABCBBAAACCCCBACBCAAABCAAAABBACCCCBCBCACAAACABBCBCCCAACCBBCABAABCCCCABCCACBABAAACAAABACAABCABBABBBBAABCBBABBBAAACCACAACCAAACCCBBBBBACBAACBBABACBBBAABBBCCACABCBCBCBBCACBBCBCBBAAABCAAACBACAABBACABAAABBABACAAAABCBBBBBABCACAABCBACBBBACACBACBAACBCAACBBABBAABBCBBBBAAAACABBABACACCBCABBCBBAAACCAAACCCBBBCAACBBABACACCCABABBBAACCCBCABACABACBAACAAACCACBBACABCACABCCCBACACACBCCBBCBCCCBBACCCCCAAABCBACBBBA...', 'output': ['1101001000001000001110110100111100001010100000000000000010000000000000101100010000001000000100000111001000000001010000001111001100000010000010000100010000010000001000000000101100000000100100000010000000000000000000000000100101000010010000001000000001000000100000010000000000000010000000000010001010000000000000000010010100000001000000000000000000000001000000011000000000010000000101000110100000000000100000001001110000001000000010100001011000000000001101010000000100000001100000001000110000000000000110100000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ABAACBBABABACCABACBBABACABBAABBBACCBBBACCCCBCABAACAAACCACACBBCCBBBBBCCCCBCABBAABABBABCBBACCACBCCBCCBBABACBBBBBAACACACACCBACAACBCABACCBCBCBABCCACCAABAAABAABAACAAABBCCBCCBBCABABBBABBBCCBBABCCCCCCCCBBAABBAAACCCBCBBAACBBCCBCBAAACACCABCCCACBACCAACBCBCBAAAACBACBBABBCBAABABACAAABACABABBCCBBACCCAABBCBBACCAABBCBCBCAAAAABAAABAABBCCCCCBACBBCCCBCCCAAACACABCCCABBCCCBAABBBAABCBBCCBCAACBACCBBBCCCBBCBCABCBCACABAABCBCCBBACBCABCCCCCABCCABBCACACBCBBBCBCBCCBACCAAABCBBBCAABBBABBBBCABCCACCBBCBACBBAAACCACCCCAABCBBABAACBCCCAABCBB...', 'output': ['0100000000000010001000010010000011000000000001000000000000110000000000000000101100000101000110000010000010000011100000110000000100000001000000110000000010000000000101000000000000001000000010000001000000000001000010000010000000000010010101000001100000100101010000000000000010000000010000000100010001000000000100000001000000000000100100000000000000000000000101000101000000000001010000100000000000000000000000000000000000010000000110000000001100000000000101010001001001100010000000010000000000010000000000000100100...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBBABCABBBBACCBBCCCCCACCCCCBAACABBCAABABCBBBAACCBCACBBBABBACBCACBCABCCACAACCCAABCBAAACCCBCAACABAACBBBBAAABACCCACBACCBBACCABBACCBBBACBCAABBACCCBBBAAACAAABAACCBBBCCBCBCABBCBBCBCBCAAABACCACBBBACCBAABAAACCCCCACBBABCABCCCBAABCCCBBCCBAAABAABCAAABBCBBBBCCCABCCCCCBBBCBBBCABCCBABCAABABAACBACABBABCAABCCCCAACCBABCACBACBAACABABACBCACACABBCACABCAACCBABBCCCBAAAACCACCBCBCBACCACAACABACBBCCAABCCCBBBCAAAACBBBBABCAABCAABCCCCBAABCAABBBBCACBAAAAAABCABCACACBBCCBCAAABBBBCCBBABCBBABCAABACBACCAAACABAAAACACACCACCABBCBBCABACACABBABA...', 'output': ['0000000110001000000000000010000101010100001010000000000000000000010100000000000001101000000100000000000000000000101100000000000000100010000000001000000100000000001000000000110000000000001100000010001000100100000001001000100000110000000000010010000101000001000000010100010100001000010000011000000000010000000001000010010100000000000010110101000100000100000000000000000001000000000101000000000010000000001000010100010000010000000100000000000100000000000010000000000000000000000000000000000100001000011000000000100...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AACBCBACBCCCBCAABBCACBAAACBAABBCBACCBBAABABBACCBCACCBACBACABAACACCBACCAABCABBAABCBBABBAABABBCAABACBBCBBCBABCACCBCACCCCBBCAACCBCACBBACCCCBCBACCBAAACAACAAAACABCBCCBCCCABBABBBABCCAABCCCCBBBCCBCCCABBABBBCABBCBBCBCCCCACCACACCBBBCCBAAACBABAAABBCCBCACBACABCCABCCCBBBCACBCAACBBACACCBCBBBBCBBCCBACBBCCCAAACCBCAAABCACCCCCABBAABACCACBCAABACAABACBCCBACBCACABCABABBBCAAACCACBBCACACACCBCAABCAAAABBCCACBBAAACBCAACACCCBBAAABCABBBCBCACCBBAABBABBCCAABBCABCABBABBBACACCCBBCAACABCACCCCBAABBBCACABACABBCBABBCBBBCBBAABCCABCCABAAAAABB...', 'output': ['0000000000000110101101000101000010000000100100000010010000000000000000000010000000010001000001101000011011000000111001000100010001010000000000000000001010000001010100010000010100001101100110000000001000000001010010000000100001000000010000000000000000010001000001100000000100000001000000001000101001000000000000000000100100100100111000100001100011010001000000010010000000000000000000001000000001000000001000000010001000001000100010000000100000101000110001000000000001110000010100110010000000011010000000001010001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCACBCBBCABACBBABCCCBACABCACCACBBBABBBBBBCBCACBACACCAACBBBBBABABCCABCBBCACCCABCBBABCCBBBCAABBBCCCABCCCBBBCAABCBBBACCABAACBCBCBACABCBAACBAAABCCCCBCBCBCBCCABBACCABBCACBCCCAABCBACBBABCACAAAAABCBCCCACABBAAAAACBBABCBCAACBBBABCCAAABBBBBBBABCBBBACCCACBBACCAABCBBCBAAAABCBBCAACBACACACCCACACAACCBBCBABBCBCABBBCACCBBACCACACBCCBBBBCAAACBBAACBCCCABCAABCBBBCBACCACCCCCAAACCCABCBBCACAABACAAABBCBAABAAACCABAAAABCACBABCBCBABACCCBACCCCBABABBACBABBBACBBBABBBCBAABABACBAAABBBCAACABACBACCBACCCABACBBABABACACBABCAABCCABCBBABBCAABCBC...', 'output': ['1000000010100100000000000100000000001101000011110000000000010000000000000010000000000000100010000000110000000000010000110000000000000001000000000000001000010000001011000000000100000100100010000000000001000010100000100000010000010000000100001000001010010001010110000110000000000001000001010000001010100000000000000000000001000010000000000001000000100001000100010001000100000000000000000011000000001011000000010000010011000100000010011000010001101000010000000000010001101001011000000001010000001000000010001001000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBBCCABCBBBCCBCBCBCABCABACBACCBCCBACCCACBBACBCBBAACBCACCACABCBCAAABBCCCCCACACBCCAACCBCCCCBBBBBAACAACCAAACAABCABCCCBBCBBCBBBCBAABBBCACBAACBABABCBBCAACACCAACCABCBBCCACCBCCCCCBCAAABBCACCCCCBCBBBBBABBBBBAAABACAAAAACBBBCCCCCBBBCBCABABCBBBBACCCCAACCBBACCBABCABBCACAAABCAABABBBBBCCBCBAAABABCBBCCBBCCCACAAABBCAABACCBBBBCACBBCBBAACACCBBBACBBCCCACBAABAABACBAAAAAACABBBACBBABBAABCCCABABCCABACCCABCCAAAAAAAACCBCBBABBAABAABCABAAACCBAACCCCCCBABBCABBBCAABCCCCAABABABABBAACCBAACACCABCBACCACCBACBBCACAACABCCCBBACCBABBBABCAACBAAB...', 'output': ['0101000100010000000000000000000000000000000100000000000100001000010000101100000000000001100001010110000100010000000000001010010000000100000000110001001000010000000001000000000100000000000011001010000101001001000010010100000000001000000001000001010010001000010000100010001000001011000110000000011000101000010000111010011100000001101000100100001000010000000000000000000000001110000000000100000000010100011001000001000100000000000000000000010001000100011100000000000000000000000000000000100000010011100000000000001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BBCABCBABBACCBCCBCCAABCCBCCABAABCABBCCBBBAAAABAABBBBCCCCCACBCCABCAAAABAABCCCACCCACBBCAAABCCCAAABAAACBBAACBCBABACCCACAAAABAAAAABACBABAACABBBCAABACCCAAACBCBBACCACABAACACCBBBBCCAABBCCAABBAABABAAACCABACCBBCBCBABACACBBCCABBBCCABCBCCCBBCAAACBCAABAAACACAAACBCBAAABCCACCAAAABABCCABBCBCABCCCAABBCBCBBCCBACBBAABABBCAAABCACBCCBCBBCCCACBCBAAACCBABCACAABBBBBBBCBACBBCACBCABAABCBCCBCAACACBBCCCBACBAAAACBABCBBBCBBCBBCBCABCAACAABBCCBCAACCBBBAACBABBBBABACBBAAAAAAABBCBAABBBACABABABBBABBCACCBAACAAACCABCBCCCACBABBACCCABCCBBCAAABC...', 'output': ['0001100000001001100000000100000000000000000000011010000000010100000001000010000110000011000001000000000010000000110000000001000010000100001000001000011000001000100010001000000010001000100110000100000000000000000001001000000100010000100001010000100110000100000000001100000100001000000000000000000001000100000101010010000000000000001000010000000110000000000000010000000001000000000110001100001001000001101000000000101000000000000010000001000000000000000000000100000000000000000000000000100110000000001000000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CAABAABCCCABCBAABBCBCCABACBBBCBACCBAACBABAAABBCCCCBBABAABBBABABCCABCCBBCCCCACABCACABAABBAACCABBCCACCBCBCACACBCCABCABBBBCBCCCACBCABAACBABACAABACCCBCCACAAACCBBAAAAAABCBCBAAACACBBCABBABBCBCCCBCBABABCBBCBBCACBCAABBAAACABACCBBBACCCCABAACBABCAACBBAABABACCCCACBAAAACBBCBCCBACBABCCBABCBABAACCCCABBCBCCBCACBCBBCAABBCABAAABACBCBBAAABCAAABACAACACACBACCAABABACBAACCCBCBABCACCBABCBCBBCABAAABBCCCACBBCBBAACBCCAACBACAACCCAAABBBBBBAAABACCBBCAACABBACCABCACABBCCCACBCBCBBAABABCCAAACCAACABBAACABABCBABABAACCBACCAAACBBBCABABCCBABAB...', 'output': ['0000011000000011000001000000101010001000101000110100000100010111000100100000100100000001001000000000001010000000101100000000010000000100000000000101001010000001010010000010000010000100000000000000101100000011010001100101101010000000000000011000000000111000001110000000100000000100101000001010000011000110100000000000001000110100101100000000000101000100000000010001000000000010100000000100100110000001000100000010001000001100010000100101000000010010000000100000100000011000110000000010000000010000100010010001010...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BCABBBCACABBBCBBACCCCBCCBACABBCACBBCBCBBACAABCBBACBBCBCAAAABBAAAABACABBBBCCAAABCCBBACCCCAAACCBBCCCCBBAABABCACCCCCBABACABCCAAABCBBABCBCBACAAABACAABBABBBACCAAABBBCBAAACABABACCABCAACCBABBBAAABBAAABACABABCBBAACCAABBCAAACABBCBACAAAACBCABABBACBACBCCAAABBBCABAAACBACBBCBBCBABBCCACBBCCCBABBCBABBBACACBCACBACAACCBACACABCAAAAAACCBBCBCAAAABCBBBABCACACABAACCBCACCBBBAABBBCCBACABBCCCABBAACCABBABCACCACAAABCAACAABCCCBABABCBABCBBCACACABCABBCBACABCAAACAAABBCBBCACBCAACCACBCABAAABCAACCCACABABACACAAABCBCACBBBCCBAACAACACBCBCCBCBC...', 'output': ['0100100100000000001010000010010000000010010010000001001100000000010001001000000110101110100000000000000000000000000000010001101000010001000000000000101001000000000000010010001111000000000000111000110000110000000010001010000000000000010000011000000000000001100001000000001100000000000000000001101000000010000000000010001100000010100001010100000000101000010001100000110001000000000010000000000100000001010010000000001110100000010000000000110010011000000000000000000000010000110010000101000000000000000000000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBCBBCCABBBBCCCBBBCCCCBCBACBABBBCBAAABCCCBAAAABABACCBACACCBBAACBCCAABACAACBBACCCBBACABBBCCCCCAAAAAAAACCCACABBBBCBBACAABBCBACAACCCCABACCCBCBABBCABAAAAABBAAACABAACBBBCCABCACBBCBBBCBBBCBCCBBCBCCCBBBCBAABCCAAACBABACCCBABBBCACCCACCCCBCACAAAACCAACBCBACACCCCBCACBABCAACAABCCCCCCBCBBBBABCCBBCBCABACCBBCACAAACABCABACCBABCABBCBCCAABACBBCAACCCBACBABACAABAACABBCCAAAAAABAABCCCCACABBCAAACBCCAABCBABABCABCBBCAACAACCCCABACBABCBCCBCCCABBCBABACAACCCABAAACBCABBBBCCCBACABCCCCCCBAAAAACCACCAAACCACABCBABCABAABACABCBBCCCBBBCCCBBCBAB...', 'output': ['0000110000000100000000011011011100000010000000010000001010001100000000000000101010100000000000000001000000010011100000001000000000100000100000100110000000010000001000000000000100001010000000000100100001010101000100000000101000000000000110010000000000110100010011010000000100000000100010000010100001100011010000000101100000001100000000000000011000000000000101001000001000000000010000010010110000000000000010010001010000000000000000000000000000001000000001101000010011010100010110001111000000010000010000000010110...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AAABAACBCCBACCABBCAACACAAABAAACBCCACCBBBCCCBACBCCBCCACCBBAABAABCACCCCBACCCCCCCBABACCBCCCAAACCBBAABCBCAACBACBBAABBBCBCBCABACAACAACABCCAABAAABBBCCACCBBABBBBBBCCBCCCBBCBABBCBBAACBCCCCBBBABABBBCABCCCBCAABABCABCACABACABCCCCBCAACAABAACBABBACBCACACCBAABAABCACACCCBACAACBCCBABCABCBBCCCBAAACAACCCABAABABBACCAACABBBBBBBCACBBABBACBBAACABCBABCCABBBBCABBCAACABBBCBBAAAABCCCABABBCCAACACBCCCCBBBCBBBCBCBCBBABCBACBACABAAABCBBAABBAABACBAAACACACBCBCCBBBBBBAAACAAAABCABACCCBABBBCACBABBCCCBBABAABBCBBBCCABACCABCCCABABBAABACAAACBCCA...', 'output': ['0000000000001100000010001000000000000000000000100000010100000000000000000001100000001010001100000000000100000110010010010100000001100000010000000000000000000001000000000010001100100000000001000001001101000010100000000000001000000010100000000001100000000100011100010000000000001010000010001000000001000100010000000000000010100100001000000010000000100011010100000010000010110001000011000100011000010000010010000001010110000000010000101101000010000000101010000000010111000000000000000000000000001010010100000100001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'BABCBBCCCCCBCCBAACCACAAABACCCCABCBBBBBCCBBBBBCCBACCCCBCBABCBCBAACABCCABBBCBABABAAABBAAAAAABCBBACCBCBCBBBBBACCAAABACBABBCBABCCCAAACBBABBACABBBAABCCCCCBCCABACBABABBBBACCBAAACBACCACBCCCBCCBCCABCBAABABBBCABBCCBCCCBACBBCABBCBCABCCABACCCACCAAAAABBBABAAACABBABACCACCABBCBBAAABBCBBBBACBCCBBCCACCBAACBBCABABCCCAAAACCABCACCCCBCACAABCCABCBBCABCBAABBCBCBAAACCACCCCCCCBBAACABCABBBCAACBBBABBACCABBCCCAACBACCBBBBBCBBBCBACBABCAABABBCACAAABABAACBCAACBBBAAACAACBCAACACBCBBCABABACBBAACBBBBCBCCAACBACCBAABCBCACBBBCACCACCBCCACAABCAB...', 'output': ['0000000010001000000000000000000000000000000001000001000000001000010000000010000000010010000010100000101000000000011000100000000010000000000100000000000000000001000100000000000010000000000100010110000100001000000100000000000000000000000000000000000000010000100000010000001000100000000100100000000000001100000000011000000100000000000000000001000010000000000000000000101000000000001000000100000000010000001001011000000000010000000000000000000000000000010000010000000100010000010000000010000000000010000010000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ACCCAABBCABACCBABCACBBCBCABBCACACBBCACCABBCBACCAACCBCCCCBABBCCBCBACABABBCCBBCABACCABBABBCBBABCCCABCBCCCACABACBCCBABBBACBBCCACCBCBCCCCACACBBCBCAAACABABCCBBCBACCABACCAAABABCCABCCCBCAAABBBAABAABBCBCAABACBAACABACBCBBCCCBACBCABAAAABBCACCBCCBBBCCBBCBACABCBCAACCCBBBBBCABBBBBCBABABBBCCBABCBBBCCACBABBABACACCBCCBBAAAAACBACBABABCBABCCACBBBBCBBCCBCCACCBACCBBACBBACACACABCABABBACACABAABACCCABBABAACBABBCABCCACCABAACCABCBBBABACCBABACACACABCABCAABCCBCCCCBACCCAABBCCCABACAABCACBCCAABAABBBBBBCCBAABACBABCACABACBCBBCBBACAABCACA...', 'output': ['0101000010100100011000000000000000000000101100000000001001100010100111000110011000100001010100000000010000000000000001100001000000001000001001100000000010011000010000000000010000111000000010000001000100000001010000000010000000001000010000000110001000100101010000000000000001000000000001010000000000000000000000000010000100001010000000000000000000001100100010001001000100011000000000100000000011100010111000000000000000000001001100000000010010101010001000000000000000100000000000000000100001001001000010001000010...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBCABBCCABBACCCCBCCABABBABCACABCBABBCCCCAABCBBBCBACBABCCBBCBBCACAAACCACCBCBCBAABBCBBCCCCBBCAABBBACBBAAACCCCAABBCBACBABACCBCBCBBBCCCBABABBCBACCACABABBAABACACCCACABCCCBBBBABABBAAABACACBAABBCAABBBCBBBBBCBACAAACCCCABCACBBBABCACABCBACCCBCABCCACCCCBCAABCBBABBCBBAABBBCBACBBACCBCBBABCAACCACCCCABBBCBBBCCABCBACBAABBCABBBAAAABABBACBCBACBBBCBABBBBBAAABAAAABBBBCCACACBABCCABCBCBCAACCBACCAABCCACCABBCBBABACCCBCCCBACABBCCBACBBBBBAACABCAACABABCACBAACABACCCCBBCCABAABAACACCCCCCBACBCABBBACCCACBCBACBBAACBBBBCACCABAACACBAAACBBAB...', 'output': ['1000110000000010000000000001011000000010001010000000000000011000001010000000000000000100100000000100000000000000100000010100000010000000010000000000010000000000100000000000100100000000000000000100010000001010100000000100100000000000011000000000000000000000010000001000010000000001001100110000101000000010000010000000000010000000000000000000001000100000010010000000001110000010000000100000000000100001000010000001000000000000100000000110010000000000000000001001000000010101010010000001000001001000000010000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AABBACCACCACBCACABABACACBBBBBCCCBCCABCCBACBCBBAAAACBCAAAACBAAABACBCCCAABAABBABAAABAABCAAACAAABABCABBABACACBBBCBACCBBBCCBCBAABBCAACAABCBABABACCABBBCCCCBBCCBABAAAABCCACCBBCBAABABBCCBBAABBBBAABBAABCBACCAACAACABCCAAABAACCCCACBBBABCBABAABAAACABACBBBACBBAAACCBBCAAABAABCACCCBCABABACCBBABBBBACBAACBCACAAAAABCBCACCCCAABBCBCCBBACBABBBBBACACBCBCCBAACCCBABCCACBACCCAABBBBBCAAABACABACCCCCCCCAACBBBACACBBAAABBAABCCCCAACABCCCCBBABBBAABCCAAACBAACBCABCCCBCAACABCBABCABAACABCBCCBCABCBCBBBAABABBCAABBBBACBBABBBBABBCACBABBACABBBCA...', 'output': ['1010110000010000000001000000000000000100000110001000000000100001101000000000010000110000001000000100001000001000010000000000100100010000000000000000000000000001000000000000101110000000000000000100110000001100001000000100010100000000100000001000001000100010001000000000000001001000001000000000010011010001000101100000011100000001000001100000001000000000100000000000000000010010000000001100110001000000100000000000010000100000100000001011100000000010010100100000110100000001000101000000000000000010000010000000001...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CABBBBCCCBAACCABACCCAAACABAABBACBBCCCCACABBCBCACBACBCCCACBABCACBBBBBCCBACCACCBCBBBBACABBAACBCCCACAAAABCBABCCCAACBCAACAACCCCBAACCBBBCAAAAAABBACAAABCBABBAACACACBACACAAAAABBAABCBBCCAABCAAACCCBABABCBCBCCAACACCCABAABCCBABBBACAABABAABAABACABBABCBACABCACABBBACBBCACACACCBBBCBCCBACACACBBBCCACACCACCBBABBCBAAABCBCBABBAAABABACCBAABCABABBBCAAACBBBBBCBCAAAACABABCBABABCCCBABBBAAABABBBABBAABCBBCACBAACABCABBCCCBCCACBBAABACBAABCBBABBCACCACAAACCAAAACCABCBABACBCBAABBBBAAABBCACAAAACBBAACBBAAACBCBBBCBBBACACBAACAABCAAAACBAACBCCB...', 'output': ['1000010010000011100000010010000000000100101100000100000000010010000000101010000000000010110000000000000100100000110000000001100000001001001101000000001000000101000000000001000000101010010000100011110000001001001000000110001000100010000100010100001000100000001000000000000000000100000100000000100100000000001100000000001000010100000000100000101000000001000010000010010001010011000000100100000010100000000010011001000000001011100111000000000000001000000000000100010001000000000000000111010000010000000000100100000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'ABCCACAAACBCCCABCBACCACCBBBCACCBBAABBCCBAABABCBBCBCABCABBCCACABCCBCACCCCACBABCCBABBAABCCCAABACAABAAACBAABAACAACBCBAABBCAACBCAAABCCBABABCCBBCABBCCABCBBCCCCCCCCBCCBAABBCBCACACABCBCCCBAACCBAABAACAACCABABBCCCACBBCCBBCCABCACBCCAAAAACABBBBBACBCBBACACCCBCAACBAABCABAACCCAAACABACCAAAAACAAAABBCCCAAAACACCBABAABBAAABCACBCABCABCBCAAACBCCBBCABBBCAABCCBAABACACAABACBBBCCACAABCAACCBACAABABCBABCABABCBCABCACCCCCCBCBBBCCBBCBCBAABACBCBACACBAAAABBAABCACACABBCCCACCAACACCCCCBAABBCCAABBCACABBABBBBACACCACCACCAABCBACBBBCACAACBBABACA...', 'output': ['0001100000010000000000001010100000000000000000000100000000010000001001000011000000010000011000011000100000111001000100000000001000000100000011000000000000000001001000000011000001010000000100010000000000101000000100100000000001100101000100000010000000011000100000010100001100000000000000100000010000100100000001000000001000110011000000000111100000000100000100000000010110000000101000000000001110000000010100001010001000001011000100010000010010001000011001000000000000000000000000001000000000000010000101000000000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'CBBACAABAAACCCBABCCACBBAABABCBBBBCCCABACACAABBBAACBAACABCABABBCACCACACCACCACCCCCCBAACBAABBBBCBABBACBCCACBABABBCABBCCCCACBCACCAAAABCCABCABCBCAABBBAAACAACBABBCACABAAAACABCCBABABABCABCBACAABCBCBCCBBBCCCCBBAABBABCCABACACBBBCAABBBCBAAABACCCABCCABBCBCBCBCAAABABCCAAABAAAACCCCBABCCACCABCBBAACCAACBCCAAACBACCABCCCCBACCAACBBBCACBBCCBCCBBAACCACCCBBAABBCCBCAABBCBCBBACBACCBABCBCBCCBCCBBCABCABBCCACABBCCCCAAABCBACABBACCACABBBAABAABCCBCCCABBBCABCAAAACCBCABCCACABCAABCAACAACCBBBACBCCBCACACACBBBCBBBCAACCBABCCCACABCABACCBBBACB...', 'output': ['0000001000000000000010000000010010000000000000000000001100000000011000000111000000000000011110000000000000000000000000001000100000010000000000001101000000001010100000011000010010000010010000000100000010000000000101010000000000001000000011000000001010000000000000000000000000000000000001000000010000101001010000000100010000010001100101000000010000001100010100000000100010100000000000001001000001000001000100000001000000000000000000000000000000000100110010101100000010000000000000000010000000000000000000000001000...']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AAAAACAAAAAB\\r\\nAAAAABAAAAAC\\r\\n20\\r\\n1 6 10 12\\r\\n10 12 7 12\\r\\n9 12 8 12\\r\\n2 6 8 12\\r\\n7 12 2 6\\r\\n9 12 7 12\\r\\n1 6 10 12\\r\\n4 6 3 6\\r\\n7 12 7 12\\r\\n4 6 5 6\\r\\n3 6 12 12\\r\\n5 6 8 12\\r\\n9 12 1 6\\r\\n2 6 3 6\\r\\n10 12 2 6\\r\\n1 6 12 12\\r\\n7 12 3 6\\r\\n9 12 3 6\\r\\n10 12 10 12\\r\\n11 12 11 12\\r\\n', 'output': ['11111111111111111111']}, {'input': 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC\\r\\n1000\\r\\n151 202 152 202\\r\\n80 101 149 202\\r\\n3 101 124 202\\r\\n103 202 127 202\\r\\n150 202 71 101\\r\\n140 202 47 101\\r\\n...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': 'AAABABACACACAAACAC\\r\\nAABCBBACABACBBCBCC\\r\\n20\\r\\n6 17 17 17\\r\\n14 17 13 14\\r\\n1 13 7 12\\r\\n11 17 5 17\\r\\n6 10 16 17\\r\\n16 17 16 16\\r\\n15 17 17 17\\r\\n15 15 7 10\\r\\n1 4 10 14\\r\\n4 11 2 17\\r\\n6 9 1 7\\r\\n16 16 11 18\\r\\n4 14 6 17\\r\\n1 17 6 18\\r\\n13 18 15 18\\r\\n1 12 5 11\\r\\n8 8 12 17\\r\\n10 15 3 7\\r\\n17 17 9 14\\r\\n6 17 6 6\\r\\n', 'output': ['00010001011111100110']}, {'input': 'AAACAABB\\r\\nCACBCCBB\\r\\n10\\r\\n2 2 4 5\\r\\n4 4 3 3\\r\\n1 4 1 8\\r\\n5 5 2 8\\r\\n7 7 3 4\\r\\n6 6 2 2\\r\\n1 7 1 1\\r\\n6 7 7 8\\r\\n4 6 6 8\\r\\n8 8 6 8\\r\\n', 'output': ['1111010011']}, {'input': 'A\\r\\nCB\\r\\n1\\r\\n1 1 1 2\\r\\n', 'output': ['1']}, {'input': 'BCBBC\\r\\nABBCB\\r\\n5\\r\\n2 2 2 4\\r\\n3 4 2 4\\r\\n1 2 2 2\\r\\n2 3 4 5\\r\\n5 5 2 4\\r\\n', 'output': ['10011']}, {'input': 'ABAABAABBBAAABAAABABBAAABBABABBBBBAAAABAAAABAABBAAAABABABAABBABBBAAAABBAABABABBBABAABBBABBABBBBBBBAAAAABAAAAABAAABBAAAAABAABABAAABBAABBBAAAAABABAABAABABABBABAAABBABABBAABBBABBBBAAAAABBAAABABAABBBAABAABABBABABABBABBBBABAAABBBAABBABABBBBABBAABBBBABBBABBBBBBBBBAAAAAABAAAAAABAAAABBAAAAAABAAABABAAAABBAAABBBAAAAAABAABAABAAABABAABBABAAAABBAABABBAAABBBAABBBBAAAAAABABAAABAABAABABBAABAAABABABABABAABBABABBBABAAAABBABAABBAABABBABBABBAAABBBABABBBAABBBBABBBBBAAAAAABBAAAABABAAABBBAAABAABAABBABAABABBAABBBBAABAAABABBAABABA...', 'output': ['1000010000011000000000011010010000000000000000011010011001011000000000000000000000000000000000011010011001011010010110011010010000000000000000000000000000000000000000000000000000000000000000011010011001011010010110011010011001011001101001011010011001011001001000001001000000001001011000000000000000001001011001101001000000000000000000000000000000001001011001101001011010011001011000000000000000000000000000000000000000000000000000000000000000001001011001101001011010011001011001101001100101101001011001101001001...']}, {'input': 'CCBCBAACCCBCBCBCBBCACBCBBBBBBBCACCCCCCCCBBBCCBBCCBBBCABBCACBBCBCBBBBCBCABBCBCCBBCBBCBCCCBBABCCCBBBBCCBCCCBCCACCCBBBBABBBCCCCBBBCBCBBBBCCCCBCCBCCCBBCBCCBBCCCABBCCBBCBCABCBBBCCCCBCACCCBCBCBBBBCBCCBAABCCBBCCCCCCBBCCBCBBACBBCBCCBBCCBBBABBBBCCCCCCACBCBBBCCCCCCBCBCCCABACCABCCBBABBABCBCCAABBBCCBBBCCBBCCBCCBACBCABBBCBCCBCBBBBCBCBCACCABCCBCCBCCBBCBBBCCCABCBCBBCCCBBBAABBBBCCCCCBBCCCBCCCCBCCCBCBCBCCCBCCCCBBCCCBBBBBCABBCBBBBCBCCCCBABBCBBCACAABBBABBBACBCBCCBBBBCBBACCCBBBCBBBACCBBBBCCBCAACBBBCCCCBCCBABCCCBCBBBCCCBBABBBB...', 'output': ['1100001101010000010000100100011001010101000000100010100101010100000010001000000001001000010010000101000000000000010100010010000000111100011000001101000000000000000001100010000110001111110001011000100000000100100100010000000000010001000100000000000100000001000100000000010000001101001011000101100100110100010000000111001100100101000101101001000001001001001000001001000100010001001101001001000010010110000010010000000000110010000101100010110010011110000010000011110010001110010101000011001101100100010000000000000...']}, {'input': 'BCCBACCCCCBBACAACBACBCBBCACCCBBABBCCBBCCBBCBCBBBBBCCCBBCACBCCBCCCBBACBACCCBCBABBCCCBBBBCCBCBCBBBCBBCCCBCACBBCBCCABAABCCBBCBBBCBABBCCBCBBCBBACBBCCAABCBCCCCBCCBCCCCBCCABBBCCBABBCCBCBACCBCCBCCBCBCCACCCABCCBBBBBBCCBCBBBCBBBBCCBCBCCBBCABCBCBCCCCCBBBBBCBBBBABCCCBCBCACBBABCCCBBCCACCCCBCCABCCBCAACCCBCBBCCCBCCBBBCCCBCCCCBACCCBBBBCCCBBBCCCCABBCBBBCCBAABCCCCABBBCCBCCBCBABCABCBCCBBCBBCCCCCBBBBACCBBBCCCCCBBCABCBBBCBCBBCABBCABBBCBBBCBBCBACBBCBCBBBCCCCBCBACBCBBCCCBCBBBBBABBABBCCCCCBCBBBBBBCBBCCCCBACCBCCCCCBBBCBCCBAAABBAB...', 'output': ['0000000000100100001011000000100010011000010011010101100110000010010000000010110000000010000110010101000000100110000101100000001000110000000000001000000001000100001000000111010111101000000100000001010101001010100100010100010000000000101110000010011100001101000100100000100001010101000000001010000100110000001101110101000010000000110101001100001111101000100100000110000001010100001010000000101010111110010110000001110000000100000100011100100100000010100010001001100010011000000100011000000100000000100000100001000...']}, {'input': 'CCCCCBCCCCCCBABBCCAAACCBCBCCACBCCBCCACABABACAAACBBBCBCBBCCBCBCCCBAAACACBCCCCBABABACBACBBBBBACCBCCCBABBCCCCCBABAAAACBBBAABCBBACBBACCBABCCBABCABBCACCCBCCBACBCBBBCCABBBCBBCCCBABBBABACBABCBBCBBBBBBCABBBCBABCBCCCCABCCCACCBCBACCCCCBCAACCBABCBACBCCBCACABBCBABCACACCBBCABCBBABCACCAAABABAABACCBCABBCBACCCBCCBBBBBBBBBCCBBBCBBAACCCABCBBCAABBBBBCBBABBBBCBCCCBBACABBCBCAACBCBACCACBBCAACBCBBBCCBBCBBCCBCAABBBBBBACABCCBBBBCCCCCBCCBBCBBCCBCCBAABBCCCBCABCCBBAACCBCBACBBACCBBCBBACBBABCCBBCABBCBBBCACCCABCCBBBBCBBBCAACCBBCBAABBBCB...', 'output': ['0110000100000100000001001000100000010010100000000100001000000000100010000000000000100001000100001010001000001100001011010000010101000100000000001100000000000000010110111001000000000000010000000000111100000011000010000000001000001001001010000100110000000000000010010101010000000110000000000101000010000000000000001000100000100100100000001001000110000110000011000010000011000000001000001110100010000000001010000000001000001000000010010000000100000001100001000101000011000000000110100010100000101010000001001001101...']}, {'input': 'ACCBBCCCACACBCCCBBCCBBCBBCCABAACBBCBAABBBBAACCABACACBABBCBACCAABBCBBACCBACBCCCCAACBCBBCAAAAABCCACCABBCACACBAAACAAAAAACABCCAAAACCCBABCBBCAABCCCCACAACACBCBACCBBBCBCABACBBCBAAAABCCCACCABACCAACCCCBBABBBBBCBBCCAAACCCACCAABBABBACAAACACBBBBBBBCCCCACAACACAAACBABCBCCBBACCBABCABBBCBBBBBBCBAACCABBABBBCCAACBBBBCAABBABAACCBCCCBCBBCBBAABBABCBCACBABCAAABACBBCABBACBABABABCCACCCABBACABBAABBCAABBCCBBAABBBBCBACBBCCBACBBBABCBCBCBCBBCBABBAABBBABABAACBCCBCBBCBCBBCCBBCACABCBACACCCBBCABBBABBABCBCAAABBBABACBBCCAAAAABACACAAACABCBCA...', 'output': ['0000000100100110010000010000000110001011000000000000001000100000000010000000000001000000001101000100000100000000010010000010000001011000100110100010101011000100100000001001001100010000100010100100000100001010100101001000100010010001000100000000011100000001000011001000101100000000101100001000100000010011110110110000000100000000000000100000000010010000010010110100000000000000011001010100010000000010000000000100001010010110000000110010001001001010011000100001010000010101100000101000010000000010000000000010101...']}, {'input': 'CAABCCAAACCACBCCBCACAACAAAAACABCABBABBAABCBCBBACACCCCBCAAAAAABCACBAACACAACBCCBBBBCAABBBBACBBCBBCABCAACCAAACACBAAACABACBCACCCBAACACAAACCABBAABCAAABCABBAACBAABAAAABACBCAAAAABCAABAAACCACCCAAACBAABACABCBAAABACAAACBCAAABCCBBCABABCAACCCBBBCCCCBBAABAABABABACCACACAABBAAACBACABABABACACBCBACCCBBACBACCBBBABCCBCBBCBAABABAACCABBCAACCCBAACCBCBAACABBAABCBABAAABCCCBAABABAAACAABBAABCABACBAAACCACACBABABBBBBCCBCCCACABACBBACBABAABCBBACCACBACBCBABACABCACABBBCCABABABAAAABABCACBCCCBCCAACABABCBBBAACBAABACCABBAACAACBABAACAABABCACC...', 'output': ['0000000100000000000000000100000000001000001000110000000000000000000001000000010100010000000100010100000010000101001001101001001110000000100010000000001000000100000011000000011000010000000000000000100101000110000001000000000000000010001000011001100100001000001000000010000010101110011110010010000000110001100010010000001001001001010100001000010000000010000101010000000000100000001000101101010000000000000000000001000000001000000110000011010011000100000011001010000010100000100000000000001000000011000100100000100...']}, {'input': 'AAAABBBBCABBBBACBBCABBACBACCACBCCACCBBACBACACAAABCCAAAACCCCAAAAAAAAABACACABCAAACBBABBAACCAACACAABCBAACBCABABCBBBCAAAACACBCABACBBABABCAAABABBCCCABBCACABABBCAABAABABAAACBAACBAACABCBABCCABACAAABBCBACCBCCAABAAACACAAAAAAAAAAAAAAABBBCCCCBAACACBABACCABBBACAAAACBACACCBCBABABAAACACACBAAABBCABAABBCAABAAAACABACABACBCACCBABBBCACAACCAABBACBAABCBBABCAAAACAACAABACCABBCCCBABACBACACBAAAAAAABAABBAAACACCBCAABAACABCAABCBCCBAAACCACACCAAAAAAAAACAABAAAAAAABBCBBBAABCAABACBAAABABCCACAAAAAAACBBABBCAAAABABCBBAAAABBABAAAAABBBBAACCCAB...', 'output': ['0010000000100000000000000010010000000100000010000010000000000101000000010010000000100010100000010010010000110000001000000010000010001000000000010100100100101000000101010010000000001000100000000000000010100000000010100011100000100000000010001000000000000010010000000000000001000000000010000001110100100001100100100000000010001000000000000000000000000001000000000000000000000000000101000000000100100000010001000001010110001000010101000001000011000000100001000101000000000101010001000000001000010000000000000010001...']}, {'input': 'CCABABCABABBACBAACAAAAAABAABAABABBBCBCBAABAAAABCAABABACAAAAABABAACBCBAABCBAACBCCABAAAAABACAAACCAAAAAAAAABABABABAAAAACCABABAAAAAAAABABABBAAAAAAAACBAAABAAAABBAAACBAAAABACBBACABAAAACAAAAABBBCAACBBAAAABCBAAAAAAABBACCCCACBCBBBBAAABAABAAAAACBAAAAAAAAAACABBAAACCCAAAAAACAACAACAABABAAABAAAABAAABCCAABABBAABCBBAACACCABCBCAABABAABCAABAAABCACACAACCACCCCAAAABBACCAAAAAAAAAACBACBAABABAACAACAAAAABACABAAACAACBAACACABCAAABABACCAACCAAAAAAAAAAAAAAACAACCAABCAACAABAAABAACACCACBBCACAABAAAAAAAABCAABAACABCAACCCACABABAAAAAAABAAACCBA...', 'output': ['0000000000000100010011100000000000010000100000010100001000100010001001000000010010010011000001000010000000000000000010000000000000001100000100100000001001000100000010010000011011001010000001000000100110000000110000000110000110101100001101000000000000000010000000001000000101000000000100100010000000110000110001100110000000000000101000000000101000000000010000000010000000100100000010000000000000100000000000000000000010000101000001001000000000101000001100000010000000000000000001001000000100000000100000000001100...']}, {'input': 'CAAAACAAAAAABACABCCAAACBAABAAABABAACBBBABAABCAAAABAABBAAABAACABABAABAACAAAABCABBAAAAAAAACAAAABCAACAAAAAACAACAAAAACACAAAAAABBBCCAAAACCCACBABCABABAAAAAAAABABACABAACACCAAAABCACAACCCABAAAAABAAAAAABABAABAAAABAAABABAAACAABACAACABCABBAAACAAAAAAAAAAAAACACAAAACABAABABAACAAAAACABAAAAACAAABAAAAACABCCABAAAAAAAAAAAAABCABBAAAAAAACAABAAAABBBAACAABAAACAAAAACAAAAACAAABBBAAAAACABAACAAAACABCABBCBABAAAAAAAAAAAAAAAAACAAAACAAAAAACAAACAAAACACBAABAAAAABAAABBAAAABBACACACAAAAAAAAACACAACAAABAAAAAAAAACAABACACCACCAAACBAAAAAAACAAABAAAB...', 'output': ['0000000000000000010001010000100000100000000000100000100000101100010100010000000000011000000000001000001000000010000100000000010000010110000000000000110000000100010000000010010110001010000000010001010101000100000001001000000000000101000000000001000000000001010010000000010101100010000100010000000001010101000110001000010010100001010100000000000001000000001000000011000000000000000000100001010000111000001000000000000000010000000010010000000010100100000110100010010000000100010000100011100010000000000000000000001...']}, {'input': 'AAAAAAAABAAAAAAAAAAAABAAAAAAABCAAABBAAAAACCCAAABAAABAABAAAAABAAACACAAAAACCCAAAABACCAAAAAAAAAAAAAAAAAAAABAACCAAAAAAABAAABAAAAAAAAAAACAAAAAAAAABAAAACAAAAAAACAAACACAAAABAAAAAAAAAAAAAAABBAAAAAAABACAAAAAAAACABAAAABCACAAAACAAAAAAAAAACAAAAAAAAAAAABAAAAAAAAAAAABAAAAAACAAAABAAAAAACABAAABACABACBAAAAACAAAAACAAAAACBAAACAAAAAAAAAAACAAABAACAAAAAAACAACABAABABCAAACAAABBAAAAAAAAAAAACAAAACAAAACABAAAAAAAAAABAAAAAAAAAABAAACAAAAAAAAAAAAACACAAAAAAAAAAAAAAAAACAAAAAAAAABAAACAAACBAAAAAAAAAAAAAAAAAAAAAAACAABAAAAAAAAAAAAAAABAAAAAAAB...', 'output': ['1000111010000001000000000100000000000100000000000000000000110010000000000001001100010100000000000000000000001000100000000010000000000010000010000001000010001101100000000101100000000000000100100000001000000000000000000000000000000000000000100000010000100001000000000001000000100000000000000000100100000000000001011001000100000000000000000000000001000001000010000000111010000000100000111000000000000100000001010010111000001000000001100100000000000000010011000001010010000001000000000010000000000000000100000010110...']}, {'input': 'AAAAACAAAAABAAAABAAAAAAAAAAAABAACAACAAAAAAAAAAAAAAAAAAAABAAAAAABAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAAAAAAAAAAAAAAAABACAAAAAAACAAAAACAAAACAAAAAAAAAACAAAAABAAAAAAACAAACAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAABAAAABAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAABAAAAAAAAAAAAAABAAAAABAAAABAAAAAAAACAAAAACAAAACAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAACAAAAAAAAAACAAAAAABAAABBAAAAAACACAABAAAAAAAAACAAAAACAAAAAAAAAACCAAAAAAABACAAAAAAAAAAAAAACAAAAAAAAAAAAAA...', 'output': ['0000001100000001000010100000110000000000000010010011000000000001000001001000010001100000100100001000101000011001000100010000000010000000001110000111000000000010001000000000000000000000000010000001000000000001000101010000000101000000000001100001000000011100000000000000000100000100000010000000000000001000000010000010000001100000100000000010000010101000000000010100110010000000000000100100110000001000000000000000001011000001001000000000001001000000000000000000110000111000000000000100100000000101010110110011001...']}]","id":342} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"a17bac596b1f060209534cbffdf0f40e","execute_outcome":"RUNTIME_ERROR","source_code":"n, k = gets.split.collect{|x| x.to_i}\n\nold_scheme = \"aaaa\"\n(1..n).each{\n scheme = nil\n lines = Array.new(4) { gets.chomp }\n \n lines.each_index{|i|\n pos = []\n lines[i].scan(\/[aeiou]\/){pos << $~.begin(0)}\n if pos[-k].nil?\n puts \"NO\"\n exit\n end\n lines[i] = lines[i][pos[-k]..-1]\n }\n\n scheme = \"aabb\" if lines[0] == lines[1] and lines[2] == lines[3]\n scheme = \"abab\" if lines[0] == lines[2] and lines[1] == lines[3]\n scheme = \"abba\" if lines[0] == lines[3] and lines[1] == lines[2]\n scheme = \"aaaa\" if lines[0] == lines[1] and lines[1] == lines[2] and lines[2] == lines[3] \n if scheme.nil? or (old_scheme != scheme and old_scheme != \"aaaa\")\n puts \"NO\"\n exit\n end\n \n old_scheme = scheme\n}\n\nputs old_scheme","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"],"human_solution":"n, m = gets.split.map(&:to_i)\nb = [true] * 4\nn.times do\n a = Array.new(4){gets[\/([aeiou][^aeiou]*){#{m}}$\/]}\n 1.upto(3) do |i|\n if b[i]\n b[i] &= a[0] && a[0] == a[i]\n j = i != 1 ? 1 : 2\n k = i != 3 ? 3 : 2\n b[i] &= a[j] && a[j] == a[k]\n end\n end\nend\n\nif b.all?\n puts :aaaa\nelsif b[1]\n puts :aabb\nelsif b[2]\n puts :abab\nelsif b[3]\n puts :abba\nelse\n puts :NO\nend\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":343} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"a6cba17c5ddb93f6741e00280fb6c54c","execute_outcome":"RUNTIME_ERROR","source_code":"n, m = gets.split.map(&:to_i)\nidentifiers = {}\nmemory_blocks = {}\nidentifier = 1\n\nn.times do\n\tcommand = gets.split(' ')\t\n\tcase command[0]\n\t\twhen \"alloc\"\n\t\t\tstart_index = 0\n\t\t\tblock_size = command[1].to_i\n\t\t\tfit = false\n\t\t\twhile memory_blocks[start_index]\n\t\t\t\tstart_index += memory_blocks[start_index]\n\t\t\tend\n\t\t\twhile start_index + block_size <= m \n\t\t\t\tbreak if block_size == m && !memory_blocks.empty?\n\t\t\t\tcheck = memory_blocks.select { |k, v| (k < start_index + block_size) && (k >= start_index) }\n\t\t\t\tif check.empty?\n\t\t\t\t\tmemory_blocks[start_index] = block_size\n\t\t\t\t\tidentifiers[identifier] = start_index\n\t\t\t\t\tputs identifier\n\t\t\t\t\tidentifier += 1\n\t\t\t\t\tfit = true\n\t\t\t\t\tputs \"memory_blocks is #{memory_blocks}\"\n\t\t\t\t\tputs \"identifiers is #{identifiers}\"\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tnext_index = check.min\n\t\t\t\t\tstart_index = next_index[0] + memory_blocks[next_index[0]]\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"NULL\" unless fit\n\t\twhen \"erase\"\n\t\t\td_iden = command[1].to_i\n\t\t\tiden_index = identifiers[d_iden]\n\t\t\tif iden_index.nil?\n\t\t\t\tputs \"ILLEGAL_ERASE_ARGUMENT\"\n\t\t\telse\n\t\t\t\tidentifiers.delete(d_iden)\n\t\t\t\tmemory_blocks.delete(iden_index)\n\t\t\t\tputs \"memory_blocks is #{memory_blocks}\"\n\t\t\t\tputs \"identifiers is #{identifiers}\"\n\t\t\tend\n\t\telse # defragment\n\t\t\tstart_index = 0\n\t\t\tcopy = {}\n\t\t\tmemory_blocks.size.times do\n\t\t\t\tlowest = memory_blocks.min\n\t\t\t\tcopy[start_index] = lowest[1]\n\t\t\t\tidentifiers[identifiers.key(lowest[0])] = start_index\n\t\t\t\tstart_index += lowest[1]\n\t\t\t\tmemory_blocks.delete(lowest[0])\n\t\t\tend\n\t\t\tmemory_blocks = copy\n\t\t\tputs \"memory_blocks is #{memory_blocks}\"\n\t\t\tputs \"identifiers is #{identifiers}\"\n\t\tend\nend\n","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2009\u2264\u2009t\u2009\u2264\u2009100;1\u2009\u2264\u2009m\u2009\u2264\u2009100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2009\u2264\u2009n\u2009\u2264\u2009100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. ","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6"],"sample_outputs":["1\n2\nNULL\n3"],"human_solution":"input = gets.chomp.split.map do |x|\n Integer(x)\nend\n\nn = input[0]\nm = input[1]\n\nmemory = Array.new(m) { |i| 0 }\nnext_id = 1\n\ndef find_and_fill_block(memory, len, next_id)\n head = 0\n for i in 0...memory.length\n if head <= i - len\n break \n end\n\n if memory[i] != 0\n head = i + 1 \n end\n end\n if head + len <= memory.length\n for i in 0...len\n memory[head + i] = next_id\n end\n return true\n end\n\n return false\nend\n\ndef erase_block(memory, id)\n flag = false\n for i in 0...memory.length\n if memory[i] == id\n memory[i] = 0\n flag = true\n end\n end\n\n return flag\nend\n\ndef defragment(memory)\n j = 0\n for i in 0...memory.length\n if memory[i] != 0\n memory[j] = memory[i]\n j += 1\n end\n end\n for i in j...memory.length\n memory[i] = 0\n end\nend\n\nfor i in 0...n\n input = gets.chomp.split\n command = input[0]\n if command[0] == 'a'\n len = Integer(input[1])\n ret = find_and_fill_block(memory, len, next_id)\n if ret\n puts next_id\n next_id += 1\n else\n puts \"NULL\"\n end\n elsif command[0] == 'e'\n cur_id = Integer(input[1])\n ret = cur_id != 0 && erase_block(memory, cur_id)\n if !ret\n puts \"ILLEGAL_ERASE_ARGUMENT\"\n end\n else\n defragment(memory)\n end\nend\n","testcases":"[{'input': '6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': '6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n', 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n', 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n', 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': '22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': '7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': '3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': '8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n', 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': '10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":344} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"b263917e47e1c84340bcb1c77999fd7e","execute_outcome":"RUNTIME_ERROR","source_code":"n = gets.to_i\narr = gets.split(\" \").map(&:to_i).sort.reverse\nans = nil\nif arr.include?(0)\n\tsum = arr.inject(0,:+)\n\tif sum % 3 == 0\n\t\tans = arr.join(\"\")\n\telsif sum % 3 == 1\n\t\t\n\t\tone = [1,4,7]\n\t\ttwo = [2,5,8]\n\t\tl = nil\n\t\tone.each do |o|\n\t\t\tl = arr.rindex(o)\n\t\t\tif l\n\t\t\t\tarr.delete_at(l)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\tunless l\n\t\t\tdeleted = 0\n\t\t\ttwo.each do |t|\n\t\t\t\tl = arr.rindex(t)\n\t\t\t\tif l \n\t\t\t\t\tif deleted == 0\n\t\t\t\t\t\tl1 = arr.index(t)\n\t\t\t\t\t\tif l == l1\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tdeleted = 1\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tarr.delete_at(l1)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif deleted == 1\n\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# j = arr.length - 1\n\t\t# while j >= 0\n\t\t# \ta = arr[j]\n\t\t\t\n\t\t# \tif a % 3 == 1 && one.length < 1\n\t\t# \t\tone << j \n\t\t# \t\tbreak\n\t\t# \tend\n\t\t\t\n\t\t# \tif a % 3 == 2 && two.length < 2\n\t\t# \t\ttwo << j\n\t\t# \tend\n\t\t# \tj -= 1\t\t\t\n\t\t# end\n\t\t# if one.empty?\n\t\t# \tarr.delete_at(two[0])\n\t\t# \tarr.delete_at(two[1])\n\t\t# else\n\t\t# \tarr.delete_at(one[0])\n\t\t# end\n\n\n\t\t# puts \"here\"\n\t\t# l = arr.rindex{|a| a % 3 == 1}\n\t\t# if l\n\t\t# \tarr.delete_at(l)\n\t\t# else\n\t\t# \tl = arr.rindex{|a| a % 3 == 2}\n\t\t# \tarr.delete_at(l)\n\t\t# \tl = arr.rindex{|a| a % 3 == 2}\n\t\t# \tarr.delete_at(l)\n\t\t# end\n\telse\n\n\t\t\n\t\tone = [1,4,7]\n\t\ttwo = [2,5,8]\n\t\tl = nil\n\t\ttwo.each do |o|\n\t\t\tl = arr.rindex(o)\n\t\t\tif l\n\t\t\t\tarr.delete_at(l)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\tunless l\n\t\t\tdeleted = 0\n\t\t\tone.each do |t|\n\t\t\t\tl = arr.rindex(t)\n\t\t\t\tif l \n\t\t\t\t\tif deleted == 0\n\t\t\t\t\t\tl1 = arr.index(t)\n\t\t\t\t\t\tif l == l1\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tdeleted = 1\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tarr.delete_at(l1)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif deleted == 1\n\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n\t\t# one = [1,4,7]\n\t\t# two = [2,5,8]\n\t\t# j = arr.length - 1\n\t\t# while j >= 0\n\t\t# \ta = arr[j]\n\t\t\t\n\t\t# \tif a % 3 == 2 && two.length < 1\n\t\t# \t\ttwo << j \n\t\t# \t\tbreak\n\t\t# \tend\n\t\t\t\n\t\t# \tif a % 3 == 1 && one.length < 2\n\t\t# \t\tone << j\n\t\t# \tend\n\t\t# \tj -= 1\t\t\t\n\t\t# end\n\t\t# if two.empty?\n\t\t# \tarr.delete_at(one[0])\n\t\t# \tarr.delete_at(one[1])\n\t\t# else\n\t\t# \tarr.delete_at(two[0])\n\t\t# end\n\n\n\t\t# l = arr.rindex{|a| a % 3 == 2}\n\t\t# if l\n\t\t# \tarr.delete_at(l)\n\t\t# else\n\t\t# \tl = arr.rindex{|a| a % 3 == 1}\n\t\t# \tarr.delete_at(l)\n\t\t# \tl = arr.rindex{|a| a % 3 == 1}\n\t\t# \tarr.delete_at(l)\n\t\t# end\n\tend\n\tans = arr.join(\"\")\n\tif ans.to_i == 0\n\t\tputs \"0\"\n\telse\n\t\tputs ans\n\tend\nelse\n\tputs \"-1\"\nend","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. ","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.","notes":"NoteIn the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.","sample_inputs":["1\n0","11\n3 4 5 4 5 3 5 3 4 4 0","8\n3 2 5 1 5 2 2 3"],"sample_outputs":["0","5554443330","-1"],"human_solution":"n = gets.to_i\narr = gets.split(\" \").map(&:to_i).sort.reverse\nans = nil\nif arr.include?(0)\n\tsum = arr.inject(0,:+)\n\tif sum % 3 == 0\n\t\tans = arr.join(\"\")\n\telsif sum % 3 == 1\n\t\t\n\t\tone = [1,4,7]\n\t\ttwo = [2,5,8]\n\t\tl = nil\n\t\tone.each do |o|\n\t\t\tl = arr.rindex(o)\n\t\t\tif l\n\t\t\t\tarr.delete_at(l)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\tunless l\n\t\t\tdeleted = 0\n\t\t\ttwo.each do |t|\n\t\t\t\tl = arr.rindex(t)\n\t\t\t\tif l \n\t\t\t\t\tif deleted == 0\n\t\t\t\t\t\tl1 = arr.index(t)\n\t\t\t\t\t\tif l == l1\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tdeleted = 1\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tarr.delete_at(l1)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif deleted == 1\n\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# j = arr.length - 1\n\t\t# while j >= 0\n\t\t# \ta = arr[j]\n\t\t\t\n\t\t# \tif a % 3 == 1 && one.length < 1\n\t\t# \t\tone << j \n\t\t# \t\tbreak\n\t\t# \tend\n\t\t\t\n\t\t# \tif a % 3 == 2 && two.length < 2\n\t\t# \t\ttwo << j\n\t\t# \tend\n\t\t# \tj -= 1\t\t\t\n\t\t# end\n\t\t# if one.empty?\n\t\t# \tarr.delete_at(two[0])\n\t\t# \tarr.delete_at(two[1])\n\t\t# else\n\t\t# \tarr.delete_at(one[0])\n\t\t# end\n\n\n\t\t# puts \"here\"\n\t\t# l = arr.rindex{|a| a % 3 == 1}\n\t\t# if l\n\t\t# \tarr.delete_at(l)\n\t\t# else\n\t\t# \tl = arr.rindex{|a| a % 3 == 2}\n\t\t# \tarr.delete_at(l)\n\t\t# \tl = arr.rindex{|a| a % 3 == 2}\n\t\t# \tarr.delete_at(l)\n\t\t# end\n\telse\n\n\t\t\n\t\tone = [1,4,7]\n\t\ttwo = [2,5,8]\n\t\tl = nil\n\t\ttwo.each do |o|\n\t\t\tl = arr.rindex(o)\n\t\t\tif l\n\t\t\t\tarr.delete_at(l)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\n\t\tunless l\n\t\t\tdeleted = 0\n\t\t\tone.each do |t|\n\t\t\t\tl = arr.rindex(t)\n\t\t\t\tif l \n\t\t\t\t\tif deleted == 0\n\t\t\t\t\t\tl1 = arr.index(t)\n\t\t\t\t\t\tif l == l1\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tdeleted = 1\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\t\t\tarr.delete_at(l1)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tif deleted == 1\n\t\t\t\t\t\tarr.delete_at(l)\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n\t\t# one = [1,4,7]\n\t\t# two = [2,5,8]\n\t\t# j = arr.length - 1\n\t\t# while j >= 0\n\t\t# \ta = arr[j]\n\t\t\t\n\t\t# \tif a % 3 == 2 && two.length < 1\n\t\t# \t\ttwo << j \n\t\t# \t\tbreak\n\t\t# \tend\n\t\t\t\n\t\t# \tif a % 3 == 1 && one.length < 2\n\t\t# \t\tone << j\n\t\t# \tend\n\t\t# \tj -= 1\t\t\t\n\t\t# end\n\t\t# if two.empty?\n\t\t# \tarr.delete_at(one[0])\n\t\t# \tarr.delete_at(one[1])\n\t\t# else\n\t\t# \tarr.delete_at(two[0])\n\t\t# end\n\n\n\t\t# l = arr.rindex{|a| a % 3 == 2}\n\t\t# if l\n\t\t# \tarr.delete_at(l)\n\t\t# else\n\t\t# \tl = arr.rindex{|a| a % 3 == 1}\n\t\t# \tarr.delete_at(l)\n\t\t# \tl = arr.rindex{|a| a % 3 == 1}\n\t\t# \tarr.delete_at(l)\n\t\t# end\n\tend\n\tans = arr.join(\"\")\n\tunless \/[^0]\/ =~ ans\n\t\tputs \"0\"\n\telse\n\t\tputs ans\n\tend\nelse\n\tputs \"-1\"\nend","testcases":"[{'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n', 'output': ['5554443330\\r\\n']}, {'input': '8\\r\\n3 2 5 1 5 2 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n5 5 4 1 5 5 5 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n', 'output': ['33322222200\\r\\n']}, {'input': '12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n3 6 1 6 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n', 'output': ['999666330\\r\\n']}, {'input': '5\\r\\n9 6 6 6 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 2 2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n3 3 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '7\\r\\n3 3 2 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '6\\r\\n0 3 3 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 1 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 4 4 4 4\\r\\n', 'output': ['444330\\r\\n']}, {'input': '7\\r\\n0 3 3 2 2 4 4\\r\\n', 'output': ['4433220\\r\\n']}, {'input': '7\\r\\n4 2 3 3 0 0 0\\r\\n', 'output': ['4332000\\r\\n']}, {'input': '4\\r\\n1 1 0 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n3 0 2 2\\r\\n', 'output': ['30\\r\\n']}, {'input': '8\\r\\n3 3 3 5 5 0 0 0\\r\\n', 'output': ['333000\\r\\n']}, {'input': '8\\r\\n3 3 6 3 0 7 7 9\\r\\n', 'output': ['963330\\r\\n']}, {'input': '9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 0\\r\\n', 'output': ['90\\r\\n']}, {'input': '10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n', 'output': ['32222220\\r\\n']}, {'input': '10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n', 'output': ['31111110\\r\\n']}, {'input': '10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n', 'output': ['44444430\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 4 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 4 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '3\\r\\n2 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['3210\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n8 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 8 5 6\\r\\n', 'output': ['600\\r\\n']}, {'input': '4\\r\\n5 8 3 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n1 4 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n2 2 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n3 2 5 0 0\\r\\n', 'output': ['300\\r\\n']}, {'input': '4\\r\\n5 3 2 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '5\\r\\n0 0 0 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 3 5 8\\r\\n', 'output': ['30\\r\\n']}]","id":345} {"difficulty":1900,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","execute_outcome":"RUNTIME_ERROR","source_code":"number_of_books,limit_height = gets.split.collect! {|x| x.to_i}\n\nbooks_height = []\nbooks_height = gets.split.collect! {|x| x.to_i}\n\nmax_books = 1\nresult = []\nmax_h = min_h = books_height[0]\nmax_i = min_i = 0\nmax_sub_h = 0\nmin_sub_h = 1000000\nmax_sub_i = min_sub_i = 0\ncount = 0\ni = 0\nwhile i < number_of_books\n#(number_of_books).times do |i|\n# count = i + 1\n# max_h = min_h = books_height[i]\n# max_i = min_i = count - 1\n if max_sub_i > i\n max_h = max_sub_h\n max_i = max_sub_i\n else\n max_h = books_height[i]\n max_i = i\n count = i + 1\n end\n if min_sub_i > i\n min_h = min_sub_i\n min_i = min_sub_i\n else\n min_h = books_height[i]\n min_i = i\n count = i + 1\n end\n max_sub_h = 0\n min_sub_h = 1000000\n max_sub_i = min_sub_i = 0\n while count < number_of_books\n if max_h <= books_height[count]\n max_h = books_height[count]\n max_i = count\n elsif min_h >= books_height[count]\n min_h = books_height[count]\n min_i = count\n elsif max_i < min_i && max_sub_h < max_h\n max_sub_h = books_height[count]\n max_sub_i = count\n elsif min_i < max_i && min_sub_h > min_h\n min_sub_h = books_height[count]\n min_sub_i = count\n end\n if (max_h - min_h).abs > limit_height\n break\n end\n count += 1\n end\n if count - i >= max_books\n if count - i > max_books\n result.clear\n end\n max_books = count - i\n result.push [i + 1,count]\n end\n if count == number_of_books || number_of_books - i <= max_books\n break\n elsif max_i >= min_i\n i = min_i + 1\n elsif min_i > max_i\n i = max_i + 1\n else\n i += 1\n end\nend\nputs max_books.to_s + ' ' + result.length.to_s\nresult.length.times do |i|\n puts result[i][0].to_s + ' ' + result[i][1].to_s\nend\n\n","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"],"human_solution":"number_of_books,limit_height = gets.split.collect! {|x| x.to_i}\n\nbooks_height = []\nbooks_height = gets.split.collect! {|x| x.to_i}\n\nmax_books = 1\nresult = []\nmax_h = min_h = books_height[0]\nmax_i = min_i = 0\nmax_sub_h = 0\nmin_sub_h = 1000000\nmax_sub_i = min_sub_i = 0\ncount = 0\ni = 0\nwhile i < number_of_books\n if max_sub_i > i\n max_h = max_sub_h\n max_i = max_sub_i\n else\n max_h = books_height[i]\n max_i = i\n end\n if min_sub_i > i\n min_h = min_sub_i\n min_i = min_sub_i\n else\n min_h = books_height[i]\n min_i = i\n end\n if count <= i\n count = i + 1\n end\n max_sub_h = 0\n min_sub_h = 1000000\n max_sub_i = min_sub_i = 0\n while count < number_of_books\n if max_h <= books_height[count]\n max_h = books_height[count]\n max_i = count\n elsif min_h >= books_height[count]\n min_h = books_height[count]\n min_i = count\n elsif max_i < min_i && max_sub_h < max_h\n max_sub_h = books_height[count]\n max_sub_i = count\n elsif min_i < max_i && min_sub_h > min_h\n min_sub_h = books_height[count]\n min_sub_i = count\n end\n if (max_h - min_h).abs > limit_height\n break\n end\n count += 1\n end\n if count - i >= max_books\n if count - i > max_books\n result.clear\n end\n max_books = count - i\n result.push [i + 1,count]\n end\n if count == number_of_books || number_of_books - i <= max_books\n break\n elsif max_i >= min_i\n i = min_i + 1\n elsif min_i > max_i\n i = max_i + 1\n else\n i += 1\n end\n count -= 1\nend\nputs max_books.to_s + ' ' + result.length.to_s\nresult.length.times do |i|\n puts result[i][0].to_s + ' ' + result[i][1].to_s\nend\n\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":346} {"difficulty":1900,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"c16c49baf7b2d179764871204475036e","execute_outcome":"RUNTIME_ERROR","source_code":"s = gets.chomp!\nmods = 1000000007\ndp = [[0,0,0],[0,0,0]]\n\nlen =s.size\ncur =0;nxt=1;\n\ncase s[0]\nwhen '0'\n\tdp[cur][0]=1\nwhen '1'\n\tdp[cur][1]=1\nwhen '2'\n\tp 0\n\texit\nwhen '*'\n\tdp[cur][2]=1\nwhen '?'\n\tdp[cur][0]=dp[cur][1]=dp[cur][2]=1\nend\n\nfor i in 1...len\n\tcase s[i]\n\twhen '0'\n\t\tdp[nxt][0]=dp[cur][0]\n\twhen '1'\n\t\tdp[nxt][1]= dp[cur][0]\n\t\tdp[nxt][0]= dp[cur][2]\n\twhen '2'\n\t\tdp[nxt][1]=dp[cur][2]\n\twhen '*'\n\t\tdp[nxt][2]= (dp[cur][1]+dp[cur][2])\n\twhen '?'\n\t\tdp[nxt][1]= (dp[cur][2]+dp[cur][0])\n\t\tdp[nxt][0]= (dp[cur][0]+dp[cur][2])\n\t\tdp[nxt][2]= (dp[cur][1]+dp[cur][2])\n\tend\n\ta = cur \n\tcur = nxt\n\tnxt = a\n\tdp[nxt] = [0,0,0]\nend\n\nputs \"#{(dp[cur][0]+dp[cur][2])%mods}\"","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"],"human_solution":"s = gets.chomp!\nmods = 1000000007\ndp = [[0,0,0],[0,0,0]]\n\nlen =s.size\ncur =0;nxt=1;\n\ncase s[0]\nwhen '0'\n\tdp[cur][0]=1\nwhen '1'\n\tdp[cur][1]=1\nwhen '2'\n\tp 0\n\texit\nwhen '*'\n\tdp[cur][2]=1\nwhen '?'\n\tdp[cur][0]=dp[cur][1]=dp[cur][2]=1\nend\n\nfor i in 1...len\n\tcase s[i]\n\twhen '0'\n\t\tdp[nxt][0]=dp[cur][0]\n\twhen '1'\n\t\tdp[nxt][1]= dp[cur][0]\n\t\tdp[nxt][0]= dp[cur][2]\n\twhen '2'\n\t\tdp[nxt][1]=dp[cur][2]\n\twhen '*'\n\t\tdp[nxt][2]= (dp[cur][1]+dp[cur][2])%mods\n\twhen '?'\n\t\tdp[nxt][1]= (dp[cur][2]+dp[cur][0])%mods\n\t\tdp[nxt][0]= (dp[cur][0]+dp[cur][2])%mods\n\t\tdp[nxt][2]= (dp[cur][1]+dp[cur][2])%mods\n\tend\n\tcur = nxt\n\tnxt = cur==0?1:0\n\tdp[nxt] = [0,0,0]\nend\n\nputs \"#{(dp[cur][0]+dp[cur][2])%mods}\"","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":347} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"d3a0402de1338a1a542a86ac5b484acc","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/env\/ruby\n\ndef exec(debug = false)\n length = gets.chomp.to_i\n elements = gets.chomp.split(\/\\s\/).map{|s| s.to_i}\n return puts \"NO\" unless length == elements.size\n \n max = length \/ 3\n p \"max: #{max}\" if debug\n max.times do |i|\n ii = i + 1\n p \"ii: #{ii}\" if debug\n next if length % ii != 0\n elements.each_with_index do |e, index|\n break if index == max\n success = true\n next if e == 0\n next if index >= ii\n p \"index:#{index}\" if debug\n (index + ii).step(length - 1, ii) do |j|\n p \"j: #{j}\" if debug\n unless elements[j] == 1\n p \"break\" if debug\n success = false\n break\n end\n end\n return puts(\"YES\") if success\n end\n end\n puts \"NO\"\nend\n\nexec(debug = true)\n#exec\n","description":"There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in a good mood should be located. Otherwise, the next month will bring misfortunes.A convex polygon is regular if all its sides have same length and all his angles are equal. In this problem we consider only regular polygons with at least 3 vertices, i. e. only nondegenerated.On a picture below some examples of such polygons are present. Green points mean knights in a good mood. Red points mean ones in a bad mood. King Arthur knows the knights' moods. Help him find out if the next month will be fortunate or not.","input_specification":"The first line contains number n, which is the number of knights at the round table (3\u2009\u2264\u2009n\u2009\u2264\u2009105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. \"1\" means that the knight is in a good mood an \"0\" means that he is in a bad mood.","output_specification":"Print \"YES\" without the quotes if the following month will turn out to be lucky. Otherwise, print \"NO\".","notes":null,"sample_inputs":["3\n1 1 1","6\n1 0 1 1 1 0","6\n1 0 0 1 0 1"],"sample_outputs":["YES","YES","NO"],"human_solution":"\nn=gets.to_i\na=gets.split.map(&:to_i)\n3.upto(n){|i|\n if n%i==0 then\n k=n\/i\n k.times{|j|\n ok=1\n now=j\n i.times{\n if a[now]==0 then\n ok=0\n break\n end\n now+=k\n }\n if ok==1 then\n puts \"YES\"\n exit\n end\n }\n end\n}\nputs \"NO\"\n","testcases":"[{'input': '3\\r\\n1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 1 1 1 0\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '10\\r\\n1 0 1 1 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 0 1 0 1 1 0 1 0 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '29\\r\\n0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1\\r\\n', 'output': ['NO']}, {'input': '77\\r\\n0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1\\r\\n', 'output': ['YES']}, {'input': '99\\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 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\\r\\n', 'output': ['YES']}, {'input': '18\\r\\n0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 1\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n0 0 1 0 0 1\\r\\n', 'output': ['NO']}, {'input': '6\\r\\n0 1 0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n0 0 1 0 0 0 1\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '8\\r\\n1 0 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\\r\\n', 'output': ['YES']}, {'input': '30\\r\\n1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0\\r\\n', 'output': ['YES']}, {'input': '100\\r\\n1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0\\r\\n', 'output': ['YES']}, {'input': '113\\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\\r\\n', 'output': ['YES']}]","id":348} {"difficulty":2500,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"e7e0f9069166fe992abe6f0e19caa6a1","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/env ruby\nclass Integer\n def min(x)\n self < x ? self : x\n end\nend\nn = gets.to_i\na = gets.split.map { |x| x.to_i }\nb = (0...n).to_a.sort_by { |x| a[x] }\nls = []; nx = []\nl = 0; r = n - 1\nn.times do |i|\n ls[i] = i - 1\n nx[i] = i + 1\nend\nans = 0\nb.each_with_index do |i, ix|\n break if ix > n - 2\n if i == l\n ans += a[i]\n l = nx[l]\n elsif i == r\n ans += a[i]\n r = ls[r]\n else\n ans += a[ls[i]].min(a[nx[i]])\n nx[ls[i]] = nx[i]\n ls[nx[i]] = ls[i]\n end\nend\nputs ans\n","description":"Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a,\u2009b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn't have an adjacent number to the left or right, Artem doesn't get any points. After the element is removed, the two parts of the array glue together resulting in the new array that Artem continues playing with. Borya wondered what maximum total number of points Artem can get as he plays this game.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20095\u00b7105) \u2014 the number of elements in the array. The next line contains n integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009106) \u2014 the values of the array elements.","output_specification":"In a single line print a single integer \u2014 the maximum number of points Artem can get.","notes":null,"sample_inputs":["5\n3 1 5 2 6","5\n1 2 3 4 5","5\n1 100 101 100 1"],"sample_outputs":["11","6","102"],"human_solution":"gets\ns,ans=[],0\ngets.split.map(&:to_i).each do |i|\n while s[-2]&&(k=[s[-2],i].min)>=s[-1]\n ans+=k\n s.pop\n end\n s.push i\nend\ns.sort!\n(0..s.size-3).each{|i| ans+=s[i]}\np ans\n","testcases":"[{'input': '5\\r\\n3 1 5 2 6\\r\\n', 'output': ['11']}, {'input': '5\\r\\n1 2 3 4 5\\r\\n', 'output': ['6']}, {'input': '5\\r\\n1 100 101 100 1\\r\\n', 'output': ['102']}, {'input': '10\\r\\n96 66 8 18 30 48 34 11 37 42\\r\\n', 'output': ['299']}, {'input': '1\\r\\n87\\r\\n', 'output': ['0']}, {'input': '2\\r\\n93 51\\r\\n', 'output': ['0']}, {'input': '3\\r\\n31 19 5\\r\\n', 'output': ['5']}, {'input': '4\\r\\n86 21 58 60\\r\\n', 'output': ['118']}, {'input': '5\\r\\n21 6 54 69 32\\r\\n', 'output': ['74']}, {'input': '500000\\r\\n420656 493141 666713 218520 820461 110241 571052 221576 622547 422070 444000 24019 418357 645255 263883 786440 591985 779139 998849 699918 621698 430994 923570 83634 935074 894461 984992 212896 370138 429677 404026 15213 848103 382539 159706 6993 455627 684167 261848 815538 804077 201076 870537 670363 994669 268113 564376 907979 656969 685475 403646 794602 737125 100285 295201 87959 875706 465762 542151 602140 51614 146049 277621 882179 886827 375902 131432 382594 587151 541266 352879 686993 128432...', 'output': ['333286228412']}, {'input': '6\\r\\n46 30 38 9 65 23\\r\\n', 'output': ['145']}, {'input': '7\\r\\n82 60 92 4 2 13 15\\r\\n', 'output': ['129']}, {'input': '8\\r\\n77 84 26 34 17 56 76 3\\r\\n', 'output': ['279']}, {'input': '9\\r\\n72 49 39 50 68 35 75 94 56\\r\\n', 'output': ['435']}, {'input': '10\\r\\n4 2 2 4 1 2 2 4 2 1\\r\\n', 'output': ['21']}, {'input': '1\\r\\n4\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '3\\r\\n1 2 1\\r\\n', 'output': ['1']}, {'input': '4\\r\\n2 3 1 2\\r\\n', 'output': ['4']}, {'input': '5\\r\\n2 6 2 1 2\\r\\n', 'output': ['6']}, {'input': '6\\r\\n1 7 3 1 6 2\\r\\n', 'output': ['12']}, {'input': '7\\r\\n2 1 2 2 2 2 2\\r\\n', 'output': ['10']}, {'input': '8\\r\\n3 4 3 1 1 3 4 1\\r\\n', 'output': ['15']}, {'input': '9\\r\\n4 5 2 2 3 1 3 3 5\\r\\n', 'output': ['23']}, {'input': '10000\\r\\n4 4 4 3 1 3 3 4 2 4 2 3 4 3 3 3 3 1 1 2 3 4 4 4 1 4 2 4 2 1 1 1 1 4 3 3 4 2 2 2 2 3 4 3 4 4 4 1 2 3 4 3 1 1 3 4 1 4 3 2 4 1 2 4 3 3 4 1 4 1 3 1 4 2 2 4 2 2 3 1 4 4 4 1 2 1 4 4 3 2 3 3 4 4 4 2 3 3 1 3 4 1 4 1 2 4 3 1 2 4 4 4 3 3 2 1 1 1 1 4 1 2 3 3 3 3 1 1 1 3 1 2 4 1 4 2 3 1 4 1 4 3 2 4 2 3 1 1 2 4 2 1 1 2 4 2 1 2 2 4 2 4 1 3 1 3 4 3 4 2 2 1 1 4 3 2 2 1 4 1 4 3 2 3 3 2 1 3 1 3 3 4 1 3 1 2 1 1 2 2 3 1 2 3 2 4 1 2 3 2 2 4 3 4 4 3 3 3 2 2 3 2 2 2 4 1 3 4 3 4 2 1 3 1 2 2 4 2 2 1 2 3 1 4 3 4 4 1 1 1 1 1 ...', 'output': ['31378']}, {'input': '10000\\r\\n51 51 65 78 110 6 77 101 73 76 92 60 8 46 74 87 88 121 11 32 3 63 51 27 31 57 53 62 70 19 55 75 22 26 94 72 47 120 49 49 102 95 57 35 3 110 23 15 44 6 90 69 34 112 28 61 45 112 69 54 88 113 54 19 86 70 32 103 1 34 57 56 24 67 122 109 89 6 14 22 100 107 1 86 5 16 110 34 53 103 117 11 17 117 104 96 8 18 89 50 1 62 88 43 96 85 57 108 92 120 102 79 58 5 41 16 55 27 51 70 50 87 104 53 11 32 32 89 54 59 53 44 55 57 86 5 91 14 116 20 108 10 63 40 61 98 16 11 58 82 36 59 118 59 123 123 98 90 58 91 69 118 12...', 'output': ['821942']}, {'input': '10000\\r\\n305 2217 4079 1032 5027 4431 3905 1423 5423 5392 1722 1680 1222 3408 3246 1744 313 198 2852 5327 4617 3077 1253 5283 4127 57 2085 4838 1455 3747 3155 653 5543 463 1760 3758 623 487 4815 4685 2438 3820 5468 2579 1979 1354 4215 597 3319 178 1200 4881 3173 2107 1530 1655 1204 1759 5293 4445 4639 1091 345 2857 5238 54 4080 5496 2450 1616 2908 5260 1962 214 5331 4168 4219 2063 4259 5448 3784 1780 5350 5256 3855 1569 1931 3502 2232 1257 4228 4088 4848 2240 3837 3720 1861 1766 5281 4250 2527 667 4055 5472 ...', 'output': ['37185774']}, {'input': '10000\\r\\n937269 52328 616518 108211 17319 217729 361901 517567 299812 362331 49608 475088 381160 101157 459745 35742 462673 352769 61032 762616 306099 871281 26520 482300 466697 128157 683319 888115 379270 285379 141948 996358 851593 5371 991562 829025 5230 660134 585115 179107 422785 274611 294904 612799 771725 323149 129188 640754 219219 685413 34649 799777 335062 985559 825834 950158 976275 787003 772423 702710 5262 143627 864927 253387 613960 710956 911648 621065 443981 973723 583194 122871 425769 931957...', 'output': ['6648774646']}, {'input': '100000\\r\\n613499 780095 313501 52879 215436 862263 306729 367183 314542 622970 347292 284166 390702 24018 760627 417939 959455 794970 72227 14085 898342 330881 379441 184430 577249 650477 997745 520528 335412 503227 478361 262772 20466 474277 603648 474266 969253 51773 82745 652811 764347 57110 457094 203530 849485 737666 428091 975657 519756 220085 813489 991735 795658 830856 558883 554711 755875 12122 487656 850988 725126 310417 670157 310832 379427 197118 45262 907428 966835 513182 387697 873250 834207 43...', 'output': ['66739070768']}, {'input': '500000\\r\\n2 3 3 4 4 3 4 2 1 2 2 2 3 4 1 3 2 2 2 2 2 4 3 2 4 2 1 1 1 1 1 4 3 3 4 1 3 3 3 1 4 2 4 1 3 1 4 1 3 1 3 1 3 2 4 4 4 3 3 1 3 4 1 4 1 1 1 2 2 2 2 2 1 1 4 2 3 1 3 3 1 1 2 4 3 4 3 2 1 4 3 4 2 2 1 2 2 2 1 4 1 2 3 2 1 3 2 4 4 3 1 4 2 4 3 3 3 2 3 2 2 4 1 2 2 3 2 3 4 1 3 4 3 4 4 4 4 4 4 1 2 2 4 1 2 3 4 1 2 4 4 1 2 1 2 3 2 1 3 1 4 4 4 2 2 4 4 2 1 4 3 4 2 4 4 2 1 4 3 3 1 1 1 3 2 2 4 2 1 3 2 2 1 2 3 1 3 3 3 1 4 4 2 3 3 2 2 4 2 4 4 1 3 2 1 4 4 2 3 2 2 2 3 4 2 3 4 3 2 4 4 3 4 3 1 1 1 3 3 1 4 2 3 3 1 4 1 1 3 1 3 2...', 'output': ['1563483']}, {'input': '500000\\r\\n44 118 122 87 58 104 114 106 81 111 14 8 49 53 103 5 80 44 109 120 100 106 107 103 26 33 56 9 7 110 105 73 35 4 107 20 83 60 54 52 118 68 105 96 45 12 46 93 11 92 43 51 74 21 121 22 25 33 122 103 82 62 123 44 89 56 51 112 28 107 67 116 10 112 31 65 109 92 73 87 69 117 3 54 12 16 6 102 66 103 16 82 50 104 18 81 6 91 33 49 84 33 18 28 79 1 48 95 111 97 113 59 78 87 37 123 4 74 123 107 75 111 82 41 11 42 62 14 49 49 26 9 61 1 14 81 82 113 80 115 81 1 109 105 34 100 96 6 1 48 33 98 99 38 18 94 3 21 121...', 'output': ['41304696']}, {'input': '500000\\r\\n2996 495 5250 3319 834 4335 31 5346 2500 497 2969 5281 4565 148 751 3013 458 4778 89 3078 1778 5024 1260 680 4032 3533 2712 2960 4555 446 3276 4720 3834 780 48 2339 1279 993 4615 3464 4087 5104 5353 4137 693 1529 2840 4239 184 1898 4882 2801 1799 4278 389 3559 1091 2903 863 58 631 4525 2711 1593 2277 3881 5037 2159 833 1331 4007 2752 599 3842 4380 4157 4714 4643 873 4661 972 1993 1444 170 1494 433 2164 4501 836 3073 1392 926 1190 3662 1576 3044 494 1163 2913 4205 2407 2704 1754 813 2371 1461 275 89...', 'output': ['1852279744']}, {'input': '500000\\r\\n305368 255895 502210 475877 574974 319198 59454 129258 744627 274911 746538 93295 246339 880196 988079 162872 74868 863817 254869 229545 378612 868571 310138 694129 923809 769115 205295 744739 551541 291521 567023 406565 767565 447582 141629 295361 171092 421882 561881 904537 604432 530779 159902 533815 437577 232679 668923 928707 308433 882401 153548 122957 259701 681103 280788 128202 512446 994748 156569 587356 248100 943961 977757 720330 856976 975743 356724 203343 511564 495952 489991 697230 32...', 'output': ['333152632699']}, {'input': '500000\\r\\n54986 980609 331654 936147 176951 525059 592709 211432 591241 565473 737272 587991 893779 272415 574906 55545 666668 818799 640849 742225 477091 121575 887416 813637 948128 913172 227400 429067 232792 142760 966786 81503 789228 123534 798267 454896 383327 937374 189412 819995 681842 687532 650421 701518 573278 262715 825910 932815 863406 298127 998890 568149 779318 472096 670872 580500 89459 637099 612919 718166 865473 785250 421813 52485 372339 475139 116708 380165 923858 202758 358658 638718 3182...', 'output': ['333666489394']}, {'input': '500000\\r\\n606433 543120 598155 992348 182763 279356 839193 832513 782824 747497 627843 949366 560065 716458 575943 789004 30045 637256 880029 473537 159456 445146 826313 561257 922709 211453 541393 306170 427238 722609 958857 763700 249096 676240 282570 725035 472883 246636 459841 278771 426255 904515 269923 57318 844203 536993 376958 978388 400294 929875 389675 850952 233392 821443 43552 81651 453227 576821 71970 445240 172395 297821 394391 243091 336604 847130 449529 592167 71107 682387 233575 535714 15657...', 'output': ['333785777692']}]","id":349} {"difficulty":1800,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"e9c486e2d942700e0644dff29b6e3be6","execute_outcome":"RUNTIME_ERROR","source_code":"class Spell\n\tdef initialize(idx, power, dmg)\n\t\t@idx = idx\n\t\t@power = power\n\t\t@dmg = dmg\n\t\t@used = false\n\tend\n\tattr_accessor :idx, :power, :dmg, :used\nend\n\t\nn,mx,reg = gets.chomp.split(\/ \/).map!{|x|x.to_i}\nra = Array.new(n)\nret = true\nsa = Array.new\nfor i in 0..n-1\n\ta = gets.chomp.split(\/ \/).map!{|x|x.to_i}\n\tra[i] = Spell.new( i+1, a[0], a[1] )\nend\n\nra.sort!{|a,b| b.dmg <=> a.dmg }\n\nmxw = mx\ndmgpermin = 0\nmtime = 0\n\nwhile mxw > 0\n\tprevmxw = mxw\n\tnotfound = true\n\tfor i in 0..n-1\n\t\tnext if ra[i].used\n\t\tnext if ra[i].power*mx < mxw*100\n\t\tdmgpermin += ra[i].dmg\n\t\tra[i].used = true\n\t\tsa.push( mtime.to_s + \" \" + ra[i].idx.to_s )\n\t\tnotfound = false\n\t\tbreak\n\tend\n\tmxw -= dmgpermin\n\tmxw += reg\n\tmxw = mx if mxw > mx\n\n\tbreak if mxw < 0\n\n\tmtime += 1\n\n\tif notfound && prevmxw <= mxw\n\t\tret = false\n\t\tbreak\n\tend\nend\n\nret = false if mxw > 0\n\nif ret\n\tputs \"YES\"\n\tputs mtime.to_s + \" \" + sa.length.to_s\n\tsa.each{|x| puts x }\nelse\n\tputs \"NO\"\nend","description":"Vasya\u2019s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.While playing the game Petya found spell scrolls and now he is about to use them. Let\u2019s describe the way fighting goes on this level:1) The boss has two parameters: max \u2014 the initial amount of health and reg \u2014 regeneration rate per second.2) Every scroll also has two parameters: powi \u2014 spell power measured in percents \u2014 the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than powi percent of health the scroll cannot be used); and dmgi the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmgi of damage per second upon him until the end of the game.During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can\u2019t have more than max of health), then the player may use another scroll (no more than one per second).The boss is considered to be defeated if at the end of a second he has nonpositive (\u2009\u2264\u20090) amount of health.Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.","input_specification":"The first line contains three integers N, max and reg (1\u2009\u2264\u2009N,\u2009max,\u2009reg\u2009\u2264\u20091000) \u2013\u2013 the amount of scrolls and the parameters of the boss. The next N lines contain two integers powi and dmgi each \u2014 the parameters of the i-th scroll (0\u2009\u2264\u2009powi\u2009\u2264\u2009100, 1\u2009\u2264\u2009dmgi\u2009\u2264\u20092000). ","output_specification":"In case Petya can\u2019t complete this level, output in the single line NO. Otherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds. Output scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.","notes":null,"sample_inputs":["2 10 3\n100 3\n99 1","2 100 10\n100 11\n90 9"],"sample_outputs":["NO","YES\n19 2\n0 1\n10 2"],"human_solution":"class Spell\n\tdef initialize(idx, power, dmg)\n\t\t@idx = idx\n\t\t@power = power\n\t\t@dmg = dmg\n\t\t@used = false\n\tend\n\tattr_accessor :idx, :power, :dmg, :used\nend\n\t\nn,mx,reg = gets.chomp.split(\/ \/).map!{|x|x.to_i}\nra = Array.new(n)\nret = true\nsa = Array.new\nfor i in 0..n-1\n\ta = gets.chomp.split(\/ \/).map!{|x|x.to_i}\n\tra[i] = Spell.new( i+1, a[0], a[1] )\nend\n\nra.sort!{|a,b| b.dmg <=> a.dmg }\n\nmxw = mx\ndmgpermin = 0\nmtime = 0\n\nwhile mxw > 0\n\tprevmxw = mxw\n\tnotfound = true\n\tfor i in 0..n-1\n\t\tnext if ra[i].used\n\t\tnext if ra[i].power*mx < mxw*100\n\t\tdmgpermin += ra[i].dmg\n\t\tra[i].used = true\n\t\tsa.push( mtime.to_s + \" \" + ra[i].idx.to_s )\n\t\tnotfound = false\n\t\tbreak\n\tend\n\tmxw -= dmgpermin\n\tmxw += reg\n\tmxw = mx if mxw > mx\n\tmtime += 1\n\n\tif notfound && prevmxw <= mxw\n\t\tret = false\n\t\tbreak\n\tend\nend\n\nret = false if mxw > 0\n\nif ret\n\tputs \"YES\"\n\tputs mtime.to_s + \" \" + sa.length.to_s\n\tsa.each{|x| puts x }\nelse\n\tputs \"NO\"\nend","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":350} {"difficulty":1600,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"fbfc333ad4b0a750f654a00be84aea67","execute_outcome":"RUNTIME_ERROR","source_code":"#! ruby\n# Try Codeforces\n# author: Leonardone @ NEETSDKASU\n\ndef gi(); gets.to_i; end\ndef gis(); gets.chomp.split.map(&:to_i); end\n\nn, m = gis\n\nh = []\n1.upto(n) do |i|\n h[i] = [-1] * n.succ\n h[i][i] = 0\nend\n\nm.times do\n u, v = gis\n h[u][v] = h[v][u] = 1\nend\n\nt1 = []\nt2 = []\n1.upto(n) do |i|\n t1[i] = []\n t2[i] = []\n 1.upto(n) do |j|\n case h[i][j]\n when 1\n t1[i] << j\n when -1\n t2[i] << j\n end\n end\nend\n\nif t1[1].empty? || t2[1].empty? || t1[n].empty? || t2[n].empty?\n puts '-1'\n exit\nend\n\nl1 = [1]\nv1 = [true] + ([false] * n)\nflg = true\nct = 0\nwhile flg && !l1.empty? do\n ct += 1\n l2 = []\n l1.each do |k|\n if t1[k][-1] == n\n flg = false\n break\n end\n t1[k].each do |x|\n next if v1[x]\n l2 << x\n end\n end\n l1 = l2\nend \n\nif flg\n puts '-1'\n exit\nend\n\n\nl1 = [1]\nv1 = [true] + ([false] * n)\nflg = true\ncb = 0\nwhile flg && !l1.empty? do\n cb += 1\n l2 = []\n l1.each do |k|\n if t2[k][-1] == n\n flg = false\n break\n end\n t2[k].each do |x|\n next if v1[x]\n l2 << x\n end\n end\n l1 = l2\nend \n\nif flg\n puts '-1'\n exit\nend\n\nputs [ct,cb].max\n\n","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"],"human_solution":"#! ruby\n# Try Codeforces\n# author: Leonardone @ NEETSDKASU\n\ndef gi(); gets.to_i; end\ndef gis(); gets.chomp.split.map(&:to_i); end\n\nn, m = gis\n\nh = []\n1.upto(n) do |i|\n h[i] = [-1] * n.succ\n h[i][i] = 0\nend\n\nm.times do\n u, v = gis\n h[u][v] = h[v][u] = 1\nend\n\nt1 = []\nt2 = []\n1.upto(n) do |i|\n t1[i] = []\n t2[i] = []\n 1.upto(n) do |j|\n case h[i][j]\n when 1\n t1[i] << j\n when -1\n t2[i] << j\n end\n end\nend\n\nif t1[1].empty? || t2[1].empty? || t1[n].empty? || t2[n].empty?\n puts '-1'\n exit\nend\n\nl1 = [1]\nv1 = [true] + ([false] * n)\nflg = true\nct = 0\nwhile flg && !l1.empty? do\n ct += 1\n l2 = []\n l1.each do |k|\n if t1[k][-1] == n\n flg = false\n break\n end\n t1[k].each do |x|\n next if v1[x]\n v1[x] = true\n l2 << x\n end\n end\n l1 = l2\nend \n\nif flg\n puts '-1'\n exit\nend\n\n\nl1 = [1]\nv1 = [true] + ([false] * n)\nflg = true\ncb = 0\nwhile flg && !l1.empty? do\n cb += 1\n l2 = []\n l1.each do |k|\n if t2[k][-1] == n\n flg = false\n break\n end\n t2[k].each do |x|\n next if v1[x]\n v1[x] = true\n l2 << x\n end\n end\n l1 = l2\nend \n\nif flg\n puts '-1'\n exit\nend\n\nputs [ct,cb].max\n\n","testcases":"[{'input': '4 2\\r\\n1 3\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 5\\r\\n4 2\\r\\n3 5\\r\\n4 5\\r\\n5 1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 4\\r\\n1 2\\r\\n3 2\\r\\n3 4\\r\\n5 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '20 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '381 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 1\\r\\n1 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 5\\r\\n1 3\\r\\n2 1\\r\\n3 4\\r\\n4 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '20 1\\r\\n20 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '21 1\\r\\n21 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\n100 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '400 1\\r\\n1 400\\r\\n', 'output': ['2\\r\\n']}, {'input': '5 5\\r\\n2 5\\r\\n1 2\\r\\n1 4\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['2\\r\\n']}]","id":351} {"difficulty":1000,"lang":"Go","lang_cluster":"Go","src_uid":"0515ac888937a4dda30cad5e2383164f","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ Author: sighduck\n\/\/ URL: https:\/\/codeforces.com\/contest\/1230\/problem\/B\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc _Solve(current int, n int, k int, S string) string {\n\tif n == 1 && k > 0 {\n\t\treturn \"0\"\n\t}\n\tif k == 0 || current == n {\n\t\treturn S\n\t}\n\tif current == 0 && string(S[current]) != \"1\" {\n\t\tk -= 1\n\t\tS = \"1\" + S[1:]\n\t} else if current != 0 && S[current] > 0 {\n\t\tk -= 1\n\t\tS = S[:current] + \"0\" + S[current+1:]\n\t}\n\treturn _Solve(current+1, n, k, S)\n}\n\nfunc Solve(n int, k int, S string) string {\n\treturn _Solve(0, n, k, S)\n}\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\n\tvar n, k int\n\tvar s string\n\tfmt.Fscanf(reader, \"%d %d\\n%s\\n\", &n, &k, &s)\n\n\tfmt.Fprintf(writer, \"%s\\n\", Solve(n, k, s))\n}\n","description":"Ania has a large integer $$$S$$$. Its decimal representation has length $$$n$$$ and doesn't contain any leading zeroes. Ania is allowed to change at most $$$k$$$ digits of $$$S$$$. She wants to do it in such a way that $$$S$$$ still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq n \\leq 200\\,000$$$, $$$0 \\leq k \\leq n$$$) \u2014 the number of digits in the decimal representation of $$$S$$$ and the maximum allowed number of changed digits. The second line contains the integer $$$S$$$. It's guaranteed that $$$S$$$ has exactly $$$n$$$ digits and doesn't contain any leading zeroes.","output_specification":"Output the minimal possible value of $$$S$$$ which Ania can end with. Note that the resulting integer should also have $$$n$$$ digits.","notes":"NoteA number has leading zeroes if it consists of at least two digits and its first digit is $$$0$$$. For example, numbers $$$00$$$, $$$00069$$$ and $$$0101$$$ have leading zeroes, while $$$0$$$, $$$3000$$$ and $$$1010$$$ don't have leading zeroes.","sample_inputs":["5 3\n51528","3 2\n102","1 1\n1"],"sample_outputs":["10028","100","0"],"human_solution":"package main\n\nimport (\n \"fmt\"\n \"os\"\n \"bufio\"\n \"strconv\"\n)\n\nconst MaxBuf = 200100\nvar buf []byte\nvar sc = bufio.NewScanner(os.Stdin)\n\nfunc init() {\n sc.Split(bufio.ScanWords)\n sc.Buffer(buf,MaxBuf)\n}\n\nfunc readString() string {\n sc.Scan()\n return sc.Text()\n}\n\nfunc readInt64() int64 {\n sc.Scan()\n r,_ := strconv.ParseInt(sc.Text(),10,64)\n return r\n}\n\nfunc readInt() int {\n sc.Scan()\n r,_ := strconv.Atoi(sc.Text())\n return r\n}\n\nfunc main() {\n\tn := readInt()\n\tk := readInt()\n\ts := readString()\n\n\tr := make([]rune,n)\n\tfor i,v := range s {\n\t\tvar x rune\n\t\tif k > 0 {\n\t\t\tif i == 0 {\n\t\t\t\tif len(s) == 1 {\n\t\t\t\t\tx = '0'\n\t\t\t\t} else {\n\t\t\t\t\tx = '1'\n\t\t\t\t}\n\t\t\t\tif v != x {\n\t\t\t\t\tk--\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tx = '0'\n\t\t\t\tif v != x {\n\t\t\t\t\tk--\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tx = v\n\t\t}\n\t\tr[i] = x\n\t}\n\n\tfmt.Println(string(r))\n\t\n}","testcases":"[{'input': '5 3\\r\\n51528\\r\\n', 'output': ['10028']}, {'input': '3 2\\r\\n102\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '8 3\\r\\n76185080\\r\\n', 'output': ['10085080']}, {'input': '10 9\\r\\n6605076924\\r\\n', 'output': ['1000000000']}, {'input': '17 14\\r\\n70419129275429261\\r\\n', 'output': ['10000000000000061']}, {'input': '199998 156775\\r\\n7634835512546227964243675139267315515577320237799637891529762314202017056236453683463308322179478107714532692736127575938520704751962381411698645433174487533559358321355930286745679211230306497827539374809663293796414447998709546787238564494719936067978838018924333308448159811275761513662350712828112159370994524797946201631497195474204565415159556215408393442798737977256084296355518425255430478805792621099352145489884245660406882249088247622551866815094192404242822804505500195699678136715085...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 2\\r\\n771112621109427812643673718074851764530689179759522591776981347807280232051563479817701294504068444683925657775712189272916643598581280840476981946390136592530160890213039665570819989634882772014581123884548476129114444089853125242596962777622415395884132936832620353838491107480004705925531447086202872507603787398475272973977883161172711023044040076388597092521402114312141786014676329287040828537689063290700494627878117322477780331244252157257615979675788502631313114376908083415265271825142311855...', 'output': ['1011126211094278126436737180748517645306891797595225917769813478072802320515634798177012945040684446839256577757121892729166435985812808404769819463901365925301608902130396655708199896348827720145811238845484761291144440898531252425969627776224153958841329368326203538384911074800047059255314470862028725076037873984752729739778831611727110230440400763885970925214021143121417860146763292870408285376890632907004946278781173224777803312442521572576159796757885026313131143769080834152652718251423118555804948582...']}, {'input': '200000 187545\\r\\n1301932000014086050003493008300090088600008905090000090726720050602018004305000000700039502080000000000804105230405000900500088030035200500800855026204010050500010740072080660018636955073996700000035002008600100300004080060050758040037000509580004102081000660006058000482268044600010070000000600070000003080064000030800000680000750000004322050608600400970480084802503000000400630507000200002000001005804040800800090005802057000428580020800925000000629700040000413000100370770900000020000090020500...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 108920\\r\\n1000060080705000000204167000210030260410030008740020004440300400704400002246004600000000280000009000003000600100402000001018908014000000000700009400007010506000008040000081093000007290200799770220020090000090000003750029800400018800610035060000778074010010070342570100000309000400900109573300780000002000580000008110565008609045902500004700309400341000270000800541701003044061539000504007102204600020200000000410080008800040014043020001740001009909604006083100000306000008080010000306019090006920...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 0\\r\\n256460096885481118333385694194593424724739000857078402894729701905592008141621922999353883420223647081763072129620176745092485803472555520197554536813418150418668888561749524693799305459423468508526178216363770325370737637707298927860518980996754247764234637679566129316759583799946805627150829867078807856652337888873045390190273863335903317485821289778295646610247705331477977491374901408118245671900293927177708527564320879813680266512784477174618257362818880763121593493992240288309416423252322589...', 'output': ['2564600968854811183333856941945934247247390008570784028947297019055920081416219229993538834202236470817630721296201767450924858034725555201975545368134181504186688885617495246937993054594234685085261782163637703253707376377072989278605189809967542477642346376795661293167595837999468056271508298670788078566523378888730453901902738633359033174858212897782956466102477053314779774913749014081182456719002939271777085275643208798136802665127844771746182573628188807631215934939922402883094164232523225896946463143...']}, {'input': '1 0\\r\\n1\\r\\n', 'output': ['1']}, {'input': '1 1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '2 1\\r\\n16\\r\\n', 'output': ['10']}, {'input': '199998 1\\r\\n393793459125730434817326505196085664401836690611040699365444699554396567481294672734190867935101303782403762614914695106676085805233526531077883925316679432454645499725035536054511270853595067746389612754512677963407959910298501740600753730291829759092013350224236537453749695855228708627576745877006835358665778204750554336289003281805557831681316447819422395981821587041818138679267179845673476645222792419445270267854570200477975677775848636560868302397070651219976608387583798999637359541316043303...', 'output': ['1937934591257304348173265051960856644018366906110406993654446995543965674812946727341908679351013037824037626149146951066760858052335265310778839253166794324546454997250355360545112708535950677463896127545126779634079599102985017406007537302918297590920133502242365374537496958552287086275767458770068353586657782047505543362890032818055578316813164478194223959818215870418181386792671798456734766452227924194452702678545702004779756777758486365608683023970706512199766083875837989996373595413160433037914192167...']}, {'input': '1 0\\r\\n0\\r\\n', 'output': ['0']}, {'input': '400 224\\r\\n3403471829631665055630257676709588054274069759668265706060902871201473941465824155677441158274936877159724887320158357490042422725165554784088776427589353335344063521672837620180854587939835953567037285547297153069505169565026205894046634052941764635777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118\\r\\n', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118']}, {'input': '1 0\\r\\n7\\r\\n', 'output': ['7']}, {'input': '30001 3687\\r\\n4879192340040210090371839649725898645819068470953339807944387968566809980170694714689568391058070568669565556001147862733255297572185796382230959350902061126937291655379996336535818031441002901288810081315372322742150381341152172532929586842038085743018527749089883673304076590435577643595823925084516541240697072236066890237191637478444052629650299572670262123127495201287721836078729470595572382868026441586623803689911342230360110538673179021296182761497570880783531361319832799494113744343814346...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '1 1\\r\\n9\\r\\n', 'output': ['0']}, {'input': '200000 38987\\r\\n76547795344979180295054210128630519504720553087786617591179063355165277050010800500919098736157692909606440488419230571151305874941386099145638002486943253041385929903189240704372570279164739070920245500523417056463480725895142260414739614203125827132260399332409961148788603352128175214468463293051554232404622569836095853346138387735994831271987736838622488963205796989636461581587213002982703456678244029796890854541824300618965779648737201358064901552552135936371807846933513367765608458110676...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n6460919550116632947975329737843793545236004047782108596534898123057253397260469884887006447373686860765441991750069970261923059655977307450939819192459072743822235871752239218106124430454880896265366218869237362174028558375318768755925219864762612285510997026013758388494629568802512355717750245845107715580333327502926161629218455221202583429645434847277896131705531441501475955858572369832897721621131980865577036189025532131971953553814709481914469596257388306747828391809722245306699413411356...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 180000\\r\\n9286117824715039989999736422374781884612984621858762074834566600961603517152352735549120665833482175119005317968171609951234595077176340999613167085078113630149499963897453833136536185540829393433131144347288914693721741432644933889416271480298131676680040597613465738188321726645084008821977045447857551641906525603448963266537865723315776809482680723682113527494815672911819578085994601036108229286294416703575942970998720095863251394147350975897963975493513231689411282318956457883748074239936...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '5 4\\r\\n39837\\r\\n', 'output': ['10007']}, {'input': '50 30\\r\\n57206210120809502631460958076295309729525641641207\\r\\n', 'output': ['10000000000000000000000000000000000000525641641207']}, {'input': '1007 227\\r\\n369799753553096434212687991038890334035927231543168858070363240543707094851004011833546324278654842112185372843388625808742617383357633200469817324198361676851033219633460115249216685327348387483420593801099766213228912614693858934416795750496016581432964640991389901515295952359505287110013873006017098823518143738023806132465622999469686472455422850159238870901537707018878862333427679379258787429175993594228281458543965661564527149998125389241781729944715267138852336209263357013249353365630301197...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004329646409913899015152959523595052871100138730060170988235181437380238061324656229994696864724554228501592388709015377070188788623334276793792587874291759935942282814585439656615645271499981253892417817299447152671388523362092633570132493533656303011977386208557...']}, {'input': '200000 115883\\r\\n2827598722404843878394338738400265508106504152501270300221275146405910260468705816133192242761521885478231751746733067543198108040164336590532649752514637122116183049796533213177428365653624032802274504819895081417821483054448617694493086660221342348252961651777999310547071904394447885642496063169952269344168248485570225037351961780490886353728688696791957504642834707407902831439040324401593442009455549209814087473740461121097636313114425724581495619327798682412667883550806628933794919641259...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 189016\\r\\n8416570810017947799345366245078545563060867951133843463654077942101407592653938857977547381029040691849115146855959823582926802977252493901665144141970754517157599890945319344469867753613264046987787640052143993567764617851230536541653443136278486466556306793654923504647164029627821833277786952281911088641656772278631961340215855281140528251402412512927863990092036900991949353394435401099491371631409700722234576482621310820225343236454865691230822555516565709427343903368050866632422516548258...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 167461\\r\\n3206034925895567066888019409555989055917283638539640987330840691986340901091285419615291003659395213547844117278189300000448972461050871482816547410380426547709241564981816209111235849764373041087269479006869844988533891914109097219526276297728401721820429870716530719442072568598657571188900284564564598745870786857232505646728989857796675717471643943277223802206690334370807779370367768124252032251265638353636571475165110321018144037214277697268552443843181594498917633998597790442500539400524...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 21257\\r\\n44238960540540399079380242266731890700609403619472760007061267571428334037102918118752841521938648875551027597345220240908862764992885902871379464657862623367496599353782269710632200373004719407545316738755312387383814463173569764303033377637752411311816380248291023629183766989210112931198686632466234288853956206441696813735148071146419670152515759258185718973302514749658468772753904356563283604788308404726875408100418719283160487507951147249719290590821488722695303392048575123466568873086805...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 44357\\r\\n93333192597026512176815315293321734076497304923578001284021054296259224275585800839794398341409078876994334203979905365584045106874714895982250663201231184557035827543194251454094227697985895358234195034291595869308581214790550473721423513798474163524284955776857005795032871710866852351639387239633644520469116345457022619176007318426990358530241027423401935295649358641417228997507447929003896390875027755861897034241802774873465494445856936268435579453157280432124684728711434457495750468741969...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199033\\r\\n9562475203625759746707785966654413048735096081794862651254941808251820762773935427336876973684436897689371203248974318238246237695069165133400485413602104140143788767778225877751617574119145493578782177450427992509861796676189366615328753903844704324959837649108323782873361897137809322915297840041401157146037172352953907682526984141304190711584060218096282515834339047498067515566837279395849437620451737762461342815506022514957516109855972163698584716904813928943681292087902463663438317932736...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 170000\\r\\n3913915994642697697068963716167447315467551489827800141559679559075740187983956330933176444195368834633971243230038152411012393823719029418928176806191130256121684431281388232758427708370450251279891286938341958980524672861384032979614504035143487945567588388365457227518415795423587413884635833455433955608933042928701966518829427448161236453167057098435014584458826943662674175676728265459598337668185029005721022505587759835093144219035819689601313026735782513243943394741063330555806376207658...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199997 190000\\r\\n2611566865624277085686743605084826361393478369330618445377254081355948171705185770366238370879604476405532972172684641535374648236073859897122593987641677216626971177570245111474701939613364722185246632577785379726413466571867339419697213701866787984064673743403069775130439828526057608245054485455644600298905641341911565951517745699909161462338230794579418191139865987264464782699342660463557293538565289896039262820158236693272255963501987670682930198614286125250562177178065109415863812573667...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199998\\r\\n5226295693272515932955906141172464664794325832463650925111357112660308794448535195539499902492266941035983585725090710160650749337604021144987925265375618330734221762004307435246532165634575179128547059807918762778771255467658504849956368939758887537175055104228887917312939399327925422637266391391743214324093433782448530821995504679841305590835338381300556636358933189575787051381364261348518393185561193905124721917500955091301228889880860201268208287603358978753985359622263972937993927354483...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 10261\\r\\n10072000970000600012706000002096008764300020900840080007092000500404000008000000000058215800062975440087090007216000010450009000100152740043008300442809848046940095504241070540209206108000400009061023608710600000008000739000281008000081050150000600581000000000026768009302006200820021015000650000000014801028000209808700050003000608737000000002230210000264500057005000707000700008080060000000008902000006006018004000001305159213907000008001900000000500150090000030604300206080050098002064003000088...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 87158\\r\\n24022000060085800102807501265840001010660000990000075050800000050000104016020008040060003060533052080752009000160608020002930000425767816883560204970012552065000440001775040236070986700007003003000055000000500010660006434130600900754300009002640200600030000005005406000478006100005001909107007800083009060016008725602000501002100425600004070409700060060131600002004000007960000048000206066940320009042906209000000001400010004077070001024072030050277000900090001854310980000400002600060901500935600...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 123819\\r\\n1000070000038093004000489005400500000690010077000950100907070080030100103810020000649050100097804009063040254000763000004003900040200030050200700009050092000800000607007000050639048800000540060050000000004400008760070200005463300000079205004576000606260000004600004054780570200230200030077000002072008000827661200000007048000000050000047000600100000030037100600065690003000642009060090000048050830600408900000100000360000009800600000250700000900951850405808004000000015375098007208602000156000105...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 84557\\r\\n36000600000001000020005906800030000001570004000200510500000007040211030001040800002409032000400020803501000800000000009040041529110793500000000069108000008502150000860730009500000050850800000007069248000000008000869904000206010009007000204103007000002000700348002440500004300700007000002099603978650030105060610364190000400907011050000044000104005820000000901004024070207200803808481000091401451400000012601005030200460000000108517087700604009024018006849508980303043027241010077700240000003064905...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 868\\r\\n1400001060200017042503601108900020100040080600020600070005000720200014700368022601100604202000034030646070030004703402370672066280800000107022001306005041320180021000600247100020000200050067020686200039940000604150005000060000004010008000900970050906085000044341000008096900906000702001004008277044100018066606702164909050030000877043310700501260005088040300300410780082000903300009561401850001000000059060003070303400055060904000003061709030560801020000009000000017401033309079008076000008470000005...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 156059\\r\\n1706005864440400040010560020000000000020024050070200005900000080003050050901004004087110966504007872090016909000000000000500088077000080070146300001616490072754010259900700302000036704704352050496030060280260000080502100000010100210000005700000800018504040700600000012235908002009004608220500900170100560200090002103004060500730030505000804280800404069023000570035471164041700000050010900000075060003000900000109500000064005000032088407907002440350607570790800100000000009200000230092078830285403...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 200000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '200000 200000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '200000 200000\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 7\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '2 2\\r\\n10\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n10000\\r\\n', 'output': ['10000']}, {'input': '1 1\\r\\n5\\r\\n', 'output': ['0']}, {'input': '2 2\\r\\n99\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n55555\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n123\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '4 4\\r\\n1111\\r\\n', 'output': ['1000']}, {'input': '4 4\\r\\n1234\\r\\n', 'output': ['1000']}, {'input': '5 5\\r\\n11111\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n12345\\r\\n', 'output': ['10000']}, {'input': '2 1\\r\\n99\\r\\n', 'output': ['19']}, {'input': '6 6\\r\\n123456\\r\\n', 'output': ['100000']}, {'input': '1 0\\r\\n5\\r\\n', 'output': ['5']}, {'input': '5 5\\r\\n56789\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n555\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n185\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n888\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n99999\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n11234\\r\\n', 'output': ['10000']}, {'input': '4 4\\r\\n9999\\r\\n', 'output': ['1000']}, {'input': '1 1\\r\\n8\\r\\n', 'output': ['0']}, {'input': '5 5\\r\\n51528\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n100\\r\\n', 'output': ['100']}, {'input': '6 2\\r\\n123456\\r\\n', 'output': ['100456']}, {'input': '2 2\\r\\n11\\r\\n', 'output': ['10']}, {'input': '3 3\\r\\n999\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n65412\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n111\\r\\n', 'output': ['100']}, {'input': '4 4\\r\\n5555\\r\\n', 'output': ['1000']}, {'input': '10 5\\r\\n1000054300\\r\\n', 'output': ['1000000000']}, {'input': '5 5\\r\\n54321\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n300\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '1 0\\r\\n2\\r\\n', 'output': ['2']}]","id":352} {"difficulty":1400,"lang":"Go","lang_cluster":"Go","src_uid":"08f1ba79ced688958695a7cfcfdda035","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nvar reader *bufio.Reader = bufio.NewReader(os.Stdin)\nvar writer *bufio.Writer = bufio.NewWriter(os.Stdout)\n\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\n\nfunc min(a, b int) int {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc printSlice(a []int) {\n\tprintf(\" \")\n\tfor i := 0; i < len(a); i++ {\n\t\tprintf(\"%d \", a[i])\n\t}\n\tprintf(\"\\n\")\n}\n\nfunc main() {\n\tdefer writer.Flush()\n\tvar n int\n\tscanf(\"%d\\n\", &n)\n\ta := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tscanf(\"%d\", &a[i])\n\t}\n\t\/\/ printSlice(a)\n\tdp := make([]int, n+1)\n\ts := \"\"\n\tfor i := 1; i <= n; i++ {\n\t\tvar x, y, z int\n\t\tx = 1e5\n\t\ty = 1e5\n\t\tz = 1e5\n\t\tvar prev byte\n\t\tif i >= 2 {\n\t\t\tprev = s[i-2]\n\t\t} else {\n\t\t\tprev = 'x'\n\t\t}\n\t\tif (a[i-1] == 2 || a[i-1] == 3) && (prev != 's') {\n\t\t\ty = dp[i-1]\n\t\t}\n\t\tif (a[i-1] == 1 || a[i-1] == 3) && (prev != 'c') {\n\t\t\tz = dp[i-1]\n\t\t}\n\t\tx = dp[i-1] + 1\n\t\tminans := min(x, min(y, z))\n\t\tdp[i] = minans\n\t\tif minans == x {\n\t\t\ts += \"r\"\n\t\t} else if minans == y {\n\t\t\ts += \"s\"\n\t\t} else {\n\t\t\ts += \"c\"\n\t\t}\n\n\t}\n\tprintf(\"%d\\n\", dp[n])\n}\n","description":"Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options: on this day the gym is closed and the contest is not carried out; on this day the gym is closed and the contest is carried out; on this day the gym is open and the contest is not carried out; on this day the gym is open and the contest is carried out. On each of days Vasya can either have a rest or write the contest (if it is carried out on this day), or do sport (if the gym is open on this day).Find the minimum number of days on which Vasya will have a rest (it means, he will not do sport and write the contest at the same time). The only limitation that Vasya has \u2014 he does not want to do the same activity on two consecutive days: it means, he will not do sport on two consecutive days, and write the contest on two consecutive days.","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of days of Vasya's vacations. The second line contains the sequence of integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u20093) separated by space, where: ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; ai equals 1, if on the i-th day of vacations the gym is closed, but the contest is carried out; ai equals 2, if on the i-th day of vacations the gym is open and the contest is not carried out; ai equals 3, if on the i-th day of vacations the gym is open and the contest is carried out.","output_specification":"Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses: to do sport on any two consecutive days, to write the contest on any two consecutive days. ","notes":"NoteIn the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.In the third test Vasya can do sport either on a day number 1 or number 2. He can not do sport in two days, because it will be contrary to the his limitation. Thus, he will have a rest for only one day.","sample_inputs":["4\n1 3 2 0","7\n1 3 3 2 1 2 3","2\n2 2"],"sample_outputs":["2","0","1"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nvar bufin *bufio.Reader\nvar bufout *bufio.Writer\n\nconst maxn = 100\n\nvar n int\nvar a [maxn + 1]int\nvar f [maxn + 1][3]int\n\nfunc min(x int, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}\n\nfunc main() {\n\tbufin = bufio.NewReader(os.Stdin)\n\tbufout = bufio.NewWriter(os.Stdout)\n\tdefer bufout.Flush()\n\n\tfmt.Fscan(bufin, &n)\n\tfor i := 1; i <= n; i++ {\n\t\tfmt.Fscan(bufin, &a[i])\n\t}\n\n\tfor j := 0; j < 3; j++ {\n\t\tf[0][j] = 0\n\t}\n\n\tfor i := 1; i <= n; i++ {\n\t\tf[i][0] = n\n\t\tfor j := 0; j < 3; j++ {\n\t\t\tf[i][0] = min(f[i][0], f[i-1][j]+1)\n\t\t}\n\n\t\tf[i][1] = n\n\t\tif (a[i] & 1) == 1 {\n\t\t\tf[i][1] = min(f[i][1], f[i-1][0])\n\t\t\tf[i][1] = min(f[i][1], f[i-1][2])\n\t\t}\n\n\t\tf[i][2] = n\n\t\tif ((a[i] >> 1) & 1) == 1 {\n\t\t\tf[i][2] = min(f[i][2], f[i-1][0])\n\t\t\tf[i][2] = min(f[i][2], f[i-1][1])\n\t\t}\n\t}\n\n\tr := min(min(f[n][0], f[n][1]), f[n][2])\n\tfmt.Fprint(bufout, r)\n}\n","testcases":"[{'input': '4\\r\\n1 3 2 0\\r\\n', 'output': ['2']}, {'input': '7\\r\\n1 3 3 2 1 2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1']}, {'input': '1\\r\\n0\\r\\n', 'output': ['1']}, {'input': '10\\r\\n0 0 1 1 0 0 0 0 1 0\\r\\n', 'output': ['8']}, {'input': '100\\r\\n3 2 3 3 3 2 3 1 3 2 2 3 2 3 3 3 3 3 3 1 2 2 3 1 3 3 2 2 2 3 1 0 3 3 3 2 3 3 1 1 3 1 3 3 3 1 3 1 3 0 1 3 2 3 2 1 1 3 2 3 3 3 2 3 1 3 3 3 3 2 2 2 1 3 1 3 3 3 3 1 3 2 3 3 0 3 3 3 3 3 1 0 2 1 3 3 0 2 3 3\\r\\n', 'output': ['16']}, {'input': '10\\r\\n2 3 0 1 3 1 2 2 1 0\\r\\n', 'output': ['3']}, {'input': '45\\r\\n3 3 2 3 2 3 3 3 0 3 3 3 3 3 3 3 1 3 2 3 2 3 2 2 2 3 2 3 3 3 3 3 1 2 3 3 2 2 2 3 3 3 3 1 3\\r\\n', 'output': ['6']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '2\\r\\n3 3\\r\\n', 'output': ['0']}, {'input': '3\\r\\n3 3 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 2\\r\\n', 'output': ['1']}, {'input': '10\\r\\n2 2 3 3 3 3 2 1 3 2\\r\\n', 'output': ['2']}, {'input': '15\\r\\n0 1 0 0 0 2 0 1 0 0 0 2 0 0 0\\r\\n', 'output': ['11']}, {'input': '15\\r\\n1 3 2 2 2 3 3 3 3 2 3 2 2 1 1\\r\\n', 'output': ['4']}, {'input': '15\\r\\n3 1 3 2 3 2 2 2 3 3 3 3 2 3 2\\r\\n', 'output': ['3']}, {'input': '20\\r\\n0 2 0 1 0 0 0 1 2 0 1 1 1 0 1 1 0 1 1 0\\r\\n', 'output': ['12']}, {'input': '20\\r\\n2 3 2 3 3 3 3 2 0 3 1 1 2 3 0 3 2 3 0 3\\r\\n', 'output': ['5']}, {'input': '20\\r\\n3 3 3 3 2 3 3 2 1 3 3 2 2 2 3 2 2 2 2 2\\r\\n', 'output': ['4']}, {'input': '25\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 2 0 0 2 0 0 1 0 2 0 1 1\\r\\n', 'output': ['16']}, {'input': '25\\r\\n1 3 3 2 2 3 3 3 3 3 1 2 2 3 2 0 2 1 0 1 3 2 2 3 3\\r\\n', 'output': ['5']}, {'input': '25\\r\\n2 3 1 3 3 2 1 3 3 3 1 3 3 1 3 2 3 3 1 3 3 3 2 3 3\\r\\n', 'output': ['3']}, {'input': '30\\r\\n0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 2 0 0 1 1 2 0 0 0\\r\\n', 'output': ['22']}, {'input': '30\\r\\n1 1 3 2 2 0 3 2 3 3 1 2 0 1 1 2 3 3 2 3 1 3 2 3 0 2 0 3 3 2\\r\\n', 'output': ['9']}, {'input': '30\\r\\n1 2 3 2 2 3 3 3 3 3 3 3 3 3 3 1 2 2 3 2 3 3 3 2 1 3 3 3 1 3\\r\\n', 'output': ['2']}, {'input': '35\\r\\n0 1 1 0 0 2 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 2 1 0 2 2 1 0 1 0 1 1 1 0 0\\r\\n', 'output': ['21']}, {'input': '35\\r\\n2 2 0 3 2 2 0 3 3 1 1 3 3 1 2 2 0 2 2 2 2 3 1 0 2 1 3 2 2 3 2 3 3 1 2\\r\\n', 'output': ['11']}, {'input': '35\\r\\n1 2 2 3 3 3 3 3 2 2 3 3 2 3 3 2 3 2 3 3 2 2 2 3 3 2 3 3 3 1 3 3 2 2 2\\r\\n', 'output': ['7']}, {'input': '40\\r\\n2 0 1 1 0 0 0 0 2 0 1 1 1 0 0 1 0 0 0 0 0 2 0 0 0 2 1 1 1 3 0 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['28']}, {'input': '40\\r\\n2 2 3 2 0 2 3 2 1 2 3 0 2 3 2 1 1 3 1 1 0 2 3 1 3 3 1 1 3 3 2 2 1 3 3 3 2 3 3 1\\r\\n', 'output': ['10']}, {'input': '40\\r\\n1 3 2 3 3 2 3 3 2 2 3 1 2 1 2 2 3 1 2 2 1 2 2 2 1 2 2 3 2 3 2 3 2 3 3 3 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '45\\r\\n2 1 0 0 0 2 1 0 1 0 0 2 2 1 1 0 0 2 0 0 0 0 0 0 1 0 0 2 0 0 1 1 0 0 1 0 0 1 1 2 0 0 2 0 2\\r\\n', 'output': ['29']}, {'input': '45\\r\\n3 3 2 3 3 3 2 2 3 2 3 1 3 2 3 2 2 1 1 3 2 3 2 1 3 1 2 3 2 2 0 3 3 2 3 2 3 2 3 2 0 3 1 1 3\\r\\n', 'output': ['8']}, {'input': '50\\r\\n3 0 0 0 2 0 0 0 0 0 0 0 2 1 0 2 0 1 0 1 3 0 2 1 1 0 0 1 1 0 0 1 2 1 1 2 1 1 0 0 0 0 0 0 0 1 2 2 0 0\\r\\n', 'output': ['32']}, {'input': '50\\r\\n3 3 3 3 1 0 3 3 0 2 3 1 1 1 3 2 3 3 3 3 3 1 0 1 2 2 3 3 2 3 0 0 0 2 1 0 1 2 2 2 2 0 2 2 2 1 2 3 3 2\\r\\n', 'output': ['16']}, {'input': '50\\r\\n3 2 3 1 2 1 2 3 3 2 3 3 2 1 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 2 3 3 3 3 2 3 1 2 3 3 2 3 3 1 2 2 1 1 3 3\\r\\n', 'output': ['7']}, {'input': '55\\r\\n0 0 1 1 0 1 0 0 1 0 1 0 0 0 2 0 0 1 0 0 0 1 0 0 0 0 3 1 0 0 0 1 0 0 0 0 2 0 0 0 2 0 2 1 0 0 0 0 0 0 0 0 2 0 0\\r\\n', 'output': ['40']}, {'input': '55\\r\\n3 0 3 3 3 2 0 2 3 0 3 2 3 3 0 3 3 1 3 3 1 2 3 2 0 3 3 2 1 2 3 2 3 0 3 2 2 1 2 3 2 2 1 3 2 2 3 1 3 2 2 3 3 2 2\\r\\n', 'output': ['13']}, {'input': '55\\r\\n3 3 1 3 2 3 2 3 2 2 3 3 3 3 3 1 1 3 3 2 3 2 3 2 0 1 3 3 3 3 2 3 2 3 1 1 2 2 2 3 3 3 3 3 2 2 2 3 2 3 3 3 3 1 3\\r\\n', 'output': ['7']}, {'input': '60\\r\\n0 1 0 0 0 0 0 0 0 2 1 1 3 0 0 0 0 0 1 0 1 1 0 0 0 3 0 1 0 1 0 2 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0\\r\\n', 'output': ['44']}, {'input': '60\\r\\n3 2 1 3 2 2 3 3 3 1 1 3 2 2 3 3 1 3 2 2 3 3 2 2 2 2 0 2 2 3 2 3 0 3 3 3 2 3 3 0 1 3 2 1 3 1 1 2 1 3 1 1 2 2 1 3 3 3 2 2\\r\\n', 'output': ['15']}, {'input': '60\\r\\n3 2 2 3 2 3 2 3 3 2 3 2 3 3 2 3 3 3 3 3 3 2 3 3 1 2 3 3 3 2 1 3 3 1 3 1 3 0 3 3 3 2 3 2 3 2 3 3 1 1 2 3 3 3 3 2 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '65\\r\\n1 0 2 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 2 0 2 1 0 2 1 0 1 0 1 1 0 1 1 1 2 1 0 1 0 0 0 0 1 2 2 1 0 0 1 2 1 2 0 2 0 0 0 1 1\\r\\n', 'output': ['35']}, {'input': '65\\r\\n2 2 2 3 0 2 1 2 3 3 1 3 1 2 1 3 2 3 2 2 2 1 2 0 3 1 3 1 1 3 1 3 3 3 3 3 1 3 0 3 1 3 1 2 2 3 2 0 3 1 3 2 1 2 2 2 3 3 2 3 3 3 2 2 3\\r\\n', 'output': ['13']}, {'input': '65\\r\\n3 2 3 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 3 3 2 2 2 3 3 2 3 3 2 3 3 3 3 2 3 3 3 2 2 3 3 3 3 3 3 2 2 3 3 2 3 3 1 3 3 3 3\\r\\n', 'output': ['6']}, {'input': '70\\r\\n1 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 1 1 1 3 1 1 0 1 2 0 2 1 0 0 0 1 1 1 1 1 0 0 1 0 0 0 1 1 1 3 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1\\r\\n', 'output': ['43']}, {'input': '70\\r\\n2 3 3 3 1 3 3 1 2 1 1 2 2 3 0 2 3 3 1 3 3 2 2 3 3 3 2 2 2 2 1 3 3 0 2 1 1 3 2 3 3 2 2 3 1 3 1 2 3 2 3 3 2 2 2 3 1 1 2 1 3 3 2 2 3 3 3 1 1 1\\r\\n', 'output': ['16']}, {'input': '70\\r\\n3 3 2 2 1 2 1 2 2 2 2 2 3 3 2 3 3 3 3 2 2 2 2 3 3 3 1 3 3 3 2 3 3 3 3 2 3 3 1 3 1 3 2 3 3 2 3 3 3 2 3 2 3 3 1 2 3 3 2 2 2 3 2 3 3 3 3 3 3 1\\r\\n', 'output': ['10']}, {'input': '75\\r\\n1 0 0 1 1 0 0 1 0 1 2 0 0 2 1 1 0 0 0 0 0 0 2 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 1 2 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0\\r\\n', 'output': ['51']}, {'input': '75\\r\\n1 3 3 3 1 1 3 2 3 3 1 3 3 3 2 1 3 2 2 3 1 1 1 1 1 1 2 3 3 3 3 3 3 2 3 3 3 3 3 2 3 3 2 2 2 1 2 3 3 2 2 3 0 1 1 3 3 0 0 1 1 3 2 3 3 3 3 1 2 2 3 3 3 3 1\\r\\n', 'output': ['16']}, {'input': '75\\r\\n3 3 3 3 2 2 3 2 2 3 2 2 1 2 3 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 3 3 3 2 3 2 2 2 3 3 1 3 2 2 3 3 3 0 3 2 1 3 3 2 3 3 3 3 1 2 3 3 3 2 2 3 3 3 3 2 2 3 3 1\\r\\n', 'output': ['11']}, {'input': '80\\r\\n0 0 0 0 2 0 1 1 1 1 1 0 0 0 0 2 0 0 1 0 0 0 0 1 1 0 2 2 1 1 0 1 0 1 0 1 1 1 0 1 2 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 2 2 0 1 1 0 0 0 0 0 0 0 0 1\\r\\n', 'output': ['56']}, {'input': '80\\r\\n2 2 3 3 2 1 0 1 0 3 2 2 3 2 1 3 1 3 3 2 3 3 3 2 3 3 3 2 1 3 3 1 3 3 3 3 3 3 2 2 2 1 3 2 1 3 2 1 1 0 1 1 2 1 3 0 1 2 3 2 2 3 2 3 1 3 3 2 1 1 0 3 3 3 3 1 2 1 2 0\\r\\n', 'output': ['17']}, {'input': '80\\r\\n2 3 3 2 2 2 3 3 2 3 3 3 3 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 1 3 2 3 3 0 3 1 2 3 3 1 2 3 2 3 3 2 3 3 3 3 3 2 2 3 0 3 3 3 3 3 2 2 3 2 3 3 3 3 3 2 3 2 3 3 3 3 2 3\\r\\n', 'output': ['9']}, {'input': '85\\r\\n0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 2 0 1 0 0 2 0 1 1 0 0 0 0 2 2 0 0 0 1 0 0 0 1 2 0 1 0 0 0 2 1 1 2 0 3 1 0 2 2 1 0 0 1 1 0 0 0 0 1 0 2 1 1 2 1 0 0 1 2 1 2 0 0 1 0 1 0\\r\\n', 'output': ['54']}, {'input': '85\\r\\n2 3 1 3 2 3 1 3 3 2 1 2 1 2 2 3 2 2 3 2 0 3 3 2 1 2 2 2 3 3 2 3 3 3 2 1 1 3 1 3 2 2 2 3 3 2 3 2 3 1 1 3 2 3 1 3 3 2 3 3 2 2 3 0 1 1 2 2 2 2 1 2 3 1 3 3 1 3 2 2 3 2 3 3 3\\r\\n', 'output': ['19']}, {'input': '85\\r\\n1 2 1 2 3 2 3 3 3 3 3 3 3 2 1 3 2 3 3 3 3 2 3 3 3 1 3 3 3 3 2 3 3 3 3 3 3 2 2 1 3 3 3 3 2 2 3 1 1 2 3 3 3 2 3 3 3 3 3 2 3 3 3 2 2 3 3 1 1 1 3 3 3 3 1 3 3 3 1 3 3 1 3 2 3\\r\\n', 'output': ['9']}, {'input': '90\\r\\n2 0 1 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 2 2 0 2 0 0 2 1 0 2 0 1 0 1 0 0 1 2 2 0 0 1 0 0 1 0 1 0 2 0 1 1 1 0 1 1 0 1 0 2 0 1 0 1 0 0 0 1 0 0 1 2 0 0 0 1 0 0 2 2 0 0 0 0 0 1 3 1 1 0 1\\r\\n', 'output': ['57']}, {'input': '90\\r\\n2 3 3 3 2 3 2 1 3 0 3 2 3 3 2 1 3 3 2 3 2 3 3 2 1 3 1 3 3 1 2 2 3 3 2 1 2 3 2 3 0 3 3 2 2 3 1 0 3 3 1 3 3 3 3 2 1 2 2 1 3 2 1 3 3 1 2 0 2 2 3 2 2 3 3 3 1 3 2 1 2 3 3 2 3 2 3 3 2 1\\r\\n', 'output': ['17']}, {'input': '90\\r\\n2 3 2 3 2 2 3 3 2 3 2 1 2 3 3 3 2 3 2 3 3 2 3 3 3 1 3 3 1 3 2 3 2 2 1 3 3 3 3 3 3 3 3 3 3 2 3 2 3 2 1 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 1 3 2 3 3 3 2 2 3 2 3 2 1 3 2\\r\\n', 'output': ['9']}, {'input': '95\\r\\n0 0 3 0 2 0 1 0 0 2 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 0 0 2 1 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 2 0 1 2 2 0 0 1 0 2 0 0 0 1 0 2 1 2 1 0 1 0 0 0 1 0 0 1 1 2 1 1 1 1 2 0 0 0 0 0 1 1 0 1\\r\\n', 'output': ['61']}, {'input': '95\\r\\n2 3 3 2 1 1 3 3 3 2 3 3 3 2 3 2 3 3 3 2 3 2 2 3 3 2 1 2 3 3 3 1 3 0 3 3 1 3 3 1 0 1 3 3 3 0 2 1 3 3 3 3 0 1 3 2 3 3 2 1 3 1 2 1 1 2 3 0 3 3 2 1 3 2 1 3 3 3 2 2 3 2 3 3 3 2 1 3 3 3 2 3 3 1 2\\r\\n', 'output': ['15']}, {'input': '95\\r\\n2 3 3 2 3 2 2 1 3 1 2 1 2 3 1 2 3 3 1 3 3 3 1 2 3 2 2 2 2 3 3 3 2 2 3 3 3 3 3 1 2 2 3 3 3 3 2 3 2 2 2 3 3 2 3 3 3 3 3 3 3 0 3 2 0 3 3 1 3 3 3 2 3 2 3 2 3 3 3 3 2 2 1 1 3 3 3 3 3 1 3 3 3 3 2\\r\\n', 'output': ['14']}, {'input': '100\\r\\n1 0 2 0 0 0 0 2 0 0 0 1 0 1 0 0 1 0 1 2 0 1 1 0 0 1 0 1 1 0 0 0 2 0 1 0 0 2 0 0 0 0 0 1 1 1 0 0 1 0 2 0 0 0 0 1 0 1 0 1 0 1 0 1 2 2 0 0 2 0 1 0 1 0 1 0 0 0 1 0 0 2 1 1 1 0 0 1 0 0 0 2 0 0 2 1 1 0 0 2\\r\\n', 'output': ['63']}, {'input': '100\\r\\n3 2 1 3 2 3 2 3 2 2 3 1 3 3 3 3 3 2 2 3 2 2 3 2 3 3 3 2 3 1 2 1 3 3 3 3 1 3 3 3 3 3 2 3 2 1 3 3 1 2 2 3 1 3 3 1 2 2 1 3 1 3 2 2 3 3 1 3 2 3 1 2 1 2 3 3 2 2 1 2 3 3 3 3 3 1 3 3 3 3 2 1 3 0 3 3 3 2 3 3\\r\\n', 'output': ['15']}, {'input': '100\\r\\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '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': ['50']}, {'input': '100\\r\\n2 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 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['50']}, {'input': '99\\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\\r\\n', 'output': ['49']}, {'input': '100\\r\\n2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1\\r\\n', 'output': ['0']}, {'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': ['100']}, {'input': '2\\r\\n0 3\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2 1\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0\\r\\n', 'output': ['50']}]","id":353} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\n\tn, vb, vs := readThreeNums(reader)\n\tX := readNNums(reader, n)\n\troom := readNNums(reader, 2)\n\n\tfmt.Println(solve(n, vb, vs, X, room))\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\nfunc solve(n int, vb int, vs int, X []int, exam []int) int {\n\ttime := make([]float64, n)\n\tv1 := float64(vs)\n\tv2 := float64(vb)\n\tvar best = math.MaxFloat64\n\tvar pos int\n\tfor i := 0; i < n; i++ {\n\t\tt1 := float64(X[0]) \/ v1\n\t\tt2 := distance(exam[0], exam[1], X[i], 0) \/ v2\n\t\ttime[i] = t1 + t2\n\t\tif i > 0 && time[i] < best {\n\t\t\tbest = time[i]\n\t\t\tpos = i\n\t\t}\n\t}\n\treturn pos + 1\n}\n\nfunc distance(a, b, c, d int) float64 {\n\tdx := float64(c - a)\n\tdy := float64(d - b)\n\treturn math.Sqrt(dx*dx + dy*dy)\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"math\"\n\t\"os\"\n)\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar n int\n\tvar vb, vs, xu, yu float64\n\n\tfmt.Fscanf(reader, \"%d %f %f\\n\", &n, &vb, &vs)\n\tstop := make([]float64, n)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscanf(reader, \"%f\", &stop[i])\n\t\tif i != n-1 {\n\t\t\tfmt.Fscanf(reader, \" \")\n\t\t} else {\n\t\t\tfmt.Fscanf(reader, \"\\n\")\n\t\t}\n\t}\n\tfmt.Fscanf(reader, \"%f %f\", &xu, &yu)\n\tmin := 99999999999.0\n\tvar minStop int\n\tfor i := 1; i < n; i++ {\n\t\tt := stop[i]\/vb + math.Sqrt((xu-stop[i])*(xu-stop[i])+yu*yu)\/vs\n\t\tif t < min {\n\t\t\tminStop = i\n\t\t\tmin = t\n\t\t} else if t == min {\n\t\t\tif math.Abs(xu-stop[minStop]) > math.Abs(xu-stop[i]) {\n\t\t\t\tminStop = i\n\t\t\t\tmin = t\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Printf(\"%d\", minStop+1)\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":354} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"18_C","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n\/*\n1\n3\n---\n0\n======\n2\n2 2\n---\n1\n======\n2\n-4 -4\n---\n1\n======\n6\n1 2 3 1 2 3\n---\n1\n======\n5\n1 -2 3 0 -1\n---\n0\n*\/\n\n\/\/goland:noinspection GoUnhandledErrorResult\nfunc main() {\n\tdefer writer.Flush()\n\n\tbld := strings.Builder{}\n\n\tt := 1\n\t\/\/scanf(\"%d\\n\", &t)\n\n\tfor ; t > 0; t-- {\n\t\tvar n int\n\t\tscanf(\"%d\\n\", &n)\n\n\t\t\/\/ overflow is expected\n\t\tps := make([]int, n)\n\n\t\tif strconv.IntSize == 64 {\n\t\t\tprintf(\"64bit\")\n\t\t\treturn\n\t\t}\n\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar num int\n\t\t\tscanf(\"%d\", &num)\n\n\t\t\tif i == 0 {\n\t\t\t\tps[i] = num\n\t\t\t} else {\n\t\t\t\tps[i] = ps[i-1] + num\n\t\t\t}\n\t\t}\n\n\t\tcnt := 0\n\n\t\tfor i := 0; i < n-1; i++ {\n\t\t\tleftSum := ps[i]\n\t\t\trightSum := ps[n-1] - ps[i]\n\t\t\tif leftSum == rightSum {\n\t\t\t\tcnt++\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintln(&bld, cnt)\n\t}\n\n\tprintf(\"%s\", bld.String())\n}\n\nconst maxUint = ^uint(0)\n\n\/\/goland:noinspection GoUnusedConst\nconst minUint = 0\nconst maxInt = int(maxUint >> 1)\n\n\/\/goland:noinspection GoUnusedConst\nconst minInt = -maxInt - 1\n\n\/\/goland:noinspection GoUnusedType\ntype pair struct {\n\tfst int\n\tsnd int\n}\n\nvar reader = bufio.NewReader(os.Stdin)\nvar writer = bufio.NewWriter(os.Stdout)\n\n\/\/goland:noinspection GoUnusedFunction\nfunc printf(f string, a ...interface{}) {\n\tif _, err := fmt.Fprintf(writer, f, a...); err != nil {\n\t\tpanic(err)\n\t}\n}\n\nfunc scanf(f string, a ...interface{}) {\n\tif _, err := fmt.Fscanf(reader, f, a...); err != nil {\n\t\tpanic(err)\n\t}\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc max(x, y int) int {\n\tif x > y {\n\t\treturn x\n\t}\n\treturn y\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc isPrime(n int) bool {\n\tif n == 2 || n == 3 {\n\t\treturn true\n\t}\n\n\tif n <= 1 || n%2 == 0 || n%3 == 0 {\n\t\treturn false\n\t}\n\n\tfor i := 5; i*i <= n; i += 6 {\n\t\tif n%i == 0 || n%(i+2) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc gcd(a, b int) int {\n\tfor b != 0 {\n\t\ta, b = b, a%b\n\t}\n\treturn a\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc lcm(a, b int) int {\n\treturn abs(a) \/ gcd(a, b) * abs(b)\n}\n\n\/\/ Examples:\n\/\/\tdigitAt(1234, 0) -> 4\n\/\/\tdigitAt(1234, 1) -> 3\n\/\/\tdigitAt(1234, 2) -> 2\n\/\/\tdigitAt(1234, 3) -> 2\n\/\/\tdigitAt(1234, 4) -> panic!\n\/\/goland:noinspection GoUnusedFunction\nfunc digitAt(num, pos int) int {\n\tlenNum := int(math.Log10(float64(num))) + 1\n\tif pos >= lenNum {\n\t\terr := fmt.Sprintf(\"Out of bound access for digit. Position passed %d, number lenght %d\", pos, lenNum)\n\t\tpanic(err)\n\t}\n\n\trem := num % int(math.Pow(10, float64(pos+1)))\n\treturn rem \/ int(math.Pow(10, float64(pos)))\n}\n","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 two pieces so that the sum of numbers from one piece is equal to the sum of numbers from the 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 two non-empty pieces so that the sum of numbers from one piece is equal to the sum of numbers from the other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only.\n","notes":null,"sample_inputs":["9\n1 5 -6 7 9 -16 0 -2 2\n","3\n1 1 1\n","2\n0 0\n"],"sample_outputs":["3\n","0\n","1\n"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"strings\"\n)\n\n\/*\n1\n3\n---\n0\n======\n2\n2 2\n---\n1\n======\n2\n-4 -4\n---\n1\n======\n6\n1 2 3 1 2 3\n---\n1\n======\n5\n1 -2 3 0 -1\n---\n0\n*\/\n\n\/\/goland:noinspection GoUnhandledErrorResult\nfunc main() {\n\tdefer writer.Flush()\n\n\tbld := strings.Builder{}\n\n\tt := 1\n\t\/\/scanf(\"%d\\n\", &t)\n\n\tfor ; t > 0; t-- {\n\t\tvar n int\n\t\tscanf(\"%d\\n\", &n)\n\n\t\tps := make([]int, n)\n\n\t\tfor i := 0; i < n; i++ {\n\t\t\tvar num int\n\t\t\tscanf(\"%d\", &num)\n\n\t\t\tif i == 0 {\n\t\t\t\tps[i] = num\n\t\t\t} else {\n\t\t\t\tps[i] = ps[i-1] + num\n\t\t\t}\n\t\t}\n\n\t\tcnt := 0\n\n\t\tfor i := 0; i < n-1; i++ {\n\t\t\tleftSum := ps[i]\n\t\t\trightSum := ps[n-1] - ps[i]\n\t\t\tif leftSum == rightSum {\n\t\t\t\tcnt++\n\t\t\t}\n\t\t}\n\n\t\tfmt.Fprintln(&bld, cnt)\n\t}\n\n\tprintf(\"%s\", bld.String())\n}\n\nconst maxUint = ^uint(0)\n\n\/\/goland:noinspection GoUnusedConst\nconst minUint = 0\nconst maxInt = int(maxUint >> 1)\n\n\/\/goland:noinspection GoUnusedConst\nconst minInt = -maxInt - 1\n\n\/\/goland:noinspection GoUnusedType\ntype pair struct {\n\tfst int\n\tsnd int\n}\n\nvar reader = bufio.NewReader(os.Stdin)\nvar writer = bufio.NewWriter(os.Stdout)\n\n\/\/goland:noinspection GoUnusedFunction\nfunc printf(f string, a ...interface{}) {\n\tif _, err := fmt.Fprintf(writer, f, a...); err != nil {\n\t\tpanic(err)\n\t}\n}\n\nfunc scanf(f string, a ...interface{}) {\n\tif _, err := fmt.Fscanf(reader, f, a...); err != nil {\n\t\tpanic(err)\n\t}\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc max(x, y int) int {\n\tif x > y {\n\t\treturn x\n\t}\n\treturn y\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc abs(x int) int {\n\tif x < 0 {\n\t\treturn -x\n\t}\n\treturn x\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc isPrime(n int) bool {\n\tif n == 2 || n == 3 {\n\t\treturn true\n\t}\n\n\tif n <= 1 || n%2 == 0 || n%3 == 0 {\n\t\treturn false\n\t}\n\n\tfor i := 5; i*i <= n; i += 6 {\n\t\tif n%i == 0 || n%(i+2) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc gcd(a, b int) int {\n\tfor b != 0 {\n\t\ta, b = b, a%b\n\t}\n\treturn a\n}\n\n\/\/goland:noinspection GoUnusedFunction\nfunc lcm(a, b int) int {\n\treturn abs(a) \/ gcd(a, b) * abs(b)\n}\n\n\/\/ Examples:\n\/\/\tdigitAt(1234, 0) -> 4\n\/\/\tdigitAt(1234, 1) -> 3\n\/\/\tdigitAt(1234, 2) -> 2\n\/\/\tdigitAt(1234, 3) -> 2\n\/\/\tdigitAt(1234, 4) -> panic!\n\/\/goland:noinspection GoUnusedFunction\nfunc digitAt(num, pos int) int {\n\tlenNum := int(math.Log10(float64(num))) + 1\n\tif pos >= lenNum {\n\t\terr := fmt.Sprintf(\"Out of bound access for digit. Position passed %d, number lenght %d\", pos, lenNum)\n\t\tpanic(err)\n\t}\n\n\trem := num % int(math.Pow(10, float64(pos+1)))\n\treturn rem \/ int(math.Pow(10, float64(pos)))\n}\n","testcases":"[{'input': ['9\\r\\n1 5 -6 7 9 -16 0 -2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n0 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n100 1 10 111\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n0 4 -3 0 -2 2 -3 -3 2 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\n0 -1 2 2 -1 1 0 0 0 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n-1 -1 1 -1 0 1 0 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['50\\r\\n-4 -3 3 4 -1 0 2 -4 -3 -4 1 4 3 0 4 1 0 -3 4 -3 -2 2 2 1 0 -4 -4 -5 3 2 -1 4 5 -3 -3 4 4 -5 2 -3 4 -5 2 5 -4 4 1 -2 -4 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['15\\r\\n0 4 0 3 -1 4 -2 -2 -4 -4 3 2 4 -1 -3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n3 -1 -3 -1 3 -2 0 3 1 -2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n-4 2 4 4 1 3 -3 -3 2 1 -4 0 0 2 3 -1 -4 -3 4 -2 -3 -3 -3 -1 -2 -3 -1 -4 0 4 0 -1 4 0 -4 -4 4 -4 -2 1 -4 1 -3 -2 3 -4 4 0 -1 3 -1 4 -1 4 -1 3 -3 -3 -2 -2 4 -3 -3 4 -3 -2 -1 0 -2 4 0 -3 -1 -2 -3 1 -4 1 -3 -3 -3 -2 -3 0 1 -2 -2 -4 -3 -1 2 3 -1 1 1 0 3 -3 -1 -2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100\\r\\n-2 -1 1 0 -2 -1 2 2 0 0 2 1 0 2 0 2 1 0 -1 -1 -1 0 -2 -1 2 -1 -2 2 -2 2 -2 -2 2 1 1 1 -2 2 0 0 2 -1 2 2 2 0 -1 -1 -1 1 -2 2 2 2 -2 0 0 -2 0 -2 -2 0 -1 -1 -2 -1 1 2 -2 -1 1 -2 -1 0 -2 2 2 -1 -2 2 0 0 0 1 0 1 2 1 -2 -2 -1 -1 -2 -2 -2 -1 2 2 2 -2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100\\r\\n2 7 6 0 8 -2 0 1 8 -1 7 -4 -1 1 0 3 4 -4 3 7 8 -4 -6 6 4 -2 -5 7 4 6 1 6 3 8 -2 6 -6 -3 0 -1 -7 -8 -2 5 8 6 -2 -2 -5 -4 -7 -3 -5 -3 -3 -1 5 8 4 0 -7 -6 8 -4 -1 7 2 6 6 4 -5 -4 -5 -2 2 -2 -7 -1 5 -8 -6 -2 -5 4 2 8 -6 7 -8 -1 -5 8 6 -3 -1 7 -1 2 -8 -8\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}]","id":355} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc can_buy(cur uint64, prizes []int) int {\n\tfor i:=4; i>=0; i-- {\n\t\tif cur >= uint64(prizes[i]) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}\n\nfunc main() {\n\tvar n int\n\tvar cur uint64 = 0\n\tfmt.Scan(&n)\n\tpoints := make([]int, n)\n\tprizes := make([]int, 5)\n\tclaimed_prizes := make([]int, 5)\n\tfor i:=0; i=1;j-- {\n\t\t\ty[j]+=e\/x[j]\n\t\t\te%=x[j]\n\t\t}\n\t}\n\tfor f=1; f<=5;f++ {\n\t\tfmt.Print(y[f],\" \")\n\t}\n\tfmt.Println()\n\tfmt.Println(e)\n}\n\n\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":356} {"difficulty":1500,"lang":"Go","lang_cluster":"Go","src_uid":"24_B","execute_outcome":"WRONG_ANSWER","source_code":"package main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t\"fmt\"\r\n\t\"os\"\r\n)\r\n\r\nvar reader *bufio.Reader = bufio.NewReader(os.Stdin)\r\nvar writer *bufio.Writer = bufio.NewWriter(os.Stdout)\r\n\r\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\r\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\r\n\r\ntype game struct {\r\n\tname string\r\n\tscore int\r\n\tplace [10]int\r\n}\r\n\r\nfunc main() {\r\n\t\/\/ STDOUT MUST BE FLUSHED MANUALLY!!!\r\n\tdefer writer.Flush()\r\n\tif len(os.Args[1:]) == 1 {\r\n\t\tfile, _ := os.Open(os.Args[1])\r\n\t\treader = bufio.NewReader(file)\r\n\t}\r\n\r\n\tvar n, t int\r\n\tscanf(\"%d\\n\", &t)\r\n\tn2n := make(map[string]int)\r\n\tstart := 0\r\n\tvar s string\r\n\tc := make([]game, 50)\r\n\trank := [10]int{25, 18, 15, 12, 10, 8, 6, 4, 2, 1}\r\n\tfor i := 0; i < t; i++ {\r\n\t\tscanf(\"%d\\n\", &n)\r\n\t\tfor j := 0; j < n; j++ {\r\n\t\t\tscanf(\"%s\\n\", &s)\r\n\t\t\tif j >= 10 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tindex, ok := n2n[s]\r\n\t\t\tif !ok {\r\n\t\t\t\tn2n[s] = start\r\n\t\t\t\tindex = start\r\n\t\t\t\tstart++\r\n\t\t\t}\r\n\t\t\tc[index].name = s\r\n\t\t\tc[index].score += rank[j]\r\n\t\t\tc[index].place[j]++\r\n\t\t}\r\n\t}\r\n\tma := c[0]\r\n\t\/\/fmt.Println(c)\r\n\tfor i := 1; i < 50; i++ {\r\n\t\tif bigger(c[i], ma) {\r\n\t\t\tma = c[i]\r\n\t\t}\r\n\t}\r\n\tprintf(\"%s\\n\", ma.name)\r\n\tma = c[0]\r\n\tfor i := 1; i < 50; i++ {\r\n\t\tif bigger2(c[i], ma) {\r\n\t\t\tma = c[i]\r\n\t\t}\r\n\t}\r\n\tprintf(\"%s\\n\", ma.name)\r\n}\r\n\r\nfunc bigger(left, right game) bool {\r\n\tif left.score > right.score {\r\n\t\treturn true\r\n\t}\r\n\tif left.score < right.score {\r\n\t\treturn false\r\n\t}\r\n\tfor i := 0; i < 10; i++ {\r\n\t\tif left.place[i] > right.place[i] {\r\n\t\t\treturn true\r\n\t\t} else if left.place[i] < right.place[i] {\r\n\t\t\treturn false\r\n\t\t}\r\n\t}\r\n\r\n\treturn false\r\n}\r\n\r\nfunc bigger2(left, right game) bool {\r\n\tif left.place[0] > right.place[0] {\r\n\t\treturn true\r\n\t} else if left.place[0] < right.place[0] {\r\n\t\treturn false\r\n\t}\r\n\tif left.score > right.score {\r\n\t\treturn true\r\n\t}\r\n\tif left.score < right.score {\r\n\t\treturn false\r\n\t}\r\n\tfor i := 1; i < 10; i++ {\r\n\t\tif left.place[i] > right.place[i] {\r\n\t\t\treturn true\r\n\t\t} else if left.place[i] < right.place[i] {\r\n\t\t\treturn false\r\n\t\t}\r\n\t}\r\n\r\n\treturn false\r\n}\r\n","description":"Formula One championship consists of series of races called Grand Prix. After every race drivers receive points according to their final position. Only the top 10 drivers receive points in the following order 25, 18, 15, 12, 10, 8, 6, 4, 2, 1. At the conclusion of the championship the driver with most points is the champion. If there is a tie, champion is the one with most wins (i.e. first places). If a tie still exists, it is chosen the one with most second places, and so on, until there are no more place to use for compare. Last year another scoring system was proposed but rejected. In it the champion is the one with most wins. If there is tie, champion is the one with most points. If a tie still exists it is proceeded the same way as in the original scoring system, that is comparing number of second, third, forth, and so on, places.You are given the result of all races during the season and you are to determine the champion according to both scoring systems. It is guaranteed, that both systems will produce unique champion.","input_specification":"The first line contain integer t (1\u2264t\u226420), where t is the number of races. After that all races are described one by one. Every race description start with an integer n (1\u2264n\u226450) on a line of itself, where n is the number of clasified drivers in the given race. After that n lines follow with the classification for the race, each containing the name of a driver. The names of drivers are given in order from the first to the last place. The name of the driver consists of lowercase and uppercase English letters and has length at most 50 characters. Comparing of names should be case-sensetive.\n","output_specification":"Your output should contain exactly two line. On the first line is the name of the champion according to the original rule, and on the second line the name of the champion according to the alternative rule.\n","notes":"It is not guaranteed that the same drivers participate in all races. For the championship consider every driver that has participated in at least one race. The total number of drivers during the whole season is not more then 50.\n","sample_inputs":["3\n3\nHamilton\nVettel\nWebber\n2\nWebber\nVettel\n2\nHamilton\nVettel\n","2\n7\nProst\nSurtees\nNakajima\nSchumacher\nButton\nDeLaRosa\nBuemi\n8\nAlonso\nProst\nNinoFarina\nJimClark\nDeLaRosa\nNakajima\nPatrese\nSurtees\n"],"sample_outputs":["Vettel\nHamilton\n","Prost\nProst\n"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strconv\"\n \"fmt\"\n \"sort\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\ntype Driver struct {\n Name string\n Points int\n Places map[int]int\n MaxPlace int\n}\n\nvar drivers = map[string]*Driver{}\n\ntype OldList []*Driver\ntype NewList []*Driver\nfunc (list OldList) Len() int {\n return len(list)\n}\nfunc (list OldList) Swap(i, j int) {\n list[i], list[j] = list[j], list[i]\n}\nfunc (list NewList) Len() int {\n return len(list)\n}\nfunc (list NewList) Swap(i, j int) {\n list[i], list[j] = list[j], list[i]\n}\n\nfunc (list OldList) Less(i, j int) bool {\n a, b := list[i], list[j]\n if a.Points != b.Points {\n return a.Points > b.Points\n }\n return comparePlaces(a, b)\n}\nfunc (list NewList) Less(i, j int) bool {\n a, b := list[i], list[j]\n if a.Places[1] != b.Places[1] {\n return a.Places[1] > b.Places[1]\n }\n if a.Points != b.Points {\n return a.Points > b.Points\n }\n return comparePlaces(a, b)\n}\nfunc comparePlaces(a, b *Driver) bool {\n for p := 1; p <= a.MaxPlace || p <= b.MaxPlace; p++ {\n placesA := a.Places[p]\n placesB := b.Places[p]\n if placesA != placesB {\n return placesA > placesB\n }\n }\n return true\n}\n\nfunc main() {\n scanner = bufio.NewScanner(os.Stdin)\n scanner.Split(bufio.ScanWords)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n points := map[int]int{ 1: 25, 2: 18, 3: 15, 4: 12, 5: 10,\n 6: 8, 7: 6, 8: 4, 9: 2, 10: 1 }\n\n t := getI()\n for ti := 0; ti < t; ti++ {\n n := getI()\n for ni := 0; ni < n; ni++ {\n name := getS()\n place := ni+1\n driver, found := drivers[name]\n if !found {\n driver = &Driver{ name, 0, map[int]int{}, 0 }\n drivers[name] = driver\n }\n driver.Points += points[place]\n driver.Places[place] += 1\n if place > driver.MaxPlace {\n driver.MaxPlace = place\n }\n }\n }\n oldList, newList := []*Driver{}, []*Driver{}\n for _, driver := range drivers {\n oldList = append(oldList, driver)\n newList = append(newList, driver)\n }\n sort.Sort(OldList(oldList))\n sort.Sort(NewList(newList))\n writer.WriteString(fmt.Sprintf(\"%s\\n\", oldList[0].Name))\n writer.WriteString(fmt.Sprintf(\"%s\\n\", newList[0].Name))\n}\n","testcases":"[{'input': ['3\\r\\n3\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\n2\\r\\nWebber\\r\\nVettel\\r\\n2\\r\\nHamilton\\r\\nVettel\\r\\n'], 'output': ['Vettel\\r\\nHamilton\\r\\n']}, {'input': ['2\\r\\n7\\r\\nProst\\r\\nSurtees\\r\\nNakajima\\r\\nSchumacher\\r\\nButton\\r\\nDeLaRosa\\r\\nBuemi\\r\\n8\\r\\nAlonso\\r\\nProst\\r\\nNinoFarina\\r\\nJimClark\\r\\nDeLaRosa\\r\\nNakajima\\r\\nPatrese\\r\\nSurtees\\r\\n'], 'output': ['Prost\\r\\nProst\\r\\n']}, {'input': ['5\\r\\n3\\r\\nWebber\\r\\nTrulli\\r\\nJones\\r\\n9\\r\\nVilleneuve\\r\\nBerger\\r\\nJimClark\\r\\nReneArnoux\\r\\nKubica\\r\\nJones\\r\\nScheckter\\r\\nKobayashi\\r\\nJamesHunt\\r\\n10\\r\\nTrulli\\r\\nJackBrabham\\r\\nKobayashi\\r\\nNakajima\\r\\nAndretti\\r\\nScheckter\\r\\nDeLaRosa\\r\\nReneArnoux\\r\\nKovalainen\\r\\nJones\\r\\n3\\r\\nBerger\\r\\nJimClark\\r\\nTrulli\\r\\n15\\r\\nNakajima\\r\\nVilleneuve\\r\\nBerger\\r\\nTrulli\\r\\nJamesHunt\\r\\nMassa\\r\\nReneArnoux\\r\\nKubica\\r\\nJimClark\\r\\nDeLaRosa\\r\\nJackBrabham\\r\\nHill\\r\\nKobayashi\\r\\ndiGrassi\\r\\nJones\\r\\n'], 'output': ['Trulli\\r\\nTrulli\\r\\n']}, {'input': ['2\\r\\n18\\r\\nKubica\\r\\nHawthorn\\r\\nSurtees\\r\\nBerger\\r\\nKobayashi\\r\\nWebber\\r\\nJackBrabham\\r\\nJimClark\\r\\nPatrese\\r\\nJones\\r\\nHakkinen\\r\\nJackieStewert\\r\\nMensel\\r\\nSenna\\r\\nHamilton\\r\\nAlonso\\r\\nHulkenberg\\r\\nBarichelo\\r\\n9\\r\\nHawthorn\\r\\nSutil\\r\\nBarichelo\\r\\nJackieStewert\\r\\nJones\\r\\nScheckter\\r\\nPiquet\\r\\nLiuzzi\\r\\nKovalainen\\r\\n'], 'output': ['Hawthorn\\r\\nHawthorn\\r\\n']}, {'input': ['6\\r\\n2\\r\\nAlbertoAscari\\r\\nHamilton\\r\\n5\\r\\nScheckter\\r\\nAlguersuari\\r\\nVettel\\r\\nPetrov\\r\\nProst\\r\\n5\\r\\nAlbertoAscari\\r\\nScheckter\\r\\nAlguersuari\\r\\nVettel\\r\\nHamilton\\r\\n3\\r\\nScheckter\\r\\nHamilton\\r\\nAlguersuari\\r\\n3\\r\\nAlbertoAscari\\r\\nScheckter\\r\\nProst\\r\\n4\\r\\nAlbertoAscari\\r\\nAlguersuari\\r\\nScheckter\\r\\nHamilton\\r\\n'], 'output': ['Scheckter\\r\\nAlbertoAscari\\r\\n']}, {'input': ['15\\r\\n3\\r\\nSenna\\r\\nFittipaldi\\r\\nLauda\\r\\n2\\r\\nSenna\\r\\nFittipaldi\\r\\n2\\r\\nFittipaldi\\r\\nLauda\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nFittipaldi\\r\\nSenna\\r\\nLauda\\r\\n1\\r\\nSenna\\r\\n3\\r\\nSenna\\r\\nFittipaldi\\r\\nLauda\\r\\n1\\r\\nLauda\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nSenna\\r\\nFittipaldi\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n1\\r\\nSenna\\r\\n3\\r\\nFittipaldi\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nFittipaldi\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nSenna\\r\\nFittipaldi\\r\\n'], 'output': ['Senna\\r\\nLauda\\r\\n']}, {'input': ['11\\r\\n4\\r\\nLauda\\r\\nRosberg\\r\\nBerger\\r\\nBarichelo\\r\\n4\\r\\nGlock\\r\\nPatrese\\r\\nBarichelo\\r\\nLauda\\r\\n7\\r\\nGlock\\r\\nBarichelo\\r\\nSchumacher\\r\\nLauda\\r\\nPatrese\\r\\nBerger\\r\\nRosberg\\r\\n4\\r\\nBerger\\r\\nRosberg\\r\\nPatrese\\r\\nBarichelo\\r\\n3\\r\\nSchumacher\\r\\nGlock\\r\\nPatrese\\r\\n1\\r\\nBarichelo\\r\\n1\\r\\nBarichelo\\r\\n5\\r\\nRosberg\\r\\nBerger\\r\\nGlock\\r\\nBarichelo\\r\\nPatrese\\r\\n1\\r\\nBerger\\r\\n3\\r\\nBerger\\r\\nSchumacher\\r\\nLauda\\r\\n4\\r\\nRosberg\\r\\nSchumacher\\r\\nBarichelo\\r\\nLauda\\r\\n'], 'output': ['Barichelo\\r\\nBerger\\r\\n']}, {'input': ['2\\r\\n11\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\nButton\\r\\nKubica\\r\\nPetrov\\r\\nRoseberg\\r\\nSchumacher\\r\\nAlonson\\r\\nMassa\\r\\nSenna\\r\\n10\\r\\nSenna\\r\\nKobayashi\\r\\nDeLaRosa\\r\\nHakkinen\\r\\nRaikkonen\\r\\nProst\\r\\nJimClark\\r\\nNakajima\\r\\nBerger\\r\\nAlbertoAscari\\r\\n'], 'output': ['Senna\\r\\nSenna\\r\\n']}, {'input': ['2\\r\\n10\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\nButton\\r\\nKubica\\r\\nPetrov\\r\\nRoseberg\\r\\nSchumacher\\r\\nAlonson\\r\\nMassa\\r\\n11\\r\\nSenna\\r\\nKobayashi\\r\\nDeLaRosa\\r\\nHakkinen\\r\\nRaikkonen\\r\\nProst\\r\\nJimClark\\r\\nNakajima\\r\\nBerger\\r\\nAlbertoAscari\\r\\nHamilton\\r\\n'], 'output': ['Hamilton\\r\\nHamilton\\r\\n']}, {'input': ['1\\r\\n50\\r\\nJamesHunt\\r\\nNakajima\\r\\nHakkinen\\r\\nScheckter\\r\\nJones\\r\\nHill\\r\\nHawthorn\\r\\nVettel\\r\\nHulkenberg\\r\\nSutil\\r\\nGlock\\r\\nWebber\\r\\nAlbertoAscari\\r\\nMensel\\r\\nBuemi\\r\\nKubica\\r\\ndiGrassi\\r\\nJimClark\\r\\nKovalainen\\r\\nTrulli\\r\\nBarichelo\\r\\nSurtees\\r\\nJackieStewert\\r\\nLauda\\r\\nRaikkonen\\r\\nVilleneuve\\r\\nFangio\\r\\nButton\\r\\nDeLaRosa\\r\\nProst\\r\\nRosberg\\r\\nAlonso\\r\\nBerger\\r\\nPatrese\\r\\nHamilton\\r\\nJochenRindt\\r\\nNinoFarina\\r\\nKobayashi\\r\\nFittipaldi\\r\\nAlguersuari\\r\\nDennyHulme\\r\\nSchumacher\\r\\nPetrov\\r\\nPiquet\\r\\nAndretti\\r\\nJackBrabham\\r\\nMassa\\r\\nSenna\\r\\nLiuzzi\\r\\nReneArnoux\\r\\n'], 'output': ['JamesHunt\\r\\nJamesHunt\\r\\n']}, {'input': ['1\\r\\n1\\r\\nA\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['2\\r\\n1\\r\\nA\\r\\n1\\r\\nA\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['2\\r\\n2\\r\\nA\\r\\nB\\r\\n2\\r\\nA\\r\\nC\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['3\\r\\n2\\r\\nA\\r\\nB\\r\\n2\\r\\nA\\r\\nD\\r\\n2\\r\\nA\\r\\nC\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['20\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n'], 'output': ['b\\r\\nb\\r\\n']}, {'input': ['20\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n'], 'output': ['b\\r\\nb\\r\\n']}, {'input': ['20\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nba\\r\\na\\r\\nab\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n'], 'output': ['ab\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n'], 'output': ['ab\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nab\\r\\nb\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n'], 'output': ['b\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\na\\r\\nab\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n'], 'output': ['b\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nba\\r\\nab\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n'], 'output': ['ab\\r\\nb\\r\\n']}]","id":357} {"difficulty":1100,"lang":"Go","lang_cluster":"Go","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport (\n\t\"fmt\"\n\t\"bufio\"\n\t\"os\"\n\t\"strconv\"\n)\n\nvar scanner = bufio.NewScanner(os.Stdin)\nvar writer = bufio.NewWriter(os.Stdout)\n\n\/\/Wrong\nfunc main() {\n\tdefer writer.Flush()\n\tscanner.Split(bufio.ScanWords)\n\n\tn := nextInt()\n\t_ = n\n\n\ts := next()\n\n\ti, count := 0, 0\n\n\tfor i 0{\n\t\t\tpeopleMap[peopleList[i]] = true\n\t\t}else{\n\t\t\tnow := peopleList[i] * -1\n\t\t\tdelete(peopleMap, now)\n\t\t}\n\t\tres = Max(res, len(peopleMap))\n\t}\n\tfmt.Println(res)\n}\n\nfunc Max(x, y int) int {\n\tif x > y {\n\t\treturn x\n\t}\n\treturn y\n}","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":360} {"difficulty":1000,"lang":"Go","lang_cluster":"Go","src_uid":"6e0dafeaf85e92f959c388c72e158f68","execute_outcome":"COMPILATION_ERROR","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"runtime\"\n\t\"strconv\"\n)\n\nfunc main() {\n\tget := wrapStdin()\n\tn, a, b := get.Int(), get.Int(), get.Int()\n\n\tif a*b < n {\n\t\tfmt.Println(-1)\n\t\tfmt.Fprintf(os.Stderr, runtime.GOMAXPROCS(0))\n\t\treturn\n\t}\n\n\tg := func(b int) func() int {\n\t\treturn func() int {\n\t\t\tt := b\n\t\t\tb += 2\n\t\t\tif t > n {\n\t\t\t\tt = 0\n\t\t\t}\n\t\t\treturn t\n\t\t}\n\t}\n\tev, od := g(2), g(1)\n\n\tfor i := 0; i < a; i++ {\n\t\tfor j := 0; j < b; j++ {\n\t\t\tvar x int\n\t\t\tif (i^j)&1 == 0 {\n\t\t\t\tx = od()\n\t\t\t} else {\n\t\t\t\tx = ev()\n\t\t\t}\n\t\t\tfmt.Printf(\"%d \", x)\n\t\t}\n\t\tfmt.Printf(\"\\n\")\n\t}\n}\n\ntype Input struct {\n\t*bufio.Scanner\n}\n\nfunc wrapStdin() Input {\n\tsc := bufio.NewScanner(os.Stdin)\n\tsc.Split(bufio.ScanWords)\n\treturn Input{Scanner: sc}\n}\nfunc (in Input) Int() int {\n\tin.Scan()\n\tx, _ := strconv.Atoi(in.Text())\n\treturn x\n}\nfunc (in Input) IntOk() (int, bool) {\n\tok := in.Scan()\n\tx, _ := strconv.Atoi(in.Text())\n\treturn x, ok\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n)\n\nfunc main() {\n\tget := wrapStdin()\n\tn, a, b := get.Int(), get.Int(), get.Int()\n\n\tif a*b < n {\n\t\tfmt.Println(-1)\n\t\treturn\n\t}\n\n\tg := func(b int) func() int {\n\t\treturn func() int {\n\t\t\tt := b\n\t\t\tb += 2\n\t\t\tif t > n {\n\t\t\t\tt = 0\n\t\t\t}\n\t\t\treturn t\n\t\t}\n\t}\n\tev, od := g(2), g(1)\n\n\tfor i := 0; i < a; i++ {\n\t\tfor j := 0; j < b; j++ {\n\t\t\tvar x int\n\t\t\tif (i^j)&1 == 0 {\n\t\t\t\tx = od()\n\t\t\t} else {\n\t\t\t\tx = ev()\n\t\t\t}\n\t\t\tfmt.Printf(\"%d \", x)\n\t\t}\n\t\tfmt.Printf(\"\\n\")\n\t}\n}\n\ntype Input struct {\n\t*bufio.Scanner\n}\n\nfunc wrapStdin() Input {\n\tsc := bufio.NewScanner(os.Stdin)\n\tsc.Split(bufio.ScanWords)\n\treturn Input{Scanner: sc}\n}\nfunc (in Input) Int() int {\n\tin.Scan()\n\tx, _ := strconv.Atoi(in.Text())\n\treturn x\n}\nfunc (in Input) IntOk() (int, bool) {\n\tok := in.Scan()\n\tx, _ := strconv.Atoi(in.Text())\n\treturn x, ok\n}\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":361} {"difficulty":1100,"lang":"Go","lang_cluster":"Go","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ 25B\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar i, n int\n\tvar s string\n\tfmt.Scan(&n, &s)\n\tfor i = 0; i < n-2-n%2; i += 2 {\n\t\tfmt.Print(s[i], s[i+1], string('-'))\n\t}\n\tfmt.Println(s[i : n-i])\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\n\tvar (\n\t\tlo, i int32\n\t\torig, ans string\n\t)\n\n\tfmt.Scan(&lo)\n\tfmt.Scan(&orig)\n\tif lo < 4 {\n\t\tans = orig\n\t} else {\n\t\tif lo%2 > 0 {\n\t\t\tans = orig[0:3]\n\t\t\ti = 3\n\t\t} else {\n\t\t\tans = orig[0:2]\n\t\t\ti = 2\n\t\t}\n\t\tfor i < lo {\n\t\t\tans += \"-\"\n\t\t\tans += orig[i : i+2]\n\t\t\ti += 2\n\t\t}\n\t}\n\n\tfmt.Println(ans)\n}\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":362} {"difficulty":800,"lang":"Go","lang_cluster":"Go","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"WRONG_ANSWER","source_code":"package main\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar input, x int\n\tx=1\n\tfmt.Scan(&input)\n\tfor i:=1; iinput {\n\t\t\tfmt.Println(x%input)\n\t\t} else {\n\t\t\tfmt.Println(x)\n\t\t}\n\t}\n}","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"],"human_solution":"package main\n\nimport \"fmt\"\n\nfunc main() {\n var n int\n fmt.Scan(&n)\n pos, plus := 0, 1\n for i := 1; i < n; i++ {\n pos = (pos+plus)%n\n fmt.Print(pos+1)\n if i != (n-1) { fmt.Print(\" \") } else { fmt.Println() }\n plus++\n }\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":363} {"difficulty":1400,"lang":"Go","lang_cluster":"Go","src_uid":"77_A","execute_outcome":"WRONG_ANSWER","source_code":"package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"math\"\r\n)\r\n\r\nfunc main() {\r\n\tvar n int\r\n\tfmt.Scanf(\"%d\\n\", &n)\r\n\tvar a, b string\r\n\tlikes := map[string]map[string]int{}\r\n\tfor i := 0; i < n; i++ {\r\n\t\tfmt.Scanf(\"%s likes %s\\n\", &a, &b)\r\n\t\t_, ok := likes[a]\r\n\t\tif !ok {\r\n\t\t\tlikes[a] = map[string]int{}\r\n\t\t}\r\n\t\tlikes[a][b] = 1\r\n\t}\r\n\tvar n1, n2, n3 int\r\n\tfmt.Scanf(\"%d %d %d\\n\", &n1, &n2, &n3)\r\n\theroes := []string{\"Anka\", \"Chapay\", \"Cleo\", \"Troll\", \"Dracul\", \"Snowy\", \"Hexadecimal\"}\r\n\tans1, ans2 := math.MaxInt32, math.MinInt32\r\n\tg1, g2, g3 := 0, 0, 0\r\n\tfor i := 1; i <= 5; i++ {\r\n\t\tfor j := 1; j <= 5; j++ {\r\n\t\t\tif i+j >= 7 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tk := 7 - i - j\r\n\t\t\tt := calc(n1\/i, n2\/j, n3\/k)\r\n\t\t\tif t < ans1 {\r\n\t\t\t\tans1 = t\r\n\t\t\t\tg1, g2, g3 = i, j, k\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvar i, j, k uint\r\n\tvar t int\r\n\tfor i = 0; i < 128; i++ {\r\n\t\tif count(i) != g1 {\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\tfor j = 0; j < 128; j++ {\r\n\t\t\tif count(j) != g2 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tk = 127 - i - j\r\n\t\t\tif count(k) != g3 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tt = calc2(i, heroes, likes) + calc2(j, heroes, likes) + calc2(k, heroes, likes)\r\n\t\t\tif t > ans2 {\r\n\t\t\t\tans2 = t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfmt.Println(ans1, ans2)\r\n}\r\n\r\nfunc calc2(n uint, h []string, l map[string]map[string]int) int {\r\n\tans := 0\r\n\tq := []int{}\r\n\tfor i := 0; i < 7; i++ {\r\n\t\tif n&(1< c {\r\n\t\treturn a - c\r\n\t}\r\n\tif c > a {\r\n\t\treturn c - b\r\n\t}\r\n\treturn a - b\r\n}\r\n","description":"The year of 2012 is coming...According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us mere mortals from the effect of this terrible evil.The seven great heroes are: amazon Anka, barbarian Chapay, sorceress Cleo, druid Troll, necromancer Dracul, paladin Snowy and a professional hit girl Hexadecimal. Heroes already know how much experience will be given for each of the three megabosses: a for Mephisto, b for Diablo and c for Baal.Here's the problem: heroes are as much as seven and megabosses are only three! Then our heroes decided to split into three teams, where each team will go to destroy their own megaboss. Each team member will receive a of experience, rounded down, where x will be the amount of experience for the killed megaboss and y \u2014 the number of people in the team.Heroes do not want to hurt each other's feelings, so they want to split into teams so that the difference between the hero who received the maximum number of experience and the hero who received the minimum number of experience were minimal. Since there can be several divisions into teams, then you need to find the one in which the total amount of liking in teams were maximum.It is known that some heroes like others. But if hero p likes hero q, this does not mean that the hero q likes hero p. No hero likes himself.The total amount of liking in teams is the amount of ordered pairs (p,q), such that heroes p and q are in the same group, and hero p likes hero q (but it is not important if hero q likes hero p). In case of heroes p and q likes each other and they are in the same group, this pair should be counted twice, as (p,q) and (q,p).A team can consist even of a single hero, but it is important that every megaboss was destroyed. All heroes must be involved in the campaign against evil. None of the heroes can be in more than one team.It is guaranteed that every hero is able to destroy any megaboss alone.","input_specification":"The first line contains a single non-negative integer n (0\u2264n\u226442) \u2014 amount of liking between the heroes. Next n lines describe liking in the form \"p likes q\", meaning that the hero p likes the hero q (p \u2260 q). Every liking is described in the input exactly once, no hero likes himself.\nIn the last line are given three integers a, b and c (1\u2264a,b,c\u22642\u00b710^9), separated by spaces: the experience for Mephisto, the experience for Diablo and experience for Baal.\nIn all the pretests, except for examples from the statement, the following condition is satisfied: a=b=c.\n","output_specification":"Print two integers \u2014 the minimal difference in the experience between two heroes who will receive the maximum and minimum number of experience points, and the maximal total amount of liking in teams (the number of friendships between heroes that end up in one team).\nWhen calculating the second answer, the team division should satisfy the difference-minimizing contraint. I.e. primary you should minimize the difference in the experience and secondary you should maximize the total amount of liking.\n","notes":"A note to first example: it the first team should be Dracul, Troll and Anka, in the second one Hexadecimal and Snowy, and in the third Cleo \u0438 Chapay.\n","sample_inputs":["3\nTroll likes Dracul\nDracul likes Anka\nSnowy likes Hexadecimal\n210 200 180\n","2\nAnka likes Chapay\nChapay likes Anka\n10000 50 50\n"],"sample_outputs":["30 3\n","1950 2\n"],"human_solution":"package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"math\"\r\n)\r\n\r\nfunc main() {\r\n\tvar n int\r\n\tfmt.Scanf(\"%d\\n\", &n)\r\n\tvar a, b string\r\n\tlikes := map[string]map[string]int{}\r\n\tfor i := 0; i < n; i++ {\r\n\t\tfmt.Scanf(\"%s likes %s\\n\", &a, &b)\r\n\t\t_, ok := likes[a]\r\n\t\tif !ok {\r\n\t\t\tlikes[a] = map[string]int{}\r\n\t\t}\r\n\t\tlikes[a][b] = 1\r\n\t}\r\n\tvar n1, n2, n3 int\r\n\tfmt.Scanf(\"%d %d %d\\n\", &n1, &n2, &n3)\r\n\theroes := []string{\"Anka\", \"Chapay\", \"Cleo\", \"Troll\", \"Dracul\", \"Snowy\", \"Hexadecimal\"}\r\n\tans1, ans2 := math.MaxInt32, math.MinInt32\r\n\tg := make(map[int][]int)\r\n\tfor i := 1; i <= 5; i++ {\r\n\t\tfor j := 1; j <= 5; j++ {\r\n\t\t\tif i+j >= 7 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tk := 7 - i - j\r\n\t\t\tt := calc(n1\/i, n2\/j, n3\/k)\r\n\t\t\tif t <= ans1 {\r\n\t\t\t\tans1 = t\r\n\t\t\t\t_, ok := g[t]\r\n\t\t\t\tif !ok {\r\n\t\t\t\t\tg[t] = make([]int, 0)\r\n\t\t\t\t}\r\n\t\t\t\tg[t] = append(g[t], i, j, k)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvar i, j, k uint\r\n\tvar t int\r\n\tfor len(g[ans1]) != 0 {\r\n\t\tg1, g2, g3 := g[ans1][0], g[ans1][1], g[ans1][2]\r\n\t\tg[ans1] = g[ans1][3:]\r\n\t\tfor i = 0; i < 128; i++ {\r\n\t\t\tif count(i) != g1 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tfor j = 0; j < 128; j++ {\r\n\t\t\t\tif count(j) != g2 {\r\n\t\t\t\t\tcontinue\r\n\t\t\t\t}\r\n\t\t\t\tk = 127 - i - j\r\n\t\t\t\tif count(k) != g3 {\r\n\t\t\t\t\tcontinue\r\n\t\t\t\t}\r\n\t\t\t\tt = calc2(i, heroes, likes) + calc2(j, heroes, likes) + calc2(k, heroes, likes)\r\n\t\t\t\tif t > ans2 {\r\n\t\t\t\t\tans2 = t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfmt.Println(ans1, ans2)\r\n}\r\n\r\nfunc calc2(n uint, h []string, l map[string]map[string]int) int {\r\n\tans := 0\r\n\tq := []int{}\r\n\tfor i := 0; i < 7; i++ {\r\n\t\tif n&(1< c {\r\n\t\treturn a - c\r\n\t}\r\n\tif c > a {\r\n\t\treturn c - b\r\n\t}\r\n\treturn a - b\r\n}\r\n","testcases":"[{'input': ['3\\r\\nTroll likes Dracul\\r\\nDracul likes Anka\\r\\nSnowy likes Hexadecimal\\r\\n210 200 180\\r\\n'], 'output': ['30 3\\r\\n']}, {'input': ['2\\r\\nAnka likes Chapay\\r\\nChapay likes Anka\\r\\n10000 50 50\\r\\n'], 'output': ['1950 2\\r\\n']}, {'input': ['11\\r\\nSnowy likes Dracul\\r\\nAnka likes Dracul\\r\\nChapay likes Snowy\\r\\nHexadecimal likes Troll\\r\\nAnka likes Cleo\\r\\nChapay likes Dracul\\r\\nAnka likes Chapay\\r\\nSnowy likes Troll\\r\\nAnka likes Hexadecimal\\r\\nCleo likes Chapay\\r\\nTroll likes Cleo\\r\\n100 100 100\\r\\n'], 'output': ['17 5\\r\\n']}, {'input': ['14\\r\\nChapay likes Cleo\\r\\nCleo likes Anka\\r\\nDracul likes Snowy\\r\\nSnowy likes Cleo\\r\\nChapay likes Anka\\r\\nSnowy likes Anka\\r\\nChapay likes Troll\\r\\nTroll likes Anka\\r\\nAnka likes Snowy\\r\\nChapay likes Dracul\\r\\nDracul likes Anka\\r\\nHexadecimal likes Chapay\\r\\nSnowy likes Dracul\\r\\nCleo likes Dracul\\r\\n15 15 15\\r\\n'], 'output': ['2 6\\r\\n']}, {'input': ['4\\r\\nAnka likes Cleo\\r\\nSnowy likes Cleo\\r\\nAnka likes Hexadecimal\\r\\nCleo likes Snowy\\r\\n1 1 1\\r\\n'], 'output': ['0 3\\r\\n']}, {'input': ['8\\r\\nSnowy likes Anka\\r\\nHexadecimal likes Snowy\\r\\nTroll likes Dracul\\r\\nHexadecimal likes Troll\\r\\nSnowy likes Troll\\r\\nAnka likes Snowy\\r\\nSnowy likes Chapay\\r\\nAnka likes Chapay\\r\\n70 70 70\\r\\n'], 'output': ['12 5\\r\\n']}, {'input': ['0\\r\\n100 300 600\\r\\n'], 'output': ['50 0\\r\\n']}, {'input': ['3\\r\\nChapay likes Hexadecimal\\r\\nAnka likes Cleo\\r\\nTroll likes Snowy\\r\\n15 15000 90\\r\\n'], 'output': ['2985 2\\r\\n']}, {'input': ['0\\r\\n1 1 10000\\r\\n'], 'output': ['1999 0\\r\\n']}, {'input': ['13\\r\\nCleo likes Hexadecimal\\r\\nCleo likes Snowy\\r\\nHexadecimal likes Anka\\r\\nAnka likes Snowy\\r\\nTroll likes Snowy\\r\\nChapay likes Hexadecimal\\r\\nHexadecimal likes Snowy\\r\\nSnowy likes Chapay\\r\\nTroll likes Cleo\\r\\nAnka likes Hexadecimal\\r\\nHexadecimal likes Cleo\\r\\nChapay likes Dracul\\r\\nSnowy likes Dracul\\r\\n1000000000 2000000000 1000000000\\r\\n'], 'output': ['166666666 6\\r\\n']}, {'input': ['12\\r\\nCleo likes Hexadecimal\\r\\nChapay likes Anka\\r\\nHexadecimal likes Cleo\\r\\nAnka likes Snowy\\r\\nAnka likes Cleo\\r\\nDracul likes Snowy\\r\\nAnka likes Troll\\r\\nSnowy likes Anka\\r\\nCleo likes Anka\\r\\nHexadecimal likes Troll\\r\\nHexadecimal likes Chapay\\r\\nSnowy likes Troll\\r\\n1000000000 1 2000000000\\r\\n'], 'output': ['499999999 7\\r\\n']}, {'input': ['0\\r\\n2000000000 2000000000 2000000000\\r\\n'], 'output': ['333333334 0\\r\\n']}, {'input': ['2\\r\\nSnowy likes Hexadecimal\\r\\nTroll likes Dracul\\r\\n2000000000 2000000000 2000000000\\r\\n'], 'output': ['333333334 2\\r\\n']}, {'input': ['12\\r\\nSnowy likes Chapay\\r\\nCleo likes Dracul\\r\\nHexadecimal likes Snowy\\r\\nHexadecimal likes Anka\\r\\nDracul likes Chapay\\r\\nCleo likes Troll\\r\\nDracul likes Snowy\\r\\nSnowy likes Dracul\\r\\nTroll likes Chapay\\r\\nDracul likes Anka\\r\\nChapay likes Hexadecimal\\r\\nTroll likes Dracul\\r\\n436364663 856574374 347564737\\r\\n'], 'output': ['111742423 6\\r\\n']}, {'input': ['12\\r\\nAnka likes Dracul\\r\\nDracul likes Troll\\r\\nCleo likes Troll\\r\\nSnowy likes Hexadecimal\\r\\nHexadecimal likes Chapay\\r\\nCleo likes Dracul\\r\\nCleo likes Chapay\\r\\nHexadecimal likes Anka\\r\\nSnowy likes Cleo\\r\\nHexadecimal likes Snowy\\r\\nCleo likes Snowy\\r\\nChapay likes Snowy\\r\\n584329075 428752235 675234087\\r\\n'], 'output': ['77788420 6\\r\\n']}, {'input': ['8\\r\\nAnka likes Chapay\\r\\nDracul likes Snowy\\r\\nSnowy likes Cleo\\r\\nCleo likes Anka\\r\\nCleo likes Troll\\r\\nHexadecimal likes Troll\\r\\nTroll likes Cleo\\r\\nSnowy likes Dracul\\r\\n325432666 254352394 547360304\\r\\n'], 'output': ['55277237 6\\r\\n']}, {'input': ['18\\r\\nSnowy likes Troll\\r\\nChapay likes Hexadecimal\\r\\nCleo likes Snowy\\r\\nDracul likes Snowy\\r\\nSnowy likes Chapay\\r\\nTroll likes Cleo\\r\\nSnowy likes Anka\\r\\nDracul likes Hexadecimal\\r\\nHexadecimal likes Anka\\r\\nAnka likes Hexadecimal\\r\\nAnka likes Chapay\\r\\nTroll likes Anka\\r\\nAnka likes Snowy\\r\\nAnka likes Troll\\r\\nSnowy likes Cleo\\r\\nHexadecimal likes Troll\\r\\nHexadecimal likes Dracul\\r\\nCleo likes Anka\\r\\n20000 1000 20000\\r\\n'], 'output': ['5666 8\\r\\n']}, {'input': ['6\\r\\nChapay likes Troll\\r\\nTroll likes Cleo\\r\\nCleo likes Troll\\r\\nChapay likes Snowy\\r\\nAnka likes Snowy\\r\\nTroll likes Dracul\\r\\n987499608 272739716 133573597\\r\\n'], 'output': ['113301305 5\\r\\n']}, {'input': ['6\\r\\nAnka likes Troll\\r\\nTroll likes Chapay\\r\\nTroll likes Hexadecimal\\r\\nHexadecimal likes Cleo\\r\\nSnowy likes Hexadecimal\\r\\nChapay likes Troll\\r\\n740076959 230477703 987799796\\r\\n'], 'output': ['98788895 5\\r\\n']}, {'input': ['17\\r\\nCleo likes Dracul\\r\\nTroll likes Cleo\\r\\nAnka likes Chapay\\r\\nAnka likes Troll\\r\\nChapay likes Snowy\\r\\nTroll likes Snowy\\r\\nChapay likes Dracul\\r\\nHexadecimal likes Snowy\\r\\nDracul likes Snowy\\r\\nTroll likes Hexadecimal\\r\\nHexadecimal likes Anka\\r\\nCleo likes Snowy\\r\\nHexadecimal likes Dracul\\r\\nSnowy likes Chapay\\r\\nSnowy likes Hexadecimal\\r\\nSnowy likes Dracul\\r\\nDracul likes Troll\\r\\n112909524 619275170 403563648\\r\\n'], 'output': ['88872300 9\\r\\n']}, {'input': ['1\\r\\nHexadecimal likes Chapay\\r\\n848189141 631955593 79523012\\r\\n'], 'output': ['203206701 1\\r\\n']}, {'input': ['18\\r\\nAnka likes Troll\\r\\nDracul likes Chapay\\r\\nHexadecimal likes Dracul\\r\\nChapay likes Dracul\\r\\nAnka likes Hexadecimal\\r\\nSnowy likes Cleo\\r\\nDracul likes Anka\\r\\nSnowy likes Anka\\r\\nSnowy likes Hexadecimal\\r\\nDracul likes Troll\\r\\nDracul likes Snowy\\r\\nHexadecimal likes Anka\\r\\nChapay likes Hexadecimal\\r\\nSnowy likes Dracul\\r\\nCleo likes Snowy\\r\\nChapay likes Cleo\\r\\nAnka likes Dracul\\r\\nTroll likes Anka\\r\\n838821770 712931449 361810998\\r\\n'], 'output': ['124167182 8\\r\\n']}, {'input': ['18\\r\\nHexadecimal likes Chapay\\r\\nTroll likes Dracul\\r\\nTroll likes Snowy\\r\\nCleo likes Dracul\\r\\nChapay likes Snowy\\r\\nDracul likes Chapay\\r\\nCleo likes Snowy\\r\\nDracul likes Hexadecimal\\r\\nTroll likes Anka\\r\\nAnka likes Troll\\r\\nHexadecimal likes Dracul\\r\\nChapay likes Hexadecimal\\r\\nCleo likes Chapay\\r\\nAnka likes Hexadecimal\\r\\nSnowy likes Dracul\\r\\nChapay likes Troll\\r\\nAnka likes Snowy\\r\\nDracul likes Cleo\\r\\n240256138 922743697 38909902\\r\\n'], 'output': ['191776022 10\\r\\n']}, {'input': ['0\\r\\n477107314 230715335 261545417\\r\\n'], 'output': ['43678104 0\\r\\n']}, {'input': ['16\\r\\nChapay likes Snowy\\r\\nHexadecimal likes Anka\\r\\nChapay likes Troll\\r\\nDracul likes Cleo\\r\\nTroll likes Hexadecimal\\r\\nHexadecimal likes Dracul\\r\\nChapay likes Cleo\\r\\nSnowy likes Cleo\\r\\nSnowy likes Anka\\r\\nTroll likes Chapay\\r\\nSnowy likes Hexadecimal\\r\\nTroll likes Snowy\\r\\nCleo likes Hexadecimal\\r\\nAnka likes Snowy\\r\\nSnowy likes Chapay\\r\\nAnka likes Dracul\\r\\n843382501 58524777 503038818\\r\\n'], 'output': ['192994632 8\\r\\n']}, {'input': ['5\\r\\nTroll likes Chapay\\r\\nAnka likes Snowy\\r\\nAnka likes Dracul\\r\\nChapay likes Anka\\r\\nSnowy likes Troll\\r\\n709201888 431802832 597079932\\r\\n'], 'output': ['82638550 3\\r\\n']}, {'input': ['18\\r\\nCleo likes Snowy\\r\\nSnowy likes Hexadecimal\\r\\nCleo likes Hexadecimal\\r\\nTroll likes Dracul\\r\\nHexadecimal likes Snowy\\r\\nDracul likes Troll\\r\\nChapay likes Anka\\r\\nChapay likes Cleo\\r\\nTroll likes Chapay\\r\\nHexadecimal likes Chapay\\r\\nAnka likes Snowy\\r\\nTroll likes Snowy\\r\\nDracul likes Snowy\\r\\nDracul likes Chapay\\r\\nChapay likes Troll\\r\\nCleo likes Troll\\r\\nHexadecimal likes Cleo\\r\\nAnka likes Chapay\\r\\n864225278 509037060 402199775\\r\\n'], 'output': ['86975205 9\\r\\n']}, {'input': ['12\\r\\nCleo likes Hexadecimal\\r\\nTroll likes Cleo\\r\\nAnka likes Cleo\\r\\nHexadecimal likes Troll\\r\\nAnka likes Snowy\\r\\nHexadecimal likes Anka\\r\\nTroll likes Hexadecimal\\r\\nTroll likes Anka\\r\\nDracul likes Cleo\\r\\nCleo likes Troll\\r\\nDracul likes Troll\\r\\nChapay likes Anka\\r\\n762445890 377707484 324080158\\r\\n'], 'output': ['92108551 6\\r\\n']}, {'input': ['21\\r\\nChapay likes Dracul\\r\\nSnowy likes Chapay\\r\\nSnowy likes Troll\\r\\nCleo likes Chapay\\r\\nCleo likes Troll\\r\\nChapay likes Cleo\\r\\nSnowy likes Anka\\r\\nDracul likes Anka\\r\\nTroll likes Snowy\\r\\nSnowy likes Cleo\\r\\nChapay likes Hexadecimal\\r\\nCleo likes Anka\\r\\nCleo likes Snowy\\r\\nHexadecimal likes Cleo\\r\\nHexadecimal likes Snowy\\r\\nHexadecimal likes Anka\\r\\nHexadecimal likes Troll\\r\\nAnka likes Snowy\\r\\nDracul likes Troll\\r\\nChapay likes Anka\\r\\nSnowy likes Hexadecimal\\r\\n482557397 502108264 750230216\\r\\n'], 'output': ['9775434 8\\r\\n']}, {'input': ['6\\r\\nTroll likes Chapay\\r\\nHexadecimal likes Snowy\\r\\nCleo likes Dracul\\r\\nCleo likes Anka\\r\\nChapay likes Anka\\r\\nAnka likes Chapay\\r\\n758376921 432619768 578580897\\r\\n'], 'output': ['72980564 5\\r\\n']}, {'input': ['5\\r\\nChapay likes Cleo\\r\\nAnka likes Hexadecimal\\r\\nAnka likes Chapay\\r\\nCleo likes Troll\\r\\nAnka likes Cleo\\r\\n299076810 225593528 36830738\\r\\n'], 'output': ['62861532 3\\r\\n']}, {'input': ['13\\r\\nAnka likes Cleo\\r\\nCleo likes Troll\\r\\nChapay likes Cleo\\r\\nSnowy likes Troll\\r\\nChapay likes Anka\\r\\nChapay likes Snowy\\r\\nSnowy likes Chapay\\r\\nAnka likes Snowy\\r\\nSnowy likes Dracul\\r\\nCleo likes Hexadecimal\\r\\nDracul likes Chapay\\r\\nAnka likes Hexadecimal\\r\\nSnowy likes Cleo\\r\\n554338888 280967932 682619964\\r\\n'], 'output': ['96188303 7\\r\\n']}, {'input': ['17\\r\\nHexadecimal likes Chapay\\r\\nChapay likes Snowy\\r\\nChapay likes Troll\\r\\nAnka likes Hexadecimal\\r\\nCleo likes Troll\\r\\nSnowy likes Cleo\\r\\nCleo likes Anka\\r\\nCleo likes Hexadecimal\\r\\nAnka likes Snowy\\r\\nChapay likes Hexadecimal\\r\\nAnka likes Cleo\\r\\nDracul likes Snowy\\r\\nChapay likes Anka\\r\\nTroll likes Hexadecimal\\r\\nTroll likes Anka\\r\\nAnka likes Dracul\\r\\nHexadecimal likes Anka\\r\\n828886798 548024213 166661324\\r\\n'], 'output': ['107350782 9\\r\\n']}, {'input': ['2\\r\\nTroll likes Cleo\\r\\nAnka likes Cleo\\r\\n14344913 559182022 405430772\\r\\n'], 'output': ['172049094 2\\r\\n']}, {'input': ['22\\r\\nCleo likes Snowy\\r\\nCleo likes Troll\\r\\nChapay likes Dracul\\r\\nSnowy likes Troll\\r\\nDracul likes Chapay\\r\\nDracul likes Snowy\\r\\nChapay likes Cleo\\r\\nSnowy likes Chapay\\r\\nDracul likes Troll\\r\\nAnka likes Hexadecimal\\r\\nSnowy likes Anka\\r\\nHexadecimal likes Cleo\\r\\nHexadecimal likes Troll\\r\\nDracul likes Anka\\r\\nCleo likes Hexadecimal\\r\\nHexadecimal likes Dracul\\r\\nChapay likes Troll\\r\\nChapay likes Hexadecimal\\r\\nAnka likes Snowy\\r\\nTroll likes Hexadecimal\\r\\nSnowy likes Hexadecimal\\r\\nAnka likes Chapay\\r\\n458053183 602148195 994999698\\r\\n'], 'output': ['102639975 9\\r\\n']}, {'input': ['5\\r\\nTroll likes Dracul\\r\\nAnka likes Chapay\\r\\nCleo likes Anka\\r\\nChapay likes Cleo\\r\\nSnowy likes Hexadecimal\\r\\n222 400 400\\r\\n'], 'output': ['89 5\\r\\n']}, {'input': ['0\\r\\n2000000000 2000000000 1\\r\\n'], 'output': ['666666665 0\\r\\n']}, {'input': ['0\\r\\n1200000000 1200000000 1200000000\\r\\n'], 'output': ['200000000 0\\r\\n']}, {'input': ['0\\r\\n1 2000000000 2000000000\\r\\n'], 'output': ['666666665 0\\r\\n']}]","id":364} {"difficulty":1300,"lang":"Go","lang_cluster":"Go","src_uid":"782b819eb0bfc86d6f96f15ac09d5085","execute_outcome":"WRONG_ANSWER","source_code":"package main\nimport \"fmt\"\nimport \"math\"\n\nfunc main(){\n\tvar n,ans,i int64\n\tfmt.Scan(&n)\n\tx:=int64(math.Sqrt(math.Pow(4,float64(n))))\n\tfor i=1; i<=x;i++{ans+=i}\n\tfmt.Println(ans)\n}","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"],"human_solution":"\/\/ 185A\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tvar n, x, y, m int64\n\tin := bufio.NewReader(os.Stdin)\n\tout := bufio.NewWriter(os.Stdout)\n\tfmt.Fscan(in, &n)\n\ty, x, m = 1, 2, 1000000007\n\tfor n != 0 {\n\t\tif n%2 != 0 {\n\t\t\ty = (y * x) % m\n\t\t}\n\t\tx = (x * x) % m\n\t\tn = n \/ 2\n\t}\n\tfmt.Fprint(out, ((y*y+y)\/2)%m)\n\tout.Flush()\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":365} {"difficulty":1500,"lang":"Go","lang_cluster":"Go","src_uid":"88_B","execute_outcome":"WRONG_ANSWER","source_code":"package main\r\n\r\nimport (\r\n \"fmt\"\r\n \"math\"\r\n \"unicode\"\r\n)\r\n\r\ntype Key struct {\r\n x,y float64\r\n}\r\ntype Keyboard struct {\r\n m map[rune][]Key\r\n}\r\n\r\nfunc main() {\r\n hand := 0\r\n keyboard := Keyboard{}\r\n keyboard.m = make(map[rune][]Key)\r\n var m,n int\r\n var x float64\r\n var no_sense string\r\n fmt.Scanf(\"%d %d %f\", &m,&n,&x)\r\n fmt.Scanf(\"%s\", &no_sense)\r\n for i := 0; i < m; i++ {\r\n var keys string\r\n fmt.Scanf(\"%s\", &keys)\r\n fmt.Scanf(\"%s\", &no_sense)\r\n for pos,char:= range keys{\r\n keyboard.m[char] = append(keyboard.m[char],Key{float64(i)+0.5,float64(pos)+0.5,})\r\n }\r\n }\r\n var e,text string\r\n fmt.Scanf(\"%s\", &e)\r\n fmt.Scanf(\"%s\", &no_sense)\r\n fmt.Scanf(\"%s\", &text)\r\n s_key := 'S'\r\n for _,char:= range text{\r\n v1, e1 := keyboard.m[unicode.ToLower(char)]\r\n if !e1{\r\n hand = -1\r\n break\r\n }\r\n if unicode.IsUpper(char) {\r\n one_hand := false\r\n v2, e2 := keyboard.m[s_key]\r\n if !e2{\r\n hand = -1\r\n break\r\n }\r\n for _,k1:= range v2{\r\n for _,k2:= range v1{\r\n if keyboard.e_distance(k1, k2) <= x*x{\r\n one_hand = true\r\n break\r\n }\r\n }\r\n }\r\n if !one_hand {\r\n hand++\r\n }\r\n }\r\n }\r\n fmt.Println(hand)\r\n}\r\n \r\nfunc (Keyboard) e_distance(k1 Key, k2 Key) float64{\r\n return math.Pow(k1.x - k2.x, 2) + math.Pow(k1.y - k2.y, 2)\r\n}","description":"Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys work like the \"Shift\" key on standard keyboards, that is, they make lowercase letters uppercase.Vasya can press one or two keys with one hand. However, he can only press two keys if the Euclidean distance between the centers of the keys does not exceed x. The keys are considered as squares with a side equal to 1. There are no empty spaces between neighbouring keys.Vasya is a very lazy boy, that's why he tries to type with one hand as he eats chips with his other one. However, it is possible that some symbol can't be typed with one hand only, because the distance between it and the closest \"Shift\" key is strictly larger than x. In this case he will have to use his other hand. Having typed the symbol, Vasya returns other hand back to the chips.You are given Vasya's keyboard and the text. Count the minimum number of times Vasya will have to use the other hand.","input_specification":"The first line contains three integers n, m, x (1\u2264n,m\u226430,1\u2264x\u226450).\nNext n lines contain descriptions of all the keyboard keys. Each line contains the descriptions of exactly m keys, without spaces. The letter keys are marked with the corresponding lowercase letters. The \"Shift\" keys are marked with the \"S\" symbol. \nThen follow the length of the text q (1\u2264q\u22645\u00b710^5). The last line contains the text T, which consists of q symbols, which are uppercase and lowercase Latin letters.\n","output_specification":"If Vasya can type the text, then print the minimum number of times he will have to use his other hand. Otherwise, print \"-1\" (without the quotes).\n","notes":"In the first sample the symbol \"A\" is impossible to print as there's no \"Shift\" key on the keyboard.\nIn the second sample the symbol \"e\" is impossible to print as there's no such key on the keyboard.\nIn the fourth sample the symbols \"T\", \"G\" are impossible to print with one hand. The other letters that are on the keyboard can be printed. Those symbols come up in the text twice, thus, the answer is 2.\n","sample_inputs":["2 2 1\nab\ncd\n1\nA\n","2 2 1\nab\ncd\n1\ne\n","2 2 1\nab\ncS\n5\nabcBA\n","3 9 4\nqwertyuio\nasdfghjkl\nSzxcvbnmS\n35\nTheQuIcKbRoWnFOXjummsovertHeLazYDOG\n"],"sample_outputs":["-1\n","-1\n","1\n","2\n"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strings\"\n \"strconv\"\n \"fmt\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\ntype Key struct {\n R, C int\n Ch rune\n}\n\nfunc main() {\n reader := bufio.NewReader(os.Stdin)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n var n, m, x int\n line, _ := reader.ReadString('\\n')\n fmt.Sscanf(line, \"%d %d %d\", &n, &m, &x)\n keys := []Key{}\n for r := 0; r < n; r++ {\n line, _ := reader.ReadString('\\n')\n s := strings.TrimSpace(line)\n for c, ch := range s {\n keys = append(keys, Key{ r, c, ch })\n }\n }\n cost := map[rune]int{}\n for i := 0; i < len(keys); i++ {\n a := keys[i]\n if a.Ch != 'S' {\n cost[a.Ch] = 1\n continue\n }\n for j := 0; j < len(keys); j++ {\n b := keys[j]\n if b.Ch != 'S' {\n ch := b.Ch - 'a' + 'A'\n if cost[ch] == 1 {\n continue\n }\n cost[ch] = 2\n d2 := (a.R - b.R)*(a.R - b.R) + (a.C - b.C)*(a.C - b.C)\n if d2 <= x*x {\n cost[ch] = 1\n }\n }\n }\n }\n reader.ReadString('\\n')\n line, _ = reader.ReadString('\\n')\n s := strings.TrimSpace(line)\n result := 0\n for _, ch := range s {\n c, found := cost[ch]\n if !found {\n writer.WriteString(\"-1\\n\")\n return\n }\n result += c-1\n }\n writer.WriteString(fmt.Sprintf(\"%d\\n\", result))\n}\n","testcases":"[{'input': ['2 2 1\\r\\nab\\r\\ncd\\r\\n1\\r\\nA\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 2 1\\r\\nab\\r\\ncd\\r\\n1\\r\\ne\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 2 1\\r\\nab\\r\\ncS\\r\\n5\\r\\nabcBA\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 9 4\\r\\nqwertyuio\\r\\nasdfghjkl\\r\\nSzxcvbnmS\\r\\n35\\r\\nTheQuIcKbRoWnFOXjummsovertHeLazYDOG\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 9 3\\r\\noboxlgpey\\r\\nyxcuwkkmp\\r\\njuqeflhwq\\r\\nsfnxqtjqS\\r\\nkkudcnyjl\\r\\nhgjlcrkjq\\r\\njnofqksxn\\r\\nqbhsnuguv\\r\\nlvahnifao\\r\\nebwnnlrwe\\r\\n35\\r\\nCodeforcesBetaRoundproblemAtestfive\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2 7 4\\r\\niuqtieo\\r\\nysxcgmS\\r\\n2\\r\\nsQ\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 2 4\\r\\nbS\\r\\n8\\r\\nbBbbbBbb\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 8 5\\r\\nfqiubjpm\\r\\nqbshcsyk\\r\\ncjbxpbef\\r\\nptwpmapx\\r\\nryazscbm\\r\\nqnvsgzrf\\r\\nhtardzkz\\r\\n9\\r\\nuxrmwkayy\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8 6 4\\r\\nefvmov\\r\\nkeofnw\\r\\npwajpe\\r\\nknptky\\r\\nSibruu\\r\\nrgdukk\\r\\nbsxosd\\r\\nhovgSe\\r\\n10\\r\\nECreruXmsC\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 3 2\\r\\nukk\\r\\neqt\\r\\nfex\\r\\nqSh\\r\\ntvz\\r\\nfjn\\r\\niol\\r\\nehd\\r\\nnte\\r\\ngyx\\r\\n5\\r\\ncgQxI\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 10 19\\r\\nowqjcaSpqn\\r\\nvgrhboqahn\\r\\nbzziocjmbu\\r\\npurqsmiSop\\r\\nxcsifctjhy\\r\\nycyytwoamk\\r\\nrnjfxsxowl\\r\\nnkgcywcdff\\r\\nbazljrisqv\\r\\nkcakigSekq\\r\\n100\\r\\nzewpATtssQVicNrlRrcoifTutTAfFMUEfDFKoNyQbSrSYxTGMadNkRpmJvoEqUsqPYgAdQreaUrwDKMNFWiwdRRCcJBPorfMVMoK\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10 26\\r\\nwxmssptheb\\r\\nzpxbxsyxsy\\r\\nqbjkpaywqp\\r\\nfwhnuzjcgq\\r\\nycgaanzedz\\r\\njrycrbzqfs\\r\\ngswwakybus\\r\\nfhtxhljedz\\r\\noSepmyjosv\\r\\ndwviycevdn\\r\\n100\\r\\nyapwUfnyPzgZyFvAHGKWVbXQHkuhJDoUTvCAtdMMCQmKchxKkilUTECOqYJFUSHPqKiRKhDXZgHxwApDWlShdwakmVCgaeKCLOMX\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10 3\\r\\nrvouufmnqu\\r\\nbyukrnmnhr\\r\\nzjggwxgvkz\\r\\ntcagkSitiw\\r\\nhryajgtpwc\\r\\njragfhqoks\\r\\nkgroxxkuvp\\r\\nbpgrkqiyns\\r\\njbuhjjkziw\\r\\nomjmbaggsw\\r\\n100\\r\\nCpRzrPqPngYvrVJFCWRPMRwrpXcbtiwfoFcAkRaNjzpMMKOQAzBxSrxGbIHaYgmSqhhxhZTmhFttKnhFzRfKxYXshUZRvtKJIzZq\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['10 10 2\\r\\nfriuxvShvg\\r\\nerslojqtgu\\r\\nzeqsmdewry\\r\\nwvhbeeyeSu\\r\\ngkofbjaavr\\r\\ntwkcdxugps\\r\\nnzlylSmafu\\r\\nstamkpxnzt\\r\\nuwxwximkrm\\r\\nmzxyboazbl\\r\\n100\\r\\nmRIfAtrLKmztpVkAmojDCiIgseBwlUilBIixDQhqNhNAqVLLIobuCIretLdSvixNNdCiouFMXtwHZFlObCeaygmIiFBfaCirbmCa\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['10 10 2\\r\\nbddahSqkmk\\r\\npxbocxayjs\\r\\nottvdazstk\\r\\nlaxuidqlqb\\r\\nkfjwdpdfat\\r\\nxlipuubkgv\\r\\niqyomzfktm\\r\\niwbgidmwyu\\r\\nrngqkeupsf\\r\\nbqndtekryw\\r\\n100\\r\\nMNQgWFLhHycqwjSsbTkbgMYAIHFYARRmOsinYMFjOxxnLjiKfeiBbMpoeTdzUMORPaAxRNfvdAPFaKkPdxdAjjJgGCxkDzmSasqq\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['10 10 2\\r\\nnxcwdrsmrv\\r\\nSyjahsosvp\\r\\nvkrqbxhgbv\\r\\nwkxywavtnn\\r\\nepkyoviqbi\\r\\nsfmpvhuwwq\\r\\nnlsostrotx\\r\\ntcdguorhny\\r\\nimixrqzSdu\\r\\nxzhdhdwibt\\r\\n100\\r\\nUzzaWiRFYbAqxIDMrRBBDoGQhSzSqSLEddAiJsZcxbemdeuddamNYdWOvzlYSCuHIRpnuxdNxAsnZMiLXBYwnrMcrbNeLrUYhZOB\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['10 10 23\\r\\nhtyvouoiqi\\r\\nvySvsfqadv\\r\\nxvqyqjyutq\\r\\npjcrrphzbk\\r\\nhlqfyoqfmo\\r\\nezcSwleoew\\r\\nxkwqrajxyg\\r\\nngSiftgoso\\r\\njyndgicccr\\r\\nlgjvokydhp\\r\\n100\\r\\nJzVVfotldIRcyjhTNRcFlTxFeZKRwavZxYcvdDOQyUvTmryFRuRBcRvmscegtspkPuchqlFEKbrfpTOSlSFOARsbbvSenMwNmaRj\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10 7\\r\\nifcwalsdbj\\r\\njpykymrbei\\r\\nrylzgkyefh\\r\\noilvvexpjp\\r\\niptgodpfim\\r\\ndSrqejaixu\\r\\npksxlsniwa\\r\\nmoSenxtfbc\\r\\noqssptcenz\\r\\nqdhmouvyas\\r\\n100\\r\\nqtMDVUXJpSEFgPsLKyRJVRbfVoYaCKJDnQDLFVngVjSPzzVyMnMyuyahMRiBJuNhKtgpVqvukUolLvYEmidvXotgQUJukYwIweUW\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10 1\\r\\nmdxafehbkr\\r\\nyuhenybjps\\r\\ntvfwmiwcoh\\r\\njmzrepzjvx\\r\\nnqyorkSnuk\\r\\ntSmztmwidv\\r\\ncmmajnlqrw\\r\\nfiqewpdwax\\r\\nuesmkdcplt\\r\\nlgkomdcqbo\\r\\n100\\r\\nmcEQmAvFqKYMXLHQUDeIulkmAMRkIUtbKihTFJwJYQfcAelNrZWSAwHunwZTrdHaRWokgCyLqbubOpEHuZiDVoFHjvkMSoBPyGOI\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['10 10 2\\r\\nnhfafdwqhh\\r\\neyvitpcthk\\r\\nrpiotuoqzh\\r\\nnxxnhuaxee\\r\\nyevrtirzwf\\r\\nkbtSsamyel\\r\\nfeenjvxsmo\\r\\nkqpenxjmde\\r\\nlqsamthlwp\\r\\njdyyqsbtbk\\r\\n100\\r\\nUHucxPWDaKonVpXEctuqYUAQnrFEZaTYxhoacNbHIMevlbDejXjitEzyVrTfcfBHWRMdJvaTkbkqccyHjtzpTbKmRAXwlXCtFKNX\\r\\n'], 'output': ['29\\r\\n']}, {'input': ['10 10 1\\r\\nsufnxxpdnx\\r\\nvttibpllhv\\r\\nlvbrjmfdjx\\r\\ngmtexvrnfh\\r\\nygsqrsSwxd\\r\\nkxbbjxgbzs\\r\\nedutwocmzd\\r\\nfebjgknyai\\r\\nvcvquagvrs\\r\\ndrdoarhgoc\\r\\n100\\r\\nZoZJXhUWyaLgBTpgbznABKHuyFcKzJmGaMhoKkKfyOGacLwBspaKtAEdwMZJFYiZUFNDxdDIDgKSCRvsbGUOXRqalbpuEqkduYpW\\r\\n'], 'output': ['44\\r\\n']}, {'input': ['10 10 2\\r\\ncstcrltzsl\\r\\nblotmquzvj\\r\\nuiitiytlgx\\r\\nwumpfdaprd\\r\\ntfxohqpztn\\r\\nvfrpsccddo\\r\\nneegusrkxw\\r\\niijfjozqjq\\r\\nioegbvuhew\\r\\npjjpqdxvqu\\r\\n100\\r\\nkPCBONfZLkeXzWVuSgvinPENazcnRoBcUHXwRzPyvNIiDlDSeKOYmiUmjooXuzTCtIRxKDAYeTLgjsenxHoymVazMALUADQpjVjV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 10 1\\r\\nqztnjglyrc\\r\\nnukswgzajl\\r\\nqnpbdwjvbb\\r\\nliiakzcrlz\\r\\nnolwfzzvxd\\r\\nmqvhiySttx\\r\\nqwuizSjuto\\r\\nqbgwiwjukx\\r\\nkomyvblgkc\\r\\ntkzlxzgsru\\r\\n100\\r\\nYUzTZDzLFkMUhjQWbwljJCRyZGFzgJcozvROiwPktRGxkMKiPyiTvhDrtusPYhMgVAOFIjAvlpzcrUvrMrMbhkpUiyAytKfYOGTF\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['10 10 1\\r\\nmgziiihbkq\\r\\niobjknuogh\\r\\nvntwahSopu\\r\\nsjsxjpaqvm\\r\\nwqgrodizst\\r\\nselzugktoi\\r\\nvbhfzvgjfn\\r\\nliqlfdcjhf\\r\\nbpbtpmimxb\\r\\npksfiydpfw\\r\\n100\\r\\nwAVZXEhKTuajdCauVTIwgnfbxWuUSmtXkjHZtNVcfTsiSAPLdpdEFdTJLZRjptUcRhAmrNjKMXmuDGatAQoaIpbddnzRGHsJrhoq\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['10 10 2\\r\\nshbqxycvfm\\r\\notydudkttw\\r\\nqhatsxsngz\\r\\nixvyujtyjc\\r\\nsbvqhnjbak\\r\\neggcguuuka\\r\\nxcydfgjzeb\\r\\nytpdkcdrsq\\r\\nefqlpywggu\\r\\nfcnfrhnouo\\r\\n100\\r\\nHPqtuVckdUOhsnuhnbpekWvWKUnAEaOCihpeEvmaOKOPcIZiMixGJGEuXAaOxuUNyrIesmldLEqGnvyDKPDvFkCbRebCORHmUgeV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 50\\r\\nS\\r\\n29\\r\\nargjhoaiogjiSjqfhjksdvjkSvcvn\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 50\\r\\nS\\r\\n1\\r\\nS\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 50\\r\\na\\r\\n29\\r\\nargjhoaiogjiSjqfhjksdvjkSvcvn\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 50\\r\\nz\\r\\n29\\r\\nargjhoaiogjiSjqfhjksdvjkSvcvn\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 1 2\\r\\nS\\r\\nc\\r\\n4\\r\\nCSSA\\r\\n'], 'output': ['-1\\r\\n']}]","id":366} {"difficulty":1300,"lang":"Go","lang_cluster":"Go","src_uid":"92_B","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ 92B\r\npackage main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t\"fmt\"\r\n\t\"os\"\r\n)\r\n\r\nfunc main() {\r\n\tvar s string\r\n\tin := bufio.NewReader(os.Stdin)\r\n\tfmt.Fscan(in, &s)\r\n\tvar a, b, c int\r\n\tfor i := 1; i < len(s); i++ {\r\n\t\tif s[i] == 1 {\r\n\t\t\ta = i\r\n\t\t\tb = c\r\n\t\t} else {\r\n\t\t\tc++\r\n\t\t\tif a > 0 {\r\n\t\t\t\tb += a*2 - 1\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfmt.Println(b + c)\r\n}\r\n","description":"Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations.Fangy takes some positive integer x and wants to get a number one from it. While x is not equal to 1, Fangy repeats the following action: if x is odd, then he adds 1 to it, otherwise he divides x by 2. Fangy knows that for any positive integer number the process ends in finite time.How many actions should Fangy perform to get a number one from number x?","input_specification":"The first line contains a positive integer x in a binary system. It is guaranteed that the first digit of x is different from a zero and the number of its digits does not exceed 10^6.\n","output_specification":"Print the required number of actions.\n","notes":"Let's consider the third sample. Number 101110 is even, which means that we should divide it by 2. After the dividing Fangy gets an odd number 10111 and adds one to it. Number 11000 can be divided by 2 three times in a row and get number 11. All that's left is to increase the number by one (we get 100), and then divide it by 2 two times in a row. As a result, we get 1.\n","sample_inputs":["1\n","1001001\n","101110\n"],"sample_outputs":["0\n","12\n","8\n"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strconv\"\n \"strings\"\n \"fmt\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\nfunc main() {\n reader := bufio.NewReader(os.Stdin)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n line, _ := reader.ReadString('\\n')\n s := strings.TrimSpace(line)\n count := len(s)-1\n for i := len(s)-1; i > 0; i-- {\n if s[i] == '1' {\n count += 2;\n for seek := i-1; seek > 0; seek-- {\n if s[seek] == '0' {\n count++\n }\n }\n break\n }\n }\n writer.WriteString(fmt.Sprintf(\"%d\\n\", count))\n}\n","testcases":"[{'input': ['1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1001001\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['101110\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['11110001101\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1010101001001111000111110011111000010101011111101010\\r\\n'], 'output': ['74\\r\\n']}, {'input': ['1100000010010100111011100011110101111\\r\\n'], 'output': ['55\\r\\n']}, {'input': ['11000111111110110110100110110101111100010100110110010\\r\\n'], 'output': ['74\\r\\n']}, {'input': ['11100000110100011110101001101111100000011001111000011110000000111110111\\r\\n'], 'output': ['106\\r\\n']}, {'input': ['1000101100110000000001111010110000000010001001111110011011000011101011001001010010111\\r\\n'], 'output': ['133\\r\\n']}, {'input': ['1000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['72\\r\\n']}, {'input': ['10000100000\\r\\n'], 'output': ['16\\r\\n']}]","id":367} {"difficulty":1100,"lang":"Go","lang_cluster":"Go","src_uid":"9c90974a0bb860a5e180760042fd5045","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\nconst MAX_NM = 100\nconst MAX_CHAR = int('z')\n\nfunc main() {\n\treader := NewStdReader(os.Stdin)\n\n\tn, m := reader.ReadInt(), reader.ReadInt()\n\n\tcountRow := [MAX_NM][MAX_CHAR]byte{}\n\tcountCol := [MAX_NM][MAX_CHAR]byte{}\n\n\ttable := [MAX_NM][MAX_NM]byte{}\n\n\tfor i := 0; i < n; i++ {\n\t\tfor j := 0; j < m; j++ {\n\t\t\tc := reader.ReadChar()\n\t\t\ttable[i][j] = c\n\t\t\tcountRow[i][c]++\n\t\t\tcountCol[j][c]++\n\t\t}\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tfor j := 0; j < m; j++ {\n\t\t\tc := table[i][j]\n\n\t\t\tif countRow[i][c] == 1 && countCol[j][c] == 1 {\n\t\t\t\tfmt.Print(string(c))\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype StdReader struct {\n\tbuf *bufio.Reader\n}\n\nfunc NewStdReader(reader io.Reader) *StdReader {\n\treturn &StdReader{bufio.NewReaderSize(reader, 20*1024*1024)}\n}\n\nfunc (std *StdReader) ReadInt() int {\n\n\tr := 0\n\tsign := 1\n\tok := false\n\n\tfor {\n\t\tb, e := std.buf.ReadByte()\n\n\t\tif e != nil {\n\t\t\tbreak\n\t\t}\n\t\tif b >= '0' && b <= '9' {\n\t\t\tr = r*10 + int(b-'0')\n\t\t\tok = true\n\t\t} else {\n\t\t\tif ok {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tif b == '-' {\n\t\t\t\t\tsign = -sign\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn sign * r\n}\n\nfunc (std *StdReader) ReadChar() byte {\n\tfor {\n\t\tb, e := std.buf.ReadByte()\n\n\t\tif e != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif b >= 'a' && b <= 'z' {\n\t\t\treturn b\n\t\t}\n\t}\n\n\treturn 0\n}\n","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"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strconv\"\n \"fmt\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\nfunc main() {\n scanner = bufio.NewScanner(os.Stdin)\n scanner.Split(bufio.ScanWords)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n n, m := getI(), getI()\n mark := make([][]bool, n)\n rows := make([]string, n)\n for r := range rows {\n rows[r] = getS()\n mark[r] = make([]bool, m)\n }\n for r := range rows {\n seen := map[byte]int{}\n for c := 0; c < m; c++ {\n ch := rows[r][c]\n if seen[ch] != 0 {\n mark[r][seen[ch]-1] = true\n mark[r][c] = true\n } else {\n seen[ch] = c+1\n }\n }\n }\n for c := 0; c < m; c++ {\n seen := map[byte]int{}\n for r := range rows {\n ch := rows[r][c]\n if seen[ch] != 0 {\n mark[seen[ch]-1][c] = true\n mark[r][c] = true\n } else {\n seen[ch] = r+1\n }\n }\n }\n chars := []byte{}\n for r := range rows {\n for c := 0; c < m; c++ {\n if !mark[r][c] {\n chars = append(chars, rows[r][c])\n }\n }\n }\n writer.WriteString(fmt.Sprintf(\"%s\\n\", string(chars)))\n}\n","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":368} {"difficulty":1400,"lang":"Go","lang_cluster":"Go","src_uid":"a37df9b239a40473516d1525d56a0da7","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n)\n\nvar (\n\tin = bufio.NewScanner(os.Stdin)\n\tout = bufio.NewWriter(os.Stdout)\n)\n\nvar (\n\tMOD = 1000000007\n)\n\nvar (\n\tn, m int\n\ta [100][30]int\n\ts [100]string\n)\n\nfunc main() {\n\tdefer out.Flush()\n\tin.Split(bufio.ScanWords)\n\n\tfmt.Scan(&n, &m)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Scan(&s[i])\n\t}\n\n\tfor i := 0; i < n; i++ {\n\t\tfor j := 0; j < len(s[i]); j++ {\n\t\t\ta[j][s[i][j]-65] = 1\n\t\t}\n\n\t}\n\n\tans := 1\n\tfor i := 0; i < m; i++ {\n\t\tcnt := 0\n\t\tfor j := 0; j < 26; j++ {\n\t\t\tcnt = cnt + a[i][j]\n\n\t\t}\n\t\t\/\/writeln(cnt)\n\t\tans = (ans * cnt) % MOD\n\t}\n\n\twriteln(ans)\n\n}\n\nfunc read(num ...*int) {\n\tfor _, value := range num {\n\t\tin.Scan()\n\t\t*value, _ = strconv.Atoi(in.Text())\n\t}\n}\n\nfunc writeln(num ...int) {\n\tfor _, value := range num {\n\t\tstr := strconv.Itoa(value)\n\t\tout.WriteString(str)\n\t}\n\tout.WriteString(\"\\n\")\n}\n","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"],"human_solution":"package main\nimport \"fmt\"\n\nfunc main(){\n\tvar n,m,i,u,count,ans int64\n\tfmt.Scan(&n,&m)\n\ts:=make([]string,n)\n\tfor i=0; i= len(l.s) {\n\t\treturn false, errOutOfRange\n\t}\n\tc := l.s[l.i]\n\tl.i++\n\treturn c == '0', nil\n}\n\nfunc mergeSort(a []int, l *log) error {\n\tif len(a) == 1 {\n\t\treturn nil\n\t}\n\n\terr := mergeSort(a[:len(a)\/2], l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = mergeSort(a[len(a)\/2:], l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb := make([]int, 0, len(a))\n\ti, j := 0, len(a)\/2\n\n\tfor i < len(a) \/ 2 && j < len(a) {\n\t\tleft, err := l.left()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif left {\n\t\t\tb = append(b, a[i])\n\t\t\ti++\n\t\t} else {\n\t\t\tb = append(b, a[j])\n\t\t\tj++\n\t\t}\n\t}\n\n\tfor i < len(a) \/ 2 {\n\t\tb = append(b, a[i])\n\t\ti++\n\t}\n\n\tfor j < len(a) {\n\t\tb = append(b, a[j])\n\t\tj++\n\t}\n\n\tfor i := range b {\n\t\ta[i] = b[i]\n\t}\n\treturn nil\n}\n\nfunc main() {\n\tio := NewIO(os.Stdin, os.Stdout)\n\ts := io.ReadString()\n\n\taa := make([]int, 0)\n\n\tfor i := 0; i < 1000; i++ {\n\t\taa = append(aa, i)\n\n\t\ta := make([]int, len(aa))\n\t\tcopy(a, aa)\n\n\t\tl := log{s, 0}\n\t\terr := mergeSort(a, &l)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, err = l.left(); err != nil {\n\t\t\tb := make([]int, len(a))\n\n\t\t\tfor i, v := range a {\n\t\t\t\tb[v] = i + 1\n\t\t\t}\n\n\t\t\tfmt.Println(len(a))\n\t\t\tfor _, v := range b {\n\t\t\t\tfmt.Printf(\"%d \", v)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","description":"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Python: def sort(a): n = len(a) b = [0 for i in range(n)] log = [] def mergeSort(l, r): if r - l <;= 1: return m = (l + r) >> 1 mergeSort(l, m) mergeSort(m, r) i, j, k = l, m, l while i <; m and j <; r: if a[i] <; a[j]: log.append('0') b[k] = a[i] i += 1 else: log.append('1') b[k] = a[j] j += 1 k += 1 while i <; m: b[k] = a[i] i += 1 k += 1 while j <; r: b[k] = a[j] j += 1 k += 1 for p in range(l, r): a[p] = b[p] mergeSort(0, n) return \"\".join(log)\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.\u0421\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0412\u0430\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 $$$a$$$ (\u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 $$$n$$$ \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 $$$1$$$ \u0434\u043e $$$n$$$), \u0434\u0430\u043b \u0435\u0451 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sort \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$ \u0412\u0430\u0441\u044f \u043d\u0430\u0448\u0451\u043b, \u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 $$$a$$$ \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0430\u0441\u044c. \u0412\u0430\u0441\u044f \u0445\u043e\u0447\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 $$$a$$$ \u0442\u0430\u043a\u0443\u044e, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sort \u043e\u0442 \u043d\u0435\u0451 \u0434\u0430\u0441\u0442 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$. \u041f\u043e\u043c\u043e\u0433\u0438\u0442\u0435 \u0435\u043c\u0443!","input_specification":"\u0412\u0432\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 0 \u0438 1. \u0412 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u043b\u0438\u043d\u044b $$$16$$$, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0430\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0432\u0430\u0448 \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u043b\u0438\u043d\u0443, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043e\u0442 $$$16$$$.","output_specification":"\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $$$n$$$\u00a0\u2014 \u0434\u043b\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 $$$n$$$ \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b $$$a_0, a_1, \\ldots, a_{n-1}$$$ ($$$1 \\le a_i \\le n$$$)\u00a0\u2014 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430, \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445.","notes":null,"sample_inputs":["00000000000000000000000000000000","11111111111111111111111111111111","101011010001100100011011001111011000011110010"],"sample_outputs":["16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16","16\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1","16\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\ntype IO struct {\n\tin io.Reader\n\tout io.Writer\n}\n\nfunc NewIO(in io.Reader, out io.Writer) *IO {\n\treturn &IO{in: bufio.NewReader(in), out: bufio.NewWriter(out)}\n}\n\nfunc (io *IO) ReadInt64() int64 {\n\tvar res int64\n\tfmt.Fscanf(io.in, \"%d\\n\", &res)\n\treturn res\n}\n\nfunc (io *IO) ReadInt() int {\n\tvar res int\n\tfmt.Fscanf(io.in, \"%d\\n\", &res)\n\treturn res\n}\n\nfunc (io *IO) ReadPairInt64() (int64, int64) {\n\tvar a, b int64\n\tfmt.Fscanf(io.in, \"%d %d\\n\", &a, &b)\n\treturn a, b\n}\n\nfunc (io *IO) ReadPairInt() (int, int) {\n\tvar a, b int\n\tfmt.Fscanf(io.in, \"%d %d\\n\", &a, &b)\n\treturn a, b\n}\n\nfunc (io *IO) ReadString() string {\n\tvar res string\n\tfmt.Fscanf(io.in, \"%s\\n\", &res)\n\treturn res\n}\n\nfunc (io *IO) ReadIntSlice(n int) []int64 {\n\tvar t int64\n\tres := make([]int64, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscanf(io.in, \"%d\", &t)\n\t\tres = append(res, t)\n\t}\n\tfmt.Fscanf(io.in, \"\\n\")\n\treturn res\n}\n\ntype log struct {\n\ts string\n\ti int\n}\n\nvar errOutOfRange = errors.New(\"out of range\")\n\nfunc (l *log) left() (bool, error) {\n\tif l.i >= len(l.s) {\n\t\treturn false, errOutOfRange\n\t}\n\tc := l.s[l.i]\n\tl.i++\n\treturn c == '0', nil\n}\n\nfunc mergeSort(a []int, l *log) error {\n\tif len(a) == 1 {\n\t\treturn nil\n\t}\n\n\terr := mergeSort(a[:len(a)\/2], l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = mergeSort(a[len(a)\/2:], l)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb := make([]int, 0, len(a))\n\ti, j := 0, len(a)\/2\n\n\tfor i < len(a)\/2 && j < len(a) {\n\t\tleft, err := l.left()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif left {\n\t\t\tb = append(b, a[i])\n\t\t\ti++\n\t\t} else {\n\t\t\tb = append(b, a[j])\n\t\t\tj++\n\t\t}\n\t}\n\n\tfor i < len(a)\/2 {\n\t\tb = append(b, a[i])\n\t\ti++\n\t}\n\n\tfor j < len(a) {\n\t\tb = append(b, a[j])\n\t\tj++\n\t}\n\n\tfor i := range b {\n\t\ta[i] = b[i]\n\t}\n\treturn nil\n}\n\nfunc doSomething(n int, s string) int {\n\ta := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\ta[i] = i\n\t}\n\n\tl := log{s, 0}\n\terr := mergeSort(a, &l)\n\tif err != nil {\n\t\treturn 1000000000\n\t}\n\n\treturn len(l.s) - l.i\n}\n\nfunc doSomethingWithPrint(n int, s string) int {\n\ta := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\ta[i] = i\n\t}\n\n\tl := log{s, 0}\n\terr := mergeSort(a, &l)\n\tif err != nil {\n\t\treturn 1000000000\n\t}\n\n\tif _, err = l.left(); err != nil {\n\t\tb := make([]int, len(a))\n\n\t\tfor i, v := range a {\n\t\t\tb[v] = i + 1\n\t\t}\n\n\t\tfmt.Println(len(a))\n\t\tfor _, v := range b {\n\t\t\tfmt.Printf(\"%d \", v)\n\t\t}\n\t}\n\n\treturn len(l.s) - l.i\n}\n\nfunc main() {\n\tio := NewIO(os.Stdin, os.Stdout)\n\ts := io.ReadString()\n\n\tl, r := 1, 200000\n\n\tfor r - l > 1 {\n\t\tx1 := l + (r - l) \/ 3\n\t\tx2 := l + (r - l) \/ 3 * 2\n\n\t\tv1 := doSomething(x1, s)\n\t\tv2 := doSomething(x2, s)\n\n\t\tif v1 < v2 {\n\t\t\tl = x1\n\t\t} else {\n\t\t\tr = x2\n\t\t}\n\t}\n\n\tdoSomethingWithPrint(l, s)\n}\n","testcases":"[{'input': '00000000000000000000000000000000\\n', 'output': ['16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \\n', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\\n', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16']}, {'input': '11111111111111111111111111111111\\n', 'output': ['16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 \\n', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\n', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1']}, {'input': '101011010001100100011011001111011000011110010\\n', 'output': ['16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2\\n', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2 \\n', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2 ', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2']}, {'input': '10100010011001001110110110111010011000110100\\n', 'output': ['16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8\\n', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8 ', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8 \\n', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8']}, {'input': '100101110000101110101111001010101110000001101110\\n', 'output': ['17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12 ', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14\\n', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12\\n', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14 \\n', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14 ', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12 \\n']}, {'input': '000100100101010100110101101010001011000110111\\n', 'output': ['16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9\\n', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9 ', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9 \\n', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9']}, {'input': '1101100011000111011100110111010100100111010001101\\n', 'output': ['16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5 \\n', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5\\n', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5 ']}, {'input': '00010001101001111001010111100100101001110001101\\n', 'output': ['16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3 ', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3\\n', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3 \\n']}, {'input': '10101011010111001100100111010011010011011100000\\n', 'output': ['16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4 \\n', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4 ', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4\\n']}, {'input': '111010100010110101100011001010011100111010101001\\n', 'output': ['16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1\\n', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1 ', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1 \\n', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1']}, {'input': '0001101001100110000101010100000100001111010\\n', 'output': ['16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15 ', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15 \\n', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15\\n']}, {'input': '001110001100100010110111111000100111001101011\\n', 'output': ['16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3\\n', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3 ', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3 \\n', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3']}, {'input': '100100110010011100100110110100110110011011100000\\n', 'output': ['16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8\\n', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8 \\n', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8 ']}, {'input': '001010100001101110100011101000010111010110000\\n', 'output': ['16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4\\n', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4 \\n', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4 ']}, {'input': '001001111101101000101111100010011010100001110\\n', 'output': ['16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2 \\n', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2\\n', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2 ']}, {'input': '010011010100000100000111011001011111100000101\\n', 'output': ['16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5 ', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5 \\n', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5\\n']}, {'input': '1010011111000101001001001101100110101001100\\n', 'output': ['16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8 \\n', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8 ', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8\\n']}, {'input': '00001001000101101101000010011011101111000010100\\n', 'output': ['16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11 \\n', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12\\n', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11\\n', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12 ', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12 \\n', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11 ', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12']}, {'input': '1001010000011100101000100111000111101011000000\\n', 'output': ['16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3 ', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3\\n', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3 \\n']}, {'input': '110111101011010110010001001001110101110101101\\n', 'output': ['16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10 ', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10 \\n', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10\\n']}, {'input': '011011010000111001100101001000000001110111101\\n', 'output': ['16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14\\n', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14 \\n', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14 ']}, {'input': '100100001011100011110001000011100011100011010010\\n', 'output': ['16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9\\n', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9 ', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9 \\n']}, {'input': '011011001001110111101101011001101100100111101001\\n', 'output': ['16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9\\n', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9 \\n', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9 ']}, {'input': '111000110111011010101110001000111011111\\n', 'output': ['16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2\\n', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2 ', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2 \\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7\\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7 \\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7 ']}, {'input': '1001101100101000100110010110100010011010011011\\n', 'output': ['16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13 \\n', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13 ', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13\\n']}, {'input': '000100110000010001011001111011010000000\\n', 'output': ['16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12 \\n', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12\\n', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12 ']}, {'input': '10010111010100011011101001011100111111101\\n', 'output': ['16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7\\n', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7 ', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7 \\n']}, {'input': '110111110111000010011001001010110010110110000\\n', 'output': ['16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14 \\n', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14 ', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14\\n']}, {'input': '0010010100001000110010101001001111010111\\n', 'output': ['16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9 \\n', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9\\n', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9 ']}, {'input': '100100110110000110111101100100100000000\\n', 'output': ['16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14\\n', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14 ', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14 \\n']}, {'input': '1110100100011111001010101011110010001000\\n', 'output': ['16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12 \\n', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12 ', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12\\n']}, {'input': '101000101011011110111101100010000000010\\n', 'output': ['16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14\\n', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14 ', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14 \\n']}, {'input': '001011101100010011000010101111000010000\\n', 'output': ['16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12 \\n', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12\\n', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12 ']}, {'input': '0111100011001111000011010010011110110011\\n', 'output': ['16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7\\n', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7 \\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12 \\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7 ', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12\\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12 ']}, {'input': '01001100100111101111001000100110000010110\\n', 'output': ['16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15 ', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15\\n', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15 \\n']}, {'input': '10110111011110100000000100010011000100\\n', 'output': ['16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16 ', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16 \\n', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16\\n']}, {'input': '01111000000110000000001010111011101011001\\n', 'output': ['16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9 ', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9 \\n', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9\\n', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9']}, {'input': '010011000110111111110010010000010111110101\\n', 'output': ['15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12\\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12 ', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12\\n', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12 \\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12 \\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12 ', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12']}, {'input': '011110111101011100000001101100101011100010\\n', 'output': ['16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13\\n', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13 ', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13 \\n']}, {'input': '000001000010100000101101101110110000110100\\n', 'output': ['16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4 \\n', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4 ', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4\\n', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4']}, {'input': '110001001100000011000001001000011111100000\\n', 'output': ['16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16\\n', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16 ', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16 \\n']}, {'input': '101101110110000000010010011111000001011111\\n', 'output': ['16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11\\n', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11 ', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12 ', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11 \\n', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12 \\n', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12\\n']}, {'input': '0111100001000111110111011111111000111\\n', 'output': ['16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3\\n', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3 ', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3 \\n', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3']}, {'input': '1\\n', 'output': ['2\\n2 1', '2\\n2 1 ', '2\\n2 1\\n', '2\\n2 1 \\n']}, {'input': '110\\n', 'output': ['3\\n2 3 1 ', '3\\n2 3 1\\n', '3\\n2 3 1 \\n', '3\\n2 3 1']}, {'input': '1111\\n', 'output': ['4\\n4 3 2 1 \\n', '4\\n4 3 2 1', '4\\n4 3 2 1\\n', '4\\n4 3 2 1 ']}, {'input': '10101011\\n', 'output': ['5\\n5 2 3 1 4 \\n', '5\\n5 2 3 1 4\\n', '6\\n2 6 5 1 4 3 \\n', '5\\n5 2 3 1 4 ', '6\\n2 6 5 1 4 3 ', '5\\n5 2 3 1 4', '6\\n2 6 5 1 4 3\\n']}, {'input': '1001101010\\n', 'output': ['6\\n1 5 3 6 2 4\\n', '6\\n1 5 3 6 2 4 \\n', '6\\n1 5 3 6 2 4 ', '6\\n1 5 3 6 2 4']}, {'input': '110011000010\\n', 'output': ['7\\n2 4 1 5 6 7 3\\n', '7\\n2 4 1 5 6 7 3', '7\\n2 4 1 5 6 7 3 ', '7\\n2 4 1 5 6 7 3 \\n']}, {'input': '1000000110111001\\n', 'output': ['8\\n5 1 6 8 2 7 3 4 \\n', '8\\n5 1 6 8 2 7 3 4 ', '8\\n5 1 6 8 2 7 3 4\\n', '8\\n5 1 6 8 2 7 3 4']}, {'input': '111001011011010110101\\n', 'output': ['9\\n7 5 9 2 6 1 8 3 4 \\n', '9\\n7 5 9 2 6 1 8 3 4 ', '9\\n7 5 9 2 6 1 8 3 4\\n', '9\\n7 5 9 2 6 1 8 3 4']}, {'input': '0010011110111011101100100\\n', 'output': ['11\\n1 8 5 4 7 2 11 10 9 6 3 \\n', '10\\n2 9 6 5 8 10 3 7 1 4 \\n', '10\\n2 9 6 5 8 10 3 7 1 4 ', '11\\n1 8 5 4 7 2 11 10 9 6 3\\n', '10\\n2 9 6 5 8 10 3 7 1 4\\n', '11\\n1 8 5 4 7 2 11 10 9 6 3', '11\\n1 8 5 4 7 2 11 10 9 6 3 ']}, {'input': '10100000110010111110101000\\n', 'output': ['11\\n6 4 9 8 10 1 3 11 5 7 2', '11\\n6 4 9 8 10 1 3 11 5 7 2\\n', '11\\n6 4 9 8 10 1 3 11 5 7 2 ', '11\\n6 4 9 8 10 1 3 11 5 7 2 \\n']}, {'input': '01011101110111101010100101001111\\n', 'output': ['12\\n7 1 12 6 4 2 11 5 9 8 10 3', '12\\n7 1 12 6 4 2 11 5 9 8 10 3 \\n', '12\\n7 1 12 6 4 2 11 5 9 8 10 3 ', '12\\n7 1 12 6 4 2 11 5 9 8 10 3\\n']}, {'input': '0111111011011001011111010011110010\\n', 'output': ['13\\n12 3 10 9 4 1 13 8 11 5 7 2 6 ', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6\\n', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6 \\n', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6']}, {'input': '1101101110101100100001011001010001100\\n', 'output': ['14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14 \\n', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14 ', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14\\n']}, {'input': '01001001010101100011101010101110001101011\\n', 'output': ['15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2\\n', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2 ', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2 \\n']}, {'input': '1110100000111010101000010011001000100011111010011100101100010010101011110100010101111010111010110010000100101010\\n', 'output': ['31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27\\n', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27 \\n', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27 ']}, {'input': '101010111001101011001110110011101101101101010101001111110011110001000110101101111101111101001000110001100101001001011101001100100011000110001101010110011011010011010110000100110100001100111101110101\\n', 'output': ['46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7 \\n', '46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7\\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7 \\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7\\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7 ', '46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7 ', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7']}, {'input': '1011111000101010101110001011100111110010100110011001000111011000111000101101000001101011011110001010110001101011001100010010101011000100111010111010101100001001010010110001101100011001110100011001110010101101001111011000001010111100100001001001101000101001101100011011110110000101101000110110110010101111111010110100011100001011001010110011111000011010000111111001111100001111001101001100001101110000110001110010101011100101011011111011011011011010110011010010011010001011100000111100110101010100101000001001001...', 'output': ['94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12\\n', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12 ', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12 \\n', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12']}, {'input': '1001100000101101110001101011011101000101000011010011001011000001010110011111101001111001010011100010111011000001110111110111010111000111010000101000101011111001100001011111110100100000110100110100100111000001100011110101100011111010010010110101101110110011101010011000010111000110110100010011011011010110010111000110101000000011100100101110101001001101010000101111111011011011000000010101101010111001100001011101101011100101010000110111111000010000111000110101111100010001101101110110001011011111101111101111001...', 'output': ['163\\n101 95 14 87 155 59 149 44 65 116 83 102 21 100 47 107 78 43 163 159 28 156 35 17 147 125 134 63 7 26 122 56 2 104 133 51 57 111 97 93 73 45 79 123 132 144 113 70 18 22 84 131 49 80 127 66 109 161 91 120 105 158 145 76 39 20 64 85 27 90 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 24 ...', '164\\n97 87 2 78 147 56 134 35 59 107 65 100 14 95 43 102 63 28 159 156 122 164 125 44 163 149 155 133 7 101 104 83 47 93 111 51 17 21 26 116 57 73 109 66 18 70 131 22 144 132 120 79 113 123 127 49 84 80 45 161 91 145 76 158 105 39 20 64 27 90 85 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 ...', '164\\n97 87 2 78 147 56 134 35 59 107 65 100 14 95 43 102 63 28 159 156 122 164 125 44 163 149 155 133 7 101 104 83 47 93 111 51 17 21 26 116 57 73 109 66 18 70 131 22 144 132 120 79 113 123 127 49 84 80 45 161 91 145 76 158 105 39 20 64 27 90 85 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86...', '163\\n101 95 14 87 155 59 149 44 65 116 83 102 21 100 47 107 78 43 163 159 28 156 35 17 147 125 134 63 7 26 122 56 2 104 133 51 57 111 97 93 73 45 79 123 132 144 113 70 18 22 84 131 49 80 127 66 109 161 91 120 105 158 145 76 39 20 64 85 27 90 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 24 1...']}, {'input': '1111101001001101110000000110011111000011101001111001010110000100001011100010111101010110101110011111100101100110111010101100000001011101011001110010100000000001110001101110010110111001001111111111100111010100100100110101010100010010100010111101010010000101110100111100101100101010111010110000010011101000111110101010000011001001101100010010110001011101111001101100111000111001111110100011001100000110101001001010101111110010000001001100000011100110011101110110110001111101011000100101000100010001101001001100110...', 'output': ['321\\n220 215 226 218 201 89 229 92 231 168 10 14 227 183 214 166 54 273 213 48 280 285 257 145 274 73 278 24 169 263 232 184 39 18 56 146 318 141 11 53 77 225 191 151 188 179 217 63 27 216 237 189 186 83 43 301 78 164 267 194 221 144 61 207 258 249 277 84 45 174 66 199 55 132 180 282 16 143 120 155 153 187 34 108 90 288 235 313 321 271 126 101 38 47 270 62 243 98 148 242 279 109 79 208 133 82 259 3 289 311 9 21 190 162 309 119 36 7 295 234 116 128 142 211 15 172 160 315 298 94 171 262 91 130 165 287 193 1 ...', '321\\n220 215 226 218 201 89 229 92 231 168 10 14 227 183 214 166 54 273 213 48 280 285 257 145 274 73 278 24 169 263 232 184 39 18 56 146 318 141 11 53 77 225 191 151 188 179 217 63 27 216 237 189 186 83 43 301 78 164 267 194 221 144 61 207 258 249 277 84 45 174 66 199 55 132 180 282 16 143 120 155 153 187 34 108 90 288 235 313 321 271 126 101 38 47 270 62 243 98 148 242 279 109 79 208 133 82 259 3 289 311 9 21 190 162 309 119 36 7 295 234 116 128 142 211 15 172 160 315 298 94 171 262 91 130 165 287 193 1 1...', '322\\n217 213 221 216 194 84 227 90 228 165 7 10 225 179 211 164 51 270 208 45 278 282 249 143 271 70 274 18 166 259 229 180 36 16 54 144 313 132 9 48 71 220 189 146 186 172 215 61 21 214 234 187 183 79 38 298 73 160 263 191 218 142 56 204 255 243 273 82 39 171 63 193 53 129 174 279 14 141 116 151 169 201 33 109 94 288 235 321 322 283 133 100 55 67 267 77 262 98 153 245 285 115 83 231 145 91 264 1 295 319 24 27 226 184 301 128 34 15 300 232 120 126 148 277 87 190 155 315 311 101 168 287 89 130 162 294 199 7...', '322\\n217 213 221 216 194 84 227 90 228 165 7 10 225 179 211 164 51 270 208 45 278 282 249 143 271 70 274 18 166 259 229 180 36 16 54 144 313 132 9 48 71 220 189 146 186 172 215 61 21 214 234 187 183 79 38 298 73 160 263 191 218 142 56 204 255 243 273 82 39 171 63 193 53 129 174 279 14 141 116 151 169 201 33 109 94 288 235 321 322 283 133 100 55 67 267 77 262 98 153 245 285 115 83 231 145 91 264 1 295 319 24 27 226 184 301 128 34 15 300 232 120 126 148 277 87 190 155 315 311 101 168 287 89 130 162 294 199 78...']}, {'input': '0011111101101011010100011010110000111110001111011101000110111011110010100011100010001110001010010110011011010010101101100101011101110101011100001001010110001011111111110010101100100010110110110011000110010100100110101001011001101011100110100110110100001011110101011101011100111100100100011101101100010110011000110110001001010001011110001110100000111100110000111110011101010110100110011011000111001011000100001000110010001101011010110111100011001011101001011010011111111101010001011111111011100101111110001001010...', 'output': ['632\\n548 630 91 406 487 5 553 316 137 436 586 170 379 565 205 226 323 338 273 37 493 434 238 119 577 166 161 225 617 615 100 141 263 371 199 453 102 237 489 431 423 308 218 187 467 173 107 280 554 357 71 479 176 302 512 246 249 570 445 105 515 252 447 17 498 330 118 250 370 63 321 223 378 576 128 61 239 196 82 36 329 194 395 131 349 54 522 611 30 365 594 290 403 470 144 73 165 157 314 624 262 34 147 409 10 587 416 266 530 389 481 390 358 392 179 77 268 298 242 602 135 540 327 111 618 13 114 291 292 182 535 ...', '632\\n548 630 91 406 487 5 553 316 137 436 586 170 379 565 205 226 323 338 273 37 493 434 238 119 577 166 161 225 617 615 100 141 263 371 199 453 102 237 489 431 423 308 218 187 467 173 107 280 554 357 71 479 176 302 512 246 249 570 445 105 515 252 447 17 498 330 118 250 370 63 321 223 378 576 128 61 239 196 82 36 329 194 395 131 349 54 522 611 30 365 594 290 403 470 144 73 165 157 314 624 262 34 147 409 10 587 416 266 530 389 481 390 358 392 179 77 268 298 242 602 135 540 327 111 618 13 114 291 292 182 535...']}, {'input': '0100010110000111010000100111111111001011100011111011010000001000000000000001000110000111000111000111000000100000100101111101110110001111011111011111000000010000000110111111111011111111111111111101001100111010100010001000001000001011101010001101011010010111111011111111111111110110110111101011011001011111011011110101000110110101000010111111011000000000100000000000100000100000000000000000111111101111111111111111111111110111111111111111111111111110111101101001111010011101101111111110110111011110110111110111101...', 'output': ['912\\n781 780 782 784 786 745 785 776 755 774 778 777 775 779 788 789 787 783 793 792 791 797 795 790 800 794 799 798 746 748 717 692 752 749 750 756 754 753 747 759 757 758 772 770 773 762 771 769 768 767 761 766 765 751 764 760 763 708 706 709 703 704 707 521 711 705 712 713 714 710 715 697 649 699 702 700 701 696 690 566 689 688 695 694 693 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 909 900 908 912 907 911 910 906 905 903 902 901 894...', '912\\n781 780 782 784 786 745 785 776 755 774 778 777 775 779 788 789 787 783 793 792 791 797 795 790 800 794 799 798 746 748 717 692 752 749 750 756 754 753 747 759 757 758 772 770 773 762 771 769 768 767 761 766 765 751 764 760 763 708 706 709 703 704 707 521 711 705 712 713 714 710 715 697 649 699 702 700 701 696 690 566 689 688 695 694 693 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 909 900 908 912 907 911 910 906 905 903 902 901 89...', '911\\n780 779 781 783 785 745 784 775 755 773 777 776 774 778 787 788 786 782 792 791 790 795 794 789 799 793 798 797 749 751 748 747 756 752 753 759 758 757 750 762 760 761 771 769 772 692 770 768 765 766 767 717 754 746 764 763 703 709 704 710 705 706 707 708 712 711 713 521 714 715 696 699 701 649 702 700 697 689 693 694 690 566 695 688 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 908 899 907 911 906 910 909 905 904 902 901 900 893 90...', '911\\n780 779 781 783 785 745 784 775 755 773 777 776 774 778 787 788 786 782 792 791 790 795 794 789 799 793 798 797 749 751 748 747 756 752 753 759 758 757 750 762 760 761 771 769 772 692 770 768 765 766 767 717 754 746 764 763 703 709 704 710 705 706 707 708 712 711 713 521 714 715 696 699 701 649 702 700 697 689 693 694 690 566 695 688 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 908 899 907 911 906 910 909 905 904 902 901 900 893 903...']}, {'input': '0110111101010000101101111101010110100110100010111001101101101101110101011101011111111101101101010101000011001000110011011010101110110010101111101110011111011110101111011010011110111111111001101110111011011110110101000111101011110101110101110110110011000110000100111110111100110100011000100110000111010100011111100111010101000101100010110010110111001011100110010001001110110111111011000010000010110000000001010000101100000010000000000001010000010010000101010010000100101101000000001100000011011011101101100001100...', 'output': ['858\\n123 116 122 121 76 111 119 40 120 5 89 15 113 94 6 104 107 60 106 101 68 103 87 47 99 36 70 75 46 25 58 13 62 23 80 83 79 63 84 55 61 22 43 11 49 24 33 8 32 18 30 14 20 134 78 97 136 12 137 132 124 86 118 54 37 67 157 145 155 143 160 162 69 148 150 34 73 125 117 130 180 175 156 181 91 186 195 190 187 184 163 189 98 158 165 100 159 168 59 166 176 178 144 172 164 174 142 291 56 290 288 245 260 283 266 270 281 284 287 272 285 48 282 298 258 296 299 297 300 302 292 82 304 268 277 259 279 278 264 273 274 8...', '858\\n123 116 122 121 76 111 119 40 120 5 89 15 113 94 6 104 107 60 106 101 68 103 87 47 99 36 70 75 46 25 58 13 62 23 80 83 79 63 84 55 61 22 43 11 49 24 33 8 32 18 30 14 20 134 78 97 136 12 137 132 124 86 118 54 37 67 157 145 155 143 160 162 69 148 150 34 73 125 117 130 180 175 156 181 91 186 195 190 187 184 163 189 98 158 165 100 159 168 59 166 176 178 144 172 164 174 142 291 56 290 288 245 260 283 266 270 281 284 287 272 285 48 282 298 258 296 299 297 300 302 292 82 304 268 277 259 279 278 264 273 274 88...']}, {'input': '0011011111111010110100000111010010110100000010000000001000000101000110101101001000111110010001001101110000100111111111110100000000000001100000000011111000100101011110111111111101111100101101000100011110111111111111100111011010000100001001101110100111011000001011110111111110000000000000010000000010000000000000000000000000000000000000100000100010011101011011011011000000111101000110110001010111110000000000110011110111100100111011111111111101001100111011011111111111111011111101111101111111111111111011101011011...', 'output': ['732\\n10 192 191 177 184 199 198 193 196 197 149 195 203 206 205 200 208 207 209 210 211 204 223 226 227 221 228 235 231 233 229 225 232 213 212 201 215 216 202 220 214 222 219 217 218 256 254 259 257 249 252 247 253 250 237 251 240 239 224 238 234 230 244 245 242 241 236 243 274 272 276 275 262 280 278 273 282 277 281 263 248 265 261 258 260 270 266 271 269 264 268 289 307 309 308 306 313 316 311 310 312 279 326 324 325 327 328 315 317 319 314 322 323 318 302 305 304 303 291 300 301 296 298 297 299 293 292...', '732\\n10 192 191 177 184 199 198 193 196 197 149 195 203 206 205 200 208 207 209 210 211 204 223 226 227 221 228 235 231 233 229 225 232 213 212 201 215 216 202 220 214 222 219 217 218 256 254 259 257 249 252 247 253 250 237 251 240 239 224 238 234 230 244 245 242 241 236 243 274 272 276 275 262 280 278 273 282 277 281 263 248 265 261 258 260 270 266 271 269 264 268 289 307 309 308 306 313 316 311 310 312 279 326 324 325 327 328 315 317 319 314 322 323 318 302 305 304 303 291 300 301 296 298 297 299 293 292 ...']}, {'input': '1010101111101101001000010001101111101000101110110011001101000010010101101111100111111111010100110000111001011110111110101000110111110100111100011001010111010101001001011001110011110011011010010000101010011111011010111111100111111101001000110100110101001010011110111110001001101101001100111000010111101101000110111010111111000111110100011001011101111111000110011101101000010110100101011011011001110010111000101111110110011000110110111100100111001100101010001110101110001001111011000000000100110100110111011101110...', 'output': ['594\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 4...', '593\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 4...', '593\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 46...', '594\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 46...']}, {'input': '0101110010011011100011111011101111011111111011000000001011110111111111010110101111101100101110111110010011101100101110110111111100000000010001111111111111101111111101111101110111011110101111101110101100010010100110010010000001000000000001100100100110101010100100000011101101001110010011101001000011111111111101111111110111111111110111111100100000010000000000000000000000000000000000000000000100101000011011010001000000110111101011000110010111011110111111111111101101011011100100010110111101101011011110110001000...', 'output': ['809\\n656 654 658 660 659 657 651 649 650 655 639 653 640 642 633 638 637 624 645 644 643 648 646 647 641 621 616 622 618 620 612 613 486 475 615 609 614 635 636 619 632 631 634 630 626 629 625 628 623 627 696 697 689 695 694 693 692 687 691 688 690 667 699 679 701 702 704 700 705 698 707 711 706 708 710 676 677 674 678 675 680 682 683 672 686 684 681 685 663 662 511 665 617 664 673 671 669 666 668 661 670 778 777 779 780 734 781 784 776 783 786 782 785 775 772 774 773 765 770 766 746 762 763 769 767 768 79...', '809\\n656 654 658 660 659 657 651 649 650 655 639 653 640 642 633 638 637 624 645 644 643 648 646 647 641 621 616 622 618 620 612 613 486 475 615 609 614 635 636 619 632 631 634 630 626 629 625 628 623 627 696 697 689 695 694 693 692 687 691 688 690 667 699 679 701 702 704 700 705 698 707 711 706 708 710 676 677 674 678 675 680 682 683 672 686 684 681 685 663 662 511 665 617 664 673 671 669 666 668 661 670 778 777 779 780 734 781 784 776 783 786 782 785 775 772 774 773 765 770 766 746 762 763 769 767 768 797...']}, {'input': '0101111101001000110101110111011111010000000011000010011110000111010110011111011100000000100000010000000000000010100011011110110100101001011110010000001010000100111011111011010010100101111111111101100000000000000001000000000000010000000000000000000000001010001011101111101101110011110110000000011101011101110010000010101110111101111000000000000000010000000000100101001111101111001111010111101000000100110100011010010001101011101101100000000010000111111101111111111111111111111111111111111111110111111111111111111...', 'output': ['562\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 290 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283 ...', '561\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 289 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283 ...', '561\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 289 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283...', '562\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 290 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283...']}, {'input': '0011101101101011010010011001111001111110010100110000010001110100000011010111111101000000101100010110111101110001111010110001111110011111100111001101111110101001111111001010110100101101011000101110100011010001010011111110111101011100100110111110111100011110101011110110111001000100011110111010110101000000011101011011111111011001010011111111101111101101100101110011100011110101110111111110111101011111110101101011011010001101001101001111100111010010100011000100001010101001011111010110110010011001000100101110010...', 'output': ['718\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 1...', '718\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 ...', '719\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 1...', '719\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 ...']}, {'input': '1101111101011110100111101111111111010001001001101010000010000000000001000001011011011101001110111111110111100110100010111000100010000000000010000000000001010000000000000000000011001011011111010001000001000011110010001011011001011111011111111110111111100101000010001011011110111111111010001011011101010011111101111111011111110000000000000000101000000000000000000000000000000000001000000000000100000000000000010111100001000011001001111111011010011101110010011110001000111011111111110101110010110000101110111011111...', 'output': ['837\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 564...', '838\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 56...', '837\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 56...', '838\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 564...']}, {'input': '1010101011110101000100111101100101100001011001100111010110001110101100001001111110101001111010000011110000100000010011010001001100011001010001101000111001010100011101000100010101001011010000001111110111001101010110101101101111011011110011011101100001111011100111111101100010110110101011010111010001111110011001000110001101000111001111001110011100110111101000011100111010100110011100011101101111001010110000001010001101100111000011011000110111010010100101101110100011001010111011111001111010001101000100011101111...', 'output': ['548\\n255 212 134 231 130 215 181 131 140 224 189 263 230 266 264 262 201 273 265 271 10 252 256 267 41 276 278 279 228 47 277 161 121 253 211 213 222 138 209 227 235 15 243 74 245 177 83 217 249 56 247 187 123 37 159 63 220 2 195 1 124 8 68 167 23 150 71 59 168 34 110 155 109 170 44 172 157 79 163 114 25 52 132 13 65 194 158 200 160 102 192 183 190 6 115 162 78 125 191 146 188 139 154 46 151 122 66 148 84 93 94 113 69 101 92 137 22 9 127 43 5 54 3 50 12 75 62 31 51 100 30 107 27 99 90 67 55 370 376 380 340...', '548\\n255 212 134 231 130 215 181 131 140 224 189 263 230 266 264 262 201 273 265 271 10 252 256 267 41 276 278 279 228 47 277 161 121 253 211 213 222 138 209 227 235 15 243 74 245 177 83 217 249 56 247 187 123 37 159 63 220 2 195 1 124 8 68 167 23 150 71 59 168 34 110 155 109 170 44 172 157 79 163 114 25 52 132 13 65 194 158 200 160 102 192 183 190 6 115 162 78 125 191 146 188 139 154 46 151 122 66 148 84 93 94 113 69 101 92 137 22 9 127 43 5 54 3 50 12 75 62 31 51 100 30 107 27 99 90 67 55 370 376 380 340 ...']}, {'input': '1101001100000100001111111001110111111111101101001111100010000101001100100111110010000000000010000000000000110100111100010000110011110100100000000001001101110101011001000110011111011000100000001000000000000000000100011111111111111111111111111101111111111010001101010000001100101011111011111101111111100101001110010011011011011010100000000100001111111111111110111110111110010101111010100010110101111100000100001101010100101000001011011001011110101111111111111111111111111101000000000000000000010000000000000000000...', 'output': ['569\\n335 332 337 334 338 339 340 336 326 333 330 331 325 324 329 328 313 344 343 327 345 347 346 349 348 341 342 356 357 355 350 352 353 354 351 289 127 290 288 291 292 295 294 287 297 298 299 293 302 296 304 303 300 308 301 307 305 314 309 311 306 312 315 316 318 310 323 319 322 321 317 388 387 380 389 390 392 391 386 379 385 383 384 377 382 378 372 381 360 358 361 320 366 359 364 363 365 370 362 369 368 373 375 371 374 367 419 411 418 417 413 409 414 416 412 415 427 428 426 423 425 422 421 424 404 402 40...', '569\\n335 332 337 334 338 339 340 336 326 333 330 331 325 324 329 328 313 344 343 327 345 347 346 349 348 341 342 356 357 355 350 352 353 354 351 289 127 290 288 291 292 295 294 287 297 298 299 293 302 296 304 303 300 308 301 307 305 314 309 311 306 312 315 316 318 310 323 319 322 321 317 388 387 380 389 390 392 391 386 379 385 383 384 377 382 378 372 381 360 358 361 320 366 359 364 363 365 370 362 369 368 373 375 371 374 367 419 411 418 417 413 409 414 416 412 415 427 428 426 423 425 422 421 424 404 402 405...']}, {'input': '1000110101000001110111011111010011001111101110110000000110100101010010100001010011101000001111000111100110111111111011100111010110010111010000001011101011011101000100011000001111010010000111011001111011110000011100011100010011100111001101001011000000110001010001100010111110001000111001100100001101001010110100111111000100001111010011010001111111110001111110000111111000011100001101110101000000100101000010001010110010110011100101001011110111101011001101110100000001101010110101111101001100110110111100000101011...', 'output': ['938\\n108 721 578 728 855 463 629 270 533 641 325 458 161 277 509 857 807 573 803 377 289 864 524 105 477 791 820 882 895 117 127 613 750 653 508 443 591 587 181 506 207 129 31 421 542 664 797 744 80 491 252 437 830 853 815 711 114 265 618 662 865 194 563 883 917 352 385 374 238 157 394 798 119 435 920 925 927 581 518 60 413 789 462 854 918 323 743 680 468 327 875 769 222 221 904 890 73 37 604 559 876 607 514 49 244 639 720 307 136 313 687 691 735 128 569 827 800 231 774 683 339 645 295 236 816 502 621 342 ...', '938\\n108 721 578 728 855 463 629 270 533 641 325 458 161 277 509 857 807 573 803 377 289 864 524 105 477 791 820 882 895 117 127 613 750 653 508 443 591 587 181 506 207 129 31 421 542 664 797 744 80 491 252 437 830 853 815 711 114 265 618 662 865 194 563 883 917 352 385 374 238 157 394 798 119 435 920 925 927 581 518 60 413 789 462 854 918 323 743 680 468 327 875 769 222 221 904 890 73 37 604 559 876 607 514 49 244 639 720 307 136 313 687 691 735 128 569 827 800 231 774 683 339 645 295 236 816 502 621 342 1...']}, {'input': '0001111110110110011101001011011101001111010101011010010010001110011110011111101101001101000101100100101101010111110000011110100111011101011111111000110010000101111111001010011100010101110101011010100000100011110010101111110111000000010110001111000101010010001110000100101000001111001111000101010100110100010100111101101010001111001110011101000110000101001011110000111011110110111111101010011101010001001011000110010000011001010111100101001111100010000000010110111110001100111101111010010101101001001010010110101...', 'output': ['953\\n659 894 900 479 825 411 203 665 880 811 519 468 772 643 37 246 758 828 790 548 185 487 462 81 150 78 311 778 496 87 193 783 836 817 118 390 796 707 252 115 337 308 615 690 682 349 565 931 914 307 276 219 25 912 702 263 146 310 524 483 338 234 227 406 571 824 440 387 843 916 533 737 116 200 810 11 526 469 755 946 941 728 752 256 93 937 753 166 273 559 238 424 305 270 171 189 202 336 139 136 801 770 180 137 343 739 733 594 476 934 896 73 30 170 634 742 806 123 515 666 61 622 68 106 299 367 630 431 477 68...', '953\\n659 894 900 479 825 411 203 665 880 811 519 468 772 643 37 246 758 828 790 548 185 487 462 81 150 78 311 778 496 87 193 783 836 817 118 390 796 707 252 115 337 308 615 690 682 349 565 931 914 307 276 219 25 912 702 263 146 310 524 483 338 234 227 406 571 824 440 387 843 916 533 737 116 200 810 11 526 469 755 946 941 728 752 256 93 937 753 166 273 559 238 424 305 270 171 189 202 336 139 136 801 770 180 137 343 739 733 594 476 934 896 73 30 170 634 742 806 123 515 666 61 622 68 106 299 367 630 431 477 6...']}, {'input': '1100100100001011010000101110101100011010001000111000110011111111010101110100111111010101111010100101010111100000011010100111110101101001011000000001110001110000100001101010010101000110011010010100011011111000100111111010111011011010100001110001111010110000110011100101110111101100011110000101000110001110000110110110011011000111011001011001001100101111100001011010110110111111101111110101000000111101101001110111010101100001111110100100011010001101001100001110000111111111101100101010001001100101001111111111001...', 'output': ['599\\n63 21 349 190 270 200 124 388 502 96 35 482 495 545 548 41 444 268 585 595 314 397 340 449 297 150 260 131 373 584 529 271 496 503 433 334 196 116 324 409 511 187 283 568 173 546 210 281 558 353 3 486 583 344 573 242 217 298 398 500 408 2 355 87 510 564 459 348 14 439 485 311 436 316 49 307 487 536 252 1 412 13 289 555 554 426 411 515 423 333 394 362 261 277 240 149 86 215 440 320 185 363 413 230 138 103 157 359 219 518 471 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 547 ...', '600\\n21 2 340 150 242 187 87 353 495 41 3 444 482 510 529 14 433 217 573 583 297 355 316 436 271 116 210 96 349 568 503 260 485 496 398 314 173 35 388 449 502 200 311 584 131 564 63 268 334 585 511 298 595 500 596 124 324 558 408 281 439 283 548 546 545 397 344 196 373 348 459 190 486 270 409 13 555 554 536 411 471 1 423 359 363 289 320 277 487 394 518 413 240 185 138 49 103 362 219 230 215 333 515 307 412 261 157 86 149 426 252 440 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 ...', '600\\n21 2 340 150 242 187 87 353 495 41 3 444 482 510 529 14 433 217 573 583 297 355 316 436 271 116 210 96 349 568 503 260 485 496 398 314 173 35 388 449 502 200 311 584 131 564 63 268 334 585 511 298 595 500 596 124 324 558 408 281 439 283 548 546 545 397 344 196 373 348 459 190 486 270 409 13 555 554 536 411 471 1 423 359 363 289 320 277 487 394 518 413 240 185 138 49 103 362 219 230 215 333 515 307 412 261 157 86 149 426 252 440 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 5...', '599\\n63 21 349 190 270 200 124 388 502 96 35 482 495 545 548 41 444 268 585 595 314 397 340 449 297 150 260 131 373 584 529 271 496 503 433 334 196 116 324 409 511 187 283 568 173 546 210 281 558 353 3 486 583 344 573 242 217 298 398 500 408 2 355 87 510 564 459 348 14 439 485 311 436 316 49 307 487 536 252 1 412 13 289 555 554 426 411 515 423 333 394 362 261 277 240 149 86 215 440 320 185 363 413 230 138 103 157 359 219 518 471 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 547 4...']}, {'input': '0000101010100001000111000010010111110110001110010110000011010110010001110000111011100111100010111111110110010010110100000111001011001100100110100111000110001111101101001100010011010100100010101110010110001111000010011111100011101011010000110101100110010001110100011001111000110111011001011010001110011000001010111001101011011001100011011010000001010001111110010101111111010010111000100100110000011110100001011100001011100010111101010001011101001001110111111100001110011100101001001111110010111000111010001111010...', 'output': ['712\\n88 243 231 254 494 288 410 368 215 599 523 149 302 146 487 540 408 702 697 480 344 46 74 341 419 71 354 132 474 590 308 250 245 509 401 318 154 193 356 304 156 626 310 592 43 283 123 383 339 270 524 528 21 314 294 319 337 688 587 228 42 411 451 89 373 115 150 31 78 595 510 32 229 281 467 465 63 12 485 530 360 168 269 692 381 689 15 460 477 432 572 391 117 10 137 710 708 142 286 471 311 244 218 603 612 422 158 75 448 423 170 577 571 60 140 312 48 640 669 51 379 546 666 374 306 169 135 59 671 674 496 366...', '712\\n88 243 231 254 494 288 410 368 215 599 523 149 302 146 487 540 408 702 697 480 344 46 74 341 419 71 354 132 474 590 308 250 245 509 401 318 154 193 356 304 156 626 310 592 43 283 123 383 339 270 524 528 21 314 294 319 337 688 587 228 42 411 451 89 373 115 150 31 78 595 510 32 229 281 467 465 63 12 485 530 360 168 269 692 381 689 15 460 477 432 572 391 117 10 137 710 708 142 286 471 311 244 218 603 612 422 158 75 448 423 170 577 571 60 140 312 48 640 669 51 379 546 666 374 306 169 135 59 671 674 496 36...']}, {'input': '1011100001101001111001011101001111111100110100101000011111000001101000111110110011101111111101110101001000101011111010101001110011101011100101000110111110001100111011111110100111000100101111111100101101011000110111010011111101111100100110110111010100101001110000100010111101001001100001111111010011000001100001000011110011010110101111101000110111010000011101011100011010101010010001011111111110100101100010010110100011111100101001111010001010011100010011011110110101011111111011101011101100010000011111000110111...', 'output': ['641\\n316 302 576 4 535 9 218 530 85 294 356 522 604 602 379 443 594 381 184 75 10 342 575 150 521 483 502 422 55 106 273 387 266 209 56 497 459 120 303 236 508 475 80 233 255 420 449 336 113 42 263 350 102 366 426 362 332 88 33 47 131 225 122 41 59 533 397 142 60 137 573 572 182 317 272 247 377 130 543 494 553 407 292 283 259 234 406 253 620 588 249 82 409 206 398 489 503 291 44 220 221 279 87 599 622 373 230 81 210 159 631 632 548 393 63 625 484 181 478 408 335 324 76 127 195 348 448 289 168 39 228 464 16...', '642\\n315 301 572 3 531 4 210 519 92 297 348 514 605 603 381 434 599 382 182 60 8 344 571 147 513 475 502 420 46 106 273 384 268 206 47 495 463 116 304 230 512 470 69 225 249 419 458 336 115 38 259 347 102 362 422 356 330 94 32 41 141 217 117 36 51 521 388 145 55 144 562 561 181 316 272 236 380 130 546 483 552 406 292 283 253 229 398 247 615 588 239 86 411 200 390 478 510 291 39 213 215 275 93 602 624 377 221 81 207 161 630 633 548 387 56 625 477 178 473 407 332 325 67 129 196 346 449 284 170 35 220 469 167...', '642\\n315 301 572 3 531 4 210 519 92 297 348 514 605 603 381 434 599 382 182 60 8 344 571 147 513 475 502 420 46 106 273 384 268 206 47 495 463 116 304 230 512 470 69 225 249 419 458 336 115 38 259 347 102 362 422 356 330 94 32 41 141 217 117 36 51 521 388 145 55 144 562 561 181 316 272 236 380 130 546 483 552 406 292 283 253 229 398 247 615 588 239 86 411 200 390 478 510 291 39 213 215 275 93 602 624 377 221 81 207 161 630 633 548 387 56 625 477 178 473 407 332 325 67 129 196 346 449 284 170 35 220 469 167 ...', '641\\n316 302 576 4 535 9 218 530 85 294 356 522 604 602 379 443 594 381 184 75 10 342 575 150 521 483 502 422 55 106 273 387 266 209 56 497 459 120 303 236 508 475 80 233 255 420 449 336 113 42 263 350 102 366 426 362 332 88 33 47 131 225 122 41 59 533 397 142 60 137 573 572 182 317 272 247 377 130 543 494 553 407 292 283 259 234 406 253 620 588 249 82 409 206 398 489 503 291 44 220 221 279 87 599 622 373 230 81 210 159 631 632 548 393 63 625 484 181 478 408 335 324 76 127 195 348 448 289 168 39 228 464 161...']}, {'input': '0110111000101100100010000010111000001001000110111110000100001010100100001000010010010001110011001011011101111111000111101100110010000010010000000010101010001010001001010000101100110000000001000010011000111111110000100001100011110001110100000001001010111110110110111111111011110111110111110111100011110011101111111000011001111011000010010110001111101101111111001110101101111111011100110101111011100010011111101111111111001101011101001111111111110001101110111101101011011110001011111100010100000101011111011110000...', 'output': ['881\\n232 175 213 437 35 313 342 511 456 512 14 521 519 507 238 97 188 532 534 535 16 578 569 548 559 530 543 373 588 582 176 591 637 601 328 47 3 486 572 191 357 663 652 464 579 541 644 584 667 610 656 676 689 666 675 480 64 476 122 247 460 498 447 436 502 492 518 504 441 410 374 194 105 368 397 66 248 278 133 292 311 367 366 348 302 304 343 271 187 163 96 80 295 301 286 72 125 59 112 178 162 160 32 253 189 222 198 206 129 165 756 742 752 759 758 555 192 737 602 738 693 740 745 732 727 364 71 716 723 725 71...', '881\\n232 175 213 437 35 313 342 511 456 512 14 521 519 507 238 97 188 532 534 535 16 578 569 548 559 530 543 373 588 582 176 591 637 601 328 47 3 486 572 191 357 663 652 464 579 541 644 584 667 610 656 676 689 666 675 480 64 476 122 247 460 498 447 436 502 492 518 504 441 410 374 194 105 368 397 66 248 278 133 292 311 367 366 348 302 304 343 271 187 163 96 80 295 301 286 72 125 59 112 178 162 160 32 253 189 222 198 206 129 165 756 742 752 759 758 555 192 737 602 738 693 740 745 732 727 364 71 716 723 725 7...']}, {'input': '0110111101111110010111100000011100101101111001110100000101111111001011111100110111111000000101111101101101111110110110000101111011111001111011111111111100111101101101101101111111111111111110001010001011101000000011111110111110001011110111111101111110110111110001100100111100101111111101100000010111000011110110000100000001000000100101000001100100001010100000000000010010111000100000000000000000000101000001000001011100000010001000101100001001110110111011111011101111101111001000100100110111101111111001000000000...', 'output': ['862\\n666 660 663 661 638 648 681 678 667 672 635 677 675 440 308 172 139 251 287 657 650 655 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 412 296 227 23 194 107 250 186 295 286 695 694 674 697 696 66 699 708 705 700 656 701 702 685 688 689 686 683 670 105 662 645 135 445 49 637 640 684 710 714 719 712 715 709 459 704 605 10 682 644 713 725 726 673 718 720 722 730 733 734 731 732 721 729 562 590 589 581 464 575 554 511 550 540 473 142 198 626 611 624 627 419 631 629 59...', '861\\n664 658 663 661 638 647 679 678 667 671 635 676 675 437 308 171 139 251 287 657 650 652 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 411 296 227 23 194 107 250 177 295 278 695 690 674 697 696 55 698 706 705 700 656 701 702 685 687 689 686 683 668 93 662 645 135 445 49 636 639 684 710 714 719 711 715 709 459 703 605 10 682 641 713 723 726 673 716 720 722 730 733 734 731 732 721 727 558 590 589 581 463 575 554 508 550 540 473 140 198 626 608 613 627 419 630 628 591 ...', '862\\n666 660 663 661 638 648 681 678 667 672 635 677 675 440 308 172 139 251 287 657 650 655 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 412 296 227 23 194 107 250 186 295 286 695 694 674 697 696 66 699 708 705 700 656 701 702 685 688 689 686 683 670 105 662 645 135 445 49 637 640 684 710 714 719 712 715 709 459 704 605 10 682 644 713 725 726 673 718 720 722 730 733 734 731 732 721 729 562 590 589 581 464 575 554 511 550 540 473 142 198 626 611 624 627 419 631 629 591...', '861\\n664 658 663 661 638 647 679 678 667 671 635 676 675 437 308 171 139 251 287 657 650 652 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 411 296 227 23 194 107 250 177 295 278 695 690 674 697 696 55 698 706 705 700 656 701 702 685 687 689 686 683 668 93 662 645 135 445 49 636 639 684 710 714 719 711 715 709 459 703 605 10 682 641 713 723 726 673 716 720 722 730 733 734 731 732 721 727 558 590 589 581 463 575 554 508 550 540 473 140 198 626 608 613 627 419 630 628 591...']}, {'input': '0000011100010000010001110111111001111011111110111101111110010010010000001111100011111111110111110111001000000111101111000000011011001000101111100000010011111001001000011101111011111100111101110111100111111111110111111011111111000110000100100000100011101000110111011110111011010000111110111111011110101111111011011111111111011011000000000010000010000111100010000100011000000100000010111110111111111101011110000011000000000100011010010100000000010010001000000000000100000111011101111101011111011111111111101111111...', 'output': ['523\\n424 425 431 433 437 439 435 432 421 427 429 430 403 391 406 423 415 414 151 413 412 408 384 22 418 417 7 202 422 420 419 416 388 374 281 47 390 395 389 350 392 399 400 409 398 397 396 394 292 14 298 294 75 8 99 271 385 21 387 386 126 346 324 348 376 252 211 258 266 174 269 291 272 76 191 195 193 223 251 218 104 156 154 4 130 170 163 93 160 140 146 136 127 87 27 74 48 319 311 34 159 329 330 332 326 169 192 303 327 344 296 347 354 364 372 375 373 380 381 382 379 352 92 360 371 53 309 46 80 304 508 511 5...', '523\\n424 425 431 433 437 439 435 432 421 427 429 430 403 391 406 423 415 414 151 413 412 408 384 22 418 417 7 202 422 420 419 416 388 374 281 47 390 395 389 350 392 399 400 409 398 397 396 394 292 14 298 294 75 8 99 271 385 21 387 386 126 346 324 348 376 252 211 258 266 174 269 291 272 76 191 195 193 223 251 218 104 156 154 4 130 170 163 93 160 140 146 136 127 87 27 74 48 319 311 34 159 329 330 332 326 169 192 303 327 344 296 347 354 364 372 375 373 380 381 382 379 352 92 360 371 53 309 46 80 304 508 511 51...', '524\\n425 427 432 435 439 441 437 433 422 429 430 431 406 392 408 424 416 415 258 414 413 409 385 48 419 418 4 269 423 421 420 417 389 380 281 87 391 396 390 373 394 400 403 412 399 398 397 395 292 8 330 309 93 7 136 272 386 27 388 387 192 346 344 371 384 251 202 252 266 160 271 296 294 34 174 195 193 218 223 211 75 156 154 53 146 191 169 92 163 130 140 127 99 126 104 14 80 47 46 22 74 291 151 298 303 311 76 327 332 347 319 304 324 326 375 376 350 354 374 379 381 382 21 360 364 372 352 348 329 159 170 511 5...', '524\\n425 427 432 435 439 441 437 433 422 429 430 431 406 392 408 424 416 415 258 414 413 409 385 48 419 418 4 269 423 421 420 417 389 380 281 87 391 396 390 373 394 400 403 412 399 398 397 395 292 8 330 309 93 7 136 272 386 27 388 387 192 346 344 371 384 251 202 252 266 160 271 296 294 34 174 195 193 218 223 211 75 156 154 53 146 191 169 92 163 130 140 127 99 126 104 14 80 47 46 22 74 291 151 298 303 311 76 327 332 347 319 304 324 326 375 376 350 354 374 379 381 382 21 360 364 372 352 348 329 159 170 511 51...']}, {'input': '1011111100111000101010000110001111010110100001110000100110101101000100111110010011100111110100000111111001001100010010011011101011000110111111001111000101100110001100011100011010110100000011111011111111110000100111111111001001111010111010010001001000110101100010011100110101101110000111101011111010110111110100011110011011001110100111001110100011110101001111110010110110001110001011100101110101111101111101100110101111101011100011111001000000011101000011100010001001100100111111111111101111001111111111000101111...', 'output': ['763\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 ...', '762\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 4...', '762\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 ...', '763\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 4...']}, {'input': '0011100100110010001111110111111100111000111001110110001100001000011110011100100010111011000110010101011010111011100101101110111111010010101000000000010010110100111101101110000001001111101001110111000010001101101110011110111101011011111110001011001100001110010000001101001000100011100100010100000101101000001111100100000000100110000000100000010101001001110010000100001001001100100001100101110111101110010001111101100001001011111000111001001000100100011010111011011101011101101100100000110011101101011000100111100...', 'output': ['729\\n64 203 216 2 204 73 141 80 164 115 157 320 391 316 193 100 36 227 89 295 19 241 441 506 514 508 55 366 268 77 12 463 497 68 315 397 433 396 415 291 382 371 207 352 228 531 530 96 523 513 119 317 495 486 503 522 205 501 502 488 471 355 195 229 305 57 449 454 458 515 434 158 110 401 540 537 377 527 535 526 194 414 202 544 534 545 551 559 362 542 547 430 436 419 1 139 386 62 208 331 395 403 180 240 25 65 148 30 263 349 152 384 351 248 399 116 170 126 439 285 338 462 438 442 484 473 479 378 477 409 353 47...', '729\\n64 203 216 2 204 73 141 80 164 115 157 320 391 316 193 100 36 227 89 295 19 241 441 506 514 508 55 366 268 77 12 463 497 68 315 397 433 396 415 291 382 371 207 352 228 531 530 96 523 513 119 317 495 486 503 522 205 501 502 488 471 355 195 229 305 57 449 454 458 515 434 158 110 401 540 537 377 527 535 526 194 414 202 544 534 545 551 559 362 542 547 430 436 419 1 139 386 62 208 331 395 403 180 240 25 65 148 30 263 349 152 384 351 248 399 116 170 126 439 285 338 462 438 442 484 473 479 378 477 409 353 47 ...']}, {'input': '1111101000111001110101001110001011100101111110001101010101100010011011011000001010110100111101101000101000010110011111110001011110110011110010010101110000111001100110001000001010001001111110110101100000111010110000011110100001011101101000000001111111100100100010010101101001010110000101101111001001110100011101010110111010011101010100011110111110101001000010100010111000111000101001000011100010111110100011100011110011011010001000100110010011001011101100110110101101111010010000111010010110011100010101110001010...', 'output': ['1000\\n803 376 98 675 492 852 505 511 527 504 42 108 129 664 120 628 105 777 33 429 704 693 47 317 722 679 724 518 727 556 78 493 797 983 303 717 514 414 698 840 168 209 667 146 937 706 594 681 144 207 824 890 863 897 649 631 555 981 32 40 189 164 888 607 132 560 254 274 842 93 867 373 816 583 351 159 472 613 925 841 892 634 4 592 249 117 440 684 669 445 423 813 932 584 316 975 294 521 882 496 44 523 421 87 790 369 620 894 702 916 2 494 901 232 785 574 67 729 197 968 289 402 687 943 689 360 292 375 520 28 67...', '1000\\n803 376 98 675 492 852 505 511 527 504 42 108 129 664 120 628 105 777 33 429 704 693 47 317 722 679 724 518 727 556 78 493 797 983 303 717 514 414 698 840 168 209 667 146 937 706 594 681 144 207 824 890 863 897 649 631 555 981 32 40 189 164 888 607 132 560 254 274 842 93 867 373 816 583 351 159 472 613 925 841 892 634 4 592 249 117 440 684 669 445 423 813 932 584 316 975 294 521 882 496 44 523 421 87 790 369 620 894 702 916 2 494 901 232 785 574 67 729 197 968 289 402 687 943 689 360 292 375 520 28 6...']}, {'input': '1011001111111111111111000000001001000000001111000000000000000111111111111111111110110000000111100000000000111110001111111110111111111111111111111111111111111111111111111111111111111111110010000011110111000011111111011100001111010001111111000000000000000000000000011010011111100010011110000000010000000000011110000000000000000111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000110000111110000000000011111111100010110000101111001111111111110000000000000...', 'output': ['1000\\n302 304 303 299 298 301 300 312 311 310 309 308 307 306 305 282 283 285 284 287 286 288 289 292 293 291 290 295 294 296 297 269 268 267 273 272 270 271 274 275 276 277 281 280 279 278 266 265 264 263 260 259 261 262 258 257 256 255 254 253 251 252 353 355 354 356 357 359 358 348 347 346 345 351 352 350 349 366 367 365 364 360 361 362 363 372 373 375 374 370 371 369 368 335 336 333 334 329 330 332 331 342 341 344 343 337 338 340 339 314 313 315 316 317 318 319 320 324 323 322 321 325 326 327 328 390 38...', '1000\\n302 304 303 299 298 301 300 312 311 310 309 308 307 306 305 282 283 285 284 287 286 288 289 292 293 291 290 295 294 296 297 269 268 267 273 272 270 271 274 275 276 277 281 280 279 278 266 265 264 263 260 259 261 262 258 257 256 255 254 253 251 252 353 355 354 356 357 359 358 348 347 346 345 351 352 350 349 366 367 365 364 360 361 362 363 372 373 375 374 370 371 369 368 335 336 333 334 329 330 332 331 342 341 344 343 337 338 340 339 314 313 315 316 317 318 319 320 324 323 322 321 325 326 327 328 390 3...']}, {'input': '0101010001101110010110110101101000111011100100001000010110100000100100111001101111010110000101010111101100110010100110100011111001000111010001011100011100110110101101000100100101111001001110000010101001010101011000011000010110011111110001100001011011010010011110110010011100110100110001010101111000000100110111111010111100100101100111110000011101001100100101110011110100101011001000111001101010101010101111110101010010010001010100110110110010010011011110000100000111000011111000011010101001010101010001010101110...', 'output': ['1000\\n461 47 859 683 246 143 822 591 356 425 995 843 359 561 481 421 646 513 809 174 469 260 913 155 391 150 870 651 117 231 270 848 601 38 406 564 163 622 10 442 433 914 188 157 593 53 512 276 372 537 158 901 389 196 327 315 871 160 148 645 248 957 899 743 612 769 456 162 556 623 826 501 706 961 203 225 435 169 964 759 570 937 67 127 385 46 955 735 491 161 220 111 817 888 40 390 86 360 388 13 547 238 190 723 109 345 566 264 981 844 383 44 447 419 948 189 628 632 794 128 659 98 905 770 596 819 16 607 410 7...', '1000\\n461 47 859 683 246 143 822 591 356 425 995 843 359 561 481 421 646 513 809 174 469 260 913 155 391 150 870 651 117 231 270 848 601 38 406 564 163 622 10 442 433 914 188 157 593 53 512 276 372 537 158 901 389 196 327 315 871 160 148 645 248 957 899 743 612 769 456 162 556 623 826 501 706 961 203 225 435 169 964 759 570 937 67 127 385 46 955 735 491 161 220 111 817 888 40 390 86 360 388 13 547 238 190 723 109 345 566 264 981 844 383 44 447 419 948 189 628 632 794 128 659 98 905 770 596 819 16 607 410 71...']}, {'input': '1111010001000101110100001001010111111101010101000100110100110101111001111111111110111111011110110111010100100110001100110111101011111110111010000010110100110111101111110101111111100111111101110010000010000100000000000000101000000111101010001101000100111011100111111011001110100010110101101101111011101111111101111110111011110101010101011111010101011011111111111001001010110011011100111110011101011000000010100000000010000000001001000010000100000000001000000000010000000000000000000000000000100000000010010000000...', 'output': ['1000\\n426 425 406 428 427 415 429 345 418 417 411 420 419 416 422 409 281 274 408 407 412 414 410 403 314 404 402 348 400 367 338 460 445 452 464 461 459 462 455 456 457 449 432 453 454 431 444 430 442 438 447 446 443 448 440 421 441 436 373 424 405 306 490 481 489 492 476 493 491 487 483 488 486 471 482 450 484 465 473 477 284 480 478 479 475 470 423 472 468 467 433 466 458 499 508 509 507 506 504 500 505 501 497 463 498 474 496 495 485 514 516 511 515 510 512 513 439 522 518 520 521 517 502 519 469 374 35...', '1000\\n426 425 406 428 427 415 429 345 418 417 411 420 419 416 422 409 281 274 408 407 412 414 410 403 314 404 402 348 400 367 338 460 445 452 464 461 459 462 455 456 457 449 432 453 454 431 444 430 442 438 447 446 443 448 440 421 441 436 373 424 405 306 490 481 489 492 476 493 491 487 483 488 486 471 482 450 484 465 473 477 284 480 478 479 475 470 423 472 468 467 433 466 458 499 508 509 507 506 504 500 505 501 497 463 498 474 496 495 485 514 516 511 515 510 512 513 439 522 518 520 521 517 502 519 469 374 3...']}, {'input': '0111111011111111000001100001010110010010001111101101011100111101010101111110001110100101001100000011101100001011011111000010011001111100001100001001000101011011111000101000011010000110101101011000111110101010101010110101011001100101101101000111011100010001100000001001001000111101001100101000001100110100000011110001101111100011000010000110100101110011011001110001110010110011101100011000001011011011001110111010111111011011101010010111100001101110010011001001101001101101011111010111100110001110100110110000000...', 'output': ['1000\\n562 87 558 411 367 248 156 715 544 364 148 197 306 812 826 803 143 882 904 861 769 620 5 608 856 349 212 329 603 45 175 240 909 921 704 386 280 297 478 155 960 963 73 146 957 598 84 309 537 376 187 10 317 344 440 680 189 142 385 152 913 864 145 979 940 150 400 844 468 382 615 981 905 502 266 984 983 37 132 207 447 752 633 435 258 930 636 437 379 333 34 972 978 299 958 17 31 968 967 710 898 81 300 843 950 661 497 106 203 900 891 733 180 820 721 530 581 251 337 694 352 814 810 32 164 851 786 839 11 378...', '999\\n581 106 562 435 376 251 164 721 558 367 150 203 309 814 843 810 145 891 905 864 803 633 10 615 861 352 240 333 608 73 180 248 913 930 710 400 297 299 497 156 963 967 81 148 958 603 87 317 544 379 189 17 329 349 447 694 197 143 386 155 921 882 142 978 940 146 385 844 468 382 598 979 904 502 266 983 981 37 132 207 440 752 620 411 258 909 636 437 364 306 34 968 972 84 187 661 960 950 957 5 704 280 898 826 31 300 45 478 175 900 856 715 820 733 537 530 769 344 337 680 152 812 32 212 851 786 839 11 378 673 ...', '1000\\n562 87 558 411 367 248 156 715 544 364 148 197 306 812 826 803 143 882 904 861 769 620 5 608 856 349 212 329 603 45 175 240 909 921 704 386 280 297 478 155 960 963 73 146 957 598 84 309 537 376 187 10 317 344 440 680 189 142 385 152 913 864 145 979 940 150 400 844 468 382 615 981 905 502 266 984 983 37 132 207 447 752 633 435 258 930 636 437 379 333 34 972 978 299 958 17 31 968 967 710 898 81 300 843 950 661 497 106 203 900 891 733 180 820 721 530 581 251 337 694 352 814 810 32 164 851 786 839 11 378 ...', '999\\n581 106 562 435 376 251 164 721 558 367 150 203 309 814 843 810 145 891 905 864 803 633 10 615 861 352 240 333 608 73 180 248 913 930 710 400 297 299 497 156 963 967 81 148 958 603 87 317 544 379 189 17 329 349 447 694 197 143 386 155 921 882 142 978 940 146 385 844 468 382 598 979 904 502 266 983 981 37 132 207 440 752 620 411 258 909 636 437 364 306 34 968 972 84 187 661 960 950 957 5 704 280 898 826 31 300 45 478 175 900 856 715 820 733 537 530 769 344 337 680 152 812 32 212 851 786 839 11 378 673 8...']}, {'input': '0\\n', 'output': ['2\\n1 2\\n', '2\\n1 2', '2\\n1 2 ', '2\\n1 2\\n', '2\\n1 2 \\n', '2\\n1 2 ', '2\\n1 2 \\n']}, {'input': '00\\n', 'output': ['3\\n1 2 3\\n', '3\\n1 2 3 ', '3\\n1 2 3 ', '3\\n1 2 3 \\n', '3\\n1 2 3\\n', '3\\n1 2 3 \\n', '3\\n1 2 3']}, {'input': '11010\\n', 'output': ['4\\n3 1 4 2', '4\\n3 1 4 2 \\n', '4\\n3 1 4 2 \\n', '4\\n3 1 4 2\\n', '4\\n3 1 4 2 ', '4\\n3 1 4 2 ', '4\\n3 1 4 2\\n']}, {'input': '111000\\n', 'output': ['5\\n2 1 4 5 3\\n', '5\\n2 1 4 5 3 ', '5\\n2 1 4 5 3 ', '5\\n2 1 4 5 3\\n', '5\\n2 1 4 5 3', '5\\n2 1 4 5 3 \\n', '5\\n2 1 4 5 3 \\n']}, {'input': '000100010\\n', 'output': ['6\\n1 2 4 5 3 6 ', '6\\n1 2 4 5 3 6\\n', '6\\n1 2 4 5 3 6 ', '6\\n1 2 4 5 3 6', '6\\n1 2 4 5 3 6 \\n', '6\\n1 2 4 5 3 6 \\n', '6\\n1 2 4 5 3 6\\n']}, {'input': '11010011110010\\n', 'output': ['7\\n4 6 3 7 1 2 5 ', '7\\n4 6 3 7 1 2 5 \\n', '7\\n4 6 3 7 1 2 5', '7\\n4 6 3 7 1 2 5\\n', '7\\n4 6 3 7 1 2 5 \\n', '7\\n4 6 3 7 1 2 5\\n', '7\\n4 6 3 7 1 2 5 ']}, {'input': '0010100011010010\\n', 'output': ['8\\n3 6 1 4 2 8 5 7 \\n', '8\\n3 6 1 4 2 8 5 7', '8\\n3 6 1 4 2 8 5 7\\n', '8\\n3 6 1 4 2 8 5 7\\n', '8\\n3 6 1 4 2 8 5 7 \\n', '8\\n3 6 1 4 2 8 5 7 ', '8\\n3 6 1 4 2 8 5 7 ']}, {'input': '0101110010110101010\\n', 'output': ['9\\n1 7 5 3 9 4 2 6 8 \\n', '9\\n1 7 5 3 9 4 2 6 8\\n', '9\\n1 7 5 3 9 4 2 6 8 \\n', '9\\n1 7 5 3 9 4 2 6 8\\n', '9\\n1 7 5 3 9 4 2 6 8 ', '9\\n1 7 5 3 9 4 2 6 8', '9\\n1 7 5 3 9 4 2 6 8 ']}, {'input': '01001010111101110000110\\n', 'output': ['11\\n2 4 3 8 5 6 11 10 9 7 1', '11\\n2 4 3 8 5 6 11 10 9 7 1 \\n', '10\\n3 5 4 9 6 10 7 8 1 2\\n', '11\\n2 4 3 8 5 6 11 10 9 7 1 ', '10\\n3 5 4 9 6 10 7 8 1 2 ', '10\\n3 5 4 9 6 10 7 8 1 2 \\n', '11\\n2 4 3 8 5 6 11 10 9 7 1\\n', '10\\n3 5 4 9 6 10 7 8 1 2 ', '10\\n3 5 4 9 6 10 7 8 1 2\\n', '11\\n2 4 3 8 5 6 11 10 9 7 1 ', '10\\n3 5 4 9 6 10 7 8 1 2 \\n']}, {'input': '1110010110100000111100011\\n', 'output': ['11\\n7 1 8 11 6 3 4 2 5 10 9\\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 ', '11\\n7 1 8 11 6 3 4 2 5 10 9 \\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 \\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 ', '11\\n7 1 8 11 6 3 4 2 5 10 9\\n', '11\\n7 1 8 11 6 3 4 2 5 10 9']}, {'input': '01001010100100100001100100111\\n', 'output': ['12\\n7 4 11 6 3 12 1 5 2 9 8 10\\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 ', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 ', '12\\n7 4 11 6 3 12 1 5 2 9 8 10', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 \\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 \\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10\\n']}, {'input': '00110101011110101110011010101110101\\n', 'output': ['13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 ', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6\\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 \\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 ', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 \\n', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 ', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 \\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6\\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 ', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6\\n']}, {'input': '000001101100100011101110100100111100\\n', 'output': ['14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8\\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8\\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 \\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 ', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 \\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 ']}, {'input': '01111110001111111000101010010110111011\\n', 'output': ['15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4\\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 \\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 ', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 \\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4\\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 ']}, {'input': '01001100110110010110001011011000010100000010011100110111010110001110001110111011000101000\\n', 'output': ['25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 \\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 ', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11\\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 \\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 ', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11\\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11']}, {'input': '001011101110010101101010010101101101101110010001111110101110101100001001101011110010010001001101101000111111111100000101001101010101101101111101101100011111101100000101110011000100000011001011001101000110111111010001110100111100\\n', 'output': ['51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13\\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 ', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 \\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 \\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13\\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 ']}, {'input': '00101000111111010000110101111101100111010011011011011100101101110110100011100101001010001111101011110101010111001001101001111111001000111111011010110110110000000100111100111110000110011011000100100011001110000111101110111001110111101110011000111000011000101011111000001010101100001110011001100011010100100110101010111111100111101001100100001101110010101000111010001011000100101001100111101100011100100000010101001010111011110101101001011100011011010011011111010001101110010011000010010000111\\n', 'output': ['92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 \\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 ', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 \\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47\\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 ', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47\\n']}, {'input': '0100000111110101110110101011010110001111000101011100011000111100100111001101100100110110001001001100101111001000111101100100011011100101001001011110001011000001110110100011011001010010101000001010001100000111101111011000010111011011011001101110110011111010010001100100010111110100011001010010000111000111001011011001100010000101101011110101101011111001011100001101101000001110110110010011011110000000111001101011101111000011101000101111110110100010110111000101101000010101011101101110000011010101101101101110100...', 'output': ['212\\n31 9 190 84 128 159 137 197 67 144 86 11 69 129 7 79 133 210 102 14 117 44 177 35 205 20 50 127 99 155 107 150 207 97 91 187 123 167 193 114 141 103 152 109 209 24 100 188 172 15 212 194 64 206 72 45 125 94 96 110 134 48 161 130 131 180 145 132 200 27 38 170 63 52 196 104 151 203 184 164 83 166 126 157 3 149 93 90 70 181 32 179 16 65 105 143 18 23 1 115 165 122 39 171 60 34 153 183 162 87 154 178 2 4 158 160 140 121 199 40 30 138 118 85 116 47 41 119 95 80 76 75 42 186 53 13 57 163 211 173 108 208 176 ...', '212\\n31 9 190 84 128 159 137 197 67 144 86 11 69 129 7 79 133 210 102 14 117 44 177 35 205 20 50 127 99 155 107 150 207 97 91 187 123 167 193 114 141 103 152 109 209 24 100 188 172 15 212 194 64 206 72 45 125 94 96 110 134 48 161 130 131 180 145 132 200 27 38 170 63 52 196 104 151 203 184 164 83 166 126 157 3 149 93 90 70 181 32 179 16 65 105 143 18 23 1 115 165 122 39 171 60 34 153 183 162 87 154 178 2 4 158 160 140 121 199 40 30 138 118 85 116 47 41 119 95 80 76 75 42 186 53 13 57 163 211 173 108 208 176...']}, {'input': '1010001111010111101001100111111101010001111010101100000011010011010010110110100010010111100101001111001010010110101011110011100011010100110011011001011100100110001101010010110011001100101011100110011100111010001101001011110001000100001011110010101011011010101001110110010010101100011111001000011001011001011001111101101110100101011110100100100010011110101011101000000111100100110010110110011011000110001110010100111111010001011010111010000011111000111100100001100001011101110000001011101011110110100101001111000...', 'output': ['370\\n133 105 262 192 326 368 241 47 28 237 114 282 244 108 272 203 54 163 365 370 330 64 160 267 63 91 314 334 178 155 242 332 209 20 263 120 315 106 58 233 165 158 347 264 245 24 180 246 289 151 182 42 84 212 110 349 16 191 79 356 93 275 354 153 276 83 85 70 220 131 156 278 117 44 15 187 140 55 72 215 284 344 366 291 186 62 35 240 227 268 257 118 125 355 298 166 81 197 45 312 211 2 309 351 176 177 31 149 66 185 134 4 26 251 248 281 200 195 287 162 41 295 113 8 127 308 7 102 121 336 6 269 67 128 94 193 350 ...', '370\\n133 105 262 192 326 368 241 47 28 237 114 282 244 108 272 203 54 163 365 370 330 64 160 267 63 91 314 334 178 155 242 332 209 20 263 120 315 106 58 233 165 158 347 264 245 24 180 246 289 151 182 42 84 212 110 349 16 191 79 356 93 275 354 153 276 83 85 70 220 131 156 278 117 44 15 187 140 55 72 215 284 344 366 291 186 62 35 240 227 268 257 118 125 355 298 166 81 197 45 312 211 2 309 351 176 177 31 149 66 185 134 4 26 251 248 281 200 195 287 162 41 295 113 8 127 308 7 102 121 336 6 269 67 128 94 193 350...']}, {'input': '0001001111011100100111110001100101101111100011011011010001100011101010110010011101001100001110110110101100001111001111000111010010001111001001100101010000110110000111011001001000101011001101100110101010010111101100110101110001001010001110111111010100010011000010101110000100100101010010101011011110010101101101101010111010000000110110110101100000011010101001100011111010000111010001011100100010111111010100101010111001101000010100111100111000010110111110011001001111110101010000101001111101011011101001110000110...', 'output': ['650\\n196 334 90 337 611 482 289 433 419 339 540 234 294 392 600 148 415 75 199 139 525 166 210 32 504 163 567 411 360 555 49 519 106 43 72 291 648 353 399 249 410 213 98 469 552 391 581 367 452 439 615 420 223 649 464 488 155 27 247 297 135 565 296 222 143 590 354 531 636 193 216 335 91 229 471 475 311 169 378 516 571 298 243 454 523 604 608 154 344 330 352 290 638 64 314 153 48 24 572 493 231 506 192 528 333 85 541 502 121 478 338 77 585 259 147 232 84 446 481 470 273 158 583 227 546 359 432 174 537 126 6...', '649\\n199 335 87 338 612 483 290 438 419 343 540 234 296 397 599 150 417 75 200 139 527 165 210 32 505 161 571 415 364 565 53 519 100 39 73 294 642 354 399 251 403 216 98 469 555 391 575 367 448 439 615 421 224 649 463 493 158 27 246 298 135 567 297 223 144 588 355 532 619 196 222 337 96 231 472 476 303 170 369 508 572 302 240 459 523 606 608 155 344 323 352 291 641 64 320 151 47 23 573 495 232 506 192 528 333 86 545 500 109 477 339 77 586 258 146 233 84 446 482 471 272 159 585 227 546 359 425 173 538 125 72...', '650\\n196 334 90 337 611 482 289 433 419 339 540 234 294 392 600 148 415 75 199 139 525 166 210 32 504 163 567 411 360 555 49 519 106 43 72 291 648 353 399 249 410 213 98 469 552 391 581 367 452 439 615 420 223 649 464 488 155 27 247 297 135 565 296 222 143 590 354 531 636 193 216 335 91 229 471 475 311 169 378 516 571 298 243 454 523 604 608 154 344 330 352 290 638 64 314 153 48 24 572 493 231 506 192 528 333 85 541 502 121 478 338 77 585 259 147 232 84 446 481 470 273 158 583 227 546 359 432 174 537 126 67...', '649\\n199 335 87 338 612 483 290 438 419 343 540 234 296 397 599 150 417 75 200 139 527 165 210 32 505 161 571 415 364 565 53 519 100 39 73 294 642 354 399 251 403 216 98 469 555 391 575 367 448 439 615 421 224 649 463 493 158 27 246 298 135 567 297 223 144 588 355 532 619 196 222 337 96 231 472 476 303 170 369 508 572 302 240 459 523 606 608 155 344 323 352 291 641 64 320 151 47 23 573 495 232 506 192 528 333 86 545 500 109 477 339 77 586 258 146 233 84 446 482 471 272 159 585 227 546 359 425 173 538 125 7...']}, {'input': '0000011110110111001011110010010010111111000110110100011111010010101000001110101000110011010100001011101010100010011100011010001100010010100011101000010011110100110100000110011000100111101001000000011110100000010101011101011100110011011100000001111100110101111100111000111110010000011101100110100101010101110010101110001001110011111000111110111110110100100001000011000011111011001101010011010000110110011100110111000001010110000011111101101110011011100000111111100100011000010101010111010101010010000010010101010...', 'output': ['2019\\n362 1584 1707 87 776 172 383 1440 1519 1295 1195 512 1411 290 968 38 1913 563 892 1264 1825 1344 1159 236 164 57 856 1928 1568 929 1822 293 291 554 28 461 1504 1134 317 1064 1588 335 1829 878 862 675 1482 705 1520 748 356 485 643 768 1251 994 1471 1041 1665 1542 1725 997 875 1175 1145 1778 1905 660 469 1259 1693 1286 735 865 1119 694 1142 1277 1889 1260 1596 1563 1934 1268 1844 959 115 672 601 758 823 1439 1187 1240 1313 1301 1386 212 59 904 410 1740 1843 1943 11 437 640 614 336 216 1405 1178 596 376...', '2019\\n362 1584 1707 87 776 172 383 1440 1519 1295 1195 512 1411 290 968 38 1913 563 892 1264 1825 1344 1159 236 164 57 856 1928 1568 929 1822 293 291 554 28 461 1504 1134 317 1064 1588 335 1829 878 862 675 1482 705 1520 748 356 485 643 768 1251 994 1471 1041 1665 1542 1725 997 875 1175 1145 1778 1905 660 469 1259 1693 1286 735 865 1119 694 1142 1277 1889 1260 1596 1563 1934 1268 1844 959 115 672 601 758 823 1439 1187 1240 1313 1301 1386 212 59 904 410 1740 1843 1943 11 437 640 614 336 216 1405 1178 596 376 ...']}, {'input': '1010010011111000110001110111001000110011110001110100010101001000011110010001111000011100000110001111010000111011110100000000111000000001101010001011101010101011011101011011000100001110000001110100000101110001110001101101010101100010111101010111001011110100001000011000011000010011000111011010011011111100110110110111011100001101001111100101001010101110110101010101011001101010100010011000001110101000111100101110010101011101001010110110111101001001010010010010100101111100010011000101011101010011111010011001101...', 'output': ['2218\\n1650 1628 1568 2034 2021 2 340 367 301 38 440 734 1969 1930 1317 1739 412 117 497 867 562 73 891 1375 508 2138 2159 138 152 1048 307 906 2191 2136 1684 670 1850 55 921 1267 1694 2102 844 201 1216 1900 1647 408 1680 58 1175 214 445 647 1617 1109 967 1888 2120 1407 597 492 775 1514 1623 1649 1058 868 1217 711 1186 1719 1437 2125 1665 1213 365 139 1236 1620 764 2035 881 1678 624 1239 33 490 225 1639 1204 1218 1901 680 1289 819 330 2187 547 574 1689 580 131 1864 710 129 342 1677 1162 2112 286 416 1945 282...', '2217\\n1655 1627 1563 2033 2021 2 341 371 301 33 434 732 1969 1925 1311 1733 405 111 498 861 561 73 889 1376 508 2138 2160 135 141 1034 307 905 2192 2129 1683 664 1839 50 922 1265 1700 2100 836 198 1217 1899 1644 394 1680 58 1172 215 437 649 1602 1108 967 1888 2114 1408 599 493 779 1520 1625 1647 1053 865 1218 710 1186 1718 1433 2119 1663 1216 367 138 1238 1606 745 2034 878 1672 616 1241 30 488 224 1636 1202 1226 1900 667 1288 818 323 2181 538 569 1689 577 133 1862 709 131 342 1670 1161 2112 271 416 1944 268...', '2218\\n1650 1628 1568 2034 2021 2 340 367 301 38 440 734 1969 1930 1317 1739 412 117 497 867 562 73 891 1375 508 2138 2159 138 152 1048 307 906 2191 2136 1684 670 1850 55 921 1267 1694 2102 844 201 1216 1900 1647 408 1680 58 1175 214 445 647 1617 1109 967 1888 2120 1407 597 492 775 1514 1623 1649 1058 868 1217 711 1186 1719 1437 2125 1665 1213 365 139 1236 1620 764 2035 881 1678 624 1239 33 490 225 1639 1204 1218 1901 680 1289 819 330 2187 547 574 1689 580 131 1864 710 129 342 1677 1162 2112 286 416 1945 28...', '2217\\n1655 1627 1563 2033 2021 2 341 371 301 33 434 732 1969 1925 1311 1733 405 111 498 861 561 73 889 1376 508 2138 2160 135 141 1034 307 905 2192 2129 1683 664 1839 50 922 1265 1700 2100 836 198 1217 1899 1644 394 1680 58 1172 215 437 649 1602 1108 967 1888 2114 1408 599 493 779 1520 1625 1647 1053 865 1218 710 1186 1718 1433 2119 1663 1216 367 138 1238 1606 745 2034 878 1672 616 1241 30 488 224 1636 1202 1226 1900 667 1288 818 323 2181 538 569 1689 577 133 1862 709 131 342 1670 1161 2112 271 416 1944 26...']}, {'input': '1100110011010110111000000110011001001111010101101001000111011001111100001001101101001111000100100001110110000101111010010011010110001010011110001000101101010110111100101010100101110110111001000110111000000001100110101010111011001011001101010100001001011010101010011110110110100110101111001101100001000001100101001101111101010010111110100010111010010010111111100010111100110111101111010010110000111100011001011101010100110101010001011010001011110100011110100110011101100000000010101010100111000110000011101010001...', 'output': ['7418\\n4632 5020 3554 2651 3931 4783 477 1553 3687 1968 5534 4702 7181 3818 6251 3878 2962 7215 3521 3228 5976 2883 519 4650 1710 6523 22 1480 3735 5572 3641 1538 2207 1640 2638 3904 3028 5382 53 2549 4737 3839 175 2665 6345 1459 2813 7405 3370 7199 3592 3355 6151 6609 5596 801 1734 4601 692 2502 5815 2178 4147 2410 7403 4284 6956 1162 7167 7095 1696 2940 3343 4059 3243 5999 6616 2710 2902 147 2090 827 5599 2495 3791 261 5487 5663 4945 2242 5053 4854 430 5411 5186 2503 2353 3522 6120 3589 886 4894 1946 7286...', '7418\\n4632 5020 3554 2651 3931 4783 477 1553 3687 1968 5534 4702 7181 3818 6251 3878 2962 7215 3521 3228 5976 2883 519 4650 1710 6523 22 1480 3735 5572 3641 1538 2207 1640 2638 3904 3028 5382 53 2549 4737 3839 175 2665 6345 1459 2813 7405 3370 7199 3592 3355 6151 6609 5596 801 1734 4601 692 2502 5815 2178 4147 2410 7403 4284 6956 1162 7167 7095 1696 2940 3343 4059 3243 5999 6616 2710 2902 147 2090 827 5599 2495 3791 261 5487 5663 4945 2242 5053 4854 430 5411 5186 2503 2353 3522 6120 3589 886 4894 1946 7286 ...']}, {'input': '0110101100001110100011110111011101010011010111000111001101001011101101011111111100010000010111110101010010011101001010101111001001001111001110001100000110001110010111001111000111101011110010101101111101110101010101101011111000000101111101110101101110010010011111011100100011010010110001101101000100110101111001010100111101000111100000100000111000110100000010001110110001101101001011110000010110111111011101010111010100110101000100011011101101100000010010100111000000011011000111101001001111000101101011101101110...', 'output': ['10213\\n3257 5843 4790 837 1041 1570 4550 6734 2871 1867 9081 4719 3302 261 3463 1960 5964 178 2414 8695 2233 1491 6503 1221 5638 8899 819 336 79 1389 9533 835 3763 4296 5479 2178 5311 8108 320 8558 8743 9757 9108 7134 3175 6896 8591 6786 1076 4295 8929 354 4933 2921 9333 872 6587 4784 3624 7438 2506 6588 5267 2585 4527 8422 812 7186 2442 4116 6111 5193 987 566 5137 2138 3499 9270 7829 3899 1687 2575 2554 6824 3744 1002 4398 3854 6436 5570 375 7663 435 4242 76 4153 4918 7796 9646 1344 3565 9521 1748 986 544...', '10213\\n3257 5843 4790 837 1041 1570 4550 6734 2871 1867 9081 4719 3302 261 3463 1960 5964 178 2414 8695 2233 1491 6503 1221 5638 8899 819 336 79 1389 9533 835 3763 4296 5479 2178 5311 8108 320 8558 8743 9757 9108 7134 3175 6896 8591 6786 1076 4295 8929 354 4933 2921 9333 872 6587 4784 3624 7438 2506 6588 5267 2585 4527 8422 812 7186 2442 4116 6111 5193 987 566 5137 2138 3499 9270 7829 3899 1687 2575 2554 6824 3744 1002 4398 3854 6436 5570 375 7663 435 4242 76 4153 4918 7796 9646 1344 3565 9521 1748 986 544 ...']}, {'input': '1111011001100010111011001011110101010001011110011110111111011011100001100011011100001011100011001100111100010011011110110000000010101101101110101111000001100101101100101110101001010001101110010001000001011011101101111000101110100000110111001000110100100101110110101010110100011000110100010110100110110010111010100000010111011100001010110010010001001010010100111100110000111010111101100010110111101010011111001111000100100000010101010101111011101110101000001111011111010100011110000000110100110011000101110010101...', 'output': ['28140\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 9...', '28141\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 93...', '28141\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 9...', '28140\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 93...']}, {'input': '1111101001011100111111010011110010010001100110001010110001010110111000000111001110010110010110011001111010101011101111001101011101110000001111100010100110011011110101001011111010000000010001011100011110001100110110011110000111110011111110001011011111110010010100100111011011101111001000011000010010101101001001101100001101000111010100110111100010010001001101001001111010101010001010111100000010101101110101110000101111110110000100011010001110100111100100000000100111011001001100110101110101010111111110110100110...', 'output': ['47704\\n37487 27108 44381 27514 24599 9507 5852 32084 27625 26378 23042 29571 29784 7709 30085 15014 38933 37738 18336 19964 2298 8457 42652 39496 42021 31693 14015 47310 1082 27761 12759 11459 36566 11211 36354 2008 40528 34409 17391 13576 1709 45503 7439 40964 3038 9177 373 46302 38315 46960 34302 11962 20614 9258 41957 2575 4968 35461 22601 16686 40555 39845 35977 16212 36860 32352 6373 15421 849 6836 22105 4599 32307 30310 42044 11752 18020 4260 4739 22652 41404 26356 38657 43552 5688 47101 810 46904 42...', '47704\\n37487 27108 44381 27514 24599 9507 5852 32084 27625 26378 23042 29571 29784 7709 30085 15014 38933 37738 18336 19964 2298 8457 42652 39496 42021 31693 14015 47310 1082 27761 12759 11459 36566 11211 36354 2008 40528 34409 17391 13576 1709 45503 7439 40964 3038 9177 373 46302 38315 46960 34302 11962 20614 9258 41957 2575 4968 35461 22601 16686 40555 39845 35977 16212 36860 32352 6373 15421 849 6836 22105 4599 32307 30310 42044 11752 18020 4260 4739 22652 41404 26356 38657 43552 5688 47101 810 46904 422...', '47703\\n37487 27097 44371 27512 24555 9507 5851 32079 27620 26362 23034 29536 29784 7709 30083 15014 38933 37714 18336 19959 2298 8453 42652 39496 42021 31693 14012 47310 1082 27761 12759 11459 36563 11190 36354 2008 40528 34409 17391 13576 1709 45503 7439 40946 3038 9116 363 46302 38315 46960 34295 11937 20614 9258 41944 2575 4942 35457 22589 16686 40555 39845 35977 16212 36829 32352 6349 15421 849 6836 22089 4599 32307 30272 42040 11752 17994 4260 4739 22652 41374 26356 38652 43538 5688 47050 802 46904 42...', '47703\\n37487 27097 44371 27512 24555 9507 5851 32079 27620 26362 23034 29536 29784 7709 30083 15014 38933 37714 18336 19959 2298 8453 42652 39496 42021 31693 14012 47310 1082 27761 12759 11459 36563 11190 36354 2008 40528 34409 17391 13576 1709 45503 7439 40946 3038 9116 363 46302 38315 46960 34295 11937 20614 9258 41944 2575 4942 35457 22589 16686 40555 39845 35977 16212 36829 32352 6349 15421 849 6836 22089 4599 32307 30272 42040 11752 17994 4260 4739 22652 41374 26356 38652 43538 5688 47050 802 46904 422...']}, {'input': '0111100111011010101101001110111111000001110000101010001100110101010110001010100110001101100110011001101101001110101110010111010110001010100101000111110100001011110101100110010110110110010110001101100000100110111001011111100100001101001100001011111000011110001101101001011110101101010010010100101100100101100000110110011100001000010001111110010011010111011011011011101100100111100101111110101110100011101101010000100001111001101101000001100101011001101000010111111101101011100011010111011001101010010101110010111...', 'output': ['87919\\n26100 48796 75498 71615 13065 84075 48146 34244 64621 25801 78019 68925 51779 54918 46135 42091 17533 9268 72072 85828 86298 45643 37741 55965 83662 70731 64386 24966 66523 14203 73152 59441 53458 2163 35789 84859 56576 74854 38950 71388 39702 40375 40606 1011 42914 19779 36544 28166 36447 13398 83951 18832 27007 66001 60328 40901 68980 76321 46821 5549 1496 18445 25841 31230 74836 34599 35940 41184 38272 64659 62295 7568 33908 54864 68145 59720 33494 22557 59875 45992 32566 74594 67094 42440 80813 7...', '87919\\n26100 48796 75498 71615 13065 84075 48146 34244 64621 25801 78019 68925 51779 54918 46135 42091 17533 9268 72072 85828 86298 45643 37741 55965 83662 70731 64386 24966 66523 14203 73152 59441 53458 2163 35789 84859 56576 74854 38950 71388 39702 40375 40606 1011 42914 19779 36544 28166 36447 13398 83951 18832 27007 66001 60328 40901 68980 76321 46821 5549 1496 18445 25841 31230 74836 34599 35940 41184 38272 64659 62295 7568 33908 54864 68145 59720 33494 22557 59875 45992 32566 74594 67094 42440 80813 ...', '87920\\n26039 48758 75494 71599 13045 84053 48134 34238 64570 25763 78003 68897 51768 54913 46084 42063 17491 9256 72065 85731 86273 45634 37724 55924 83621 70705 64359 24947 66491 14199 73133 59409 53446 2158 35767 84801 56499 74848 38859 71359 39683 40311 40587 997 42895 19767 36521 28161 36404 13360 83936 18782 26990 65995 60263 40781 68956 76292 46810 5533 1457 18407 25822 31205 74748 34558 35900 41156 38221 64634 62271 7549 33849 54851 68123 59693 33422 22510 59840 45987 32538 74587 67049 42408 80777 79...', '87920\\n26039 48758 75494 71599 13045 84053 48134 34238 64570 25763 78003 68897 51768 54913 46084 42063 17491 9256 72065 85731 86273 45634 37724 55924 83621 70705 64359 24947 66491 14199 73133 59409 53446 2158 35767 84801 56499 74848 38859 71359 39683 40311 40587 997 42895 19767 36521 28161 36404 13360 83936 18782 26990 65995 60263 40781 68956 76292 46810 5533 1457 18407 25822 31205 74748 34558 35900 41156 38221 64634 62271 7549 33849 54851 68123 59693 33422 22510 59840 45987 32538 74587 67049 42408 80777 7...']}, {'input': '1001010101001001000110110111011111011111111001111010101101101100100011010010100101000111111110010000010000000111000000110111010010011111010100010010001100111011101110101010111001101111011100111001111010111000010000110111110111101011111110110111110111001111111111111111111111111011111110001111011110000100100011011111110100000100100010111111010100100101011010011110100010111011111000100010000100010000001100111001111110110101000111011010010010000010001101100110101110111010101110110100110111000100001010111011111...', 'output': ['75255\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 ...', '75256\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 ...', '75256\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 5...', '75255\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 5...']}, {'input': '0101110111011010110111110101111111100100100100111101111011100111110111010101111111101011110111101011111000111111010111111010011111010110010001100001010010000100001000010101000100110000001001000000010110000000011011010001100100110111010111110101001001111110110101011101111010111000001000001010100100100010011000111010001000011001100010011111100010111101100001010000010010100010001000010000010000001000011000001010010000000000111000010000000000100010111000000000001100100000000000110000111101000110100101010011111...', 'output': ['55366\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 ...', '55367\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 2...', '55367\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 ...', '55366\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 2...']}, {'input': '1110001101101110101110010101101110001110001100010110011011011101101011101011101011110111111100111011111000010011110110101000011010111101001000000010100110101111100110101110101101010101011101000000011100110101100101101000010110010100010110011001110000010101100010100111010001100110011000110011100001011111101001001110001000100111000110110100101111010101101001101000111110101111010001101110111110011101110000111011011001011100101001111100111110010101100000011010101100101110001000010111001110111000110011010101010...', 'output': ['73807\\n64878 30126 64970 27134 29745 61051 20437 39035 7396 37761 23819 25647 64962 65002 57153 64987 59459 64907 65016 46639 65005 54574 38981 6112 59113 34518 47235 49867 22617 64595 24521 33893 615 11367 8225 5488 31518 52648 64583 38134 20147 51894 26440 41204 12719 4967 64373 59056 11485 64945 60562 17739 9723 64874 46399 56120 55169 27044 11489 44003 63989 64915 16723 1983 64895 63732 21003 24194 25873 64964 2934 64994 65055 54084 10959 65062 24866 64120 28970 21308 20682 18611 64560 37461 57240 13359...', '73807\\n64878 30126 64970 27134 29745 61051 20437 39035 7396 37761 23819 25647 64962 65002 57153 64987 59459 64907 65016 46639 65005 54574 38981 6112 59113 34518 47235 49867 22617 64595 24521 33893 615 11367 8225 5488 31518 52648 64583 38134 20147 51894 26440 41204 12719 4967 64373 59056 11485 64945 60562 17739 9723 64874 46399 56120 55169 27044 11489 44003 63989 64915 16723 1983 64895 63732 21003 24194 25873 64964 2934 64994 65055 54084 10959 65062 24866 64120 28970 21308 20682 18611 64560 37461 57240 1335...']}, {'input': '1101100100011110100010101111110110010011110101111011111001111111011011111011011010011111111001001100000001011001000100010001000110000011100000000000010111110111111111111101101011111111001110111111101110110111110111101011100110111100001100001100100000000011110001001111101001110110101111001111110010000100010010000000010100001000000001001000000010001000100000000000001110001000001000000010000000000000101000000000000110100100110110100001000010010010110101100100001011110110101010111111111110111110010011011001001...', 'output': ['51533\\n4857 4859 4839 4860 4863 4852 4854 4848 4853 4855 4856 4833 4844 4845 4837 4850 4851 4838 4842 4841 4828 4840 4745 4500 4824 4810 4717 4809 4771 4759 4808 4813 4812 4702 4815 4816 4705 4821 4381 4822 4823 4825 4819 4827 4525 4830 4834 4835 4566 4836 4874 4873 4820 4871 4872 4866 4870 4829 4869 4865 4797 4782 4884 4882 4847 4875 4807 4811 4890 4880 4889 4888 4881 4885 4886 4897 4883 4893 4898 4900 4896 4887 4849 4878 4895 4891 4867 4906 4892 4905 4901 4903 4894 4908 4904 4899 4909 4910 4907 4911 4707 ...', '51533\\n4857 4859 4839 4860 4863 4852 4854 4848 4853 4855 4856 4833 4844 4845 4837 4850 4851 4838 4842 4841 4828 4840 4745 4500 4824 4810 4717 4809 4771 4759 4808 4813 4812 4702 4815 4816 4705 4821 4381 4822 4823 4825 4819 4827 4525 4830 4834 4835 4566 4836 4874 4873 4820 4871 4872 4866 4870 4829 4869 4865 4797 4782 4884 4882 4847 4875 4807 4811 4890 4880 4889 4888 4881 4885 4886 4897 4883 4893 4898 4900 4896 4887 4849 4878 4895 4891 4867 4906 4892 4905 4901 4903 4894 4908 4904 4899 4909 4910 4907 4911 4707...', '51532\\n4858 4860 4840 4861 4864 4853 4855 4849 4854 4856 4857 4834 4845 4846 4838 4851 4852 4839 4843 4842 4829 4841 4746 4501 4825 4811 4718 4810 4772 4760 4809 4814 4813 4703 4816 4817 4706 4822 4382 4823 4824 4826 4820 4828 4526 4831 4835 4836 4567 4837 4875 4874 4821 4872 4873 4867 4871 4830 4870 4866 4798 4783 4885 4883 4848 4876 4808 4812 4891 4881 4890 4889 4882 4886 4887 4898 4884 4894 4899 4901 4897 4888 4850 4879 4896 4892 4868 4907 4893 4906 4902 4904 4895 4909 4905 4900 4910 4911 4908 4912 4708...', '51532\\n4858 4860 4840 4861 4864 4853 4855 4849 4854 4856 4857 4834 4845 4846 4838 4851 4852 4839 4843 4842 4829 4841 4746 4501 4825 4811 4718 4810 4772 4760 4809 4814 4813 4703 4816 4817 4706 4822 4382 4823 4824 4826 4820 4828 4526 4831 4835 4836 4567 4837 4875 4874 4821 4872 4873 4867 4871 4830 4870 4866 4798 4783 4885 4883 4848 4876 4808 4812 4891 4881 4890 4889 4882 4886 4887 4898 4884 4894 4899 4901 4897 4888 4850 4879 4896 4892 4868 4907 4893 4906 4902 4904 4895 4909 4905 4900 4910 4911 4908 4912 4708 ...']}, {'input': '0101100100011010001011011110101111011011110110110111110100000010000011111010000110111011111011101011001000100010100100001000111011110111111000000000100000000000010001110101101111011010000010001101111011111011001000111110111101111110111110100111000110010011100001001110100010011111001000101111111110110111111110000010000000001000000000000000000000000000000000001000000000000001000010000000111010100011111110110000010111111011101111101110001000110011111111111111111011011010011101000001110100100011010100010100000...', 'output': ['50866\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051...', '50867\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051 ...', '50867\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051...', '50866\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051 ...']}, {'input': '0111101101001110001101111101110011111101111000000001000100000111010110100110010101111100110111111111110111101111001000000000111110110111111111111111101101110111100111001000101001111111101101100000111111101011111111011110111100001000001111001001101101000111011111111111010111111111110111111111110111100010000000000000000001010000000000000000000000111101011111110110111111111010111110101011000010111110011111110101001110101011010000011011010001111010111000000011111110111110000000000000000000110001110010110010001...', 'output': ['92133\\n52804 52807 52806 52805 52797 52799 52779 52800 52803 52776 52801 52809 52808 52811 52802 52810 52816 52815 52798 52814 52813 52812 52785 52782 52783 52784 52639 52728 52629 52778 52781 52777 52780 52787 52796 52795 52791 52793 52790 52789 52786 52788 52681 52469 52858 52847 52856 52849 52855 52864 52854 52863 52861 52862 52859 52845 52837 52843 52842 52844 52852 52851 52848 52846 52850 52824 52835 52832 52834 52833 52825 52838 52839 52836 52841 52840 52827 52829 52817 52826 52830 52831 52823 52794 ...', '92133\\n52804 52807 52806 52805 52797 52799 52779 52800 52803 52776 52801 52809 52808 52811 52802 52810 52816 52815 52798 52814 52813 52812 52785 52782 52783 52784 52639 52728 52629 52778 52781 52777 52780 52787 52796 52795 52791 52793 52790 52789 52786 52788 52681 52469 52858 52847 52856 52849 52855 52864 52854 52863 52861 52862 52859 52845 52837 52843 52842 52844 52852 52851 52848 52846 52850 52824 52835 52832 52834 52833 52825 52838 52839 52836 52841 52840 52827 52829 52817 52826 52830 52831 52823 52794 5...']}, {'input': '1111010110000101101010000010000101110010011011011100101110100001100011101111101111011010111001011111000101111011111100110101110011101100111101010000110111110111111001111011111101011101111111111111110111111111101000011101110110101100100011111110111010101000110000010101110111110111101011111111111011110011011101111001101010001001000001101011100010010100111011111111110010111110011111111111000000001000011000000000000000000000000001001000000000000010001000000000000010000000001000000001101110110111111000101000100...', 'output': ['59091\\n58467 58466 58454 58472 58468 58434 58470 58473 58471 58474 58476 58463 58477 58475 58455 58453 58262 58235 58449 57381 58452 58465 58461 58464 58459 58450 58451 58462 58446 58439 58448 58444 58443 58445 58437 58440 58442 58433 58317 58435 58302 58426 58431 58429 58432 58428 58425 58430 58255 58364 58244 58260 58266 58424 58195 58427 58423 58505 58456 58507 58436 58504 58502 58503 58498 58492 58496 58497 58501 58500 58499 58489 58422 58488 58495 58490 58482 58493 58483 58484 58485 58469 58441 58479 5...', '59091\\n58467 58466 58454 58472 58468 58434 58470 58473 58471 58474 58476 58463 58477 58475 58455 58453 58262 58235 58449 57381 58452 58465 58461 58464 58459 58450 58451 58462 58446 58439 58448 58444 58443 58445 58437 58440 58442 58433 58317 58435 58302 58426 58431 58429 58432 58428 58425 58430 58255 58364 58244 58260 58266 58424 58195 58427 58423 58505 58456 58507 58436 58504 58502 58503 58498 58492 58496 58497 58501 58500 58499 58489 58422 58488 58495 58490 58482 58493 58483 58484 58485 58469 58441 58479 ...']}, {'input': '0010100100011000000111001011000000111100111101011001001001001110111100101010000110100010000111011110111001111100111101010101100111111001010110010010010000011010101101001001111010001101011010100001000011010011111001110111111001101000000010000100010100001000001000101111100000111011110010101110101011001100001011010000000101110011010111000100110101100110011111101001010010000100011001000101011011100100011001010110100110101011110110101011011010010011111010111110011100110110101111101101111110001101101111101111011...', 'output': ['67905\\n56302 56325 49913 56323 56295 56327 56088 56330 56262 56306 56293 56304 56311 56199 56237 56321 56103 56235 56209 56196 56198 56273 52122 56282 56286 56226 56284 56081 56292 54651 56297 56299 56147 56351 56314 56356 56338 56346 56341 56309 56344 56358 56352 56360 56320 56362 56355 56152 56361 56335 56291 56242 56332 56315 56301 56219 56317 56336 56331 56270 56337 56334 56345 56342 56343 56318 56254 56218 56250 56171 56223 56216 56248 56060 56258 56205 56150 56257 56145 56263 56266 54648 56264 56281 ...', '67905\\n56302 56325 49913 56323 56295 56327 56088 56330 56262 56306 56293 56304 56311 56199 56237 56321 56103 56235 56209 56196 56198 56273 52122 56282 56286 56226 56284 56081 56292 54651 56297 56299 56147 56351 56314 56356 56338 56346 56341 56309 56344 56358 56352 56360 56320 56362 56355 56152 56361 56335 56291 56242 56332 56315 56301 56219 56317 56336 56331 56270 56337 56334 56345 56342 56343 56318 56254 56218 56250 56171 56223 56216 56248 56060 56258 56205 56150 56257 56145 56263 56266 54648 56264 56281 5...']}, {'input': '1100110100010111011100001101001001001001110100111110111001111001100111111001011011001011001100101010001000110110100111111010000001101001000001011000101001000010000100100100000000111110000101100111011110011110000110001011011011101110111001111101010001110110111111010011110101111011010010011000100111101110110101100100011011011001111000111111111110101111011010100011001111111010001110100000011010000000001100001001000000001001101000001000000110110010110011011110100100001011100100110100010001100100011111100110010...', 'output': ['98341\\n95834 95895 95456 96416 95704 96411 96426 96395 96427 96425 96413 96409 96204 94216 96357 96365 96183 96410 96241 96057 90885 95759 93536 95831 96421 95959 96353 96431 96418 96430 96185 96434 92966 96441 96423 96438 96428 95731 96424 96447 96422 96444 96448 96446 96436 96450 96449 96440 96496 96432 96497 96453 96461 96445 96506 95952 96504 96494 96501 96483 96492 96488 96493 96455 96490 96398 96484 96489 96456 96480 96463 96457 96469 96429 96470 96433 94834 95542 96477 96466 96476 96435 96473 95912 9...', '98341\\n95834 95895 95456 96416 95704 96411 96426 96395 96427 96425 96413 96409 96204 94216 96357 96365 96183 96410 96241 96057 90885 95759 93536 95831 96421 95959 96353 96431 96418 96430 96185 96434 92966 96441 96423 96438 96428 95731 96424 96447 96422 96444 96448 96446 96436 96450 96449 96440 96496 96432 96497 96453 96461 96445 96506 95952 96504 96494 96501 96483 96492 96488 96493 96455 96490 96398 96484 96489 96456 96480 96463 96457 96469 96429 96470 96433 94834 95542 96477 96466 96476 96435 96473 95912 ...', '98342\\n95835 95896 95457 96417 95705 96412 96427 96396 96428 96426 96414 96410 96205 94217 96358 96366 96184 96411 96242 96058 90886 95760 93537 95832 96422 95960 96354 96432 96419 96431 96186 96435 92967 96442 96424 96439 96429 95732 96425 96448 96423 96445 96449 96447 96437 96451 96450 96441 96497 96433 96498 96454 96462 96446 96507 95953 96505 96495 96502 96484 96493 96489 96494 96456 96491 96399 96485 96490 96457 96481 96464 96458 96470 96430 96471 96434 94835 95543 96478 96467 96477 96436 96474 95913 ...', '98342\\n95835 95896 95457 96417 95705 96412 96427 96396 96428 96426 96414 96410 96205 94217 96358 96366 96184 96411 96242 96058 90886 95760 93537 95832 96422 95960 96354 96432 96419 96431 96186 96435 92967 96442 96424 96439 96429 95732 96425 96448 96423 96445 96449 96447 96437 96451 96450 96441 96497 96433 96498 96454 96462 96446 96507 95953 96505 96495 96502 96484 96493 96489 96494 96456 96491 96399 96485 96490 96457 96481 96464 96458 96470 96430 96471 96434 94835 95543 96478 96467 96477 96436 96474 95913 9...']}, {'input': '1011100111111100011110011011001011101001110010100001100010000000010010110010010011101101110111101111011011010001010001111111011101111111111011001111111111011010011101101011110111110101111011110111101100111010100000001000100100011111101110110011100100101111101000110111001000100010000100001001001000001100000000100000001000111111100111111101111111111101011011111111111110101111001110110110101000101101111111110010011110110111011101111011101110111101010011111010111110011111001000101100111101101000000000001000011...', 'output': ['93996\\n15465 15462 15467 15459 15466 15458 15456 15439 15464 15463 15436 15441 15470 15472 15473 15453 15477 15476 15460 15474 15471 15475 15448 15454 15455 15451 15457 15444 15449 15337 15450 15437 15452 15430 15438 15391 15410 15405 15346 15445 15447 15442 15427 15443 15407 15369 15396 15393 15316 15392 15388 15296 15389 15363 15305 15291 15400 15401 15390 15399 15398 15306 15408 15409 15387 15402 15406 15397 15413 15404 15411 15327 15236 15420 15421 15359 15415 15417 15412 15424 15423 15414 15425 15428 ...', '93996\\n15465 15462 15467 15459 15466 15458 15456 15439 15464 15463 15436 15441 15470 15472 15473 15453 15477 15476 15460 15474 15471 15475 15448 15454 15455 15451 15457 15444 15449 15337 15450 15437 15452 15430 15438 15391 15410 15405 15346 15445 15447 15442 15427 15443 15407 15369 15396 15393 15316 15392 15388 15296 15389 15363 15305 15291 15400 15401 15390 15399 15398 15306 15408 15409 15387 15402 15406 15397 15413 15404 15411 15327 15236 15420 15421 15359 15415 15417 15412 15424 15423 15414 15425 15428 1...', '93997\\n15464 15461 15466 15458 15465 15457 15455 15438 15463 15462 15435 15440 15469 15471 15472 15452 15476 15475 15459 15473 15470 15474 15447 15453 15454 15450 15456 15443 15448 15336 15449 15436 15451 15429 15437 15390 15409 15404 15345 15444 15446 15441 15426 15442 15406 15368 15395 15392 15315 15391 15387 15295 15388 15362 15304 15290 15399 15400 15389 15398 15397 15305 15407 15408 15386 15401 15405 15396 15412 15403 15410 15326 15235 15419 15420 15358 15414 15416 15411 15423 15422 15413 15424 15427 1...', '93997\\n15464 15461 15466 15458 15465 15457 15455 15438 15463 15462 15435 15440 15469 15471 15472 15452 15476 15475 15459 15473 15470 15474 15447 15453 15454 15450 15456 15443 15448 15336 15449 15436 15451 15429 15437 15390 15409 15404 15345 15444 15446 15441 15426 15442 15406 15368 15395 15392 15315 15391 15387 15295 15388 15362 15304 15290 15399 15400 15389 15398 15397 15305 15407 15408 15386 15401 15405 15396 15412 15403 15410 15326 15235 15419 15420 15358 15414 15416 15411 15423 15422 15413 15424 15427 ...']}, {'input': '0001000100011000011101010010100011111110010101101001000001101011111010010001110101001000010010001000011111110000010011000001101001000110011110001010011000001110101111100100010111110111111011011110010011101001001111101110001010100100001111010000000100000100011001110100101110000011100010110010000001100110100101110111111111111101111001111001011110011111011011101100101011111111011001011111110001001011011000010100010111010010111001011111101100111000011101101011110110100010111111111101111101101000111110000001110...', 'output': ['61246\\n1761 23163 28906 18156 38891 40268 39084 42589 41231 41810 13260 24629 31817 41232 44596 30424 12456 46052 45850 45325 36025 40774 39015 29873 31197 19828 42632 44254 43482 3090 28691 17948 17358 30429 36307 35077 36460 36531 25484 25652 41182 40671 39233 9470 13196 2817 13175 2163 14837 21741 15226 3711 193 32315 11129 34526 34235 33737 29085 515 34419 35392 10387 6443 14391 20275 8120 28457 36251 35967 23454 36577 37536 38553 28598 26603 9715 8855 22177 24638 23568 3806 5148 13753 31678 33126 34232...', '61246\\n1761 23163 28906 18156 38891 40268 39084 42589 41231 41810 13260 24629 31817 41232 44596 30424 12456 46052 45850 45325 36025 40774 39015 29873 31197 19828 42632 44254 43482 3090 28691 17948 17358 30429 36307 35077 36460 36531 25484 25652 41182 40671 39233 9470 13196 2817 13175 2163 14837 21741 15226 3711 193 32315 11129 34526 34235 33737 29085 515 34419 35392 10387 6443 14391 20275 8120 28457 36251 35967 23454 36577 37536 38553 28598 26603 9715 8855 22177 24638 23568 3806 5148 13753 31678 33126 3423...']}, {'input': '0100101111100111001001110000100011010010101110100101101010010111110111011101101001010010110101000011111101100000101011100011010011100010100100111110100101101001111011101111001110011010011100001011111001011110001001001010010010100000111001101000001000111101001100101110100100010110010001100101111010010101010001111011000011001101000111001101100110000110011111110001101010111000000111001111101111001011111110101010110101011110001100111001011111100011111111111011111111101001001011001111101001010110001000011110101...', 'output': ['79551\\n1516 16436 68003 55107 78676 77649 47588 27068 38288 58675 49243 80 4068 21682 17316 27238 18321 60663 68148 866 36875 72985 71539 69754 61333 7532 2436 4935 53275 19298 76665 30512 75584 20577 26303 15502 56354 33246 15805 62821 75501 71214 23076 16034 63721 20365 31163 50220 43344 419 37633 1690 63998 51539 11108 24243 37991 7774 19406 64506 26355 1246 3343 59891 13881 71669 66489 31190 58800 10261 70837 67236 76047 76480 32308 39530 63881 16316 9452 74554 78684 57356 61795 23939 28445 57295 36205...', '79551\\n1516 16436 68003 55107 78676 77649 47588 27068 38288 58675 49243 80 4068 21682 17316 27238 18321 60663 68148 866 36875 72985 71539 69754 61333 7532 2436 4935 53275 19298 76665 30512 75584 20577 26303 15502 56354 33246 15805 62821 75501 71214 23076 16034 63721 20365 31163 50220 43344 419 37633 1690 63998 51539 11108 24243 37991 7774 19406 64506 26355 1246 3343 59891 13881 71669 66489 31190 58800 10261 70837 67236 76047 76480 32308 39530 63881 16316 9452 74554 78684 57356 61795 23939 28445 57295 36205 ...']}, {'input': '1001111011110000111000101100100110110010001011111001101101110101001011000101010110101001111111011111101101110011010100011001001011110011101101011100101110111111010000011100010000111111001110010000101100101111111100011010110001100100101010101011010010010011110010011000011001110010010000100001111000001001010110001011111100011001010010111100011110100011011001111010110000100110011101001100001100011111000010111100100100111001011000001110111010101110010111001011111011011100111101000010100000011111111111011000010...', 'output': ['91877\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 ...', '91878\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 ...', '91878\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 4...', '91877\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 4...']}, {'input': '0011100010100010000100010100010110111010010000000111111110111110000101011100110111000010000000000110101111111011111000111111100010001011110000011110100011010001000011111111011000100110010001000111111100100010000010011111111011101111111111101110101101111011000000000011000001000001100001000000100010000100010111100111111011100111100010001000000001000100100010111110011011110011100011001000010000001100000001001110000000000000100001001000101111101110011111110111000100100000000010001101010110100111110011100111101...', 'output': ['83741\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 50...', '83740\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 50...', '83741\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 5...', '83740\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 5...']}, {'input': '0000101111000101111011011001101001110100000010000001000010000110110010100001110001000000110010011011011101000001111110111110100000000010000010010000001010111110001110110100001011100100000101111011111110111111011101110011110111100001000001111010111000010011101111111111010111111111111011111011101111101110111111111110111101111010101111001111111111111111101111110111000011101000111111011011010011101100101011111000100010000011100010000011011100001001011101001001110001011111010000000010001111011111111110011111111...', 'output': ['96729\\n11670 13778 13631 13779 13816 11441 7464 1029 9848 12056 12034 13938 13835 13926 11532 13763 13888 13897 13945 13948 13991 13953 13942 14353 14076 14245 14382 14294 14359 14324 14514 14511 14420 14442 14472 13743 13925 14017 14117 13976 14074 14289 13845 14227 14170 14142 14165 13606 13545 13538 12022 13509 13679 13721 13738 13718 13364 13706 11332 13394 13257 13484 13481 13341 9375 13025 13179 6327 12949 12960 11823 5621 11561 11262 11525 11307 11867 12494 11939 12916 12723 7218 10751 8520 6837 437...', '96729\\n11670 13778 13631 13779 13816 11441 7464 1029 9848 12056 12034 13938 13835 13926 11532 13763 13888 13897 13945 13948 13991 13953 13942 14353 14076 14245 14382 14294 14359 14324 14514 14511 14420 14442 14472 13743 13925 14017 14117 13976 14074 14289 13845 14227 14170 14142 14165 13606 13545 13538 12022 13509 13679 13721 13738 13718 13364 13706 11332 13394 13257 13484 13481 13341 9375 13025 13179 6327 12949 12960 11823 5621 11561 11262 11525 11307 11867 12494 11939 12916 12723 7218 10751 8520 6837 4377...']}, {'input': '1001101000111111101110011010101010011111101111100011000001111010101000001101010010001111110111011010000000001010100111000101001001110111101111101111110101000111111000011110000001111101100100111110000010001110010011110000101101010110011111110110000111011100101110111101000100100000000110010001110100000010001111101001101111100101000011100000110000101110100000001110111100111100000101100101011101001001001100111000011101010110111100000110100010110010110000101010100011110101001011110000101000101001001001100011000...', 'output': ['55740\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 ...', '55740\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 4...', '55739\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 4...', '55739\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 ...']}, {'input': '1100001110101100111011111110101111101010110000010000111100111000011000101000111101111101000011100100100000101101101001011111111100110111100010010000011011110101000110101101100001111101111110100100111100111011101100101110000110100110101111100100110101000001001100011110111111000000111001000010000111011110000010110011100010111001011001011001010000001011101001101011111001010011111001101001111011111000010100110011100100011010000100101001110011000111000011101101000110010111010111111001111101011101110100100110101...', 'output': ['72613\\n42298 21602 64334 62222 42446 47578 20231 29491 69970 71445 19081 23265 36972 33809 21595 215 5199 48737 48493 54284 55901 38316 45199 69444 61190 34816 48763 10213 60118 50384 29613 31766 23975 49659 35948 56591 45981 6174 36390 53457 25364 62232 58512 14380 43710 50378 51984 70534 66764 8926 45476 25603 44555 31289 24071 7996 69226 59489 44514 6554 16909 72259 72261 45704 12030 68678 47050 17274 18049 18347 22115 3201 49052 30639 67783 58849 26243 48231 49 6161 10285 30117 40190 51817 3662 16173 10...', '72613\\n42298 21602 64334 62222 42446 47578 20231 29491 69970 71445 19081 23265 36972 33809 21595 215 5199 48737 48493 54284 55901 38316 45199 69444 61190 34816 48763 10213 60118 50384 29613 31766 23975 49659 35948 56591 45981 6174 36390 53457 25364 62232 58512 14380 43710 50378 51984 70534 66764 8926 45476 25603 44555 31289 24071 7996 69226 59489 44514 6554 16909 72259 72261 45704 12030 68678 47050 17274 18049 18347 22115 3201 49052 30639 67783 58849 26243 48231 49 6161 10285 30117 40190 51817 3662 16173 1...']}, {'input': '1001101000110010110100100001111110001011000100001110000001101111111011010110101101101111011111100111111010000011111110111110110110010111111010111011100010001001010010000001101101001001000111011011111111011011000001001101001011110100110011111001101000010100100111011101111100111000000101100000110100000111101110011000100000010111000000110010001011101000110001000111100011000000010100011000111011001011100011000001100001000111001100011100110000010000001010100100001110010011111101110011111001110100011110001111110...', 'output': ['51878\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 4...', '51878\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 ...', '51877\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 ...', '51877\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 4...']}, {'input': '1011110111001111000010110000111111110110101101000011110111011101010011010111111110111000111110010000100011001011101111111100100010011110110010000010110010011011000000010110001011111011110111010111110111011100100011001000100001010111100100001111110110110001001111110010010111010111110001011111001110100101100010101111101011000011011111110001111101100001110111110101010111111110110100011010111010000001111111100100000010110001111001001101000010111101101011001100101001110001001000010010010110100000000111101011100...', 'output': ['54199\\n3683 36366 35604 26567 19294 471 10977 36471 11552 36849 36855 36478 2655 34352 33660 13013 33541 1121 1111 2551 11585 6902 31959 27109 3377 22975 12180 10680 7367 21367 158 17281 21472 13155 13025 23749 291 28588 25327 14726 33187 33036 31521 29174 18388 25781 22860 20597 27046 6831 30754 30750 19570 32100 23180 44137 43271 26545 35532 43862 44904 45399 19102 45742 45585 18495 18010 153 17153 33303 29194 21861 42650 43412 34488 34343 6506 3680 27525 11027 9405 12127 37529 37473 42385 40676 38113 126...', '54199\\n3683 36366 35604 26567 19294 471 10977 36471 11552 36849 36855 36478 2655 34352 33660 13013 33541 1121 1111 2551 11585 6902 31959 27109 3377 22975 12180 10680 7367 21367 158 17281 21472 13155 13025 23749 291 28588 25327 14726 33187 33036 31521 29174 18388 25781 22860 20597 27046 6831 30754 30750 19570 32100 23180 44137 43271 26545 35532 43862 44904 45399 19102 45742 45585 18495 18010 153 17153 33303 29194 21861 42650 43412 34488 34343 6506 3680 27525 11027 9405 12127 37529 37473 42385 40676 38113 12...']}, {'input': '0011001100011001111011100010010010011101001100100011001100001101111011011000101010111100100011011010010110010010111011110111111000110011100111010001000110101010000000011010111000001111111101000100000111111000111101000111010000011001001101011011001010001110110000010110001000111101110010011100010111000010111111100111000001001001001110010110010100001011100010000001110100011111111111010000000010001100110111111001110000100000000100010100011100111010000010100100111000001000011101110001111111100111001100110100110...', 'output': ['67586\\n11775 44160 4262 7703 50501 58236 24714 25424 38597 47772 36044 19680 64902 64406 4698 40619 18727 10397 60275 57658 9684 3473 29173 37483 22942 47796 61903 63776 57490 50725 16667 41425 36834 47205 15565 14727 14731 54435 54116 43599 42565 44037 47845 43107 29192 61073 65049 4746 37741 3091 3961 60811 61364 17261 60121 3766 8254 28802 44779 46139 52098 66336 66682 30699 18180 2625 64641 63927 23601 33160 58942 52195 51192 12228 9850 11547 40524 41543 6006 29457 60724 53877 37692 38087 39001 43905 6...', '67586\\n11775 44160 4262 7703 50501 58236 24714 25424 38597 47772 36044 19680 64902 64406 4698 40619 18727 10397 60275 57658 9684 3473 29173 37483 22942 47796 61903 63776 57490 50725 16667 41425 36834 47205 15565 14727 14731 54435 54116 43599 42565 44037 47845 43107 29192 61073 65049 4746 37741 3091 3961 60811 61364 17261 60121 3766 8254 28802 44779 46139 52098 66336 66682 30699 18180 2625 64641 63927 23601 33160 58942 52195 51192 12228 9850 11547 40524 41543 6006 29457 60724 53877 37692 38087 39001 43905 60...']}, {'input': '1010100110101010011110000100110100101100111010000110010110011011001010001110010101111100010001110010111010100001001110000011111001100111100110101000111001000011111001001111010011100011101110010000110010101010101100010011110100011100111011001110110010110110111000100100110011100110010110111000010010110001010101010010101110100001001111101011101011110100100001110010010001011101011010011111101001001101111010100000011001010110001110010010000110101100011011110100100000100011100101000000110110111111101111001001000...', 'output': ['100000\\n34728 59050 36431 27331 52266 45898 46179 14883 93370 495 80118 73354 35826 81703 1196 6246 55730 38192 22095 52457 56236 96178 78621 26410 49611 37868 29184 56374 57243 44630 15782 18777 33312 98899 40070 26180 20318 79337 78026 94528 16156 83054 36456 36898 80611 43231 33964 6126 64875 98469 29829 29712 86466 90968 56790 94226 43955 60576 80489 77529 35724 73123 6427 58546 66294 28028 64142 33786 64093 93696 5577 75234 29682 43857 75173 289 95318 22311 30811 86430 46164 24799 56658 44164 38053 487...', '100001\\n34724 59046 36427 27327 52262 45894 46175 14879 93366 491 80114 73350 35822 81699 1192 6242 55726 38188 22091 52453 56232 96174 78617 26406 49607 37864 29180 56370 57239 44626 15778 18773 33308 98895 40066 26176 20314 79333 78022 94524 16152 83050 36452 36894 80607 43227 33960 6122 64871 98465 29825 29708 86462 90964 56786 94222 43951 60572 80485 77525 35720 73119 6423 58542 66290 28024 64138 33782 64089 93692 5573 75230 29678 43853 75169 285 95314 22307 30807 86426 46160 24795 56654 44160 38049 48...', '100000\\n34728 59050 36431 27331 52266 45898 46179 14883 93370 495 80118 73354 35826 81703 1196 6246 55730 38192 22095 52457 56236 96178 78621 26410 49611 37868 29184 56374 57243 44630 15782 18777 33312 98899 40070 26180 20318 79337 78026 94528 16156 83054 36456 36898 80611 43231 33964 6126 64875 98469 29829 29712 86466 90968 56790 94226 43955 60576 80489 77529 35724 73123 6427 58546 66294 28028 64142 33786 64093 93696 5577 75234 29682 43857 75173 289 95318 22311 30811 86430 46164 24799 56658 44164 38053 48...', '100001\\n34724 59046 36427 27327 52262 45894 46175 14879 93366 491 80114 73350 35822 81699 1192 6242 55726 38188 22091 52453 56232 96174 78617 26406 49607 37864 29180 56370 57239 44626 15778 18773 33308 98895 40066 26176 20314 79333 78022 94524 16152 83050 36452 36894 80607 43227 33960 6122 64871 98465 29825 29708 86462 90964 56786 94222 43951 60572 80485 77525 35720 73119 6423 58542 66290 28024 64138 33782 64089 93692 5573 75230 29678 43853 75169 285 95314 22307 30807 86426 46160 24795 56654 44160 38049 487...']}, {'input': '1001111111101111100000010111111100111110000000000000000001110000000100000000000110011110111000000000000000000000000000000000000000000000011011000111101110000000110000011101111111111100000000000000011111101110001111111110011110111111110000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111100000110111110000000110011111111100011111111111111111100101110111110000000000011111111101111111111111111111111111110000000000000000000000000010111011111111000000111101111000000111111...', 'output': ['99999\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 ...', '99999\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 5...', '100000\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004...', '100000\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 ...']}, {'input': '1111100011011011101101001010110110110100011101101101011000111101000011111000100001110011101111010011110011001100011000111001001001101011010101011110100100000111011000100110011101001011100101111100001011100100100000111011110001101101010101101001011010100111001110111100111111110010101110100011000110110010001111010011001010101010111011011010100101111111010100010000101110000110111001000000010110010111110101110100110000000111101000101110000110011110111011110101010010100101111001010000010100010100101111111000110...', 'output': ['100001\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 93166...', '100000\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 9316...', '100001\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 9316...', '100000\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 93166...']}, {'input': '0111111011011110011101001000111111001001111010000011000010111111010111101011110110110100100110000001111110100010010001011011011110111101011111011111001111111111111111011101111000100110101000011000000110111000011111011111110011101111001111111011011101111101000101101101111101101111100001101111101101111000010010100000000000100010000001000000100011111111110111101111111111111101111011111111101111011111111110010010110010010111011011110011101111110111110011100101000000100001101001110100100100010000100101111101011...', 'output': ['100000\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88923 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88880 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893...', '99999\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88922 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88879 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 8...', '100000\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88923 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88880 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 ...', '99999\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88922 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88879 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 ...']}, {'input': '1000100000011100001011101111100010011101111010010001101010000010011001101010011101111100010001110011101110001010111100001000011010010001001010001110100011010110010011111001101111000010011011100100010111111101111110001110001000101010001001010000110001010001110010010011010001111110110100111111111011010011111100010101001001000111101101000010001001010000101000111100101111101001101000001001000110111100010111001010000110101010001000000110110110010111101101001100001001101001011010000010100000100011101110000001010...', 'output': ['99999\\n22919 58763 43976 3903 72333 82721 27886 32042 34104 56249 20235 45063 55598 46531 3823 8474 67983 83978 92989 89129 75539 84923 34919 72088 32836 74129 47662 47660 13170 39413 40774 26786 16799 25822 41993 46094 45851 534 37863 41305 74614 50102 51536 77134 70724 80497 80381 21146 26981 37693 70983 38932 83166 82270 68205 50070 16527 23459 22866 10317 24056 67562 51052 15608 79658 87772 35243 91652 53022 11640 95578 92358 14852 82219 48036 95699 24918 93949 72792 57846 68173 64764 63401 16162 96084 ...', '99999\\n22919 58763 43976 3903 72333 82721 27886 32042 34104 56249 20235 45063 55598 46531 3823 8474 67983 83978 92989 89129 75539 84923 34919 72088 32836 74129 47662 47660 13170 39413 40774 26786 16799 25822 41993 46094 45851 534 37863 41305 74614 50102 51536 77134 70724 80497 80381 21146 26981 37693 70983 38932 83166 82270 68205 50070 16527 23459 22866 10317 24056 67562 51052 15608 79658 87772 35243 91652 53022 11640 95578 92358 14852 82219 48036 95699 24918 93949 72792 57846 68173 64764 63401 16162 96084...', '100000\\n23180 58741 43976 3865 72308 82710 27886 32042 34088 56215 20275 45185 55739 46516 3821 8485 67926 83976 93078 89084 75728 84909 34872 72081 32836 74150 47662 47619 13115 39479 40659 26786 16770 25847 41987 46121 45851 629 37857 41269 74565 50102 51514 77124 70699 80497 80381 21275 26979 37693 70946 38932 83083 82261 68188 50035 16527 23471 22865 10310 23964 67553 51023 15716 79787 87772 35310 91780 53018 11614 95578 92357 14852 82208 48036 95643 24907 93946 72850 57855 68170 64560 63401 16147 9648...', '100000\\n23180 58741 43976 3865 72308 82710 27886 32042 34088 56215 20275 45185 55739 46516 3821 8485 67926 83976 93078 89084 75728 84909 34872 72081 32836 74150 47662 47619 13115 39479 40659 26786 16770 25847 41987 46121 45851 629 37857 41269 74565 50102 51514 77124 70699 80497 80381 21275 26979 37693 70946 38932 83083 82261 68188 50035 16527 23471 22865 10310 23964 67553 51023 15716 79787 87772 35310 91780 53018 11614 95578 92357 14852 82208 48036 95643 24907 93946 72850 57855 68170 64560 63401 16147 96481...']}]","id":370} {"difficulty":800,"lang":"Go","lang_cluster":"Go","src_uid":"b69170c8377623beb66db4706a02ffc6","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"package main\n\nimport \"fmt\"\n\nfunc main() {\n var first ,second,input,n int\n count:=0\n fmt.Scan(&n) \n\nfor j:=0;jsecond {\n\t\t count++\t\t\n\t }else{\n\t\t \n\t\t fmt.Println(count)\n\t\t count=0\n\t\t break\n\t }\n }\n j++\n}\n\n}","description":"There are two sisters Alice and Betty. You have $$$n$$$ candies. You want to distribute these $$$n$$$ candies between two sisters in such a way that: Alice will get $$$a$$$ ($$$a > 0$$$) candies; Betty will get $$$b$$$ ($$$b > 0$$$) candies; each sister will get some integer number of candies; Alice will get a greater amount of candies than Betty (i.e. $$$a > b$$$); all the candies will be given to one of two sisters (i.e. $$$a+b=n$$$). Your task is to calculate the number of ways to distribute exactly $$$n$$$ candies between sisters in a way described above. Candies are indistinguishable.Formally, find the number of ways to represent $$$n$$$ as the sum of $$$n=a+b$$$, where $$$a$$$ and $$$b$$$ are positive integers and $$$a>b$$$.You have to answer $$$t$$$ independent test cases.","input_specification":"The first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) \u2014 the number of test cases. Then $$$t$$$ test cases follow. The only line of a test case contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^9$$$) \u2014 the number of candies you have.","output_specification":"For each test case, print the answer \u2014 the number of ways to distribute exactly $$$n$$$ candies between two sisters in a way described in the problem statement. If there is no way to satisfy all the conditions, print $$$0$$$.","notes":"NoteFor the test case of the example, the $$$3$$$ possible ways to distribute candies are: $$$a=6$$$, $$$b=1$$$; $$$a=5$$$, $$$b=2$$$; $$$a=4$$$, $$$b=3$$$. ","sample_inputs":["6\n7\n1\n2\n3\n2000000000\n763243547"],"sample_outputs":["3\n0\n0\n1\n999999999\n381621773"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tvar t, n int\n\tin := bufio.NewReader(os.Stdin)\n\tfmt.Fscan(in, &t)\n\tfor i := 0; i < t; i++ {\n\t\tfmt.Fscan(in, &n)\n\t\tfmt.Println((n - 1) \/ 2)\n\t}\n}\n","testcases":"[{'input': '6\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773']}, {'input': '10000\\r\\n1999998163\\r\\n1999998749\\r\\n3608\\r\\n1999995797\\r\\n3253\\r\\n1999998518\\r\\n3146\\r\\n938\\r\\n1999996903\\r\\n2957\\r\\n966\\r\\n1738464254\\r\\n2474\\r\\n2226\\r\\n1999997073\\r\\n1999995579\\r\\n1168\\r\\n91\\r\\n1999998757\\r\\n1999999297\\r\\n3541\\r\\n3769\\r\\n70\\r\\n3838\\r\\n1045411991\\r\\n1999996556\\r\\n4163\\r\\n1999999008\\r\\n1999997424\\r\\n1999997409\\r\\n3413\\r\\n2952\\r\\n1999996689\\r\\n1911\\r\\n1999998790\\r\\n1999997406\\r\\n4161\\r\\n1999998785\\r\\n2273\\r\\n1999998472\\r\\n973\\r\\n2749\\r\\n1999996019\\r\\n1999998967\\r\\n1999999115\\r\\n1999998605\\r\\n3081\\r\\n1633009152\\r\\n1999997493\\r\\n1999996534\\r\\n1999997510\\r\\n1999999805\\r\\n1956085790\\r\\n3818\\r\\n1999997...', 'output': ['999999081\\r\\n999999374\\r\\n1803\\r\\n999997898\\r\\n1626\\r\\n999999258\\r\\n1572\\r\\n468\\r\\n999998451\\r\\n1478\\r\\n482\\r\\n869232126\\r\\n1236\\r\\n1112\\r\\n999998536\\r\\n999997789\\r\\n583\\r\\n45\\r\\n999999378\\r\\n999999648\\r\\n1770\\r\\n1884\\r\\n34\\r\\n1918\\r\\n522705995\\r\\n999998277\\r\\n2081\\r\\n999999503\\r\\n999998711\\r\\n999998704\\r\\n1706\\r\\n1475\\r\\n999998344\\r\\n955\\r\\n999999394\\r\\n999998702\\r\\n2080\\r\\n999999392\\r\\n1136\\r\\n999999235\\r\\n486\\r\\n1374\\r\\n999998009\\r\\n999999483\\r\\n999999557\\r\\n999999302\\r\\n1540\\r\\n816504575\\r\\n999998746\\r\\n999998266\\r\\n999998754\\r\\n999999902\\r\\n978042894\\r\\n1908\\r\\n999998701\\r\\n999999380\\r\\n999998341\\r\\n1743\\r\\n9999979...', '999999081\\n999999374\\n1803\\n999997898\\n1626\\n999999258\\n1572\\n468\\n999998451\\n1478\\n482\\n869232126\\n1236\\n1112\\n999998536\\n999997789\\n583\\n45\\n999999378\\n999999648\\n1770\\n1884\\n34\\n1918\\n522705995\\n999998277\\n2081\\n999999503\\n999998711\\n999998704\\n1706\\n1475\\n999998344\\n955\\n999999394\\n999998702\\n2080\\n999999392\\n1136\\n999999235\\n486\\n1374\\n999998009\\n999999483\\n999999557\\n999999302\\n1540\\n816504575\\n999998746\\n999998266\\n999998754\\n999999902\\n978042894\\n1908\\n999998701\\n999999380\\n999998341\\n1743\\n999997960\\n953\\n999998982\\n936778166\\n301\\n999999608\\n879\\n261\\n999998090...']}, {'input': '2\\r\\n1\\r\\n2\\r\\n', 'output': ['0\\r\\n0', '0\\n0']}, {'input': '1\\r\\n108139\\r\\n', 'output': ['54069']}, {'input': '5\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0\\n0\\n0', '0\\r\\n0\\r\\n0\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\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', 'output': ['0\\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', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0']}, {'input': '1\\r\\n121112422\\r\\n', 'output': ['60556210']}, {'input': '1\\r\\n1411\\r\\n', 'output': ['705']}, {'input': '39\\r\\n2\\r\\n3\\r\\n5\\r\\n7\\r\\n9\\r\\n8\\r\\n6\\r\\n5\\r\\n4\\r\\n4\\r\\n9\\r\\n4\\r\\n5\\r\\n6\\r\\n8\\r\\n1\\r\\n5\\r\\n4\\r\\n3\\r\\n10\\r\\n7\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n5\\r\\n6\\r\\n2\\r\\n5\\r\\n9\\r\\n9\\r\\n6\\r\\n6\\r\\n4\\r\\n5\\r\\n3\\r\\n10\\r\\n10\\r\\n1\\r\\n', 'output': ['0\\n1\\n2\\n3\\n4\\n3\\n2\\n2\\n1\\n1\\n4\\n1\\n2\\n2\\n3\\n0\\n2\\n1\\n1\\n4\\n3\\n0\\n0\\n1\\n1\\n2\\n2\\n0\\n2\\n4\\n4\\n2\\n2\\n1\\n2\\n1\\n4\\n4\\n0', '0\\r\\n1\\r\\n2\\r\\n3\\r\\n4\\r\\n3\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n0\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n0\\r\\n2\\r\\n4\\r\\n4\\r\\n2\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n4\\r\\n4\\r\\n0']}, {'input': '39\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n32\\r\\n32\\r\\n34\\r\\n35\\r\\n36\\r\\n37\\r\\n35\\r\\n39\\r\\n', 'output': ['0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15\\n15\\n15\\n16\\n17\\n17\\n18\\n17\\n19', '0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15\\r\\n15\\r\\n15\\r\\n16\\r\\n17\\r\\n17\\r\\n18\\r\\n17\\r\\n19']}, {'input': '98\\r\\n710\\r\\n896\\r\\n635\\r\\n909\\r\\n528\\r\\n799\\r\\n184\\r\\n970\\r\\n731\\r\\n285\\r\\n481\\r\\n62\\r\\n829\\r\\n815\\r\\n204\\r\\n927\\r\\n48\\r\\n958\\r\\n858\\r\\n549\\r\\n722\\r\\n900\\r\\n290\\r\\n96\\r\\n414\\r\\n323\\r\\n488\\r\\n140\\r\\n494\\r\\n286\\r\\n783\\r\\n551\\r\\n896\\r\\n580\\r\\n724\\r\\n766\\r\\n841\\r\\n914\\r\\n200\\r\\n170\\r\\n384\\r\\n664\\r\\n14\\r\\n203\\r\\n582\\r\\n203\\r\\n678\\r\\n502\\r\\n677\\r\\n318\\r\\n189\\r\\n144\\r\\n97\\r\\n330\\r\\n169\\r\\n20\\r\\n492\\r\\n233\\r\\n198\\r\\n876\\r\\n697\\r\\n624\\r\\n877\\r\\n514\\r\\n828\\r\\n41\\r\\n575\\r\\n959\\r\\n499\\r\\n786\\r\\n621\\r\\n878\\r\\n547\\r\\n409\\r\\n194\\r\\n59\\r\\n657\\r\\n893\\r\\n230\\r\\n559\\r\\n170\\r\\n238\\r\\n752\\r\\n854\\r\\n385\\r\\n365\\r\\n415\\r\\n505\\r\\n584\\r\\n434\\r\\n135\\r\\n136\\r\\n610\\r\\n525\\r\\n945\\r\\n889\\r\\n941\\r\\n579\\r\\n', 'output': ['354\\r\\n447\\r\\n317\\r\\n454\\r\\n263\\r\\n399\\r\\n91\\r\\n484\\r\\n365\\r\\n142\\r\\n240\\r\\n30\\r\\n414\\r\\n407\\r\\n101\\r\\n463\\r\\n23\\r\\n478\\r\\n428\\r\\n274\\r\\n360\\r\\n449\\r\\n144\\r\\n47\\r\\n206\\r\\n161\\r\\n243\\r\\n69\\r\\n246\\r\\n142\\r\\n391\\r\\n275\\r\\n447\\r\\n289\\r\\n361\\r\\n382\\r\\n420\\r\\n456\\r\\n99\\r\\n84\\r\\n191\\r\\n331\\r\\n6\\r\\n101\\r\\n290\\r\\n101\\r\\n338\\r\\n250\\r\\n338\\r\\n158\\r\\n94\\r\\n71\\r\\n48\\r\\n164\\r\\n84\\r\\n9\\r\\n245\\r\\n116\\r\\n98\\r\\n437\\r\\n348\\r\\n311\\r\\n438\\r\\n256\\r\\n413\\r\\n20\\r\\n287\\r\\n479\\r\\n249\\r\\n392\\r\\n310\\r\\n438\\r\\n273\\r\\n204\\r\\n96\\r\\n29\\r\\n328\\r\\n446\\r\\n114\\r\\n279\\r\\n84\\r\\n118\\r\\n375\\r\\n426\\r\\n192\\r\\n182\\r\\n207\\r\\n252\\r\\n291\\r\\n216\\r\\n67\\r\\n67\\r\\n304\\r\\n262\\r\\n472\\r\\n444\\r\\n470\\r\\n289', '354\\n447\\n317\\n454\\n263\\n399\\n91\\n484\\n365\\n142\\n240\\n30\\n414\\n407\\n101\\n463\\n23\\n478\\n428\\n274\\n360\\n449\\n144\\n47\\n206\\n161\\n243\\n69\\n246\\n142\\n391\\n275\\n447\\n289\\n361\\n382\\n420\\n456\\n99\\n84\\n191\\n331\\n6\\n101\\n290\\n101\\n338\\n250\\n338\\n158\\n94\\n71\\n48\\n164\\n84\\n9\\n245\\n116\\n98\\n437\\n348\\n311\\n438\\n256\\n413\\n20\\n287\\n479\\n249\\n392\\n310\\n438\\n273\\n204\\n96\\n29\\n328\\n446\\n114\\n279\\n84\\n118\\n375\\n426\\n192\\n182\\n207\\n252\\n291\\n216\\n67\\n67\\n304\\n262\\n472\\n444\\n470\\n289']}, {'input': '102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n1...', 'output': ['50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50', '50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50']}, {'input': '1411\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...', 'output': ['0\\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\\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...', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0...']}, {'input': '3\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0', '0\\r\\n0\\r\\n0']}, {'input': '1\\r\\n10\\r\\n', 'output': ['4']}, {'input': '7\\r\\n1\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['0\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773', '0\\n3\\n0\\n0\\n1\\n999999999\\n381621773']}, {'input': '3\\r\\n3\\r\\n4\\r\\n5\\r\\n', 'output': ['1\\r\\n1\\r\\n2', '1\\n1\\n2']}, {'input': '31\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n', 'output': ['0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15', '0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15']}, {'input': '1\\r\\n54334\\r\\n', 'output': ['27166']}, {'input': '1\\r\\n54332\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54331\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54335\\r\\n', 'output': ['27167']}, {'input': '1\\r\\n54330\\r\\n', 'output': ['27164']}]","id":371} {"difficulty":1000,"lang":"Go","lang_cluster":"Go","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar word string\n\tvar k int\n\n\tfmt.Scan(&word,&k)\n\n\tif len(word) < k {\n\t\tfmt.Println(\"impossible\")\n\t\treturn\n\t}\n\n\tvar chs map[rune]int = make(map[rune]int,0)\n\n\tfor _,ch := range word {\n\t\tchs[ch]++\n\t}\n\n\tvar countRep = 0\n\tfor _,num := range chs {\n\t\tcountRep += num - 1\n\t}\n\n fmt.Println(countRep)\n}","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"],"human_solution":"package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar word string\n\tvar k int\n\n\tfmt.Scan(&word,&k)\n\n\tif len(word) < k {\n\t\tfmt.Println(\"impossible\")\n\t\treturn\n\t}\n\n\tchs := make(map[rune]int,0)\n\n\tfor _,ch := range word {\n\t\tchs[ch]++\n\t}\n\t\n\tout := k - len(chs)\n\tif out < 0 {\n\t\tout = 0\n\t}\n fmt.Println(out)\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":372} {"difficulty":1000,"lang":"Go","lang_cluster":"Go","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"WRONG_ANSWER","source_code":"\ufeffpackage main\nimport (\n\t\"fmt\"\n\t\/\/\"sort\"\n)\nfunc main() {\n\tvar n,m int\n\tc:=0\n\tfmt.Scan(&n)\n\ta:=make([]int,n+1)\n\tfor i:=0;i= 2*s {\n result++\n }\n }\n writer.WriteString(fmt.Sprintf(\"%d\\n\", result))\n}\n","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"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strconv\"\n \"fmt\"\n \"sort\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\ntype House struct {\n Pos, Size int\n}\ntype Houses []*House\nfunc (houses Houses) Len() int {\n return len(houses)\n}\nfunc (houses Houses) Swap(i, j int) {\n houses[i], houses[j] = houses[j], houses[i]\n}\nfunc (houses Houses) Less(i, j int) bool {\n return houses[i].Pos < houses[j].Pos\n}\n\nfunc main() {\n scanner = bufio.NewScanner(os.Stdin)\n scanner.Split(bufio.ScanWords)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n n, s := getI(), getI()\n houses := make([]*House, n)\n for i := 0; i < n; i++ {\n houses[i] = &House{ getI(), getI() }\n }\n sort.Sort(Houses(houses))\n result := 2\n for i := 1; i < n; i++ {\n doubleGap := 2*(houses[i].Pos - houses[i-1].Pos)\n doubleGap -= houses[i].Size + houses[i-1].Size\n if doubleGap >= 2*s {\n result++\n }\n if doubleGap > 2*s {\n result++\n }\n }\n writer.WriteString(fmt.Sprintf(\"%d\\n\", result))\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":374} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strings\"\n \"strconv\"\n \"fmt\"\n)\n\nvar scanner *bufio.Scanner\n\nfunc getI64() int64 {\n scanner.Scan()\n x, _ := strconv.ParseInt(scanner.Text(), 10, 64)\n return x\n}\nfunc getI() int {\n return int(getI64())\n}\nfunc getF() float64 {\n scanner.Scan()\n x, _ := strconv.ParseFloat(scanner.Text(), 64)\n return x\n}\nfunc getS() string {\n scanner.Scan()\n return scanner.Text()\n}\n\nfunc seek(s, a, b string) bool {\n aPos := strings.Index(s, a)\n if aPos != -1 {\n bPos := strings.Index(s[aPos+len(a):], b)\n if bPos != -1 {\n return true\n }\n }\n return false\n}\n\nfunc main() {\n scanner = bufio.NewScanner(os.Stdin)\n scanner.Split(bufio.ScanWords)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n ab := getS()\n n := len(ab)\n baBytes := make([]byte, n)\n for i := 0; i < n; i++ {\n baBytes[i] = ab[n-1-i]\n }\n ba := string(baBytes)\n s1, s2 := getS(), getS()\n forward, backward := seek(ab, s1, s2), seek(ba, s1, s2)\n result := \"fantasy\"\n if forward && backward {\n result = \"both\"\n } else if forward {\n result = \"forward\"\n } else if backward {\n result = \"backward\"\n }\n writer.WriteString(fmt.Sprintf(\"%s\\n\", result))\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc reverse(s string) string {\n\tb := []byte(s)\n\tfor i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {\n\t\tb[i], b[j] = b[j], b[i]\n\t}\n\treturn string(b)\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar s, s0, s1 string\n\tvar forward, backward bool\n\n\tfmt.Fscanf(reader, \"%s\\n\", &s)\n\tfmt.Fscanf(reader, \"%s\\n\", &s0)\n\tfmt.Fscanf(reader, \"%s\", &s1)\n\n\tfindex0 := strings.Index(s, s0)\n\tfindex1 := strings.LastIndex(s, s1)\n\tif findex0 == -1 || findex1 == -1 || findex1-findex0 < len(s0) {\n\t\tforward = false\n\t} else {\n\t\tforward = true\n\t}\n\n\ts = reverse(s)\n\tbindex0 := strings.Index(s, s0)\n\tbindex1 := strings.LastIndex(s, s1)\n\tif bindex0 == -1 || bindex1 == -1 || bindex1-bindex0 < len(s0) {\n\t\tbackward = false\n\t} else {\n\t\tbackward = true\n\t}\n\n\tif forward && backward {\n\t\tfmt.Printf(\"both\\n\")\n\t} else if forward && !backward {\n\t\tfmt.Printf(\"forward\\n\")\n\t} else if !forward && backward {\n\t\tfmt.Printf(\"backward\\n\")\n\t} else {\n\t\tfmt.Printf(\"fantasy\")\n\t}\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":375} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n \"fmt\"\n \"bufio\"\n \"os\"\n \"strconv\"\n)\n\n\/\/ Took from here: https:\/\/www.codementor.io\/tucnak\/using-golang-for-competitive-programming-h8lhvxzt3\nvar reader *bufio.Reader = bufio.NewReaderSize(os.Stdin, 10000000)\nvar writer *bufio.Writer = bufio.NewWriterSize(os.Stdout,10000000)\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\n\nvar n, count int\nvar matrix [1001][1001]int\n\nfunc main() {\n \/\/ STDOUT MUST BE FLUSHED MANUALLY!!!\n defer writer.Flush()\n \n scanf(\"%d\\n\", &n)\n for i := 1; i <= n; i++ {\n var a, b int\n scanf(\"%d %d\\n\", &a, &b)\n matrix[a][b] = 1\n }\n \n for i := 1; i <= 1000; i++ {\n for j := 1; j <= 1000; j++ {\n if matrix[i][j] == 1 {\n count++\n dfs_adaptada(i, j)\n break\n }\n }\n }\n printf(strconv.Itoa(count - 1))\n}\n\nfunc dfs_adaptada(x, y int) () {\n if matrix[x][y] == 1 {\n matrix[x][y] = 2\n for i := x + 1; i <= 1000; i++ {\n if matrix[i][y] == 1 {\n dfs_adaptada(i, y)\n }\n }\n for j := y + 1; j <= 1000; j++ {\n if matrix[x][j] == 1 {\n dfs_adaptada(x, j)\n }\n }\n }\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"os\"\n\t\"bufio\"\n\t\"strconv\"\n\t\"fmt\"\n)\n\nfunc scanInt(scanner *bufio.Scanner) int {\n\tscanner.Scan()\n\tx, _ := strconv.Atoi(scanner.Text())\n\treturn x\n}\n\ntype Point struct {\n\tx, y int\n\tvisited bool\n}\n\nfunc flood(points []Point, pos int) {\n\tpoints[pos].visited = true\n\tx, y := points[pos].x, points[pos].y\n\tfor i := 0; i < len(points); i++ {\n\t\tif !points[i].visited && (points[i].x == x || points[i].y == y) {\n\t\t\tflood(points, i)\n\t\t}\n\t}\n}\n\nfunc main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Split(bufio.ScanWords)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\tn := scanInt(scanner)\n\tpoints := make([]Point, n)\n\tfor i := 0; i < n; i++ {\n\t\tpoints[i] = Point{x: scanInt(scanner), y: scanInt(scanner)}\n\t}\n\tcount := -1\n\tfor i := 0; i < n; i++ {\n\t\tif points[i].visited {\n\t\t\tcontinue\n\t\t}\n\t\tcount++\n\t\tflood(points, i)\n\t}\n\twriter.WriteString(fmt.Sprintf(\"%d\\n\", count))\n}\n","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":376} {"difficulty":1100,"lang":"Go","lang_cluster":"Go","src_uid":"d526af933b5afe9abfdf9815e9664144","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ 192B\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc min(x, y int) int {\n\tif x < y {\n\t\treturn x\n\t}\n\treturn y\n}\nfunc max(x, y int) int {\n\tif x > y {\n\t\treturn x\n\t}\n\treturn y\n}\n\nfunc main() {\n\tvar n int\n\tfmt.Scan(&n)\n\tvar a [1005]int\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Scan(a[i])\n\t}\n\tans := min(a[0], a[n-1])\n\tfor i := 0; i < n-1; i++ {\n\t\tans = min(ans, max(a[i], a[i+1]))\n\t}\n\tfmt.Println(ans)\n}\n","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"],"human_solution":"package main\n\nimport (\n \"os\"\n \"bufio\"\n \"strconv\"\n \"fmt\"\n)\n\nfunc scanInt(scanner *bufio.Scanner) int {\n scanner.Scan()\n x, _ := strconv.Atoi(scanner.Text())\n return x\n}\n\nfunc main() {\n scanner := bufio.NewScanner(os.Stdin)\n scanner.Split(bufio.ScanWords)\n writer := bufio.NewWriter(os.Stdout)\n defer writer.Flush()\n\n n := scanInt(scanner)\n rain := map[int][]int{}\n for pos := 0; pos < n; pos++ {\n day := scanInt(scanner)\n tiles, found := rain[day]\n if !found {\n rain[day] = []int{ pos }\n } else {\n rain[day] = append(tiles, pos)\n }\n tiles = rain[day]\n }\n wreck := make([]bool, n)\n day, done := 0, false\n for !done {\n day++\n tiles, found := rain[day]\n if !found {\n continue\n }\n for _, pos := range tiles {\n if pos == 0 || pos == n-1 || wreck[pos-1] || wreck[pos+1] {\n done = true\n break\n }\n wreck[pos] = true\n }\n }\n writer.WriteString(fmt.Sprintf(\"%d\\n\", day))\n}\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":377} {"difficulty":1200,"lang":"Go","lang_cluster":"Go","src_uid":"f8315dc903b0542c453cab4577bcb20d","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ 129B\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tvar x, y, b, d, e, f, h, i, j int\n\tb, y = 0, 0\n\tvar a [100][100]int\n\tvar m [100]int\n\tfmt.Scanf(\"%d %d\", &b, &d)\n\tfor x = 0; x < b; x++ {\n\t\tfor y = 0; y < b; y++ {\n\t\t\ta[x][y] = 0\n\t\t}\n\t\tm[x] = 0\n\t}\n\tfor x = 0; x < d; x++ {\n\t\tfmt.Scan(&e, &f)\n\t\ta[e-1][f-1] = 1\n\t\ta[f-1][e-1] = 1\n\t}\n\tj = 0\n\ti = 0\n\tfor x = 0; x < b; x++ {\n\t\ti = 0\n\t\tfor y = 0; y < b; y++ {\n\t\t\tif a[x][y] == 1 {\n\t\t\t\ti++\n\t\t\t}\n\t\t}\n\t\tm[x] = i\n\t}\n\tfor x = 0; x < b; x++ {\n\t\tif m[x] == 1 {\n\t\t\th++\n\t\t\tfor y = 0; y < b; y++ {\n\t\t\t\ta[x][y] = 0\n\t\t\t\ta[y][x] = 0\n\t\t\t}\n\t\t}\n\t}\n\tif h > 0 {\n\t\tj++\n\t\th = 0\n\t}\n\tfmt.Printf(\"%d\\n\", j)\n\treturn\n}\n","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"],"human_solution":"package main\nimport \"fmt\"\n\nfunc main() {\n\tvar nn, mm, aa, bb, k, l int\n\tvar x[110][110]int\n\tvar cnt[110]int\n\tvar s[110]int\n\tvar notice bool\n\t\n\tfmt.Scan(&nn, &mm)\n\tfor i:=1; i<=nn; i++ {\n\t\tcnt[1]=0\n\t\tfor j:=1; j<=nn; j++ {\n\t\t\tx[i][j]=0\n\t\t}\n\t}\n\t\n\tfor i:=1; i<=mm; i++ {\n\t\tfmt.Scan(&aa, &bb)\n\t\tx[aa][bb]=1\n\t\tx[bb][aa]=1\n\t\tcnt[aa]+=1\n\t\tcnt[bb]+=1\n\t}\n\tk=0\n\tl=0\n\tfor {\n\t\tk=0\n\t\tfor i:=1; i<=nn; i++ {\n\t\t\tif cnt[i]==1 {\n\t\t\t\ts[k]=i\n\t\t\t\tk++\n\t\t\t}\n\t\t}\n\t\tif k==0 {\n\t\t\tbreak\n\t\t}\n\t\tfor i:=1; i<=nn; i++ {\n\t\t\tnotice=false\n\t\t\tfor j:=0; j u {\n min = u\n ansi = i+1\n ansj = ((i+1)%n)+1\n }\n }\n fmt.Println(ansi,ansj)\n}\n","testcases":"[{'input': '5\\r\\n10 12 13 15 10\\r\\n', 'output': ['5 1\\r\\n']}, {'input': '4\\r\\n10 20 30 40\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '6\\r\\n744 359 230 586 944 442\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '5\\r\\n826 747 849 687 437\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n999 999 993 969 999\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n4 24 6 1 15\\r\\n', 'output': ['3 4\\r\\n']}, {'input': '2\\r\\n511 32\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '3\\r\\n907 452 355\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['4 1\\r\\n']}, {'input': '10\\r\\n684 698 429 694 956 812 594 170 937 764\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '20\\r\\n646 840 437 946 640 564 936 917 487 752 844 734 468 969 674 646 728 642 514 695\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '30\\r\\n996 999 998 984 989 1000 996 993 1000 983 992 999 999 1000 979 992 987 1000 996 1000 1000 989 981 996 995 999 999 989 999 1000\\r\\n', 'output': ['12 13\\r\\n']}, {'input': '50\\r\\n93 27 28 4 5 78 59 24 19 134 31 128 118 36 90 32 32 1 44 32 33 13 31 10 12 25 38 50 25 12 4 22 28 53 48 83 4 25 57 31 71 24 8 7 28 86 23 80 101 58\\r\\n', 'output': ['16 17\\r\\n']}, {'input': '88\\r\\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 999 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 998 1000 1000 998 1000 999 1000 1000 1000 1000\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '99\\r\\n4 4 21 6 5 3 13 2 6 1 3 4 1 3 1 9 11 1 6 17 4 5 20 4 1 9 5 11 3 4 14 1 3 3 1 4 3 5 27 1 1 2 10 7 11 4 19 7 11 6 11 13 3 1 10 7 2 1 16 1 9 4 29 13 2 12 14 2 21 1 9 8 26 12 12 5 2 14 7 8 8 8 9 4 12 2 6 6 7 16 8 14 2 10 20 15 3 7 4\\r\\n', 'output': ['1 2\\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': ['86 87\\r\\n']}, {'input': '100\\r\\n31 75 86 68 111 27 22 22 26 30 54 163 107 75 160 122 14 23 17 26 27 20 43 58 59 71 21 148 9 32 43 91 133 286 132 70 90 156 84 14 77 93 23 18 13 72 18 131 33 28 72 175 30 86 249 20 14 208 28 57 63 199 6 10 24 30 62 267 43 479 60 28 138 1 45 3 19 47 7 166 116 117 50 140 28 14 95 85 93 43 61 15 2 70 10 51 7 95 9 25\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '100\\r\\n896 898 967 979 973 709 961 968 806 967 896 967 826 975 936 903 986 856 851 931 852 971 786 837 949 978 686 936 952 909 965 749 908 916 943 973 983 975 939 886 964 928 960 976 907 788 994 773 949 871 947 980 945 985 726 981 887 943 907 990 931 874 840 867 948 951 961 904 888 901 976 967 994 921 828 970 972 722 755 970 860 855 914 869 714 899 969 978 898 862 642 939 904 936 819 934 884 983 955 964\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '100\\r\\n994 927 872 970 815 986 952 996 965 1000 877 986 978 999 950 990 936 997 993 960 921 860 895 869 943 998 983 968 973 953 999 990 995 871 853 979 973 963 953 938 997 989 993 964 960 973 946 975 1000 962 920 746 989 957 904 965 920 979 966 961 1000 993 975 952 846 971 991 979 985 969 984 973 956 1000 952 778 983 974 956 927 995 997 980 997 1000 970 960 970 988 983 947 904 935 972 1000 863 992 996 932 967\\r\\n', 'output': ['81 82\\r\\n']}, {'input': '100\\r\\n48 108 63 21 27 8 49 21 75 8 24 42 149 18 8 28 21 18 25 35 59 70 59 33 40 1 67 34 120 82 4 115 72 87 3 15 15 63 37 12 40 27 83 14 38 20 14 58 93 10 31 3 39 6 197 77 54 16 31 146 9 49 14 8 77 82 5 11 80 116 8 61 50 24 7 103 29 11 3 3 1 12 46 24 21 131 39 29 36 2 107 40 16 99 31 41 29 48 17 17\\r\\n', 'output': ['36 37\\r\\n']}]","id":379} {"difficulty":1700,"lang":"Go","lang_cluster":"Go","src_uid":"0fd33e1bdfd6c91feb3bf00a2461603f","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\nvar reader *bufio.Reader = bufio.NewReader(os.Stdin)\nvar writer *bufio.Writer = bufio.NewWriter(os.Stdout)\n\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\n\nfunc max(a, b int) int {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc main() {\n\tdefer writer.Flush()\n\n\tvar s, ss string\n\tscanf(\"%s\\n%s\\n\", &s, &ss)\n\tglobal := 0\n\tssl := len(ss)\n\n\tfor i, _ := range s {\n\t\tif strings.Index(s[i:], ss) == 0 {\n\t\t\t\/\/fmt.Println(s[:i], s[i+ssl:], i)\n\t\t\tlocal := max(len(s[:i]), len(s[i+ssl:]))\n\t\t\tif local > global {\n\t\t\t\tglobal = local\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", global)\n}\n","description":"The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous) from $$$s$$$ without changing order of remaining characters (in other words, it is guaranteed that $$$t$$$ is a subsequence of $$$s$$$).For example, the strings \"test\", \"tst\", \"tt\", \"et\" and \"\" are subsequences of the string \"test\". But the strings \"tset\", \"se\", \"contest\" are not subsequences of the string \"test\".You want to remove some substring (contiguous subsequence) from $$$s$$$ of maximum possible length such that after removing this substring $$$t$$$ will remain a subsequence of $$$s$$$.If you want to remove the substring $$$s[l;r]$$$ then the string $$$s$$$ will be transformed to $$$s_1 s_2 \\dots s_{l-1} s_{r+1} s_{r+2} \\dots s_{|s|-1} s_{|s|}$$$ (where $$$|s|$$$ is the length of $$$s$$$).Your task is to find the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.","input_specification":"The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $$$s$$$.","output_specification":"Print one integer \u2014 the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.","notes":null,"sample_inputs":["bbaba\nbb","baaba\nab","abcde\nabcde","asdfasdf\nfasd"],"sample_outputs":["3","2","0","3"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nvar reader *bufio.Reader = bufio.NewReader(os.Stdin)\nvar writer *bufio.Writer = bufio.NewWriter(os.Stdout)\n\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\n\nfunc max(a, b int) int {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc main() {\n\tdefer writer.Flush()\n\n\tvar s, t string\n\tscanf(\"%s\\n%s\\n\", &s, &t)\n\tslen, tlen := len(s), len(t)\n\n\t\/\/ \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c t \u0432 s (\u0438\u043d\u0434\u0435\u043a\u0441\u044b) \u0441\u043b\u0435\u0432\u0430\n\tpos := 0\n\tl := make([]int, tlen)\n\tfor i := 0; i < tlen; i++ {\n\t\tfor ; t[i] != s[pos]; pos++ {\n\t\t}\n\t\tl[i] = pos\n\t\tpos++\n\t}\n\t\/\/fmt.Println(l)\n\n\t\/\/ \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u0434\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c t \u0432 s (\u0438\u043d\u0434\u0435\u043a\u0441\u044b) \u0441\u043f\u0440\u0430\u0432\u0430\n\tpos = slen - 1\n\tr := make([]int, tlen)\n\tfor i := tlen - 1; i >= 0; i-- {\n\t\tfor ; t[i] != s[pos]; pos-- {\n\t\t}\n\t\tr[i] = pos\n\t\tpos--\n\t}\n\t\/\/fmt.Println(r)\n\n\t\/\/ \u0431\u0435\u0440\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043c\u0435\u0436\u0434\u0443 \u0445\u0432\u043e\u0441\u0442\u0430\u043c\u0438: \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442 l \u0438 \u0441\u043b\u0435\u0432\u0430 \u043e\u0442 r\n\tans := max(slen-1-l[tlen-1], r[0])\n\t\/\/ \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u0430\u0435\u043c \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 l[i] \u0438 r[i+1]\n\tfor i := 0; i < tlen-1; i++ {\n\t\tans = max(ans, r[i+1]-l[i]-1)\n\t}\n\n\tfmt.Println(ans)\n}\n","testcases":"[{'input': 'bbaba\\r\\nbb\\r\\n', 'output': ['3']}, {'input': 'baaba\\r\\nab\\r\\n', 'output': ['2']}, {'input': 'abcde\\r\\nabcde\\r\\n', 'output': ['0']}, {'input': 'asdfasdf\\r\\nfasd\\r\\n', 'output': ['3']}, {'input': 'zywmerhahxlqsjekpqsdqxnjiduyjrytswiweohctztgpiorwimhjmdfofqynyggcrtzslbyvkuvqrsgwyacyvcuathplliwwshusluiqwuhutnzwvuchfedhwwfdzizltdxibtsaocpnqezstblgkfdcvfsjjyzwalkksumsaljqljmmkcyejwwdkolmcgmodoiclte\\r\\nzywmehahxlqjekqsdqjidytswwztgiowimhmffqygctzslbykurwacyvcuaplwshsluiqwuhutnwchfewwfdizttcpnqestgkfvsjylkksumaljmmkcjwwdkolmcgodcle\\r\\n', 'output': ['5']}, {'input': 'nqlswpkupyawfzygzjfntqpivmudprpmtkhwjcoabkkxfemjekxvnjikbvtbzgrxyacflvausuwgqfxvfcgxphzeiwpitswykvcsyspvimmynlyeldkqjsogjhszcqtvteiefdcissquzeynmjdhazcygrypyzjhjhsntegsuryjgpknwvnjxplztmjszidqkihuxgzc\\r\\nnlwkupywfzgzftqpiudprmkhwcozenmjdhacygryjhhntgugpkwvnjxplztszikihgc\\r\\n', 'output': ['101']}, {'input': 'mejfmlmclpqwopscpxxtkamtodhogweqtpigxgsbmsdvhcvyenqwsqpuxegugrgkopjwulnuqbqwqsarnymoursenotgeakbslepaacvwiydnqgnetsjaazblnriaqcmolxplvqtfdqtcmwduwrnmemtvlkgbbzkvaplprscuaqfvjlftkblwddcgwsqsfecoqibpncs\\r\\nm\\r\\n', 'output': ['199']}, {'input': 'kbuwmzldbajqgbdyeqqyuvdwsdzvjicqgsadjgruebcsxuhgftlykvuevsldvapqoxkrwjbwjjqquogxkpradzauxxlhrayprgnwxwumabxdojztankeqmraeqbbggrltdvcpiozbrvwhxhjpurwachimqrxrplcavtpaqzemxhrvagbngyqhacuxfbpkwqxyixdfmrj\\r\\nkbmrxrplcavtpaqemxhagbghacuxbpkwqxidmj\\r\\n', 'output': ['150']}, {'input': 'aplxwwvctglkkvfdyfpegleljcjtaxhdjnfonpedzeyvqprewgqwalqafebjvbjmpimoujgcfcnycugvdmgkjeaeggmnrspkydplacliklknqifoenxwxmtxsmakekewtkglligipuhpicngocrzhehelimoiocusgtuzkodlyqeetsiionfrphuoznnnobldhvjagmx\\r\\naplxwvctgdjfopdzevqpregwqafejvbjpmoujgccncumgkjeaeggnspdplclknifenxxmakekewgligiphingoczheheioiocustuzkodlyeesinfrpuonnobldvagmx\\r\\n', 'output': ['21']}, {'input': 'toimpgygoklxroowdhpacrtrrwmkhcgcpidapeyxrjmiqgilveimnazyydvnujtqpenfkeqdbylfdinompxupfwvirxohaampqihjueasygkucweptgcowjibgnwyqetynykgoujeargnhjbmntfovwusqavpdwtpnpqpkcgaxbhgdxloyealksmgkxprtpfugixdyfn\\r\\npgygkxrowdpcrmkcgciapxjmiqgveimnazydvnujteqdblinmpxpvxoaampesygucweptgcignwytgurgnhjtfovwusqavdtnppcxgdxyalksgkxtid\\r\\n', 'output': ['6']}, {'input': 'ziurxtzxixmsmewfuffsqdkpphssdcgybwtmzavkosqtmcntspzvftqybaldjllvgttblectspqinfdhhnpvkcbwjlqlquajueqsgymyekuswjctumsbnvvaiinxjlzcnyixfaykolkeogufvzvhnatqtelgjkqfvexghiznwubwihjkznkhepjzrnyzftmimqtlihpn\\r\\nzurzximmewfuffskppsdcybwmzavkosqtmctspvftybaljlgtltsqinfdhhpvkcwjlqlqymykusctumsbnvvainxjlcyxfykokeguvvhategjfxinuwihjznkhepjznzftmmqtlihpn\\r\\n', 'output': ['8']}, {'input': 'sowebxtwfdqpqkirbgcwzgglhkochlvjydmcksbenikriedfgrutoaqbnfdfzhqzacppcvznjnwmdadlxhowejzderdglkskznacjqqdrgmbnfxhmvgktivxrczqeafsapcbnjpccrbccutaabzwdtvbdpqduhbpcmlfkakimayhdqxhqvajpcfodvkmomvlimooncqi\\r\\nso\\r\\n', 'output': ['198']}, {'input': 'm\\r\\nm\\r\\n', 'output': ['0']}, {'input': 'td\\r\\nt\\r\\n', 'output': ['1']}, {'input': 'ipz\\r\\nz\\r\\n', 'output': ['2']}, {'input': 'cel\\r\\nc\\r\\n', 'output': ['2']}, {'input': 'xmxcpstetnnyxqbdbfsqhyjpdihhcpbxfugnmwhjadphwsialqafdvunwjqpifdqdwoxrkyetoyafjiyaosahwxfoxejwtvtousuailafdlukqfyealdakjxgfagdltxgteasiclclbdutzdxokclotgabcqbytryszetctfvfmxrfouepwyrmvnvvvhoppbcnlkdzio\\r\\npstnnyxqbfqhdipbxfgmaphialqdvunwjqpifdqdwoxketofjyaohxfoejwtousuaiaukqfyaldakjfgtxgeasiclcldtxokotgabqbrstcffxrfopyrmnvvhoppbcnlkdz\\r\\n', 'output': ['4']}, {'input': 'pibvxshjediuehnmfyvprhjtghzadeavjgnlvjwaqzlbexrlrnijokvqirbgfpnwwgnuptzotcdoooorqyqipbfawdslkvqrscnguydrywwzazwohlufbverfvoblvygevornmproyvsnjdxscgyrjmcqsmamfaugfmluuidnkmxbrzfzvmchopukbrlkuinxgridioo\\r\\npdrwwzzwohlurfvoblvygeonmpoyvjdxscjmcqsmfauguikmxbzfzmchopukbrluidioo\\r\\n', 'output': ['101']}, {'input': 'gecewmzjpvbpuvgtxiranywdxlneejahynrmfrpysxwqeymmwtotktkhncrtueulewaunbtcqnglwktiwkkkusjxhnfosjsoujaggwpuaceisnghxvgbdbeadwxshclpmocbyxqqrhthvwpedhorfeytuucbaaxrdrwvwayzadnqxfnhwkeevxzsdytxocjvpqvyxbch\\r\\nh\\r\\n', 'output': ['199']}, {'input': 'eseflxqdffomkoxxhdicryombxleqlvckmqfxxpwipivffhoozteiinpelbaukuifsoygjwyxjlqtazufqrafadzulucrgbtqfsxlnrvauxpojwbpgyzwentjokrkvkepazivjvtxsepruqorgmhvjfnjintftbvnqfwmapmcuilsbkmjgdulgirtpfpywawfpjpbxhy\\r\\nfnntftvnqwmmulbkmdgifpywfpjpxhy\\r\\n', 'output': ['150']}, {'input': 'ppneeasyjzorefvertisgxykuoqsugzppvfoubkybksuwtmmepnauteyemvtwwweftteccshepmnoxoglvpinlcduflxybdkvmjrwxcedsfjskiuxizwlckchsycmbwnlasriohmxwkkqdrpahmeuabdchfmyhbanluynzaaknssnjzbqwhudbupwhqfdvwdbhebykhg\\r\\nppnuqsppvfoubkybksuwtmmepnauteemvtwweftcsepmnooglvplcuxybdkvjrxcesfskiuzckchsycmwlaomxwkpahmabcmhanlknsnjzbwhudbupwdwdbhebyhg\\r\\n', 'output': ['21']}, {'input': 'izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\noukzkkhwazxbaarpbybsjxlylbbjbrezlasfzvtxvcdxrltffoqwlzqwneizpoygfdcmdxzesxlsitozzrfomhggrwrcfoorvhyzdpjhakuoxdjhzaalanzwqlrtmmraleyjyxutc\\r\\n', 'output': ['4']}, {'input': 'qmrzsrvfllfraflralrwlcfjxupnlomnbeuvipcyxxmksztljxqaoqnptwwemhgswpovpnvoqajaqzxpmtqarpgdrgwuuferbhjjowmljtaoiidzkrcaawzomruigpwzgsksgdkbdbrjwaszgdwreyztdctwacfmujdgxvjqoclueiwdgvjcfpfbpmbbmcufjiitndis\\r\\nqmrzsrflrrwlfjxupnlmevipcyxxmkstljaoqnptweswpovpnvoqajaxptarpgdgwufbhjjoljtiidcawzorugpwzgskgddbrazdwreyztdctcujgxvjqlewvjpfpmbbcjtndis\\r\\n', 'output': ['7']}, {'input': 'trlypzzcpqrdgejwjolsefdtaceyixfdnwbphfwutzcweeqjsfqdcuftiscihqbflemognctgylfgtwqhcqjmutymwnxzoobfxopbsduyrvdaptgqecwjtliifaytgqdlbckulbyrpqfcbxmwxzboidqmzeghltlvbobpdidklzrurmfrigprxqowfjeiapiodipbhpt\\r\\npt\\r\\n', 'output': ['198']}, {'input': 'dexradrxekhwsmctzdqyrqctyrduvazzfybzlwdrhjdxawojhilywadneuijwuuwjbnhdjitjekszqjmnhrxulxcwfrwfzjlkzagaygllqzbehxdyiaztrcpjtvrvtmzkhvgnopwdnssyvaagatdvxgwectdpelvjmsgovdxrdeffawhwcdkospyjziiyiwyoofgnxzq\\r\\ndexrdekhwczqrqtyduvzzyblwhdaojhilwanijuuwbnhjitjeksqjmnhrulxwfwflkgagllbhxyiaztcpjvrvmzkhvnnsaadvxwectdpevjsgodxdefwhwcdospyjziiwoogxz\\r\\n', 'output': ['4']}, {'input': 'lyvutlpllxxqnttfihibqdntcxbmnzpyfcpfmcqiazztsesrumkfaksqieruntdgptwgzgsuwezxnzouiyducrcksnxjfnlhiekbnqxdakumkwgunlliwtnkdsletbyeqfxqeitljzgmnqqccuhasbcrarjozprcmxcqvxvjqvjfdljvhvjyrissqopfdcbsajaolxiy\\r\\nlvuplxntihiqdncbmpyfcfqazztsrumkfasqieuntgtgzguwxnzouiydccksnxjfhieb\\r\\n', 'output': ['100']}, {'input': 'ynqvahidlgpkijhypxuxczcgmofasasypqwmloybyaxcjetnwupkkhbfakbkyispgcntzfzokejakhkyzdnndysopyhxivzgfgpqlevpfkyusruchbturvtkmqmmkwdrcnpeotelidokcydqjgmikqwbrulezdkxjrpcfzeblkcgyivijuxquvbeofjgpjlthbiqapdm\\r\\ny\\r\\n', 'output': ['199']}, {'input': 'pofvbxtueyzxgzcrthooeacytrsysourmdvkfhebuqpoofbixkxrveqijcluhgaqbeljezhpeiffpeaejkvvuhbhrlhlwuwpkbmgejmrelsnzlrubrgmqowtfucbjzvqoqcbvrqqljzvlscrrulfahdijkzosggdocqmhpbszktbucsfnfurklmlnxcshtdjhrherwxr\\r\\npofvbxtuezgrtooacytrssoumdvkuobxr\\r\\n', 'output': ['151']}, {'input': 'rycgapxwyctxltrpateousbjtijdfsrxxgexpbiwyijynvomwanlrqbzqbkoaikqyblojwamoqlgoxxtvqatcrmhulzcubrtaguxysvepnrvtppeuzgnncusougnuzcayncuedvadkezhtkqucmfvgtdzcyhlztdtdkaiocdmtmoawzvfojvkdfzlaudxxchpnbbgtkp\\r\\nrycgpxwytxltrpaeusbjijdxxgexpbiwyjynvoalrbzqaikqywamoloxxtvqrmhulcubtgxysvepnrpzgnunucncuedvequfgtcyhltdtdaiodtmazfov\\r\\n', 'output': ['20']}, {'input': 'grkhejdykjmieztowpjdazxmjqlccvlwjjspiupkmhbpuvjfkncwoiastztyekhrpsfwkqwmtrznggbkfwzrtuwswbgowsemwpmssbkzorkmjauqzpsdylnhapjopgiswihierbluojvarvrakdslncrhinbjxyxptiojddnnvxsedklyjehbvsinezsppztbpqswutf\\r\\nrkhjdykjitopjdxmqlclwjspiupkmhbufknciatzterpsfkmtrznggbkfwzrtwswgowsempsbkzokmauzpsdynhapjpgswibljvaakslncnbjxtjddnnvxyevszspztbpqstf\\r\\n', 'output': ['5']}, {'input': 'kxzkueqzheeolprfncwxyxgqqlocajzkusopvpwowdxubsvvtfvnrkyijoxqjawzkvfkainowbxdzcxbgrywttplukaorxvtimqxonumuvsqyfobzorqqsohazhjyvscjhtlgbmetpigfzhtcjipiorcrcsvvdofflgkqzymdxbeaozrgcjxrgtkxrzpshjesucdwhds\\r\\nkzkqeeolprcxyxgqqloazkuspwouvvvnkyoxjzvkinowxdzbrytluaorximxnmvfoboqqsozjvschtlgbetizhcjipirccvffgkzyxbeozgctkzpsheus\\r\\n', 'output': ['5']}, {'input': 'yddetawddikawvqdrlzrupjncowrjegdlffvqomiuczkpezqtnbnuzcalfsvptfvxkwfualvarudertbhngudovyqfqfuccfspgevzqdcknlnxwphudqnbltuvvpojjxnndexpswqcwhadiyryctuychonrgfkxvemyulrelpsjvzdhfhnwugsbtkasxwchysaxervjz\\r\\nyd\\r\\n', 'output': ['198']}, {'input': 'agjcuoizuqjsjqseebznldgxxoidwtgkmhalwefupqhhdfgnpfbwtvcxdtehporvlzpzxcqcsqughooebnsprdpvwqujiermibzbputvybnacrszmuqiilhrgjoahwqiaidlzgvzwsadziapxjyqyjqkgzuiqnsperhfpuzrxjfzfemthlwerdwxvlypnfmwgtceygropdlkgbzpiaheypygrwqshocurxcsmgmdpmuhagmfmlrkflpbbrxzxuvhygdxfudkypqrtvvitserwrxxojnshzdjbnxiemfjiedcogcbrejwsgkdttqlcdntpbdsfzrleqdmbssbazdgdfojguhwtqmqjdpduswnkfccmzfuygwozwymtzovfweibqqzhzbvxljoqmaspmtlfmxraikuoxqykrwnsrwrchqatbwivicdhvjqmymdccjmfhbxesakdshzrepdsdwhhlinhhsmkmmqaeysimevibqoprijqkxrlzvdhykrmji...', 'output': ['11']}, {'input': 'ekmxunniussgbuqgntgnnikcgwrjuxyzbsjjabvpoieadohgbzpsbvyfqwnlrrbiifxlnqslkjaxdfgnuasfrahhapbwutlxkavfsbqynpshgtwbhxkzglvemxdsqhgmttkqxkzydazcmjvagssmncbskpopijtypxipjlgcxqeasmjnmtebzidabcjjxkprlbxamvpzamdswwdsldttporjlzhuywghlscifiuaawufhypfdueunwketxcpmpenijyciygnmhcpjajsmirlpzoxdjudypuxeomhwbkxiiofdligsatpyscscsasdigxdeenofwnsexzohkuffswejxjeurfhfwhpdoktowtcejgppzpjhwxnrbvlcngpmdxktzvubtpszmprybzkmdrwmepbpmspdiavoyayeobgxfrhgsfaerivduwudniomztwwpxmvztutbmwzggnyupnwmcidzrixufecluzwauswstrmcmmvrpytqdzpdyyzc...', 'output': ['100000']}, {'input': 'zfeetfqvyhovzbtnfyuzthrdadupoterdwsmjfyeixjvgjlyxiqetattxghalgcummcpjdpcjxogrhsiuewjpuqsnmqrixdvkwrznnfrujrmbngzddwbgvjeyckyncmwcuqyysdpuklznpflxagrireowtlovfuqylrueuqpqfsihtapeanmxeltpmgluucgevtqxwdeetksddmgxsflfuztzixnosaykxsdbovexobvnwxmhlsdejiorcxrkohkbdizteoksdpvbvlndwsuzfalmjgwcegdiorijsxmhzrnsqalpebfzqsffqxmojnwodbxzldljxhvomxsbsvwhasqwyjdawrpjlhrspjcbyryxxvynpvrnuzdgxsgyjkkqixcudanvjnoiaqqkqhzhjlwyempzbayiuhqrfytwolrthkoutvxljnizbgxsulohczhibuknlvqvnyhjbizavaclbvnnypiuftwxewsdlypqqmueyjnzgugusjekhr...', 'output': ['199999']}, {'input': 'ibwycbpspvxkrzxqyvlazgbgxqivykdtjvnotglijzuyxppvexbewpyvrthjlhwquqlmrjihtmjffkswuomghqgeznlzjbvgoyxkjtdkrqqgvihcvdfbdfeloauogifatepcoswefirlhlenvrwrxjbltiepaafzseuiudolgfougduytbosukvuxoxwbbqitjesruesloteeeawmfvpznbxwonvgtntnkxmzxvxwwdohebvhxqwvjkdiytckegsficgvgiqakqskdckagfhrklutrrkvcoqtmfcphfncdkgthdlfqnnvyrhavzyfnwgkxfengzcringswzxeprhzdrytbfssncwjkjmgbqrcgdffqdayhbxwzooitjmckfjhuyguasqzerifrgftdjpkkaeyyuamuijmkzhvvnbcjyhogfzbnswjgehwkwjskaulrchvusesockapysndykowpyjsxexumyfmsqnrnqwgicanqhsstgvlibafrfpjj...', 'output': ['150002']}, {'input': 'tszyjfpbqjxxyhqaeccwzfzwquoqnurwgvfvzbkufmgtdkiwwjxvtuputgqosvllsvtruyrmwocfdyudwezslmcfhroxosfyzjtlaaqfuzivfsetuahylimngoqukeqlklqmbrwnmfcaxsluhnellfqafweotcwkkujjtahkpbfuvejmprusjdyyypniezhjnfbozndjcqxpglsrhvkkemqoamucfxxfokhnbmqghszmmbtpijhoodkacjcxpuvcxorffniondkhpdktjixrfepdbtdhizojpbrhjnmhbvbcjatgdznsdhcvhxabyvrquoeepnfkmodykurqgcswkxqzlzgnfgspowykedxfvgucgrkklcuspvrllpdammrdsrrkgskkoiupdtqwrdkdulazfmkebbwqklhjrsmnuomcihyenutolfypjdigluibtzhyxvrndhvtjtyfkwcoqldrijqazwidvygvggwrbmydsdolezxeawxhmcifkff...', 'output': ['2001']}, {'input': 'swwdfbzdbckyjwcosrwlxymfehbqucprhuxphsvrpaajbdxgqyxzxlaqotjuuyegamjgqvehzelqufkkqcqiikiufoijetjabxcogddlcgbdcadefsdjpdlyasfsanneocyyytwqaervzzdpteqigthcyvqnxhqmxgklukhmfgxvxxarjzzgyftkzlgtsyupmwxtzrdvlxyyciaavwcetkhwdbbbtlojtbnpyuaeyoebohoyxcdxqryctymslqtqttzdppeubwqcrrytotxgegelxqxrqgyfqggwrffxnvcqrwlbaxoozdujjpzoreckamwmkixuzqeegrfxsgvhnrywkjfybiycmzafjahdrewwjndpsbbmbchmdmbzkzdqhmgwbzryifdpiyrbwkoamwzvchthdaxjzjmpmkbobrkvsdurtdnmcbnspchkoskymicxagejlwabojvzmprfgwordynqzpbdiomkiyhzzesnuzlqleefdifgcbywrgc...', 'output': ['12']}, {'input': 'aqgknrbuvpltemixhplailgecsfyqfpntglasosekhfvxxconmniperqoqzkjdwkrbrbrvsxptptedafnbhidjqvejehnnjygniadhkjmrolfhhvjlojmcyohtesnihkcmilxdatkpktbyowbqsmfyezzkaysmkxdusamketbbvlxbmqsqfnrkjakoifgyrsegiiedoxzhlnsxlmellidvooormyefxezoxgelsgzyljffsxbaqmzjvdrwgczaomdhmwrxhbhqtkichbyveuazbeemappbguijilfpbozubecooazhamxxwwcdzylgxigvzmfkovkqgivuulohzjsccixczhagnpspkpauizpwdhskbawntekrqlpwpkxkbigubnkymepropihodvgczgweikhuvugttspgussqdzrseplqphpbonxfcyszgvsreegbwvxmagjejwvkjbewyffgeorzdxzxrgrbpjkmndsalmuvnbrewammrkoolgah...', 'output': ['12']}, {'input': 'qquhufraoefpkwnbyxwdrvhweolqqcpdhvxzgnrqhlesyoodzbfavhkntxnmttdxrvxkijmmotwesxktspxgszavygwugjdvunrgbkhwqonejunxbgchxtslealcnrrhsbqcorykmeoxzwlwvwnfqczjzmwhodwrgoetyfrcwlgnlejxmjpxoqmdvrmdqluxequsttqzgiycwjbeytyhmcpagzovkysyivjzodljghjtgwcrdjsgmwhgsgxuvmrhumogmalozyrhcshjjzaxvtisugyeynpodrgypcijunhdbbzhnqgcsashjqqhzmgswjveiocheyuvaeltarbinqvwxfnycsvzoxwumexupgydprppqaikvqhcepegiyytnbimfngatjuugxclzohsffmeitkxjjpnaiuhozjngkmdmgoidcrwvajnvhkqbgwvghzsctfmplbctjzfssjvarsgebfycspcbkuvvzdgmhbdrtiyrikczjtehoxpdjg...', 'output': ['198000']}, {'input': 'nhybfnqfkvbqkzhnwkleujvvqlpyuztmyiehknvkoafeppxnvzbzsjguyzaerlbrincbpqxpjjuykzcktugzeulblqmziznajdrhipftobsuaqcffhorwxaskciotzrnywgiomzaocxtzkwgpoukrujxifuihrqlbucmyjptlzpdmjiaqkxxknerwybqgfcazjjsufcsypivxwyfegbhpftubcyxoybavvtkfsegjoxuuiybqctrxrxvosvnjdurlupbbklfcdejhpziisscsbmjwwhlhorxwtcesavqkcbwvxegkvqbfplkxydflyesrujuzjetiuxdgzkfbaqkqumsknywpxscpkvocbngisnvmrdlrlzggupvkqebtzjvjowxuwrhfmehrcwknpahcnrhbqolrtztgudmwnuokgqwdcybfxzeqqaamjfylvjrfplgzcwrwpvbjprenlorqiskhpdzoqzpujoywhfiespqkshgapxrdhzbmnjzyfj...', 'output': ['12']}, {'input': 'mgdkfpbtzyzsusonyqqjcrgannhokmckciuajeqeojivbmligyyedlpyacnrotjdwbflgggffanedmcattwnhstovfgkkajcmkokybkysfvwwtyvgebbelpitmatllaqvclhvsxzaeseisqcghetvhdcabupuxrvummvxsotyglxrpqxbpecpeqlfdeklnyunyhffpucrhpaazkwteukjkkvsmcjitcqoyaiqeeeqfatmrllxmmwpacmdlerrinwoyrfocvduhsvcfoadckfhcuwpkyykrgzoifsrggvzhjbvunzriioomtrydwlxednabnunxwgujpvlhavcebmpuwdxbinvwrjodvwuzuklifrysesfedqywoftgerdeqrwoorokviewgomceqemhgdurdeuhobsbhlhyyadkialmugwpfthjlxubfytvebhxpmsknrfrcyjmcfkpluuqgpezpdzlqsolqluixfdjoenjtidddmjsrtysjafduxro...', 'output': ['100004']}, {'input': 'blprasxcaasqxfgbstpapdouiafxtcnjyvgudkfutgtwxzqsrqxccxgapizsdnsacvnwziafhncunahladmxmsthqvhsrzcmsmtlbrwcmpvpyavyvzmzugfyvrijhpjmyyphjquebsxpffoprkswqrezggzmkwxumcmnjikfvvobghwfrjpiaociyujhyeavxmjbmcqmbiuazrboqpseinpiwikmfvgoannketabhfgigrnhetdeuwlunqjhqnenpkbpqskypjrdwrswdrpefuwojwoizwajofutofkqkzrgkeqykjpxcrihsfoszrjfeupjiqiipoozokkuvjkechrwjcrhngzmyzznmviiybdeifwqbcoziffczakycyyzdqfmgachfogvfiphjcnjyjkmaqsczdvvlqbstlvkmjdufpfonfwuapzpqkeofpgzkkeheqrgdtxjealygixavmzhsyrfahezhpcryonmylqsakjoxomqvwkjfpybwfm...', 'output': ['199998']}, {'input': 'fhyaecegqjsptkrxyjnwdhqxpkvooadrhbbobizdjiigcdtxfjunoiqlzbxkoqqktlgmvagxswvxvprtzrojoqrqicjkiuotumnnegwcjfocdxfyhroraywvfexaxqzonxjfdngzzxgusolbwwucuxohbmhmrsgunuayofoleqjjblbqauuirqmcrkmtzyazviifljyavwnrmxgsyyqmgbeeofvmlrgsszqeufxjemmyamlbrfvvthkunwgfisoglawselktsgnvjdskmaqqisddthloofifvibxqqbitsniqdjoxkhjdmcapiblqixwfjxtgcnfdauvazshilcmipjsrbeqszyoqyyieahdxakzfmppssbkhzvpmidiixhasmduhkvbkbacfsieztfzcdkyqoolifqqctzswwxrfnwweaccdozzehhomjxpybkbufgxxdkezcimabmcwfbekkvfizttchggzbwxcrbxtwaujsmjamwsorwuvodmqyd...', 'output': ['150005']}, {'input': 'ilxcwdywdjivimunhsruyzteyemyqweczyhmcoivzqeronikoxhxhgcqgpabvvieyprngodbmgztdsxhyytdqvyiuixpdpejdezqcuozpdfwhgekngnbjibemzqkgyqviwqizqcanrwdcgbitbdaaedaiflelfkkrfysheopdpknyztbwjidbwvqxepetfhwixejlbblvldumdpfryglouqmocelcizhbelrwsxuabbxmjopteyzuthdpugfuhidrfrvqzhnicknrdbnysgmhgztqqmqtdbtwwewkbnalewjsypkebmwoodivouozpkdulscmtmtqjbkzdrrzbeeesgibajgcbknuvlomsqzbshujyqlksarzurbbjpfrenixwhgizkwdxdcbbbdeuspnefszdyhzbtzhdyyasczrkbzjajfphyvpbplzqpkkkxgcivxarqpitmwdhjqvqpjokoqgpqhkgpcaffyhrtgxbeqyohkzvnwjiotyyeebjv...', 'output': ['202']}, {'input': 'ituckyvcozccqsyqydkvgapurnyzwygnbagcinwswxzcpwtczuazcdvygqnyftlyeqxmudorztdgizuixzbebuczdqjqtmpekfqijzwsevylbapussxglkomwfehzqaenbdxtlyhpzhtwrerpmbriihttotjbecpbxppjrwimczlwfkszaapllrykuqhfpkbzdmlyumacsxuiopvayyenwouwnuakisujztiswlxlgwcdnonzjvjlgwwxshhguspnbmomolkragzcwmyxeijcwomazvedksotedujhvvbnaorydydfjkuaqyhrxhfxwqgxhqmxbmojnixjzkpofqqhyfqojjtdubyaellmtyjwmzbwntndfyktbvkzstqaxhplcoylecygscjgbzumdptlmhfsyjfvllctovrxqawgvyievqyzimoontbbfpuuyqpppidbbyzzovnltxbkfxtnfxeglywaoykllkwqvjqfipqchmzytqxsoulfdlygx...', 'output': ['22']}, {'input': 'lgtsqnsqeabfarshxbbljjeewemenzwtmgbdrgokrcpgcrfrnwglquiadwcggomtombzeuyrksavqzxlgxifoqljdboepxyqxcccsjqsjogkdnctknkhtcwixjoawesrbsdqashrpticmwqynzizewxjunfvyxpbueouwswmyvkuizqlypunkmvhgbmjiwdrhczpmnpcvweqmayfrjhbqczwczdrvmacobhhrcjuxnvpqiqihapjrvrpwsghasrnljskdjrthmjbjdiihmsznuclnbpartboogvsdoltoaqoqryeojpaterptmgwdpfuzecqsbehmxphgeknrggqdmiahlhffoqpfwrsuwjpkdyktuyeyetihuafqtnjscyusfvrwblcqtbqwveemjpsrnqnwlbqvxdpqpyxrygcgyvdxwktxjmtbznspplynvyljjehkdpgsksngctzjrmfulxmwxjjrfffvdxjqsrbhjaydgqxmvtyoenezlhtxhm...', 'output': ['52']}, {'input': 'pxxeuzuevuzsjhpjojhcynndyjvwzzhubcvvxqesylixusxsvzvsagtoesxrhulirbciigjujvylvoihkegaimlppbnnykiiaekjtqbeyfjhmnkdwswhigncudemcefvyjpjyrymitadeskrnhxkiyssaznhsbdgbibazkyqwfkplylybowrevvoqozrgvsnmrkwcdtkjbzdbwntpixmcaciihggwbkjnrblxrldjvvfodnymdpwajeznabcydexqoexqldsiozkjbssfixdwzomniatyptjkcrrjwghlwwptjgcprdnypwybplbcrdwtftaklwhpxlecudaldvibgmnnxviobljebmmcopeabjxmbmxawvgsnrcgednizyaavccyejxiahmqloatfmathmsuohbwsqmgzfvagyzsozpnqpdxpthnntljebycvhayntizfuvrecvdngxcauxdfggesmmmkcqctafxcokyasklcqxxuzsfgaihoghcte...', 'output': ['19800']}, {'input': 'vuurwsjugbokkznzjyvrgfngeedcmskruprygruhiuanvpkxwtxzpprbntzujfcujfeyhiotuvgoxwyhaazktguptcketlqdrvjhlgoeezyiezxyfjhchopgcvszgiayyzyivjtvsaklpcrxlsrodbmltkxwhkeqerujuamsguyklvzdcoxlpkshnampiamllkbexmflxlilqlmvspoffqfxsgstmxaaqqdehjuzvdvcgrvuzhevmnykzsuroxmhragzqsceamtdoajjqnivpakuqwlvbjjztcmcbfxtoqeogkcrlyemgytbbmqboggutowmjgtxfrtbrxstyhuerzccthslfbjkijxvhdcjyvdgelexyzfksjufkaglrxdajkzwsqfgtkuplgegwbvwyrwkhpwbtrofmnwwyjnvcorylicugxksuqecfuqnyyhsskyzgzxtbqjrdkswvucycajjrcacrnnsdajjlntdsehaasrojaoqgkwekgaxqcu...', 'output': ['12']}, {'input': 'gqhyvrektfdgoaidpyraiqtgrefdssdbmefcagensnnpjxpyjjdezmlmfaopwganapxeuzargpdyfypytrjnbwoynmhnpfqlchcoxtmdvkzyaoazmqbcaqgtevvltxidalrjxhprnbldijnhzxksdceyjhluaawodoqpbzneaqklxioopdnaadelgajoetimdgchzvahvoupbdxsamsmmmgjwllzllhgursurvnwdqdcfcpuhrgqtrtifntyqqzqigunhgqgyykfrmyluzudvkrxnnxrrkmymcdtpjfzkuaujgtftqgtbdoozbnckbhqczonhyizwbkstusbmcndtzvoqtfuugohhmxwedakgolxpkhobwkfnnutyybyhqzjejvrkjlnbhvsqtzuhheolvldsazobjhdkglbncfkglufipooizdsjxbqtizpcnaerhgjfgdyfsbrfeoqzejkdmkaitjpiokmugwuqcrbjoozrhvkhlsfdlmhulxltbl...', 'output': ['10001']}, {'input': 'tajsigcawtoryybbaglpwrngqzljetzqnenjzohyqaihtwyuyixvcofwggyfpeotmgvuwltadisznhiojrbysfvianagwbsrqojxavmkkwabuejeyshwjspvrnqafjwvkznpbalbemilinsxamfwxhnnuzddqsvvhvlnfemvwlcwiljqfitfkxrwaypqgminufsswkilerxuiajdzgclmaihwnbtmltuiljlfzrmwnlldsnwrkqwyvuhcfzhckhvhuciuhbejacmxumktzrjbewuwadjelzathgvbxljanlsqqpclrvbyhzrvtwvkjminvonrubaetnfrpuynqqoxgajwyqpevxeqdgqqgxmgpwxsoykfjsojasimmmrfxgaribqesovsunzplmddqafvltwyxvyylgmnzwmkgdadrsnaowqimmmhwycmozlfldpcsfqkvguobiqqjpxrqqejmwvlygairtkwpcyaxthvuryxmpjchcvcjibmudtbrq...', 'output': ['199997']}, {'input': 'vzhkayniphiltwmfqlpzfwesqdnqkgywekzkkibehoiirbuqjhtnxtnosbkdaqtdliuoxtmtmtkkcvgtavenebomhtltvdggwvenjhjknunprtcnztignlzxzlikmanynpllkbhqglwarmqewjmflwnmijwgglrktikpbygjwehqonpywdjfnwuzcxoiezjfyhnprzfvtftuxmkwhfagbugwkftbstxsgxxqdhkdrosudiprktogocxmrguznqowokgftxifzzsokxyvhxhzrbhuhbbucfubqqxcigdzsfhjspdcktsmullctubojuaimkvgrikilrzmghztbvsagvlwwyxbngkzzzshsnwxpdbbaxupafsywylyjgajetvolnztsqnenivcobtogvjawvnpmqvhfyummdnxcjftaiacuewmqrkytfbgbfhibqpseyfytedatnbkgvrjqekswrzhsvmgxiooogmvrmgadctpmnnaautalskqguzjsco...', 'output': ['150005']}, {'input': 'dnonjckyhvwgtdkizmmhsziqnqkjiqgywozrskfwzurjnmraueqwosydyncqgkeoamcwrfxgotludnnjkwdvzgajaepcaahowrgbcuxmxmzqxtoiemkftynzwtdkgbrxoxxqsqrwfmxcaglxnhpkvyqiodxehafklzpprsicrehyanczjpfodqvapmcexoigihhqruxwkkkqibmfmcrtcgbfxwwrpjatllsxerkyrdanymaktylloxecnvohjegltqsfqanidhignhugqnhqtftyjzcrnamyoyjetubsfrchpyorlmjcdxdacmyjnboftqioxgxpbrmhuxftbdswqywdvehpjssinbjaiubxcaahaawdyszlxprbvifrbuylrzpykhiaszosrrrjpvefgtwxlsllloqtqgqpdujlcyjyxjvhuizewqhweynqvrprlpgnmiudclitgocgwzezlnhgfhnopkyqzmgspezipjktkdpbpjeljqhuihfkzom...', 'output': ['20924']}, {'input': 'whhkdzwvmbuwwmdwgjrzooiyodolsnwoxcipdqgamtyepngtzxlvgxqgayijutpopxwkmnckeixjckoerphduosfsyzukenedmurdlstfzjrjsvkfqwgoiyzurjwawuskzkkmnfkhabrrvmpdacfttihyqrtbdrukwkroikibmqvkyleevzhcotsrfcwzgphylmqejzylinpdwiouliqtcklbsqgdzgnocrsgsxmqrwdxclhmskcmghzsgprvrycxlaaauhenkpfyvkbfvxdflrepgtrxycigphcpipubtuwguxwcgdwkpojearqfrrokugssbrxzvtpnnzmarhoedqzwriyrdfvnyeexmydsqtezdydweluswhqnfijxexqeeymtbzavcghsndblidyctxvsdxifhivogrbvjwpxotwudxiotsyxtixnfgqjdgrsimedhcldkoxyfeqsvpegxxexscrdvxfwawmqewgrlpdholvxswbjfbuplzpfkw...', 'output': ['11']}, {'input': 'bpvlttjwjwkcfbblvvdqmmrewyolpblbjlemqmndxrujzlrkipemiaowqpmayjevkywycgrohsuzxhmwtkgjupmzphtufjcnpjyybvchndqvbuowepvserzyuberjlfcxzwnpxqdgbacveyqhzhaquxrjmwnnjhczoipvefirluhhhcmlogyszurdsetczzsoqxbewkocaczpgxxwvsxnpzwxdhpzdtvhiijkufrykwjygkrzacynefwcvzmsannrpjciccgtbcogfmjtrqawqnjlemzoqejyfpygwlrqgmzftfiaewxaidjnutldvarlphirltbdkwedjzqbvtspqhufojmekvdxpzhtjriabqcijluomadsgrezstircilwnyibiilubpftnzpjddbrbvxivcepznpvnxqkgwyhmzsssjtqenngcapjmgvpxgtubfmwdrsmsanituultxwthtqknmkrtavbbhrdhjnpdlncevunpaiuomicdrufjd...', 'output': ['11']}, {'input': 'ysdiwsqoqatfjkahugrxyptzagnhyfqngklnftkyhjlosxyavmycjbzrwvjdqhxxcmzidmmlyxwbtidycretuzhogeyigavtwhxphydpojmnprnrxaqniokmommggmwjqgedwxjqtwzglaxpqkxunausaqgjrugwmclehnyjfhogskapyknhikfsccpxlsemfnulyvipftijkpmbsvydrgtmsbhsrdmpbcurrngfcapnzajgifnwpzhzgmecepjsdaunhebxslyowasyjtrdfquhibtvnknhrhykutztdteyzqltlkrdilouqyxjosmywpsiagclpnvzkbftortonmwnfoimbkrjmfrnilpspulykvjatzxhbjichhikoqbvvlsegxgnlffhvvpnkfihtayllwqstncslodybirprlcsaztcaruasglpjkrqbdgsmrvacoxqykwmarxqteyfrrxgghiclysekqqxkxjuodrmoambrtbvehtsuuzrkjk...', 'output': ['19897']}, {'input': 'npynh\\r\\nnnh\\r\\n', 'output': ['2']}, {'input': 'aa\\r\\na\\r\\n', 'output': ['1']}, {'input': 'abcc\\r\\nacc\\r\\n', 'output': ['1']}, {'input': 'qwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfg\\r\\nqwertyuiopasdfg\\r\\n', 'output': ['180']}, {'input': 'tsypkoisgayandsuckedhisdadsdick\\r\\ntsypkoisgay\\r\\n', 'output': ['20']}, {'input': 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr\\r\\nabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv\\r\\n', 'output': ['100']}, {'input': 'rosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefranci\\r\\nrosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefranci\\r\\n', 'output': ['100']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['27']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['99']}, {'input': 'izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\nizoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\n', 'output': ['0']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['100']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['109']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['111']}]","id":380} {"difficulty":1700,"lang":"Go","lang_cluster":"Go","src_uid":"101_B","execute_outcome":"WRONG_ANSWER","source_code":"package main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t. \"fmt\"\r\n\t\"io\"\r\n\t\"os\"\r\n\t\"sort\"\r\n)\r\n\r\n\/\/ github.com\/EndlessCheng\/codeforces-go\r\nfunc CF101B(_r io.Reader, out io.Writer) {\r\n\tin := bufio.NewReader(_r)\r\n\tconst mod int = 1e9 + 7\r\n\r\n\tvar n, m, ans int\r\n\tFscan(in, &n, &m)\r\n\ta := make([]struct{ l, r int }, m)\r\n\tb := make(sort.IntSlice, 0, m*2)\r\n\tfor i := range a {\r\n\t\tFscan(in, &a[i].l, &a[i].r)\r\n\t\tb = append(b, a[i].l, a[i].r)\r\n\t}\r\n\tb.Sort()\r\n\tif m == 0 || b[0] != 0 || b[m*2-1] != n {\r\n\t\tFprint(out, 0)\r\n\t\treturn\r\n\t}\r\n\tk := 0\r\n\tfor _, w := range b[1:] {\r\n\t\tif b[k] != w {\r\n\t\t\tk++\r\n\t\t\tb[k] = w\r\n\t\t}\r\n\t}\r\n\tb = b[:k+1]\r\n\tsum := make([]int, m*2+1)\r\n\tsum[0] = -1\r\n\tsort.Slice(a, func(i, j int) bool { return a[i].r < a[j].r })\r\n\tfor _, p := range a {\r\n\t\tr := b.Search(p.r)\r\n\t\tres := (sum[r] - sum[b.Search(p.l)]) % mod\r\n\t\tif p.r < n {\r\n\t\t\tsum[r+1] = (sum[r] + res) % mod\r\n\t\t} else {\r\n\t\t\tans = (ans + res) % mod\r\n\t\t}\r\n\t}\r\n\tFprint(out, (ans+mod)%mod)\r\n}\r\n\r\nfunc main() { CF101B(os.Stdin, os.Stdout) }\r\n","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+1 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 0; i &= i - 1 {\r\n\t\t\tres = (res + tree[i]) % mod\r\n\t\t}\r\n\t\treturn\r\n\t}\r\n\tadd(1, 1)\r\n\tsort.Slice(a, func(i, j int) bool { return a[i].r < a[j].r })\r\n\tfor _, p := range a {\r\n\t\tr := b.Search(p.r)\r\n\t\tres := (sum(r) + mod - sum(b.Search(p.l))) % mod\r\n\t\tif p.r < n {\r\n\t\t\tadd(r+1, res)\r\n\t\t} else {\r\n\t\t\tans = (ans + res) % mod\r\n\t\t}\r\n\t}\r\n\tFprint(out, ans)\r\n}\r\n\r\nfunc main() { CF101B(os.Stdin, os.Stdout) }\r\n","testcases":"[{'input': ['2 2\\r\\n0 1\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 2\\r\\n0 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 5\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n0 6\\r\\n0 7\\r\\n0 8\\r\\n0 9\\r\\n0 10\\r\\n'], 'output': ['512\\r\\n']}, {'input': ['6 6\\r\\n3 4\\r\\n2 3\\r\\n3 5\\r\\n0 1\\r\\n1 2\\r\\n3 6\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7 7\\r\\n0 1\\r\\n1 3\\r\\n2 3\\r\\n4 6\\r\\n5 7\\r\\n4 5\\r\\n5 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1000000000 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8 8\\r\\n0 1\\r\\n4 5\\r\\n7 8\\r\\n3 4\\r\\n2 3\\r\\n6 7\\r\\n5 6\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 1\\r\\n0 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 4\\r\\n0 3\\r\\n1 2\\r\\n4 5\\r\\n4 6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 15\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n'], 'output': ['360\\r\\n']}, {'input': ['5 3\\r\\n0 1\\r\\n2 3\\r\\n4 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 15\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n3 4\\r\\n4 5\\r\\n4 5\\r\\n'], 'output': ['120\\r\\n']}, {'input': ['8 94\\r\\n2 8\\r\\n3 8\\r\\n5 6\\r\\n1 2\\r\\n4 6\\r\\n2 7\\r\\n2 4\\r\\n3 5\\r\\n0 2\\r\\n0 1\\r\\n7 8\\r\\n0 7\\r\\n0 5\\r\\n1 4\\r\\n2 7\\r\\n3 4\\r\\n6 7\\r\\n1 5\\r\\n4 6\\r\\n4 6\\r\\n2 8\\r\\n4 5\\r\\n0 1\\r\\n3 8\\r\\n5 8\\r\\n1 3\\r\\n3 4\\r\\n1 6\\r\\n1 6\\r\\n1 7\\r\\n1 7\\r\\n1 4\\r\\n5 6\\r\\n5 7\\r\\n2 4\\r\\n3 8\\r\\n0 1\\r\\n0 4\\r\\n4 8\\r\\n1 8\\r\\n3 8\\r\\n2 4\\r\\n5 7\\r\\n2 4\\r\\n2 7\\r\\n3 8\\r\\n3 7\\r\\n0 6\\r\\n1 2\\r\\n0 2\\r\\n2 7\\r\\n0 4\\r\\n0 3\\r\\n3 6\\r\\n0 2\\r\\n5 7\\r\\n4 8\\r\\n3 6\\r\\n0 3\\r\\n3 5\\r\\n2 3\\r\\n1 8\\r\\n3 7\\r\\n0 6\\r\\n4 6\\r\\n1 8\\r\\n1 2\\r\\n3 5\\r\\n1 5\\r\\n1 2\\r\\n0 2\\r\\n0 3\\r\\n4 7\\r\\n1 4\\r\\n2 5\\r\\n5 8\\r\\n0 3\\r\\n5 7\\r\\n5 8\\r\\n0 2\\r\\n1 5\\r\\n4 6\\r\\n3 6\\r\\n5 6\\r\\n0 6\\r\\n1 7\\r\\n7 8\\r\\n2 7\\r\\n2 4\\r\\n1 7\\r\\n0 7\\r\\n1 6\\r\\n3 8\\r\\n0 7\\r\\n'], 'output': ['203624961\\r\\n']}, {'input': ['97 53\\r\\n21 34\\r\\n19 95\\r\\n0 6\\r\\n28 40\\r\\n26 41\\r\\n39 41\\r\\n47 85\\r\\n32 46\\r\\n2 17\\r\\n55 73\\r\\n18 67\\r\\n36 85\\r\\n77 96\\r\\n77 97\\r\\n1 53\\r\\n12 49\\r\\n9 71\\r\\n29 92\\r\\n35 89\\r\\n40 43\\r\\n5 78\\r\\n13 92\\r\\n2 97\\r\\n11 22\\r\\n4 6\\r\\n22 92\\r\\n60 87\\r\\n25 47\\r\\n10 59\\r\\n51 70\\r\\n13 95\\r\\n27 43\\r\\n5 71\\r\\n48 73\\r\\n82 94\\r\\n45 51\\r\\n85 97\\r\\n51 89\\r\\n15 66\\r\\n44 80\\r\\n78 93\\r\\n65 84\\r\\n9 75\\r\\n28 30\\r\\n39 69\\r\\n50 89\\r\\n41 77\\r\\n14 31\\r\\n12 97\\r\\n69 86\\r\\n15 18\\r\\n14 56\\r\\n38 47\\r\\n'], 'output': ['478604297\\r\\n']}, {'input': ['33 5\\r\\n17 18\\r\\n5 27\\r\\n18 29\\r\\n12 24\\r\\n14 31\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['93 69\\r\\n9 92\\r\\n31 37\\r\\n58 83\\r\\n28 93\\r\\n36 44\\r\\n22 90\\r\\n61 88\\r\\n76 83\\r\\n19 85\\r\\n25 87\\r\\n55 84\\r\\n45 47\\r\\n5 27\\r\\n54 82\\r\\n4 65\\r\\n12 81\\r\\n49 55\\r\\n16 52\\r\\n16 34\\r\\n34 44\\r\\n17 36\\r\\n62 64\\r\\n7 34\\r\\n19 21\\r\\n16 73\\r\\n3 55\\r\\n12 62\\r\\n49 91\\r\\n2 36\\r\\n47 65\\r\\n17 37\\r\\n70 80\\r\\n52 71\\r\\n59 77\\r\\n1 17\\r\\n23 81\\r\\n15 67\\r\\n38 67\\r\\n14 48\\r\\n70 82\\r\\n33 51\\r\\n31 88\\r\\n28 51\\r\\n10 54\\r\\n6 71\\r\\n37 88\\r\\n5 60\\r\\n2 91\\r\\n88 91\\r\\n30 91\\r\\n17 58\\r\\n12 72\\r\\n14 77\\r\\n34 90\\r\\n15 42\\r\\n44 47\\r\\n54 87\\r\\n84 90\\r\\n3 49\\r\\n26 71\\r\\n40 87\\r\\n71 74\\r\\n20 60\\r\\n86 92\\r\\n76 83\\r\\n40 80\\r\\n3 31\\r\\n18 33\\r\\n5 82\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 59\\r\\n4 7\\r\\n4 8\\r\\n0 4\\r\\n5 7\\r\\n6 9\\r\\n7 8\\r\\n0 9\\r\\n6 7\\r\\n4 9\\r\\n1 10\\r\\n5 6\\r\\n1 4\\r\\n0 4\\r\\n4 9\\r\\n3 6\\r\\n1 7\\r\\n4 9\\r\\n3 7\\r\\n1 2\\r\\n0 1\\r\\n4 7\\r\\n0 8\\r\\n8 10\\r\\n0 3\\r\\n2 5\\r\\n0 7\\r\\n1 8\\r\\n2 10\\r\\n0 3\\r\\n0 9\\r\\n7 8\\r\\n2 6\\r\\n1 6\\r\\n2 10\\r\\n3 10\\r\\n3 4\\r\\n0 2\\r\\n0 8\\r\\n3 8\\r\\n9 10\\r\\n1 6\\r\\n7 10\\r\\n6 9\\r\\n2 10\\r\\n2 10\\r\\n3 5\\r\\n9 10\\r\\n4 10\\r\\n0 8\\r\\n5 9\\r\\n4 6\\r\\n0 10\\r\\n6 9\\r\\n1 2\\r\\n6 7\\r\\n1 5\\r\\n0 6\\r\\n0 7\\r\\n0 6\\r\\n'], 'output': ['28167561\\r\\n']}, {'input': ['66 35\\r\\n49 55\\r\\n9 30\\r\\n28 54\\r\\n44 62\\r\\n55 61\\r\\n1 21\\r\\n6 37\\r\\n8 10\\r\\n26 33\\r\\n19 37\\r\\n12 23\\r\\n24 42\\r\\n34 64\\r\\n8 56\\r\\n36 40\\r\\n16 58\\r\\n21 30\\r\\n16 36\\r\\n36 38\\r\\n19 45\\r\\n26 49\\r\\n6 62\\r\\n1 11\\r\\n22 48\\r\\n33 38\\r\\n8 41\\r\\n29 53\\r\\n58 60\\r\\n27 66\\r\\n2 19\\r\\n48 53\\r\\n25 47\\r\\n48 56\\r\\n61 65\\r\\n45 46\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['31 26\\r\\n15 21\\r\\n4 25\\r\\n5 19\\r\\n16 18\\r\\n5 23\\r\\n3 25\\r\\n7 18\\r\\n24 31\\r\\n6 9\\r\\n8 25\\r\\n18 29\\r\\n12 27\\r\\n15 16\\r\\n12 20\\r\\n2 7\\r\\n14 26\\r\\n13 22\\r\\n5 19\\r\\n5 24\\r\\n15 23\\r\\n4 7\\r\\n8 12\\r\\n14 26\\r\\n28 30\\r\\n1 30\\r\\n24 31\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['69 68\\r\\n49 62\\r\\n3 38\\r\\n1 43\\r\\n42 58\\r\\n12 64\\r\\n1 37\\r\\n35 59\\r\\n7 43\\r\\n2 29\\r\\n8 65\\r\\n19 47\\r\\n4 27\\r\\n41 58\\r\\n25 60\\r\\n17 37\\r\\n34 40\\r\\n16 38\\r\\n28 52\\r\\n35 63\\r\\n6 65\\r\\n57 58\\r\\n38 50\\r\\n8 28\\r\\n6 8\\r\\n10 44\\r\\n48 63\\r\\n2 42\\r\\n46 58\\r\\n26 62\\r\\n37 45\\r\\n7 22\\r\\n0 21\\r\\n19 48\\r\\n6 67\\r\\n6 15\\r\\n28 38\\r\\n19 22\\r\\n16 20\\r\\n27 40\\r\\n0 3\\r\\n33 69\\r\\n2 66\\r\\n10 24\\r\\n29 48\\r\\n26 69\\r\\n15 53\\r\\n24 34\\r\\n34 58\\r\\n20 47\\r\\n21 23\\r\\n38 68\\r\\n34 45\\r\\n60 68\\r\\n7 15\\r\\n21 34\\r\\n16 30\\r\\n14 58\\r\\n2 62\\r\\n24 66\\r\\n13 27\\r\\n24 40\\r\\n32 37\\r\\n10 37\\r\\n22 40\\r\\n44 50\\r\\n27 31\\r\\n0 44\\r\\n20 32\\r\\n'], 'output': ['622740890\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['68 74\\r\\n51 54\\r\\n3 22\\r\\n12 24\\r\\n3 27\\r\\n32 42\\r\\n36 55\\r\\n60 64\\r\\n1 4\\r\\n4 23\\r\\n11 64\\r\\n54 62\\r\\n50 56\\r\\n21 34\\r\\n27 63\\r\\n15 54\\r\\n28 61\\r\\n13 57\\r\\n39 53\\r\\n12 32\\r\\n32 40\\r\\n33 67\\r\\n55 61\\r\\n33 67\\r\\n30 37\\r\\n15 49\\r\\n27 45\\r\\n21 41\\r\\n8 42\\r\\n24 63\\r\\n40 48\\r\\n28 41\\r\\n30 67\\r\\n0 4\\r\\n7 15\\r\\n27 59\\r\\n60 62\\r\\n25 65\\r\\n30 31\\r\\n38 67\\r\\n24 43\\r\\n14 64\\r\\n26 46\\r\\n8 12\\r\\n34 41\\r\\n32 67\\r\\n11 42\\r\\n11 53\\r\\n45 55\\r\\n2 47\\r\\n7 51\\r\\n30 54\\r\\n21 44\\r\\n7 52\\r\\n40 62\\r\\n16 50\\r\\n10 41\\r\\n26 65\\r\\n16 51\\r\\n6 29\\r\\n1 31\\r\\n48 54\\r\\n9 42\\r\\n33 45\\r\\n19 59\\r\\n25 37\\r\\n21 62\\r\\n20 58\\r\\n23 59\\r\\n12 61\\r\\n2 46\\r\\n19 49\\r\\n44 60\\r\\n1 20\\r\\n19 66\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['79 68\\r\\n26 47\\r\\n55 70\\r\\n5 40\\r\\n7 45\\r\\n16 21\\r\\n31 38\\r\\n19 62\\r\\n40 55\\r\\n42 78\\r\\n60 61\\r\\n43 69\\r\\n50 73\\r\\n3 77\\r\\n2 45\\r\\n2 29\\r\\n10 58\\r\\n2 11\\r\\n62 76\\r\\n57 70\\r\\n65 73\\r\\n37 67\\r\\n9 24\\r\\n4 28\\r\\n8 16\\r\\n31 44\\r\\n10 66\\r\\n47 70\\r\\n19 45\\r\\n17 28\\r\\n5 36\\r\\n9 68\\r\\n2 35\\r\\n55 77\\r\\n51 71\\r\\n1 59\\r\\n6 33\\r\\n21 53\\r\\n39 49\\r\\n59 70\\r\\n17 44\\r\\n18 64\\r\\n49 78\\r\\n0 52\\r\\n24 56\\r\\n65 79\\r\\n19 51\\r\\n42 77\\r\\n37 78\\r\\n20 39\\r\\n47 56\\r\\n19 78\\r\\n50 78\\r\\n3 67\\r\\n37 47\\r\\n5 27\\r\\n40 51\\r\\n24 29\\r\\n50 54\\r\\n45 50\\r\\n13 76\\r\\n29 31\\r\\n0 28\\r\\n26 36\\r\\n21 44\\r\\n71 77\\r\\n55 58\\r\\n38 61\\r\\n22 44\\r\\n'], 'output': ['317376853\\r\\n']}, {'input': ['45 51\\r\\n2 12\\r\\n6 18\\r\\n4 17\\r\\n8 25\\r\\n16 24\\r\\n3 23\\r\\n29 31\\r\\n31 40\\r\\n7 26\\r\\n5 6\\r\\n35 37\\r\\n1 36\\r\\n9 45\\r\\n18 36\\r\\n12 27\\r\\n5 15\\r\\n11 16\\r\\n19 29\\r\\n8 23\\r\\n1 27\\r\\n0 30\\r\\n25 38\\r\\n21 44\\r\\n34 39\\r\\n10 41\\r\\n4 16\\r\\n11 36\\r\\n0 8\\r\\n15 38\\r\\n3 33\\r\\n11 31\\r\\n2 33\\r\\n5 34\\r\\n24 28\\r\\n7 32\\r\\n15 25\\r\\n2 27\\r\\n16 44\\r\\n31 40\\r\\n35 45\\r\\n13 38\\r\\n29 42\\r\\n18 23\\r\\n8 25\\r\\n13 21\\r\\n3 39\\r\\n3 41\\r\\n5 6\\r\\n13 21\\r\\n11 20\\r\\n23 42\\r\\n'], 'output': ['493168232\\r\\n']}, {'input': ['5 31\\r\\n0 2\\r\\n3 4\\r\\n3 5\\r\\n2 4\\r\\n1 3\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n0 2\\r\\n2 5\\r\\n1 4\\r\\n0 2\\r\\n1 3\\r\\n0 5\\r\\n2 3\\r\\n1 5\\r\\n1 2\\r\\n2 3\\r\\n0 1\\r\\n0 1\\r\\n2 4\\r\\n0 4\\r\\n1 2\\r\\n0 3\\r\\n1 2\\r\\n3 4\\r\\n0 2\\r\\n0 4\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n'], 'output': ['8595\\r\\n']}, {'input': ['81 52\\r\\n33 48\\r\\n59 61\\r\\n37 77\\r\\n58 73\\r\\n29 54\\r\\n1 17\\r\\n8 29\\r\\n50 73\\r\\n7 26\\r\\n35 41\\r\\n22 26\\r\\n9 22\\r\\n0 11\\r\\n40 73\\r\\n25 57\\r\\n35 55\\r\\n36 54\\r\\n29 41\\r\\n56 66\\r\\n42 77\\r\\n29 48\\r\\n41 66\\r\\n25 36\\r\\n2 55\\r\\n58 64\\r\\n0 61\\r\\n23 31\\r\\n9 61\\r\\n27 45\\r\\n2 71\\r\\n14 29\\r\\n4 31\\r\\n0 35\\r\\n31 77\\r\\n21 39\\r\\n0 54\\r\\n46 68\\r\\n18 62\\r\\n41 45\\r\\n12 28\\r\\n59 66\\r\\n39 71\\r\\n10 59\\r\\n29 77\\r\\n16 48\\r\\n13 46\\r\\n30 73\\r\\n2 41\\r\\n42 55\\r\\n19 61\\r\\n28 29\\r\\n20 42\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['84 50\\r\\n33 46\\r\\n19 40\\r\\n51 64\\r\\n37 45\\r\\n35 81\\r\\n44 81\\r\\n6 57\\r\\n57 60\\r\\n14 53\\r\\n15 49\\r\\n4 30\\r\\n35 49\\r\\n2 51\\r\\n8 72\\r\\n15 18\\r\\n49 51\\r\\n14 49\\r\\n50 71\\r\\n41 59\\r\\n28 60\\r\\n61 81\\r\\n9 12\\r\\n34 79\\r\\n5 56\\r\\n60 67\\r\\n21 60\\r\\n39 71\\r\\n31 60\\r\\n13 35\\r\\n16 84\\r\\n17 33\\r\\n48 57\\r\\n36 61\\r\\n50 55\\r\\n5 84\\r\\n66 79\\r\\n61 70\\r\\n42 49\\r\\n19 39\\r\\n47 49\\r\\n3 82\\r\\n59 65\\r\\n8 44\\r\\n71 80\\r\\n66 77\\r\\n8 65\\r\\n1 81\\r\\n7 82\\r\\n50 74\\r\\n10 17\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100 68\\r\\n77 89\\r\\n19 71\\r\\n11 46\\r\\n23 70\\r\\n16 47\\r\\n4 61\\r\\n7 96\\r\\n38 74\\r\\n79 95\\r\\n68 75\\r\\n14 86\\r\\n10 55\\r\\n7 13\\r\\n88 99\\r\\n19 21\\r\\n4 94\\r\\n17 83\\r\\n11 16\\r\\n7 50\\r\\n58 96\\r\\n4 58\\r\\n17 72\\r\\n44 56\\r\\n35 91\\r\\n50 88\\r\\n9 37\\r\\n36 52\\r\\n83 89\\r\\n8 16\\r\\n1 80\\r\\n12 75\\r\\n3 27\\r\\n92 93\\r\\n53 88\\r\\n37 49\\r\\n34 78\\r\\n31 66\\r\\n39 55\\r\\n36 94\\r\\n22 67\\r\\n47 85\\r\\n20 58\\r\\n62 98\\r\\n41 89\\r\\n85 96\\r\\n11 73\\r\\n39 95\\r\\n44 68\\r\\n25 33\\r\\n36 45\\r\\n66 70\\r\\n66 93\\r\\n17 97\\r\\n1 71\\r\\n49 53\\r\\n47 54\\r\\n19 95\\r\\n10 12\\r\\n38 57\\r\\n47 68\\r\\n21 70\\r\\n32 93\\r\\n53 71\\r\\n45 59\\r\\n27 48\\r\\n47 63\\r\\n75 76\\r\\n8 57\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['918949684 6\\r\\n351553415 785588657\\r\\n423490842 845475457\\r\\n351553415 918949684\\r\\n740298829 785588657\\r\\n351328841 610486484\\r\\n423490842 847590951\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['863261873 5\\r\\n137690029 666186924\\r\\n137690029 379800754\\r\\n515537329 666186924\\r\\n442925959 722302912\\r\\n137690029 863261873\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['735324925 2\\r\\n642054038 735324925\\r\\n170935185 642054038\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['977743286 6\\r\\n317778866 395496218\\r\\n395496218 932112884\\r\\n98371691 432544933\\r\\n440553 922085291\\r\\n440553 432544933\\r\\n586988624 922085291\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['977700285 7\\r\\n386643627 467079072\\r\\n116215943 914856211\\r\\n15183537 386643627\\r\\n424146511 977700285\\r\\n15183537 620050423\\r\\n336304090 947990602\\r\\n116215943 914856211\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['814609521 3\\r\\n622460875 697824636\\r\\n283825432 369448402\\r\\n614658965 622460875\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['931612300 8\\r\\n64655010 186892167\\r\\n25283092 580196656\\r\\n297609123 628681221\\r\\n25283092 186892167\\r\\n186892167 221075230\\r\\n221075230 634105512\\r\\n25283092 156293949\\r\\n86333513 156293949\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['947714605 4\\r\\n23890708 35992029\\r\\n35992029 947714605\\r\\n93644635 629491402\\r\\n23890708 947714605\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1000000000 2\\r\\n0 500000000\\r\\n500000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}]","id":381} {"difficulty":1700,"lang":"Go","lang_cluster":"Go","src_uid":"105_A","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\tline, _ := reader.ReadBytes('\\n')\n\tvar n, m int\n\tpos := readInt(line, 0, &n)\n\tpos = readInt(line, pos+1, &m)\n\tvar k float64\n\treadFloat64(line, pos+1, &k)\n\tbefore := make([]string, n)\n\n\tfor i := 0; i < n; i++ {\n\t\tbefore[i] = readString(reader)\n\t}\n\n\tafter := make([]string, m)\n\n\tfor i := 0; i < m; i++ {\n\t\tafter[i] = readString(reader)\n\t}\n\n\tres := solve(k, before, after)\n\n\tvar buf bytes.Buffer\n\n\tbuf.WriteString(fmt.Sprintf(\"%d\\n\", len(res)))\n\n\tfor i := 0; i < len(res); i++ {\n\t\tbuf.WriteString(res[i])\n\t\tbuf.WriteByte('\\n')\n\t}\n\n\tfmt.Print(buf.String())\n}\n\nfunc readFloat64(bs []byte, pos int, r *float64) int {\n\tvar first float64\n\tvar second float64\n\texp := 1.0\n\tvar dot bool\n\tfor pos < len(bs) && (bs[pos] == '.' || isDigit(bs[pos])) {\n\t\tif bs[pos] == '.' {\n\t\t\tdot = true\n\t\t} else if !dot {\n\t\t\tfirst = first*10 + float64(bs[pos]-'0')\n\t\t} else {\n\t\t\tsecond = second*10 + float64(bs[pos]-'0')\n\t\t\texp *= 10\n\t\t}\n\t\tpos++\n\t}\n\t*r = first + second\/exp\n\t\/\/fmt.Fprintf(os.Stderr, \"%.6f \", *r)\n\treturn pos\n}\n\nfunc isDigit(b byte) bool {\n\treturn b >= '0' && b <= '9'\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readString(reader *bufio.Reader) string {\n\ts, _ := reader.ReadString('\\n')\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '\\n' || s[i] == '\\r' {\n\t\t\treturn s[:i]\n\t\t}\n\t}\n\treturn s\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc solve(k float64, before []string, after []string) []string {\n\tskills := make(map[string]int)\n\n\tK := int(k * 100)\n\n\tfor _, s := range before {\n\t\tvar i int\n\t\tfor i < len(s) && s[i] != ' ' {\n\t\t\ti++\n\t\t}\n\t\tname := s[:i]\n\t\ti++\n\t\tvar score int\n\t\treadInt([]byte(s), i, &score)\n\t\tscore = K * score \/ 100\n\t\tif score >= 100 {\n\t\t\tskills[name] = score\n\t\t}\n\t}\n\n\tvar res []string\n\n\tfor _, s := range after {\n\t\tsc := skills[s]\n\t\tres = append(res, fmt.Sprintf(\"%s %d\", s, sc))\n\t\tdelete(skills, s)\n\t}\n\n\tfor s, v := range skills {\n\t\tres = append(res, fmt.Sprintf(\"%s %d\", s, v))\n\t}\n\n\tsort.Strings(res)\n\n\treturn res\n}\n","description":"In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill level is represented as an integer that increases when you use this skill. Different character classes are characterized by different skills. Unfortunately, the skills that are uncommon for the given character's class are quite difficult to obtain. To avoid this limitation, there is the so-called transmigration. Transmigration is reincarnation of the character in a new creature. His soul shifts to a new body and retains part of his experience from the previous life. As a result of transmigration the new character gets all the skills of the old character and the skill levels are reduced according to the k coefficient (if the skill level was equal to x, then after transmigration it becomes equal to [kx], where [y] is the integral part of y). If some skill's levels are strictly less than 100, these skills are forgotten (the character does not have them any more). After that the new character also gains the skills that are specific for his class, but are new to him. The levels of those additional skills are set to 0. Thus, one can create a character with skills specific for completely different character classes via transmigrations. For example, creating a mage archer or a thief warrior is possible. You are suggested to solve the following problem: what skills will the character have after transmigration and what will the levels of those skills be?","input_specification":"The first line contains three numbers n, m and k \u2014 the number of skills the current character has, the number of skills specific for the class into which the character is going to transmigrate and the reducing coefficient respectively; n and m are integers, and k is a real number with exactly two digits after decimal point (1\u2264n,m\u226420, 0.01\u2264k\u22640.99).\nThen follow n lines, each of which describes a character's skill in the form \"name exp\" \u2014 the skill's name and the character's skill level: name is a string and exp is an integer in range from 0 to 9999, inclusive. \nThen follow m lines each of which contains names of skills specific for the class, into which the character transmigrates. \nAll names consist of lowercase Latin letters and their lengths can range from 1 to 20 characters, inclusive. All character's skills have distinct names. Besides the skills specific for the class into which the player transmigrates also have distinct names.\n","output_specification":"Print on the first line number z \u2014 the number of skills the character will have after the transmigration. Then print z lines, on each of which print a skill's name and level, separated by a single space. The skills should be given in the lexicographical order.\n","notes":null,"sample_inputs":["5 4 0.75\naxe 350\nimpaler 300\nionize 80\nmegafire 120\nmagicboost 220\nheal\nmegafire\nshield\nmagicboost\n"],"sample_outputs":["6\naxe 262\nheal 0\nimpaler 225\nmagicboost 165\nmegafire 0\nshield 0\n"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\tline, _ := reader.ReadBytes('\\n')\n\tvar n, m int\n\tpos := readInt(line, 0, &n)\n\tpos = readInt(line, pos+1, &m)\n\tvar k int\n\treadInt(line, pos+3, &k)\n\tbefore := make([]string, n)\n\n\tfor i := 0; i < n; i++ {\n\t\tbefore[i] = readString(reader)\n\t}\n\n\tafter := make([]string, m)\n\n\tfor i := 0; i < m; i++ {\n\t\tafter[i] = readString(reader)\n\t}\n\n\tres := solve(k, before, after)\n\n\tvar buf bytes.Buffer\n\n\tbuf.WriteString(fmt.Sprintf(\"%d\\n\", len(res)))\n\n\tfor i := 0; i < len(res); i++ {\n\t\tbuf.WriteString(res[i])\n\t\tbuf.WriteByte('\\n')\n\t}\n\n\tfmt.Print(buf.String())\n}\n\nfunc readFloat64(bs []byte, pos int, r *float64) int {\n\tvar first float64\n\tvar second float64\n\texp := 1.0\n\tvar dot bool\n\tfor pos < len(bs) && (bs[pos] == '.' || isDigit(bs[pos])) {\n\t\tif bs[pos] == '.' {\n\t\t\tdot = true\n\t\t} else if !dot {\n\t\t\tfirst = first*10 + float64(bs[pos]-'0')\n\t\t} else {\n\t\t\tsecond = second*10 + float64(bs[pos]-'0')\n\t\t\texp *= 10\n\t\t}\n\t\tpos++\n\t}\n\t*r = first + second\/exp\n\t\/\/fmt.Fprintf(os.Stderr, \"%.6f \", *r)\n\treturn pos\n}\n\nfunc isDigit(b byte) bool {\n\treturn b >= '0' && b <= '9'\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readString(reader *bufio.Reader) string {\n\ts, _ := reader.ReadString('\\n')\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '\\n' || s[i] == '\\r' {\n\t\t\treturn s[:i]\n\t\t}\n\t}\n\treturn s\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc solve(k int, before []string, after []string) []string {\n\tskills := make(map[string]int)\n\n\t\/\/K := int(k * 100)\n\n\tfor _, s := range before {\n\t\tvar i int\n\t\tfor i < len(s) && s[i] != ' ' {\n\t\t\ti++\n\t\t}\n\t\tname := s[:i]\n\t\ti++\n\t\tvar score int\n\t\treadInt([]byte(s), i, &score)\n\t\tscore = k * score \/ 100\n\t\tif score >= 100 {\n\t\t\tskills[name] = score\n\t\t}\n\t}\n\n\tvar res []string\n\n\tfor _, s := range after {\n\t\tsc := skills[s]\n\t\tres = append(res, fmt.Sprintf(\"%s %d\", s, sc))\n\t\tdelete(skills, s)\n\t}\n\n\tfor s, v := range skills {\n\t\tres = append(res, fmt.Sprintf(\"%s %d\", s, v))\n\t}\n\n\tsort.Strings(res)\n\n\treturn res\n}\n","testcases":"[{'input': ['5 4 0.75\\r\\naxe 350\\r\\nimpaler 300\\r\\nionize 80\\r\\nmegafire 120\\r\\nmagicboost 220\\r\\nheal\\r\\nmegafire\\r\\nshield\\r\\nmagicboost\\r\\n'], 'output': ['6\\r\\naxe 262\\r\\nheal 0\\r\\nimpaler 225\\r\\nmagicboost 165\\r\\nmegafire 0\\r\\nshield 0\\r\\n']}, {'input': ['1 1 0.50\\r\\nstaff 1005\\r\\nionize\\r\\n'], 'output': ['2\\r\\nionize 0\\r\\nstaff 502\\r\\n']}, {'input': ['4 3 0.32\\r\\ninrf 48\\r\\nfdgdf 200\\r\\nvbkdfk 450\\r\\nfdbvfdd 1000\\r\\ndff\\r\\ninrf\\r\\nnfdkd\\r\\n'], 'output': ['5\\r\\ndff 0\\r\\nfdbvfdd 320\\r\\ninrf 0\\r\\nnfdkd 0\\r\\nvbkdfk 144\\r\\n']}, {'input': ['5 1 0.99\\r\\na 1\\r\\nb 2\\r\\nc 3\\r\\nd 4\\r\\ne 5\\r\\nf\\r\\n'], 'output': ['1\\r\\nf 0\\r\\n']}, {'input': ['2 2 0.02\\r\\nfn 1003\\r\\nzz 7000\\r\\nkk\\r\\nau\\r\\n'], 'output': ['3\\r\\nau 0\\r\\nkk 0\\r\\nzz 140\\r\\n']}, {'input': ['3 3 0.10\\r\\naa 900\\r\\nbb 990\\r\\ncc 999\\r\\naa\\r\\nbb\\r\\ncc\\r\\n'], 'output': ['3\\r\\naa 0\\r\\nbb 0\\r\\ncc 0\\r\\n']}, {'input': ['1 1 0.99\\r\\nfdvedvrgfckdkvfpmkjd 100\\r\\nfdvedvrgfckdkvfpmkjd\\r\\n'], 'output': ['1\\r\\nfdvedvrgfckdkvfpmkjd 0\\r\\n']}, {'input': ['1 1 0.01\\r\\na 9999\\r\\na\\r\\n'], 'output': ['1\\r\\na 0\\r\\n']}, {'input': ['1 1 0.80\\r\\nxyz 125\\r\\nxyz\\r\\n'], 'output': ['1\\r\\nxyz 100\\r\\n']}, {'input': ['5 1 0.67\\r\\ndjdn 6699\\r\\nolkj 6700\\r\\nhgvg 6698\\r\\noijggt 6701\\r\\nyfyv 6700\\r\\nyfyv\\r\\n'], 'output': ['5\\r\\ndjdn 4488\\r\\nhgvg 4487\\r\\noijggt 4489\\r\\nolkj 4489\\r\\nyfyv 4489\\r\\n']}, {'input': ['5 2 0.73\\r\\njcyuc 136\\r\\npooj 137\\r\\nojnbg 138\\r\\ninng 135\\r\\nuuv 139\\r\\nhg\\r\\nouohoiivuvu\\r\\n'], 'output': ['5\\r\\nhg 0\\r\\nojnbg 100\\r\\nouohoiivuvu 0\\r\\npooj 100\\r\\nuuv 101\\r\\n']}, {'input': ['4 1 0.99\\r\\nutctc 101\\r\\nijh 100\\r\\nfyyui 99\\r\\ntctxxx 102\\r\\nojohiobib\\r\\n'], 'output': ['2\\r\\nojohiobib 0\\r\\ntctxxx 100\\r\\n']}, {'input': ['4 4 0.80\\r\\nyfcyccyyccccc 123\\r\\nkkkkk 124\\r\\noops 125\\r\\nabfgg 126\\r\\nh\\r\\njkl\\r\\nqwerty\\r\\noops\\r\\n'], 'output': ['5\\r\\nabfgg 100\\r\\nh 0\\r\\njkl 0\\r\\noops 100\\r\\nqwerty 0\\r\\n']}, {'input': ['4 6 0.68\\r\\na 146\\r\\nb 147\\r\\nc 148\\r\\nd 149\\r\\ne\\r\\nf\\r\\ng\\r\\nh\\r\\ni\\r\\nj\\r\\n'], 'output': ['8\\r\\nc 100\\r\\nd 101\\r\\ne 0\\r\\nf 0\\r\\ng 0\\r\\nh 0\\r\\ni 0\\r\\nj 0\\r\\n']}, {'input': ['5 1 0.02\\r\\nirn 4999\\r\\nsdfc 5000\\r\\nzzzzzz 5001\\r\\ndcw 100\\r\\nfvvv 22\\r\\ndcw\\r\\n'], 'output': ['3\\r\\ndcw 0\\r\\nsdfc 100\\r\\nzzzzzz 100\\r\\n']}, {'input': ['5 5 0.18\\r\\nxwjxvrgz 9492\\r\\ndhpe 5259\\r\\nbnbkznfgyuluho 5070\\r\\nygpluaefwefxmhuaqi 2975\\r\\nvqstuwkaqk 8892\\r\\ndhpe\\r\\nbnbkznfgyuluho\\r\\nygpluaefwefxmhuaqi\\r\\nvyaefiicj\\r\\nxwjxvrgz\\r\\n'], 'output': ['6\\r\\nbnbkznfgyuluho 912\\r\\ndhpe 946\\r\\nvqstuwkaqk 1600\\r\\nvyaefiicj 0\\r\\nxwjxvrgz 1708\\r\\nygpluaefwefxmhuaqi 535\\r\\n']}, {'input': ['10 10 0.28\\r\\nszyiekxcixeyqyfm 7701\\r\\ncdxkfpggugy 5344\\r\\ngqyvyzwkajhc 3674\\r\\ntmo 8865\\r\\ntbp 8932\\r\\nwbrzxccfmdxbzw 4566\\r\\nvpgcejyragzhm 1554\\r\\ncqqjrh 7868\\r\\nw 1548\\r\\nxkbitfl 588\\r\\nlpcwvverv\\r\\nborcfgittei\\r\\nw\\r\\nzqtzpicsndbxfcbaduds\\r\\ncdxkfpggugy\\r\\ntmo\\r\\nmvmdaltjmy\\r\\nbzhykrayudljyj\\r\\nyktrcowlgwkvqucbqh\\r\\nvtm\\r\\n'], 'output': ['17\\r\\nborcfgittei 0\\r\\nbzhykrayudljyj 0\\r\\ncdxkfpggugy 1496\\r\\ncqqjrh 2203\\r\\ngqyvyzwkajhc 1028\\r\\nlpcwvverv 0\\r\\nmvmdaltjmy 0\\r\\nszyiekxcixeyqyfm 2156\\r\\ntbp 2500\\r\\ntmo 2482\\r\\nvpgcejyragzhm 435\\r\\nvtm 0\\r\\nw 433\\r\\nwbrzxccfmdxbzw 1278\\r\\nxkbitfl 164\\r\\nyktrcowlgwkvqucbqh 0\\r\\nzqtzpicsndbxfcbaduds 0\\r\\n']}, {'input': ['13 13 0.20\\r\\nbbdtfrykzf 6189\\r\\nnqwei 7327\\r\\ndtigwnbwevnnlinhk 3662\\r\\nxokqjtylly 1274\\r\\nsdpnhipam 5672\\r\\npfjmflvtuvctwxr 9580\\r\\nybqgomvwoguzcqvzkx 2062\\r\\nvowzavh 6345\\r\\nbfidjslqlesdtyjkreou 6780\\r\\nsvpzwtwn 1945\\r\\ninvzueipnifajadhjk 7034\\r\\nsz 6494\\r\\nce 1323\\r\\nybqgomvwoguzcqvzkx\\r\\nbbdtfrykzf\\r\\nvunbpghae\\r\\ndtigwnbwevnnlinhk\\r\\nuqdlfskhgo\\r\\nvdemdnxifb\\r\\nvowzavh\\r\\npfjmflvtuvctwxr\\r\\nbfidjslqlesdtyjkreou\\r\\nnqwei\\r\\nsz\\r\\njiemqkytxtqnxgjvhzjl\\r\\nce\\r\\n'], 'output': ['17\\r\\nbbdtfrykzf 1237\\r\\nbfidjslqlesdtyjkreou 1356\\r\\nce 264\\r\\ndtigwnbwevnnlinhk 732\\r\\ninvzueipnifajadhjk 1406\\r\\njiemqkytxtqnxgjvhzjl 0\\r\\nnqwei 1465\\r\\npfjmflvtuvctwxr 1916\\r\\nsdpnhipam 1134\\r\\nsvpzwtwn 389\\r\\nsz 1298\\r\\nuqdlfskhgo 0\\r\\nvdemdnxifb 0\\r\\nvowzavh 1269\\r\\nvunbpghae 0\\r\\nxokqjtylly 254\\r\\nybqgomvwoguzcqvzkx 412\\r\\n']}, {'input': ['1 17 0.97\\r\\nsfidbvqbvx 562\\r\\npmuvtjkw\\r\\nysxuhhfgwgifkf\\r\\nnsgdgacfdstvsf\\r\\ngggnzgevrtykq\\r\\nvmeytgyobqpmq\\r\\nrbzif\\r\\nfqbr\\r\\nepcy\\r\\ntvtgk\\r\\nsdwsny\\r\\nhuzsrlvxvufyb\\r\\niallwqylqga\\r\\nsemxysiafu\\r\\nodrxgpjgiiizlubtuv\\r\\nlenenatgyqep\\r\\nlzakhvoxfccct\\r\\nijkhhuppdghdwz\\r\\n'], 'output': ['18\\r\\nepcy 0\\r\\nfqbr 0\\r\\ngggnzgevrtykq 0\\r\\nhuzsrlvxvufyb 0\\r\\niallwqylqga 0\\r\\nijkhhuppdghdwz 0\\r\\nlenenatgyqep 0\\r\\nlzakhvoxfccct 0\\r\\nnsgdgacfdstvsf 0\\r\\nodrxgpjgiiizlubtuv 0\\r\\npmuvtjkw 0\\r\\nrbzif 0\\r\\nsdwsny 0\\r\\nsemxysiafu 0\\r\\nsfidbvqbvx 545\\r\\ntvtgk 0\\r\\nvmeytgyobqpmq 0\\r\\nysxuhhfgwgifkf 0\\r\\n']}, {'input': ['5 19 0.38\\r\\nmwfhslniu 2324\\r\\njyzifusxbigcagch 6167\\r\\nkccudxutkgb 9673\\r\\nuccmkylmiqcn 4773\\r\\niuawwcyefaimhro 214\\r\\njyzifusxbigcagch\\r\\nfalsionuewiyvseurg\\r\\nrkrvudkrhophdflqln\\r\\nahsybnxitvpm\\r\\nx\\r\\nancpcxgr\\r\\nsvs\\r\\nvvssivqobhdfqggahqu\\r\\npf\\r\\nwjtrtcvjqydxuwwvsqpc\\r\\nyllpzfjdojpymwy\\r\\nepjhkxffsymowea\\r\\nyztamblsfzk\\r\\nbej\\r\\nwy\\r\\nvnkvonk\\r\\nymsnsngzcvxeilbitknn\\r\\nlmaajt\\r\\nmwfhslniu\\r\\n'], 'output': ['21\\r\\nahsybnxitvpm 0\\r\\nancpcxgr 0\\r\\nbej 0\\r\\nepjhkxffsymowea 0\\r\\nfalsionuewiyvseurg 0\\r\\njyzifusxbigcagch 2343\\r\\nkccudxutkgb 3675\\r\\nlmaajt 0\\r\\nmwfhslniu 883\\r\\npf 0\\r\\nrkrvudkrhophdflqln 0\\r\\nsvs 0\\r\\nuccmkylmiqcn 1813\\r\\nvnkvonk 0\\r\\nvvssivqobhdfqggahqu 0\\r\\nwjtrtcvjqydxuwwvsqpc 0\\r\\nwy 0\\r\\nx 0\\r\\nyllpzfjdojpymwy 0\\r\\nymsnsngzcvxeilbitknn 0\\r\\nyztamblsfzk 0\\r\\n']}, {'input': ['13 10 0.35\\r\\napjqdcdylyads 948\\r\\ni 618\\r\\nsbifpsvflzngfziwx 6815\\r\\nlhuzbitj 8455\\r\\nzhoro 657\\r\\nfm 6899\\r\\nbhigr 6743\\r\\net 3322\\r\\nljbkmxj 3023\\r\\nloxxykp 6048\\r\\naiibfjdgd 965\\r\\nmmpylhw 5483\\r\\nyrbikjks 7426\\r\\nfm\\r\\njvj\\r\\napjqdcdylyads\\r\\nbhigr\\r\\naiibfjdgd\\r\\nljbkmxj\\r\\nauftuqyphmz\\r\\nloxxykp\\r\\nzhoro\\r\\ndmqdfmfjq\\r\\n'], 'output': ['16\\r\\naiibfjdgd 337\\r\\napjqdcdylyads 331\\r\\nauftuqyphmz 0\\r\\nbhigr 2360\\r\\ndmqdfmfjq 0\\r\\net 1162\\r\\nfm 2414\\r\\ni 216\\r\\njvj 0\\r\\nlhuzbitj 2959\\r\\nljbkmxj 1058\\r\\nloxxykp 2116\\r\\nmmpylhw 1919\\r\\nsbifpsvflzngfziwx 2385\\r\\nyrbikjks 2599\\r\\nzhoro 229\\r\\n']}, {'input': ['17 6 0.44\\r\\nhefojxlinlzhynuleh 9008\\r\\nufy 7485\\r\\ngmgjrihvgxsbcu 7575\\r\\nrnlz 3789\\r\\nnkvcpt 5813\\r\\nm 9066\\r\\nsjxpwpxrkbpydkjcojvq 8679\\r\\nftvk 9385\\r\\nyygdlclq 759\\r\\nvkltswaflkg 5183\\r\\notosgwfe 639\\r\\nmaayvyqtvxkudpbcfj 7425\\r\\nhys 935\\r\\ngwucwol 6087\\r\\nbrkmjhnmmrkjzhar 1247\\r\\ntea 205\\r\\nhyxhj 6600\\r\\nmaayvyqtvxkudpbcfj\\r\\nm\\r\\nrnlz\\r\\nbrkmjhnmmrkjzhar\\r\\nhys\\r\\ngwucwol\\r\\n'], 'output': ['16\\r\\nbrkmjhnmmrkjzhar 548\\r\\nftvk 4129\\r\\ngmgjrihvgxsbcu 3333\\r\\ngwucwol 2678\\r\\nhefojxlinlzhynuleh 3963\\r\\nhys 411\\r\\nhyxhj 2904\\r\\nm 3989\\r\\nmaayvyqtvxkudpbcfj 3267\\r\\nnkvcpt 2557\\r\\notosgwfe 281\\r\\nrnlz 1667\\r\\nsjxpwpxrkbpydkjcojvq 3818\\r\\nufy 3293\\r\\nvkltswaflkg 2280\\r\\nyygdlclq 333\\r\\n']}, {'input': ['19 3 0.40\\r\\npwmgdtn 817\\r\\nikzw 8809\\r\\nyjltrwizoumwvvtivqmm 2126\\r\\ntvdguvmepsvvp 9945\\r\\ndvhoxdvqyqmyl 5998\\r\\nalpxryere 7048\\r\\nchnprj 3029\\r\\ntnsrxilkay 1076\\r\\nquamvicl 7260\\r\\nzdzahaxmxnbkuqavmb 174\\r\\nywgyrbmmhwbrcx 3637\\r\\noicdsxki 7516\\r\\nzftrgvmtbuhqsmv 6831\\r\\njlfjgvzgmkmzbsjhwhy 8042\\r\\nzuy 2049\\r\\nhsahihp 1975\\r\\nkcfsycnilwqyqvsf 6896\\r\\ntdlgs 4302\\r\\nim 4476\\r\\nkcfsycnilwqyqvsf\\r\\nim\\r\\ndvhoxdvqyqmyl\\r\\n'], 'output': ['18\\r\\nalpxryere 2819\\r\\nchnprj 1211\\r\\ndvhoxdvqyqmyl 2399\\r\\nhsahihp 790\\r\\nikzw 3523\\r\\nim 1790\\r\\njlfjgvzgmkmzbsjhwhy 3216\\r\\nkcfsycnilwqyqvsf 2758\\r\\noicdsxki 3006\\r\\npwmgdtn 326\\r\\nquamvicl 2904\\r\\ntdlgs 1720\\r\\ntnsrxilkay 430\\r\\ntvdguvmepsvvp 3978\\r\\nyjltrwizoumwvvtivqmm 850\\r\\nywgyrbmmhwbrcx 1454\\r\\nzftrgvmtbuhqsmv 2732\\r\\nzuy 819\\r\\n']}, {'input': ['20 1 0.78\\r\\nxc 6799\\r\\nztrfjsq 3023\\r\\nkhbcbsaztwigxeidh 2974\\r\\nkksvbmtjiiqlguwv 188\\r\\nwvqzzjrpmxsdbfvua 4547\\r\\niqkqqwtqifdpxfhslpv 6264\\r\\nwarmknju 9472\\r\\nfheisuiufwmtagl 292\\r\\nwge 4338\\r\\nzaklermeji 6733\\r\\nfcn 6282\\r\\nbjyjzgzkgzy 1778\\r\\ngufpvhdnsesyfuegef 4998\\r\\nxnhuhwzzxqbaphktqbc 8485\\r\\ncokabaqahfw 8645\\r\\nbtgeopbwekffdadgj 1791\\r\\nsgvrgyhidnhecvt 7264\\r\\ncczstyyxhbpwj 3244\\r\\nguaykdl 3786\\r\\nmabamfnewwrykizn 4705\\r\\nbjyjzgzkgzy\\r\\n'], 'output': ['20\\r\\nbjyjzgzkgzy 1386\\r\\nbtgeopbwekffdadgj 1396\\r\\ncczstyyxhbpwj 2530\\r\\ncokabaqahfw 6743\\r\\nfcn 4899\\r\\nfheisuiufwmtagl 227\\r\\nguaykdl 2953\\r\\ngufpvhdnsesyfuegef 3898\\r\\niqkqqwtqifdpxfhslpv 4885\\r\\nkhbcbsaztwigxeidh 2319\\r\\nkksvbmtjiiqlguwv 146\\r\\nmabamfnewwrykizn 3669\\r\\nsgvrgyhidnhecvt 5665\\r\\nwarmknju 7388\\r\\nwge 3383\\r\\nwvqzzjrpmxsdbfvua 3546\\r\\nxc 5303\\r\\nxnhuhwzzxqbaphktqbc 6618\\r\\nzaklermeji 5251\\r\\nztrfjsq 2357\\r\\n']}, {'input': ['1 1 0.94\\r\\na 8700\\r\\nb\\r\\n'], 'output': ['2\\r\\na 8178\\r\\nb 0\\r\\n']}, {'input': ['1 1 0.70\\r\\na 1000\\r\\na\\r\\n'], 'output': ['1\\r\\na 700\\r\\n']}, {'input': ['2 1 0.50\\r\\naxe 200\\r\\nmegafire 120\\r\\nmegafire\\r\\n'], 'output': ['2\\r\\naxe 100\\r\\nmegafire 0\\r\\n']}, {'input': ['5 4 0.99\\r\\naxe 350\\r\\nimpaler 300\\r\\nionize 102\\r\\nmegafire 120\\r\\nmagicboost 220\\r\\nheal\\r\\nmegafire\\r\\nshield\\r\\nmagicboost\\r\\n'], 'output': ['7\\r\\naxe 346\\r\\nheal 0\\r\\nimpaler 297\\r\\nionize 100\\r\\nmagicboost 217\\r\\nmegafire 118\\r\\nshield 0\\r\\n']}, {'input': ['1 1 0.94\\r\\na 8700\\r\\nb\\r\\n'], 'output': ['2\\r\\na 8178\\r\\nb 0\\r\\n']}, {'input': ['1 1 0.50\\r\\nlho 200\\r\\nhai\\r\\n'], 'output': ['2\\r\\nhai 0\\r\\nlho 100\\r\\n']}, {'input': ['20 3 0.29\\r\\na 100\\r\\nb 200\\r\\nc 300\\r\\nd 400\\r\\ne 500\\r\\nf 600\\r\\ng 700\\r\\nh 800\\r\\ni 900\\r\\nj 1000\\r\\nk 1100\\r\\nl 1200\\r\\nm 1300\\r\\nn 1400\\r\\no 1500\\r\\np 1600\\r\\nq 1700\\r\\nr 1800\\r\\ns 1900\\r\\nt 2000\\r\\nz\\r\\nm\\r\\nk\\r\\n'], 'output': ['18\\r\\nd 116\\r\\ne 145\\r\\nf 174\\r\\ng 203\\r\\nh 232\\r\\ni 261\\r\\nj 290\\r\\nk 319\\r\\nl 348\\r\\nm 377\\r\\nn 406\\r\\no 435\\r\\np 464\\r\\nq 493\\r\\nr 522\\r\\ns 551\\r\\nt 580\\r\\nz 0\\r\\n']}, {'input': ['2 2 0.50\\r\\nabcd 200\\r\\naaa 201\\r\\nfff\\r\\nffff\\r\\n'], 'output': ['4\\r\\naaa 100\\r\\nabcd 100\\r\\nfff 0\\r\\nffff 0\\r\\n']}, {'input': ['1 1 0.94\\r\\na 8700\\r\\nb\\r\\n'], 'output': ['2\\r\\na 8178\\r\\nb 0\\r\\n']}, {'input': ['1 1 0.29\\r\\nhren 400\\r\\nblin\\r\\n'], 'output': ['2\\r\\nblin 0\\r\\nhren 116\\r\\n']}, {'input': ['5 4 0.30\\r\\naxe 350\\r\\nimpaler 9000\\r\\nionize 80\\r\\nmegafire 120\\r\\nmagicboost 220\\r\\nheal\\r\\nmegafire\\r\\nshield\\r\\nmagicboost\\r\\n'], 'output': ['6\\r\\naxe 105\\r\\nheal 0\\r\\nimpaler 2700\\r\\nmagicboost 0\\r\\nmegafire 0\\r\\nshield 0\\r\\n']}, {'input': ['1 1 0.03\\r\\naxe 9900\\r\\nheal\\r\\n'], 'output': ['2\\r\\naxe 297\\r\\nheal 0\\r\\n']}]","id":382} {"difficulty":2600,"lang":"Go","lang_cluster":"Go","src_uid":"1237_F","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n)\nvar wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)\nvar rdr = bufio.NewScanner(os.Stdin)\nfunc gs() string { rdr.Scan(); return rdr.Text() }\nfunc gi() int { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }\nfunc gis(n int) []int { res := make([]int,n); for i:=0;i b { return a }; return b }\nfunc min(a,b int) int { if a > b { return b }; return a }\nfunc maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }\nfunc minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }\nfunc sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }\nfunc zeroarr(a []int) { for i:=0; i 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }\nfunc powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }\nfunc gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }\nfunc gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b\/a)*x1,x1 }\nfunc modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true }\nfunc vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr,\" \") }\nfunc makefact(n int,mod int) ([]int,[]int) {\n\tfact,factinv := make([]int,n+1),make([]int,n+1)\n\tfact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }\n\tfactinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }\n\treturn fact,factinv\n}\n\nfunc ia64(m int) []int64 { return make([]int64,m) }\nfunc iai64(m int,v int64) []int64 { a := make([]int64,m); for i:=0;i b { return a }; return b }\nfunc min64(a,b int64) int64 { if a > b { return b }; return a }\nfunc maxarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }\nfunc minarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }\nfunc sumarr64(a []int64) int64 { ans := int64(0); for _,aa := range(a) { ans += aa }; return ans }\nfunc zeroarr64(a []int64) { for i:=0; i 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }\nfunc powint64(a,e int64) int64 { res, m := int64(1), a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }\nfunc gcd64(a,b int64) int64 { for b != 0 { t:=b; b=a%b; a=t }; return a }\nfunc gcdExtended64(a,b int64) (int64,int64,int64) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended64(b%a,a); return gcd, y1-(b\/a)*x1,x1 }\nfunc modinv64(a,m int64) (int64,bool) { g,x,_ := gcdExtended64(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true }\nfunc vecint64string(a []int64) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.FormatInt(a,10) }; return strings.Join(astr,\" \") }\nfunc makefact64(n int,mod int64) ([]int64,[]int64) {\n\tfact,factinv := make([]int64,n+1),make([]int64,n+1)\n\tfact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * int64(i) % mod }\n\tfactinv[n] = powmod64(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * int64(i+1) % mod }\n\treturn fact,factinv\n}\nconst MOD int64 = 998244353\nfunc main() {\n\t\/\/f1, _ := os.Create(\"cpu.prof\"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()\n\tdefer wrtr.Flush()\n\tinfn := \"\"; if infn == \"\" && len(os.Args) > 1 {\tinfn = os.Args[1] }\n\tif infn != \"\" {\tf, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }\n\trdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)\n\t\/\/ PROGRAM STARTS HERE\n\tH,W,N := gi(),gi(),gi(); R1,C1,R2,C2 := fill4(N); for i:=0;i n { return 0 }; return fact[n] * factinv[r] % MOD * factinv[n-r] % MOD }\n\tsbh := make([]bool,H); sbw := make([]bool,W)\n\tfor _,r := range R1 { sbh[r] = true }; for _,r := range R2 { sbh[r] = true }\n\tfor _,c := range C1 { sbw[c] = true }; for _,c := range C2 { sbw[c] = true }\n\trtot := 0; for _,b := range sbh { if !b { rtot++ } }\n\tctot := 0; for _,b := range sbw { if !b { ctot++ } }\n\tdoPairDp := func(sb []bool) []int64 {\n\t\tn := len(sb)\n\t\td := n\/2+2\n\t\tdp := twodi64(d,n,0)\n\t\tfor i:=0;i=0;j-- {\n\t\t\t\tdp[i][j] = dp[i][j+1]\n\t\t\t\tif !sb[j] && !sb[j+1] { dp[i][j] += dp[i-1][j+2]; dp[i][j] %= MOD }\n\t\t\t}\n\t\t}\n\t\tansarr := ia64(d); for i:=0;i b { return a }; return b }\nfunc min(a,b int) int { if a > b { return b }; return a }\nfunc maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }\nfunc minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }\nfunc sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }\nfunc zeroarr(a []int) { for i:=0; i 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }\nfunc powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }\nfunc gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }\nfunc gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b\/a)*x1,x1 }\nfunc modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true }\nfunc vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr,\" \") }\nfunc makefact(n int,mod int) ([]int,[]int) {\n\tfact,factinv := make([]int,n+1),make([]int,n+1)\n\tfact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }\n\tfactinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }\n\treturn fact,factinv\n}\n\nfunc ia64(m int) []int64 { return make([]int64,m) }\nfunc iai64(m int,v int64) []int64 { a := make([]int64,m); for i:=0;i b { return a }; return b }\nfunc min64(a,b int64) int64 { if a > b { return b }; return a }\nfunc maxarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }\nfunc minarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }\nfunc sumarr64(a []int64) int64 { ans := int64(0); for _,aa := range(a) { ans += aa }; return ans }\nfunc zeroarr64(a []int64) { for i:=0; i 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }\nfunc powint64(a,e int64) int64 { res, m := int64(1), a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }\nfunc gcd64(a,b int64) int64 { for b != 0 { t:=b; b=a%b; a=t }; return a }\nfunc gcdExtended64(a,b int64) (int64,int64,int64) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended64(b%a,a); return gcd, y1-(b\/a)*x1,x1 }\nfunc modinv64(a,m int64) (int64,bool) { g,x,_ := gcdExtended64(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true }\nfunc vecint64string(a []int64) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.FormatInt(a,10) }; return strings.Join(astr,\" \") }\nfunc makefact64(n int,mod int64) ([]int64,[]int64) {\n\tfact,factinv := make([]int64,n+1),make([]int64,n+1)\n\tfact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * int64(i) % mod }\n\tfactinv[n] = powmod64(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * int64(i+1) % mod }\n\treturn fact,factinv\n}\nconst MOD int64 = 998244353\nfunc main() {\n\t\/\/f1, _ := os.Create(\"cpu.prof\"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()\n\tdefer wrtr.Flush()\n\tinfn := \"\"; if infn == \"\" && len(os.Args) > 1 {\tinfn = os.Args[1] }\n\tif infn != \"\" {\tf, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }\n\trdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)\n\t\/\/ PROGRAM STARTS HERE\n\tH,W,N := gi(),gi(),gi(); R1,C1,R2,C2 := fill4(N); for i:=0;i n { return 0 }; return fact[n] * factinv[r] % MOD * factinv[n-r] % MOD }\n\tsbh := make([]bool,H); sbw := make([]bool,W)\n\tfor _,r := range R1 { sbh[r] = true }; for _,r := range R2 { sbh[r] = true }\n\tfor _,c := range C1 { sbw[c] = true }; for _,c := range C2 { sbw[c] = true }\n\trtot := 0; for _,b := range sbh { if !b { rtot++ } }\n\tctot := 0; for _,b := range sbw { if !b { ctot++ } }\n\tdoPairDp := func(sb []bool) []int64 {\n\t\tn := len(sb)\n\t\tansarr := make([]int64,0,n)\n\t\tansarr = append(ansarr,1)\n\t\tif n == 1 { return ansarr }\n\t\tdp := iai64(n,1); ndp := iai64(n,0)\n\t\tfor i:=1;i=0;j-- {\n\t\t\t\tndp[j] = ndp[j+1]\n\t\t\t\tif !sb[j] && !sb[j+1] { ndp[j] += dp[j+2]; ndp[j] %= MOD }\n\t\t\t}\n\t\t\tif ndp[0] == 0 { break }\n\t\t\tansarr = append(ansarr,ndp[0])\n\t\t\tdp,ndp = ndp,dp\n\t\t}\n\t\treturn ansarr\n\t}\n\trdp := doPairDp(sbh)\n\tcdp := doPairDp(sbw)\n\tans := int64(0)\n\tfor i,v1 := range rdp {\n\t\tfor j,v2 := range cdp {\n\t\t\trs := rtot-2*i\n\t\t\tcs := ctot-2*j\n\t\t\tif cs < i || rs < j { continue }\n\t\t\tadder := v1 * comb(cs,i) % MOD * v2 % MOD * comb(rs,j) % MOD * fact[i] % MOD * fact[j] % MOD\n\t\t\tans += adder\n\t\t}\n\t}\n\tans %= MOD\n\tfmt.Println(ans)\n}\n\n","testcases":"[{'input': ['5 7 2\\r\\n3 1 3 2\\r\\n4 4 4 5\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 4 2\\r\\n1 2 2 2\\r\\n4 3 4 4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['23 42 0\\r\\n'], 'output': ['102848351\\r\\n']}, {'input': ['1 1 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 5 0\\r\\n'], 'output': ['178\\r\\n']}, {'input': ['9 8 4\\r\\n8 6 9 6\\r\\n3 8 4 8\\r\\n5 3 6 3\\r\\n7 1 7 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['16 39 9\\r\\n3 28 3 29\\r\\n5 27 6 27\\r\\n12 32 12 33\\r\\n10 39 11 39\\r\\n1 22 1 23\\r\\n7 36 7 37\\r\\n2 9 2 10\\r\\n14 21 15 21\\r\\n4 34 4 35\\r\\n'], 'output': ['77137\\r\\n']}, {'input': ['54 53 9\\r\\n11 45 12 45\\r\\n25 23 26 23\\r\\n13 39 14 39\\r\\n37 6 38 6\\r\\n20 30 21 30\\r\\n27 35 28 35\\r\\n6 4 7 4\\r\\n33 1 34 1\\r\\n47 41 48 41\\r\\n'], 'output': ['796215167\\r\\n']}, {'input': ['3600 3600 0\\r\\n'], 'output': ['537036583\\r\\n']}, {'input': ['3600 3600 20\\r\\n380 2371 381 2371\\r\\n1458 239 1458 240\\r\\n3075 2519 3075 2520\\r\\n3456 2092 3456 2093\\r\\n1731 3132 1731 3133\\r\\n2403 1200 2403 1201\\r\\n1114 3050 1114 3051\\r\\n3070 1284 3071 1284\\r\\n1906 3242 1906 3243\\r\\n833 1904 834 1904\\r\\n120 2663 121 2663\\r\\n1290 2199 1290 2200\\r\\n1275 3113 1275 3114\\r\\n276 78 276 79\\r\\n3510 2412 3511 2412\\r\\n1189 2996 1189 2997\\r\\n1764 2367 1765 2367\\r\\n286 2122 287 2122\\r\\n51 2356 51 2357\\r\\n1722 1471 1722 1472\\r\\n'], 'output': ['276971428\\r\\n']}, {'input': ['1 3600 0\\r\\n'], 'output': ['3600\\r\\n']}, {'input': ['3600 1 1\\r\\n414 1 415 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 2 1\\r\\n1 1 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 2 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 1 1\\r\\n1 1 2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 3600 1\\r\\n1 3071 1 3072\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3600 1 0\\r\\n'], 'output': ['3600\\r\\n']}]","id":383} {"difficulty":2400,"lang":"Go","lang_cluster":"Go","src_uid":"1244_G","execute_outcome":"WRONG_ANSWER","source_code":"package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"math\"\r\n\t\"strconv\"\r\n)\r\n\r\nfunc len1N(n int) int {\r\n\tif n <= 0 {\r\n\t\treturn 0\r\n\t}\r\n\tl := int(math.Log10(float64(n)))\r\n\tnn := int(math.Pow10(l) - 1)\r\n\treturn len1N(nn) + (n-nn)*(l+2)\r\n}\r\n\r\nfunc main() {\r\n\tvar n, k int64\r\n\tfmt.Scanf(\"%d %d\", &n, &k)\r\n\tmin := n * (n + 1) \/ 2\r\n\tvar max int64\r\n\tif n%2 == 0 {\r\n\t\tmax = (3*n + 2) * n \/ 4\r\n\t} else {\r\n\t\tmax = (3*n - 1) * (n + 1) \/ 4\r\n\t}\r\n\tif k < min {\r\n\t\tfmt.Println(\"-1\")\r\n\t\treturn\r\n\t}\r\n\tif k > max {\r\n\t\tk = max\r\n\t}\r\n\tfmt.Println(k)\r\n\tres := make([]byte, 0, len1N(int(n)))\r\n\tfor i := int64(1); i <= n; i++ {\r\n\t\tres = strconv.AppendInt(res, i, 10)\r\n\t\tres = append(res, ' ')\r\n\t}\r\n\tfmt.Printf(\"%s\\n\", res)\r\n\tres = res[:0]\r\n\tdiff := k - min\r\n\tmmax := n\r\n\trem := map[int64]int64{}\r\n\tfor i := int64(1); i <= n; i++ {\r\n\t\tif i >= mmax || mmax-i > diff {\r\n\t\t\tif nnn, ok := rem[i]; ok {\r\n\t\t\t\tres = strconv.AppendInt(res, nnn, 10)\r\n\t\t\t\tres = append(res, ' ')\r\n\t\t\t} else {\r\n\t\t\t\tres = strconv.AppendInt(res, i, 10)\r\n\t\t\t\tres = append(res, ' ')\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tres = strconv.AppendInt(res, mmax, 10)\r\n\t\t\tres = append(res, ' ')\r\n\t\t\tdiff -= mmax - i\r\n\t\t\trem[mmax] = i\r\n\t\t\tmmax--\r\n\t\t}\r\n\t}\r\n\tif diff != 0 {\r\n\t\tpanic(\"Programming error\")\r\n\t}\r\n}\r\n","description":"Demonstrative competitions will be held in the run-up to the $$$20NN$$$ Berlatov Olympic Games. Today is the day for the running competition!Berlatov team consists of $$$2n$$$ runners which are placed on two running tracks; $$$n$$$ runners are placed on each track. The runners are numbered from $$$1$$$ to $$$n$$$ on each track. The runner with number $$$i$$$ runs through the entire track in $$$i$$$ seconds.The competition is held as follows: first runners on both tracks start running at the same time; when the slower of them arrives at the end of the track, second runners on both tracks start running, and everyone waits until the slower of them finishes running, and so on, until all $$$n$$$ pairs run through the track.The organizers want the run to be as long as possible, but if it lasts for more than $$$k$$$ seconds, the crowd will get bored. As the coach of the team, you may choose any order in which the runners are arranged on each track (but you can't change the number of runners on each track or swap runners between different tracks).You have to choose the order of runners on each track so that the duration of the competition is as long as possible, but does not exceed $$$k$$$ seconds.Formally, you want to find two permutations $$$p$$$ and $$$q$$$ (both consisting of $$$n$$$ elements) such that $$$sum = \\sum\\limits_{i=1}^{n} max(p_i, q_i)$$$ is maximum possible, but does not exceed $$$k$$$. If there is no such pair, report about it.","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 10^6, 1 \\le k \\le n^2$$$) \u2014 the number of runners on each track and the maximum possible duration of the competition, respectively.\n","output_specification":"If it is impossible to reorder the runners so that the duration of the competition does not exceed $$$k$$$ seconds, print $$$-1$$$. \nOtherwise, print three lines. The first line should contain one integer $$$sum$$$ \u2014 the maximum possible duration of the competition not exceeding $$$k$$$. The second line should contain a permutation of $$$n$$$ integers $$$p_1, p_2, \\dots, p_n$$$ ($$$1 \\le p_i \\le n$$$, all $$$p_i$$$ should be pairwise distinct) \u2014 the numbers of runners on the first track in the order they participate in the competition. The third line should contain a permutation of $$$n$$$ integers $$$q_1, q_2, \\dots, q_n$$$ ($$$1 \\le q_i \\le n$$$, all $$$q_i$$$ should be pairwise distinct) \u2014 the numbers of runners on the second track in the order they participate in the competition. The value of $$$sum = \\sum\\limits_{i=1}^{n} max(p_i, q_i)$$$ should be maximum possible, but should not exceed $$$k$$$. If there are multiple answers, print any of them.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"math\"\r\n\t\"strconv\"\r\n)\r\n\r\nfunc len1N(n int) int {\r\n\tif n <= 0 {\r\n\t\treturn 0\r\n\t}\r\n\tl := int(math.Log10(float64(n)))\r\n\tnn := int(math.Pow10(l) - 1)\r\n\treturn len1N(nn) + (n-nn)*(l+2)\r\n}\r\n\r\nfunc main() {\r\n\tvar n, k int64\r\n\tfmt.Scanf(\"%d %d\", &n, &k)\r\n\tmin := n * (n + 1) \/ 2\r\n\tvar max int64\r\n\tif n%2 == 0 {\r\n\t\tmax = (3*n + 2) * n \/ 4\r\n\t} else {\r\n\t\tmax = (3*n - 1) * (n + 1) \/ 4\r\n\t}\r\n\tif k < min {\r\n\t\tfmt.Println(\"-1\")\r\n\t\treturn\r\n\t}\r\n\tif k > max {\r\n\t\tk = max\r\n\t}\r\n\tfmt.Println(k)\r\n\tres := make([]byte, 0, len1N(int(n)))\r\n\tfor i := int64(1); i <= n; i++ {\r\n\t\tres = strconv.AppendInt(res, i, 10)\r\n\t\tres = append(res, ' ')\r\n\t}\r\n\tfmt.Printf(\"%s\\n\", res)\r\n\tres = res[:0]\r\n\tdiff := k - min\r\n\tmmax := n\r\n\trem := map[int64]int64{}\r\n\tfor i := int64(1); i <= n; i++ {\r\n\t\tif i >= mmax || mmax-i > diff {\r\n\t\t\tif nnn, ok := rem[i]; ok {\r\n\t\t\t\tres = strconv.AppendInt(res, nnn, 10)\r\n\t\t\t\tres = append(res, ' ')\r\n\t\t\t} else {\r\n\t\t\t\tres = strconv.AppendInt(res, i, 10)\r\n\t\t\t\tres = append(res, ' ')\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tres = strconv.AppendInt(res, mmax, 10)\r\n\t\t\tres = append(res, ' ')\r\n\t\t\tdiff -= mmax - i\r\n\t\t\trem[mmax] = i\r\n\t\t\tmmax--\r\n\t\t}\r\n\t}\r\n\tfmt.Printf(\"%s\\n\", res)\r\n\tif diff != 0 {\r\n\t\tpanic(\"Programming error\")\r\n\t}\r\n}\r\n","testcases":"[{'input': ['5 20\\r\\n'], 'output': ['20\\r\\n1 2 3 4 5 \\r\\n5 2 4 3 1 \\r\\n']}, {'input': ['3 9\\r\\n'], 'output': ['8\\r\\n1 2 3 \\r\\n3 2 1 \\r\\n']}, {'input': ['10 54\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 55\\r\\n'], 'output': ['55\\r\\n1 2 3 4 5 6 7 8 9 10 \\r\\n1 2 3 4 5 6 7 8 9 10 \\r\\n']}, {'input': ['10 80\\r\\n'], 'output': ['80\\r\\n1 2 3 4 5 6 7 8 9 10 \\r\\n10 9 8 7 6 5 4 3 2 1 \\r\\n']}, {'input': ['10 81\\r\\n'], 'output': ['80\\r\\n1 2 3 4 5 6 7 8 9 10 \\r\\n10 9 8 7 6 5 4 3 2 1 \\r\\n']}, {'input': ['1 1\\r\\n'], 'output': ['1\\r\\n1 \\r\\n1 \\r\\n']}, {'input': ['1000000 500000499999\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1000000 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 3\\r\\n'], 'output': ['3\\r\\n1 2 \\r\\n1 2 \\r\\n']}, {'input': ['2 4\\r\\n'], 'output': ['4\\r\\n1 2 \\r\\n2 1 \\r\\n']}, {'input': ['3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 6\\r\\n'], 'output': ['6\\r\\n1 2 3 \\r\\n1 2 3 \\r\\n']}, {'input': ['3 7\\r\\n'], 'output': ['7\\r\\n1 2 3 \\r\\n1 3 2 \\r\\n']}, {'input': ['3 8\\r\\n'], 'output': ['8\\r\\n1 2 3 \\r\\n3 2 1 \\r\\n']}, {'input': ['50 1274\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50 1275\\r\\n'], 'output': ['1275\\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 \\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 \\r\\n']}, {'input': ['50 1276\\r\\n'], 'output': ['1276\\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 \\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 50 49 \\r\\n']}, {'input': ['50 1345\\r\\n'], 'output': ['1345\\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 \\r\\n50 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 49 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 28 1 \\r\\n']}, {'input': ['50 1678\\r\\n'], 'output': ['1678\\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 \\r\\n50 49 48 47 46 45 44 43 42 41 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 40 38 39 37 10 9 8 7 6 5 4 3 2 1 \\r\\n']}, {'input': ['50 1870\\r\\n'], 'output': ['1870\\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 \\r\\n50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 20 21 22 23 24 31 26 27 28 29 30 25 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 \\r\\n']}, {'input': ['50 1899\\r\\n'], 'output': ['1899\\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 \\r\\n50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 25 26 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']}, {'input': ['50 1900\\r\\n'], 'output': ['1900\\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 \\r\\n50 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']}, {'input': ['50 1901\\r\\n'], 'output': ['1900\\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 \\r\\n50 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']}, {'input': ['500 125249\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10000 50004999\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100000 5000049999\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['500000 125000249999\\r\\n'], 'output': ['-1\\r\\n']}]","id":384} {"difficulty":2000,"lang":"Go","lang_cluster":"Go","src_uid":"13cd1aafbb1ba76be9ee10eaf8d8aef5","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tin := bufio.NewReaderSize(os.Stdin, 1<<16)\n\tvar la, lb int\n\tfmt.Fscan(in, &la, &lb)\n\ta := make([]int, la)\n\tfor i := range a {\n\t\tfmt.Fscan(in, &a[i])\n\t}\n\tb := make([]int, lb)\n\tbPos := make([]int, 1e6+1)\n\tfor i := range b {\n\t\tfmt.Fscan(in, &b[i])\n\t\tbPos[b[i]] = i + 1\n\t}\n\n\tans := 0\n\twrapped := false\n\tvar i, j int\n\tfor i < la && j - i < la {\n\t\tif bPos[a[j%la]] == 0 {\n\t\t\tj++\n\t\t\ti = j\n\t\t\tcontinue\n\t\t}\n\t\tif i == j {\n\t\t\tj++\n\t\t\tif ans < j-i {\n\t\t\t\tans = j - i\n\t\t\t}\n\t\t}\n\t\tfor j-i < la {\n\t\t\tif bPos[a[j%la]] == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif bPos[a[j%la]] < bPos[a[(j-1)%la]] && (wrapped || bPos[a[i]] < bPos[a[j%la]]) || wrapped && bPos[a[i]] < bPos[a[j%la]] {\n\t\t\t\tif bPos[a[i]] > bPos[a[(i+1)%la]] {\n\t\t\t\t\twrapped = false\n\t\t\t\t}\n\t\t\t\ti++\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif bPos[a[j%la]] < bPos[a[(j-1)%la]] {\n\t\t\t\twrapped = true\n\t\t\t}\n\t\t\tj++\n\t\t\tif ans < j-i {\n\t\t\t\tans = j - i\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Println(ans)\n}\n","description":"Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hieroglyphs. We know that no hieroglyph occurs twice in either the first or the second circle (but in can occur once in each of them).Polycarpus wants to save these pictures on his laptop, but the problem is, laptops do not allow to write hieroglyphs circles. So Polycarp had to break each circle and write down all of its hieroglyphs in a clockwise order in one line. A line obtained from the first circle will be called a, and the line obtained from the second one will be called b.There are quite many ways to break hieroglyphic circles, so Polycarpus chooses the method, that makes the length of the largest substring of string a, which occurs as a subsequence in string b, maximum.Help Polycarpus \u2014 find the maximum possible length of the desired substring (subsequence) if the first and the second circles are broken optimally.The length of string s is the number of characters in it. If we denote the length of string s as |s|, we can write the string as s\u2009=\u2009s1s2... s|s|.A substring of s is a non-empty string x\u2009=\u2009s[a... b]\u2009=\u2009sasa\u2009+\u20091... sb (1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009|s|). For example, \"code\" and \"force\" are substrings of \"codeforces\", while \"coders\" is not. A subsequence of s is a non-empty string y\u2009=\u2009s[p1p2... p|y|]\u2009=\u2009sp1sp2... sp|y| (1\u2009\u2264\u2009p1\u2009<;\u2009p2\u2009<;\u2009...\u2009<;\u2009p|y|\u2009\u2264\u2009|s|). For example, \"coders\" is a subsequence of \"codeforces\".","input_specification":"The first line contains two integers la and lb (1\u2009\u2264\u2009la,\u2009lb\u2009\u2264\u20091000000) \u2014 the number of hieroglyphs in the first and second circles, respectively. Below, due to difficulties with encoding of Berland hieroglyphs, they are given as integers from 1 to 106. The second line contains la integers \u2014 the hieroglyphs in the first picture, in the clockwise order, starting with one of them. The third line contains lb integers \u2014 the hieroglyphs in the second picture, in the clockwise order, starting with one of them. It is guaranteed that the first circle doesn't contain a hieroglyph, which occurs twice. The second circle also has this property.","output_specification":"Print a single number \u2014 the maximum length of the common substring and subsequence. If at any way of breaking the circles it does not exist, print 0.","notes":"NoteIn the first test Polycarpus picks a string that consists of hieroglyphs 5 and 1, and in the second sample \u2014 from hieroglyphs 1, 3 and 5.","sample_inputs":["5 4\n1 2 3 4 5\n1 3 5 6","4 6\n1 3 5 2\n1 2 3 4 5 6","3 3\n1 2 3\n3 2 1"],"sample_outputs":["2","3","2"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tin := bufio.NewReaderSize(os.Stdin, 1<<16)\n\tvar la, lb int\n\tfmt.Fscan(in, &la, &lb)\n\ta := make([]int, la)\n\tfor i := range a {\n\t\tfmt.Fscan(in, &a[i])\n\t}\n\tb := make([]int, lb)\n\tbPos := make([]int, 1e6+1)\n\tfor i := range b {\n\t\tfmt.Fscan(in, &b[i])\n\t\tbPos[b[i]] = i + 1\n\t}\n\n\tans := 0\n\twrapped := false\n\tvar i, j int\n\tfor i < la && j - i < la {\n\t\tif bPos[a[j%la]] == 0 {\n\t\t\tj++\n\t\t\ti = j\n\t\t\twrapped = false\n\t\t\tcontinue\n\t\t}\n\t\tif i == j {\n\t\t\tj++\n\t\t\tif ans < j-i {\n\t\t\t\tans = j - i\n\t\t\t}\n\t\t}\n\t\tfor j-i < la {\n\t\t\tif bPos[a[j%la]] == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif bPos[a[j%la]] < bPos[a[(j-1)%la]] && (wrapped || bPos[a[i]] < bPos[a[j%la]]) || wrapped && bPos[a[i]] < bPos[a[j%la]] {\n\t\t\t\tif bPos[a[i]] > bPos[a[(i+1)%la]] {\n\t\t\t\t\twrapped = false\n\t\t\t\t}\n\t\t\t\ti++\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif bPos[a[j%la]] < bPos[a[(j-1)%la]] {\n\t\t\t\twrapped = true\n\t\t\t}\n\t\t\tj++\n\t\t\tif ans < j-i {\n\t\t\t\tans = j - i\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Println(ans)\n}\n","testcases":"[{'input': '5 4\\r\\n1 2 3 4 5\\r\\n1 3 5 6\\r\\n', 'output': ['2']}, {'input': '4 6\\r\\n1 3 5 2\\r\\n1 2 3 4 5 6\\r\\n', 'output': ['3']}, {'input': '3 3\\r\\n1 2 3\\r\\n3 2 1\\r\\n', 'output': ['2']}, {'input': '6 3\\r\\n1 2 3 4 5 6\\r\\n3 5 1\\r\\n', 'output': ['1']}, {'input': '1 1\\r\\n1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '100000 100000\\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 ...', 'output': ['100000']}, {'input': '99990 100000\\r\\n531596 374763 268649 293578 830864 93497 125421 546304 922745 44360 838604 661961 489689 14605 100679 729122 779450 716916 980744 659009 548920 279483 39948 138914 693625 988408 649619 24071 111551 64800 772610 732506 48246 10468 231111 2568...', 'output': ['99990']}, {'input': '5 5\\r\\n5 6 3 2 1\\r\\n4 3 1 5 6\\r\\n', 'output': ['4']}, {'input': '5 5\\r\\n9 2 5 1 3\\r\\n1 7 2 3 9\\r\\n', 'output': ['3']}, {'input': '10 10\\r\\n9 12 15 2 4 14 1 5 6 13\\r\\n12 11 13 1 4 3 8 2 14 15\\r\\n', 'output': ['3']}, {'input': '10 10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n6 7 8 9 10 1 2 3 4 5\\r\\n', 'output': ['10']}, {'input': '100 100\\r\\n182 176 23 94 28 42 109 10 153 44 4 3 59 17 14 102 169 113 117 133 49 62 89 30 158 180 184 79 118 55 66 72 162 175 191 188 90 16 15 58 143 5 115 48 170 178 82 20 81 34 173 104 36 146 95 194 183 47 134 190 86 123 199 140 65 75 155 13 43 51 128 137...', 'output': ['3']}, {'input': '1000 1000\\r\\n1230 1763 2375 2868 1167 2408 1063 1425 241 173 693 1476 2560 2684 257 2671 1996 1683 1192 2373 1436 1429 10 2147 2338 597 2475 2809 1075 396 638 1139 2343 961 1693 2174 1222 1235 1795 528 1821 2572 2986 2062 751 1307 412 2636 1934 2970 1114 61...', 'output': ['3']}, {'input': '10000 10000\\r\\n8532 16782 5709 1087 19633 16055 12710 9750 2918 5156 10843 9419 16719 19848 16630 7185 4256 3136 14142 19528 7356 19686 4193 11742 14649 2171 9246 12468 4176 14850 4745 5430 6149 13585 9674 9441 14460 17214 1291 18633 15532 16026 17846 7413 ...', 'output': ['5']}, {'input': '1000000 1000000\\r\\n929676 167519 528378 46165 403878 136373 942668 240293 260338 549598 774807 965633 919620 809634 593531 200108 184045 281408 988887 800798 14199 550283 338516 661285 206426 796903 344789 726270 787048 19756 128951 579179 961702 270300 299...', 'output': ['11']}, {'input': '1000000 1000000\\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 8...', 'output': ['2', '1000000']}, {'input': '1000000 900000\\r\\n75534 265542 455039 38675 872276 642849 579310 327685 525449 525638 517343 632116 419168 565531 520064 331066 208391 490476 154006 489612 896497 433333 204439 963551 578939 565966 453973 632081 961502 413964 951639 385459 650201 140583 773...', 'output': ['10']}, {'input': '900000 1000000\\r\\n208865 504878 875962 551935 266291 100654 375517 501833 616091 701146 443267 203248 473359 587095 195919 480245 703144 603303 33275 62604 779202 49103 115868 208955 426864 461039 686831 825547 69194 571295 301127 895076 67228 694016 246744...', 'output': ['10']}, {'input': '1000000 1000000\\r\\n814845 585921 166533 134278 874686 24126 908347 829633 522526 329789 731298 460750 317353 838447 97196 544692 119117 470614 703425 709239 973133 920217 879152 407186 52446 46975 404589 311442 740452 65522 865620 877647 241367 477793 40306...', 'output': ['11']}, {'input': '1000000 1000000\\r\\n68342 625545 192973 250464 939505 786525 606453 909209 83103 245275 446773 664949 91905 433347 935250 2046 585966 351886 349097 519983 714562 968155 684878 798341 861832 756639 287098 971581 555238 542857 79443 763179 305215 125382 588616...', 'output': ['10']}, {'input': '1000000 1000000\\r\\n248869 134298 52405 863656 741126 714546 632833 600494 822756 81873 896073 689407 840008 629335 389778 474765 202495 773738 651994 459819 509574 818964 147427 287444 498473 419404 808870 278650 558782 149416 634190 399869 470768 67609 811...', 'output': ['10']}, {'input': '1000000 1000000\\r\\n611952 502166 791142 169859 198996 132719 790009 344092 324478 316231 642896 471639 608258 544711 801170 304490 510274 227951 980378 512263 834950 592455 572545 233050 25756 12453 296571 264971 791395 605748 290888 735692 609319 473820 28...', 'output': ['10']}, {'input': '1000000 1000000\\r\\n163950 484337 549012 174317 714285 388739 829079 547431 481852 685996 861763 140837 377612 942713 226837 841450 915453 579147 508319 255455 273950 504636 50666 821215 207685 689601 485159 617518 132900 272288 55497 442092 437942 831401 93...', 'output': ['310308']}, {'input': '1000000 1000000\\r\\n778956 694986 225657 217411 46467 269599 918419 550591 244368 101765 831240 969287 881644 3006 231570 422835 103634 321274 756176 832874 148693 315860 267071 71566 272379 826909 424749 354265 40488 263890 473891 235567 854838 299900 90866...', 'output': ['51872']}, {'input': '1000000 1000000\\r\\n988195 323247 986348 128366 351554 377197 383404 716930 610375 971156 339114 130198 992366 938236 943809 892804 725503 395133 909515 674470 900264 19624 646737 656061 24273 247889 930905 573427 54770 672761 706958 915091 513185 736030 610...', 'output': ['7321']}, {'input': '1000000 1000000\\r\\n331034 664828 181928 679335 327855 479376 122251 633271 28681 684449 676358 409900 395653 427971 834486 31759 257900 534516 866362 663391 351199 616866 586604 929522 623992 791011 160580 869194 591074 766064 213260 176590 105862 347394 55...', 'output': ['880']}, {'input': '1000000 1000000\\r\\n716821 6301 298536 191645 641277 907349 258914 438586 627584 458423 280624 766276 803391 55699 966097 334753 961146 197335 57436 116938 181807 324294 759054 281272 854617 615893 408977 649780 468416 728519 89304 65193 481926 111550 736079...', 'output': ['773264']}, {'input': '1000000 1000000\\r\\n182006 941796 10725 571092 601961 301257 252855 830877 504797 608784 999557 860558 705352 839698 978433 454733 849874 979455 291096 25165 652778 384314 686828 907573 343155 602427 183963 353525 773787 218152 28343 607894 413539 597495 138...', 'output': ['489473']}, {'input': '1000000 1000000\\r\\n813433 672327 527305 935114 754884 968800 676861 191725 527434 19077 664724 287179 499883 207692 747999 142488 60787 890376 799627 488786 592724 203919 561368 516091 89183 520945 524499 701924 489829 117785 965049 383653 384947 141467 296...', 'output': ['337886']}, {'input': '100000 100000\\r\\n621284 369069 726276 49683 402261 860164 991272 371754 166123 352146 155744 40414 133675 625231 872918 274152 73811 529136 612837 76941 98993 441208 884005 937064 320139 710276 786631 454954 201566 213924 215592 182360 946373 913698 881586 ...', 'output': ['4']}, {'input': '999990 1000000\\r\\n575876 110935 576345 255039 426020 361394 879024 911798 686964 549725 752806 178479 697120 599628 198313 677786 302228 231037 215289 242903 293418 75556 220999 614677 71110 207455 695689 16498 242458 700423 65267 600607 509786 558700 14064...', 'output': ['999990']}, {'input': '999900 1000000\\r\\n472771 913836 578890 387383 117744 342722 778687 425621 539450 262276 557575 772804 286727 400731 485550 897424 764748 229118 786361 381049 814894 614855 196557 260269 258789 23108 769464 513767 912727 640427 756788 780173 139425 872494 48...', 'output': ['999900']}, {'input': '999000 1000000\\r\\n329814 85005 545386 972400 274941 225961 384223 286124 512530 450285 528378 915764 113345 215195 478497 352571 142570 589703 396731 146469 775207 857845 880050 525194 726848 855448 416540 786617 125653 37582 965337 882529 121101 203938 733...', 'output': ['999000']}, {'input': '500000 500000\\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 ...', 'output': ['0']}, {'input': '9 9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n7 8 9 1 2 4 5 6 3\\r\\n', 'output': ['8']}, {'input': '1 2\\r\\n1\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '1 1\\r\\n1\\r\\n1\\r\\n', 'output': ['1']}, {'input': '1000000 999999\\r\\n971491 914810 990920 974835 922199 975990 971879 966488 987921 967310 995563 997554 981156 991487 999494 985042 961713 983376 964076 988247 983053 986692 972353 991496 979079 976476 919377 997392 974921 975671 972636 984924 975764 942385 9...', 'output': ['10']}]","id":385} {"difficulty":1700,"lang":"Go","lang_cluster":"Go","src_uid":"18_B","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"package main\n\nimport (\n\t\"bytes\"\n\t\"os\"\n\t\"io\/ioutil\"\n\t\"fmt\"\n)\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar n, d, m, l int64\n\tfmt.Fscanf(reader, \"%d %d %d %d\", &n, &d, &m, &l)\n\tvar pos int64\n\n\tstep := d\n\tfor ;; pos += step {\n\t\tr := pos % m\n\t\tif r > l || pos > (n - 1) * m + l {\n\t\t\tfmt.Printf(\"%d\", pos)\n\t\t\treturn\n\t\t}\n\n\t\tif r == 0 && pos != 0 {\n\t\t\tpos = n * m \/ pos * pos\n\t\t}\n\t}\n}","description":"In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k-1)m,(k-1)m+l], and l= R * R) {\n fmt.Print(x1,y1,R)\n } else {\n if (x == 0 && y == 0) {\n dist := float64(R) \/ 2\n fmt.Print(float64(x1) + dist, float64(y1) + dist, dist)\n } else {\n l := math.Sqrt(float64(x*x+y*y))\n dist := (float64(R) + l) \/ 2\n xd := float64(x) \/ l * dist\n yd := float64(y) \/ l * dist\n fmt.Print(float64(x2) + xd, float64(y2) + yd, dist)\n }\n }\n}\n","description":"Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by Fifa) from its position. Fifa must put the access point inside the flat which has a circular shape of radius R. Fifa wants to minimize the area that is not covered by the access point inside the flat without letting Fafa or anyone outside the flat to get access to the internet.The world is represented as an infinite 2D plane. The flat is centered at (x1,\u2009y1) and has radius R and Fafa's laptop is located at (x2,\u2009y2), not necessarily inside the flat. Find the position and the radius chosen by Fifa for his access point which minimizes the uncovered area.","input_specification":"The single line of the input contains 5 space-separated integers R,\u2009x1,\u2009y1,\u2009x2,\u2009y2 (1\u2009\u2264\u2009R\u2009\u2264\u2009105, |x1|,\u2009|y1|,\u2009|x2|,\u2009|y2|\u2009\u2264\u2009105).","output_specification":"Print three space-separated numbers xap,\u2009yap,\u2009r where (xap,\u2009yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10\u2009-\u20096 absolutely or relatively, and also the radius you printed can be changed by no more than 10\u2009-\u20096 (absolutely or relatively) in such a way that all points outside the flat and Fafa's laptop position are outside circle of the access point range.","notes":null,"sample_inputs":["5 3 3 1 1","10 5 5 5 15"],"sample_outputs":["3.7677669529663684 3.7677669529663684 3.914213562373095","5.0 5.0 10.0"],"human_solution":"package main\n\nimport (\n\t\"fmt\"\n \"math\"\n)\n\nfunc main() {\n\tvar R,x1,y1,x2,y2 int64\n\tfmt.Scan(&R, &x1, &y1, &x2, &y2)\n x := x1 - x2\n y := y1 - y2\n if (x*x + y*y >= R * R) {\n fmt.Print(x1,y1,R)\n } else {\n if (x == 0 && y == 0) {\n dist := float64(R) \/ 2\n fmt.Print(float64(x1) + dist, float64(y1), dist)\n } else {\n l := math.Sqrt(float64(x*x+y*y))\n dist := (float64(R) + l) \/ 2\n xd := float64(x) \/ l * dist\n yd := float64(y) \/ l * dist\n fmt.Print(float64(x2) + xd, float64(y2) + yd, dist)\n }\n }\n}\n","testcases":"[{'input': '5 3 3 1 1\\r\\n', 'output': ['3.7677669529663684 3.7677669529663684 3.914213562373095\\r\\n']}, {'input': '10 5 5 5 15\\r\\n', 'output': ['5.0 5.0 10.0\\r\\n']}, {'input': '5 0 0 0 7\\r\\n', 'output': ['0 0 5\\r\\n']}, {'input': '10 0 0 0 0\\r\\n', 'output': ['5.0 0.0 5.0\\r\\n']}, {'input': '100000 100000 100000 10000 10000\\r\\n', 'output': ['100000 100000 100000\\r\\n']}, {'input': '100000 -100000 100000 -10000 100000\\r\\n', 'output': ['-105000.0 100000.0 95000.0\\r\\n']}, {'input': '1 0 0 0 -1\\r\\n', 'output': ['0.0 0.0 1.0\\r\\n']}, {'input': '100000 83094 84316 63590 53480\\r\\n', 'output': ['100069.69149822203 111154.72144376408 68243.2515742123\\r\\n']}, {'input': '1 0 0 0 0\\r\\n', 'output': ['0.5 0.0 0.5\\r\\n']}, {'input': '1 0 0 -2 -2\\r\\n', 'output': ['0 0 1\\r\\n']}, {'input': '10 0 0 4 0\\r\\n', 'output': ['-3.0 0.0 7.0\\r\\n']}, {'input': '82 1928 -30264 2004 -30294\\r\\n', 'output': ['1927.8636359254158 -30263.946172075823 81.85339643163098\\r\\n']}, {'input': '75 -66998 89495 -66988 89506\\r\\n', 'output': ['-67018.22522977486 89472.75224724766 44.933034373659254\\r\\n']}, {'input': '11 9899 34570 9895 34565\\r\\n', 'output': ['9900.435822761548 34571.794778451935 8.701562118716424\\r\\n']}, {'input': '21 7298 -45672 7278 -45677\\r\\n', 'output': ['7298.186496251526 -45671.95337593712 20.80776406404415\\r\\n']}, {'input': '31 84194 -71735 84170 -71758\\r\\n', 'output': ['84194 -71735 31\\r\\n']}, {'input': '436 25094 -66597 25383 -66277\\r\\n', 'output': ['25092.386577687754 -66598.78648837341 433.5927874489312\\r\\n']}, {'input': '390 -98011 78480 -98362 78671\\r\\n', 'output': ['-98011 78480 390\\r\\n']}, {'input': '631 -21115 -1762 -21122 -1629\\r\\n', 'output': ['-21101.91768814977 -2010.563925154407 382.0920415665416\\r\\n']}, {'input': '872 55782 51671 54965 51668\\r\\n', 'output': ['55809.49706065544 51671.100968398976 844.502753968685\\r\\n']}, {'input': '519 -92641 -28571 -92540 -28203\\r\\n', 'output': ['-92659.18165738975 -28637.246038806206 450.30421903092184\\r\\n']}, {'input': '3412 23894 22453 26265 25460\\r\\n', 'output': ['23894 22453 3412\\r\\n']}, {'input': '3671 -99211 -3610 -99825 -1547\\r\\n', 'output': ['-98994.40770099283 -4337.736014416596 2911.7161725229744\\r\\n']}, {'input': '3930 -76494 -83852 -78181 -81125\\r\\n', 'output': ['-76303.71953677801 -84159.58436467478 3568.316718555632\\r\\n']}, {'input': '4189 -24915 61224 -28221 65024\\r\\n', 'output': ['-24915 61224 4189\\r\\n']}, {'input': '8318 -2198 35161 3849 29911\\r\\n', 'output': ['-2315.0277877457083 35262.60342081445 8163.0201360632545\\r\\n']}, {'input': '15096 -12439 58180 -10099 50671\\r\\n', 'output': ['-13514.641370727473 61631.70557811649 11480.578066612283\\r\\n']}, {'input': '70343 64457 3256 83082 -17207\\r\\n', 'output': ['50095.092392996106 19035.206193939368 49006.464709026186\\r\\n']}, {'input': '66440 -58647 -76987 2151 -40758\\r\\n', 'output': ['-58647 -76987 66440\\r\\n']}, {'input': '62537 18249 96951 -3656 54754\\r\\n', 'output': ['21702.922094423477 103604.5106422455 55040.41533091097\\r\\n']}, {'input': '88209 95145 42027 21960 26111\\r\\n', 'output': ['101649.61478542663 43441.59928844504 81552.34132964142\\r\\n']}, {'input': '100000 -100000 -100000 -100000 -100000\\r\\n', 'output': ['-50000.0 -100000.0 50000.0\\r\\n']}, {'input': '100000 100000 100000 100000 100000\\r\\n', 'output': ['150000.0 100000.0 50000.0\\r\\n']}, {'input': '2 0 0 0 1\\r\\n', 'output': ['0.0 -0.5 1.5\\r\\n']}, {'input': '1 1 0 1 0\\r\\n', 'output': ['1.5 0.0 0.5\\r\\n']}, {'input': '2 3 3 3 3\\r\\n', 'output': ['4.0 3.0 1.0\\r\\n']}, {'input': '1 1 1 1 1\\r\\n', 'output': ['1.5 1.0 0.5\\r\\n']}, {'input': '10 1 1 1 1\\r\\n', 'output': ['6.0 1.0 5.0\\r\\n']}, {'input': '10 5 5 5 10\\r\\n', 'output': ['5.0 2.5 7.5\\r\\n']}, {'input': '5 0 0 0 0\\r\\n', 'output': ['2.5 0.0 2.5\\r\\n']}]","id":389} {"difficulty":2000,"lang":"Go","lang_cluster":"Go","src_uid":"31be4d38a8b5ea8738a65bfee24a5a21","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n \"fmt\"\n \"strconv\"\n)\n\nfunc solve (y int64) {\n var ten, step int64 = 0, 10\n for i := 1; i < len(strconv.Itoa(int(y))); i++ {\n ten += step\n step *= 10\n }\n for y < 1989 + ten {\n y += step\n }\n fmt.Printf(\"%d\\n\", y)\n}\n\nfunc main() {\n n := 1\n var y int64 = 1\n fmt.Scanf(\"%d\\n\", &n)\n for i := 1; i <= n; i++ {\n fmt.Scanf(\"IAO'%d\\n\", &y)\n solve(y)\n }\n}","description":"International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string y that has never been used before. Among all such valid abbreviations they choose the shortest one and announce it to be the abbreviation of this year's competition.For example, the first three Olympiads (years 1989, 1990 and 1991, respectively) received the abbreviations IAO'9, IAO'0 and IAO'1, while the competition in 2015 received an abbreviation IAO'15, as IAO'5 has been already used in 1995.You are given a list of abbreviations. For each of them determine the year it stands for.","input_specification":"The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000)\u00a0\u2014 the number of abbreviations to process. Then n lines follow, each containing a single abbreviation. It's guaranteed that each abbreviation contains at most nine digits.","output_specification":"For each abbreviation given in the input, find the year of the corresponding Olympiad.","notes":null,"sample_inputs":["5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0","4\nIAO'9\nIAO'99\nIAO'999\nIAO'9999"],"sample_outputs":["2015\n12015\n1991\n1989\n1990","1989\n1999\n2999\n9999"],"human_solution":"\npackage main\n\nimport (\n \"bufio\"\n \"fmt\"\n \"os\"\n \"strconv\"\n)\n\nvar stdin *bufio.Reader\nvar stdout *bufio.Writer\n\nfunc init() {\n\tstdin = bufio.NewReader(os.Stdin)\n stdout = bufio.NewWriter(os.Stdout)\n}\n\nfunc main() {\n\n ncase := 0\n fmt.Fscanf(stdin, \"%d\\n\", &ncase)\n for i := 0; i < ncase; i++ {\n str := \"\"\n fmt.Fscanf(stdin, \"IAO'%s\\n\", &str)\n \n if len(str) == 1 {\n if str == \"9\" {\n fmt.Fprintf(stdout, \"1989\\n\")\n } else if len(str) == 1 {\n fmt.Fprintf(stdout, \"199%s\\n\", str)\n }\n } else if len(str) == 2 {\n if str == \"99\" {\n fmt.Fprintf(stdout, \"1999\\n\")\n } else {\n fmt.Fprintf(stdout, \"20%s\\n\", str)\n }\n } else if len(str) == 3 {\n year, _ := strconv.Atoi(str)\n if 99 <= year {\n fmt.Fprintf(stdout, \"2%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"3%s\\n\", str)\n }\n } else if len(str) == 4 {\n year, _ := strconv.Atoi(str)\n if 3099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n } else if len(str) == 5 {\n year, _ := strconv.Atoi(str)\n if 13099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n } else if len(str) == 6 {\n year, _ := strconv.Atoi(str)\n if 113099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n } else if len(str) == 7 {\n year, _ := strconv.Atoi(str)\n if 1113099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n } else if len(str) == 8 {\n year, _ := strconv.Atoi(str)\n if 11113099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n } else if len(str) == 9 {\n year, _ := strconv.Atoi(str)\n if 111113099 <= year {\n fmt.Fprintf(stdout, \"%s\\n\", str)\n } else {\n fmt.Fprintf(stdout, \"1%s\\n\", str)\n }\n }\n \n }\n\n stdout.Flush()\n}","testcases":"[{'input': \"5\\r\\nIAO'15\\r\\nIAO'2015\\r\\nIAO'1\\r\\nIAO'9\\r\\nIAO'0\\r\\n\", 'output': ['2015\\r\\n12015\\r\\n1991\\r\\n1989\\r\\n1990']}, {'input': \"4\\r\\nIAO'9\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['1989\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1000\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'10\\r\\nIAO'11\\r\\nIAO'12\\r\\nIAO'13\\r\\nIAO'14\\r\\nIAO'15\\r\\nIAO'16\\r\\nIAO'17\\r\\nIAO'18\\r\\nIAO'19\\r\\nIAO'20\\r\\nIAO'21\\r\\nIAO'22\\r\\nIAO'23\\r\\nIAO'24\\r\\nIAO'25\\r\\nIAO'26\\r\\nIAO'27\\r\\nIAO'28\\r\\nIAO'29\\r\\nIAO'30\\r\\nIAO'31\\r\\nIAO'32\\r\\nIAO'33\\r\\nIAO'34\\r\\nIAO'35\\r\\nIAO'36\\r\\nIAO'37\\r\\nIAO'38\\r\\nIAO'39\\r\\nIAO'40\\r\\nIAO'41\\r\\nIAO'42\\r\\nIAO'43\\r\\nIAO'44\\r\\nIAO'45\\r\\nIAO'46\\r\\nIAO'47\\r\\nIAO'48\\r\\nIAO'49\\r\\nIAO'50\\r\\nIAO'51\\r\\nIAO'52\\r\\nIAO'53\\r\\nIAO'54\\r\\nIAO'55\\r\\nIAO'56\\r\\nIAO'57\\r\\nIAO'58\\r\\nIAO'59\\r\\nIAO'60\\r\\nIAO'61\\r\\nIAO'62\\r\\nIAO'63\\r\\nIAO...\", 'output': ['1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2010\\r\\n2011\\r\\n2012\\r\\n2013\\r\\n2014\\r\\n2015\\r\\n2016\\r\\n2017\\r\\n2018\\r\\n2019\\r\\n2020\\r\\n2021\\r\\n2022\\r\\n2023\\r\\n2024\\r\\n2025\\r\\n2026\\r\\n2027\\r\\n2028\\r\\n2029\\r\\n2030\\r\\n2031\\r\\n2032\\r\\n2033\\r\\n2034\\r\\n2035\\r\\n2036\\r\\n2037\\r\\n2038\\r\\n2039\\r\\n2040\\r\\n2041\\r\\n2042\\r\\n2043\\r\\n2044\\r\\n2045\\r\\n2046\\r\\n2047\\r\\n2048\\r\\n2049\\r\\n2050\\r\\n2051\\r\\n2052\\r\\n2053\\r\\n2054\\r\\n2055\\r\\n2056\\r\\n2057\\r\\n2058\\r\\n2059\\r\\n2060\\r\\n2061\\r\\n2062\\r\\n2063\\r\\n2064\\r\\n2065\\r\\n2066\\r\\n2067\\r\\n2068\\r\\n2069\\r\\n2070\\r\\n2071\\r\\n2072\\r\\n2073\\r\\n2074\\r\\n2075\\r\\n2076\\r\\n2077\\r\\n2078\\r\\n2079\\r\\n2080\\r\\n2081\\r\\n2082\\r\\n2083\\r\\n2084\\r\\n2...']}, {'input': \"1000\\r\\nIAO'111112940\\r\\nIAO'818187\\r\\nIAO'00078853\\r\\nIAO'11112867\\r\\nIAO'2677\\r\\nIAO'431790741\\r\\nIAO'5206510\\r\\nIAO'0003566\\r\\nIAO'11113008\\r\\nIAO'55873562\\r\\nIAO'870948497\\r\\nIAO'000019400\\r\\nIAO'00001733\\r\\nIAO'79230\\r\\nIAO'1113209\\r\\nIAO'00054768\\r\\nIAO'111113183\\r\\nIAO'000726284\\r\\nIAO'000984404\\r\\nIAO'13343\\r\\nIAO'853952489\\r\\nIAO'000042254\\r\\nIAO'000000083\\r\\nIAO'111113291\\r\\nIAO'1112892\\r\\nIAO'031211\\r\\nIAO'0000054\\r\\nIAO'88862\\r\\nIAO'000024897\\r\\nIAO'6068\\r\\nIAO'11113261\\r\\nIAO'1563400\\r\\nIAO'0000014\\r\\nIAO'1113147\\r\\nIAO'113122\\r\\nIAO'11113114\\r\\nIAO'11112873\\r\\nIAO'00...\", 'output': ['1111112940\\r\\n818187\\r\\n100078853\\r\\n111112867\\r\\n12677\\r\\n431790741\\r\\n5206510\\r\\n10003566\\r\\n111113008\\r\\n55873562\\r\\n870948497\\r\\n1000019400\\r\\n100001733\\r\\n79230\\r\\n1113209\\r\\n100054768\\r\\n111113183\\r\\n1000726284\\r\\n1000984404\\r\\n13343\\r\\n853952489\\r\\n1000042254\\r\\n1000000083\\r\\n111113291\\r\\n11112892\\r\\n1031211\\r\\n10000054\\r\\n88862\\r\\n1000024897\\r\\n6068\\r\\n11113261\\r\\n1563400\\r\\n10000014\\r\\n1113147\\r\\n113122\\r\\n11113114\\r\\n111112873\\r\\n1000000020\\r\\n2644846\\r\\n1113143\\r\\n111113142\\r\\n60064652\\r\\n33881\\r\\n99223093\\r\\n1113069\\r\\n11113003\\r\\n11112865\\r\\n100001371\\r\\n112865\\r\\n16735\\r\\n1000070394\\r\\n111113...']}, {'input': \"1000\\r\\nIAO'13042\\r\\nIAO'113044\\r\\nIAO'113014\\r\\nIAO'111112921\\r\\nIAO'3393\\r\\nIAO'11113123\\r\\nIAO'00042330\\r\\nIAO'0039790\\r\\nIAO'1112851\\r\\nIAO'09327\\r\\nIAO'11113210\\r\\nIAO'12940\\r\\nIAO'13374\\r\\nIAO'824097479\\r\\nIAO'90718\\r\\nIAO'112944\\r\\nIAO'12883\\r\\nIAO'227955125\\r\\nIAO'29726\\r\\nIAO'11113300\\r\\nIAO'373423793\\r\\nIAO'0059555\\r\\nIAO'40539982\\r\\nIAO'00000262\\r\\nIAO'000716486\\r\\nIAO'0040940\\r\\nIAO'00092502\\r\\nIAO'84551722\\r\\nIAO'931673356\\r\\nIAO'000048103\\r\\nIAO'0000009\\r\\nIAO'111113047\\r\\nIAO'111113101\\r\\nIAO'113132\\r\\nIAO'59665\\r\\nIAO'73538082\\r\\nIAO'11910636\\r\\nIAO'000000378\\r\\nIAO'...\", 'output': ['113042\\r\\n1113044\\r\\n1113014\\r\\n1111112921\\r\\n3393\\r\\n11113123\\r\\n100042330\\r\\n10039790\\r\\n11112851\\r\\n109327\\r\\n11113210\\r\\n112940\\r\\n13374\\r\\n824097479\\r\\n90718\\r\\n1112944\\r\\n112883\\r\\n227955125\\r\\n29726\\r\\n11113300\\r\\n373423793\\r\\n10059555\\r\\n40539982\\r\\n100000262\\r\\n1000716486\\r\\n10040940\\r\\n100092502\\r\\n84551722\\r\\n931673356\\r\\n1000048103\\r\\n10000009\\r\\n1111113047\\r\\n111113101\\r\\n113132\\r\\n59665\\r\\n73538082\\r\\n11910636\\r\\n1000000378\\r\\n38020058\\r\\n100000064\\r\\n100002195\\r\\n1100351\\r\\n1111113035\\r\\n111113019\\r\\n10005403\\r\\n1000000797\\r\\n100009407\\r\\n13290\\r\\n256572\\r\\n10016397\\r\\n12264\\r\\n43223192\\r\\n111...']}, {'input': \"1000\\r\\nIAO'11113273\\r\\nIAO'8976\\r\\nIAO'53105\\r\\nIAO'00013993\\r\\nIAO'000008754\\r\\nIAO'111112944\\r\\nIAO'000894307\\r\\nIAO'113081\\r\\nIAO'036408696\\r\\nIAO'11003\\r\\nIAO'111113304\\r\\nIAO'8416526\\r\\nIAO'236018\\r\\nIAO'3722798\\r\\nIAO'00000010\\r\\nIAO'112873\\r\\nIAO'37450\\r\\nIAO'000099605\\r\\nIAO'80580\\r\\nIAO'88114\\r\\nIAO'005746722\\r\\nIAO'111112971\\r\\nIAO'13301\\r\\nIAO'00000051\\r\\nIAO'11113128\\r\\nIAO'111112899\\r\\nIAO'11112865\\r\\nIAO'1112879\\r\\nIAO'12917\\r\\nIAO'13253\\r\\nIAO'11113260\\r\\nIAO'111112989\\r\\nIAO'1113163\\r\\nIAO'1113109\\r\\nIAO'4037959\\r\\nIAO'113022\\r\\nIAO'13346\\r\\nIAO'0001790\\r\\nIAO'4932\\r...\", 'output': ['11113273\\r\\n8976\\r\\n53105\\r\\n100013993\\r\\n1000008754\\r\\n1111112944\\r\\n1000894307\\r\\n1113081\\r\\n1036408696\\r\\n111003\\r\\n111113304\\r\\n8416526\\r\\n236018\\r\\n3722798\\r\\n100000010\\r\\n1112873\\r\\n37450\\r\\n1000099605\\r\\n80580\\r\\n88114\\r\\n1005746722\\r\\n1111112971\\r\\n13301\\r\\n100000051\\r\\n11113128\\r\\n1111112899\\r\\n111112865\\r\\n11112879\\r\\n112917\\r\\n13253\\r\\n11113260\\r\\n1111112989\\r\\n1113163\\r\\n1113109\\r\\n4037959\\r\\n1113022\\r\\n13346\\r\\n10001790\\r\\n4932\\r\\n36672\\r\\n18257129\\r\\n4772891\\r\\n108046895\\r\\n10007697\\r\\n113338\\r\\n113094\\r\\n12653\\r\\n785110421\\r\\n10000594\\r\\n113265\\r\\n10566285\\r\\n111112882\\r\\n569331178\\r\\n1000398068...']}, {'input': \"1000\\r\\nIAO'11113341\\r\\nIAO'000004632\\r\\nIAO'1112875\\r\\nIAO'113306\\r\\nIAO'112878\\r\\nIAO'002666131\\r\\nIAO'21605282\\r\\nIAO'1888\\r\\nIAO'13010\\r\\nIAO'000643083\\r\\nIAO'0000052\\r\\nIAO'113111\\r\\nIAO'00916\\r\\nIAO'29776\\r\\nIAO'445127275\\r\\nIAO'113287\\r\\nIAO'111112865\\r\\nIAO'4903398\\r\\nIAO'3617746\\r\\nIAO'079220\\r\\nIAO'111113067\\r\\nIAO'680662260\\r\\nIAO'1113017\\r\\nIAO'12893\\r\\nIAO'1112903\\r\\nIAO'841512029\\r\\nIAO'113315\\r\\nIAO'536013\\r\\nIAO'6624475\\r\\nIAO'13314\\r\\nIAO'000003682\\r\\nIAO'271008325\\r\\nIAO'04004\\r\\nIAO'000000049\\r\\nIAO'12876\\r\\nIAO'000009305\\r\\nIAO'0051405\\r\\nIAO'11112988\\r\\nIAO'0000...\", 'output': ['11113341\\r\\n1000004632\\r\\n11112875\\r\\n113306\\r\\n1112878\\r\\n1002666131\\r\\n21605282\\r\\n11888\\r\\n113010\\r\\n1000643083\\r\\n10000052\\r\\n113111\\r\\n100916\\r\\n29776\\r\\n445127275\\r\\n113287\\r\\n1111112865\\r\\n4903398\\r\\n3617746\\r\\n1079220\\r\\n1111113067\\r\\n680662260\\r\\n11113017\\r\\n112893\\r\\n11112903\\r\\n841512029\\r\\n113315\\r\\n536013\\r\\n6624475\\r\\n13314\\r\\n1000003682\\r\\n271008325\\r\\n104004\\r\\n1000000049\\r\\n112876\\r\\n1000009305\\r\\n10051405\\r\\n111112988\\r\\n100000087\\r\\n675909060\\r\\n316729520\\r\\n111113222\\r\\n8017601\\r\\n1111112992\\r\\n1113282\\r\\n100003907\\r\\n111113089\\r\\n11113002\\r\\n1112856\\r\\n5004571\\r\\n1113135\\r\\n1113217\\r\\n10...']}, {'input': \"1000\\r\\nIAO'5864\\r\\nIAO'112961\\r\\nIAO'000001780\\r\\nIAO'959112\\r\\nIAO'751285866\\r\\nIAO'0000050\\r\\nIAO'00007045\\r\\nIAO'4884\\r\\nIAO'380539882\\r\\nIAO'11112876\\r\\nIAO'7999\\r\\nIAO'111112869\\r\\nIAO'3825105\\r\\nIAO'9596134\\r\\nIAO'511898\\r\\nIAO'5347\\r\\nIAO'678172\\r\\nIAO'11112902\\r\\nIAO'111112873\\r\\nIAO'230800781\\r\\nIAO'8315\\r\\nIAO'11113216\\r\\nIAO'111113179\\r\\nIAO'052538046\\r\\nIAO'28240898\\r\\nIAO'000052957\\r\\nIAO'46208212\\r\\nIAO'196482\\r\\nIAO'71561148\\r\\nIAO'13139\\r\\nIAO'99827216\\r\\nIAO'000006898\\r\\nIAO'111113280\\r\\nIAO'113198\\r\\nIAO'000000592\\r\\nIAO'15005515\\r\\nIAO'017905\\r\\nIAO'13057\\r\\nIAO'...\", 'output': ['5864\\r\\n1112961\\r\\n1000001780\\r\\n959112\\r\\n751285866\\r\\n10000050\\r\\n100007045\\r\\n4884\\r\\n380539882\\r\\n111112876\\r\\n7999\\r\\n1111112869\\r\\n3825105\\r\\n9596134\\r\\n511898\\r\\n5347\\r\\n678172\\r\\n111112902\\r\\n1111112873\\r\\n230800781\\r\\n8315\\r\\n11113216\\r\\n111113179\\r\\n1052538046\\r\\n28240898\\r\\n1000052957\\r\\n46208212\\r\\n196482\\r\\n71561148\\r\\n13139\\r\\n99827216\\r\\n1000006898\\r\\n111113280\\r\\n113198\\r\\n1000000592\\r\\n15005515\\r\\n1017905\\r\\n113057\\r\\n1000406356\\r\\n10003323\\r\\n100005873\\r\\n48523888\\r\\n652368767\\r\\n1111113085\\r\\n10000508\\r\\n29819248\\r\\n100051354\\r\\n13159\\r\\n1000002187\\r\\n100031843\\r\\n236640073\\r\\n1000324050...']}, {'input': \"1000\\r\\nIAO'361770\\r\\nIAO'113005\\r\\nIAO'62083\\r\\nIAO'488606266\\r\\nIAO'0009107\\r\\nIAO'630923497\\r\\nIAO'000384651\\r\\nIAO'000000084\\r\\nIAO'0000452\\r\\nIAO'99608\\r\\nIAO'12129598\\r\\nIAO'111113174\\r\\nIAO'3486032\\r\\nIAO'00004501\\r\\nIAO'13058\\r\\nIAO'3271\\r\\nIAO'429137139\\r\\nIAO'810623070\\r\\nIAO'11113320\\r\\nIAO'566635279\\r\\nIAO'45462780\\r\\nIAO'112950\\r\\nIAO'8974\\r\\nIAO'1113211\\r\\nIAO'857197\\r\\nIAO'20622\\r\\nIAO'1112852\\r\\nIAO'00000054\\r\\nIAO'7075\\r\\nIAO'000893242\\r\\nIAO'458282728\\r\\nIAO'00007225\\r\\nIAO'749922761\\r\\nIAO'414594056\\r\\nIAO'0000102\\r\\nIAO'1113243\\r\\nIAO'00000073\\r\\nIAO'86119\\r\\nIAO...\", 'output': ['361770\\r\\n1113005\\r\\n62083\\r\\n488606266\\r\\n10009107\\r\\n630923497\\r\\n1000384651\\r\\n1000000084\\r\\n10000452\\r\\n99608\\r\\n12129598\\r\\n111113174\\r\\n3486032\\r\\n100004501\\r\\n113058\\r\\n3271\\r\\n429137139\\r\\n810623070\\r\\n11113320\\r\\n566635279\\r\\n45462780\\r\\n1112950\\r\\n8974\\r\\n1113211\\r\\n857197\\r\\n20622\\r\\n11112852\\r\\n100000054\\r\\n7075\\r\\n1000893242\\r\\n458282728\\r\\n100007225\\r\\n749922761\\r\\n414594056\\r\\n10000102\\r\\n1113243\\r\\n100000073\\r\\n86119\\r\\n10000663\\r\\n111113030\\r\\n80729821\\r\\n1113171\\r\\n9585546\\r\\n6474731\\r\\n111113281\\r\\n625883\\r\\n10003487\\r\\n1112893\\r\\n10004783\\r\\n8631847\\r\\n956537242\\r\\n11112953\\r\\n112864\\r\\n111...']}, {'input': \"1000\\r\\nIAO'56561116\\r\\nIAO'3195\\r\\nIAO'3617\\r\\nIAO'78233\\r\\nIAO'2088\\r\\nIAO'3763841\\r\\nIAO'13106\\r\\nIAO'5569\\r\\nIAO'11113132\\r\\nIAO'025391206\\r\\nIAO'773411423\\r\\nIAO'201748\\r\\nIAO'681772\\r\\nIAO'000000028\\r\\nIAO'1112863\\r\\nIAO'111112973\\r\\nIAO'16199\\r\\nIAO'11113099\\r\\nIAO'11113208\\r\\nIAO'53704746\\r\\nIAO'000000095\\r\\nIAO'111113204\\r\\nIAO'35462186\\r\\nIAO'12534514\\r\\nIAO'5833\\r\\nIAO'111113306\\r\\nIAO'112924\\r\\nIAO'000098261\\r\\nIAO'1113232\\r\\nIAO'31711\\r\\nIAO'0006799\\r\\nIAO'016878\\r\\nIAO'000047489\\r\\nIAO'1113116\\r\\nIAO'289357641\\r\\nIAO'113072\\r\\nIAO'0002934\\r\\nIAO'811655\\r\\nIAO'1089\\r\\nIAO...\", 'output': ['56561116\\r\\n3195\\r\\n3617\\r\\n78233\\r\\n12088\\r\\n3763841\\r\\n13106\\r\\n5569\\r\\n11113132\\r\\n1025391206\\r\\n773411423\\r\\n201748\\r\\n681772\\r\\n1000000028\\r\\n11112863\\r\\n1111112973\\r\\n16199\\r\\n11113099\\r\\n11113208\\r\\n53704746\\r\\n1000000095\\r\\n111113204\\r\\n35462186\\r\\n12534514\\r\\n5833\\r\\n111113306\\r\\n1112924\\r\\n1000098261\\r\\n1113232\\r\\n31711\\r\\n10006799\\r\\n1016878\\r\\n1000047489\\r\\n1113116\\r\\n289357641\\r\\n1113072\\r\\n10002934\\r\\n811655\\r\\n11089\\r\\n111112909\\r\\n247845626\\r\\n11113267\\r\\n328961645\\r\\n8604\\r\\n11112885\\r\\n100005524\\r\\n87071\\r\\n113313\\r\\n523148\\r\\n1112947\\r\\n11113147\\r\\n962252\\r\\n508616450\\r\\n11113204\\r\\n13338\\r\\n768...']}, {'input': \"936\\r\\nIAO'111112878\\r\\nIAO'1113081\\r\\nIAO'9634\\r\\nIAO'3340\\r\\nIAO'13318\\r\\nIAO'9252\\r\\nIAO'59349\\r\\nIAO'00000044\\r\\nIAO'13188\\r\\nIAO'2183251\\r\\nIAO'64419\\r\\nIAO'1113077\\r\\nIAO'7268\\r\\nIAO'11113017\\r\\nIAO'02144\\r\\nIAO'00098647\\r\\nIAO'1112994\\r\\nIAO'640859\\r\\nIAO'28931364\\r\\nIAO'113138\\r\\nIAO'62075\\r\\nIAO'000006092\\r\\nIAO'39337604\\r\\nIAO'501806880\\r\\nIAO'1113280\\r\\nIAO'113026\\r\\nIAO'9453624\\r\\nIAO'000004581\\r\\nIAO'237141\\r\\nIAO'00036975\\r\\nIAO'7058492\\r\\nIAO'048767\\r\\nIAO'958601\\r\\nIAO'112890\\r\\nIAO'8500800\\r\\nIAO'112900\\r\\nIAO'11113039\\r\\nIAO'000045541\\r\\nIAO'1112872\\r\\nIAO'111112886\\r...\", 'output': ['1111112878\\r\\n11113081\\r\\n9634\\r\\n3340\\r\\n13318\\r\\n9252\\r\\n59349\\r\\n100000044\\r\\n13188\\r\\n2183251\\r\\n64419\\r\\n11113077\\r\\n7268\\r\\n111113017\\r\\n102144\\r\\n100098647\\r\\n11112994\\r\\n640859\\r\\n28931364\\r\\n113138\\r\\n62075\\r\\n1000006092\\r\\n39337604\\r\\n501806880\\r\\n1113280\\r\\n1113026\\r\\n9453624\\r\\n1000004581\\r\\n237141\\r\\n100036975\\r\\n7058492\\r\\n1048767\\r\\n958601\\r\\n1112890\\r\\n8500800\\r\\n1112900\\r\\n111113039\\r\\n1000045541\\r\\n11112872\\r\\n1111112886\\r\\n11113233\\r\\n16735873\\r\\n7685\\r\\n1000000315\\r\\n77258\\r\\n113295\\r\\n112920\\r\\n111113042\\r\\n1109736490\\r\\n100006347\\r\\n1004729286\\r\\n912241097\\r\\n1113062\\r\\n1113060\\r\\n15631113\\r...']}, {'input': \"1\\r\\nIAO'111110\\r\\n\", 'output': ['1111110']}, {'input': \"2\\r\\nIAO'0\\r\\nIAO'00\\r\\n\", 'output': ['1990\\r\\n2000']}, {'input': \"1\\r\\nIAO'111111\\r\\n\", 'output': ['1111111']}, {'input': \"1\\r\\nIAO'111111111\\r\\n\", 'output': ['1111111111']}, {'input': \"1\\r\\nIAO'001\\r\\n\", 'output': ['3001']}, {'input': \"1\\r\\nIAO'2000\\r\\n\", 'output': ['12000']}, {'input': \"1\\r\\nIAO'11109999\\r\\n\", 'output': ['111109999']}, {'input': \"1\\r\\nIAO'11111\\r\\n\", 'output': ['111111']}, {'input': \"1\\r\\nIAO'100000\\r\\n\", 'output': ['1100000']}, {'input': \"1\\r\\nIAO'18999990\\r\\n\", 'output': ['18999990']}, {'input': \"1\\r\\nIAO'113098\\r\\n\", 'output': ['1113098']}, {'input': \"1\\r\\nIAO'111122\\r\\n\", 'output': ['1111122']}, {'input': \"1\\r\\nIAO'1110222\\r\\n\", 'output': ['11110222']}, {'input': \"1\\r\\nIAO'11133333\\r\\n\", 'output': ['11133333']}, {'input': \"1\\r\\nIAO'000000000\\r\\n\", 'output': ['1000000000']}, {'input': \"4\\r\\nIAO'3098\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['13098\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1\\r\\nIAO'11100000\\r\\n\", 'output': ['111100000']}, {'input': \"2\\r\\nIAO'15\\r\\nIAO'15\\r\\n\", 'output': ['2015\\r\\n2015']}, {'input': \"1\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999']}, {'input': \"63\\r\\nIAO'099999999\\r\\nIAO'999999999\\r\\nIAO'111113098\\r\\nIAO'111113099\\r\\nIAO'11113098\\r\\nIAO'11113099\\r\\nIAO'1113098\\r\\nIAO'1113099\\r\\nIAO'113098\\r\\nIAO'113099\\r\\nIAO'13098\\r\\nIAO'13099\\r\\nIAO'3098\\r\\nIAO'3099\\r\\nIAO'098\\r\\nIAO'099\\r\\nIAO'98\\r\\nIAO'99\\r\\nIAO'000000000\\r\\nIAO'000000001\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\nIAO'000000009\\r\\nIAO'01\\r\\nIAO'001\\r\\nIAO'0001\\r\\nIAO'02\\r\\nIAO'002\\r\\nIAO'0002\\r\\nIAO'03\\r\\nIAO'003\\r\\nIAO'0003\\r\\nIAO'0...\", 'output': ['1099999999\\r\\n999999999\\r\\n1111113098\\r\\n111113099\\r\\n111113098\\r\\n11113099\\r\\n11113098\\r\\n1113099\\r\\n1113098\\r\\n113099\\r\\n113098\\r\\n13099\\r\\n13098\\r\\n3099\\r\\n3098\\r\\n2099\\r\\n2098\\r\\n1999\\r\\n1000000000\\r\\n1000000001\\r\\n1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000\\r\\n1000000009\\r\\n2001\\r\\n3001\\r\\n10001\\r\\n2002\\r\\n3002\\r\\n10002\\r\\n2003\\r\\n3003\\r\\n10003\\r\\n2004\\r\\n3004\\r\\n10004\\r\\n2005\\r\\n3005\\r\\n10005\\r\\n2006\\r\\n3006\\r\\n10006\\r\\n2007\\r\\n3007\\r\\n10007\\r\\n2009\\r\\n3009\\r\\n10009']}, {'input': \"1\\r\\nIAO'1112121\\r\\n\", 'output': ['11112121']}, {'input': \"1\\r\\nIAO'111113098\\r\\n\", 'output': ['1111113098']}, {'input': \"1\\r\\nIAO'10005000\\r\\n\", 'output': ['110005000']}, {'input': \"1\\r\\nIAO'111378\\r\\n\", 'output': ['1111378']}, {'input': \"1\\r\\nIAO'112222\\r\\n\", 'output': ['1112222']}, {'input': \"1\\r\\nIAO'021113099\\r\\n\", 'output': ['1021113099']}, {'input': \"1\\r\\nIAO'123456789\\r\\n\", 'output': ['123456789']}, {'input': \"1\\r\\nIAO'000000001\\r\\n\", 'output': ['1000000001']}, {'input': \"1\\r\\nIAO'089\\r\\n\", 'output': ['3089']}, {'input': \"9\\r\\nIAO'0\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\n\", 'output': ['1990\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000']}, {'input': \"2\\r\\nIAO'999999999\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999\\r\\n999999999']}, {'input': \"1\\r\\nIAO'2015\\r\\n\", 'output': ['12015']}, {'input': \"1\\r\\nIAO'113097\\r\\n\", 'output': ['1113097']}, {'input': \"1\\r\\nIAO'11378\\r\\n\", 'output': ['111378']}]","id":390} {"difficulty":2200,"lang":"Go","lang_cluster":"Go","src_uid":"52b8b6c68518d5129272b8c56e5b7662","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"package main\n\nimport \"fmt\"\n\nvar (\n\tn int\n\tnum []int64\n\tpar []int\n\trem []int64\n\tminCount int = 1e9\n)\n\nfunc countPrimeDelims(n int64) (count int) {\n\tfor ; n%2 == 0; n \/= 2 {\n\t\tcount++\n\t}\n\tfor p := int64(3); p*p <= n; p += 2 {\n\t\tfor ; n%p == 0; n \/= p {\n\t\t\tcount++\n\t\t}\n\t}\n\tif n > 1 {\n\t\tcount++\n\t}\n\treturn\n}\n\nfunc eval() {\n\tcount := 0\n\twithPar0 := 0\n\tfor p := 1; p <= n; p++ {\n\t\tdelimCount := countPrimeDelims(rem[p])\n\t\tif delimCount == 1 && num[p] == rem[p] { \/\/ rem[p] is prime and p does not have kids\n\t\t\tcount += 1\n\t\t} else {\n\t\t\tcount += delimCount + 1\n\t\t}\n\t\tif par[p] == 0 {\n\t\t\twithPar0++\n\t\t}\n\t}\n\tif withPar0 > 1 {\n\t\tcount++\n\t}\n\tif count < minCount {\n\t\tminCount = count\n\t}\n}\n\nfunc brute(i int) {\n\tif i == n+1 {\n\t\teval()\n\t\treturn\n\t}\n\tpar[i] = 0\n\tbrute(i + 1)\n\n\tfor p := 1; p <= n; p++ {\n\t\tif p != i && num[i] <= rem[p] && rem[p]%num[i] == 0 {\n\t\t\tpar[i] = p\n\t\t\trem[p] \/= num[i]\n\t\t\tbrute(i + 1)\n\t\t\trem[p] *= num[i]\n\t\t}\n\t}\n}\n\nfunc main() {\n\tfmt.Scan(&n)\n\tnum = make([]int64, n+1)\n\tpar = make([]int, n+1)\n\trem = make([]int64, n+1)\n\tfor i := 1; i <= n; i++ {\n\t\tfmt.Scan(&num[i])\n\t\trem[i] = num[i]\n\t}\n\tbrute(1)\n\tfmt.Println(minCount)\n}\n","description":"A divisor tree is a rooted tree that meets the following conditions: Each vertex of the tree contains a positive integer number. The numbers written in the leaves of the tree are prime numbers. For any inner vertex, the number within it is equal to the product of the numbers written in its children. Manao has n distinct integers a1,\u2009a2,\u2009...,\u2009an. He tries to build a divisor tree which contains each of these numbers. That is, for each ai, there should be at least one vertex in the tree which contains ai. Manao loves compact style, but his trees are too large. Help Manao determine the minimum possible number of vertices in the divisor tree sought.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20098). The second line contains n distinct space-separated integers ai (2\u2009\u2264\u2009ai\u2009\u2264\u20091012).","output_specification":"Print a single integer \u2014 the minimum number of vertices in the divisor tree that contains each of the numbers ai.","notes":"NoteSample 1. The smallest divisor tree looks this way: Sample 2. In this case you can build the following divisor tree: Sample 3. Note that the tree can consist of a single vertex.","sample_inputs":["2\n6 10","4\n6 72 8 4","1\n7"],"sample_outputs":["7","12","1"],"human_solution":"package main\n\nimport \"fmt\"\n\nvar (\n\tn int\n\tnum []int64\n\tpar []int\n\trem []int64\n\tminCount int = 1e9\n\tdelimsCache = make(map[int64]int)\n)\n\nfunc countPrimeDelims(n int64) (count int) {\n\tif val, ok := delimsCache[n]; ok {\n\t\tcount = val\n\t\treturn\n\t}\n\tn0 := n\n\tfor ; n%2 == 0; n \/= 2 {\n\t\tcount++\n\t}\n\tfor p := int64(3); p*p <= n; p += 2 {\n\t\tfor ; n%p == 0; n \/= p {\n\t\t\tcount++\n\t\t}\n\t}\n\tif n > 1 {\n\t\tcount++\n\t}\n\tdelimsCache[n0] = count\n\treturn\n}\n\nfunc eval() {\n\tcount := 0\n\twithPar0 := 0\n\tfor p := 1; p <= n; p++ {\n\t\tdelimCount := countPrimeDelims(rem[p])\n\t\tif delimCount == 1 && num[p] == rem[p] { \/\/ rem[p] is prime and p does not have kids\n\t\t\tcount += 1\n\t\t} else {\n\t\t\tcount += delimCount + 1\n\t\t}\n\t\tif par[p] == 0 {\n\t\t\twithPar0++\n\t\t}\n\t}\n\tif withPar0 > 1 {\n\t\tcount++\n\t}\n\tif count < minCount {\n\t\tminCount = count\n\t}\n}\n\nfunc brute(i int) {\n\tif i == n+1 {\n\t\teval()\n\t\treturn\n\t}\n\tpar[i] = 0\n\tbrute(i + 1)\n\n\tfor p := 1; p <= n; p++ {\n\t\tif p != i && num[i] <= rem[p] && rem[p]%num[i] == 0 {\n\t\t\tpar[i] = p\n\t\t\trem[p] \/= num[i]\n\t\t\tbrute(i + 1)\n\t\t\trem[p] *= num[i]\n\t\t}\n\t}\n}\n\nfunc main() {\n\tfmt.Scan(&n)\n\tnum = make([]int64, n+1)\n\tpar = make([]int, n+1)\n\trem = make([]int64, n+1)\n\tfor i := 1; i <= n; i++ {\n\t\tfmt.Scan(&num[i])\n\t\trem[i] = num[i]\n\t}\n\tbrute(1)\n\tfmt.Println(minCount)\n}\n","testcases":"[{'input': '2\\r\\n6 10\\r\\n', 'output': ['7']}, {'input': '4\\r\\n6 72 8 4\\r\\n', 'output': ['12']}, {'input': '1\\r\\n7\\r\\n', 'output': ['1']}, {'input': '4\\r\\n10000000000 10000000001 10000000002 10000000003\\r\\n', 'output': ['33']}, {'input': '5\\r\\n1280 128 611 1000000009 82727272727\\r\\n', 'output': ['19']}, {'input': '8\\r\\n1000000000000 999999999999 999999999998 999999999997 999999999996 999999999995 999999999994 999999999993\\r\\n', 'output': ['65']}, {'input': '8\\r\\n2 3 4 5 6 7 8 9\\r\\n', 'output': ['14']}, {'input': '8\\r\\n2 4 8 1073741824 549755813888 64 4096 16777216\\r\\n', 'output': ['46']}, {'input': '1\\r\\n1000000007\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2147483647 1000000007\\r\\n', 'output': ['3']}, {'input': '8\\r\\n39136245120 574820045856 216 162000000 80 96 576 864\\r\\n', 'output': ['60']}, {'input': '8\\r\\n5945425920 405409536 4320 86400 432 72 6 24\\r\\n', 'output': ['65']}, {'input': '8\\r\\n549755813888 274877906944 32768 16384 128 16 8 4\\r\\n', 'output': ['47']}, {'input': '5\\r\\n961360214941 115378146561 916788252211 539537935531 248992492613\\r\\n', 'output': ['21']}, {'input': '1\\r\\n344340024872\\r\\n', 'output': ['8']}, {'input': '1\\r\\n258151010631\\r\\n', 'output': ['3']}, {'input': '1\\r\\n213295849570\\r\\n', 'output': ['6']}, {'input': '2\\r\\n424901551654 849803103308\\r\\n', 'output': ['5']}, {'input': '2\\r\\n802800458600 52616\\r\\n', 'output': ['10']}, {'input': '2\\r\\n762240264835 21778293281\\r\\n', 'output': ['4']}, {'input': '3\\r\\n846541 925289 394452551278\\r\\n', 'output': ['11']}, {'input': '3\\r\\n750998536541 686401957846 351744873865\\r\\n', 'output': ['18']}, {'input': '4\\r\\n737120440565 378229914051 983957160307 761546687166\\r\\n', 'output': ['21']}, {'input': '4\\r\\n89377792582 425944344122 943396966542 964442994305\\r\\n', 'output': ['24']}, {'input': '5\\r\\n2876759 123330020333 199343 573461769337 913855610523\\r\\n', 'output': ['11']}, {'input': '5\\r\\n565015466 586 496648594614 1695046398 532901575573\\r\\n', 'output': ['14']}, {'input': '6\\r\\n188435602694 158055002583 795765602269 241669 560957945158 162966378368\\r\\n', 'output': ['32']}, {'input': '6\\r\\n53090061261 9 1077 147883179 159270183783 359\\r\\n', 'output': ['14']}, {'input': '7\\r\\n3740924107 29 211 27218447813 789334986577 6119 128997383\\r\\n', 'output': ['12']}, {'input': '7\\r\\n748774792812 4569 9138 245822322 6 6092 491644644\\r\\n', 'output': ['19']}, {'input': '8\\r\\n385649 544295469 181431823 968301639351 1779 35059 1632886407 378839595607\\r\\n', 'output': ['16']}, {'input': '8\\r\\n112759800614 42136089239 5689679 799 338279401842 716313517063 7121 2\\r\\n', 'output': ['17']}, {'input': '8\\r\\n1303 2 432141739 427461395594 679 7 293424240781 328059398\\r\\n', 'output': ['11']}, {'input': '8\\r\\n16113 82856359907 41 248569079721 5371 632491297 17117830601 171178306010\\r\\n', 'output': ['17']}, {'input': '8\\r\\n208008885956 880178700893 307 3643169 74170279 67404046 4 33702023\\r\\n', 'output': ['18']}, {'input': '8\\r\\n5 628190578605 209396859535 15 197870240427 41879371907 125638115721 3\\r\\n', 'output': ['15']}, {'input': '4\\r\\n2959829 313957941517 317 28541631047\\r\\n', 'output': ['7']}, {'input': '6\\r\\n12648741782 74 341857886 468003445934 1369 234001722967\\r\\n', 'output': ['16']}, {'input': '8\\r\\n65891294953 5367970 59047670 230 5729677822 658912949530 115 256657\\r\\n', 'output': ['23']}, {'input': '8\\r\\n963761198400 642507465600 481880599200 321253732800 293318625600 240940299600 146659312800 160626866400\\r\\n', 'output': ['63']}, {'input': '1\\r\\n87178291200\\r\\n', 'output': ['23']}]","id":391} {"difficulty":2400,"lang":"Go","lang_cluster":"Go","src_uid":"63e130256e23bd0693c6a1bede5e937e","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport \"fmt\"\n\ntype Matrix struct {\n\tx [][]uint64\n}\n\nfunc newMatrix(dx int, dy int) Matrix {\n\tvar r Matrix\n\tr.x = make([][]uint64, dx)\n\tfor i := 0; i < dx; i++ {\n\t\tr.x[i] = make([]uint64, dy)\n\t}\n\treturn r\n}\n\nfunc (r *Matrix) setValue(dx int, dy int, val uint64) {\n\tr.x[dx][dy] = val\n}\n\nfunc (r Matrix) multi(r1 Matrix, m uint64) Matrix {\n\tres := newMatrix(2, 2)\n\tfor i := 0; i < 2; i++ {\n\t\tfor j := 0; j < 2; j++ {\n\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\tres.x[i][j] = (res.x[i][j] + r.x[i][k]*r1.x[k][j]) % m\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}\n\nfunc (r Matrix) powerMod(a uint64, b uint64) Matrix {\n\tmatrix := newMatrix(2, 2)\n\tmatrix.setValue(0, 0, 1)\n\tmatrix.setValue(0, 1, 1)\n\tmatrix.setValue(1, 0, 1)\n\tfor a > 0 {\n\t\tif a%2 == 1 {\n\t\t\tmatrix = matrix.multi(r, b)\n\t\t}\n\t\tr = r.multi(r, b)\n\t\ta \/= 2\n\t}\n\treturn matrix\n}\n\nfunc ok(u uint64, l uint64, r uint64, k uint64) bool {\n\tif (r\/u - (l-1)\/u) >= k {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc main() {\n\tvar m uint64\n\tvar l uint64\n\tvar r uint64\n\tvar k uint64\n\tfmt.Scanf(\"%d%d%d%d\", &m, &l, &r, &k)\n\tvar found uint64\n\tfor i := uint64(1); i*i <= r; i++ {\n\t\tif ok(i, l, r, k) {\n\t\t\tif i > found {\n\t\t\t\tfound = i\n\t\t\t}\n\t\t}\n\t\tif ok(r\/i, l, r, k) {\n\t\t\tif r\/i > found {\n\t\t\t\tfound = r \/ i\n\t\t\t}\n\t\t}\n\t}\n\tif found <= 2 {\n\t\tfmt.Println(1)\n\t\treturn\n\t}\n\tmatrix := newMatrix(2, 2)\n\tmatrix.setValue(0, 0, 1)\n\tmatrix.setValue(0, 1, 1)\n\tmatrix.setValue(1, 0, 1)\n\tmatrix = matrix.powerMod(found-2, m)\n\tfmt.Println(matrix.x[0][0])\n}\n","description":"There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations.Dima is sure that it'll be great to learn to solve the following problem by the Big Day: You're given a set A, consisting of numbers l, l\u2009+\u20091, l\u2009+\u20092, ..., r; let's consider all its k-element subsets; for each such subset let's find the largest common divisor of Fibonacci numbers with indexes, determined by the subset elements. Among all found common divisors, Dima is interested in the largest one.Dima asked to remind you that Fibonacci numbers are elements of a numeric sequence, where F1\u2009=\u20091, F2\u2009=\u20091, Fn\u2009=\u2009Fn\u2009-\u20091\u2009+\u2009Fn\u2009-\u20092 for n\u2009\u2265\u20093.Dima has more than half a century ahead to solve the given task, but you only have two hours. Count the residue from dividing the sought largest common divisor by m.","input_specification":"The first line contains four space-separated integers m, l, r and k (1\u2009\u2264\u2009m\u2009\u2264\u2009109;\u00a01\u2009\u2264\u2009l\u2009<\u2009r\u2009\u2264\u20091012;\u00a02\u2009\u2264\u2009k\u2009\u2264\u2009r\u2009-\u2009l\u2009+\u20091). 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 residue from dividing the sought greatest common divisor by m.","notes":null,"sample_inputs":["10 1 8 2","10 1 8 3"],"sample_outputs":["3","1"],"human_solution":"package main\n\nimport \"fmt\"\n\ntype Matrix struct {\n\tx [][]uint64\n}\n\nfunc newMatrix(dx int, dy int) Matrix {\n\tvar r Matrix\n\tr.x = make([][]uint64, dx)\n\tfor i := 0; i < dx; i++ {\n\t\tr.x[i] = make([]uint64, dy)\n\t}\n\treturn r\n}\n\nfunc (r *Matrix) setValue(dx int, dy int, val uint64) {\n\tr.x[dx][dy] = val\n}\n\nfunc (r Matrix) multi(r1 Matrix, m uint64) Matrix {\n\tres := newMatrix(2, 2)\n\tfor i := 0; i < 2; i++ {\n\t\tfor j := 0; j < 2; j++ {\n\t\t\tfor k := 0; k < 2; k++ {\n\t\t\t\tres.x[i][j] = (res.x[i][j] + r.x[i][k]*r1.x[k][j]) % m\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}\n\nfunc (r Matrix) powerMod(a uint64, b uint64) Matrix {\n\tmatrix := newMatrix(2, 2)\n\tmatrix.setValue(0, 0, 1)\n\tmatrix.setValue(0, 1, 1)\n\tmatrix.setValue(1, 0, 1)\n\tfor a > 0 {\n\t\tif a%2 == 1 {\n\t\t\tmatrix = matrix.multi(r, b)\n\t\t}\n\t\tr = r.multi(r, b)\n\t\ta \/= 2\n\t}\n\treturn matrix\n}\n\nfunc ok(u uint64, l uint64, r uint64, k uint64) bool {\n\tif (r\/u - (l-1)\/u) >= k {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc main() {\n\tvar m uint64\n\tvar l uint64\n\tvar r uint64\n\tvar k uint64\n\tfmt.Scanf(\"%d%d%d%d\", &m, &l, &r, &k)\n\tvar found uint64\n\tfor i := uint64(1); i*i <= r; i++ {\n\t\tif ok(i, l, r, k) {\n\t\t\tif i > found {\n\t\t\t\tfound = i\n\t\t\t}\n\t\t}\n\t\tif ok(r\/i, l, r, k) {\n\t\t\tif r\/i > found {\n\t\t\t\tfound = r \/ i\n\t\t\t}\n\t\t}\n\t}\n\tif found <= 2 {\n\t\tfmt.Println(1 % m)\n\t\treturn\n\t}\n\tmatrix := newMatrix(2, 2)\n\tmatrix.setValue(0, 0, 1)\n\tmatrix.setValue(0, 1, 1)\n\tmatrix.setValue(1, 0, 1)\n\tmatrix = matrix.powerMod(found-2, m)\n\tfmt.Println(matrix.x[0][0])\n}\n","testcases":"[{'input': '10 1 8 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '10 1 8 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 1 20 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '4 1 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1000000000 999000000000 1000000000000 1000000001\\r\\n', 'output': ['1\\r\\n']}, {'input': '643354696 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '829051283 4 9 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '549070627 2 6 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '275299363 7 8 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '232100782 7 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '466253512 1 10 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '828885826 8 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '572252279 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '888775378 3 6 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '524357331 2 4 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '467730377 5 8 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '999807424 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '355414109 1 5 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '90717740 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '733026150 5 8 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '820737413 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '689568719 4 8 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '657091243 1 6 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '386089541 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '863991268 3 4 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '854469356 260 555 272\\r\\n', 'output': ['1\\r\\n']}, {'input': '395611453 11 798 491\\r\\n', 'output': ['1\\r\\n']}, {'input': '740801616 319 352 7\\r\\n', 'output': ['5\\r\\n']}, {'input': '886543988 964 995 13\\r\\n', 'output': ['1\\r\\n']}, {'input': '724908834 353 435 21\\r\\n', 'output': ['2\\r\\n']}, {'input': '432953019 123 743 298\\r\\n', 'output': ['1\\r\\n']}, {'input': '162735738 722 830 28\\r\\n', 'output': ['2\\r\\n']}, {'input': '292717652 455 925 404\\r\\n', 'output': ['1\\r\\n']}, {'input': '469712955 323 637 310\\r\\n', 'output': ['1\\r\\n']}, {'input': '484442699 175 708 324\\r\\n', 'output': ['1\\r\\n']}, {'input': '352882236 334 543 68\\r\\n', 'output': ['2\\r\\n']}, {'input': '905420490 57 588 288\\r\\n', 'output': ['1\\r\\n']}, {'input': '718100546 681 908 124\\r\\n', 'output': ['1\\r\\n']}, {'input': '521756232 60 995 734\\r\\n', 'output': ['1\\r\\n']}, {'input': '999769304 477 723 17\\r\\n', 'output': ['610\\r\\n']}, {'input': '284765127 137 483 38\\r\\n', 'output': ['34\\r\\n']}, {'input': '378494626 818 910 16\\r\\n', 'output': ['5\\r\\n']}, {'input': '418350594 658 757 38\\r\\n', 'output': ['1\\r\\n']}, {'input': '239673066 510 755 145\\r\\n', 'output': ['1\\r\\n']}, {'input': '477001825 121 226 22\\r\\n', 'output': ['3\\r\\n']}, {'input': '850833562 487342 624253 15604\\r\\n', 'output': ['21\\r\\n']}, {'input': '776253168 501935 624447 5034\\r\\n', 'output': ['46368\\r\\n']}, {'input': '112740166 724250 820763 91354\\r\\n', 'output': ['1\\r\\n']}, {'input': '794434638 195429 577918 197816\\r\\n', 'output': ['1\\r\\n']}, {'input': '536970127 405424 806442 333727\\r\\n', 'output': ['1\\r\\n']}, {'input': '173120024 464152 639405 62848\\r\\n', 'output': ['1\\r\\n']}, {'input': '604322884 136811 746974 135514\\r\\n', 'output': ['3\\r\\n']}, {'input': '342085072 816702 835429 2448\\r\\n', 'output': ['13\\r\\n']}, {'input': '342603251 513651 575872 16399\\r\\n', 'output': ['2\\r\\n']}, {'input': '516990861 365331 514416 120353\\r\\n', 'output': ['1\\r\\n']}, {'input': '989814219 856344 952712 70116\\r\\n', 'output': ['1\\r\\n']}, {'input': '128436294 924501 935526 7097\\r\\n', 'output': ['1\\r\\n']}, {'input': '930753749 240762 304816 33119\\r\\n', 'output': ['1\\r\\n']}, {'input': '500334392 177018 213807 20966\\r\\n', 'output': ['1\\r\\n']}, {'input': '178728634 357695 636825 234054\\r\\n', 'output': ['1\\r\\n']}, {'input': '822435327 622352 898085 129237\\r\\n', 'output': ['1\\r\\n']}, {'input': '207799801 225575 230363 4101\\r\\n', 'output': ['1\\r\\n']}, {'input': '873274131 919071 929608 6597\\r\\n', 'output': ['1\\r\\n']}, {'input': '213233440 332735 968136 72864\\r\\n', 'output': ['21\\r\\n']}, {'input': '176747515 112573 755897 345857\\r\\n', 'output': ['1\\r\\n']}, {'input': '896461337 232014277619 307974127100 64176468973\\r\\n', 'output': ['1\\r\\n']}, {'input': '484166843 525464996401 759390764933 101689280407\\r\\n', 'output': ['1\\r\\n']}, {'input': '851697961 693161868155 911881110206 175212572235\\r\\n', 'output': ['1\\r\\n']}, {'input': '439334250 672097772941 732494615876 44664804365\\r\\n', 'output': ['1\\r\\n']}, {'input': '94204464 36087916686 718170323555 343248235244\\r\\n', 'output': ['1\\r\\n']}, {'input': '84735323 605652874739 762557619170 153822133015\\r\\n', 'output': ['1\\r\\n']}, {'input': '21360770 785066754170 842564125264 17876918461\\r\\n', 'output': ['2\\r\\n']}, {'input': '505249059 251318958163 361503770702 27100295491\\r\\n', 'output': ['3\\r\\n']}, {'input': '220688329 777936720815 906371247466 123531039142\\r\\n', 'output': ['1\\r\\n']}, {'input': '766452126 794358322395 934685493931 122085630645\\r\\n', 'output': ['1\\r\\n']}, {'input': '222429606 392998152462 915358102901 281100802425\\r\\n', 'output': ['1\\r\\n']}, {'input': '758880930 531051114359 641412554058 76266168689\\r\\n', 'output': ['1\\r\\n']}, {'input': '754070950 37040580265 233314567101 54515316227\\r\\n', 'output': ['2\\r\\n']}, {'input': '7417434 671183669261 881538048766 3606057091\\r\\n', 'output': ['5978569\\r\\n']}, {'input': '525779583 846043612178 943361005055 18733061595\\r\\n', 'output': ['5\\r\\n']}, {'input': '435022558 639465390342 943735699660 229744278105\\r\\n', 'output': ['1\\r\\n']}, {'input': '695678064 61102799590 232772667767 12617958334\\r\\n', 'output': ['233\\r\\n']}, {'input': '491938843 92710633332 192903440623 32543684099\\r\\n', 'output': ['2\\r\\n']}, {'input': '472015302 25781027848 844045376640 89677396520\\r\\n', 'output': ['34\\r\\n']}, {'input': '198438953 128255153816 508681842799 118232730542\\r\\n', 'output': ['2\\r\\n']}, {'input': '91 139067663884 999999999959 283084501571\\r\\n', 'output': ['2\\r\\n']}, {'input': '67 651886357845 999999999955 333765060000\\r\\n', 'output': ['1\\r\\n']}, {'input': '26 172755321697 999999999949 748328204337\\r\\n', 'output': ['1\\r\\n']}, {'input': '72 831006353527 999999999987 71879885253\\r\\n', 'output': ['1\\r\\n']}, {'input': '57 97829280565 999999999998 631455142546\\r\\n', 'output': ['1\\r\\n']}, {'input': '57 767586689935 999999999948 126106066482\\r\\n', 'output': ['1\\r\\n']}, {'input': '59 447204680121 999999999949 439602728177\\r\\n', 'output': ['1\\r\\n']}, {'input': '12 697971609680 1000000000000 51929063174\\r\\n', 'output': ['5\\r\\n']}, {'input': '11 11961531058 999999999979 397796366872\\r\\n', 'output': ['1\\r\\n']}, {'input': '88 474016746038 999999999956 143293114702\\r\\n', 'output': ['2\\r\\n']}, {'input': '54 241547671283 999999999961 594678057260\\r\\n', 'output': ['1\\r\\n']}, {'input': '58 474193094035 999999999975 34788743171\\r\\n', 'output': ['30\\r\\n']}, {'input': '39 934112975734 999999999956 3045192662\\r\\n', 'output': ['26\\r\\n']}, {'input': '45 483744571127 999999999995 11511670531\\r\\n', 'output': ['33\\r\\n']}, {'input': '65 710261362093 999999999918 134862181280\\r\\n', 'output': ['1\\r\\n']}, {'input': '77 98481782161 999999999977 38629724552\\r\\n', 'output': ['13\\r\\n']}, {'input': '75 11878056757 999999999901 911221521565\\r\\n', 'output': ['1\\r\\n']}, {'input': '74 382007414110 999999999942 226426282578\\r\\n', 'output': ['1\\r\\n']}, {'input': '58 918441992957 999999999938 44552189404\\r\\n', 'output': ['1\\r\\n']}, {'input': '65 866214593817 999999999960 6315152479\\r\\n', 'output': ['26\\r\\n']}, {'input': '643354696 983352299678 998727759639 5\\r\\n', 'output': ['513057561\\r\\n']}, {'input': '829051283 1088391361 820651073160 7\\r\\n', 'output': ['562083301\\r\\n']}, {'input': '549070627 489196200449 539980893591 3\\r\\n', 'output': ['277549405\\r\\n']}, {'input': '275299363 412116285562 820589570249 2\\r\\n', 'output': ['126012131\\r\\n']}, {'input': '232100782 947945598856 962720598687 9\\r\\n', 'output': ['107135445\\r\\n']}, {'input': '466253512 569941491511 940361459626 2\\r\\n', 'output': ['110403922\\r\\n']}, {'input': '828885826 535837481630 996470141756 9\\r\\n', 'output': ['803726132\\r\\n']}, {'input': '572252279 347359014378 476278618064 10\\r\\n', 'output': ['160894508\\r\\n']}, {'input': '888775378 394050745011 583350787788 8\\r\\n', 'output': ['266895167\\r\\n']}, {'input': '524357331 975373409792 993143162930 9\\r\\n', 'output': ['82693750\\r\\n']}, {'input': '467730377 498527596823 599363691390 9\\r\\n', 'output': ['162487839\\r\\n']}, {'input': '999807424 28852515549 693410552314 5\\r\\n', 'output': ['268962728\\r\\n']}, {'input': '355414109 321003964279 526062497801 10\\r\\n', 'output': ['175118262\\r\\n']}, {'input': '90717740 443545087482 618991227417 4\\r\\n', 'output': ['59327245\\r\\n']}, {'input': '733026150 276417674735 483233777723 2\\r\\n', 'output': ['410699288\\r\\n']}, {'input': '820737413 461416856210 478264812791 4\\r\\n', 'output': ['188543974\\r\\n']}, {'input': '689568719 291290991961 563984423945 4\\r\\n', 'output': ['272335774\\r\\n']}, {'input': '657091243 313541859466 743294479974 5\\r\\n', 'output': ['127910302\\r\\n']}, {'input': '386089541 576088663274 944905248353 10\\r\\n', 'output': ['369112903\\r\\n']}, {'input': '863991268 70609416573 891955208431 3\\r\\n', 'output': ['1505748\\r\\n']}, {'input': '1000000000 1 1000000000000 1000000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '999999999 1 1000000000000 1000000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1 1000000000000 1000000000000\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 1 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 7 12 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '100 6 12 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '1000000000 999999999999 1000000000000 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 4 8 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '100000 51 100 2\\r\\n', 'output': ['24578\\r\\n']}, {'input': '1000000000 10 15 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '1000 66 99 2\\r\\n', 'output': ['578\\r\\n']}, {'input': '1000000000 500000000001 1000000000000 2\\r\\n', 'output': ['434013378\\r\\n']}, {'input': '1000000 987665 1000000 1234\\r\\n', 'output': ['55\\r\\n']}, {'input': '1000 666666666666 999999999999 2\\r\\n', 'output': ['378\\r\\n']}, {'input': '100 6 13 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '123456789 100000000000 300000000000 3\\r\\n', 'output': ['33025443\\r\\n']}, {'input': '1000000000 1 1000000000000 2\\r\\n', 'output': ['439453125\\r\\n']}, {'input': '123456789 100000000000 300000000000 100\\r\\n', 'output': ['10381690\\r\\n']}, {'input': '999999983 27644 60308 96\\r\\n', 'output': ['841887331\\r\\n']}, {'input': '999999983 24937 53808 60\\r\\n', 'output': ['34401697\\r\\n']}, {'input': '999999937 123456789012 987654321098 2\\r\\n', 'output': ['224062417\\r\\n']}, {'input': '1000000000 10000 11000 3\\r\\n', 'output': ['521294125\\r\\n']}, {'input': '500 19 39 2\\r\\n', 'output': ['181\\r\\n']}, {'input': '10007 6 12 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '100 7 13 2\\r\\n', 'output': ['3\\r\\n']}]","id":392} {"difficulty":2400,"lang":"Go","lang_cluster":"Go","src_uid":"788cb3da98fd4a56720f800588061b79","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nconst mod = 1e9 + 7\n\nvar dp [202][1002][202]int64\n\nfunc main() {\n\tvar n, k int\n\tfmt.Scan(&n, &k)\n\ta := make([]int, n)\n\tfor i := range a {\n\t\tfmt.Scan(&a[i])\n\t}\n\tsort.Ints(a)\n\tdp[0][0][1] = 1\n\tdp[0][0][0] = 1\n\tfor i := 1; i < n; i++ {\n\t\tdiff := a[i] - a[i-1]\n\t\tfor imb := 0; imb <= k; imb++ {\n\t\t\tfor g := 0; g <= i + 1; g++ {\n\t\t\t\timb0 := imb - diff*g\n\t\t\t\tif imb0 >= 0 {\n\t\t\t\t\tdp[i][imb][g] = dp[i-1][imb0][g] * int64(g+1) % mod\n\t\t\t\t}\n\t\t\t\tif g+1 <= n && imb0-diff >= 0 {\n\t\t\t\t\tdp[i][imb][g] = (dp[i][imb][g] + dp[i-1][imb0-diff][g+1]) % mod\n\t\t\t\t}\n\t\t\t\tif g > 0 && imb0 + diff >= 0 {\n\t\t\t\t\tdp[i][imb][g] = (dp[i][imb][g] + dp[i-1][imb0+diff][g-1]) % mod\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar res int64\n\tfor i := 0; i <= k; i++ {\n\t\tres = (res + dp[n-1][i][0]) % mod\n\t}\n\tfmt.Println(res)\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nconst mod = 1e9 + 7\n\nvar dp [2][1002][202]int64\n\nfunc main() {\n\tvar n, k int\n\tfmt.Scan(&n, &k)\n\ta := make([]int, n)\n\tfor i := range a {\n\t\tfmt.Scan(&a[i])\n\t}\n\tsort.Ints(a)\n\tdp[0][0][1] = 1\n\tdp[0][0][0] = 1\n\tfor i := 1; i < n; i++ {\n\t\tdiff := a[i] - a[i-1]\n\t\tfor imb := 0; imb <= k; imb++ {\n\t\t\tfor g := 0; g <= i+1; g++ {\n\t\t\t\tdp[i%2][imb][g] = 0\n\t\t\t\timb0 := imb - diff*g\n\t\t\t\tif imb0 >= 0 {\n\t\t\t\t\tdp[i%2][imb][g] = dp[(i-1)%2][imb0][g] * int64(g+1) % mod\n\t\t\t\t}\n\t\t\t\tif g+1 <= n && imb0-diff >= 0 {\n\t\t\t\t\tdp[i%2][imb][g] = (dp[i%2][imb][g] + dp[(i-1)%2][imb0-diff][g+1]*int64(g+1)%mod) % mod\n\t\t\t\t}\n\t\t\t\tif g > 0 && imb0+diff >= 0 {\n\t\t\t\t\tdp[i%2][imb][g] = (dp[i%2][imb][g] + dp[(i-1)%2][imb0+diff][g-1]) % mod\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar res int64\n\tfor i := 0; i <= k; i++ {\n\t\tres = (res + dp[(n-1)%2][i][0]) % mod\n\t}\n\tfmt.Println(res)\n}\n","testcases":"[{'input': '3 2\\r\\n2 4 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 3\\r\\n7 8 9 10\\r\\n', 'output': ['13\\r\\n']}, {'input': '4 0\\r\\n5 10 20 21\\r\\n', 'output': ['1\\r\\n']}, {'input': '20 1000\\r\\n50 50 100 100 150 150 200 200 250 250 300 300 350 350 400 400 450 450 500 500\\r\\n', 'output': ['97456952\\r\\n']}, {'input': '5 222\\r\\n58 369 477 58 90\\r\\n', 'output': ['10\\r\\n']}, {'input': '9 222\\r\\n304 142 38 334 73 122 252 381 438\\r\\n', 'output': ['423\\r\\n']}, {'input': '9 247\\r\\n359 350 140 26 293 488 57 481 71\\r\\n', 'output': ['414\\r\\n']}, {'input': '5 341\\r\\n412 32 189 303 172\\r\\n', 'output': ['26\\r\\n']}, {'input': '200 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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': ['380668983\\r\\n']}, {'input': '121 19\\r\\n1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 2 2 1 1 2 1 1 2 1 1 1 1 1 2 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 1 1 2 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 1 2 1 2 2 2 2 2 1 1 2 2 1 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 1 1 1 2 2 1 2 1\\r\\n', 'output': ['378568711\\r\\n']}, {'input': '3 4\\r\\n10 7 10\\r\\n', 'output': ['5\\r\\n']}, {'input': '1 5\\r\\n3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 5\\r\\n9\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 2\\r\\n3 10 5 6 5\\r\\n', 'output': ['8\\r\\n']}, {'input': '1 2\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '166 7\\r\\n9 8 7 2 9 9 7 7 3 1 9 9 9 7 1 5 5 6 6 2 3 2 10 9 3 5 8 8 6 3 10 3 4 8 6 5 1 7 2 9 1 4 9 10 6 8 6 7 8 3 2 1 10 5 6 6 3 7 4 9 10 3 1 10 9 9 2 10 3 2 4 8 9 6 1 9 10 10 10 9 5 8 9 7 9 6 7 5 4 7 8 9 8 5 10 5 4 10 8 5 10 10 10 8 7 3 2 6 3 1 7 5 7 10 7 8 8 8 5 5 8 10 2 10 2 4 10 2 3 1 1 4 5 8 7 9 4 10 2 9 8 1 1 5 9 5 2 1 7 7 9 10 2 2 10 10 6 8 5 5 9 4 3 1 10 5\\r\\n', 'output': ['194851520\\r\\n']}, {'input': '94 17\\r\\n9 10 10 5 2 7 10 9 5 5 7 7 6 10 4 10 3 7 4 9 2 5 1 5 4 2 9 8 4 3 9 5 7 10 10 6 3 1 9 9 2 8 8 8 7 2 4 5 2 5 7 7 4 9 4 9 4 10 5 10 9 7 3 6 10 3 1 10 6 4 8 9 4 10 7 2 9 8 7 10 2 2 4 1 4 6 10 7 2 4 9 4 8 5\\r\\n', 'output': ['650765262\\r\\n']}, {'input': '14 26\\r\\n3 7 8 4 7 5 10 8 4 4 1 6 7 7\\r\\n', 'output': ['190894282\\r\\n']}, {'input': '142 24\\r\\n8 1 10 6 5 3 9 4 4 8 2 7 4 4 1 2 7 4 7 3 3 9 9 6 6 10 8 5 3 2 3 4 7 9 9 8 4 7 8 6 9 1 7 9 10 2 6 1 9 9 1 10 2 10 6 5 10 2 3 8 3 7 1 8 9 10 1 8 10 7 2 5 1 1 4 6 5 7 6 10 4 4 7 4 10 5 10 9 8 7 4 10 4 4 3 4 10 6 1 4 8 5 10 6 3 8 8 4 2 3 2 1 7 5 2 4 2 3 10 7 8 3 10 9 1 7 7 5 5 5 10 8 8 2 6 9 7 2 4 7 7 3\\r\\n', 'output': ['287439553\\r\\n']}, {'input': '166 34\\r\\n6 5 3 3 4 5 4 6 4 6 2 6 5 1 7 4 5 5 6 1 2 2 6 4 3 7 4 5 1 7 3 1 6 5 1 3 6 4 9 7 6 6 6 5 8 6 2 4 5 6 10 10 4 8 3 6 1 4 7 9 8 5 2 9 8 10 2 2 6 1 3 6 6 9 10 8 10 5 8 10 5 9 2 4 8 2 9 2 1 9 5 9 3 8 1 10 4 1 1 4 9 6 10 6 2 1 4 5 5 8 10 10 5 6 3 10 1 8 5 10 3 3 10 9 7 4 1 9 9 10 8 3 4 2 8 10 6 3 10 10 4 6 8 7 9 7 10 3 1 10 4 10 5 2 7 9 4 10 6 2 6 3 9 10 9 10\\r\\n', 'output': ['772974256\\r\\n']}, {'input': '171 302\\r\\n64 51 53 35 36 42 67 27 55 85 97 23 47 8 59 69 50 15 28 36 22 12 49 99 54 11 10 91 91 78 59 65 68 5 20 77 42 59 85 65 69 35 59 86 45 96 41 82 89 93 80 25 16 22 68 8 23 57 48 53 16 21 50 44 70 75 33 32 43 32 77 40 8 41 23 82 61 51 26 88 58 23 6 69 11 95 89 41 70 95 81 50 99 81 48 36 62 85 64 58 25 30 23 27 30 87 45 42 67 47 1 1 86 33 43 78 41 57 72 86 55 25 69 36 77 97 48 24 9 20 50 5 2 84 80 62 7 5 49 2 16 3 62 8 40 24 94 60 9 95 22 27 58 20 22 95 16 53 6 8 74 54 94 65 62 90 95 17 77 32 99\\r\\n', 'output': ['49555477\\r\\n']}, {'input': '158 396\\r\\n10 33 14 7 23 30 23 9 99 41 88 56 70 25 85 27 68 60 73 14 32 87 6 16 71 64 22 66 9 48 46 93 81 9 50 48 80 70 78 76 49 89 56 74 56 40 67 45 3 41 77 49 8 56 55 29 78 69 52 70 55 99 85 6 59 99 24 66 4 23 4 51 84 67 79 65 6 67 80 36 85 47 45 37 75 38 39 59 7 11 81 7 12 79 56 87 9 97 30 32 27 21 42 85 17 50 69 13 51 12 73 60 14 94 93 31 10 9 70 67 52 63 45 38 37 13 46 50 53 29 50 57 49 81 71 79 58 74 19 47 19 14 16 82 18 11 71 90 28 21 48 16 41 52 24 6 4 23\\r\\n', 'output': ['757778575\\r\\n']}, {'input': '169 129\\r\\n66 70 83 26 65 94 1 56 17 64 58 68 23 73 45 93 30 94 22 55 68 29 73 44 35 39 71 76 76 76 19 98 99 26 43 73 96 6 72 23 8 56 34 17 91 64 17 33 56 92 41 22 92 59 23 96 35 94 82 1 61 41 75 89 10 74 13 64 50 78 49 83 6 62 43 22 61 95 28 4 76 14 54 41 83 81 83 23 13 57 10 2 44 54 89 41 27 58 57 47 26 82 97 82 5 35 27 31 89 6 73 36 94 89 29 96 3 88 82 27 50 56 73 24 17 56 25 9 2 47 71 86 96 79 35 42 31 73 13 89 52 30 88 96 46 91 23 60 79 2 19 7 73 40 6 29 61 29 67 85 75 11 8 34 60 19 87 23 55\\r\\n', 'output': ['538924707\\r\\n']}, {'input': '195 110\\r\\n3 4 5 1 3 5 4 1 2 4 3 2 4 4 3 2 5 5 5 3 3 3 5 3 5 4 2 5 1 1 2 3 4 5 5 2 2 4 3 4 2 4 4 3 4 2 3 3 3 5 2 1 3 2 5 5 2 2 1 2 2 5 4 2 4 2 4 1 4 2 4 4 4 4 3 5 3 1 2 2 3 4 3 4 4 1 2 1 2 4 5 2 4 3 4 1 4 4 4 5 1 2 4 5 3 5 3 4 2 4 5 2 5 2 5 4 1 5 1 4 2 5 1 2 4 1 3 3 5 5 4 2 3 4 5 4 4 5 2 3 4 2 5 3 2 1 5 3 5 3 5 2 3 2 5 3 5 4 5 1 5 3 3 2 2 5 4 3 3 2 5 5 5 5 2 1 2 3 1 3 5 2 4 5 3 2 2 5 5 2 3 1 3 4 5\\r\\n', 'output': ['21311661\\r\\n']}, {'input': '196 17\\r\\n4 4 2 2 4 2 2 4 4 3 4 1 5 4 4 5 4 1 1 1 5 1 1 4 3 4 4 1 1 1 5 3 2 4 2 1 5 3 4 2 4 2 5 4 1 4 1 2 3 5 3 5 3 2 5 5 5 2 2 1 1 2 2 2 5 4 5 2 5 5 3 1 5 3 5 5 1 3 3 2 3 2 2 1 5 1 2 5 4 5 4 3 4 4 4 1 5 5 2 2 2 5 3 4 5 3 3 2 4 4 4 3 1 1 1 5 2 5 1 5 1 2 3 3 4 4 5 4 2 5 4 2 3 3 4 5 2 2 4 5 5 2 2 1 3 3 4 3 2 3 4 4 5 2 5 1 4 5 2 3 2 4 4 3 4 4 2 5 5 5 5 4 1 3 2 1 4 5 3 2 3 3 5 4 3 1 4 4 5 2 5 2 2 1 4 3\\r\\n', 'output': ['140496580\\r\\n']}, {'input': '200 558\\r\\n1 1 1 3 2 1 1 5 1 2 1 1 2 2 1 5 2 5 2 5 3 2 4 1 5 2 3 2 3 1 2 2 1 4 4 2 5 1 4 3 2 2 4 5 4 5 2 5 5 4 3 5 4 5 5 2 3 4 3 1 5 4 3 3 3 3 2 2 3 4 1 3 1 4 5 2 3 4 1 5 2 3 3 5 5 3 3 1 2 5 3 4 2 5 2 3 3 1 3 2 3 5 1 2 1 1 3 4 1 3 2 1 1 4 2 5 1 2 1 2 2 2 2 2 3 4 2 2 4 4 2 1 3 3 2 4 1 3 5 4 5 1 5 2 1 4 2 3 4 1 4 5 1 1 5 2 4 5 5 4 4 5 3 1 1 5 4 2 2 5 1 3 3 3 4 1 1 2 3 4 1 5 2 2 3 1 4 3 5 1 5 3 2 1 3 2 1 1 3 2\\r\\n', 'output': ['380668983\\r\\n']}, {'input': '190 152\\r\\n2 2 4 4 4 2 2 1 2 3 5 5 4 3 5 1 2 2 2 2 3 3 5 2 1 1 3 4 3 2 2 4 2 3 1 4 2 2 3 2 3 5 3 2 4 1 4 1 2 4 1 3 4 4 3 4 4 4 4 5 2 4 5 3 3 5 4 4 3 4 1 4 1 4 3 3 5 5 2 3 2 2 2 5 4 4 2 4 3 4 2 2 1 4 1 2 3 3 3 5 1 5 5 1 4 3 2 5 2 5 5 5 2 3 3 4 1 1 3 2 5 5 2 5 2 3 5 1 1 5 4 1 1 3 5 2 3 4 3 4 2 1 4 3 5 2 1 1 1 5 2 5 3 4 5 5 2 3 5 5 5 5 1 5 2 5 5 2 4 4 4 3 1 1 2 1 4 4 3 4 2 5 5 3 4 5 5 2 1 4\\r\\n', 'output': ['3475416\\r\\n']}, {'input': '191 640\\r\\n20 10 14 20 13 9 16 5 14 1 11 18 16 17 7 4 15 18 17 3 3 15 14 20 18 2 4 14 20 17 7 2 3 9 5 10 7 6 7 17 3 5 10 1 18 13 15 4 15 7 19 1 17 6 15 12 4 19 1 9 18 18 9 13 3 15 9 3 17 14 18 4 9 3 9 19 20 15 18 11 3 1 12 8 11 10 20 14 14 6 2 14 16 1 7 2 11 15 1 9 20 4 1 1 3 20 20 4 11 7 19 3 3 6 15 10 18 9 13 14 16 12 3 1 15 10 5 14 19 17 9 10 10 15 12 12 5 2 11 6 5 6 7 14 7 6 5 10 13 10 18 20 18 20 12 7 6 10 4 4 3 13 14 5 9 10 4 6 11 11 15 15 12 19 4 7 20 3 12 4 16 6 4 9 17 10 18 11 13 12 18\\r\\n', 'output': ['66598866\\r\\n']}, {'input': '197 344\\r\\n5 11 3 17 16 1 12 7 13 5 9 11 15 14 13 7 13 11 5 9 20 11 11 9 19 3 20 4 6 15 2 14 16 5 19 5 5 5 12 12 12 19 18 1 5 17 13 7 17 14 4 5 9 20 14 13 15 3 8 2 13 16 20 10 20 14 8 17 14 4 9 16 8 13 5 2 13 11 9 7 9 5 11 20 3 17 9 12 12 3 9 19 6 3 15 9 5 11 2 3 13 14 15 7 9 19 16 11 6 8 11 18 11 11 16 18 3 5 10 19 10 6 3 19 3 18 16 16 7 3 10 13 13 16 19 13 4 7 1 7 12 9 6 8 6 1 6 20 7 12 9 13 13 12 10 10 10 16 9 6 11 14 14 7 2 1 16 15 12 7 15 18 8 4 6 18 2 17 6 5 13 19 12 7 1 9 15 9 18 5 8 3 7 8 4 15 8\\r\\n', 'output': ['132934747\\r\\n']}, {'input': '200 0\\r\\n2 5 2 7 6 10 10 4 7 9 1 5 7 1 8 5 9 8 5 2 6 4 9 10 5 4 4 4 8 7 7 5 9 7 7 4 9 8 5 8 10 5 1 2 8 4 3 7 9 6 9 3 9 2 1 9 2 7 4 10 4 7 10 6 1 6 7 4 4 9 10 3 5 5 1 2 8 6 6 2 2 8 6 3 6 1 4 6 10 6 4 8 3 9 6 7 7 8 5 2 10 9 2 7 3 6 10 6 8 9 6 6 8 4 6 9 2 10 9 4 2 3 4 1 3 9 4 2 4 10 10 1 2 3 9 8 2 1 10 7 8 3 10 5 3 10 9 1 9 2 6 7 2 1 10 4 4 9 9 1 8 1 10 9 8 9 9 7 4 3 6 7 10 9 2 7 8 10 2 7 7 6 9 5 9 7 3 1 7 1 5 9 7 3 10 3 10 8 5 7\\r\\n', 'output': ['563633437\\r\\n']}, {'input': '107 59\\r\\n416 332 455 497 251 13 496 46 176 382 357 268 441 302 305 11 274 61 412 18 225 332 173 371 54 179 378 85 471 176 439 36 81 275 452 212 261 488 166 274 89 183 478 337 313 196 130 87 14 223 341 46 45 306 175 488 113 354 107 411 469 122 436 293 311 60 453 245 184 13 425 360 302 205 151 89 433 285 119 301 274 64 127 496 350 354 262 2 148 232 117 28 11 398 237 460 421 347 142 76 391 317 164 484 35 310 453\\r\\n', 'output': ['955755252\\r\\n']}, {'input': '27 383\\r\\n161 2 16 478 438 205 151 229 116 230 447 497 456 219 28 57 200 6 161 400 338 11 426 283 275 40 190\\r\\n', 'output': ['258971846\\r\\n']}, {'input': '107 497\\r\\n218 342 381 296 272 169 321 275 435 461 422 209 413 366 295 332 458 253 302 245 70 353 405 420 439 314 232 466 364 374 4 469 116 291 75 500 212 127 157 440 429 396 53 68 151 264 2 134 73 31 494 148 426 459 27 175 225 287 241 60 14 437 457 446 51 350 233 177 88 455 497 303 107 130 76 125 441 229 325 318 187 459 178 172 226 236 465 289 491 494 146 280 456 475 286 457 277 224 435 365 100 77 145 448 118 454 431\\r\\n', 'output': ['480907144\\r\\n']}, {'input': '27 209\\r\\n272 116 134 369 255 453 477 162 78 1 12 142 236 283 209 390 476 493 51 23 387 32 262 128 160 71 56\\r\\n', 'output': ['415376034\\r\\n']}, {'input': '85 655\\r\\n411 473 456 4 14 135 49 240 191 230 60 375 373 115 301 20 421 187 267 347 207 428 81 318 10 370 428 272 247 322 294 477 274 110 238 244 72 399 146 392 207 83 164 87 257 341 97 94 286 375 25 271 177 270 169 149 279 105 387 92 352 342 274 247 236 344 35 336 419 465 169 371 62 112 490 48 36 343 248 428 241 223 369 296 86\\r\\n', 'output': ['275193712\\r\\n']}, {'input': '107 19\\r\\n2 5 2 5 4 4 1 5 3 3 4 3 2 5 3 1 4 1 4 1 3 1 4 4 1 5 4 1 2 3 3 3 4 2 5 2 3 4 5 2 1 5 3 1 5 5 1 5 3 3 3 5 5 2 4 3 3 4 5 4 2 5 2 4 3 5 2 5 2 1 1 1 1 2 1 4 2 3 4 3 2 4 4 2 2 3 5 5 1 4 1 2 4 4 1 3 3 5 2 3 4 1 2 3 1 5 2\\r\\n', 'output': ['114012476\\r\\n']}, {'input': '186 35\\r\\n4 4 3 2 4 3 1 2 2 2 4 2 5 3 1 3 1 1 2 4 2 5 5 5 1 3 4 1 5 3 5 5 2 4 5 3 1 1 2 1 2 4 2 3 3 4 4 3 3 5 3 1 4 5 5 4 5 2 3 1 2 2 2 4 3 4 1 4 1 2 1 1 1 5 1 1 4 5 3 5 3 3 4 1 5 1 1 4 5 3 3 2 5 3 5 1 5 2 5 1 4 2 4 5 4 4 4 5 4 4 2 5 2 4 4 5 3 2 5 4 1 1 5 5 5 5 1 3 2 5 5 4 3 2 2 5 5 3 1 4 3 4 3 1 2 5 4 4 2 2 5 3 2 1 2 1 1 3 1 4 1 2 3 2 1 5 5 2 2 1 2 1 5 2 4 4 3 2 5 5 2 3 4 5 5 3\\r\\n', 'output': ['273232004\\r\\n']}, {'input': '150 978\\r\\n34 20 7 39 15 14 39 49 36 13 12 12 30 40 4 17 8 2 48 10 16 2 33 36 41 30 4 35 32 35 12 14 28 3 7 3 36 46 43 19 7 38 48 24 19 21 9 31 3 3 8 23 21 49 44 29 15 6 11 40 39 12 44 40 41 37 7 39 40 17 34 21 22 19 30 21 14 3 16 50 38 38 27 7 4 33 20 23 27 32 14 50 33 36 38 22 27 27 14 2 27 37 33 6 21 44 25 17 28 22 43 10 33 21 42 4 7 42 10 20 22 49 14 18 26 19 43 4 31 18 13 17 5 46 19 35 31 14 28 29 48 9 9 4 10 15 30 5 9 23\\r\\n', 'output': ['338032038\\r\\n']}, {'input': '115 588\\r\\n39 133 47 175 120 1 183 148 115 9 196 101 18 156 156 74 43 149 95 56 72 84 32 104 16 188 88 168 164 18 36 105 131 60 26 151 46 160 16 45 76 16 157 190 120 37 102 29 190 57 178 38 89 75 143 2 80 7 11 31 101 28 171 46 93 100 23 163 146 135 12 73 140 144 177 43 19 158 26 20 39 173 97 8 169 139 23 105 7 171 79 11 156 77 164 63 165 124 126 108 125 118 58 129 146 152 31 133 5 160 89 136 174 121 185\\r\\n', 'output': ['27195433\\r\\n']}]","id":393} {"difficulty":1600,"lang":"Go","lang_cluster":"Go","src_uid":"7_B","execute_outcome":"RUNTIME_ERROR","source_code":"package main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t\"fmt\"\r\n\t\"io\"\r\n\t\"os\"\r\n)\r\n\r\nfunc problem7B(_r io.Reader, out io.Writer) {\r\n\tin := bufio.NewReader(_r)\r\n\tvar t, m int\r\n\tvar cmd string\r\n\tvar arg int\r\n\tfmt.Fscan(in, &t, &m)\r\n\r\n\tid := 1\r\n\tblocks := [][3]int{}\r\n\tvar ok bool\r\n\tfor i := 0; i < t; i++ {\r\n\t\tfmt.Fscan(in, &cmd)\r\n\t\tswitch cmd {\r\n\t\tcase \"alloc\":\r\n\t\t\tfmt.Fscan(in, &arg)\r\n\t\t\t\/\/ fmt.Println(i, cmd, arg, blocks)\r\n\t\t\tok, blocks = alloc(arg, m, id, blocks)\r\n\t\t\tif !ok {\r\n\t\t\t\tfmt.Fprintln(out, \"NULL\")\r\n\t\t\t} else {\r\n\t\t\t\tfmt.Fprintln(out, id)\r\n\t\t\t\tid++\r\n\t\t\t}\r\n\t\tcase \"erase\":\r\n\t\t\tfmt.Fscan(in, &arg)\r\n\t\t\tok, blocks = erase(arg, blocks)\r\n\t\t\tif !ok {\r\n\t\t\t\tfmt.Fprintln(out, \"ILLEGAL_ERASE_ARGUMENT\")\r\n\t\t\t}\r\n\t\tcase \"defragment\":\r\n\t\t\tblocks = defrag(blocks)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunc alloc(x, m, id int, blocks [][3]int) (bool, [][3]int) {\r\n\tres := [3]int{id, -1, -1}\r\n\tif len(blocks) == 0 && x > m {\r\n\t\treturn false, blocks\r\n\t}\r\n\tif len(blocks) == 0 || blocks[0][1] >= x {\r\n\t\tres[1] = 0\r\n\t\tres[2] = x\r\n\t\treturn true, append([][3]int{res}, blocks...)\r\n\t}\r\n\tfor idx := 1; idx < len(blocks); idx++ {\r\n\t\tlo := blocks[idx-1][2]\r\n\t\thi := blocks[idx][1]\r\n\t\tif lo+x <= hi {\r\n\t\t\tres[1] = lo\r\n\t\t\tres[2] = lo + x\r\n\t\t\treturn true, append(blocks[:idx], append([][3]int{res}, blocks[idx:]...)...)\r\n\t\t}\r\n\t}\r\n\tlo := blocks[len(blocks)-1][2]\r\n\tif lo+x <= m {\r\n\t\tres[1] = lo\r\n\t\tres[2] = lo + x\r\n\t\treturn true, append(blocks, res)\r\n\t}\r\n\treturn false, blocks\r\n}\r\n\r\nfunc erase(x int, blocks [][3]int) (bool, [][3]int) {\r\n\tfor i := range blocks {\r\n\t\tif blocks[i][0] == x {\r\n\t\t\tblocks = append(blocks[:i], blocks[i+1:]...)\r\n\t\t\treturn true, blocks\r\n\t\t}\r\n\t}\r\n\treturn false, blocks\r\n}\r\n\r\nfunc defrag(blocks [][3]int) [][3]int {\r\n\tend := 0\r\n\tfor i := range blocks {\r\n\t\tif blocks[i][1] > end {\r\n\t\t\tsz := blocks[i][2] - blocks[i][1]\r\n\t\t\tblocks[i][1] = end\r\n\t\t\tblocks[i][2] = blocks[i][1] + sz\r\n\t\t\tend = blocks[i][2]\r\n\t\t}\r\n\t}\r\n\treturn blocks\r\n}\r\n\r\nfunc main() { problem7B(os.Stdin, os.Stdout) }\r\n","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2264t\u2264100;1\u2264m\u2264100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2264n\u2264100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. \n","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.\n","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6\n"],"sample_outputs":["1\n2\nNULL\n3\n"],"human_solution":"package main\r\n\r\nimport (\r\n\t\"bufio\"\r\n\t\"fmt\"\r\n\t\"os\"\r\n\t\"strconv\"\r\n\t\"strings\"\r\n)\r\n\r\nvar reader *bufio.Reader = bufio.NewReader(os.Stdin)\r\nvar writer *bufio.Writer = bufio.NewWriter(os.Stdout)\r\n\r\nfunc scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }\r\nfunc printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }\r\n\r\ntype memory struct {\r\n\tbegin int\r\n\tend int\r\n\tstatus int\r\n\tid int\r\n\tnext *memory\r\n\tprev *memory\r\n}\r\n\r\nfunc main() {\r\n\t\/\/ STDOUT MUST BE FLUSHED MANUALLY!!!\r\n\tdefer writer.Flush()\r\n\tif len(os.Args[1:]) == 1 {\r\n\t\tfile, _ := os.Open(os.Args[1])\r\n\t\treader = bufio.NewReader(file)\r\n\t}\r\n\tvar t, m int\r\n\tscanf(\"%d %d\\n\", &t, &m)\r\n\ttag := make([]int8, t+1)\r\n\thead := new(memory)\r\n\thead.id = -1\r\n\thead.status = -1\r\n\ta := new(memory)\r\n\ta.begin = 0\r\n\ta.end = m\r\n\ta.status = 0\r\n\thead.next = a\r\n\thead.prev = a\r\n\ta.next = head\r\n\ta.prev = head\r\n\tsuccess := 1\r\n\tfor i := 1; i <= t; i++ {\r\n\t\ts, _ := reader.ReadString('\\n')\r\n\t\ts = strings.Trim(s, \"\\r\\n\")\r\n\t\tif s[0] == 'a' {\r\n\t\t\tneed, _ := strconv.Atoi(s[6:])\r\n\t\t\tcurr := head.next\r\n\t\t\tfor curr != head {\r\n\t\t\t\tif curr.status != 0 {\r\n\t\t\t\t\tcurr = curr.next\r\n\t\t\t\t\tcontinue\r\n\t\t\t\t}\r\n\t\t\t\tif curr.end-curr.begin == need {\r\n\t\t\t\t\ttag[success] = 1\r\n\t\t\t\t\tprintf(\"%d\\n\", success)\r\n\t\t\t\t\tcurr.status = 1\r\n\t\t\t\t\tcurr.id = success\r\n\t\t\t\t\tsuccess++\r\n\t\t\t\t\tbreak\r\n\t\t\t\t} else if curr.end-curr.begin > need {\r\n\t\t\t\t\ttag[success] = 1\r\n\t\t\t\t\tprintf(\"%d\\n\", success)\r\n\t\t\t\t\tn := new(memory)\r\n\t\t\t\t\tn.end = curr.end\r\n\t\t\t\t\tn.begin = curr.begin + need\r\n\t\t\t\t\tn.status = 0\r\n\t\t\t\t\tn.prev = curr\r\n\t\t\t\t\tn.next = curr.next\r\n\t\t\t\t\tn.next.prev = n\r\n\t\t\t\t\tcurr.end = curr.begin + need\r\n\t\t\t\t\tcurr.status = 1\r\n\t\t\t\t\tcurr.next = n\r\n\t\t\t\t\tcurr.id = success\r\n\t\t\t\t\tsuccess++\r\n\t\t\t\t\tbreak\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcurr = curr.next\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif curr == head {\r\n\t\t\t\tprintf(\"NULL\\n\")\r\n\t\t\t}\r\n\t\t} else if s[0] == 'e' {\r\n\t\t\tnum, _ := strconv.Atoi(s[6:])\r\n\t\t\t\/\/fmt.Println(num, t, tag)\r\n\t\t\tif num <= 0 || num >= t || tag[num] != 1 {\r\n\t\t\t\tprintf(\"ILLEGAL_ERASE_ARGUMENT\\n\")\r\n\t\t\t} else {\r\n\t\t\t\t\/\/fmt.Println(\"enter\")\r\n\t\t\t\ttag[num] = 0\r\n\t\t\t\tcurr := head.next\r\n\t\t\t\tfor curr != head {\r\n\t\t\t\t\tif curr.status == 1 && curr.id == num {\r\n\t\t\t\t\t\tcurr.status = 0\r\n\t\t\t\t\t\tcurr.id = 0\r\n\t\t\t\t\t\tprev := curr.prev\r\n\t\t\t\t\t\tif prev.status == 0 && prev.end == curr.begin {\r\n\t\t\t\t\t\t\tprev.end = curr.end\r\n\t\t\t\t\t\t\tprev.next = curr.next\r\n\t\t\t\t\t\t\tprev.next.prev = prev\r\n\t\t\t\t\t\t\tcurr = prev\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnext := curr.next\r\n\t\t\t\t\t\tif next.status == 0 && next.begin == curr.end {\r\n\t\t\t\t\t\t\tcurr.end = next.end\r\n\t\t\t\t\t\t\tcurr.next = next.next\r\n\t\t\t\t\t\t\tcurr.next.prev = curr\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tcurr = curr.next\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tcurr := head.next\r\n\t\t\tstart := 0\r\n\r\n\t\t\tfor curr != head {\r\n\t\t\t\tif curr.status == 1 {\r\n\t\t\t\t\ttb := curr.begin\r\n\t\t\t\t\tte := curr.end\r\n\t\t\t\t\tcurr.begin = start\r\n\t\t\t\t\tcurr.end = te - tb + start\r\n\t\t\t\t\tstart = curr.end\r\n\t\t\t\t\tcurr = curr.next\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcurr.prev.next = curr.next\r\n\t\t\t\t\tcurr.next.prev = curr.prev\r\n\t\t\t\t\tcurr = curr.next\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tavail := new(memory)\r\n\t\t\tavail.begin = start\r\n\t\t\tavail.end = m\r\n\t\t\tavail.status = 0\r\n\t\t\tavail.next = head\r\n\t\t\tavail.prev = head.prev\r\n\t\t\thead.prev.next = avail\r\n\t\t\thead.prev = avail\r\n\t\t}\r\n\t\t\/\/pp(head)\r\n\t}\r\n}\r\n\r\nfunc pp(p *memory) {\r\n\tcurr := p.next\r\n\tfor curr != p {\r\n\t\tfmt.Println(curr)\r\n\t\tcurr = curr.next\r\n\t}\r\n\tfmt.Println()\r\n}\r\n","testcases":"[{'input': ['6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n'], 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': ['6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n'], 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n'], 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': ['26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n'], 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n'], 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': ['12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n'], 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': ['38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n'], 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n'], 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': ['16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n'], 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': ['42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n'], 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': ['19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n'], 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': ['44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n'], 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': ['22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': ['7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n'], 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': ['3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n'], 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n'], 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': ['12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n'], 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': ['8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n'], 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': ['10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n'], 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': ['16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n'], 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': ['16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n'], 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":394} {"difficulty":2300,"lang":"Go","lang_cluster":"Go","src_uid":"8781003d9eea51a509145bc6db8b609c","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport(\n\t\"fmt\"\n\t\"sort\"\n\t\"os\"\n\t\"bufio\"\n\t\/\/ \"math\"\n\t\/\/ \"strconv\"\n\t\/\/ \"strings\"\n)\n\nfunc min(a,b int) int{\n\tif ab{\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc toInt(buf []byte) (o int) {\n for _, v := range buf {\n o = o*10 + int(v-'0')\n }\n return\n}\n\ntype pair struct {\n\tfirst int\n\tsecond int\n}\n\ntype pairs []pair\n\nfunc (a pairs) Len() int {return len(a)}\nfunc (a pairs) Swap(i,j int) {a[i], a[j] = a[j], a[i]}\nfunc (a pairs) Less(i,j int) bool {\n\treturn a[i].first < a[j].first\n\tif a[i].first > a[j].first {\n\t\treturn false\n\t}\n\treturn a[i].second <= a[j].second\n}\n\nvar points [2][]pair\nvar g [100005][]int\nvar used,used_x,used_y [100005]bool\nvar diff_x,diff_y []int\nvar cycle_found bool\nvar MD int64 = 1000000007\n\n\nfunc deg(d int) int64 {\n\tif d == 0 {\n\t\treturn 1\n\t}\n\tt := deg(d \/ 2)\n\tt *= t\n\tt %= MD\n\tif d % 2 == 1 {\n\t\tt = t * 2 % MD\n\t}\n\treturn t\n}\n\nfunc dfs(v,p int) {\n\tused[v] = true\n\tif !used_x[points[0][v-1].first] {\n\t\tused_x[points[0][v-1].first] = true\n\t\tdiff_x = append(diff_x, points[0][v-1].first)\n\t}\n\tif !used_y[points[0][v-1].second] {\n\t\tused_y[points[0][v-1].second] = true\n\t\tdiff_y = append(diff_y, points[0][v-1].second)\n\t}\n\tfor i:= range g[v] {\n\t\tto := g[v][i]\n\t\tif to == p {\n\t\t\tcontinue\n\t\t}\n\t\tif used[to] {\n\t\t\tcycle_found = true\n\t\t\tcontinue\n\t\t}\n\t\tdfs(to,v)\n\t}\n}\n\nfunc main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Split(bufio.ScanWords)\n\tscanner.Scan()\n\tn := toInt(scanner.Bytes())\n\tmp := make(map[pair]int)\n\tfor i:=1;i<=n;i++ {\n\t\tscanner.Scan()\n\t\tx := toInt(scanner.Bytes())\n\t\tscanner.Scan()\n\t\ty := toInt(scanner.Bytes())\n\t\tmp[pair{x,y}] = i\n\t\tpoints[0] = append(points[0], pair{x,y})\n\t\tpoints[1] = append(points[1], pair{y,x})\n\t}\n\tsort.Sort(pairs(points[0]))\n\tsort.Sort(pairs(points[1]))\n\tfor i:= range points[0] {\n\t\tif i > 0 {\n\t\t\tif points[0][i].first == points[0][i - 1].first {\n\t\t\t\tx := mp[points[0][i]]\n\t\t\t\ty := mp[points[0][i - 1]]\n\t\t\t\tg[x] = append(g[x], y)\n\t\t\t\tg[y] = append(g[y], x)\n\t\t\t\t\/\/fmt.Println(\">>\",x,y)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i:= range points[1] {\n\t\tif i > 0 {\n\t\t\tif points[1][i].first == points[1][i - 1].first {\n\t\t\t\tx := mp[pair{points[1][i].second, points[1][i].first}]\n\t\t\t\ty := mp[pair{points[1][i - 1].second, points[1][i - 1].first}]\n\t\t\t\tg[x] = append(g[x], y)\n\t\t\t\tg[y] = append(g[y], x)\n\t\t\t\t\/\/fmt.Println(\">>\",x,y)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar ans int64\n\tans = 1\n\n\tfor i:= 1;i<= n;i++ {\n\t\tif !used[i] {\n\t\t\tcycle_found = false\n\t\t\tfor j:= range diff_x {\n\t\t\t\tused_x[diff_x[j]] = false\n\t\t\t}\n\t\t\tfor j:= range diff_y {\n\t\t\t\tused_y[diff_y[j]] = false\n\t\t\t}\n\t\t\tdiff_x = nil\n\t\t\tdiff_y = nil\n\t\t\tdfs(i,i)\n\t\t\tres := deg(len(diff_x) + len(diff_y))\n\t\t\t\/\/fmt.Println(res)\n\t\t\tif !cycle_found {\n\t\t\t\tres--\n\t\t\t}\n\t\t\tif res < 0 {\n\t\t\t\tres += MD\n\t\t\t}\n\t\t\tans = ans * res % MD\n\t\t}\n\t}\n\tfmt.Println(ans)\n}\n\n\n\n","description":"You are given n distinct points on a plane with integral coordinates. For each point you can either draw a vertical line through it, draw a horizontal line through it, or do nothing.You consider several coinciding straight lines as a single one. How many distinct pictures you can get? Print the answer modulo 109\u2009+\u20097.","input_specification":"The first line contains single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105)\u00a0\u2014 the number of points. n lines follow. The (i\u2009+\u20091)-th of these lines contains two integers xi, yi (\u2009-\u2009109\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009109)\u00a0\u2014 coordinates of the i-th point. It is guaranteed that all points are distinct.","output_specification":"Print the number of possible distinct pictures modulo 109\u2009+\u20097.","notes":"NoteIn the first example there are two vertical and two horizontal lines passing through the points. You can get pictures with any subset of these lines. For example, you can get the picture containing all four lines in two ways (each segment represents a line containing it). The first way: The second way: In the second example you can work with two points independently. The number of pictures is 32\u2009=\u20099.","sample_inputs":["4\n1 1\n1 2\n2 1\n2 2","2\n-1 -1\n0 1"],"sample_outputs":["16","9"],"human_solution":"package main\n\nimport(\n\t\"fmt\"\n\t\"sort\"\n\t\"os\"\n\t\"bufio\"\n\t\/\/ \"math\"\n\t\/\/ \"strconv\"\n\t\/\/ \"strings\"\n)\n\nfunc min(a,b int) int{\n\tif ab{\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc toInt(buf []byte) (o int) {\n for _, v := range buf {\n o = o*10 + int(v-'0')\n }\n return\n}\n\ntype pair struct {\n\tfirst int\n\tsecond int\n}\n\ntype pairs []pair\n\nfunc (a pairs) Len() int {return len(a)}\nfunc (a pairs) Swap(i,j int) {a[i], a[j] = a[j], a[i]}\nfunc (a pairs) Less(i,j int) bool {\n\treturn a[i].first < a[j].first\n\tif a[i].first > a[j].first {\n\t\treturn false\n\t}\n\treturn a[i].second <= a[j].second\n}\n\nvar points [2][]pair\nvar pts [100005]pair\nvar g [100005][]int\nvar used [100005]bool\nvar diff_x,diff_y []int\nvar cycle_found bool\nvar MD int64 = 1000000007\nvar used_x,used_y map[int]bool\nvar n,x,y int\n\nfunc deg(d int) int64 {\n\tif d == 0 {\n\t\treturn 1\n\t}\n\tt := deg(d \/ 2)\n\tt *= t\n\tt %= MD\n\tif d % 2 == 1 {\n\t\tt = t * 2 % MD\n\t}\n\treturn t\n}\n\nfunc dfs(v,p int) {\n\tused[v] = true\n\tif !used_x[pts[v].first] {\n\t\tused_x[pts[v].first] = true\n\t\tdiff_x = append(diff_x, pts[v].first)\n\t}\n\tif !used_y[pts[v].second] {\n\t\tused_y[pts[v].second] = true\n\t\tdiff_y = append(diff_y, pts[v].second)\n\t}\n\tfor i:= range g[v] {\n\t\tto := g[v][i]\n\t\tif to == p {\n\t\t\tcontinue\n\t\t}\n\t\tif used[to] {\n\t\t\tcycle_found = true\n\t\t\tcontinue\n\t\t}\n\t\tdfs(to,v)\n\t}\n}\n\nfunc main() {\n\tin := bufio.NewReader(os.Stdin)\n\tfmt.Fscanf(in, \"%d\\n\", &n)\n\tmp := make(map[pair]int)\n\tused_x = make(map[int]bool)\n\tused_y = make(map[int]bool)\n\tfor i:=1;i<=n;i++ {\n\t\tfmt.Fscanf(in, \"%d %d\\n\",&x,&y)\n\t\tmp[pair{x,y}] = i\n\t\tpts[i] = pair{x,y}\n\t\tpoints[0] = append(points[0], pair{x,y})\n\t\tpoints[1] = append(points[1], pair{y,x})\n\t}\n\tsort.Sort(pairs(points[0]))\n\tsort.Sort(pairs(points[1]))\n\tfor i:= range points[0] {\n\t\tif i > 0 {\n\t\t\tif points[0][i].first == points[0][i - 1].first {\n\t\t\t\tx := mp[points[0][i]]\n\t\t\t\ty := mp[points[0][i - 1]]\n\t\t\t\tg[x] = append(g[x], y)\n\t\t\t\tg[y] = append(g[y], x)\n\t\t\t\t\/\/fmt.Println(\">>\",x,y)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i:= range points[1] {\n\t\tif i > 0 {\n\t\t\tif points[1][i].first == points[1][i - 1].first {\n\t\t\t\tx := mp[pair{points[1][i].second, points[1][i].first}]\n\t\t\t\ty := mp[pair{points[1][i - 1].second, points[1][i - 1].first}]\n\t\t\t\tg[x] = append(g[x], y)\n\t\t\t\tg[y] = append(g[y], x)\n\t\t\t\t\/\/fmt.Println(\">>\",x,y)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar ans int64\n\tans = 1\n\n\tfor i:= 1;i<= n;i++ {\n\t\tif !used[i] {\n\t\t\tcycle_found = false\n\t\t\tfor j:= range diff_x {\n\t\t\t\tused_x[diff_x[j]] = false\n\t\t\t}\n\t\t\tfor j:= range diff_y {\n\t\t\t\tused_y[diff_y[j]] = false\n\t\t\t}\n\t\t\tdiff_x = nil\n\t\t\tdiff_y = nil\n\t\t\tdfs(i,i)\n\t\t\t\/\/fmt.Println(len(diff_x),len(diff_y))\n\t\t\tres := deg(len(diff_x) + len(diff_y))\n\t\t\tif !cycle_found {\n\t\t\t\tres--\n\t\t\t}\n\t\t\tif res < 0 {\n\t\t\t\tres += MD\n\t\t\t}\n\t\t\tans = ans * res % MD\n\t\t}\n\t}\n\tfmt.Println(ans)\n}\n\n\n\n","testcases":"[{'input': '4\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['16']}, {'input': '2\\r\\n-1 -1\\r\\n0 1\\r\\n', 'output': ['9']}, {'input': '1\\r\\n0 0\\r\\n', 'output': ['3']}, {'input': '9\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n1 2\\r\\n2 1\\r\\n3 1\\r\\n1 3\\r\\n3 2\\r\\n2 3\\r\\n', 'output': ['64']}, {'input': '10\\r\\n504155727 -77293021\\r\\n-155983273 -43296260\\r\\n-548837441 -43296260\\r\\n88335251 -77293021\\r\\n970294418 -43296260\\r\\n-155983273 850521645\\r\\n-852404258 -77293021\\r\\n518823261 -77293021\\r\\n-89661323 -43296260\\r\\n-155983273 -406914114\\r\\n', 'output': ['3937']}, {'input': '30\\r\\n4 3\\r\\n4 0\\r\\n0 -1\\r\\n-2 4\\r\\n3 4\\r\\n-1 1\\r\\n-3 -2\\r\\n-2 0\\r\\n-1 2\\r\\n3 -4\\r\\n-3 2\\r\\n1 -4\\r\\n-4 -4\\r\\n2 -1\\r\\n1 -2\\r\\n1 -1\\r\\n1 2\\r\\n3 0\\r\\n-2 1\\r\\n3 -3\\r\\n-4 -2\\r\\n2 -4\\r\\n1 3\\r\\n3 -1\\r\\n-2 2\\r\\n0 -4\\r\\n-2 3\\r\\n-4 2\\r\\n-1 3\\r\\n3 2\\r\\n', 'output': ['262144']}, {'input': '100\\r\\n-722269719 -309936395\\r\\n380859881 -649033960\\r\\n-584954164 397388193\\r\\n231765206 -649033960\\r\\n130002371 -649033960\\r\\n-240459921 -699252508\\r\\n160886400 -100907131\\r\\n160886400 -379648420\\r\\n160886400 -680156126\\r\\n160886400 -649033960\\r\\n-240459921 252138442\\r\\n231765206 -379648420\\r\\n-722269719 -680156126\\r\\n331755 -680156126\\r\\n130002371 -309936395\\r\\n331755 78847447\\r\\n130002371 252138442\\r\\n-302608849 -699252508\\r\\n130002371 -699252508\\r\\n160886400 397388193\\r\\n-302608849 -379648420\\r\\n-32047621 -100907131\\r\\n231765206 397388193\\r\\n-58495...', 'output': ['1048576']}, {'input': '100\\r\\n196570748 -401962599\\r\\n196570748 334276766\\r\\n196570748 -616788357\\r\\n196570748 -402190458\\r\\n196570748 -847545066\\r\\n196570748 874947939\\r\\n196570748 360282084\\r\\n196570748 369051137\\r\\n196570748 353866591\\r\\n196570748 642268\\r\\n196570748 -237983947\\r\\n196570748 460981986\\r\\n196570748 -336705904\\r\\n196570748 236311341\\r\\n196570748 -358733203\\r\\n196570748 495466464\\r\\n196570748 942079877\\r\\n196570748 553541576\\r\\n196570748 -18008218\\r\\n196570748 -180433478\\r\\n196570748 83075759\\r\\n196570748 381370238\\r\\n196570748 56965853\\r\\n196570748 -927191285...', 'output': ['952742562']}, {'input': '100000\\r\\n-704210202 845257195\\r\\n994374280 845257195\\r\\n-220565979 845257195\\r\\n-624651086 845257195\\r\\n124376402 845257195\\r\\n-809258596 845257195\\r\\n457192202 845257195\\r\\n364281173 845257195\\r\\n-147743086 845257195\\r\\n408855387 845257195\\r\\n72472943 845257195\\r\\n253956139 845257195\\r\\n86115330 845257195\\r\\n-685801135 845257195\\r\\n-629402350 845257195\\r\\n335335349 845257195\\r\\n-724783162 845257195\\r\\n-385836513 845257195\\r\\n99193713 845257195\\r\\n-821293787 845257195\\r\\n797527295 845257195\\r\\n-722978391 845257195\\r\\n329002376 845257195\\r\\n974027871 84...', 'output': ['215447032']}, {'input': '100\\r\\n-520656116 453887307\\r\\n44690539 438904106\\r\\n455495755 -851026008\\r\\n-264462713 404684322\\r\\n-100048781 985287741\\r\\n970190772 -888126081\\r\\n-880073993 -535056797\\r\\n757012699 530405529\\r\\n-134930284 -271029797\\r\\n608986643 -944589244\\r\\n-100048781 181092183\\r\\n44690539 356401981\\r\\n-849622341 -535056797\\r\\n970190772 -504138050\\r\\n970190772 -732972171\\r\\n408003232 -535056797\\r\\n455495755 133675102\\r\\n408003232 858834617\\r\\n970190772 90156273\\r\\n408003232 474538604\\r\\n647856704 -944589244\\r\\n708460906 -888126081\\r\\n-669416723 -535056797\\r\\n-95677...', 'output': ['309905261']}, {'input': '100000\\r\\n259944441 835989791\\r\\n-385297557 -756264795\\r\\n543708783 -8771718\\r\\n-130947321 -711484092\\r\\n-421216181 -631584459\\r\\n-448655907 987508982\\r\\n-818699289 869384878\\r\\n300839531 197915342\\r\\n-924049307 935557107\\r\\n841705192 676862386\\r\\n281305601 870880392\\r\\n300289110 -733628842\\r\\n-449839382 487625771\\r\\n-287689229 996875339\\r\\n183720835 570931351\\r\\n532081236 940281172\\r\\n937665253 348787081\\r\\n-331593739 -874681230\\r\\n507694563 -888811772\\r\\n533487610 323392558\\r\\n-690195328 -602253021\\r\\n775119648 410612088\\r\\n371491509 -619309612\\r\\n-27...', 'output': ['320597493']}, {'input': '4\\r\\n2 1\\r\\n0 2\\r\\n-2 1\\r\\n0 0\\r\\n', 'output': ['49']}, {'input': '6\\r\\n-2 1\\r\\n-1 -2\\r\\n-2 -2\\r\\n-2 2\\r\\n1 2\\r\\n2 -2\\r\\n', 'output': ['127']}, {'input': '6\\r\\n1 -2\\r\\n-2 -1\\r\\n-1 1\\r\\n1 2\\r\\n0 -1\\r\\n-2 0\\r\\n', 'output': ['315']}, {'input': '4\\r\\n1 0\\r\\n0 0\\r\\n0 1\\r\\n1 -1\\r\\n', 'output': ['31']}, {'input': '4\\r\\n1 -2\\r\\n2 1\\r\\n-1 2\\r\\n0 1\\r\\n', 'output': ['63']}, {'input': '7\\r\\n0 0\\r\\n2 2\\r\\n-2 2\\r\\n-1 2\\r\\n-1 -2\\r\\n-2 -2\\r\\n-2 -1\\r\\n', 'output': ['192']}, {'input': '4\\r\\n-2 -1\\r\\n0 0\\r\\n1 -2\\r\\n1 0\\r\\n', 'output': ['45']}, {'input': '3\\r\\n2 0\\r\\n2 1\\r\\n1 -2\\r\\n', 'output': ['21']}, {'input': '6\\r\\n-1 2\\r\\n0 -1\\r\\n-1 -2\\r\\n0 1\\r\\n-1 0\\r\\n1 0\\r\\n', 'output': ['217']}, {'input': '6\\r\\n0 2\\r\\n-1 1\\r\\n1 -2\\r\\n2 1\\r\\n-2 1\\r\\n-2 0\\r\\n', 'output': ['279']}, {'input': '100000\\r\\n-761036267 -328155614\\r\\n-761036267 577821444\\r\\n-31734468 -328155614\\r\\n218106006 -328155614\\r\\n-787839596 -328155614\\r\\n119944424 -328155614\\r\\n218106006 -781296899\\r\\n-761036267 -494396998\\r\\n-35828525 -328155614\\r\\n-525113268 -494396998\\r\\n-525113268 176332575\\r\\n292103044 -328155614\\r\\n418387567 -328155614\\r\\n-761036267 775093834\\r\\n177713625 -328155614\\r\\n479968449 -328155614\\r\\n218106006 -85737223\\r\\n-761036267 759793142\\r\\n-525113268 -433946463\\r\\n659543546 -328155614\\r\\n235422417 -328155614\\r\\n-864389692 176332575\\r\\n921423571 17633...', 'output': ['215447032']}, {'input': '100000\\r\\n898609440 870662067\\r\\n-579085260 377047488\\r\\n-579085260 -479594915\\r\\n60771032 378753404\\r\\n-877336413 879255045\\r\\n-877336413 -670781542\\r\\n-579085260 -958333597\\r\\n898609440 643007498\\r\\n898609440 359429632\\r\\n-579085260 696898110\\r\\n898609440 -754418356\\r\\n-877336413 -913231637\\r\\n898609440 -748443422\\r\\n60771032 -589733889\\r\\n-579085260 -825508938\\r\\n-877336413 335128147\\r\\n60771032 371289796\\r\\n-877336413 -27961145\\r\\n-579085260 -559406242\\r\\n-877336413 -828309647\\r\\n60771032 -680928922\\r\\n-877336413 -338940758\\r\\n-877336413 188901011...', 'output': ['870014451']}, {'input': '99856\\r\\n136901830 272076597\\r\\n-475457312 302351004\\r\\n-969630682 -56801841\\r\\n-553049932 146299509\\r\\n981021471 855952429\\r\\n-76668596 -638561916\\r\\n803600779 -253647999\\r\\n-284634933 290276355\\r\\n-661927177 651534333\\r\\n329681607 -247391130\\r\\n-634984629 -786805507\\r\\n831733808 -607216559\\r\\n-36613609 696082804\\r\\n416881659 152493739\\r\\n204319438 214814354\\r\\n599744214 -540618277\\r\\n772243515 -152645454\\r\\n-428487920 -874251019\\r\\n814458582 120441856\\r\\n-36613609 272076597\\r\\n-107169837 360871005\\r\\n-774915642 -638561916\\r\\n-470875527 592715230\\r\\n48...', 'output': ['806006049']}, {'input': '100000\\r\\n-446521571 -385335037\\r\\n-446521571 501456492\\r\\n-446521571 100301695\\r\\n-446521571 11767645\\r\\n-446521571 -841825966\\r\\n-446521571 936509588\\r\\n-446521571 -221092882\\r\\n-446521571 634718253\\r\\n-446521571 -412158501\\r\\n-446521571 -142882402\\r\\n-446521571 -634694358\\r\\n-446521571 603283741\\r\\n-446521571 564009782\\r\\n-446521571 540365483\\r\\n-446521571 -673371843\\r\\n-446521571 618314009\\r\\n-446521571 -360922970\\r\\n-446521571 -838228183\\r\\n-446521571 -467282114\\r\\n-446521571 230001261\\r\\n-446521571 -263533066\\r\\n-446521571 438551114\\r\\n-44652157...', 'output': ['215447032']}, {'input': '100000\\r\\n804417283 -263224583\\r\\n-442372591 -263224583\\r\\n-442372591 -25309503\\r\\n804417283 -25309503\\r\\n-102929376 -25309503\\r\\n706518134 -25309503\\r\\n706518134 540125796\\r\\n706518134 -593700747\\r\\n804417283 694859662\\r\\n239719684 -263224583\\r\\n-618251227 -25309503\\r\\n-618251227 154352947\\r\\n-442372591 -352612847\\r\\n804417283 -82488186\\r\\n724198943 -25309503\\r\\n804417283 -145593202\\r\\n-447296107 -145593202\\r\\n-328316785 694859662\\r\\n-946228301 -25309503\\r\\n-618251227 483377110\\r\\n858391130 -82488186\\r\\n-815903051 -263224583\\r\\n-946228301 -39052457\\r\\n...', 'output': ['151930880']}, {'input': '100000\\r\\n-183686489 578962647\\r\\n938699733 578962647\\r\\n938699733 349298434\\r\\n163298053 349298434\\r\\n163298053 -340263317\\r\\n-42343097 -340263317\\r\\n-42343097 -569250694\\r\\n-29609886 -569250694\\r\\n-29609886 -446781051\\r\\n669722921 -446781051\\r\\n669722921 -809753078\\r\\n535062418 -809753078\\r\\n535062418 -313656358\\r\\n-790533838 -313656358\\r\\n-790533838 -175436840\\r\\n-244518450 -175436840\\r\\n-244518450 -43576722\\r\\n901696708 -43576722\\r\\n901696708 -905346370\\r\\n-67387351 -905346370\\r\\n-67387351 766483054\\r\\n-982758112 766483054\\r\\n-982758112 951096567\\r...', 'output': ['607723520']}, {'input': '100000\\r\\n210308632 438417846\\r\\n-50714588 438417846\\r\\n-50714588 370731247\\r\\n-224209743 370731247\\r\\n-224209743 168971927\\r\\n35975812 168971927\\r\\n35975812 -490396851\\r\\n772883773 -490396851\\r\\n772883773 -51537316\\r\\n925981926 -51537316\\r\\n925981926 847370412\\r\\n210450024 847370412\\r\\n210450024 916986070\\r\\n956444441 916986070\\r\\n956444441 -783519027\\r\\n133495716 -783519027\\r\\n133495716 426548869\\r\\n-728378500 426548869\\r\\n-728378500 862484025\\r\\n-440278865 862484025\\r\\n-440278865 912342978\\r\\n965145092 912342978\\r\\n965145092 979016742\\r\\n-543209012 9...', 'output': ['75965440']}, {'input': '100000\\r\\n-23397176 -302315769\\r\\n683916068 -302315769\\r\\n683916068 412030470\\r\\n216954363 412030470\\r\\n216954363 232076087\\r\\n-913796326 232076087\\r\\n-913796326 -830539755\\r\\n-201224886 -830539755\\r\\n-201224886 -384463084\\r\\n-668700778 -384463084\\r\\n-668700778 -68350803\\r\\n402864660 -68350803\\r\\n402864660 -235902827\\r\\n-647542695 -235902827\\r\\n-647542695 -864365061\\r\\n-267271153 -864365061\\r\\n-267271153 142516932\\r\\n371111 142516932\\r\\n371111 -103314684\\r\\n588650961 -103314684\\r\\n588650961 898378687\\r\\n-92487409 898378687\\r\\n-92487409 -846111567\\r\\n679...', 'output': ['607723520']}, {'input': '100000\\r\\n734898896 -923645016\\r\\n179484722 -923645016\\r\\n179484722 144777347\\r\\n-144120395 144777347\\r\\n-144120395 -348219978\\r\\n130150500 -348219978\\r\\n130150500 279503656\\r\\n-914045956 279503656\\r\\n-914045956 800416534\\r\\n83472077 800416534\\r\\n83472077 237217643\\r\\n660756274 237217643\\r\\n660756274 511314055\\r\\n-91169728 511314055\\r\\n-91169728 -971273127\\r\\n570626414 -971273127\\r\\n570626414 -133101461\\r\\n-699541170 -133101461\\r\\n-699541170 48588752\\r\\n-319667069 48588752\\r\\n-319667069 -201870565\\r\\n-413063418 -201870565\\r\\n-413063418 32991762\\r\\n-2312...', 'output': ['607723520']}, {'input': '100000\\r\\n617084942 -265049120\\r\\n615333369 -265049120\\r\\n615333369 -682548120\\r\\n119562839 -682548120\\r\\n119562839 -691551382\\r\\n-286349652 -691551382\\r\\n-286349652 928420177\\r\\n627332512 928420177\\r\\n627332512 665006160\\r\\n661332261 665006160\\r\\n661332261 550203360\\r\\n-624073686 550203360\\r\\n-624073686 -684725598\\r\\n409089263 -684725598\\r\\n409089263 227469271\\r\\n-879575754 227469271\\r\\n-879575754 617872439\\r\\n881258644 617872439\\r\\n881258644 -983107218\\r\\n-16948244 -983107218\\r\\n-16948244 -62817672\\r\\n226589325 -62817672\\r\\n226589325 -244414702\\r\\n649...', 'output': ['607723520']}, {'input': '100000\\r\\n674607943 -800417597\\r\\n266182461 -800417597\\r\\n-957168890 -800417597\\r\\n266182461 837097152\\r\\n266182461 681124867\\r\\n266182461 669163191\\r\\n266182461 -550493749\\r\\n-352302723 -800417597\\r\\n-746158996 -800417597\\r\\n360296208 -800417597\\r\\n266182461 49071550\\r\\n266182461 -361740440\\r\\n-542814007 669163191\\r\\n360296208 -954088509\\r\\n266182461 -988967694\\r\\n266182461 210323326\\r\\n266182461 176283099\\r\\n-452456374 681124867\\r\\n-957168890 -92692253\\r\\n-957168890 -590332616\\r\\n-437379796 49071550\\r\\n85774087 -590332616\\r\\n-940308893 210323326\\r\\n26...', 'output': ['215447032']}, {'input': '100000\\r\\n979508972 313749130\\r\\n676160419 -455136391\\r\\n-94401006 162754067\\r\\n904301450 815875162\\r\\n-805106379 -455136391\\r\\n366301150 162754067\\r\\n-390138105 313749130\\r\\n904301450 -182573709\\r\\n-295549367 313749130\\r\\n-94401006 -273764223\\r\\n419256091 -455136391\\r\\n-385975367 162754067\\r\\n-385975367 761282509\\r\\n853870382 761282509\\r\\n-390138105 -64287928\\r\\n904301450 -794204591\\r\\n904301450 481800635\\r\\n-385975367 -386950462\\r\\n-582901876 815875162\\r\\n75304732 162754067\\r\\n-94401006 -860814712\\r\\n-338026325 -860814712\\r\\n166184376 -860814712\\r\\n71...', 'output': ['777164027']}]","id":395} {"difficulty":1600,"lang":"Go","lang_cluster":"Go","src_uid":"a6cba17c5ddb93f6741e00280fb6c54c","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\n\tt, m := readTwoNums(reader)\n\n\tmanager := NewManager(m)\n\n\tvar buf bytes.Buffer\n\n\tfor t > 0 {\n\t\tt--\n\t\ts, _ := reader.ReadBytes('\\n')\n\n\t\tif s[0] == 'a' {\n\t\t\tvar n int\n\t\t\treadInt(s, len(\"alloc \"), &n)\n\t\t\tid := manager.Alloc(n)\n\n\t\t\tif id < 0 {\n\t\t\t\tbuf.WriteString(\"NULL\\n\")\n\t\t\t} else {\n\t\t\t\tbuf.WriteString(fmt.Sprintf(\"%d\\n\", id))\n\t\t\t}\n\t\t} else if s[0] == 'e' {\n\t\t\tvar x int\n\t\t\treadInt(s, len(\"erase \"), &x)\n\t\t\tok := manager.Erase(x)\n\t\t\tif !ok {\n\t\t\t\tbuf.WriteString(\"ILLEGAL_ERASE_ARGUMENT\\n\")\n\t\t\t}\n\t\t} else {\n\t\t\tmanager.Defragment()\n\t\t}\n\t}\n\n\tfmt.Print(buf.String())\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\ntype Node struct {\n\tnext *Node\n\tsz int\n\tpos int\n\tid int\n}\n\nfunc NewNode(pos int, sz int) *Node {\n\tnode := new(Node)\n\tnode.pos = pos\n\tnode.sz = sz\n\treturn node\n}\n\ntype Manager struct {\n\tfree *Node\n\tused *Node\n\tmem map[int]int\n\tp int\n\ttot int\n}\n\nfunc NewManager(m int) Manager {\n\tfree := new(Node)\n\tfree.next = NewNode(0, m)\n\tused := new(Node)\n\tmem := make(map[int]int)\n\treturn Manager{free, used, mem, 0, m}\n}\n\nfunc (this *Manager) Alloc(n int) int {\n\thead := this.free\n\n\tfor head.next != nil && head.next.sz < n {\n\t\thead = head.next\n\t}\n\n\tif head.next == nil {\n\t\treturn -1\n\t}\n\n\ttmp := head.next\n\tpos := tmp.pos\n\n\tvar tmp2 *Node\n\n\tif tmp.sz > n {\n\t\ttmp.sz -= n\n\t\ttmp.pos += n\n\t\ttmp2 = NewNode(pos, n)\n\t} else {\n\t\thead.next = tmp.next\n\t\ttmp2 = tmp\n\t}\n\n\thead = this.used\n\n\tfor head.next != nil && head.next.pos < pos {\n\t\thead = head.next\n\t}\n\n\ttmp2.next = head.next\n\n\thead.next = tmp2\n\n\tthis.p++\n\tthis.mem[this.p] = pos\n\ttmp2.id = this.p\n\n\treturn this.p\n}\n\nfunc (this *Manager) Erase(x int) bool {\n\tif pos, found := this.mem[x]; !found {\n\t\treturn false\n\t} else {\n\t\tdelete(this.mem, x)\n\t\thead := this.used\n\t\t\/\/remove it from used\n\t\tfor head.next != nil && head.next.pos < pos {\n\t\t\thead = head.next\n\t\t}\n\n\t\tif head.next == nil || head.next.pos > pos || head.next.id != x {\n\t\t\treturn false\n\t\t}\n\n\t\ttmp := head.next\n\t\thead.next = tmp.next\n\n\t\t\/\/ put back as free\n\t\thead = this.free\n\n\t\tfor head.next != nil && head.pos < pos {\n\t\t\thead = head.next\n\t\t}\n\n\t\tif head != this.free && head.pos+head.sz == pos {\n\t\t\thead.sz += tmp.sz\n\t\t\treturn true\n\t\t}\n\n\t\ttmp.id = -1\n\t\ttmp.next = head.next\n\t\thead.next = tmp\n\n\t\tif tmp.next != nil && tmp.pos+tmp.sz == tmp.next.pos {\n\t\t\ttmp.sz += tmp.next.sz\n\t\t\ttmp.next = tmp.next.next\n\t\t}\n\n\t\treturn true\n\t}\n}\n\nfunc (this *Manager) Defragment() {\n\thead := this.used\n\tvar sz int\n\n\tfor head.next != nil {\n\t\tcur := head.next\n\t\tcur.pos = sz\n\t\tsz += cur.sz\n\t\thead = head.next\n\t}\n\n\tif this.tot > sz {\n\t\tthis.free.next = NewNode(sz, this.tot-sz)\n\t} else {\n\t\tthis.free.next = nil\n\t}\n}\n","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2009\u2264\u2009t\u2009\u2264\u2009100;1\u2009\u2264\u2009m\u2009\u2264\u2009100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2009\u2264\u2009n\u2009\u2264\u2009100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. ","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6"],"sample_outputs":["1\n2\nNULL\n3"],"human_solution":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n)\n\ntype Block struct {\n\tid int\n\tlength int\n\tnextBlock *Block\n}\n\nfunc printMemory(mem *Block) {\n\tfor p := mem; p != nil; p = p.nextBlock {\n\t\tfmt.Printf(\"id=%d length=%d\\n\", p.id, p.length)\n\t}\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar t, m int\n\tfmt.Fscanf(reader, \"%d %d\\n\", &t, &m)\n\tnextId := 1\n\tmemory := &Block{0, m, nil}\n\n\tfor i := 0; i < t; i++ {\n\t\tvar op string\n\t\tvar x int\n\t\tfmt.Fscanf(reader, \"%s\", &op)\n\t\tswitch op {\n\t\tcase \"alloc\":\n\t\t\tfmt.Fscanf(reader, \" %d\\n\", &x)\n\t\t\tflag := false\n\t\t\tfor p := memory; p != nil; p = p.nextBlock {\n\t\t\t\tif p.id == 0 {\n\t\t\t\t\tfor q := p.nextBlock; q != nil && q.id == 0; q = p.nextBlock {\n\t\t\t\t\t\tp.nextBlock = q.nextBlock\n\t\t\t\t\t\tp.length += q.length\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif p.length == x {\n\t\t\t\t\tp.id = nextId\n\t\t\t\t\tnextId++\n\t\t\t\t\tfmt.Printf(\"%d\\n\", p.id)\n\t\t\t\t\tflag = true\n\t\t\t\t\tbreak\n\t\t\t\t} else if p.length > x {\n\t\t\t\t\tq := &Block{0, p.length - x, p.nextBlock}\n\t\t\t\t\tp.length = x\n\t\t\t\t\tp.nextBlock = q\n\t\t\t\t\tp.id = nextId\n\t\t\t\t\tnextId++\n\t\t\t\t\tfmt.Printf(\"%d\\n\", p.id)\n\t\t\t\t\tflag = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !flag {\n\t\t\t\tfmt.Printf(\"NULL\\n\")\n\t\t\t}\n\t\tcase \"erase\":\n\t\t\tfmt.Fscanf(reader, \" %d\\n\", &x)\n\t\t\tflag := false\n\t\t\tfor p := memory; p != nil; p = p.nextBlock {\n\t\t\t\tif p.id == x && p.id != 0 {\n\t\t\t\t\tp.id = 0\n\t\t\t\t\tflag = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !flag {\n\t\t\t\tfmt.Printf(\"ILLEGAL_ERASE_ARGUMENT\\n\")\n\t\t\t}\n\t\tcase \"defragment\":\n\t\t\tfmt.Fscanf(reader, \"\\n\")\n\t\t\tfor p := memory; p != nil && p.nextBlock != nil; p = p.nextBlock {\n\t\t\t\tif p.id != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor q := p.nextBlock; q != nil; q = p.nextBlock {\n\t\t\t\t\tif p.id == 0 && q.id == 0 {\n\t\t\t\t\t\tp.length += q.length\n\t\t\t\t\t\tp.nextBlock = q.nextBlock\n\t\t\t\t\t} else if p.id == 0 && q.id != 0 {\n\t\t\t\t\t\tp.id, q.id = q.id, p.id\n\t\t\t\t\t\tp.length, q.length = q.length, p.length\n\t\t\t\t\t\tbreak\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","testcases":"[{'input': '6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': '6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n', 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n', 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n', 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': '22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': '7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': '3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': '8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n', 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': '10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":396} {"difficulty":2600,"lang":"Go","lang_cluster":"Go","src_uid":"a9bad412597726f8cdc0cfa2da891bc4","execute_outcome":"RUNTIME_ERROR","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\n\tn, a, b := readThreeNums(reader)\n\n\th := readNNums(reader, n)\n\n\tres := solve(n, a, b, h)\n\n\tvar buf bytes.Buffer\n\n\tbuf.WriteString(fmt.Sprintf(\"%d\\n\", len(res)))\n\n\tfor i := 0; i < len(res); i++ {\n\t\tbuf.WriteString(fmt.Sprintf(\"%d \", res[i]))\n\t}\n\tfmt.Println(buf.String())\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\nconst H = 17\nconst INF = 10000\n\nfunc solve(n int, a int, b int, h []int) []int {\n\tfor i := 0; i < n; i++ {\n\t\th[i]++\n\t}\n\tif n == 3 {\n\t\tvar res []int\n\t\tfor h[0] > 0 || h[1] > 0 || h[2] > 0 {\n\t\t\th[0] = max(0, h[0]-b)\n\t\t\th[1] = max(0, h[1]-a)\n\t\t\th[2] = max(0, h[2]-b)\n\t\t\tres = append(res, 2)\n\t\t}\n\t\treturn res\n\t}\n\tdp := make([][][]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tdp[i] = make([][]int, h[i]+1)\n\t\tfor j := 0; j <= h[i]; j++ {\n\t\t\tdp[i][j] = make([]int, 1+(H+a-1)\/a)\n\t\t\tfor k := 0; k < len(dp[i][j]); k++ {\n\t\t\t\tdp[i][j][k] = INF\n\t\t\t}\n\t\t}\n\t}\n\tdp[0][h[0]][0] = 0\n\n\tfor i := 1; i < n-1; i++ {\n\t\tfor j := 0; j <= h[i-1]; j++ {\n\t\t\tfor k := 0; k < len(dp[i-1][j]); k++ {\n\t\t\t\tif dp[i-1][j][k] >= INF {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t\/\/first: need to make sure attacks at this archer can make h[i-1] to be zero\n\t\t\t\tfor kk := 0; kk < len(dp[i][j]); kk++ {\n\t\t\t\t\tjj := max(0, h[i]-b*k-a*kk)\n\t\t\t\t\tif kk*b >= j {\n\t\t\t\t\t\tdp[i][jj][kk] = min(dp[i][jj][kk], dp[i-1][j][k]+kk)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor j := 0; j <= h[n-2]; j++ {\n\t\tfor k := 0; k < len(dp[n-2][j]); k++ {\n\t\t\tif dp[n-2][j][k] >= INF {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif k*b >= h[n-1] {\n\t\t\t\tdp[n-1][0][0] = min(dp[n-1][0][0], dp[n-2][j][k])\n\t\t\t}\n\t\t}\n\t}\n\tbest := dp[n-1][0][0]\n\tres := make([]int, 0, best)\n\n\tfor i := n - 2; i > 0; i-- {\n\t\tvar found = false\n\t\tfor j := 0; j <= h[i] && !found; j++ {\n\t\t\tfor k := 0; k < len(dp[i][j]) && !found; k++ {\n\t\t\t\tif dp[i][j][k] == best {\n\t\t\t\t\tfor x := 0; x < k; x++ {\n\t\t\t\t\t\tres = append(res, i+1)\n\t\t\t\t\t}\n\t\t\t\t\tbest -= k\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}\n\nfunc max(a, b int) int {\n\tif a >= b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc min(a, b int) int {\n\tif a <= b {\n\t\treturn a\n\t}\n\treturn b\n}\n","description":"This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.Polycarp likes to play computer role-playing game \u00abLizards and Basements\u00bb. At the moment he is playing it as a magician. At one of the last levels he has to fight the line of archers. The only spell with which he can damage them is a fire ball. If Polycarp hits the i-th archer with his fire ball (they are numbered from left to right), the archer loses a health points. At the same time the spell damages the archers adjacent to the i-th (if any) \u2014 they lose b (1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910) health points each.As the extreme archers (i.e. archers numbered 1 and n) are very far, the fire ball cannot reach them. Polycarp can hit any other archer with his fire ball.The amount of health points for each archer is known. An archer will be killed when this amount is less than 0. What is the minimum amount of spells Polycarp can use to kill all the enemies?Polycarp can throw his fire ball into an archer if the latter is already killed.","input_specification":"The first line of the input contains three integers n,\u2009a,\u2009b (3\u2009\u2264\u2009n\u2009\u2264\u200910; 1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910). The second line contains a sequence of n integers \u2014 h1,\u2009h2,\u2009...,\u2009hn (1\u2009\u2264\u2009hi\u2009\u2264\u200915), where hi is the amount of health points the i-th archer has.","output_specification":"In the first line print t \u2014 the required minimum amount of fire balls. In the second line print t numbers \u2014 indexes of the archers that Polycarp should hit to kill all the archers in t shots. All these numbers should be between 2 and n\u2009-\u20091. Separate numbers with spaces. If there are several solutions, output any of them. Print numbers in any order.","notes":null,"sample_inputs":["3 2 1\n2 2 2","4 3 1\n1 4 1 1"],"sample_outputs":["3\n2 2 2","4\n2 2 3 3"],"human_solution":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n)\n\nvar n, a, b int\n\nvar best = 999999\nvar ans []int\n\nfunc getCount(health, damage int) int {\n\tif health%damage == 0 {\n\t\treturn health \/ damage\n\t} else {\n\t\treturn (health \/ damage) + 1\n\t}\n}\n\nfunc dfs(layer int, h []int, solution []int, slen int) {\n\tif slen >= best {\n\t\treturn\n\t}\n\n\tif len(h) == 2 {\n\t\tca, cb := getCount(h[0], a), getCount(h[1], b)\n\t\tif ca < cb {\n\t\t\tca = cb\n\t\t}\n\t\tif slen+ca < best {\n\t\t\tbest = slen + ca\n\t\t\tans = make([]int, best)\n\t\t\tfor i := 0; i < slen; i++ {\n\t\t\t\tans[i] = solution[i]\n\t\t\t}\n\t\t\tfor i := 0; i < ca; i++ {\n\t\t\t\tans[slen+i] = layer + 1\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tcount0 := getCount(h[0], b)\n\tcount1 := getCount(h[1], a)\n\tcount2 := getCount(h[2], b)\n\n\tfor i := count0; true; i++ {\n\t\th0, h1, h2 := h[0], h[1], h[2]\n\n\t\th[0] = 0\n\t\tif h1 >= a*i {\n\t\t\th[1] = h1 - a*i\n\t\t} else {\n\t\t\th[1] = 0\n\t\t}\n\t\tif h2 >= b*i {\n\t\t\th[2] = h2 - b*i\n\t\t} else {\n\t\t\th[2] = 0\n\t\t}\n\t\tfor j := 0; j < i; j++ {\n\t\t\tsolution[slen+j] = layer + 2\n\t\t}\n\t\tdfs(layer+1, h[1:], solution, slen+i)\n\n\t\th[0], h[1], h[2] = h0, h1, h2\n\t\tif i > count0 && i > count1 && i > count2 {\n\t\t\tbreak\n\t\t}\n\t}\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tfmt.Fscanf(reader, \"%d %d %d\\n\", &n, &a, &b)\n\th := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscanf(reader, \"%d \", &h[i])\n\t\th[i]++\n\t}\n\tdfs(0, h, make([]int, 128, 128), 0)\n\tfmt.Printf(\"%d\\n\", best)\n\tfor i := 0; i < best; i++ {\n\t\tfmt.Printf(\"%d \", ans[i])\n\t}\n}\n","testcases":"[{'input': '3 2 1\\r\\n2 2 2\\r\\n', 'output': ['3\\r\\n2 2 2 ']}, {'input': '4 3 1\\r\\n1 4 1 1\\r\\n', 'output': ['4\\r\\n2 2 3 3 ']}, {'input': '3 5 3\\r\\n1 2 1\\r\\n', 'output': ['1\\r\\n2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 1\\r\\n10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 1\\r\\n1 9 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 2\\r\\n9 3 6\\r\\n', 'output': ['5\\r\\n2 2 2 2 2 ']}, {'input': '4 5 3\\r\\n2 2 2 1\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n2 3 2 2\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n4 2 4 2\\r\\n', 'output': ['3\\r\\n2 2 3 ']}, {'input': '4 5 1\\r\\n4 9 1 8\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n9 9 3 4\\r\\n', 'output': ['6\\r\\n2 2 2 2 3 3 ']}, {'input': '4 5 1\\r\\n8 8 9 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n10 10 10 10\\r\\n', 'output': ['8\\r\\n2 2 2 2 3 3 3 3 ']}, {'input': '4 5 2\\r\\n7 3 8 5\\r\\n', 'output': ['7\\r\\n2 2 2 2 3 3 3 ']}, {'input': '4 5 3\\r\\n5 10 7 7\\r\\n', 'output': ['5\\r\\n2 2 3 3 3 ']}, {'input': '4 3 1\\r\\n8 10 9 7\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 ']}, {'input': '10 9 5\\r\\n12 14 11 11 14 14 12 15 14 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 6 7 9 9 9 ']}, {'input': '10 5 2\\r\\n12 10 6 7 11 4 3 5 9 3\\r\\n', 'output': ['13\\r\\n2 2 2 2 2 2 2 4 5 5 7 9 9 ']}, {'input': '10 4 1\\r\\n5 12 10 5 13 6 5 5 2 10\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 3 4 5 5 5 6 7 8 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 1\\r\\n10 12 11 4 12 1 15 15 11 12\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 5 5 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n6 12 9 3 7 3 3 11 13 10\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 3 5 5 5 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n8 7 9 8 14 1 9 11 8 13\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 4 5 5 7 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n9 11 9 11 4 5 7 13 12 9\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 4 7 7 9 9 9 9 ']}, {'input': '10 8 2\\r\\n11 10 13 12 9 10 9 9 10 12\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 6 8 7 10 10 9 6 6 7\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 6 7 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 5 4 5 5 4 5 4 5 4\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n2 1 2 4 2 4 3 2 2 4\\r\\n', 'output': ['6\\r\\n2 5 5 7 9 9 ']}, {'input': '10 3 1\\r\\n4 4 3 3 3 3 2 1 3 1\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 4 5 6 7 9 9 ']}, {'input': '10 7 1\\r\\n3 3 2 1 3 1 2 2 3 1\\r\\n', 'output': ['9\\r\\n2 2 2 2 5 5 7 9 9 ']}, {'input': '10 10 1\\r\\n8 8 8 8 8 8 8 8 8 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n11 9 11 10 10 11 9 10 9 11\\r\\n', 'output': ['33\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n10 9 14 9 13 11 14 10 14 10\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 4 4 5 6 6 6 7 7 8 9 9 9 9 9 9 ']}, {'input': '10 8 6\\r\\n14 12 14 12 10 8 10 13 9 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 8 9 9 9 ']}, {'input': '10 4 1\\r\\n7 8 9 8 8 7 8 9 7 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 4 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 10 9 9 10 9 9 10 9 10\\r\\n', 'output': ['34\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 4\\r\\n11 10 10 10 10 12 10 10 10 12\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 10 4\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['4\\r\\n2 5 8 9 ']}, {'input': '10 2 1\\r\\n9 12 12 8 8 5 14 10 7 3\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 7 7 7 7 7 7 7 8 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 15 15 14 14 14\\r\\n', 'output': ['49\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 6 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n9 8 8 8 11 11 9 10 9 11\\r\\n', 'output': ['13\\r\\n2 2 2 2 5 5 5 7 7 9 9 9 9 ']}, {'input': '10 6 2\\r\\n11 8 10 11 10 8 8 13 9 13\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n3 7 9 12 11 3 4 3 14 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 3 4 4 4 5 5 5 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 7 10 7 6 8 9 8 6 9\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 2 3 4 4 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n2 9 2 6 8 7 6 5 6 2\\r\\n', 'output': ['8\\r\\n2 2 4 5 6 7 9 9 ']}, {'input': '10 7 3\\r\\n2 7 2 7 3 4 3 2 4 3\\r\\n', 'output': ['7\\r\\n2 3 5 5 7 9 9 ']}, {'input': '10 6 3\\r\\n8 9 8 9 8 9 10 9 8 9\\r\\n', 'output': ['12\\r\\n2 2 2 4 5 5 7 7 9 9 9 9 ']}, {'input': '10 2 1\\r\\n10 9 10 9 9 9 10 8 8 10\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n4 4 5 6 4 6 4 5 5 4\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 9 2\\r\\n5 7 8 8 7 5 7 4 4 5\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 9 5\\r\\n8 7 5 9 8 7 8 11 11 8\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 7 4\\r\\n5 6 6 6 7 7 6 5 5 5\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 9 1\\r\\n10 11 11 11 11 11 11 11 11 11\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 5 1\\r\\n6 5 6 5 6 6 6 5 6 6\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 2 4 5 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n8 7 9 7 9 12 12 6 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n7 3 5 3 5 5 3 4 2 4\\r\\n', 'output': ['10\\r\\n2 2 2 2 5 5 7 9 9 9 ']}, {'input': '10 7 2\\r\\n5 2 5 3 2 3 4 3 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 5 5 7 9 9 ']}, {'input': '10 2 1\\r\\n5 3 6 6 7 4 4 4 3 3\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 6 1\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['36\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 11 11 11 15 15 12 15 12 14\\r\\n', 'output': ['47\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 5 5 6 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 1\\r\\n9 15 15 11 8 10 13 9 15 9\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 3 4 4 5 6 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n12 12 14 13 14 12 14 14 11 14\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 6 7 8 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 5 5 5 5 5 5 6 4 4\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 8 7\\r\\n15 15 15 15 15 15 15 15 15 15\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 9 5\\r\\n11 10 4 4 6 9 11 4 10 8\\r\\n', 'output': ['8\\r\\n2 2 2 5 7 8 9 9 ']}, {'input': '10 6 3\\r\\n9 12 8 11 7 14 8 5 15 10\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 3 1\\r\\n4 4 4 4 3 4 3 3 3 3\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 6 4\\r\\n11 10 10 10 12 12 12 10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 6 1\\r\\n3 2 4 4 8 12 5 10 12 6\\r\\n', 'output': ['17\\r\\n2 2 2 2 4 5 6 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 9 5\\r\\n13 13 13 13 13 12 12 12 12 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 4 1\\r\\n7 7 6 6 6 8 6 7 6 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 5 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n13 10 12 10 9 12 11 8 12 12\\r\\n', 'output': ['15\\r\\n2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 ']}, {'input': '10 6 2\\r\\n1 4 5 4 4 2 3 6 6 4\\r\\n', 'output': ['8\\r\\n2 4 4 6 8 9 9 9 ']}, {'input': '10 8 1\\r\\n12 6 7 9 3 12 5 9 5 11\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n13 14 10 6 8 7 8 8 11 5\\r\\n', 'output': ['16\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 8 9 9 9 ']}, {'input': '10 8 1\\r\\n3 4 5 6 4 6 5 6 5 4\\r\\n', 'output': ['15\\r\\n2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n12 10 9 9 15 15 10 14 15 15\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 2 4 5 5 6 6 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 9 8 8 8 9 9 8 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n5 4 5 4 4 4 4 4 4 5\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n11 8 5 13 8 9 11 15 11 12\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n7 10 15 5 15 5 5 5 11 7\\r\\n', 'output': ['24\\r\\n2 2 2 2 2 2 2 2 3 3 5 5 5 5 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n5 5 4 4 4 4 4 4 5 4\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 6 2\\r\\n5 8 4 5 1 3 6 7 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 4 7 7 9 9 ']}, {'input': '10 5 2\\r\\n10 12 10 10 11 9 11 11 9 9\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 8 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n9 8 10 10 11 11 8 9 10 11\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 7 9 9 9 ']}, {'input': '10 3 2\\r\\n3 5 1 4 5 3 3 1 3 4\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 8 9 9 9 ']}, {'input': '10 3 2\\r\\n4 9 6 9 6 8 4 5 6 9\\r\\n', 'output': ['15\\r\\n2 2 2 3 5 5 5 5 7 8 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n8 9 8 9 8 8 8 8 8 8\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 4 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n11 6 9 9 11 10 7 13 11 9\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 1\\r\\n4 5 5 3 7 5 6 5 6 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 6\\r\\n15 14 14 12 15 10 9 14 13 8\\r\\n', 'output': ['9\\r\\n2 2 2 4 5 6 8 9 9 ']}, {'input': '10 7 1\\r\\n9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n4 5 4 1 3 6 3 2 2 2\\r\\n', 'output': ['4\\r\\n2 5 7 9 ']}, {'input': '10 10 3\\r\\n10 8 11 11 10 11 11 9 7 10\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 3 2\\r\\n7 8 11 6 8 7 2 3 8 7\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 5 6 6 9 9 9 9 ']}, {'input': '10 8 6\\r\\n9 9 8 10 7 13 7 11 13 12\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 3 2\\r\\n9 13 9 10 12 10 14 13 11 11\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 4 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n12 12 14 15 15 12 12 14 12 14\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 4 4 4 4 5 5 6 7 7 7 8 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 4\\r\\n6 4 8 4 8 7 10 6 8 6\\r\\n', 'output': ['8\\r\\n2 2 4 6 6 8 9 9 ']}, {'input': '10 5 4\\r\\n14 14 14 10 13 15 13 13 10 14\\r\\n', 'output': ['14\\r\\n2 2 2 2 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 10 2\\r\\n10 10 13 10 10 12 6 8 11 12\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 6 5 6 6 7 5 7 9 9\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 7 5\\r\\n10 10 10 10 10 10 10 10 10 10\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n11 10 10 10 11 11 11 10 11 11\\r\\n', 'output': ['32\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 5 2\\r\\n4 5 3 6 7 8 4 4 9 6\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 7 3\\r\\n5 9 8 8 8 7 6 7 6 5\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 2 1\\r\\n12 13 15 14 14 11 12 14 11 15\\r\\n', 'output': ['46\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n13 12 15 12 14 14 14 15 13 15\\r\\n', 'output': ['48\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 14 15 14 15 14 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 14 15 14 15 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n4 14 13 15 14 5 8 11 12 14\\r\\n', 'output': ['38\\r\\n2 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}]","id":397} {"difficulty":1600,"lang":"Go","lang_cluster":"Go","src_uid":"b263917e47e1c84340bcb1c77999fd7e","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"os\"\n\t\"bufio\"\n\t\"strconv\"\n\t\"fmt\"\n)\n\nfunc scanInt(scanner *bufio.Scanner) int {\n\tscanner.Scan()\n\tx, _ := strconv.Atoi(scanner.Text())\n\treturn x\n}\n\nfunc diminish(count []int, k int) bool {\n\tfor d := k; d < 10; d += 3 {\n\t\tif count[d] > 0 {\n\t\t\tcount[d] -= 1\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Split(bufio.ScanWords)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\tn := scanInt(scanner)\n\tcount := make([]int, 10)\n\tsum := 0\n\tfor i := 0; i < n; i++ {\n\t\tx := scanInt(scanner)\n\t\tcount[x] += 1\n\t\tsum += x\n\t}\n\tif count[0] == 0 {\n\t\twriter.WriteString(\"-1\\n\")\n\t\treturn\n\t}\n\tif sum%3 == 1 {\n\t\tif !diminish(count, 1) {\n\t\t\tif !diminish(count, 2) || !diminish(count, 2) {\n\t\t\t\twriter.WriteString(\"-1\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} else if sum%3 == 2 {\n\t\tif !diminish(count, 2) {\n\t\t\tif !diminish(count, 1) || !diminish(count, 1) {\n\t\t\t\twriter.WriteString(\"-1\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tfor d := 9; d >= 0; d-- {\n\t\tfor i := 0; i < count[d]; i++ {\n\t\t\twriter.WriteString(fmt.Sprintf(\"%d\", d))\n\t\t}\n\t}\n\twriter.WriteString(\"\\n\")\n}\n","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. ","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.","notes":"NoteIn the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.","sample_inputs":["1\n0","11\n3 4 5 4 5 3 5 3 4 4 0","8\n3 2 5 1 5 2 2 3"],"sample_outputs":["0","5554443330","-1"],"human_solution":"package main\n\nimport (\n\t\"os\"\n\t\"bufio\"\n\t\"strconv\"\n\t\"fmt\"\n)\n\nfunc scanInt(scanner *bufio.Scanner) int {\n\tscanner.Scan()\n\tx, _ := strconv.Atoi(scanner.Text())\n\treturn x\n}\n\nfunc diminish(count []int, k int) bool {\n\tfor d := k; d < 10; d += 3 {\n\t\tif count[d] > 0 {\n\t\t\tcount[d] -= 1\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc main() {\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Split(bufio.ScanWords)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\tn := scanInt(scanner)\n\tcount := make([]int, 10)\n\tsum := 0\n\tfor i := 0; i < n; i++ {\n\t\tx := scanInt(scanner)\n\t\tcount[x] += 1\n\t\tsum += x\n\t}\n\tif count[0] == 0 {\n\t\twriter.WriteString(\"-1\\n\")\n\t\treturn\n\t}\n\tif sum%3 == 1 {\n\t\tif !diminish(count, 1) {\n\t\t\tif !diminish(count, 2) || !diminish(count, 2) {\n\t\t\t\twriter.WriteString(\"0\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} else if sum%3 == 2 {\n\t\tif !diminish(count, 2) {\n\t\t\tif !diminish(count, 1) || !diminish(count, 1) {\n\t\t\t\twriter.WriteString(\"0\\n\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tmax := 0\n\tfor d := 0; d < 10; d++ {\n\t\tif count[d] > 0 {\n\t\t\tmax = d\n\t\t}\n\t}\n\tif max == 0 {\n\t\twriter.WriteString(\"0\\n\")\n\t\treturn\n\t}\n\tfor d := 9; d >= 0; d-- {\n\t\tfor i := 0; i < count[d]; i++ {\n\t\t\twriter.WriteString(fmt.Sprintf(\"%d\", d))\n\t\t}\n\t}\n\twriter.WriteString(\"\\n\")\n}\n","testcases":"[{'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n', 'output': ['5554443330\\r\\n']}, {'input': '8\\r\\n3 2 5 1 5 2 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n5 5 4 1 5 5 5 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n', 'output': ['33322222200\\r\\n']}, {'input': '12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n3 6 1 6 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n', 'output': ['999666330\\r\\n']}, {'input': '5\\r\\n9 6 6 6 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 2 2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n3 3 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '7\\r\\n3 3 2 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '6\\r\\n0 3 3 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 1 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 4 4 4 4\\r\\n', 'output': ['444330\\r\\n']}, {'input': '7\\r\\n0 3 3 2 2 4 4\\r\\n', 'output': ['4433220\\r\\n']}, {'input': '7\\r\\n4 2 3 3 0 0 0\\r\\n', 'output': ['4332000\\r\\n']}, {'input': '4\\r\\n1 1 0 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n3 0 2 2\\r\\n', 'output': ['30\\r\\n']}, {'input': '8\\r\\n3 3 3 5 5 0 0 0\\r\\n', 'output': ['333000\\r\\n']}, {'input': '8\\r\\n3 3 6 3 0 7 7 9\\r\\n', 'output': ['963330\\r\\n']}, {'input': '9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 0\\r\\n', 'output': ['90\\r\\n']}, {'input': '10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n', 'output': ['32222220\\r\\n']}, {'input': '10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n', 'output': ['31111110\\r\\n']}, {'input': '10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n', 'output': ['44444430\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 4 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 4 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '3\\r\\n2 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['3210\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n8 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 8 5 6\\r\\n', 'output': ['600\\r\\n']}, {'input': '4\\r\\n5 8 3 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n1 4 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n2 2 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n3 2 5 0 0\\r\\n', 'output': ['300\\r\\n']}, {'input': '4\\r\\n5 3 2 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '5\\r\\n0 0 0 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 3 5 8\\r\\n', 'output': ['30\\r\\n']}]","id":398} {"difficulty":1900,"lang":"Go","lang_cluster":"Go","src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n)\n\ntype Node struct {\n\tmax int\n\tmin int\n}\n\nvar n int\nvar h [100000]int\n\nfunc create(tree []*Node, l int, r int, index int) {\n\tif l == r {\n\t\ttree[index] = &Node{h[l], h[r]}\n\t\treturn\n\t}\n\tmid := (l + r) \/ 2\n\tcreate(tree, l, mid, index*2+1)\n\tcreate(tree, mid+1, r, index*2+2)\n\tmax, min := tree[index*2+1].max, tree[index*2+1].min\n\tif max < tree[index*2+2].max {\n\t\tmax = tree[index*2+2].max\n\t}\n\tif min > tree[index*2+2].min {\n\t\tmin = tree[index*2+2].min\n\t}\n\ttree[index] = &Node{max, min}\n}\n\nfunc query(tree []*Node, l int, r int, index int, lIndex int, rIndex int) (int, int) {\n\tif l == lIndex && r == rIndex {\n\t\treturn tree[index].max, tree[index].min\n\t}\n\tmid := (l + r) \/ 2\n\tif rIndex <= mid {\n\t\treturn query(tree, l, mid, index*2+1, lIndex, rIndex)\n\t}\n\tif lIndex >= mid+1 {\n\t\treturn query(tree, mid+1, r, index*2+2, lIndex, rIndex)\n\t}\n\tmax, min := query(tree, l, mid, index*2+1, lIndex, mid)\n\tmax1, min1 := query(tree, mid+1, r, index*2+2, mid+1, rIndex)\n\tif max < max1 {\n\t\tmax = max1\n\t}\n\tif min > min1 {\n\t\tmin = min1\n\t}\n\treturn max, min\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\tvar n, k int\n\n\tfmt.Fscanf(reader, \"%d %d\\n\", &n, &k)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscanf(reader, \"%d \", &h[i])\n\t}\n\ttree := make([]*Node, 1000000)\n\tcreate(tree, 0, n-1, 0)\n\n\tlp, rp := 0, 0\n\tbest := 0\n\tvar solu []*Node\n\tfor rp != n {\n\t\tmax, min := query(tree, 0, n-1, 0, lp, rp)\n\t\tif max-min > k {\n\t\t\tlp++\n\t\t} else if best == rp-lp+1 {\n\t\t\tsolu = append(solu, &Node{rp, lp})\n\t\t\trp++\n\t\t} else if best < rp-lp+1 {\n\t\t\tbest = rp - lp + 1\n\t\t\tsolu = make([]*Node, 0, 100000)\n\t\t\tsolu = append(solu, &Node{rp, lp})\n\t\t\trp++\n\t\t} else {\n\t\t\trp++\n\t\t}\n\t}\n\n\twriter := bytes.NewBuffer(make([]byte, 0, 12000000))\n\tfmt.Fprintf(writer, \"%d %d\\n\", best, len(solu))\n\tfor i := 0; i < len(solu); i++ {\n\t\tfmt.Fprintf(writer, \"%d %d\\n\", solu[i].min+1, solu[i].max+1)\n\t}\n\twriter.WriteTo(os.Stdout)\n\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\n\tn, k := readTwoNums(reader)\n\n\tH := readNNums(reader, n)\n\n\ta, b := solve(n, k, H)\n\tvar buf bytes.Buffer\n\n\tbuf.WriteString(fmt.Sprintf(\"%d %d\\n\", a, len(b)))\n\n\tfor i := 0; i < len(b); i++ {\n\t\tbuf.WriteString(fmt.Sprintf(\"%d %d\\n\", b[i][0], b[i][1]))\n\t}\n\n\tfmt.Print(buf.String())\n}\n\nfunc readInt(bytes []byte, from int, val *int) int {\n\ti := from\n\tsign := 1\n\tif bytes[i] == '-' {\n\t\tsign = -1\n\t\ti++\n\t}\n\ttmp := 0\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + int(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp * sign\n\treturn i\n}\n\nfunc readNum(reader *bufio.Reader) (a int) {\n\tbs, _ := reader.ReadBytes('\\n')\n\treadInt(bs, 0, &a)\n\treturn\n}\n\nfunc readTwoNums(reader *bufio.Reader) (a int, b int) {\n\tres := readNNums(reader, 2)\n\ta, b = res[0], res[1]\n\treturn\n}\n\nfunc readThreeNums(reader *bufio.Reader) (a int, b int, c int) {\n\tres := readNNums(reader, 3)\n\ta, b, c = res[0], res[1], res[2]\n\treturn\n}\n\nfunc readNNums(reader *bufio.Reader, n int) []int {\n\tres := make([]int, n)\n\tx := 0\n\tbs, _ := reader.ReadBytes('\\n')\n\tfor i := 0; i < n; i++ {\n\t\tfor x < len(bs) && (bs[x] < '0' || bs[x] > '9') {\n\t\t\tx++\n\t\t}\n\t\tx = readInt(bs, x, &res[i])\n\t}\n\treturn res\n}\n\nfunc readUint64(bytes []byte, from int, val *uint64) int {\n\ti := from\n\n\tvar tmp uint64\n\tfor i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {\n\t\ttmp = tmp*10 + uint64(bytes[i]-'0')\n\t\ti++\n\t}\n\t*val = tmp\n\n\treturn i\n}\n\nconst N_INF = -(10000000)\n\nfunc solve(n, k int, H []int) (a int, b [][]int) {\n\tget := func(l, r int, arr []int) int {\n\t\tres := N_INF\n\n\t\tl += n\n\t\tr += n\n\n\t\tfor l < r {\n\t\t\tif l&1 == 1 {\n\t\t\t\tres = max(res, arr[l])\n\t\t\t\tl++\n\t\t\t}\n\t\t\tif r&1 == 1 {\n\t\t\t\tr--\n\t\t\t\tres = max(res, arr[r])\n\t\t\t}\n\t\t\tl >>= 1\n\t\t\tr >>= 1\n\t\t}\n\t\treturn res\n\t}\n\n\tx := make([]int, 2*n)\n\ty := make([]int, 2*n)\n\n\tfor i := n; i < 2*n; i++ {\n\t\tx[i] = H[i-n]\n\t\ty[i] = -H[i-n]\n\t}\n\n\tfor i := n - 1; i > 0; i-- {\n\t\tx[i] = max(x[2*i], x[2*i+1])\n\t\ty[i] = max(y[2*i], y[2*i+1])\n\t}\n\n\tgetDiff := func(i, j int) int {\n\t\txx := get(i, j, x)\n\t\tyy := -get(i, j, y)\n\t\treturn xx - yy\n\t}\n\n\tcheck := func(l int) bool {\n\t\tfor i := 0; i+l <= n; i++ {\n\t\t\td := getDiff(i, i+l)\n\t\t\tif d <= k {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\n\tvar left, right = 0, n + 1\n\n\tfor left < right {\n\t\tmid := (left + right) \/ 2\n\t\tif !check(mid) {\n\t\t\tright = mid\n\t\t} else {\n\t\t\tleft = mid + 1\n\t\t}\n\t}\n\ta = right - 1\n\n\tfor i := 0; i+a <= n; i++ {\n\t\td := getDiff(i, i+a)\n\t\tif d <= k {\n\t\t\tb = append(b, []int{i + 1, i + a})\n\t\t}\n\t}\n\treturn\n}\n\nfunc max(a, b int) int {\n\tif a >= b {\n\t\treturn a\n\t}\n\treturn b\n}\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":399} {"difficulty":2600,"lang":"Go","lang_cluster":"Go","src_uid":"c23d3ec2b9fb4b4d169bc8053bfd000e","execute_outcome":"COMPILATION_ERROR","source_code":"package main\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n)\n\nvar macro2Op map[string]string\n\nfunc check(num0, num1, op string) error {\n\top0, ok0 := macro2Op[num0]\n\top1, ok1 := macro2Op[num1]\n\n\tif ok0 {\n\t\tif op0 == \"fail\" {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t\tif (op == \"*\" || op == \"\/\") && (op0 == \"+\" || op0 == \"-\") {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t}\n\n\tif ok1 {\n\t\tif op1 == \"fail\" {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t\tif (op == \"-\" && (op1 == \"-\" || op1 == \"+\")) || (op == \"\/\" && (op1 == \"\/\" || op1 == \"*\")) ||\n\t\t\t((op == \"*\" || op == \"\/\") && (op1 == \"+\" || op1 == \"-\")) {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc getRank(tokens []string) string {\n\n\tif len(tokens) == 1 {\n\t\trank, ok := macro2Op[tokens[0]]\n\t\tif ok {\n\t\t\treturn rank\n\t\t} else {\n\t\t\treturn \"()\"\n\t\t}\n\t}\n\n\top := make([]string, 10000, 10000)\n\tnum := make([]string, 10000, 10000)\n\topPointer, numPointer := 0, 0\n\tret := \"\"\n\n\tfor i := 0; i < len(tokens); i++ {\n\t\tif tokens[i] == \"(\" {\n\t\t\top[opPointer] = \"(\"\n\t\t\topPointer++\n\t\t} else if tokens[i] == \"+\" || tokens[i] == \"-\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" || op[opPointer-1] == \"+\" || op[opPointer-1] == \"-\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tret = op[opPointer-1]\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\top[opPointer] = tokens[i]\n\t\t\topPointer++\n\t\t} else if tokens[i] == \"*\" || tokens[i] == \"\/\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tret = op[opPointer-1]\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\top[opPointer] = tokens[i]\n\t\t\topPointer++\n\t\t} else if tokens[i] == \")\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" || op[opPointer-1] == \"+\" || op[opPointer-1] == \"-\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else if op[opPointer-1] == \"(\" {\n\t\t\t\t\topPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\trank, ok := macro2Op[numPointer[numPointer-1]]\n\t\t\tif ok && rank == \"fail\" {\n\t\t\t\treturn rank\n\t\t\t}\n\t\t\tret = \"()\"\n\t\t} else {\n\t\t\tnum[numPointer] = tokens[i]\n\t\t\tnumPointer++\n\t\t}\n\t}\n\tfor opPointer != 0 {\n\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\tif err != nil {\n\t\t\treturn \"fail\"\n\t\t}\n\t\tret = op[opPointer-1]\n\t\tnumPointer--\n\t\tnum[numPointer-1] = \"1\"\n\t\topPointer--\n\t}\n\n\treturn ret\n}\n\nfunc tokenize(s string) []string {\n\ttokens := make([]string, 0, 200)\n\tb := []byte(s)\n\ttoken := make([]byte, 0, 100)\n\tfor i := 0; i < len(b); i++ {\n\t\tif b[i] == '(' || b[i] == ')' ||\n\t\t\tb[i] == '+' || b[i] == '-' || b[i] == '*' || b[i] == '\/' ||\n\t\t\tb[i] == '\\r' || b[i] == '\\n' || b[i] == ' ' {\n\t\t\tif len(token) != 0 {\n\t\t\t\ttokens = append(tokens, string(token))\n\t\t\t\ttoken = make([]byte, 0, 100)\n\t\t\t}\n\t\t\tif b[i] != ' ' && b[i] != '\\r' && b[i] != '\\n' {\n\t\t\t\ttokens = append(tokens, string([]byte{b[i]}))\n\t\t\t}\n\t\t} else {\n\t\t\ttoken = append(token, b[i])\n\t\t}\n\t}\n\treturn tokens\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar n int\n\tfmt.Fscanf(reader, \"%d\\n\", &n)\n\tmacro2Op = map[string]string{}\n\n\tfor i := 0; i < n; i++ {\n\t\tvar macro string\n\t\tfmt.Fscanf(reader, \"#define %s \", ¯o)\n\t\ts, _ := reader.ReadString('\\n')\n\t\ttokens := tokenize(s)\n\t\tmacro2Op[macro] = getRank(tokens)\n\t}\n\n\ttestexpr, _ := ioutil.ReadAll(reader)\n\texpr := string(testexpr) + \"\\n\"\n\tts := tokenize(expr)\n\trank := getRank(ts)\n\tif rank == \"fail\" {\n\t\tfmt.Printf(\"Suspicious\")\n\t} else {\n\t\tfmt.Printf(\"OK\")\n\t}\n}\n","description":"Most C\/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:#define macro_name macro_valueAfter the macro has been declared, \"macro_name\" is replaced with \"macro_value\" each time it is met in the program (only the whole tokens can be replaced; i.e. \"macro_name\" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A \"macro_value\" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.One of the main problems arising while using macros \u2014 the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.Let's consider the following example. Say, we declared such a #define construction:#define sum x + yand further in the program the expression \"2 * sum\" is calculated. After macro substitution is performed we get \"2 * x + y\", instead of intuitively expected \"2 * (x + y)\".Let's call the situation \"suspicious\", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a \"safe\" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise \u2014 suspicious.Note that we consider the \"\/\" operation as the usual mathematical division, not the integer division like in C\/C++. That's why, for example, in the expression \"a*(b\/c)\" we can omit brackets to get the expression \"a*b\/c\".","input_specification":"The first line contains the only number n (0\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the amount of #define constructions in the given program. Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax: #define name expression where name \u2014 the macro name, expression \u2014 the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*\/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109. All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction. Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions. The input lines may contain any number of spaces anywhere, providing these spaces do not break the word \"define\" or the names of constructions and variables. In particular, there can be any number of spaces before and after the \"#\" symbol. The length of any line from the input file does not exceed 100 characters.","output_specification":"Output \"OK\", if the expression is correct according to the above given criterion, otherwise output \"Suspicious\".","notes":null,"sample_inputs":["1\n#define sum x + y\n1 * sum","1\n#define sum (x + y)\nsum - sum","4\n#define sum x + y\n#define mul a * b\n#define div a \/ b\n#define expr sum + mul * div * mul\nexpr","3\n#define SumSafe (a+b)\n#define DivUnsafe a\/b\n#define DenominatorUnsafe a*b\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)"],"sample_outputs":["Suspicious","OK","OK","Suspicious"],"human_solution":"package main\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\/ioutil\"\n\t\"os\"\n\t\"strings\"\n)\n\nvar macro2Op map[string]string\n\nfunc check(num0, num1, op string) error {\n\top0, ok0 := macro2Op[num0]\n\top1, ok1 := macro2Op[num1]\n\n\tif ok0 {\n\t\tif op0 == \"fail\" {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t\tif (op == \"*\" || op == \"\/\") && (op0 == \"+\" || op0 == \"-\") {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t}\n\n\tif ok1 {\n\t\tif op1 == \"fail\" {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t\tif (op == \"-\" && (op1 == \"-\" || op1 == \"+\")) || (op == \"\/\" && (op1 == \"\/\" || op1 == \"*\")) ||\n\t\t\t((op == \"*\" || op == \"\/\") && (op1 == \"+\" || op1 == \"-\")) {\n\t\t\treturn errors.New(\"fail\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc getOp(tokens []string) string {\n\n\tif len(tokens) == 1 {\n\t\trank, ok := macro2Op[tokens[0]]\n\t\tif ok {\n\t\t\treturn rank\n\t\t} else {\n\t\t\treturn \"()\"\n\t\t}\n\t}\n\n\top := make([]string, 10000, 10000)\n\tnum := make([]string, 10000, 10000)\n\topPointer, numPointer := 0, 0\n\tret := \"\"\n\n\tfor i := 0; i < len(tokens); i++ {\n\t\tif tokens[i] == \"(\" {\n\t\t\top[opPointer] = \"(\"\n\t\t\topPointer++\n\t\t} else if tokens[i] == \"+\" || tokens[i] == \"-\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" || op[opPointer-1] == \"+\" || op[opPointer-1] == \"-\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tret = op[opPointer-1]\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\top[opPointer] = tokens[i]\n\t\t\topPointer++\n\t\t} else if tokens[i] == \"*\" || tokens[i] == \"\/\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tret = op[opPointer-1]\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\top[opPointer] = tokens[i]\n\t\t\topPointer++\n\t\t} else if tokens[i] == \")\" {\n\t\t\tfor opPointer != 0 {\n\t\t\t\tif op[opPointer-1] == \"*\" || op[opPointer-1] == \"\/\" || op[opPointer-1] == \"+\" || op[opPointer-1] == \"-\" {\n\t\t\t\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"fail\"\n\t\t\t\t\t}\n\t\t\t\t\tnumPointer--\n\t\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t\t\topPointer--\n\t\t\t\t} else if op[opPointer-1] == \"(\" {\n\t\t\t\t\topPointer--\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\trank, ok := macro2Op[num[numPointer-1]]\n\t\t\tif ok && rank == \"fail\" {\n\t\t\t\treturn rank\n\t\t\t} else {\n\t\t\t\tnum[numPointer-1] = \"1\"\n\t\t\t}\n\t\t\tret = \"()\"\n\t\t} else {\n\t\t\tnum[numPointer] = tokens[i]\n\t\t\tnumPointer++\n\t\t}\n\t}\n\tfor opPointer != 0 {\n\t\terr := check(num[numPointer-2], num[numPointer-1], op[opPointer-1])\n\t\tif err != nil {\n\t\t\treturn \"fail\"\n\t\t}\n\t\tret = op[opPointer-1]\n\t\tnumPointer--\n\t\tnum[numPointer-1] = \"1\"\n\t\topPointer--\n\t}\n\n\treturn ret\n}\n\nfunc tokenize(s string) []string {\n\ttokens := make([]string, 0, 200)\n\tb := []byte(s)\n\ttoken := make([]byte, 0, 100)\n\tfor i := 0; i < len(b); i++ {\n\t\tif b[i] == '(' || b[i] == ')' ||\n\t\t\tb[i] == '+' || b[i] == '-' || b[i] == '*' || b[i] == '\/' ||\n\t\t\tb[i] == '\\r' || b[i] == '\\n' || b[i] == ' ' {\n\t\t\tif len(token) != 0 {\n\t\t\t\ttokens = append(tokens, string(token))\n\t\t\t\ttoken = make([]byte, 0, 100)\n\t\t\t}\n\t\t\tif b[i] != ' ' && b[i] != '\\r' && b[i] != '\\n' {\n\t\t\t\ttokens = append(tokens, string([]byte{b[i]}))\n\t\t\t}\n\t\t} else {\n\t\t\ttoken = append(token, b[i])\n\t\t}\n\t}\n\treturn tokens\n}\n\nfunc main() {\n\tbs, _ := ioutil.ReadAll(os.Stdin)\n\treader := bytes.NewBuffer(bs)\n\n\tvar n int\n\tfmt.Fscanf(reader, \"%d\\n\", &n)\n\tmacro2Op = map[string]string{}\n\n\tfor i := 0; i < n; i++ {\n\t\tvar macro string\n\t\ts, _ := reader.ReadString('\\n')\n\n\t\ts = strings.TrimLeft(s, \" #\")\n\t\ts = strings.TrimPrefix(s, \"define\")\n\t\ts = strings.TrimLeft(s, \" \")\n\t\tfmt.Sscanf(s, \"%s\", ¯o)\n\t\ts = strings.TrimPrefix(s, macro)\n\t\ttokens := tokenize(s)\n\t\tmacro2Op[macro] = getOp(tokens)\n\t}\n\n\ttestexpr, _ := ioutil.ReadAll(reader)\n\texpr := string(testexpr) + \"\\n\"\n\tts := tokenize(expr)\n\trank := getOp(ts)\n\tif rank == \"fail\" {\n\t\tfmt.Printf(\"Suspicious\")\n\t} else {\n\t\tfmt.Printf(\"OK\")\n\t}\n}\n","testcases":"[{'input': '1\\r\\n#define sum x + y\\r\\n1 * sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum (x + y)\\r\\nsum - sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum x + y\\r\\n#define mul a * b\\r\\n#define div a \/ b\\r\\n#define expr sum + mul * div * mul\\r\\nexpr\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define SumSafe (a+b)\\r\\n#define DivUnsafe a\/b\\r\\n#define DenominatorUnsafe a*b\\r\\n((SumSafe) + DivUnsafe\/DivUnsafe + x\/DenominatorUnsafe)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '0\\r\\naa + b - c * (ddd * eee \/ fff * a \/ b * c + d - b + c - (a + b)) - d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define a b\\r\\n#define c d\\r\\na + b + c + d + 1234567 -10*(2-2+1000*1000*1000*1000*1000)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define macros ( x + y ) \\r\\n # define Macros (x+y)\\r\\nmacros\/Macros\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define A v\\r\\n#define a v\/v\/v\\r\\nv\/(a)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define a x*y\\r\\nc\/a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define a b*c\\r\\na\/a*a\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define mul x*y\\r\\n#define bad x\/mul\\r\\n#define good x\/(mul)\\r\\ngood\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define mult a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum+difference+(sum)*(difference)-mult+mult*division+division*mult+division\/(mult+sum-(difference))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference\/division)+sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(difference)*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n(sum)\/multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nsum\/(multiplication)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n#define res (0-difference)\\r\\nsum+res*multiplication\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define sum xx+yy\\r\\n#define difference aaaa-bbbBBBB\\r\\n#define multiplication a*b\\r\\n#define division aaaaaaaaaaaaaaaaaaaaa\/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\ndivision\/(multiplication\/(division)\/DIVISION\/(sum-division-multiplication-(difference)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define sum x + y\\r\\n#define SomeBad (2 * sum)\\r\\n#define SomePossiblyGood 0 * SomeBad + (x + x - 2*x) * SomeBad\\r\\nSomePossiblyGood\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define a 0\\r\\n#define b (a-a)*(x\/x-1)\\r\\nb-b\/b*b\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '2\\r\\n#define fkdsjfslkjfsdk x\/0\\r\\n#define fkdsjfslkjfsdksdds 0\/(0-0)\\r\\nfkdsjfslkjfsdk + fkdsjfslkjfsdks + fkdsjfslkjfsdkssds\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define null x\/0\\r\\n#define some x\/x\\r\\n#define bad 1\/x\\r\\nbad\/0+0\/bad+0\/0*bad\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define MWjGY x+x*53 *x\\r\\n#define ovqZ 2\/926+x\/A\\r\\n#define uU 55-qRj*A*2\\r\\nx*A\/x-A\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define zz 5+7\/x*x*9\\r\\n#define mlTL 6+x\/7+x\/x\\r\\n#define DUO 7*7-x+zz\\r\\n#define IH 6*4-x+x\\r\\n67\/(5)-IH\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Oc 9\/51+65+vN\\r\\n#define gga 53\/ 94\/x\/x\\r\\n#define ArB x\/x\/9-77-8\\r\\n#define j 76-6\/93+vN\\r\\n#define cALNN Oc+60499\\r\\n8*6-66\/x*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define fSdvwOj (W)*W+73\\r\\n#define NAZjc 7695*55-x\\r\\n#define AHGGglVwch (6-a-W)\\r\\n((5))+W+W\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define m bJJD +x \\r\\n#define yYkQNzjR (x*19)-892\\r\\n#define MNvfxqfbq (x-6*x\/8)\\r\\n#define nJZdvO 8\/4 *m\/m\\r\\n 9+m\/x+x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define Sl x*7-(x)\/O\\r\\n#define srAOHccTln 3+x*2*O\\r\\n#define OFAZk 239751817\\r\\n#define JYWrOEgazV (x-O\/4)-x\\r\\n#define XsOZvalgOh 89905879\/7\\r\\nx\/Sl-(Sl)\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '3\\r\\n#define uYdw ((9-x-3) )\\r\\n#define fy (((x+21)))\\r\\n#define nY ((2+x)-46)\\r\\n141141432\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define GCvqH (58 )-(x)\\r\\n#define g ((x\/x+x))\\r\\n#define spst hQTJ\\r\\n#define i GCvqH\\r\\n(((x+6)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define rg (67)+((x))\\r\\n#define ya x-(6\/x)*rg\\r\\n#define anTxe 10*ya*(x)\\r\\n#define xcmo ((x)*(vT))\\r\\n#define eg ((vT)) -ya\\r\\n((x*(Ii)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define T ((b\/1 +1))\\r\\n#define pm (s)-43-(s)\\r\\n#define jkNBpvDZl ((x ))\/65\\r\\n(((58*7)))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define cJitUt 21\/(4)+4+4\\r\\n#define zHwBOLIvF 4*((41\/x))\\r\\n#define GbtYVo (E)+(x+3)\\r\\n#define zTcZBaby (58)+x-x+x\\r\\n(E+E)\/8 *4\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define mBURKdeKvy 266693986\\r\\n#define nWi ( ((x))-4)\\r\\n#define iYreeOt ((7\/x+42))\\r\\n#define laLzP ((aB\/35)) \\r\\n#define dXjRJ (((B*hX)))\\r\\n(1*2+(67))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define UVMQLGvEqOxaAgRkvJH tBd\\r\\n#define QoAsBMaUcJzXai x\/x-hm\/83+8*8\/5\/hm \/x\/hm\\r\\n#define QtxtzEHCmidm 75 +491928441\\r\\n((x)\/VUpYoEdDUtLFanGyqfQR )\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define efemx 2\/1*3*69+81+10\/690445104\\r\\n#define AyjrEzAjMKZpRPfCOaO 21*9+( j*40+3*4)*ND+w-j*j+x*55\\r\\n#define YkJkHcNhXcci 85*3215\/40\/365819568\\r\\n#define MUzvOZSXJujI 9-4\/j*j-7-w*23*5+j+9-9*ND*2\/37\\r\\nND\/j*28 -1* ND+22889023\/j\/j\/j\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define QNUkjqPcGWF 6*4\/908975666-7\/10-x*7\\r\\n#define xqwhNWiiMaZOcmgiXYY 3936*(e*5*H+2)-TsA+(e)\/1-25\\r\\n#define tRsSqfqJt ((uT*82\/e)+e\/(23+(45)-9)+(50))\\r\\n#define DtIOWRkYe (8*3\/9)*e*x *60041512*2-(e)\\r\\n#define qgPgxja (4\/x+e\/uT*16358009- 6\/13*5)\\r\\ne+x*e\/84\/x+uT*H\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define lTCUUO JQmj\\r\\n#define oUeQMB (12*x+x+x)-75-(79\/1)-(7)*1\/mr\\r\\n#define LAQu xwvBtky\\r\\n8654 *1*5-mr-3*J\/oUeQMB\/x\/6\/9\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define VLuQIO 1-x\/33+ Fk+wS\/35-wS-(x*iz )\\r\\n#define BCIsIR 5*(wS)\/x\/iz\/1+x-x-4-x\/68\/x\/8*x\\r\\n#define QPUpmTiB 21-x\/895912506+2\\r\\n#define wcZLUIqJS 7\/65-x*61-(24+iz)+x+315670+x\/x\\r\\nBCIsIR\/VLuQIO\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define FDmMYOENCOKmYwYlOl 6-(L)\/((((ud\/x))\/ud-26*8-5))\\r\\n#define QkopKBjKdJxhc (6)*4\/7-L\/781844832 \\r\\n#define UjgTieUBXTSTbiLFAhkV 3*1*(52)\/6-6*65\/x+((L-56))+x+x\\r\\n#define yWVYDuqliezpKLwnI 8\/4+1+88+97946+(1)-((68))-L\/L\\r\\n#define AvvED 719901121+95\/2\/78\/1-10+37\\r\\n(1*x+ 528176190+17\/ud)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define e x *R\/5+(x)+4\/18\/x*R\/x-8+1+R\\r\\n#define GgGqGYjXoJjIezAVu (( 491563947*R))*9-e-3\/4\\r\\n#define XgznGUWMxQwh (8\/R+4*(e)+10\/4*x+24*R+21)-224\\r\\n (82493582)\\r\\n', 'output': ['OK\\r\\n']}, {'input': '4\\r\\n#define MrKSTrKhPLeJqOcEPvv (x+x\/x)\/Qdf-x-x-(2\/23)+9442-x\\r\\n#define zPHUgmIYE 10- 7*x\/x+VwRUuIRezDR*80\\r\\n#define OsfThxasHeFZCEZTfD 271456028-(x*x)-8+2*x*x*x+(x)\\r\\n#define zVYasB x\/x -x-(51)-x*x*((x)) \/x \\r\\n(x\/64-x*( (5+x+x)-(37)\/3*22))\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WREol (fcdGZaLzhiFpVQmhHO)\\r\\n#define lDTNxcMqPPP 3+(57)\/x\/91540-x*71-x*6-((1))\\r\\n#define afFJVBkr ((12*x-8+9 *lDlx+7+lDlx))\\r\\n#define mYEizEWrNtRSQNCcDQrn 732480960+9+x-78-x\/1+12*x\\r\\n#define IZTmjheAahbNSNFa ((x-x*7+407643063 ))\\r\\nXQvMxLNpQnhpimNhAkfX\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define Mc x+x*55231- x\/x\/x+35\/x*(5*(x)) -5*x*(1-2-(29\/1))\\r\\n#define afSVLCdjvylSu bgqv\/6+4*x*((Mc\/1318\/x-8-4)-Mc\/Mc\/(9))\\r\\n#define ZOSV (1+2\/x+6* 174806683)-x\/x*Mc+52*x-x\\r\\nbgqv-x-6*x\/72\/(x )\/afSVLCdjvylSu\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RJIiiGQqn dmpWFcrqQeM+V-o* 55\/9*o-o\/V*V*o\\r\\n#define ElDZlrtzDkeKgsX 498718105* 3\/(y)\/(4)-(5*x)*1\\r\\n#define qwKl jHqPHX\\r\\n#define qXzAZkCuchBYR (qy*qwKl-6+5*1+2)-7-3+(38)-o*4\/4-1-V*x\/6+1*x\/o\\r\\no*((V))-o+2+((((2*V)\/V-o*V\/4)))\/o*33+y\/7 -x+x \\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define WTovyGexUNjGMRJv (MQG*18-6)\/x\/x*x\/x-x*akNyw*x+x-x\/2\/x*20\\r\\n#define hpextyhVCa 70*x\/67-x*87931-(497612505-7*x-MQG)-x\\r\\n#define MRkKnCXFt x-5-21962-x\/sOmThNSS\/x\/6-4+(65+57+x+x+7-7+x\/x)\\r\\n#define ajsczBLLklBSqqh nGj-38*9 *x\/47\/8*5\/5-72\/x*x-x*x*31 \/7-44-3+64\\r\\n#define jgqfv WTovyGexUNjGMRJv\\r\\n 4+338\/x*x+13 -795*3-74*2\/4+563-x\/76401438\/83025\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define G u+13-35348\/2-(u\/u)-u\/u*u*(OC)-OC -u-u\/u*u\/9 \\r\\n#define RNRQ G*G*u+G\/755750\/G\/G +((u-6*G+6)*2)- 5*96+5\/u*275-u\\r\\n#define Zg 94363\/u*u-41+Gm*G-81\/5-1-G*G*x-(5517*5\/4)*21 +75\\r\\n406690013\/WM*G+(u+u)*Zg+2\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define RMWAZhIp x*x+12+94*12*5*1-x-141915293\\r\\n#define EeguG 9-55+x\/29+x+x\/E*8*81\/x-x*75-4*17-81\/x\/6+619978*x*x\\r\\n#define HvUYEvQTyYmBGvqHSb 454574730\/644135926*x\/23+E-sy\/14\\r\\n#define BqMGcT x\/(43)+819897061-x*(7\/x)-(x)+sy-E-x*79-E+(x)\/6\/63\\r\\n76+3\/x\/8*x+E-76+sy-sy+9*6\/66\/sy-77+x-x*sy+E\/50\/64\\r\\n', 'output': ['OK\\r\\n']}, {'input': '5\\r\\n#define cbt ((((d))+9-3+ (d)\/d\/6*SDDNqj*50\/d+d-m+8\/d\/1)) \\r\\n#define gLrUE 18+ 70*d\/3-d*d-d\/35 +33-5\/9+d-d*387+d-1\\r\\n#define AvjmK 9-d-8+(d+m+5\/2\/x*d+1)\/x\/d-5-2*(m)+d+17\/d+ 4\/52\/8\\r\\n#define SjrJ 90\/7\/5\/d+ 254877982+(m) *x-19\\r\\n#define PlykoqfDbwxR 540304590 +d*x\/11-(m+d-d-4)*(d-3-1)\/d\\r\\nd-2+1+46-29620+9-(9*3 \/d)*6*m\/d+9+(1670)\/cbt\/d+d\\r\\n', 'output': ['OK\\r\\n']}, {'input': '3\\r\\n#define BuAiJLgAlkj x-3+419032556\/409023036-(17*84)+x+8+A\\r\\n#define wU 516506880\\r\\n#define HeyDGlnaGxBaHjzelvF iRSPqHfgHw\/4-(99)*(I)+A+I-9*46*x\\r\\nI\/CRklg-HeyDGlnaGxBaHjzelvF\/3+5 \\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '4\\r\\n#define SOlTohcPGckDyF ((D)\/G-83+KHGSuJFLHqD\/5)\\r\\n#define KEUXeOYpg 9+x-8-8\/x\/9-65-6+4+55*x-58\/x+84+D*2-7+D\/x-x*G\/4-2\\r\\n#define YZl (1\/67*x*6\/2*G)-D\/1595107*D+6\/x*1+D+3\/9\/x\/26-6+9 \\r\\n#define gCatFsZn uBBqilYclMhpVfKKTkGK\\r\\n(28682537+ YZl*(4*52) )*x\/8- gCatFsZn*x\/54\/7\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '5\\r\\n#define iiXEqDYeyVmIYsOaO fj\/x-9-6\/x*x+ 1\/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x\/70\\r\\n#define XVgLzhoTUxoBr ( x+x\/x\/x*6-x)* x+K\/24206-2 \/5\/8-x-7\/Ww\/K-x+6 \\r\\n#define QdfRBaJk 470551685-( 54-x)-30\\r\\n#define gEJcAGnF x+x-x+(x\/x+9)\/x-41-1\/fj\/1157561+x\/x -x\/26\/x+K*x\\r\\n#define lO 7-1*(x*58 )-K*fj \/722113691\/x\/K+2\\r\\n2+4*85\/86\/x*27 \/49252-x*x\/6-83-7\/x+x+K-lO+8-K-x\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr-sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr*sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr+sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr-sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr*sum\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nr\/sum\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x+y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum*r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x-y\\r\\nsum\/r\\r\\n', 'output': ['Suspicious\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x*y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum+r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum-r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum*r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define sum x\/y\\r\\nsum\/r\\r\\n', 'output': ['OK\\r\\n']}, {'input': '1\\r\\n#define x 3\/2\\r\\n2*x\\r\\n', 'output': ['OK\\r\\n']}, {'input': '2\\r\\n # define sum 1000000000 + 1000000000 + 1000000000 \\r\\n # define a b + 45 * sum \\r\\n a \\r\\n', 'output': ['Suspicious\\r\\n']}]","id":400} {"difficulty":2100,"lang":"Go","lang_cluster":"Go","src_uid":"d9eb0f6f82bd09ea53a1dbbd7242c497","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n)\n\ntype point struct {\n\tx, y int\n}\n\nfunc counterclockwiseTurn(a, b, c point) bool {\n\tab := point{b.x - a.x, b.y - a.y}\n\tac := point{c.x - a.x, c.y - a.y}\n\treturn ab.x*ac.y-ab.y*ac.x > 0\n}\n\nfunc convexHull(points []point) []point {\n\tsort.Slice(points, func(i, j int) bool {\n\t\tif points[i].x == points[j].x {\n\t\t\treturn points[i].y < points[j].y\n\t\t}\n\t\treturn points[i].x < points[j].x\n\t})\n\n\tvar lower []point\n\tfor i := len(points) - 1; i >= 0; i-- {\n\t\tfor len(lower) >= 2 && counterclockwiseTurn(lower[len(lower)-2], lower[len(lower)-1], points[i]) {\n\t\t\tlower = lower[:len(lower)-1]\n\t\t}\n\t\tlower = append(lower, points[i])\n\t}\n\n\tvar upper []point\n\tfor i := range points {\n\t\tfor len(upper) >= 2 && counterclockwiseTurn(upper[len(upper)-2], upper[len(upper)-1], points[i]) {\n\t\t\tupper = upper[:len(upper)-1]\n\t\t}\n\t\tupper = append(upper, points[i])\n\t}\n\n\treturn append(lower[:len(lower)-1], upper[:len(upper)-1]...)\n}\n\nvar in = bufio.NewReaderSize(os.Stdin, 2<<16)\n\nfunc readPoints() []point {\n\tvar n int\n\tfmt.Fscan(in, &n)\n\ta := make([]point, n)\n\tfor i := range a {\n\t\tfmt.Fscan(in, &a[i].x, &a[i].y)\n\t}\n\treturn a\n}\n\nfunc solve() bool {\n\ta := readPoints()\n\tb := readPoints()\n\thull := convexHull(append(b, a...))\n\tif len(hull) != len(a) {\n\t\treturn false\n\t}\n\tstart := 0\n\tfor start < len(hull) && hull[start] != a[0] {\n\t\tstart++\n\t}\n\tif start == len(hull) {\n\t\treturn false\n\t}\n\tfor i := range a {\n\t\tif a[i] != hull[(i+start)%len(hull)] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc main() {\n\tif solve() {\n\t\tfmt.Println(\"YES\")\n\t} else {\n\t\tfmt.Println(\"NO\")\n\t}\n}\n","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"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n)\n\ntype point struct {\n\tx, y int64\n}\n\nfunc counterclockwiseTurn(a, b, c point) bool {\n\tab := point{b.x - a.x, b.y - a.y}\n\tac := point{c.x - a.x, c.y - a.y}\n\treturn ab.x*ac.y-ab.y*ac.x > 0\n}\n\nfunc convexHull(points []point) []point {\n\tsort.Slice(points, func(i, j int) bool {\n\t\tif points[i].x == points[j].x {\n\t\t\treturn points[i].y < points[j].y\n\t\t}\n\t\treturn points[i].x < points[j].x\n\t})\n\n\tvar lower []point\n\tfor i := len(points) - 1; i >= 0; i-- {\n\t\tfor len(lower) >= 2 && counterclockwiseTurn(lower[len(lower)-2], lower[len(lower)-1], points[i]) {\n\t\t\tlower = lower[:len(lower)-1]\n\t\t}\n\t\tlower = append(lower, points[i])\n\t}\n\n\tvar upper []point\n\tfor i := range points {\n\t\tfor len(upper) >= 2 && counterclockwiseTurn(upper[len(upper)-2], upper[len(upper)-1], points[i]) {\n\t\t\tupper = upper[:len(upper)-1]\n\t\t}\n\t\tupper = append(upper, points[i])\n\t}\n\n\treturn append(lower[:len(lower)-1], upper[:len(upper)-1]...)\n}\n\nvar in = bufio.NewReaderSize(os.Stdin, 2<<16)\n\nfunc readPoints() []point {\n\tvar n int\n\tfmt.Fscan(in, &n)\n\ta := make([]point, n)\n\tfor i := range a {\n\t\tfmt.Fscan(in, &a[i].x, &a[i].y)\n\t}\n\treturn a\n}\n\nfunc solve() bool {\n\ta := readPoints()\n\tb := readPoints()\n\thull := convexHull(append(b, a...))\n\tif len(hull) != len(a) {\n\t\treturn false\n\t}\n\tstart := 0\n\tfor start < len(hull) && hull[start] != a[0] {\n\t\tstart++\n\t}\n\tif start == len(hull) {\n\t\treturn false\n\t}\n\tfor i := range a {\n\t\tif a[i] != hull[(i+start)%len(hull)] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc main() {\n\tif solve() {\n\t\tfmt.Println(\"YES\")\n\t} else {\n\t\tfmt.Println(\"NO\")\n\t}\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":401} {"difficulty":1800,"lang":"Go","lang_cluster":"Go","src_uid":"e71640f715f353e49745eac5f72e682a","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\nvar (\n\tin = bufio.NewReader(os.Stdin)\n\tout = bufio.NewWriter(os.Stdout)\n)\n\nvar n, m int\nvar vType []Type\nvar edges [][]int\n\nfunc main() {\n\tdefer out.Flush()\n\tfmt.Fscan(in, &n, &m)\n\tvType = make([]Type, n)\n\tedges = make([][]int, n)\n\tfor i := 0; i < m; i++ {\n\t\tvar a, b int\n\t\tfmt.Fscan(in, &a, &b)\n\t\ta--\n\t\tb--\n\t\tedges[a] = append(edges[a], b)\n\t\tedges[b] = append(edges[b], a)\n\t}\n\tif ok, a, b, c := solve(); ok {\n\t\tfmt.Fprintln(out, \"Yes\")\n\t\tfmt.Fprintln(out, strings.Repeat(\"a\", a)+strings.Repeat(\"b\", b)+strings.Repeat(\"c\", c))\n\t} else {\n\t\tfmt.Fprintln(out, \"No\")\n\t}\n}\n\nfunc solve() (ok bool, a, b, c int) {\n\tfor v := range edges {\n\t\tif len(edges[v]) == n-1 {\n\t\t\tvType[v] = B\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == UNSEEN {\n\t\t\tmark(v, A)\n\t\t\tbreak\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == UNSEEN {\n\t\t\tmark(v, C)\n\t\t\tbreak\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tswitch vType[v] {\n\t\tcase UNSEEN:\n\t\t\tok = false\n\t\t\treturn\n\t\tcase A:\n\t\t\ta++\n\t\tcase B:\n\t\t\tb++\n\t\tcase C:\n\t\t\tc++\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == A && len(edges[v]) != a-1+b {\n\t\t\tok = false\n\t\t\treturn\n\t\t}\n\t\tif vType[v] == C && len(edges[v]) != c-1+b {\n\t\t\tok = false\n\t\t\treturn\n\t\t}\n\t}\n\tok = true\n\treturn\n}\n\nfunc mark(v int, t Type) {\n\tif vType[v] != UNSEEN {\n\t\treturn\n\t}\n\tvType[v] = t\n\tfor _, u := range edges[v] {\n\t\tmark(u, t)\n\t}\n}\n\ntype Type int\n\nconst (\n\tUNSEEN Type = iota\n\tA\n\tB\n\tC\n)\n","description":"One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters \"a\", \"b\" and \"c\" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G with the following properties: G has exactly n vertices, numbered from 1 to n. For all pairs of vertices i and j, where i\u2009\u2260\u2009j, there is an edge connecting them if and only if characters si and sj are either equal or neighbouring in the alphabet. That is, letters in pairs \"a\"-\"b\" and \"b\"-\"c\" are neighbouring, while letters \"a\"-\"c\" are not. Vasya painted the resulting graph near the string and then erased the string. Next day Vasya's friend Petya came to a lecture and found some graph at his desk. He had heard of Vasya's adventure and now he wants to find out whether it could be the original graph G, painted by Vasya. In order to verify this, Petya needs to know whether there exists a string s, such that if Vasya used this s he would produce the given graph G.","input_specification":"The first line of the input contains two integers n and m \u00a0\u2014 the number of vertices and edges in the graph found by Petya, respectively. Each of the next m lines contains two integers ui and vi (1\u2009\u2264\u2009ui,\u2009vi\u2009\u2264\u2009n,\u2009ui\u2009\u2260\u2009vi)\u00a0\u2014 the edges of the graph G. It is guaranteed, that there are no multiple edges, that is any pair of vertexes appear in this list no more than once.","output_specification":"In the first line print \"Yes\" (without the quotes), if the string s Petya is interested in really exists and \"No\" (without the quotes) otherwise. If the string s exists, then print it on the second line of the output. The length of s must be exactly n, it must consist of only letters \"a\", \"b\" and \"c\" only, and the graph built using this string must coincide with G. If there are multiple possible answers, you may print any of them.","notes":"NoteIn the first sample you are given a graph made of two vertices with an edge between them. So, these vertices can correspond to both the same and adjacent letters. Any of the following strings \"aa\", \"ab\", \"ba\", \"bb\", \"bc\", \"cb\", \"cc\" meets the graph's conditions. In the second sample the first vertex is connected to all three other vertices, but these three vertices are not connected with each other. That means that they must correspond to distinct letters that are not adjacent, but that is impossible as there are only two such letters: a and c.","sample_inputs":["2 1\n1 2","4 3\n1 2\n1 3\n1 4"],"sample_outputs":["Yes\naa","No"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\nvar (\n\tin = bufio.NewReader(os.Stdin)\n\tout = bufio.NewWriter(os.Stdout)\n)\n\nvar n, m int\nvar vType []Type\nvar edges [][]int\n\nfunc main() {\n\tdefer out.Flush()\n\tfmt.Fscan(in, &n, &m)\n\tvType = make([]Type, n)\n\tedges = make([][]int, n)\n\tfor i := 0; i < m; i++ {\n\t\tvar a, b int\n\t\tfmt.Fscan(in, &a, &b)\n\t\ta--\n\t\tb--\n\t\tedges[a] = append(edges[a], b)\n\t\tedges[b] = append(edges[b], a)\n\t}\n\tif solve() {\n\t\tfmt.Fprintln(out, \"Yes\")\n\t\tfor v := range vType {\n\t\t\tfmt.Fprint(out, string('a'+vType[v]-1))\n\t\t}\n\t\tfmt.Fprintln(out)\n\t} else {\n\t\tfmt.Fprintln(out, \"No\")\n\t}\n}\n\nfunc solve() bool {\n\tfor v := range edges {\n\t\tif len(edges[v]) == n-1 {\n\t\t\tvType[v] = B\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == UNSEEN {\n\t\t\tmark(v, A)\n\t\t\tbreak\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == UNSEEN {\n\t\t\tmark(v, C)\n\t\t\tbreak\n\t\t}\n\t}\n\tvar a, b, c int\n\tfor v := range vType {\n\t\tswitch vType[v] {\n\t\tcase UNSEEN:\n\t\t\treturn false\n\t\tcase A:\n\t\t\ta++\n\t\tcase B:\n\t\t\tb++\n\t\tcase C:\n\t\t\tc++\n\t\t}\n\t}\n\tfor v := range vType {\n\t\tif vType[v] == A && len(edges[v]) != a-1+b {\n\t\t\treturn false\n\t\t}\n\t\tif vType[v] == C && len(edges[v]) != c-1+b {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc mark(v int, t Type) {\n\tif vType[v] != UNSEEN {\n\t\treturn\n\t}\n\tvType[v] = t\n\tfor _, u := range edges[v] {\n\t\tmark(u, t)\n\t}\n}\n\ntype Type int\n\nconst (\n\tUNSEEN Type = iota\n\tA\n\tB\n\tC\n)\n","testcases":"[{'input': '2 1\\r\\n1 2\\r\\n', 'output': ['Yes\\r\\nbb', 'Yes\\r\\ncb', 'Yes\\r\\naa']}, {'input': '4 3\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n', 'output': ['No']}, {'input': '4 4\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['Yes\\r\\nbcaa', 'Yes\\r\\nbacc']}, {'input': '1 0\\r\\n', 'output': ['Yes\\r\\nc', 'Yes\\r\\na', 'Yes\\r\\nb']}, {'input': '15 95\\r\\n1 11\\r\\n13 7\\r\\n12 10\\r\\n1 14\\r\\n15 14\\r\\n15 7\\r\\n13 14\\r\\n9 10\\r\\n5 10\\r\\n7 4\\r\\n6 13\\r\\n2 11\\r\\n14 10\\r\\n11 4\\r\\n15 8\\r\\n11 9\\r\\n13 15\\r\\n8 2\\r\\n2 5\\r\\n15 4\\r\\n7 14\\r\\n12 2\\r\\n12 9\\r\\n2 4\\r\\n1 8\\r\\n8 3\\r\\n1 5\\r\\n1 3\\r\\n1 10\\r\\n9 3\\r\\n6 1\\r\\n7 2\\r\\n1 4\\r\\n7 3\\r\\n7 10\\r\\n13 8\\r\\n8 14\\r\\n8 9\\r\\n14 11\\r\\n6 11\\r\\n6 12\\r\\n12 5\\r\\n14 5\\r\\n6 7\\r\\n8 4\\r\\n2 3\\r\\n7 8\\r\\n11 3\\r\\n1 9\\r\\n15 11\\r\\n14 3\\r\\n8 5\\r\\n12 11\\r\\n13 2\\r\\n15 2\\r\\n11 5\\r\\n8 10\\r\\n11 10\\r\\n12 7\\r\\n14 9\\r\\n13 11\\r\\n8 11\\r\\n5 3\\r\\n7 11\\r\\n3 4\\r\\n1 7\\r\\n1 15\\r\\n12 14\\r\\n15 5\\r\\n7 5\\r\\n2 10\\r\\n7 9\\r\\n9 4\\r\\n5 4\\r\\n13 1\\r\\n2 9\\r\\n15 10\\r\\n13 12\\r\\n15 3\\r\\n1 12\\r\\n10 4\\r\\n14 2\\r\\n9 5\\r\\n6 15\\r\\n12 4\\r\\n15 12\\r\\n10 ...', 'output': ['Yes\\r\\nbbaaacbbaabbcbb', 'Yes\\r\\nbbcccabbccbbabb']}, {'input': '8 28\\r\\n3 2\\r\\n4 2\\r\\n7 4\\r\\n6 3\\r\\n3 7\\r\\n8 1\\r\\n3 4\\r\\n5 1\\r\\n6 5\\r\\n5 3\\r\\n7 1\\r\\n5 8\\r\\n5 4\\r\\n6 1\\r\\n6 4\\r\\n2 1\\r\\n4 1\\r\\n8 2\\r\\n7 2\\r\\n6 8\\r\\n8 4\\r\\n6 7\\r\\n3 1\\r\\n7 8\\r\\n3 8\\r\\n5 7\\r\\n5 2\\r\\n6 2\\r\\n', 'output': ['Yes\\r\\nbbbbbbbb', 'Yes\\r\\naaaaaaaa', 'Yes\\r\\ncbbbbbbb']}, {'input': '417 43540\\r\\n187 191\\r\\n81 388\\r\\n332 273\\r\\n167 89\\r\\n99 394\\r\\n357 385\\r\\n405 218\\r\\n127 252\\r\\n19 282\\r\\n12 385\\r\\n329 365\\r\\n75 235\\r\\n19 390\\r\\n368 354\\r\\n39 321\\r\\n368 295\\r\\n143 406\\r\\n403 187\\r\\n64 78\\r\\n360 357\\r\\n340 345\\r\\n312 307\\r\\n323 206\\r\\n181 258\\r\\n228 210\\r\\n293 244\\r\\n186 15\\r\\n50 46\\r\\n47 79\\r\\n381 170\\r\\n365 212\\r\\n57 48\\r\\n62 260\\r\\n185 123\\r\\n325 404\\r\\n77 149\\r\\n106 153\\r\\n250 201\\r\\n238 190\\r\\n221 128\\r\\n39 312\\r\\n282 94\\r\\n113 340\\r\\n237 317\\r\\n330 138\\r\\n331 255\\r\\n281 309\\r\\n223 144\\r\\n379 209\\r\\n41 187\\r\\n50 396\\r\\n103 275\\r\\n184 6\\r\\n112 225\\r\\n160 416\\r\\n403 20\\r\\n262 240\\r\\n247 24\\r\\n262 2...', 'output': ['No']}, {'input': '500 124750\\r\\n3 470\\r\\n57 482\\r\\n422 366\\r\\n282 337\\r\\n185 467\\r\\n322 55\\r\\n250 111\\r\\n172 389\\r\\n427 146\\r\\n404 135\\r\\n443 161\\r\\n259 10\\r\\n394 111\\r\\n192 48\\r\\n444 8\\r\\n114 228\\r\\n277 42\\r\\n116 139\\r\\n417 441\\r\\n263 16\\r\\n132 328\\r\\n332 58\\r\\n94 305\\r\\n199 416\\r\\n413 338\\r\\n489 125\\r\\n66 98\\r\\n125 294\\r\\n39 36\\r\\n444 430\\r\\n78 194\\r\\n413 395\\r\\n177 338\\r\\n419 134\\r\\n337 420\\r\\n399 148\\r\\n442 321\\r\\n97 482\\r\\n281 443\\r\\n388 3\\r\\n289 56\\r\\n293 394\\r\\n173 371\\r\\n282 401\\r\\n437 363\\r\\n82 209\\r\\n140 234\\r\\n228 251\\r\\n239 57\\r\\n172 310\\r\\n227 49\\r\\n256 234\\r\\n221 19\\r\\n475 293\\r\\n167 444\\r\\n295 138\\r\\n247 353\\r\\n368 38\\r\\n221...', 'output': ['Yes\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'Yes\\r\\ncbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'Yes\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': '500 8538\\r\\n55 35\\r\\n492 402\\r\\n492 81\\r\\n135 387\\r\\n354 185\\r\\n288 444\\r\\n209 68\\r\\n302 282\\r\\n155 130\\r\\n276 423\\r\\n419 199\\r\\n483 303\\r\\n213 43\\r\\n175 180\\r\\n336 400\\r\\n318 133\\r\\n483 208\\r\\n445 260\\r\\n389 396\\r\\n4 460\\r\\n245 100\\r\\n1 335\\r\\n331 428\\r\\n197 433\\r\\n464 349\\r\\n74 114\\r\\n268 311\\r\\n160 156\\r\\n139 165\\r\\n83 359\\r\\n115 143\\r\\n138 410\\r\\n144 455\\r\\n193 333\\r\\n348 430\\r\\n236 363\\r\\n468 312\\r\\n468 437\\r\\n456 20\\r\\n422 253\\r\\n398 491\\r\\n271 275\\r\\n365 487\\r\\n353 154\\r\\n443 41\\r\\n58 369\\r\\n382 321\\r\\n21 100\\r\\n177 193\\r\\n292 500\\r\\n131 162\\r\\n260 258\\r\\n281 448\\r\\n129 367\\r\\n20 167\\r\\n191 187\\r\\n45 306\\r\\n400 3...', 'output': ['No']}, {'input': '19 144\\r\\n5 12\\r\\n14 12\\r\\n1 3\\r\\n4 5\\r\\n9 14\\r\\n5 13\\r\\n2 19\\r\\n13 15\\r\\n8 15\\r\\n6 17\\r\\n14 13\\r\\n3 10\\r\\n19 8\\r\\n8 13\\r\\n6 16\\r\\n16 13\\r\\n16 17\\r\\n5 14\\r\\n5 17\\r\\n14 18\\r\\n4 16\\r\\n13 12\\r\\n7 2\\r\\n11 7\\r\\n19 12\\r\\n1 13\\r\\n9 13\\r\\n7 17\\r\\n4 19\\r\\n9 18\\r\\n17 14\\r\\n2 5\\r\\n19 13\\r\\n16 12\\r\\n5 8\\r\\n15 12\\r\\n17 15\\r\\n16 1\\r\\n10 13\\r\\n7 16\\r\\n1 10\\r\\n2 16\\r\\n5 10\\r\\n6 10\\r\\n6 15\\r\\n4 6\\r\\n6 18\\r\\n17 18\\r\\n2 18\\r\\n5 3\\r\\n5 19\\r\\n16 8\\r\\n7 6\\r\\n6 8\\r\\n8 12\\r\\n16 10\\r\\n7 19\\r\\n3 18\\r\\n8 3\\r\\n5 15\\r\\n12 18\\r\\n16 18\\r\\n19 3\\r\\n11 17\\r\\n3 13\\r\\n2 3\\r\\n11 5\\r\\n9 2\\r\\n1 12\\r\\n19 15\\r\\n2 1\\r\\n2 17\\r\\n3 14\\r\\n6 19\\r\\n9 16\\r\\n4 2\\r\\n11 19\\r\\n19 18\\r\\n16 15\\r\\n1 14\\r\\n6 12\\r\\n2 12\\r\\n19...', 'output': ['Yes\\r\\ncbcabbacbcaccccbbcb', 'Yes\\r\\nabacbbcabacaaaabbab']}, {'input': '31 417\\r\\n4 26\\r\\n29 3\\r\\n15 7\\r\\n22 24\\r\\n22 30\\r\\n29 24\\r\\n9 2\\r\\n10 11\\r\\n16 19\\r\\n10 12\\r\\n9 1\\r\\n26 24\\r\\n27 4\\r\\n13 17\\r\\n21 2\\r\\n9 21\\r\\n16 21\\r\\n21 11\\r\\n5 30\\r\\n31 29\\r\\n31 20\\r\\n5 20\\r\\n25 29\\r\\n23 11\\r\\n28 8\\r\\n23 4\\r\\n5 3\\r\\n26 19\\r\\n3 2\\r\\n31 2\\r\\n13 1\\r\\n18 19\\r\\n29 19\\r\\n15 23\\r\\n9 6\\r\\n7 22\\r\\n1 24\\r\\n9 27\\r\\n10 2\\r\\n11 1\\r\\n9 22\\r\\n6 3\\r\\n14 27\\r\\n23 20\\r\\n23 26\\r\\n10 21\\r\\n11 26\\r\\n1 19\\r\\n8 16\\r\\n4 17\\r\\n3 19\\r\\n22 11\\r\\n10 7\\r\\n6 20\\r\\n25 31\\r\\n9 3\\r\\n9 4\\r\\n14 5\\r\\n28 7\\r\\n21 26\\r\\n31 18\\r\\n7 24\\r\\n16 20\\r\\n28 25\\r\\n28 21\\r\\n8 6\\r\\n27 24\\r\\n23 3\\r\\n28 23\\r\\n20 4\\r\\n22 4\\r\\n20 18\\r\\n29 23\\r\\n1 2\\r\\n10 5\\r\\n16 13\\r\\n14 3\\r\\n28 15\\r\\n8 15\\r\\n14 ...', 'output': ['Yes\\r\\naaaabbbcbbabbbcbaaaabbbacabcbab', 'Yes\\r\\nccccbbbabbcbbbabccccbbbcacbabcb']}, {'input': '138 6413\\r\\n45 35\\r\\n18 106\\r\\n107 130\\r\\n137 127\\r\\n63 104\\r\\n21 29\\r\\n87 82\\r\\n103 68\\r\\n120 92\\r\\n63 94\\r\\n40 52\\r\\n132 35\\r\\n18 136\\r\\n107 19\\r\\n88 14\\r\\n93 56\\r\\n12 14\\r\\n108 126\\r\\n45 117\\r\\n25 128\\r\\n65 72\\r\\n44 82\\r\\n101 72\\r\\n131 8\\r\\n124 11\\r\\n68 127\\r\\n105 56\\r\\n34 69\\r\\n81 96\\r\\n32 34\\r\\n133 32\\r\\n44 132\\r\\n29 115\\r\\n119 58\\r\\n126 75\\r\\n125 83\\r\\n107 135\\r\\n6 129\\r\\n82 36\\r\\n13 100\\r\\n133 1\\r\\n126 1\\r\\n9 36\\r\\n80 54\\r\\n16 34\\r\\n137 54\\r\\n41 92\\r\\n35 127\\r\\n47 41\\r\\n33 127\\r\\n25 58\\r\\n67 73\\r\\n57 106\\r\\n48 83\\r\\n135 71\\r\\n114 107\\r\\n67 52\\r\\n18 7\\r\\n122 72\\r\\n127 85\\r\\n1 127\\r\\n120 6\\r\\n134 69\\r\\n126 82\\r\\n28 9\\r\\n63 121\\r\\n28...', 'output': ['Yes\\r\\ncbcaaaaaccbccbcccbbcccacabccbcbccccbacabbacccccaccaabcacaaaccccccabcbaccacbaaaccccacacccabcaccccccaccccccacccaccccaacbaacccbacbaacaccccbcc', 'Yes\\r\\nabacccccaabaabaaabbaaacacbaababaaaabcacbbcaaaaacaaccbacacccaaaaaacbabcaacabcccaaaacacaaacbacaaaaaacaaaaaacaaacaaaaccabccaaabcabccacaaaabaa']}, {'input': '289 34576\\r\\n74 164\\r\\n72 122\\r\\n288 203\\r\\n25 97\\r\\n68 5\\r\\n98 135\\r\\n182 67\\r\\n143 87\\r\\n58 1\\r\\n225 39\\r\\n52 275\\r\\n19 201\\r\\n163 165\\r\\n75 23\\r\\n112 283\\r\\n204 107\\r\\n136 203\\r\\n120 205\\r\\n106 57\\r\\n114 246\\r\\n252 141\\r\\n90 232\\r\\n14 243\\r\\n11 52\\r\\n34 64\\r\\n51 277\\r\\n125 64\\r\\n17 13\\r\\n41 245\\r\\n220 286\\r\\n218 138\\r\\n161 220\\r\\n9 33\\r\\n39 177\\r\\n147 47\\r\\n58 256\\r\\n145 238\\r\\n193 127\\r\\n271 248\\r\\n115 8\\r\\n190 86\\r\\n92 29\\r\\n116 187\\r\\n201 260\\r\\n157 131\\r\\n115 82\\r\\n121 23\\r\\n122 12\\r\\n193 35\\r\\n117 1\\r\\n284 172\\r\\n87 33\\r\\n136 79\\r\\n247 105\\r\\n155 24\\r\\n123 101\\r\\n255 125\\r\\n285 255\\r\\n88 195\\r\\n14 104\\r\\n282 192\\r\\n288 ...', 'output': ['Yes\\r\\naaaaaaaaacaaaaaababcabaaaaaaacacabaaaaaaabacaaaaaaaaaaabaaabaaaacbaaaabacaaaaaaacaaacabacaaaaaaaabaaabcaabaaaabbaaaabacaaaaaaaaaacaaaaaaaaaaaacabaaaaaaacaaaaaaaaabaaaaaabcaaaaaaaabaaabbaaacbbaaaacaaaabbaaacaabcaaaccaaacabaaaaaaabaaacccacaccaaaaaaaaaaaabaaaacaaaacbaabaaabaaaaaabbacbaaaabaa', 'Yes\\r\\ncccccccccaccccccbcbacbcccccccacacbcccccccbcacccccccccccbcccbccccabccccbcacccccccacccacbcaccccccccbcccbaccbccccbbccccbcaccccccccccaccccccccccccacbcccccccacccccccccbccccccbaccccccccbcccbbcccabbccccaccccbbcccaccbacccaacccacbcccccccbcccaaacacaaccccccccccccbccccaccccabccbcccbccccccbbcabccccbcc']}, {'input': '500 123420\\r\\n136 76\\r\\n388 405\\r\\n121 171\\r\\n44 345\\r\\n45 332\\r\\n219 42\\r\\n344 468\\r\\n271 139\\r\\n312 240\\r\\n372 415\\r\\n70 431\\r\\n445 195\\r\\n50 308\\r\\n317 42\\r\\n375 208\\r\\n419 255\\r\\n366 456\\r\\n336 42\\r\\n249 28\\r\\n150 129\\r\\n250 7\\r\\n221 64\\r\\n189 280\\r\\n371 411\\r\\n142 105\\r\\n373 41\\r\\n53 134\\r\\n226 241\\r\\n382 468\\r\\n463 215\\r\\n239 270\\r\\n371 160\\r\\n405 444\\r\\n424 470\\r\\n139 360\\r\\n429 238\\r\\n372 450\\r\\n200 431\\r\\n179 276\\r\\n240 432\\r\\n27 295\\r\\n456 1\\r\\n446 339\\r\\n288 281\\r\\n468 437\\r\\n378 63\\r\\n201 498\\r\\n10 341\\r\\n279 370\\r\\n272 43\\r\\n323 87\\r\\n299 375\\r\\n417 9\\r\\n25 386\\r\\n462 243\\r\\n230 206\\r\\n132 447\\r\\n140 380\\r\\n2...', 'output': ['Yes\\r\\nbbcbcbbbbbcbbcccbcbbccbbcbcbbbabcbbbccccbbbcbbbbabcbbbbccbbcbbbbcbbbbbbbcabbbbcbbccbbbbccbbbcbbbbbbbbbbcbbccbcbbbbbcbccbbcbbcbcbbbbbbbbbbacbbcccbbbbbbbbbbbabbbbbbbbbbbbbcbbabbbbbbcbcbbbbbbbbbbbbbbbcbbcbbbcbbaccbbcbbbcbbbcbccbbbcbbbbbbbbcbcbbbbcbcbbcbbbbbbcacbbcbbccbcbcccbccbbbcbbbbbbbbbcccbbbbbbbbbcbbbbbbcbccbcbbbbcbbbccbbbbbbcbcbbccccbbbbbbbbccbbbcbbcbbbbbbbccbbbbbbabccbbbbbcbbbbbbbbccccbbbbbcbbbbcacccbbcbbbbbcbbbcbbbbbbbbcccbbccccbbcbcbbbbcbbcbbbbccbbbbbbccbbbbbbbcbbbbcbbbbbcbbbbbbcccbbbbbbbbb', 'Yes\\r\\nbbababbbbbabbaaababbaabbababbbcbabbbaaaabbbabbbbcbabbbbaabbabbbbabbbbbbbacbbbbabbaabbbbaabbbabbbbbbbbbbabbaababbbbbabaabbabbababbbbbbbbbbcabbaaabbbbbbbbbbbcbbbbbbbbbbbbbabbcbbbbbbababbbbbbbbbbbbbbbabbabbbabbcaabbabbbabbbabaabbbabbbbbbbbababbbbababbabbbbbbacabbabbaababaaabaabbbabbbbbbbbbaaabbbbbbbbbabbbbbbabaababbbbabbbaabbbbbbababbaaaabbbbbbbbaabbbabbabbbbbbbaabbbbbbcbaabbbbbabbbbbbbbaaaabbbbbabbbbacaaabbabbbbbabbbabbbbbbbbaaabbaaaabbababbbbabbabbbbaabbbbbbaabbbbbbbabbbbabbbbbabbbbbbaaabbbbbbbbb']}, {'input': '4 3\\r\\n4 3\\r\\n2 4\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\ncaaa', 'Yes\\r\\naccc']}, {'input': '4 2\\r\\n4 3\\r\\n1 2\\r\\n', 'output': ['Yes\\r\\nccaa', 'Yes\\r\\naacc']}, {'input': '500 113071\\r\\n209 169\\r\\n377 204\\r\\n119 423\\r\\n267 110\\r\\n333 414\\r\\n60 227\\r\\n78 135\\r\\n169 26\\r\\n50 384\\r\\n466 211\\r\\n190 290\\r\\n106 309\\r\\n320 272\\r\\n468 443\\r\\n87 221\\r\\n62 84\\r\\n41 100\\r\\n493 484\\r\\n346 500\\r\\n405 204\\r\\n220 183\\r\\n242 445\\r\\n305 379\\r\\n357 297\\r\\n462 441\\r\\n65 461\\r\\n317 6\\r\\n474 227\\r\\n63 27\\r\\n492 34\\r\\n85 498\\r\\n160 99\\r\\n112 292\\r\\n117 279\\r\\n182 465\\r\\n317 156\\r\\n275 248\\r\\n316 442\\r\\n444 89\\r\\n252 175\\r\\n256 409\\r\\n253 148\\r\\n131 120\\r\\n388 222\\r\\n439 419\\r\\n384 96\\r\\n54 25\\r\\n174 100\\r\\n88 378\\r\\n60 112\\r\\n236 392\\r\\n418 16\\r\\n364 484\\r\\n235 300\\r\\n210 124\\r\\n375 414\\r\\n153 214\\r\\n36 316\\r\\n3...', 'output': ['Yes\\r\\ncabaaaccbbabccbbbbccbbcbcccbccbbcbbbbbbbccccbcbccbbbccccbbcbcabbbcbccbaacbcbcbbcccbbaccaccbcbcabbbccbbbcbbccbbcbcbacbbbbccbcccbcbbbbcbcbbabccacaccaccbcbccbbcacccbabbbccccbcbbcbcabbaacabccacbabcccccccacbbcccbccbcbbcbcccbccbbbbcbcccbccbaacabcbbacbccbcbbbbbbcccbccabcbcbccacccbababccbbcccccbcbbcccbcbcbbcccbbcbccbacbcccabcbbbbcbbabcabcbacbbcbbbbcbabbcccbcbcccbccbcbcbbbacbbacccabbbcbcbcbbccabcabaccbcbcbcccbbccbcbabcbbacbcbbbcbbbcbbbbcabcbcbbcbccbbccbccccccbbbbcccbbcbbbbcbcbabcccccccbcccbcbccbbbbacbacc', 'Yes\\r\\nacbcccaabbcbaabbbbaabbabaaabaabbabbbbbbbaaaababaabbbaaaabbabacbbbabaabccabababbaaabbcaacaababacbbbaabbbabbaabbababcabbbbaabaaababbbbababbcbaacacaacaababaabbacaaabcbbbaaaababbabacbbccacbaacabcbaaaaaaacabbaaabaababbabaaabaabbbbabaaabaabccacbabbcabaababbbbbbaaabaacbababaacaaabcbcbaabbaaaaababbaaabababbaaabbabaabcabaaacbabbbbabbcbacbabcabbabbbbabcbbaaababaaabaabababbbcabbcaaacbbbabababbaacbacbcaabababaaabbaababcbabbcababbbabbbabbbbacbababbabaabbaabaaaaaabbbbaaabbabbbbababcbaaaaaaabaaababaabbbbcabcaa']}, {'input': '500 108211\\r\\n495 283\\r\\n49 361\\r\\n484 40\\r\\n151 410\\r\\n211 107\\r\\n8 441\\r\\n224 335\\r\\n448 450\\r\\n111 388\\r\\n498 87\\r\\n136 68\\r\\n244 111\\r\\n431 134\\r\\n465 182\\r\\n407 283\\r\\n19 474\\r\\n210 445\\r\\n479 395\\r\\n383 177\\r\\n177 9\\r\\n310 34\\r\\n406 69\\r\\n26 437\\r\\n72 166\\r\\n131 175\\r\\n215 451\\r\\n104 401\\r\\n412 357\\r\\n87 205\\r\\n131 451\\r\\n56 268\\r\\n425 368\\r\\n131 143\\r\\n142 46\\r\\n45 118\\r\\n347 368\\r\\n287 199\\r\\n386 407\\r\\n343 60\\r\\n308 384\\r\\n440 351\\r\\n355 297\\r\\n345 419\\r\\n185 18\\r\\n182 369\\r\\n474 175\\r\\n91 39\\r\\n273 410\\r\\n55 135\\r\\n70 397\\r\\n290 94\\r\\n17 289\\r\\n141 384\\r\\n158 451\\r\\n321 268\\r\\n453 77\\r\\n206 406\\r\\n148 494\\r\\n439...', 'output': ['Yes\\r\\nacaaaacaaaaacaaaaaaaccaaaacaaaaaaaacaaaaaaaaaaaacaaaacaaaaaaabaaaaaaabaaaaaacaaaaaaaaaaaaaaaaaaaacbaaacaaaaaaaaaacabbacaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccaaaaaaaaaaaaaacaaaaabaaaacaaaaacaaaacaaaaaaaaaaaaaaaaaacaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaacaabaaabaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaabaaaaaaaacaaaabaaaaabaaaaaaaaaaaaaaaaaaaacaaaaaacaabaaaccaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaacaaaaaacaaacaaaacaaacaaacaaaaaaaaaaaaaaaaaaaa', 'Yes\\r\\ncaccccacccccacccccccaaccccaccccccccaccccccccccccaccccacccccccbcccccccbccccccaccccccccccccccccccccabcccaccccccccccacbbcaccccccccccccccccccccccccacccccccccccacccccccccccccccccccccccccccccccccccccccccccccccccccccccaaccccccccccccccacccccbccccacccccaccccaccccccccccccccccccacccccccacccccccccccccccccccccccccaccbcccbccccccccccbcccccccccccccccccccccccccbcccccccccccccbccccccccaccccbcccccbccccccccccccccccccccaccccccaccbcccaaccccbbcccccccccccccccccccccccccccccaccaccccccacccaccccacccacccacccccccccccccccccccc']}, {'input': '500 86374\\r\\n63 497\\r\\n138 415\\r\\n393 363\\r\\n401 456\\r\\n401 375\\r\\n381 473\\r\\n104 422\\r\\n79 211\\r\\n59 49\\r\\n402 246\\r\\n253 473\\r\\n114 141\\r\\n93 127\\r\\n63 34\\r\\n68 50\\r\\n239 495\\r\\n236 210\\r\\n436 99\\r\\n189 175\\r\\n105 394\\r\\n190 323\\r\\n387 59\\r\\n129 441\\r\\n428 126\\r\\n459 442\\r\\n441 185\\r\\n382 496\\r\\n339 233\\r\\n38 49\\r\\n7 333\\r\\n195 154\\r\\n234 276\\r\\n24 59\\r\\n346 186\\r\\n341 444\\r\\n210 48\\r\\n313 184\\r\\n275 15\\r\\n288 236\\r\\n240 184\\r\\n300 156\\r\\n265 4\\r\\n306 187\\r\\n177 47\\r\\n465 118\\r\\n55 449\\r\\n148 312\\r\\n475 58\\r\\n151 458\\r\\n104 269\\r\\n265 477\\r\\n352 121\\r\\n263 58\\r\\n166 445\\r\\n252 358\\r\\n224 338\\r\\n500 143\\r\\n179 322\\r\\n111...', 'output': ['Yes\\r\\naccbcabbaaacccaacccbcaacbabcbaccaccaacbbaaccccbcbcaaccaccccaccccbbccccbcabcbcbcbacbcbaaaccabacbccaccaaccbccbcacaababbabcaaaabaaacabbacbbcbacabaacaacccaccbbaccabacacabbcaccabcbaccbacaabbbcacbccaacccbcaabcbbcbcbccccacccaaaaccbacccbaaccbccbaccaccbbacacabccaccacbccacaccabbccabbaabacacacccacccbcacaccaccacacaccbacbccccacbacaabbacaaccccbacccaaccaaaacccbaacbabbabcccaabccccaacaacccbabcccccacccccacacabcbbabcaccccbaaaccacaacaaaacccaabacabcccbcacabccaabbcbaccbcaacbacbcbacacaacbccbcccccacaaccaaccbcaaacbccccb', 'Yes\\r\\ncaabacbbcccaaaccaaabaccabcbabcaacaaccabbccaaaababaccaacaaaacaaaabbaaaabacbabababcababcccaacbcabaacaaccaabaabacaccbcbbcbaccccbcccacbbcabbabcacbccaccaaacaabbcaacbcacacbbacaacbabcaabcaccbbbacabaaccaaabaccbabbababaaaacaaaccccaabcaaabccaabaabcaacaabbcacacbaacaacabaacacaacbbaacbbccbcacacaaacaaabacacaacaacacacaabcabaaaacabcaccbbcaccaaaabcaaaccaaccccaaabccabcbbcbaaaccbaaaaccaccaaabcbaaaaacaaaaacacacbabbcbacaaaabcccaacaccaccccaaaccbcacbaaabacacbaaccbbabcaabaccabcababcacaccabaabaaaaacaccaaccaabacccabaaaab']}, {'input': '5 3\\r\\n1 2\\r\\n1 3\\r\\n4 5\\r\\n', 'output': ['No']}, {'input': '6 4\\r\\n1 2\\r\\n1 3\\r\\n4 5\\r\\n4 6\\r\\n', 'output': ['No']}, {'input': '6 4\\r\\n1 2\\r\\n2 3\\r\\n4 5\\r\\n4 6\\r\\n', 'output': ['No']}, {'input': '6 4\\r\\n3 2\\r\\n1 3\\r\\n6 5\\r\\n4 6\\r\\n', 'output': ['No']}, {'input': '6 4\\r\\n1 2\\r\\n1 3\\r\\n4 6\\r\\n5 6\\r\\n', 'output': ['No']}, {'input': '7 13\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n4 5\\r\\n5 6\\r\\n4 6\\r\\n2 5\\r\\n2 7\\r\\n3 7\\r\\n7 4\\r\\n7 6\\r\\n7 1\\r\\n7 5\\r\\n', 'output': ['No']}, {'input': '500 113344\\r\\n397 381\\r\\n431 21\\r\\n462 356\\r\\n262 105\\r\\n438 481\\r\\n324 61\\r\\n246 89\\r\\n305 327\\r\\n166 76\\r\\n141 250\\r\\n294 362\\r\\n156 381\\r\\n46 424\\r\\n26 419\\r\\n213 150\\r\\n410 324\\r\\n357 262\\r\\n9 359\\r\\n380 13\\r\\n205 112\\r\\n67 38\\r\\n488 170\\r\\n442 373\\r\\n394 368\\r\\n404 231\\r\\n270 471\\r\\n374 187\\r\\n339 175\\r\\n239 75\\r\\n396 28\\r\\n485 96\\r\\n457 396\\r\\n349 86\\r\\n73 188\\r\\n176 232\\r\\n6 127\\r\\n380 402\\r\\n174 287\\r\\n10 280\\r\\n385 80\\r\\n91 452\\r\\n47 83\\r\\n447 130\\r\\n251 39\\r\\n439 466\\r\\n8 275\\r\\n166 178\\r\\n190 438\\r\\n410 388\\r\\n239 302\\r\\n354 70\\r\\n146 209\\r\\n51 22\\r\\n115 59\\r\\n484 4\\r\\n198 202\\r\\n64 158\\r\\n384 152\\r\\n126 316\\r\\n4...', 'output': ['No']}, {'input': '500 111660\\r\\n471 302\\r\\n29 30\\r\\n21 254\\r\\n182 122\\r\\n390 268\\r\\n37 72\\r\\n205 402\\r\\n155 333\\r\\n440 390\\r\\n21 429\\r\\n385 37\\r\\n242 355\\r\\n371 183\\r\\n101 339\\r\\n287 179\\r\\n175 421\\r\\n296 480\\r\\n498 254\\r\\n202 222\\r\\n343 486\\r\\n471 319\\r\\n344 208\\r\\n214 124\\r\\n373 308\\r\\n445 206\\r\\n196 400\\r\\n500 10\\r\\n18 39\\r\\n42 243\\r\\n187 286\\r\\n20 277\\r\\n72 138\\r\\n301 28\\r\\n431 483\\r\\n180 436\\r\\n305 39\\r\\n358 55\\r\\n221 254\\r\\n466 76\\r\\n291 297\\r\\n233 264\\r\\n11 399\\r\\n60 34\\r\\n342 294\\r\\n171 21\\r\\n182 45\\r\\n265 294\\r\\n366 185\\r\\n385 347\\r\\n211 149\\r\\n38 258\\r\\n479 492\\r\\n248 79\\r\\n301 208\\r\\n444 348\\r\\n240 211\\r\\n288 320\\r\\n38 323\\r\\n21...', 'output': ['No']}, {'input': '500 111500\\r\\n491 137\\r\\n382 96\\r\\n10 130\\r\\n171 408\\r\\n451 237\\r\\n120 88\\r\\n238 174\\r\\n283 278\\r\\n240 336\\r\\n95 374\\r\\n427 408\\r\\n395 204\\r\\n413 188\\r\\n227 396\\r\\n91 430\\r\\n41 412\\r\\n148 169\\r\\n207 153\\r\\n93 344\\r\\n97 184\\r\\n68 231\\r\\n113 499\\r\\n123 206\\r\\n203 153\\r\\n317 340\\r\\n375 468\\r\\n140 345\\r\\n353 190\\r\\n39 347\\r\\n164 358\\r\\n173 147\\r\\n46 334\\r\\n187 393\\r\\n199 305\\r\\n133 254\\r\\n272 451\\r\\n23 280\\r\\n29 426\\r\\n235 437\\r\\n121 474\\r\\n284 426\\r\\n273 44\\r\\n415 399\\r\\n437 416\\r\\n219 247\\r\\n193 195\\r\\n392 374\\r\\n111 92\\r\\n390 18\\r\\n323 271\\r\\n221 318\\r\\n139 202\\r\\n234 267\\r\\n412 105\\r\\n184 319\\r\\n470 387\\r\\n16 306\\r\\n310...', 'output': ['No']}, {'input': '500 122732\\r\\n426 499\\r\\n462 379\\r\\n245 119\\r\\n144 24\\r\\n450 203\\r\\n231 225\\r\\n117 268\\r\\n21 248\\r\\n140 191\\r\\n187 444\\r\\n179 290\\r\\n58 363\\r\\n88 112\\r\\n497 473\\r\\n284 218\\r\\n413 264\\r\\n161 480\\r\\n119 389\\r\\n95 373\\r\\n168 318\\r\\n240 250\\r\\n257 393\\r\\n342 190\\r\\n182 156\\r\\n334 98\\r\\n246 40\\r\\n497 115\\r\\n373 96\\r\\n271 74\\r\\n290 29\\r\\n454 87\\r\\n394 423\\r\\n254 139\\r\\n55 411\\r\\n176 339\\r\\n84 208\\r\\n278 196\\r\\n335 253\\r\\n33 287\\r\\n404 362\\r\\n234 45\\r\\n475 482\\r\\n417 356\\r\\n109 424\\r\\n326 190\\r\\n127 224\\r\\n166 44\\r\\n465 148\\r\\n163 5\\r\\n441 443\\r\\n309 36\\r\\n107 153\\r\\n237 29\\r\\n198 215\\r\\n17 208\\r\\n307 288\\r\\n10 169\\r\\n164 249\\r...', 'output': ['No']}, {'input': '500 37186\\r\\n483 441\\r\\n223 156\\r\\n264 34\\r\\n99 148\\r\\n481 60\\r\\n347 443\\r\\n140 457\\r\\n211 499\\r\\n97 292\\r\\n53 228\\r\\n178 166\\r\\n249 338\\r\\n114 500\\r\\n141 84\\r\\n165 332\\r\\n495 35\\r\\n449 405\\r\\n52 228\\r\\n406 139\\r\\n219 408\\r\\n311 365\\r\\n146 332\\r\\n363 64\\r\\n491 74\\r\\n433 3\\r\\n224 185\\r\\n41 14\\r\\n323 453\\r\\n303 186\\r\\n11 54\\r\\n44 179\\r\\n408 70\\r\\n112 310\\r\\n240 250\\r\\n86 143\\r\\n281 424\\r\\n439 171\\r\\n206 162\\r\\n11 245\\r\\n367 471\\r\\n60 169\\r\\n393 343\\r\\n384 272\\r\\n67 314\\r\\n301 493\\r\\n428 139\\r\\n448 251\\r\\n497 27\\r\\n214 47\\r\\n285 292\\r\\n86 62\\r\\n97 142\\r\\n137 192\\r\\n356 23\\r\\n491 496\\r\\n279 63\\r\\n93 448\\r\\n77 276\\r\\n191 123\\r\\n...', 'output': ['No']}, {'input': '500 5271\\r\\n77 162\\r\\n315 195\\r\\n162 66\\r\\n196 147\\r\\n482 415\\r\\n373 489\\r\\n323 272\\r\\n346 282\\r\\n143 476\\r\\n334 359\\r\\n362 463\\r\\n263 494\\r\\n230 444\\r\\n13 137\\r\\n391 12\\r\\n359 240\\r\\n227 402\\r\\n341 55\\r\\n92 192\\r\\n242 280\\r\\n101 312\\r\\n379 141\\r\\n410 6\\r\\n233 60\\r\\n278 322\\r\\n442 80\\r\\n407 154\\r\\n259 27\\r\\n265 500\\r\\n440 137\\r\\n200 15\\r\\n130 231\\r\\n446 92\\r\\n266 360\\r\\n134 265\\r\\n44 9\\r\\n209 302\\r\\n65 286\\r\\n369 69\\r\\n415 284\\r\\n318 198\\r\\n411 186\\r\\n47 411\\r\\n152 424\\r\\n228 42\\r\\n282 176\\r\\n65 231\\r\\n430 353\\r\\n497 134\\r\\n281 102\\r\\n314 353\\r\\n60 467\\r\\n426 406\\r\\n418 65\\r\\n405 474\\r\\n124 262\\r\\n425 449\\r\\n88 53\\r\\n73 1...', 'output': ['No']}, {'input': '500 34831\\r\\n216 500\\r\\n464 222\\r\\n469 151\\r\\n259 102\\r\\n5 414\\r\\n381 367\\r\\n395 282\\r\\n322 404\\r\\n451 209\\r\\n303 9\\r\\n354 211\\r\\n291 235\\r\\n119 214\\r\\n479 33\\r\\n147 158\\r\\n231 392\\r\\n323 262\\r\\n154 436\\r\\n111 215\\r\\n359 182\\r\\n417 191\\r\\n448 404\\r\\n196 192\\r\\n455 159\\r\\n252 133\\r\\n283 98\\r\\n214 145\\r\\n408 118\\r\\n323 24\\r\\n167 334\\r\\n229 153\\r\\n299 108\\r\\n305 179\\r\\n23 484\\r\\n67 48\\r\\n229 473\\r\\n157 224\\r\\n441 345\\r\\n360 64\\r\\n251 154\\r\\n62 18\\r\\n332 290\\r\\n405 476\\r\\n35 489\\r\\n278 165\\r\\n103 428\\r\\n209 147\\r\\n60 499\\r\\n73 359\\r\\n325 351\\r\\n143 226\\r\\n306 320\\r\\n113 22\\r\\n28 453\\r\\n181 61\\r\\n427 235\\r\\n423 465\\r\\n343 10...', 'output': ['No']}, {'input': '500 57134\\r\\n129 489\\r\\n431 358\\r\\n128 51\\r\\n77 118\\r\\n131 6\\r\\n248 102\\r\\n442 64\\r\\n95 76\\r\\n483 317\\r\\n105 371\\r\\n162 114\\r\\n180 339\\r\\n2 107\\r\\n443 301\\r\\n445 473\\r\\n180 381\\r\\n200 478\\r\\n181 248\\r\\n388 47\\r\\n164 199\\r\\n21 150\\r\\n6 334\\r\\n89 496\\r\\n77 347\\r\\n398 43\\r\\n296 294\\r\\n122 427\\r\\n37 95\\r\\n21 324\\r\\n87 173\\r\\n500 316\\r\\n168 424\\r\\n93 359\\r\\n169 371\\r\\n334 382\\r\\n224 183\\r\\n315 190\\r\\n137 168\\r\\n493 273\\r\\n193 46\\r\\n121 282\\r\\n118 278\\r\\n391 437\\r\\n59 386\\r\\n380 265\\r\\n176 17\\r\\n131 366\\r\\n468 144\\r\\n93 297\\r\\n92 100\\r\\n433 488\\r\\n69 162\\r\\n368 415\\r\\n396 295\\r\\n295 216\\r\\n54 48\\r\\n61 118\\r\\n422 430\\r\\n496 98\\r\\n...', 'output': ['No']}, {'input': '8 18\\r\\n3 7\\r\\n2 5\\r\\n5 3\\r\\n3 8\\r\\n8 6\\r\\n6 3\\r\\n6 4\\r\\n4 8\\r\\n1 2\\r\\n6 1\\r\\n2 7\\r\\n2 4\\r\\n4 5\\r\\n4 3\\r\\n6 5\\r\\n1 4\\r\\n5 7\\r\\n3 1\\r\\n', 'output': ['No']}, {'input': '20 55\\r\\n20 11\\r\\n14 5\\r\\n4 9\\r\\n17 5\\r\\n16 5\\r\\n20 16\\r\\n11 17\\r\\n2 14\\r\\n14 19\\r\\n9 15\\r\\n20 19\\r\\n5 18\\r\\n15 20\\r\\n1 16\\r\\n12 20\\r\\n4 7\\r\\n16 19\\r\\n17 19\\r\\n16 12\\r\\n19 9\\r\\n11 13\\r\\n18 17\\r\\n10 8\\r\\n20 1\\r\\n16 8\\r\\n1 13\\r\\n11 12\\r\\n13 18\\r\\n4 13\\r\\n14 10\\r\\n9 13\\r\\n8 9\\r\\n6 9\\r\\n2 13\\r\\n10 16\\r\\n19 1\\r\\n7 17\\r\\n20 4\\r\\n12 8\\r\\n3 2\\r\\n18 10\\r\\n6 13\\r\\n14 9\\r\\n7 9\\r\\n19 7\\r\\n8 15\\r\\n20 6\\r\\n16 13\\r\\n14 13\\r\\n19 8\\r\\n7 14\\r\\n6 2\\r\\n9 1\\r\\n7 1\\r\\n10 6\\r\\n', 'output': ['No']}, {'input': '15 84\\r\\n11 9\\r\\n3 11\\r\\n13 10\\r\\n2 12\\r\\n5 9\\r\\n1 7\\r\\n14 4\\r\\n14 2\\r\\n14 1\\r\\n11 8\\r\\n1 8\\r\\n14 10\\r\\n4 15\\r\\n10 5\\r\\n5 12\\r\\n13 11\\r\\n6 14\\r\\n5 7\\r\\n12 11\\r\\n9 1\\r\\n10 15\\r\\n2 6\\r\\n7 15\\r\\n14 9\\r\\n9 7\\r\\n11 14\\r\\n8 15\\r\\n12 7\\r\\n13 6\\r\\n2 9\\r\\n9 6\\r\\n15 3\\r\\n12 15\\r\\n6 15\\r\\n4 6\\r\\n4 1\\r\\n9 12\\r\\n10 7\\r\\n6 1\\r\\n11 10\\r\\n2 3\\r\\n5 2\\r\\n13 2\\r\\n13 3\\r\\n12 6\\r\\n4 3\\r\\n5 8\\r\\n12 1\\r\\n9 15\\r\\n14 5\\r\\n12 14\\r\\n10 1\\r\\n9 4\\r\\n7 13\\r\\n3 6\\r\\n15 1\\r\\n13 9\\r\\n11 1\\r\\n10 4\\r\\n9 3\\r\\n8 12\\r\\n13 12\\r\\n6 7\\r\\n12 10\\r\\n4 12\\r\\n13 15\\r\\n2 10\\r\\n3 8\\r\\n1 5\\r\\n15 2\\r\\n4 11\\r\\n2 1\\r\\n10 8\\r\\n14 3\\r\\n14 8\\r\\n8 7\\r\\n13 1\\r\\n5 4\\r\\n11 2\\r\\n6 8\\r\\n5 15\\r\\n2 4\\r\\n9 8\\r\\n9 10\\r\\n', 'output': ['No']}, {'input': '31 226\\r\\n8 3\\r\\n24 25\\r\\n5 13\\r\\n19 26\\r\\n21 14\\r\\n3 25\\r\\n9 12\\r\\n1 9\\r\\n4 1\\r\\n28 25\\r\\n22 19\\r\\n25 16\\r\\n4 25\\r\\n3 30\\r\\n9 25\\r\\n2 27\\r\\n20 1\\r\\n1 5\\r\\n31 11\\r\\n28 31\\r\\n18 28\\r\\n13 11\\r\\n26 23\\r\\n12 29\\r\\n13 28\\r\\n16 23\\r\\n5 30\\r\\n2 10\\r\\n13 22\\r\\n12 26\\r\\n12 17\\r\\n27 1\\r\\n23 12\\r\\n25 1\\r\\n1 13\\r\\n11 8\\r\\n22 16\\r\\n21 28\\r\\n24 21\\r\\n27 25\\r\\n18 31\\r\\n18 23\\r\\n19 12\\r\\n15 30\\r\\n22 1\\r\\n8 30\\r\\n14 6\\r\\n23 27\\r\\n2 8\\r\\n24 3\\r\\n27 7\\r\\n30 28\\r\\n26 17\\r\\n8 23\\r\\n29 8\\r\\n31 15\\r\\n17 10\\r\\n2 21\\r\\n27 8\\r\\n6 11\\r\\n28 16\\r\\n9 13\\r\\n31 23\\r\\n17 16\\r\\n3 10\\r\\n11 4\\r\\n10 22\\r\\n24 8\\r\\n28 23\\r\\n11 1\\r\\n5 29\\r\\n21 31\\r\\n23 6\\r\\n2 6\\r\\n27 18\\r\\n22 25\\r\\n9 10\\r\\n7 30\\r\\n18...', 'output': ['No']}, {'input': '47 708\\r\\n6 31\\r\\n27 35\\r\\n42 32\\r\\n26 33\\r\\n33 40\\r\\n14 10\\r\\n43 46\\r\\n34 24\\r\\n37 45\\r\\n1 24\\r\\n33 8\\r\\n26 22\\r\\n3 42\\r\\n20 1\\r\\n32 33\\r\\n25 12\\r\\n7 27\\r\\n1 31\\r\\n38 41\\r\\n37 10\\r\\n44 35\\r\\n37 20\\r\\n24 44\\r\\n27 20\\r\\n27 9\\r\\n19 21\\r\\n22 29\\r\\n18 45\\r\\n27 1\\r\\n33 18\\r\\n7 21\\r\\n24 16\\r\\n10 31\\r\\n46 16\\r\\n44 39\\r\\n25 37\\r\\n9 29\\r\\n21 25\\r\\n46 21\\r\\n43 26\\r\\n34 44\\r\\n24 35\\r\\n8 6\\r\\n42 26\\r\\n10 32\\r\\n9 14\\r\\n8 45\\r\\n2 11\\r\\n10 6\\r\\n6 37\\r\\n35 34\\r\\n11 10\\r\\n4 21\\r\\n11 9\\r\\n45 29\\r\\n28 27\\r\\n43 37\\r\\n15 34\\r\\n46 18\\r\\n21 8\\r\\n24 41\\r\\n23 16\\r\\n2 18\\r\\n22 13\\r\\n27 4\\r\\n17 36\\r\\n32 9\\r\\n28 44\\r\\n4 33\\r\\n4 2\\r\\n28 32\\r\\n39 42\\r\\n34 33\\r\\n46 12\\r\\n37 38\\r\\n8 13\\r...', 'output': ['No']}, {'input': '15 13\\r\\n13 15\\r\\n13 3\\r\\n14 3\\r\\n10 7\\r\\n2 5\\r\\n5 12\\r\\n12 11\\r\\n9 2\\r\\n13 7\\r\\n7 4\\r\\n12 10\\r\\n15 7\\r\\n6 13\\r\\n', 'output': ['No']}, {'input': '63 449\\r\\n5 28\\r\\n48 55\\r\\n62 51\\r\\n29 44\\r\\n41 38\\r\\n28 21\\r\\n52 42\\r\\n18 50\\r\\n51 25\\r\\n18 14\\r\\n43 39\\r\\n15 6\\r\\n25 3\\r\\n13 28\\r\\n27 47\\r\\n57 27\\r\\n48 59\\r\\n54 11\\r\\n47 20\\r\\n20 44\\r\\n7 52\\r\\n14 24\\r\\n63 32\\r\\n33 32\\r\\n20 13\\r\\n61 7\\r\\n13 50\\r\\n28 30\\r\\n59 31\\r\\n63 41\\r\\n29 46\\r\\n50 34\\r\\n4 29\\r\\n30 59\\r\\n11 63\\r\\n32 7\\r\\n18 38\\r\\n47 11\\r\\n45 59\\r\\n2 30\\r\\n50 55\\r\\n30 29\\r\\n56 42\\r\\n19 56\\r\\n54 57\\r\\n49 52\\r\\n15 40\\r\\n59 56\\r\\n54 8\\r\\n52 10\\r\\n42 30\\r\\n18 47\\r\\n63 2\\r\\n8 52\\r\\n57 48\\r\\n6 45\\r\\n11 39\\r\\n34 54\\r\\n20 43\\r\\n30 10\\r\\n31 23\\r\\n60 6\\r\\n21 26\\r\\n48 58\\r\\n39 50\\r\\n40 4\\r\\n30 38\\r\\n59 57\\r\\n57 29\\r\\n43 2\\r\\n41 55\\r\\n21 23\\r\\n5 3\\r\\n30 53\\r\\n55...', 'output': ['No']}, {'input': '6 6\\r\\n1 4\\r\\n3 4\\r\\n6 4\\r\\n2 6\\r\\n5 3\\r\\n3 2\\r\\n', 'output': ['No']}, {'input': '203 10299\\r\\n193 69\\r\\n171 186\\r\\n176 55\\r\\n133 138\\r\\n46 182\\r\\n110 182\\r\\n20 188\\r\\n197 62\\r\\n62 3\\r\\n170 106\\r\\n146 25\\r\\n150 26\\r\\n51 140\\r\\n137 27\\r\\n36 146\\r\\n96 164\\r\\n12 141\\r\\n169 26\\r\\n69 37\\r\\n33 96\\r\\n74 46\\r\\n156 114\\r\\n155 26\\r\\n194 75\\r\\n200 199\\r\\n125 67\\r\\n136 149\\r\\n184 110\\r\\n28 202\\r\\n2 18\\r\\n179 140\\r\\n98 121\\r\\n25 198\\r\\n110 201\\r\\n24 181\\r\\n154 35\\r\\n91 166\\r\\n52 45\\r\\n7 186\\r\\n47 203\\r\\n91 138\\r\\n182 148\\r\\n59 125\\r\\n53 35\\r\\n139 177\\r\\n125 49\\r\\n162 176\\r\\n103 43\\r\\n5 9\\r\\n71 148\\r\\n75 113\\r\\n109 117\\r\\n64 63\\r\\n165 102\\r\\n55 201\\r\\n63 164\\r\\n103 199\\r\\n114 112\\r\\n78 118\\r\\n92 1\\r\\n88 87\\r\\n7 143\\r\\n82 20...', 'output': ['No']}, {'input': '325 29179\\r\\n63 201\\r\\n58 26\\r\\n263 208\\r\\n120 257\\r\\n105 236\\r\\n247 207\\r\\n97 169\\r\\n317 178\\r\\n77 214\\r\\n178 172\\r\\n319 322\\r\\n272 172\\r\\n159 139\\r\\n134 153\\r\\n224 8\\r\\n128 208\\r\\n60 212\\r\\n160 264\\r\\n267 99\\r\\n68 167\\r\\n309 19\\r\\n285 245\\r\\n290 16\\r\\n71 137\\r\\n210 90\\r\\n211 320\\r\\n32 38\\r\\n86 284\\r\\n167 250\\r\\n171 17\\r\\n11 175\\r\\n191 224\\r\\n110 247\\r\\n239 76\\r\\n278 53\\r\\n58 138\\r\\n20 240\\r\\n100 204\\r\\n124 156\\r\\n228 241\\r\\n39 299\\r\\n258 124\\r\\n125 324\\r\\n129 67\\r\\n248 295\\r\\n285 9\\r\\n82 106\\r\\n277 107\\r\\n285 23\\r\\n62 244\\r\\n194 32\\r\\n16 204\\r\\n315 111\\r\\n271 184\\r\\n112 79\\r\\n256 195\\r\\n263 173\\r\\n186 309\\r\\n111 13\\r\\n144...', 'output': ['No']}, {'input': '249 15869\\r\\n182 135\\r\\n28 231\\r\\n98 93\\r\\n172 113\\r\\n125 222\\r\\n190 124\\r\\n223 153\\r\\n72 78\\r\\n83 56\\r\\n237 197\\r\\n211 14\\r\\n160 86\\r\\n230 158\\r\\n112 249\\r\\n237 152\\r\\n112 208\\r\\n126 114\\r\\n27 134\\r\\n161 192\\r\\n34 87\\r\\n133 36\\r\\n158 12\\r\\n127 79\\r\\n141 189\\r\\n45 52\\r\\n149 152\\r\\n56 75\\r\\n65 223\\r\\n89 65\\r\\n176 130\\r\\n159 200\\r\\n90 76\\r\\n140 161\\r\\n62 191\\r\\n109 6\\r\\n12 204\\r\\n126 245\\r\\n190 169\\r\\n249 145\\r\\n154 170\\r\\n55 219\\r\\n95 152\\r\\n151 164\\r\\n143 206\\r\\n176 40\\r\\n191 204\\r\\n89 142\\r\\n24 63\\r\\n169 204\\r\\n45 68\\r\\n231 18\\r\\n121 173\\r\\n63 82\\r\\n210 106\\r\\n23 27\\r\\n126 168\\r\\n118 5\\r\\n237 174\\r\\n85 245\\r\\n60 132\\r\\n54 59...', 'output': ['No']}, {'input': '79 470\\r\\n21 47\\r\\n32 21\\r\\n54 38\\r\\n79 11\\r\\n43 1\\r\\n77 31\\r\\n32 26\\r\\n2 25\\r\\n34 27\\r\\n64 74\\r\\n24 66\\r\\n35 70\\r\\n25 49\\r\\n14 38\\r\\n56 13\\r\\n68 59\\r\\n8 47\\r\\n65 4\\r\\n67 15\\r\\n37 17\\r\\n2 34\\r\\n75 79\\r\\n70 50\\r\\n22 67\\r\\n12 45\\r\\n42 67\\r\\n38 37\\r\\n60 65\\r\\n63 67\\r\\n53 11\\r\\n20 54\\r\\n5 43\\r\\n47 34\\r\\n78 67\\r\\n47 62\\r\\n57 26\\r\\n46 67\\r\\n34 24\\r\\n1 14\\r\\n45 17\\r\\n59 3\\r\\n35 1\\r\\n71 72\\r\\n61 26\\r\\n29 25\\r\\n68 63\\r\\n54 1\\r\\n71 42\\r\\n28 43\\r\\n75 8\\r\\n65 47\\r\\n5 65\\r\\n57 65\\r\\n34 14\\r\\n13 12\\r\\n2 38\\r\\n56 27\\r\\n32 20\\r\\n32 56\\r\\n69 5\\r\\n7 26\\r\\n33 13\\r\\n58 6\\r\\n14 33\\r\\n43 57\\r\\n34 37\\r\\n63 20\\r\\n66 58\\r\\n73 55\\r\\n73 59\\r\\n63 15\\r\\n20 18\\r\\n72 13\\r\\n32 52\\r\\n3...', 'output': ['No']}, {'input': '364 37645\\r\\n234 245\\r\\n23 215\\r\\n289 8\\r\\n262 24\\r\\n324 302\\r\\n75 8\\r\\n227 43\\r\\n228 116\\r\\n312 48\\r\\n132 247\\r\\n248 178\\r\\n101 353\\r\\n148 2\\r\\n162 155\\r\\n143 313\\r\\n169 26\\r\\n347 13\\r\\n182 336\\r\\n291 176\\r\\n169 261\\r\\n79 267\\r\\n9 41\\r\\n265 152\\r\\n264 109\\r\\n272 362\\r\\n5 54\\r\\n337 131\\r\\n210 45\\r\\n141 285\\r\\n309 211\\r\\n147 266\\r\\n338 247\\r\\n298 339\\r\\n48 32\\r\\n7 154\\r\\n187 272\\r\\n89 125\\r\\n266 66\\r\\n202 276\\r\\n191 317\\r\\n248 286\\r\\n180 214\\r\\n178 296\\r\\n125 294\\r\\n35 55\\r\\n239 284\\r\\n198 274\\r\\n60 23\\r\\n297 185\\r\\n157 88\\r\\n133 172\\r\\n118 75\\r\\n305 146\\r\\n350 215\\r\\n290 94\\r\\n246 44\\r\\n96 49\\r\\n343 4\\r\\n340 38\\r\\n227 269\\r\\n...', 'output': ['No']}, {'input': '492 83130\\r\\n222 169\\r\\n470 311\\r\\n326 138\\r\\n185 373\\r\\n453 465\\r\\n461 345\\r\\n37 227\\r\\n18 329\\r\\n196 103\\r\\n2 242\\r\\n410 139\\r\\n366 82\\r\\n229 100\\r\\n218 225\\r\\n113 442\\r\\n340 466\\r\\n471 222\\r\\n423 431\\r\\n55 6\\r\\n250 251\\r\\n181 290\\r\\n194 294\\r\\n249 262\\r\\n199 248\\r\\n462 7\\r\\n105 158\\r\\n259 461\\r\\n288 487\\r\\n131 217\\r\\n332 378\\r\\n222 177\\r\\n128 33\\r\\n488 45\\r\\n278 106\\r\\n348 256\\r\\n268 460\\r\\n419 438\\r\\n174 368\\r\\n338 221\\r\\n262 199\\r\\n405 283\\r\\n91 264\\r\\n425 334\\r\\n189 344\\r\\n421 405\\r\\n115 309\\r\\n202 322\\r\\n444 423\\r\\n351 440\\r\\n192 424\\r\\n276 41\\r\\n464 375\\r\\n399 228\\r\\n44 390\\r\\n286 114\\r\\n364 130\\r\\n347 260\\r\\n25...', 'output': ['No']}, {'input': '19 165\\r\\n7 17\\r\\n19 8\\r\\n16 8\\r\\n14 12\\r\\n7 8\\r\\n10 15\\r\\n11 16\\r\\n9 15\\r\\n6 15\\r\\n11 18\\r\\n19 18\\r\\n16 14\\r\\n11 19\\r\\n2 18\\r\\n17 1\\r\\n19 12\\r\\n8 14\\r\\n5 10\\r\\n5 1\\r\\n17 10\\r\\n9 2\\r\\n3 15\\r\\n16 19\\r\\n2 12\\r\\n15 12\\r\\n9 18\\r\\n6 14\\r\\n8 12\\r\\n1 8\\r\\n15 18\\r\\n16 1\\r\\n16 18\\r\\n2 1\\r\\n4 8\\r\\n9 8\\r\\n5 13\\r\\n10 13\\r\\n6 16\\r\\n9 13\\r\\n7 15\\r\\n2 10\\r\\n11 7\\r\\n17 14\\r\\n11 17\\r\\n6 8\\r\\n4 17\\r\\n17 8\\r\\n11 10\\r\\n17 12\\r\\n2 6\\r\\n5 12\\r\\n6 13\\r\\n11 13\\r\\n1 15\\r\\n16 12\\r\\n5 19\\r\\n2 13\\r\\n5 16\\r\\n6 10\\r\\n4 19\\r\\n9 6\\r\\n11 14\\r\\n17 15\\r\\n4 3\\r\\n7 10\\r\\n8 3\\r\\n14 18\\r\\n7 5\\r\\n17 19\\r\\n6 12\\r\\n1 18\\r\\n11 6\\r\\n4 9\\r\\n3 18\\r\\n16 13\\r\\n11 9\\r\\n4 15\\r\\n6 19\\r\\n7 9\\r\\n4 5\\r\\n4 6\\r\\n16 15\\r\\n13...', 'output': ['No']}, {'input': '31 453\\r\\n6 22\\r\\n7 26\\r\\n9 6\\r\\n18 30\\r\\n1 30\\r\\n20 18\\r\\n16 26\\r\\n7 18\\r\\n16 27\\r\\n3 17\\r\\n6 14\\r\\n22 18\\r\\n9 17\\r\\n27 21\\r\\n8 10\\r\\n16 19\\r\\n15 6\\r\\n1 3\\r\\n31 27\\r\\n25 19\\r\\n28 15\\r\\n7 2\\r\\n25 27\\r\\n31 23\\r\\n27 12\\r\\n10 7\\r\\n16 4\\r\\n12 2\\r\\n14 3\\r\\n16 1\\r\\n1 2\\r\\n10 19\\r\\n2 30\\r\\n9 29\\r\\n25 31\\r\\n25 21\\r\\n1 19\\r\\n2 24\\r\\n7 3\\r\\n9 27\\r\\n13 12\\r\\n26 2\\r\\n22 26\\r\\n15 9\\r\\n4 19\\r\\n9 21\\r\\n23 24\\r\\n19 24\\r\\n23 7\\r\\n22 17\\r\\n21 2\\r\\n29 27\\r\\n15 31\\r\\n29 3\\r\\n28 22\\r\\n8 9\\r\\n28 8\\r\\n18 24\\r\\n15 7\\r\\n29 19\\r\\n25 2\\r\\n10 2\\r\\n27 17\\r\\n16 30\\r\\n21 1\\r\\n13 21\\r\\n12 1\\r\\n20 2\\r\\n9 13\\r\\n14 27\\r\\n9 4\\r\\n8 26\\r\\n8 30\\r\\n14 18\\r\\n4 2\\r\\n29 23\\r\\n17 24\\r\\n28 17\\r\\n7 17\\r\\n6 2...', 'output': ['No']}, {'input': '15 103\\r\\n5 10\\r\\n7 8\\r\\n1 8\\r\\n14 3\\r\\n13 9\\r\\n6 8\\r\\n11 4\\r\\n8 3\\r\\n11 3\\r\\n13 4\\r\\n12 11\\r\\n11 10\\r\\n15 10\\r\\n15 5\\r\\n13 11\\r\\n6 1\\r\\n2 5\\r\\n2 10\\r\\n7 14\\r\\n7 3\\r\\n6 5\\r\\n2 3\\r\\n14 2\\r\\n6 11\\r\\n1 15\\r\\n13 7\\r\\n5 3\\r\\n11 9\\r\\n13 5\\r\\n1 7\\r\\n6 10\\r\\n1 12\\r\\n1 4\\r\\n6 13\\r\\n2 9\\r\\n13 12\\r\\n5 4\\r\\n7 5\\r\\n13 14\\r\\n13 3\\r\\n7 9\\r\\n2 4\\r\\n15 11\\r\\n14 11\\r\\n13 8\\r\\n9 5\\r\\n3 4\\r\\n11 5\\r\\n6 3\\r\\n12 8\\r\\n6 12\\r\\n12 3\\r\\n14 10\\r\\n9 4\\r\\n15 14\\r\\n12 9\\r\\n10 4\\r\\n8 10\\r\\n14 5\\r\\n12 7\\r\\n13 1\\r\\n13 2\\r\\n6 7\\r\\n8 4\\r\\n6 15\\r\\n1 14\\r\\n7 10\\r\\n1 9\\r\\n12 4\\r\\n1 11\\r\\n12 2\\r\\n8 9\\r\\n15 2\\r\\n15 4\\r\\n14 4\\r\\n15 8\\r\\n8 2\\r\\n15 12\\r\\n14 9\\r\\n2 11\\r\\n9 3\\r\\n1 3\\r\\n8 14\\r\\n15 7\\r\\n7 11\\r\\n10 3\\r\\n8 5\\r...', 'output': ['No']}, {'input': '138 8693\\r\\n70 85\\r\\n122 58\\r\\n11 119\\r\\n111 59\\r\\n135 123\\r\\n131 89\\r\\n22 89\\r\\n38 54\\r\\n86 38\\r\\n100 37\\r\\n55 4\\r\\n79 18\\r\\n108 75\\r\\n73 66\\r\\n30 9\\r\\n84 48\\r\\n108 5\\r\\n74 60\\r\\n63 79\\r\\n121 54\\r\\n15 121\\r\\n100 105\\r\\n22 110\\r\\n67 36\\r\\n113 103\\r\\n133 27\\r\\n88 90\\r\\n104 46\\r\\n96 57\\r\\n74 67\\r\\n121 109\\r\\n32 25\\r\\n28 80\\r\\n13 39\\r\\n60 116\\r\\n120 52\\r\\n32 69\\r\\n34 62\\r\\n13 38\\r\\n111 78\\r\\n10 67\\r\\n21 92\\r\\n27 113\\r\\n21 25\\r\\n49 18\\r\\n24 113\\r\\n34 126\\r\\n6 25\\r\\n138 23\\r\\n81 129\\r\\n94 127\\r\\n24 55\\r\\n15 32\\r\\n14 55\\r\\n79 22\\r\\n28 38\\r\\n94 54\\r\\n57 89\\r\\n16 56\\r\\n15 27\\r\\n51 7\\r\\n27 53\\r\\n117 19\\r\\n56 36\\r\\n72 11\\r\\n135 62\\r\\n79 68\\r\\n78 85\\r...', 'output': ['No']}, {'input': '289 39856\\r\\n147 39\\r\\n46 270\\r\\n57 96\\r\\n86 262\\r\\n75 161\\r\\n73 62\\r\\n191 156\\r\\n163 260\\r\\n228 124\\r\\n281 47\\r\\n247 230\\r\\n197 36\\r\\n171 206\\r\\n206 223\\r\\n263 207\\r\\n235 70\\r\\n129 192\\r\\n83 177\\r\\n201 278\\r\\n68 99\\r\\n119 280\\r\\n279 223\\r\\n208 187\\r\\n215 25\\r\\n204 110\\r\\n207 259\\r\\n252 63\\r\\n63 183\\r\\n271 55\\r\\n22 186\\r\\n56 149\\r\\n89 136\\r\\n267 27\\r\\n7 164\\r\\n119 37\\r\\n247 8\\r\\n43 54\\r\\n145 111\\r\\n162 178\\r\\n42 41\\r\\n3 15\\r\\n158 212\\r\\n123 25\\r\\n228 7\\r\\n72 101\\r\\n9 107\\r\\n19 203\\r\\n279 232\\r\\n289 274\\r\\n80 28\\r\\n155 26\\r\\n206 140\\r\\n288 182\\r\\n139 129\\r\\n282 199\\r\\n96 238\\r\\n241 211\\r\\n102 58\\r\\n180 177\\r\\n76 250\\r\\n241 88\\r...', 'output': ['No']}, {'input': '4 6\\r\\n4 2\\r\\n3 1\\r\\n3 4\\r\\n3 2\\r\\n4 1\\r\\n2 1\\r\\n', 'output': ['Yes\\r\\ncbbb', 'Yes\\r\\nbbbb', 'Yes\\r\\naaaa']}, {'input': '4 4\\r\\n3 2\\r\\n2 4\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['Yes\\r\\ncbaa', 'Yes\\r\\nabcc']}, {'input': '4 3\\r\\n1 3\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['Yes\\r\\ncacc', 'Yes\\r\\nacaa']}, {'input': '4 4\\r\\n1 2\\r\\n4 1\\r\\n3 4\\r\\n3 1\\r\\n', 'output': ['Yes\\r\\nbcaa', 'Yes\\r\\nbacc']}, {'input': '4 4\\r\\n4 2\\r\\n3 4\\r\\n3 1\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\ncaba', 'Yes\\r\\nacbc']}, {'input': '4 5\\r\\n3 1\\r\\n2 1\\r\\n3 4\\r\\n2 4\\r\\n3 2\\r\\n', 'output': ['Yes\\r\\nabbc', 'Yes\\r\\ncbba']}, {'input': '4 4\\r\\n4 1\\r\\n3 1\\r\\n3 2\\r\\n3 4\\r\\n', 'output': ['Yes\\r\\ncabc', 'Yes\\r\\nacba']}, {'input': '4 5\\r\\n3 4\\r\\n2 1\\r\\n3 1\\r\\n4 1\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\nbcba', 'Yes\\r\\nbabc']}, {'input': '4 4\\r\\n1 3\\r\\n3 4\\r\\n2 1\\r\\n3 2\\r\\n', 'output': ['Yes\\r\\nccba', 'Yes\\r\\naabc']}, {'input': '4 3\\r\\n2 1\\r\\n1 4\\r\\n2 4\\r\\n', 'output': ['Yes\\r\\naaca', 'Yes\\r\\nccac']}, {'input': '4 4\\r\\n2 4\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n', 'output': ['Yes\\r\\nbcac', 'Yes\\r\\nbaca']}, {'input': '4 2\\r\\n3 1\\r\\n2 4\\r\\n', 'output': ['Yes\\r\\nacac', 'Yes\\r\\ncaca']}, {'input': '4 4\\r\\n4 2\\r\\n2 1\\r\\n3 2\\r\\n1 4\\r\\n', 'output': ['Yes\\r\\ncbac', 'Yes\\r\\nabca']}, {'input': '4 5\\r\\n4 1\\r\\n2 4\\r\\n2 1\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['Yes\\r\\nbbac', 'Yes\\r\\nbbca']}, {'input': '4 4\\r\\n1 2\\r\\n3 1\\r\\n2 4\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\ncbca', 'Yes\\r\\nabac']}, {'input': '4 2\\r\\n2 3\\r\\n1 4\\r\\n', 'output': ['Yes\\r\\ncaac', 'Yes\\r\\nacca']}, {'input': '4 4\\r\\n2 1\\r\\n1 4\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['Yes\\r\\nbaac', 'Yes\\r\\nbcca']}, {'input': '4 3\\r\\n3 2\\r\\n1 2\\r\\n1 3\\r\\n', 'output': ['Yes\\r\\nccca', 'Yes\\r\\naaac']}, {'input': '4 4\\r\\n3 2\\r\\n2 4\\r\\n3 4\\r\\n4 1\\r\\n', 'output': ['Yes\\r\\naccb', 'Yes\\r\\ncaab']}, {'input': '4 5\\r\\n4 2\\r\\n3 2\\r\\n4 3\\r\\n4 1\\r\\n2 1\\r\\n', 'output': ['Yes\\r\\ncbab', 'Yes\\r\\nabcb']}, {'input': '4 4\\r\\n3 1\\r\\n2 4\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['Yes\\r\\nacab', 'Yes\\r\\ncacb']}, {'input': '4 5\\r\\n3 1\\r\\n4 3\\r\\n4 1\\r\\n2 1\\r\\n2 4\\r\\n', 'output': ['Yes\\r\\nbcab', 'Yes\\r\\nbacb']}, {'input': '4 4\\r\\n2 4\\r\\n3 4\\r\\n1 2\\r\\n4 1\\r\\n', 'output': ['Yes\\r\\naacb', 'Yes\\r\\nccab']}, {'input': '4 5\\r\\n1 4\\r\\n4 3\\r\\n4 2\\r\\n3 2\\r\\n1 3\\r\\n', 'output': ['Yes\\r\\ncabb', 'Yes\\r\\nacbb']}, {'input': '2 0\\r\\n', 'output': ['Yes\\r\\nca', 'Yes\\r\\nac']}, {'input': '3 0\\r\\n', 'output': ['No']}, {'input': '3 1\\r\\n1 2\\r\\n', 'output': ['Yes\\r\\ncca', 'Yes\\r\\naac']}, {'input': '3 2\\r\\n1 2\\r\\n3 2\\r\\n', 'output': ['Yes\\r\\ncba', 'Yes\\r\\nabc']}, {'input': '3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\naaa', 'Yes\\r\\ncbb', 'Yes\\r\\nbbb']}, {'input': '3 1\\r\\n2 3\\r\\n', 'output': ['Yes\\r\\nacc', 'Yes\\r\\ncaa']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['Yes\\r\\naca', 'Yes\\r\\ncac']}, {'input': '4 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n', 'output': ['No']}, {'input': '5 9\\r\\n4 3\\r\\n4 2\\r\\n3 1\\r\\n5 1\\r\\n4 1\\r\\n2 1\\r\\n5 2\\r\\n3 2\\r\\n5 4\\r\\n', 'output': ['Yes\\r\\nbbcba', 'Yes\\r\\nbbabc']}, {'input': '19 107\\r\\n19 8\\r\\n1 3\\r\\n1 17\\r\\n13 18\\r\\n3 4\\r\\n2 16\\r\\n13 16\\r\\n14 8\\r\\n10 5\\r\\n15 6\\r\\n13 17\\r\\n1 13\\r\\n6 5\\r\\n12 5\\r\\n6 2\\r\\n1 16\\r\\n9 7\\r\\n11 5\\r\\n3 5\\r\\n19 9\\r\\n13 10\\r\\n16 18\\r\\n10 2\\r\\n13 11\\r\\n2 18\\r\\n8 15\\r\\n17 18\\r\\n14 15\\r\\n11 4\\r\\n1 2\\r\\n15 16\\r\\n10 16\\r\\n6 13\\r\\n17 16\\r\\n1 11\\r\\n6 16\\r\\n13 2\\r\\n11 2\\r\\n10 11\\r\\n6 12\\r\\n19 14\\r\\n12 18\\r\\n11 12\\r\\n18 3\\r\\n15 17\\r\\n7 8\\r\\n12 2\\r\\n1 12\\r\\n11 16\\r\\n17 3\\r\\n16 5\\r\\n13 3\\r\\n4 5\\r\\n16 4\\r\\n9 14\\r\\n18 4\\r\\n15 4\\r\\n9 15\\r\\n9 8\\r\\n13 4\\r\\n15 18\\r\\n18 5\\r\\n12 3\\r\\n16 3\\r\\n1 5\\r\\n2 4\\r\\n15 11\\r\\n19 7\\r\\n10 4\\r\\n15 3\\r\\n15 2\\r\\n10 3\\r\\n17 5\\r\\n1 6\\r\\n6 10\\r\\n2 3\\r\\n10 12\\r\\n15 1\\r\\n19 15\\r\\n17 12\\r\\n6 3\\r\\n12 16\\r\\n15 ...', 'output': ['No']}, {'input': '16 118\\r\\n10 2\\r\\n3 8\\r\\n10 3\\r\\n1 8\\r\\n6 13\\r\\n4 12\\r\\n10 4\\r\\n9 11\\r\\n5 8\\r\\n4 14\\r\\n16 12\\r\\n7 2\\r\\n15 3\\r\\n1 13\\r\\n3 12\\r\\n16 8\\r\\n16 13\\r\\n7 6\\r\\n7 1\\r\\n10 7\\r\\n15 2\\r\\n16 15\\r\\n15 14\\r\\n6 9\\r\\n16 9\\r\\n16 4\\r\\n3 11\\r\\n10 15\\r\\n3 1\\r\\n15 8\\r\\n5 16\\r\\n5 4\\r\\n7 14\\r\\n11 12\\r\\n7 9\\r\\n15 13\\r\\n11 13\\r\\n9 1\\r\\n4 2\\r\\n4 8\\r\\n10 14\\r\\n7 4\\r\\n8 13\\r\\n2 9\\r\\n5 11\\r\\n3 14\\r\\n7 8\\r\\n5 6\\r\\n2 12\\r\\n4 9\\r\\n15 1\\r\\n9 8\\r\\n7 3\\r\\n15 4\\r\\n11 8\\r\\n15 11\\r\\n2 11\\r\\n10 1\\r\\n3 2\\r\\n10 11\\r\\n5 13\\r\\n8 14\\r\\n5 2\\r\\n10 5\\r\\n12 8\\r\\n5 3\\r\\n2 1\\r\\n4 13\\r\\n4 11\\r\\n10 12\\r\\n6 3\\r\\n5 1\\r\\n6 12\\r\\n3 13\\r\\n6 4\\r\\n7 11\\r\\n16 2\\r\\n10 16\\r\\n2 8\\r\\n9 13\\r\\n5 14\\r\\n15 12\\r\\n16 7\\r\\n6 1\\r\\n7 15\\r\\n2 14\\r\\n3 ...', 'output': ['No']}, {'input': '87 3738\\r\\n74 11\\r\\n62 65\\r\\n22 53\\r\\n12 78\\r\\n21 56\\r\\n40 47\\r\\n14 86\\r\\n12 16\\r\\n6 48\\r\\n72 18\\r\\n68 7\\r\\n73 31\\r\\n60 64\\r\\n49 56\\r\\n23 20\\r\\n26 57\\r\\n81 51\\r\\n4 12\\r\\n75 85\\r\\n13 77\\r\\n5 20\\r\\n31 50\\r\\n46 49\\r\\n9 50\\r\\n5 16\\r\\n31 46\\r\\n16 20\\r\\n43 18\\r\\n56 53\\r\\n59 22\\r\\n63 46\\r\\n26 60\\r\\n1 87\\r\\n34 69\\r\\n69 11\\r\\n84 77\\r\\n59 65\\r\\n32 56\\r\\n71 35\\r\\n7 60\\r\\n2 12\\r\\n68 73\\r\\n72 35\\r\\n30 10\\r\\n58 61\\r\\n34 37\\r\\n32 22\\r\\n1 65\\r\\n83 10\\r\\n46 24\\r\\n31 82\\r\\n18 33\\r\\n34 17\\r\\n18 57\\r\\n4 63\\r\\n13 10\\r\\n33 57\\r\\n32 27\\r\\n49 14\\r\\n3 78\\r\\n69 81\\r\\n46 77\\r\\n70 37\\r\\n39 26\\r\\n17 30\\r\\n63 65\\r\\n83 54\\r\\n75 48\\r\\n26 33\\r\\n11 22\\r\\n17 65\\r\\n32 12\\r\\n5 43\\r\\n73 1...', 'output': ['Yes\\r\\nbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbb', 'Yes\\r\\nbbbbbbbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccbbbbbbbb']}, {'input': '17 115\\r\\n6 12\\r\\n5 4\\r\\n5 17\\r\\n8 6\\r\\n16 6\\r\\n1 10\\r\\n7 4\\r\\n13 7\\r\\n13 5\\r\\n5 7\\r\\n9 3\\r\\n3 12\\r\\n16 13\\r\\n14 1\\r\\n14 7\\r\\n15 14\\r\\n14 17\\r\\n5 6\\r\\n5 12\\r\\n15 2\\r\\n15 13\\r\\n17 12\\r\\n15 8\\r\\n1 12\\r\\n1 6\\r\\n7 12\\r\\n1 9\\r\\n16 8\\r\\n4 12\\r\\n14 11\\r\\n14 8\\r\\n7 17\\r\\n13 9\\r\\n15 1\\r\\n8 7\\r\\n6 3\\r\\n2 4\\r\\n6 4\\r\\n15 16\\r\\n11 17\\r\\n8 17\\r\\n13 6\\r\\n15 9\\r\\n16 2\\r\\n13 11\\r\\n7 6\\r\\n10 4\\r\\n8 1\\r\\n13 17\\r\\n11 7\\r\\n9 10\\r\\n8 2\\r\\n15 10\\r\\n11 8\\r\\n16 10\\r\\n17 3\\r\\n14 9\\r\\n2 1\\r\\n11 1\\r\\n15 17\\r\\n8 5\\r\\n13 2\\r\\n2 5\\r\\n7 3\\r\\n8 9\\r\\n10 17\\r\\n7 10\\r\\n17 4\\r\\n1 17\\r\\n15 11\\r\\n5 1\\r\\n4 3\\r\\n9 12\\r\\n16 1\\r\\n16 9\\r\\n2 9\\r\\n14 6\\r\\n11 9\\r\\n13 8\\r\\n10 3\\r\\n14 13\\r\\n9 6\\r\\n16 7\\r\\n11 2\\r\\n17 6\\r\\n2...', 'output': ['No']}, {'input': '88 2089\\r\\n82 7\\r\\n52 57\\r\\n51 43\\r\\n3 60\\r\\n58 85\\r\\n59 23\\r\\n1 37\\r\\n55 57\\r\\n87 50\\r\\n68 74\\r\\n22 4\\r\\n68 37\\r\\n49 60\\r\\n58 7\\r\\n68 51\\r\\n76 5\\r\\n84 36\\r\\n86 39\\r\\n24 66\\r\\n2 56\\r\\n49 24\\r\\n6 65\\r\\n3 42\\r\\n88 21\\r\\n39 10\\r\\n30 35\\r\\n58 23\\r\\n25 83\\r\\n68 38\\r\\n49 68\\r\\n8 29\\r\\n68 67\\r\\n51 11\\r\\n87 17\\r\\n47 21\\r\\n84 25\\r\\n44 39\\r\\n34 48\\r\\n78 53\\r\\n14 86\\r\\n24 58\\r\\n59 67\\r\\n33 40\\r\\n2 75\\r\\n74 23\\r\\n56 26\\r\\n29 77\\r\\n78 28\\r\\n62 42\\r\\n9 45\\r\\n32 84\\r\\n27 45\\r\\n15 13\\r\\n7 10\\r\\n34 47\\r\\n41 50\\r\\n5 21\\r\\n2 78\\r\\n1 49\\r\\n14 63\\r\\n7 80\\r\\n58 43\\r\\n33 83\\r\\n82 33\\r\\n70 11\\r\\n77 10\\r\\n63 7\\r\\n4 13\\r\\n60 11\\r\\n41 77\\r\\n4 67\\r\\n3 50\\r\\n71 35\\r\\n49 62\\r\\n40 65...', 'output': ['No']}, {'input': '6 9\\r\\n1 4\\r\\n1 6\\r\\n3 6\\r\\n5 4\\r\\n2 6\\r\\n3 5\\r\\n4 6\\r\\n1 5\\r\\n5 6\\r\\n', 'output': ['No']}, {'input': '37 665\\r\\n11 20\\r\\n10 9\\r\\n17 37\\r\\n26 30\\r\\n19 13\\r\\n2 17\\r\\n27 13\\r\\n27 10\\r\\n1 12\\r\\n8 7\\r\\n15 8\\r\\n5 3\\r\\n32 1\\r\\n30 8\\r\\n14 31\\r\\n11 29\\r\\n37 12\\r\\n5 16\\r\\n30 34\\r\\n26 14\\r\\n35 12\\r\\n4 12\\r\\n6 3\\r\\n15 36\\r\\n14 35\\r\\n21 36\\r\\n23 30\\r\\n2 35\\r\\n5 31\\r\\n13 10\\r\\n6 35\\r\\n17 36\\r\\n4 19\\r\\n12 7\\r\\n4 1\\r\\n35 33\\r\\n27 16\\r\\n11 17\\r\\n36 18\\r\\n27 5\\r\\n1 7\\r\\n24 3\\r\\n22 36\\r\\n27 4\\r\\n6 5\\r\\n15 37\\r\\n37 28\\r\\n22 24\\r\\n23 12\\r\\n6 1\\r\\n25 12\\r\\n27 9\\r\\n5 12\\r\\n3 18\\r\\n35 9\\r\\n31 29\\r\\n11 36\\r\\n15 10\\r\\n15 21\\r\\n19 30\\r\\n3 20\\r\\n27 31\\r\\n32 31\\r\\n23 33\\r\\n13 8\\r\\n6 36\\r\\n22 3\\r\\n2 28\\r\\n16 11\\r\\n5 4\\r\\n22 31\\r\\n24 19\\r\\n4 18\\r\\n24 36\\r\\n2 8\\r\\n16 37\\r\\n27 23\\r\\n35 20\\r\\n2...', 'output': ['Yes\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbcbbbbabbbbbb', 'Yes\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbabbbbcbbbbbb']}, {'input': '8 21\\r\\n4 7\\r\\n7 8\\r\\n6 4\\r\\n8 5\\r\\n8 1\\r\\n3 4\\r\\n4 8\\r\\n4 5\\r\\n6 7\\r\\n6 8\\r\\n7 1\\r\\n4 2\\r\\n1 5\\r\\n6 5\\r\\n8 2\\r\\n3 6\\r\\n5 2\\r\\n7 5\\r\\n1 2\\r\\n7 2\\r\\n4 1\\r\\n', 'output': ['No']}, {'input': '66 1669\\r\\n31 41\\r\\n19 24\\r\\n19 26\\r\\n40 46\\r\\n34 57\\r\\n13 6\\r\\n25 13\\r\\n25 21\\r\\n23 8\\r\\n3 21\\r\\n50 51\\r\\n34 60\\r\\n54 15\\r\\n66 15\\r\\n26 56\\r\\n50 21\\r\\n38 8\\r\\n50 10\\r\\n58 2\\r\\n48 58\\r\\n9 10\\r\\n41 46\\r\\n47 40\\r\\n64 9\\r\\n23 44\\r\\n18 6\\r\\n37 46\\r\\n66 6\\r\\n23 40\\r\\n18 51\\r\\n43 42\\r\\n9 56\\r\\n58 66\\r\\n43 57\\r\\n50 61\\r\\n47 66\\r\\n20 61\\r\\n58 15\\r\\n27 25\\r\\n16 33\\r\\n60 5\\r\\n7 8\\r\\n56 40\\r\\n64 15\\r\\n57 17\\r\\n7 19\\r\\n19 17\\r\\n30 56\\r\\n62 7\\r\\n28 47\\r\\n33 54\\r\\n55 66\\r\\n32 10\\r\\n58 50\\r\\n53 2\\r\\n9 46\\r\\n41 61\\r\\n20 29\\r\\n54 56\\r\\n51 44\\r\\n59 63\\r\\n11 35\\r\\n14 44\\r\\n22 38\\r\\n59 49\\r\\n28 13\\r\\n54 51\\r\\n13 21\\r\\n17 61\\r\\n47 15\\r\\n51 21\\r\\n27 4\\r\\n21 2\\r\\n9 2\\r\\n26 33...', 'output': ['Yes\\r\\ncccbbcbcccabbcccccbccabcbcaacbaccaaacbccbaacacbacccabcccbbbbcacbcc', 'Yes\\r\\naaabbabaaacbbaaaaabaacbabaccabcaacccabaabccacabcaaacbaaabbbbacabaa']}, {'input': '149 10727\\r\\n28 3\\r\\n43 131\\r\\n54 20\\r\\n45 90\\r\\n69 103\\r\\n6 130\\r\\n7 49\\r\\n65 54\\r\\n127 82\\r\\n113 3\\r\\n86 108\\r\\n104 148\\r\\n3 14\\r\\n32 25\\r\\n104 49\\r\\n57 145\\r\\n63 20\\r\\n105 131\\r\\n114 37\\r\\n69 119\\r\\n34 72\\r\\n55 33\\r\\n26 93\\r\\n75 145\\r\\n53 61\\r\\n29 73\\r\\n88 108\\r\\n104 66\\r\\n43 98\\r\\n69 16\\r\\n5 88\\r\\n38 77\\r\\n102 145\\r\\n95 137\\r\\n69 80\\r\\n96 55\\r\\n34 82\\r\\n49 148\\r\\n91 56\\r\\n39 62\\r\\n80 73\\r\\n118 94\\r\\n45 143\\r\\n97 107\\r\\n70 84\\r\\n56 21\\r\\n2 80\\r\\n34 144\\r\\n88 121\\r\\n127 14\\r\\n5 31\\r\\n64 46\\r\\n78 54\\r\\n38 13\\r\\n117 105\\r\\n82 136\\r\\n137 17\\r\\n29 95\\r\\n107 108\\r\\n97 149\\r\\n94 110\\r\\n91 75\\r\\n2 134\\r\\n125 144\\r\\n5 3\\r\\n65 53\\r\\n84 78\\r\\n92 1...', 'output': ['No']}, {'input': '139 6924\\r\\n129 4\\r\\n134 73\\r\\n127 92\\r\\n138 79\\r\\n128 50\\r\\n57 123\\r\\n43 101\\r\\n101 133\\r\\n81 41\\r\\n109 74\\r\\n116 21\\r\\n77 67\\r\\n35 121\\r\\n92 38\\r\\n77 71\\r\\n108 23\\r\\n39 36\\r\\n114 37\\r\\n123 29\\r\\n47 114\\r\\n25 39\\r\\n44 114\\r\\n59 129\\r\\n137 40\\r\\n120 130\\r\\n14 132\\r\\n97 85\\r\\n76 49\\r\\n109 57\\r\\n76 56\\r\\n104 99\\r\\n35 134\\r\\n76 54\\r\\n128 109\\r\\n101 68\\r\\n111 130\\r\\n42 106\\r\\n38 22\\r\\n128 101\\r\\n129 56\\r\\n103 65\\r\\n90 59\\r\\n129 73\\r\\n43 93\\r\\n101 134\\r\\n72 74\\r\\n32 81\\r\\n12 40\\r\\n38 81\\r\\n75 115\\r\\n69 4\\r\\n87 99\\r\\n95 23\\r\\n83 34\\r\\n53 66\\r\\n16 15\\r\\n14 103\\r\\n26 91\\r\\n124 21\\r\\n76 122\\r\\n72 114\\r\\n93 41\\r\\n24 100\\r\\n5 127\\r\\n51 111\\r\\n22 ...', 'output': ['No']}, {'input': '278 36658\\r\\n178 184\\r\\n186 61\\r\\n167 140\\r\\n61 130\\r\\n244 109\\r\\n129 98\\r\\n130 26\\r\\n54 103\\r\\n230 152\\r\\n161 192\\r\\n22 68\\r\\n193 277\\r\\n69 231\\r\\n75 200\\r\\n164 172\\r\\n236 184\\r\\n242 275\\r\\n217 184\\r\\n207 267\\r\\n158 223\\r\\n256 51\\r\\n272 228\\r\\n161 199\\r\\n11 51\\r\\n187 29\\r\\n11 273\\r\\n97 98\\r\\n277 239\\r\\n149 235\\r\\n171 197\\r\\n235 41\\r\\n171 211\\r\\n101 175\\r\\n23 154\\r\\n18 228\\r\\n86 123\\r\\n112 192\\r\\n10 79\\r\\n225 84\\r\\n96 157\\r\\n179 198\\r\\n231 263\\r\\n195 193\\r\\n69 274\\r\\n202 134\\r\\n54 29\\r\\n273 103\\r\\n36 156\\r\\n167 212\\r\\n241 251\\r\\n110 103\\r\\n190 156\\r\\n246 129\\r\\n150 37\\r\\n103 133\\r\\n278 244\\r\\n129 169\\r\\n125 250\\r\\n214 12\\r...', 'output': ['No']}, {'input': '434 69531\\r\\n227 383\\r\\n211 24\\r\\n281 157\\r\\n426 187\\r\\n171 248\\r\\n127 153\\r\\n355 410\\r\\n141 409\\r\\n170 212\\r\\n384 56\\r\\n265 275\\r\\n212 188\\r\\n144 356\\r\\n228 128\\r\\n372 179\\r\\n361 379\\r\\n151 100\\r\\n186 72\\r\\n120 321\\r\\n259 428\\r\\n267 32\\r\\n418 363\\r\\n123 310\\r\\n338 298\\r\\n172 153\\r\\n203 221\\r\\n157 372\\r\\n272 217\\r\\n88 8\\r\\n227 254\\r\\n274 395\\r\\n302 251\\r\\n3 257\\r\\n317 3\\r\\n427 409\\r\\n134 257\\r\\n251 420\\r\\n101 215\\r\\n52 99\\r\\n98 203\\r\\n125 206\\r\\n221 97\\r\\n68 385\\r\\n98 129\\r\\n401 256\\r\\n219 24\\r\\n65 195\\r\\n335 389\\r\\n389 168\\r\\n35 297\\r\\n11 24\\r\\n353 260\\r\\n107 85\\r\\n149 88\\r\\n338 89\\r\\n238 7\\r\\n107 94\\r\\n136 157\\r\\n31 46\\r...', 'output': ['No']}, {'input': '4 3\\r\\n1 4\\r\\n1 3\\r\\n2 4\\r\\n', 'output': ['No']}, {'input': '4 4\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n', 'output': ['No']}, {'input': '4 3\\r\\n1 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['No']}, {'input': '4 3\\r\\n1 3\\r\\n2 4\\r\\n1 4\\r\\n', 'output': ['No']}, {'input': '5 6\\r\\n1 2\\r\\n2 4\\r\\n2 5\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n', 'output': ['No']}, {'input': '6 10\\r\\n1 5\\r\\n1 4\\r\\n3 4\\r\\n3 6\\r\\n1 2\\r\\n3 5\\r\\n2 5\\r\\n2 6\\r\\n1 6\\r\\n4 6\\r\\n', 'output': ['No']}, {'input': '4 3\\r\\n1 2\\r\\n3 4\\r\\n2 3\\r\\n', 'output': ['No']}]","id":402} {"difficulty":2500,"lang":"Go","lang_cluster":"Go","src_uid":"e7e0f9069166fe992abe6f0e19caa6a1","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n \"fmt\"\n \"sort\"\n)\n\nconst N = 500000\n\nfunc IntMin(x, y int) int {\n if x < y {\n return x\n }\n return y\n}\n\nvar v, stk [N]int\n\nfunc main() {\n var n, top int = 0, 0\n var res int64 = 0\n fmt.Scan(&n)\n for i := 0; i < n; i++ {\n fmt.Scan(&v[i])\n for top >= 2 && stk[top-2] >= stk[top-1] && stk[top-1] <= v[i] {\n res += int64(IntMin(v[i], stk[top-2]))\n top--\n }\n stk[top] = v[i]\n top++\n }\n sort.Sort(sort.IntSlice(stk[:top]))\n for i := 0; i < top-2; i++ {\n res += int64(stk[i])\n }\n fmt.Println(res)\n}\n","description":"Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a,\u2009b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn't have an adjacent number to the left or right, Artem doesn't get any points. After the element is removed, the two parts of the array glue together resulting in the new array that Artem continues playing with. Borya wondered what maximum total number of points Artem can get as he plays this game.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20095\u00b7105) \u2014 the number of elements in the array. The next line contains n integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009106) \u2014 the values of the array elements.","output_specification":"In a single line print a single integer \u2014 the maximum number of points Artem can get.","notes":null,"sample_inputs":["5\n3 1 5 2 6","5\n1 2 3 4 5","5\n1 100 101 100 1"],"sample_outputs":["11","6","102"],"human_solution":"package main\n\nimport (\n \"bufio\"\n \"fmt\"\n \"os\"\n \"sort\"\n)\n\nconst N = 500000\n\nfunc IntMin(x, y int) int {\n if x < y {\n return x\n }\n return y\n}\n\nvar v, stk [N]int\n\nfunc main() {\n r := bufio.NewReader(os.Stdin)\n var n, top int = 0, 0\n var res int64 = 0\n fmt.Fscan(r, &n)\n for i := 0; i < n; i++ {\n fmt.Fscan(r, &v[i])\n for top >= 2 && stk[top-2] >= stk[top-1] && stk[top-1] <= v[i] {\n res += int64(IntMin(v[i], stk[top-2]))\n top--\n }\n stk[top] = v[i]\n top++\n }\n sort.Sort(sort.IntSlice(stk[:top]))\n for i := 0; i < top-2; i++ {\n res += int64(stk[i])\n }\n fmt.Println(res)\n}","testcases":"[{'input': '5\\r\\n3 1 5 2 6\\r\\n', 'output': ['11']}, {'input': '5\\r\\n1 2 3 4 5\\r\\n', 'output': ['6']}, {'input': '5\\r\\n1 100 101 100 1\\r\\n', 'output': ['102']}, {'input': '10\\r\\n96 66 8 18 30 48 34 11 37 42\\r\\n', 'output': ['299']}, {'input': '1\\r\\n87\\r\\n', 'output': ['0']}, {'input': '2\\r\\n93 51\\r\\n', 'output': ['0']}, {'input': '3\\r\\n31 19 5\\r\\n', 'output': ['5']}, {'input': '4\\r\\n86 21 58 60\\r\\n', 'output': ['118']}, {'input': '5\\r\\n21 6 54 69 32\\r\\n', 'output': ['74']}, {'input': '500000\\r\\n420656 493141 666713 218520 820461 110241 571052 221576 622547 422070 444000 24019 418357 645255 263883 786440 591985 779139 998849 699918 621698 430994 923570 83634 935074 894461 984992 212896 370138 429677 404026 15213 848103 382539 159706 6993 455627 684167 261848 815538 804077 201076 870537 670363 994669 268113 564376 907979 656969 685475 403646 794602 737125 100285 295201 87959 875706 465762 542151 602140 51614 146049 277621 882179 886827 375902 131432 382594 587151 541266 352879 686993 128432...', 'output': ['333286228412']}, {'input': '6\\r\\n46 30 38 9 65 23\\r\\n', 'output': ['145']}, {'input': '7\\r\\n82 60 92 4 2 13 15\\r\\n', 'output': ['129']}, {'input': '8\\r\\n77 84 26 34 17 56 76 3\\r\\n', 'output': ['279']}, {'input': '9\\r\\n72 49 39 50 68 35 75 94 56\\r\\n', 'output': ['435']}, {'input': '10\\r\\n4 2 2 4 1 2 2 4 2 1\\r\\n', 'output': ['21']}, {'input': '1\\r\\n4\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '3\\r\\n1 2 1\\r\\n', 'output': ['1']}, {'input': '4\\r\\n2 3 1 2\\r\\n', 'output': ['4']}, {'input': '5\\r\\n2 6 2 1 2\\r\\n', 'output': ['6']}, {'input': '6\\r\\n1 7 3 1 6 2\\r\\n', 'output': ['12']}, {'input': '7\\r\\n2 1 2 2 2 2 2\\r\\n', 'output': ['10']}, {'input': '8\\r\\n3 4 3 1 1 3 4 1\\r\\n', 'output': ['15']}, {'input': '9\\r\\n4 5 2 2 3 1 3 3 5\\r\\n', 'output': ['23']}, {'input': '10000\\r\\n4 4 4 3 1 3 3 4 2 4 2 3 4 3 3 3 3 1 1 2 3 4 4 4 1 4 2 4 2 1 1 1 1 4 3 3 4 2 2 2 2 3 4 3 4 4 4 1 2 3 4 3 1 1 3 4 1 4 3 2 4 1 2 4 3 3 4 1 4 1 3 1 4 2 2 4 2 2 3 1 4 4 4 1 2 1 4 4 3 2 3 3 4 4 4 2 3 3 1 3 4 1 4 1 2 4 3 1 2 4 4 4 3 3 2 1 1 1 1 4 1 2 3 3 3 3 1 1 1 3 1 2 4 1 4 2 3 1 4 1 4 3 2 4 2 3 1 1 2 4 2 1 1 2 4 2 1 2 2 4 2 4 1 3 1 3 4 3 4 2 2 1 1 4 3 2 2 1 4 1 4 3 2 3 3 2 1 3 1 3 3 4 1 3 1 2 1 1 2 2 3 1 2 3 2 4 1 2 3 2 2 4 3 4 4 3 3 3 2 2 3 2 2 2 4 1 3 4 3 4 2 1 3 1 2 2 4 2 2 1 2 3 1 4 3 4 4 1 1 1 1 1 ...', 'output': ['31378']}, {'input': '10000\\r\\n51 51 65 78 110 6 77 101 73 76 92 60 8 46 74 87 88 121 11 32 3 63 51 27 31 57 53 62 70 19 55 75 22 26 94 72 47 120 49 49 102 95 57 35 3 110 23 15 44 6 90 69 34 112 28 61 45 112 69 54 88 113 54 19 86 70 32 103 1 34 57 56 24 67 122 109 89 6 14 22 100 107 1 86 5 16 110 34 53 103 117 11 17 117 104 96 8 18 89 50 1 62 88 43 96 85 57 108 92 120 102 79 58 5 41 16 55 27 51 70 50 87 104 53 11 32 32 89 54 59 53 44 55 57 86 5 91 14 116 20 108 10 63 40 61 98 16 11 58 82 36 59 118 59 123 123 98 90 58 91 69 118 12...', 'output': ['821942']}, {'input': '10000\\r\\n305 2217 4079 1032 5027 4431 3905 1423 5423 5392 1722 1680 1222 3408 3246 1744 313 198 2852 5327 4617 3077 1253 5283 4127 57 2085 4838 1455 3747 3155 653 5543 463 1760 3758 623 487 4815 4685 2438 3820 5468 2579 1979 1354 4215 597 3319 178 1200 4881 3173 2107 1530 1655 1204 1759 5293 4445 4639 1091 345 2857 5238 54 4080 5496 2450 1616 2908 5260 1962 214 5331 4168 4219 2063 4259 5448 3784 1780 5350 5256 3855 1569 1931 3502 2232 1257 4228 4088 4848 2240 3837 3720 1861 1766 5281 4250 2527 667 4055 5472 ...', 'output': ['37185774']}, {'input': '10000\\r\\n937269 52328 616518 108211 17319 217729 361901 517567 299812 362331 49608 475088 381160 101157 459745 35742 462673 352769 61032 762616 306099 871281 26520 482300 466697 128157 683319 888115 379270 285379 141948 996358 851593 5371 991562 829025 5230 660134 585115 179107 422785 274611 294904 612799 771725 323149 129188 640754 219219 685413 34649 799777 335062 985559 825834 950158 976275 787003 772423 702710 5262 143627 864927 253387 613960 710956 911648 621065 443981 973723 583194 122871 425769 931957...', 'output': ['6648774646']}, {'input': '100000\\r\\n613499 780095 313501 52879 215436 862263 306729 367183 314542 622970 347292 284166 390702 24018 760627 417939 959455 794970 72227 14085 898342 330881 379441 184430 577249 650477 997745 520528 335412 503227 478361 262772 20466 474277 603648 474266 969253 51773 82745 652811 764347 57110 457094 203530 849485 737666 428091 975657 519756 220085 813489 991735 795658 830856 558883 554711 755875 12122 487656 850988 725126 310417 670157 310832 379427 197118 45262 907428 966835 513182 387697 873250 834207 43...', 'output': ['66739070768']}, {'input': '500000\\r\\n2 3 3 4 4 3 4 2 1 2 2 2 3 4 1 3 2 2 2 2 2 4 3 2 4 2 1 1 1 1 1 4 3 3 4 1 3 3 3 1 4 2 4 1 3 1 4 1 3 1 3 1 3 2 4 4 4 3 3 1 3 4 1 4 1 1 1 2 2 2 2 2 1 1 4 2 3 1 3 3 1 1 2 4 3 4 3 2 1 4 3 4 2 2 1 2 2 2 1 4 1 2 3 2 1 3 2 4 4 3 1 4 2 4 3 3 3 2 3 2 2 4 1 2 2 3 2 3 4 1 3 4 3 4 4 4 4 4 4 1 2 2 4 1 2 3 4 1 2 4 4 1 2 1 2 3 2 1 3 1 4 4 4 2 2 4 4 2 1 4 3 4 2 4 4 2 1 4 3 3 1 1 1 3 2 2 4 2 1 3 2 2 1 2 3 1 3 3 3 1 4 4 2 3 3 2 2 4 2 4 4 1 3 2 1 4 4 2 3 2 2 2 3 4 2 3 4 3 2 4 4 3 4 3 1 1 1 3 3 1 4 2 3 3 1 4 1 1 3 1 3 2...', 'output': ['1563483']}, {'input': '500000\\r\\n44 118 122 87 58 104 114 106 81 111 14 8 49 53 103 5 80 44 109 120 100 106 107 103 26 33 56 9 7 110 105 73 35 4 107 20 83 60 54 52 118 68 105 96 45 12 46 93 11 92 43 51 74 21 121 22 25 33 122 103 82 62 123 44 89 56 51 112 28 107 67 116 10 112 31 65 109 92 73 87 69 117 3 54 12 16 6 102 66 103 16 82 50 104 18 81 6 91 33 49 84 33 18 28 79 1 48 95 111 97 113 59 78 87 37 123 4 74 123 107 75 111 82 41 11 42 62 14 49 49 26 9 61 1 14 81 82 113 80 115 81 1 109 105 34 100 96 6 1 48 33 98 99 38 18 94 3 21 121...', 'output': ['41304696']}, {'input': '500000\\r\\n2996 495 5250 3319 834 4335 31 5346 2500 497 2969 5281 4565 148 751 3013 458 4778 89 3078 1778 5024 1260 680 4032 3533 2712 2960 4555 446 3276 4720 3834 780 48 2339 1279 993 4615 3464 4087 5104 5353 4137 693 1529 2840 4239 184 1898 4882 2801 1799 4278 389 3559 1091 2903 863 58 631 4525 2711 1593 2277 3881 5037 2159 833 1331 4007 2752 599 3842 4380 4157 4714 4643 873 4661 972 1993 1444 170 1494 433 2164 4501 836 3073 1392 926 1190 3662 1576 3044 494 1163 2913 4205 2407 2704 1754 813 2371 1461 275 89...', 'output': ['1852279744']}, {'input': '500000\\r\\n305368 255895 502210 475877 574974 319198 59454 129258 744627 274911 746538 93295 246339 880196 988079 162872 74868 863817 254869 229545 378612 868571 310138 694129 923809 769115 205295 744739 551541 291521 567023 406565 767565 447582 141629 295361 171092 421882 561881 904537 604432 530779 159902 533815 437577 232679 668923 928707 308433 882401 153548 122957 259701 681103 280788 128202 512446 994748 156569 587356 248100 943961 977757 720330 856976 975743 356724 203343 511564 495952 489991 697230 32...', 'output': ['333152632699']}, {'input': '500000\\r\\n54986 980609 331654 936147 176951 525059 592709 211432 591241 565473 737272 587991 893779 272415 574906 55545 666668 818799 640849 742225 477091 121575 887416 813637 948128 913172 227400 429067 232792 142760 966786 81503 789228 123534 798267 454896 383327 937374 189412 819995 681842 687532 650421 701518 573278 262715 825910 932815 863406 298127 998890 568149 779318 472096 670872 580500 89459 637099 612919 718166 865473 785250 421813 52485 372339 475139 116708 380165 923858 202758 358658 638718 3182...', 'output': ['333666489394']}, {'input': '500000\\r\\n606433 543120 598155 992348 182763 279356 839193 832513 782824 747497 627843 949366 560065 716458 575943 789004 30045 637256 880029 473537 159456 445146 826313 561257 922709 211453 541393 306170 427238 722609 958857 763700 249096 676240 282570 725035 472883 246636 459841 278771 426255 904515 269923 57318 844203 536993 376958 978388 400294 929875 389675 850952 233392 821443 43552 81651 453227 576821 71970 445240 172395 297821 394391 243091 336604 847130 449529 592167 71107 682387 233575 535714 15657...', 'output': ['333785777692']}]","id":403} {"difficulty":1600,"lang":"Go","lang_cluster":"Go","src_uid":"ed1a2ae733121af6486568e528fe2d84","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ Author: sighduck\n\/\/ URL: https:\/\/codeforces.com\/problemset\/problem\/1213\/D2\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n)\n\nconst MaxNum = 200001\n\nfunc Solve(n int, k int, a []int) int {\n\tdivs := make([][]int, MaxNum)\n\tfor _, elem := range a {\n\t\tcount := 0\n\t\tfor elem > 0 {\n\t\t\tdivs[elem] = append(divs[elem], count)\n\t\t\telem \/= 2\n\t\t\tcount += 1\n\t\t}\n\t}\n\tans := MaxNum\n\tfor _, d := range divs {\n\t\tsort.Ints(d)\n\t\tsum := 0\n\t\tfor i := 0; i < len(d) && i < k; i++ {\n\t\t\tsum += d[i]\n\t\t}\n\t\tif len(d) >= k && sum < ans {\n\t\t\tans = sum\n\t\t}\n\t}\n\treturn ans\n}\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\n\tvar n, k int\n\tfmt.Fscanf(reader, \"%d %d\\n\", &n, &k)\n\ta := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tfmt.Fscanf(reader, \"%d\", &a[i])\n\t}\n\n\tfmt.Fprintf(writer, \"%d\\n\", Solve(n, k, a))\n}\n","description":"The only difference between easy and hard versions is the number of elements in the array.You are given an array $$$a$$$ consisting of $$$n$$$ integers. In one move you can choose any $$$a_i$$$ and divide it by $$$2$$$ rounding down (in other words, in one move you can set $$$a_i := \\lfloor\\frac{a_i}{2}\\rfloor$$$).You can perform such an operation any (possibly, zero) number of times with any $$$a_i$$$.Your task is to calculate the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.Don't forget that it is possible to have $$$a_i = 0$$$ after some operations, thus the answer always exists.","input_specification":"The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le k \\le n \\le 50$$$) \u2014 the number of elements in the array and the number of equal numbers required. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 2 \\cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.","output_specification":"Print one integer \u2014 the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.","notes":null,"sample_inputs":["5 3\n1 2 2 4 5","5 3\n1 2 3 4 5","5 3\n1 2 3 3 3"],"sample_outputs":["1","2","0"],"human_solution":"package main\n\nimport (\n\t\"bufio\"\n\t\"os\"\n\t\"runtime\"\n\t\"strconv\"\n)\n\n\/* solution *\/\n\ntype nodeType struct {\n\tnext [2]*nodeType\n\tcuts [20]int\n\tcnt int\n}\n\nfunc solve() {\n\n\tn, k := readInt(), readInt()\n\troot := &nodeType{}\n\n\tfor i := 0; i < n; i++ {\n\t\tv := readInt()\n\t\tdigits := make([]int, 0)\n\t\tfor v > 0 {\n\t\t\tdigits = append(digits, v%2)\n\t\t\tv = v \/ 2\n\t\t}\n\t\taddToTree(root, digits, len(digits))\n\t}\n\n\tprintInt(search(root, k))\n\n}\n\nfunc search(node *nodeType, k int) int {\n\tif node == nil || node.cnt < k {\n\t\treturn 1000000000\n\t}\n\ts0 := 0\n\trem := k - node.cuts[0]\n\tfor i := 1; rem > 0 && i < 20; i++ {\n\t\tif rem > node.cuts[i] {\n\t\t\ts0 += node.cuts[i] * i\n\t\t\trem -= node.cuts[i]\n\t\t} else {\n\t\t\ts0 += rem * i\n\t\t\trem = 0\n\t\t}\n\t}\n\ts1, s2 := search(node.next[0], k), search(node.next[1], k)\n\treturn min(s0, min(s1, s2))\n}\n\nfunc addToTree(node *nodeType, digits []int, idx int) {\n\tnode.cnt++\n\tnode.cuts[idx]++\n\tidx--\n\tif idx < 0 {\n\t\treturn\n\t}\n\tnext := node.next[digits[idx]]\n\tif next == nil {\n\t\tnode.next[digits[idx]] = &nodeType{}\n\t\tnext = node.next[digits[idx]]\n\t}\n\taddToTree(next, digits, idx)\n}\n\nfunc min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}\n\n\/* stubs *\/\n\nfunc main() {\n\n\tvar f *os.File\n\tif runtime.GOROOT() == \"C:\\\\Soft\\\\Go\" {\n\t\tf, _ = os.Open(\"input.txt\")\n\t\tdefer f.Close()\n\t} else {\n\t\tf = os.Stdin\n\t}\n\n\twriter = bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\n\treader = bufio.NewScanner(f)\n\n\tconst maxCapacity = 1024 * 1024\n\tbuf := make([]byte, maxCapacity)\n\treader.Buffer(buf, maxCapacity)\n\n\treader.Split(bufio.ScanWords)\n\n\tsolve()\n\n}\n\nvar reader *bufio.Scanner\nvar writer *bufio.Writer\n\nfunc read() string {\n\treader.Scan()\n\treturn reader.Text()\n}\n\nfunc readInt() int {\n\treader.Scan()\n\tret, _ := strconv.Atoi(reader.Text())\n\treturn ret\n}\n\nfunc print(s string) {\n\twriter.WriteString(s)\n\twriter.WriteString(\"\\n\")\n}\n\nfunc printInt(i int) {\n\tprint(strconv.Itoa(i))\n}\n\nfunc printInt64(i int64) {\n\tprint(strconv.FormatInt(i, 10))\n}\n\nfunc readInt64() int64 {\n\treader.Scan()\n\tret, _ := strconv.ParseInt(reader.Text(), 10, 64)\n\treturn ret\n}\n","testcases":"[{'input': '5 3\\r\\n1 2 2 4 5\\r\\n', 'output': ['1']}, {'input': '5 3\\r\\n1 2 3 4 5\\r\\n', 'output': ['2']}, {'input': '5 3\\r\\n1 2 3 3 3\\r\\n', 'output': ['0']}, {'input': '1 1\\r\\n1337\\r\\n', 'output': ['0']}, {'input': '200000 100000\\r\\n150002 156252 199995 199996 149998 156248 199991 199992 114062 131640 199987 199988 149994 156244 199983 199984 128119 105636 199979 199980 149990 156240 199975 199976 107907 131636 199971 199972 149986 156236 199967 199968 128115 117796 199963 199964 114058 131632 199959 199960 149982 156228 199955 199956 128111 110012 199951 199952 149978 156224 199947 199948 102223 131628 199943 199944 149974 156220 199939 199940 128107 131624 199935 199936 149970 156216 199931 199932 149966 156212 199927...', 'output': ['1468946']}, {'input': '50 2\\r\\n72548 51391 1788 171949 148789 151619 19225 8774 52484 74830 20086 51129 151145 87650 108005 112019 126739 124087 158096 59027 34500 87415 115058 194160 171792 136832 1114 112592 171746 199013 101484 182930 185656 154861 191455 165701 140450 3475 160191 122350 66759 93252 60972 124615 119327 108068 149786 8698 63546 187913\\r\\n', 'output': ['12']}, {'input': '50 2\\r\\n3 6 10 1 14 5 26 11 6 1 23 43 7 23 20 11 15 11 2 1 8 37 2 19 31 18 2 4 15 84 9 29 38 46 9 21 2 2 13 114 28 9 6 20 14 46 4 20 39 99\\r\\n', 'output': ['0']}, {'input': '50 2\\r\\n199995 199977 199982 199979 199998 199991 199999 199976 199974 199971 199966 199999 199978 199987 199989 199995 199968 199987 199988 199987 199987 199998 199988 199958 199985 199999 199997 199939 199992 199999 199985 199994 199987 199965 199947 199991 199993 199997 199998 199994 199971 199999 199999 199990 199993 199983 199983 199999 199970 199952\\r\\n', 'output': ['0']}, {'input': '50 7\\r\\n155076 162909 18349 8937 38161 128479 127526 128714 164477 163037 130796 160247 17004 73321 175301 175796 79144 75670 46299 197255 10139 2112 195709 124860 6485 137601 63708 117985 94924 65661 113294 85898 7511 137431 115791 66126 146803 121145 96379 126408 195646 70033 131093 86487 94591 3086 59652 188702 27036 78631\\r\\n', 'output': ['79']}, {'input': '50 7\\r\\n1 2 27 54 6 15 24 1 9 28 3 26 8 12 7 6 8 54 23 8 7 13 18 10 1 33 24 10 34 13 12 9 16 11 36 50 39 9 8 10 2 5 6 4 7 67 21 12 6 55\\r\\n', 'output': ['3']}, {'input': '50 7\\r\\n199961 199990 199995 199997 199963 199995 199985 199994 199974 199974 199997 199991 199993 199982 199991 199982 199963 200000 199994 199997 199963 199991 199947 199996 199994 199995 199995 199990 199972 199973 199980 199955 199984 199998 199998 199992 199986 199986 199997 199995 199987 199958 199982 199998 199996 199995 199979 199943 199992 199993\\r\\n', 'output': ['7']}, {'input': '50 25\\r\\n162847 80339 131433 130128 135933 64805 74277 145697 92574 169638 26992 155045 32254 97675 177503 143802 44012 171388 185307 33652 194764 80214 169507 71832 180118 117737 198279 89826 9941 120250 158894 31871 616 190147 159249 158867 131076 77551 95165 54709 51376 145758 74581 26670 48775 29351 4750 55294 129850 19793\\r\\n', 'output': ['364']}, {'input': '50 25\\r\\n19 1 17 6 4 21 9 16 5 21 2 12 17 11 54 18 36 20 34 17 32 1 4 14 26 11 6 2 7 5 2 3 12 16 20 5 16 1 18 55 16 20 2 3 2 12 65 20 7 11\\r\\n', 'output': ['43']}, {'input': '50 25\\r\\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 199996 199910 199997 199976 200000 199999 199997 199998 199973 199996 199917\\r\\n', 'output': ['125']}, {'input': '50 50\\r\\n86175 169571 61423 53837 33228 49923 87369 11875 167105 101762 128203 19011 191596 19500 11213 950 192557 164451 58008 34390 39704 128606 191084 14227 57911 129189 124795 42481 69510 59862 146348 57352 158069 68387 196697 46595 84330 168274 88721 191842 155836 39164 195031 53880 188281 11150 132256 87853 179233 135499\\r\\n', 'output': ['780']}, {'input': '50 50\\r\\n8 63 44 78 3 65 7 27 13 45 7 5 18 94 25 17 26 10 21 44 5 13 6 30 10 11 44 14 71 17 10 5 4 9 8 21 4 9 25 18 3 14 15 8 7 11 5 28 9 1\\r\\n', 'output': ['167']}, {'input': '50 50\\r\\n199987 199984 199987 199977 199996 199923 199984 199995 199991 200000 199998 199990 199983 199981 199973 199989 199981 199993 199959 199994 199973 199962 199998 199970 199999 199981 199996 199996 199985 199980 199959 199990 199982 199987 199992 199997 199985 199976 199947 199998 199962 199987 199984 199982 199999 199997 199985 199992 199979 199974\\r\\n', 'output': ['450']}, {'input': '50 1\\r\\n156420 126738 188531 85575 23728 72842 190346 24786 118328 137944 126942 115577 175247 85409 146194 31398 189417 52337 135886 162083 146559 131125 31741 152481 57935 26624 106893 55028 81626 99143 182257 129556 100261 11429 156642 27997 105720 173400 140250 164944 26466 132034 86679 190160 161138 179688 2975 149862 38336 67959\\r\\n', 'output': ['0']}, {'input': '200000 2\\r\\n176158 176769 40627 19400 151736 188493 136139 77698 179121 134117 178035 140418 162114 135099 84129 162379 76419 104776 60147 117288 170931 90437 119080 55204 21173 138483 148836 69586 51085 50644 103281 37829 188454 53551 64569 89945 44943 75344 15181 174825 81977 9989 111265 195606 173051 160162 138381 76999 124303 18814 61133 195491 108882 28148 186882 169752 3079 198883 116144 92760 131861 77871 36414 42967 197445 155133 173497 182862 21765 86715 10896 8891 187559 143445 114265 80031 152290 ...', 'output': ['0']}, {'input': '200000 2\\r\\n15 6 64 30 16 10 33 28 10 7 37 96 5 11 13 25 2 7 8 49 27 35 16 32 24 7 10 44 33 20 25 14 7 2 80 26 3 8 5 17 29 2 7 6 31 19 7 45 1 5 39 30 7 4 9 8 13 9 27 11 11 9 52 48 66 7 37 4 2 42 15 39 16 22 22 53 42 12 11 28 27 4 11 8 12 10 7 1 20 14 15 16 17 26 14 27 4 60 12 31 8 14 72 7 1 38 7 3 11 7 23 5 3 30 15 10 40 72 11 11 32 21 32 11 32 11 9 52 3 68 27 8 20 16 5 4 19 47 3 39 40 37 16 29 26 36 60 20 56 27 2 38 30 18 5 7 3 27 10 16 36 25 10 23 16 20 58 11 5 5 32 5 10 7 51 8 11 24 37 55 2 10 37 38 13 1 ...', 'output': ['0']}, {'input': '200000 2\\r\\n199925 199998 199996 199972 199875 199931 199997 199980 199986 199983 199977 199999 199986 199948 199997 199946 199986 199994 199978 199956 199994 199988 199998 199965 199991 199996 199994 199993 199995 199941 200000 200000 199988 199998 199992 199999 199962 199999 199999 199987 199947 199981 199998 199994 199989 199988 199961 199981 199995 199988 199985 199981 199963 200000 199974 199997 200000 199993 199984 199995 199985 199985 199948 199970 199989 199910 199976 199946 199987 199974 199986 1999...', 'output': ['0']}, {'input': '200000 50\\r\\n89125 181814 109104 150035 118196 41142 80649 126486 180876 147942 11426 196094 152188 28730 92060 19362 182872 195147 70878 111164 35511 195859 40847 189737 80884 179444 75422 155821 93039 129202 14075 30636 32265 15924 85723 144946 43243 68999 81655 43372 3903 102043 5453 63533 165813 51716 33118 154090 52928 1274 81006 144446 102615 40217 127304 28135 142644 81314 114999 82951 121368 10744 166094 152868 5893 118756 55201 114536 40195 29010 121930 26657 120732 184850 108645 179138 172191 19906...', 'output': ['142']}, {'input': '200000 50\\r\\n29 16 86 40 24 1 6 15 7 30 7 1 1 27 11 7 15 19 1 24 17 2 5 18 13 15 6 10 36 1 4 4 12 29 97 5 2 7 49 27 22 16 11 12 4 24 30 5 43 6 71 99 3 12 6 4 12 4 6 6 1 30 41 8 13 5 12 11 7 23 23 14 11 27 12 8 27 5 7 8 17 10 9 5 3 1 30 5 28 53 5 10 12 7 22 24 2 22 2 12 82 1 8 8 15 3 3 1 12 3 5 4 26 13 22 16 19 23 12 24 7 53 5 48 17 83 10 20 11 61 44 1 8 9 52 19 23 24 6 91 14 48 42 1 9 56 17 17 4 8 70 21 9 4 18 8 4 24 48 14 2 52 20 30 19 67 8 4 16 4 44 23 2 11 10 15 7 19 19 6 2 28 43 41 11 7 16 73 13 11 14 14...', 'output': ['0']}, {'input': '200000 50\\r\\n199951 199984 199999 199989 199994 199996 199979 199985 199986 199993 199995 199986 199987 199991 199983 199974 199996 199997 199999 199996 199997 199965 199984 199919 200000 199993 199987 199940 199964 199994 199995 199997 200000 199977 199927 199995 199983 199946 199979 199978 199962 199996 199983 199995 199992 199964 199981 199980 199966 199947 199990 199979 199998 199969 199984 199997 199959 199998 199932 199994 199951 199997 199999 199994 199993 199998 199999 199998 199974 199941 199996 199...', 'output': ['0']}, {'input': '200000 5000\\r\\n79381 79230 141388 31307 165375 187864 19920 60514 15684 142282 106397 63201 127752 46886 94521 98380 42260 14463 163598 78057 117076 118960 91435 125315 54487 101590 2241 86634 175827 70289 117798 162929 136223 163143 148246 155631 103799 13538 45613 54719 111804 37261 188334 55871 167729 108986 130559 77461 105407 164447 94891 150629 174066 97332 100766 119964 20217 156471 113389 108201 108522 69928 137932 54974 5691 180045 50709 5139 122890 172079 77384 136612 166807 112859 192517 169518 93...', 'output': ['51474']}, {'input': '200000 5000\\r\\n30 22 8 30 19 8 19 74 23 8 13 34 1 3 13 14 52 15 52 11 2 6 24 1 20 93 4 68 24 32 11 21 18 10 8 3 3 40 13 67 25 1 29 3 80 13 43 23 31 9 19 61 34 10 3 21 29 15 1 3 23 19 6 17 16 39 59 11 29 5 11 78 36 81 18 21 9 40 25 22 16 19 33 13 33 1 13 19 85 31 10 93 68 26 61 36 15 27 8 3 25 27 15 3 26 23 6 17 4 1 35 1 1 6 5 19 21 35 42 7 12 9 16 61 3 20 26 34 66 35 19 16 33 15 5 5 14 1 18 2 17 20 2 1 18 54 15 7 28 21 15 2 9 3 11 21 28 40 15 16 4 4 4 5 59 2 41 1 5 2 5 27 33 1 2 5 69 28 41 21 1 36 21 24 47 2...', 'output': ['0']}, {'input': '200000 5000\\r\\n199982 199959 199999 199990 199999 199988 199999 199997 199998 199952 199998 199995 199994 199999 199993 199994 199975 199985 199972 199989 199981 199976 199959 199987 199999 199996 199992 199988 199967 199997 199991 199982 199970 199938 199993 199984 199948 199986 199987 199954 199955 199993 199965 199994 199996 200000 199942 199999 199978 199999 199934 199998 199988 199993 199982 199982 199971 199998 199964 199976 199982 199993 199949 199987 199982 199970 199987 199982 199978 199970 199989 1...', 'output': ['0']}, {'input': '200000 100000\\r\\n34325 22969 103009 71027 2038 152578 5879 138977 191292 113909 109908 96249 184205 44508 147634 148777 176276 77032 69901 98564 189633 111725 130407 192895 152327 45155 47364 152117 95645 72935 162863 53604 68862 135160 17204 99950 90345 50234 48612 90841 131041 80246 83412 156495 160173 137432 191901 105695 179289 34864 101790 92090 197748 92914 144694 6006 139600 158454 110410 189327 88326 181432 40645 153505 87151 22745 109139 53679 5803 170908 84133 199840 50398 55018 166192 27004 82542 ...', 'output': ['1469076']}, {'input': '200000 100000\\r\\n7 32 54 4 21 7 46 25 29 10 4 24 16 28 2 37 7 50 36 3 28 8 19 16 28 10 12 9 55 5 2 1 21 28 9 8 29 1 39 10 19 2 3 43 12 8 11 13 4 23 3 6 21 3 25 5 16 13 14 20 54 22 44 37 10 12 8 3 1 4 3 39 18 52 78 20 12 11 20 24 32 5 13 19 5 50 1 2 65 7 15 22 3 54 30 6 11 6 21 12 14 36 50 12 3 6 21 13 52 49 6 21 64 7 47 21 8 2 7 12 20 3 35 23 41 17 6 27 31 3 64 18 13 5 11 1 7 39 32 4 3 3 34 2 6 9 9 61 3 46 4 27 11 10 51 2 104 9 6 8 29 54 20 3 2 21 8 17 29 10 18 47 5 13 12 3 17 2 2 21 25 8 12 15 23 6 22 40 13...', 'output': ['203774']}, {'input': '200000 100000\\r\\n199995 199985 199996 199949 199992 199991 199967 199997 199970 199987 199983 199969 199963 199948 199991 199927 199967 199997 199962 199996 199994 199996 199967 199968 199988 199987 200000 199995 199980 199989 199978 199973 199988 199999 199996 199999 200000 199995 199994 199989 199970 199998 200000 199994 199989 199977 199977 199991 199998 199996 199966 199999 199992 199960 199971 199980 199989 199965 199979 199993 199955 199991 199945 199990 199919 199966 199991 199966 199986 199999 199988...', 'output': ['400000']}, {'input': '200000 199999\\r\\n59140 28957 29004 124065 198366 31262 20255 555 101812 77794 57243 80983 106873 59781 102126 113354 195632 71253 185623 44381 152629 3476 7721 165148 72116 153977 116812 24392 130480 27568 110844 128214 148350 41366 196296 167855 69895 160766 128532 28654 179594 199534 69783 99429 155223 197218 74846 22616 20885 92744 1863 74047 34173 36675 12871 113417 156700 120361 23269 179092 74197 99589 20668 190966 59229 37589 167805 94519 179133 95820 126635 40724 46228 84754 72989 25150 175250 90047 ...', 'output': ['3137884']}, {'input': '200000 199999\\r\\n60 39 34 20 61 27 3 20 14 53 12 1 41 20 18 29 27 16 5 36 6 79 21 25 62 28 6 45 13 4 16 13 30 50 32 19 17 26 9 24 28 4 13 21 18 12 13 28 24 20 8 32 12 50 30 27 4 18 4 11 6 46 8 14 26 14 27 1 120 1 10 5 4 23 15 9 7 5 6 18 11 12 13 18 33 1 67 28 88 13 63 26 29 38 13 28 15 65 10 20 23 24 4 62 6 71 24 10 8 6 38 16 21 22 21 27 5 2 10 19 34 19 4 34 15 5 23 86 1 9 22 20 8 4 1 15 19 32 46 25 15 31 6 12 4 4 29 66 10 23 34 4 27 14 4 69 23 41 54 33 14 6 28 35 14 6 18 24 29 1 6 4 3 27 17 5 54 22 19 48 7 ...', 'output': ['650309']}, {'input': '200000 199999\\r\\n199991 199994 199961 199957 199983 199958 199999 199984 199983 200000 199983 199955 199997 199994 199973 199964 199958 199983 199926 199968 199955 199992 199994 199973 199974 199978 199992 199950 199938 199941 199952 199996 199989 199958 199990 199975 199979 199978 199955 199994 199969 199965 199948 199989 199993 199991 199974 199992 199982 199986 199990 199945 200000 199983 199999 199996 199955 199992 199989 199927 199978 199984 199995 199854 199949 199992 199945 199972 199982 199997 199948...', 'output': ['1799991']}, {'input': '200000 200000\\r\\n197543 192033 68698 92316 101105 108314 167424 42287 198103 96873 181007 90054 44902 63014 39886 13121 100673 922 101400 163828 48349 72261 114526 119401 113604 103065 183011 154652 109138 126652 94974 30269 145851 94410 40539 199281 85891 36305 175226 125138 47940 79444 33199 37866 77228 74953 41056 75132 149820 158299 95563 78843 133706 31336 60925 129361 122496 29955 139867 84314 17627 94387 140829 195174 79980 183347 109006 164346 54490 196784 129358 193423 197279 196494 32464 124498 787...', 'output': ['3137948']}, {'input': '200000 200000\\r\\n5 9 15 1 65 41 24 10 20 50 5 14 1 9 67 19 11 32 7 35 19 23 6 60 37 7 30 66 2 11 15 14 1 79 33 15 28 10 34 7 29 22 13 45 1 19 45 107 18 6 26 18 22 44 23 3 4 24 38 22 2 97 7 32 8 11 66 33 2 38 17 6 66 26 66 16 2 4 28 24 7 11 42 14 36 3 27 1 23 5 3 20 12 24 39 14 5 4 27 1 76 3 7 11 21 44 51 22 25 18 10 17 22 4 101 44 12 42 36 62 4 15 15 3 37 22 4 21 7 91 28 25 3 3 28 6 11 13 6 11 4 1 3 10 2 86 2 4 9 26 20 17 3 31 20 3 6 41 17 3 22 20 19 64 2 21 4 18 9 3 6 7 1 31 7 17 58 34 40 3 2 45 24 24 38 6 ...', 'output': ['648723']}, {'input': '200000 200000\\r\\n199954 199998 199997 199905 199992 199987 200000 199993 199994 199999 199990 199992 199991 199956 199972 199978 199998 199989 199980 199998 199982 199997 199988 199995 199982 199998 199988 199985 199979 199997 199996 199980 199992 199998 199984 199986 199990 199987 199997 199967 199983 199995 199881 199987 199950 199963 199991 199970 199985 199993 199931 199947 199995 199987 199998 199998 200000 199960 199967 199999 199982 199999 199909 199906 199968 199997 199985 200000 199994 199968 199987...', 'output': ['1800000']}, {'input': '200000 1\\r\\n92734 60628 60074 189922 26674 109716 131452 126414 69158 197231 150299 180674 162024 132858 122318 114462 28697 57218 62129 44535 50287 166852 35763 13525 41908 19763 87319 187829 136772 183477 184055 127559 46163 77415 62460 95345 177509 77973 27943 17418 98580 16066 145484 28448 39054 31782 191569 152755 57877 90347 148020 176439 185789 129328 26690 34006 61489 152262 136097 134956 178158 19957 59783 88393 161221 83768 108416 146739 107166 50877 179052 139105 26032 40934 195390 8897 28938 1995...', 'output': ['0']}, {'input': '122222 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 1 1 1...', 'output': ['0']}, {'input': '80000 79999\\r\\n1 40001 3 60001 5 40003 7 70001 9 40005 11 60003 13 40007 15 75001 17 40009 19 60005 21 40011 23 70003 25 40013 27 60007 29 40015 31 77501 33 40017 35 60009 37 40019 39 70005 41 40021 43 60011 45 40023 47 75003 49 40025 51 60013 53 40027 55 70007 57 40029 59 60015 61 40031 63 78751 65 40033 67 60017 69 40035 71 70009 73 40037 75 60019 77 40039 79 75005 81 40041 83 60021 85 40043 87 70011 89 40045 91 60023 93 40047 95 77503 97 40049 99 60025 101 40051 103 70013 105 40053 107 60027 109 40055 111...', 'output': ['1148930']}, {'input': '200000 200000\\r\\n34270 172662 160315 82250 122014 143563 189833 179410 199358 34011 154756 108685 144055 4444 198531 7726 180229 189819 131221 82152 107365 30928 15920 39640 109263 13894 39369 120853 167341 35740 99808 28942 6959 40064 30514 18025 197628 113087 162701 152773 49494 157652 83875 154323 119790 69069 7265 126682 179363 138690 17595 32863 126791 35121 67392 130851 113513 633 97905 84860 114018 30176 50547 123183 159184 39079 93299 154446 164239 157492 131022 165855 140555 128259 147364 197301 326...', 'output': ['3137875']}, {'input': '200000 2000\\r\\n370 166204 57007 38501 172522 141517 103303 64223 42659 20177 51346 53306 9530 151444 89650 4420 26956 107479 43444 48925 91520 131437 35119 1378 2629 111439 156790 168445 177463 179056 49024 195535 132940 103843 16822 179209 31004 36692 153316 89047 58328 14300 81899 72998 159058 41977 136270 69400 54278 61813 29924 48797 93959 94814 180334 115732 78508 87670 47762 7003 110845 27316 199711 16579 2593 70955 81361 80479 173377 3833 47015 14246 143011 60562 19331 138151 135055 79910 19538 31933 ...', 'output': ['16946']}, {'input': '50 4\\r\\n29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n2 2 2 2 2\\r\\n', 'output': ['0']}, {'input': '7 3\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '7 4\\r\\n3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '10 6\\r\\n7 7 7 7 7 7 7 7 7 7\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n9 9 9 9\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n3 3 3 3\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n2 2 2 2\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n9 9 9 9 9\\r\\n', 'output': ['0']}]","id":404} {"difficulty":1600,"lang":"Go","lang_cluster":"Go","src_uid":"fbfc333ad4b0a750f654a00be84aea67","execute_outcome":"WRONG_ANSWER","source_code":"package main\n\nimport (\n\t\"bufio\"\n\t\"os\"\n\t\"strconv\"\n\t\"fmt\"\n)\n\nvar scanner = bufio.NewScanner(os.Stdin)\nvar writer = bufio.NewWriter(os.Stdout)\n\/\/defer writer.Flush()\n\nconst (\n\t\/\/MaxScanTokenSize = 64 * 1024 \/\/ package default\n\tMaxScanTokenSize = 8 * 1024 * 1024 \/\/ 8M\n)\n\nfunc init() {\n\tscanner.Buffer(make([]byte, 0, MaxScanTokenSize), MaxScanTokenSize)\n\tscanner.Split(bufio.ScanWords)\n}\n\nfunc readString() string {\n\tscanner.Scan()\n\treturn scanner.Text()\n}\n\nfunc readInt() int {\n\tval, _ := strconv.Atoi(readString())\n\treturn val\n}\n\nfunc readInt64() int64 {\n\tv, _ := strconv.ParseInt(readString(), 10, 64)\n\treturn v\n}\n\nfunc readIntArray(size int) []int {\n\ta := make([]int, size)\n\tfor i := 0; i < size; i++ {\n\t\ta[i] = readInt()\n\t}\n\treturn a\n}\n\nfunc readInt64Array(n int) []int64 {\n\tres := make([]int64, n)\n\tfor i := 0; i < n; i++ {\n\t\tres[i] = readInt64()\n\t}\n\treturn res\n}\n\nfunc readFloat64() float64 {\n\tv, _ := strconv.ParseFloat(readString(), 64)\n\treturn v\n}\n\nfunc readFloat64Array(n int) []float64 {\n\tres := make([]float64, n)\n\tfor i := 0; i < n; i++ {\n\t\tres[i] = readFloat64()\n\t}\n\treturn res\n}\n\ntype Edge struct {\n\tFrom int\n\tTo int\n\tCap int\n\tFlow int\n}\n\ntype Graph struct {\n\tNNode int\n\tNEdge int\n\tEdges []Edge\n\tNodes [][]int\n}\n\nfunc NewGraph(nNode, nEdge int) *Graph {\n\tg := &Graph{\n\t\tNNode: nNode,\n\t\tNEdge: nEdge,\n\t\tEdges: make([]Edge, 0, nEdge),\n\t\tNodes: make([][]int, nNode, nNode),\n\t}\n\treturn g\n}\n\nfunc (g *Graph) AddEdge(from, to, cap, flow int) {\n\tg.Nodes[from] = append(g.Nodes[from], len(g.Edges))\n\tg.Edges = append(g.Edges, Edge{from, to, cap, flow})\n\tg.Nodes[to] = append(g.Nodes[to], len(g.Edges))\n\tg.Edges = append(g.Edges, Edge{to, from, cap, flow})\n}\n\nfunc (g *Graph) Show() {\n\tfmt.Printf(\"n node = %d, n edge = %d\\n\", g.NNode, g.NEdge)\n\tfor i, cur := range g.Nodes {\n\t\tfmt.Printf(\"[%d]\", i)\n\t\tfor _, next := range cur {\n\t\t\tfmt.Printf(\" %d\", g.Edges[next].To)\n\t\t}\n\t\tfmt.Println()\n\t}\n}\n\ntype QueueStack struct {\n\tdata []interface{}\n}\n\nfunc (q *QueueStack) size() int {\n\treturn len(q.data)\n}\n\nfunc (q *QueueStack) push(v interface{}) {\n\tq.data = append(q.data, v)\n}\n\nfunc (q *QueueStack) popFront() interface{} {\n\tv := q.data[0]\n\tq.data = q.data[1:]\n\treturn v\n}\n\nfunc (q *QueueStack) pop() interface{} {\n\tlast := len(q.data) - 1\n\tv := q.data[last]\n\tq.data = q.data[:last]\n\treturn v\n}\n\nfunc spfa(g *Graph, from, to int) int {\n\tn := g.NNode\n\tdist := make([]int, n, n)\n\tdist[0] = 0\n\tfor i := 1; i < n; i++ {\n\t\tdist[i] = n\n\t}\n\n\tq := &QueueStack{}\n\tq.push(from)\n\tfor q.size() > 0 {\n\t\tcur := q.pop().(int)\n\t\tfor _, ie := range g.Nodes[cur] {\n\t\t\te := g.Edges[ie]\n\t\t\tif dist[cur] + 1 < dist[e.To] {\n\t\t\t\tdist[e.To] = dist[cur] + 1\n\t\t\t\tq.push(e.To)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dist[to]\n}\n\n\nfunc main() {\n\tdefer writer.Flush()\n\n\tn, m := readInt(), readInt()\n\n\tgFull := make([][]int, n, n)\n\tfor i := 0; i < n; i++ {\n\t\tgFull[i] = make([]int, n, n)\n\t}\n\n\tg := NewGraph(n, m)\n\tfor i := 0; i < m; i++ {\n\t\tx, y := readInt(), readInt()\n\t\tx--\n\t\ty--\n\t\tg.AddEdge(x, y, 0, 0)\n\t\tgFull[x][y] = 1\n\t\tgFull[y][x] = 1\n\t}\n\tg.Show()\n\n\td1 := spfa(g, 0, n - 1)\n\n\tif d1 == n {\n\t\tfmt.Fprintf(writer, \"-1\\n\")\n\t\treturn\n\t}\n\n\tg = NewGraph(n, n * (1 + n) \/ 2 - m)\n\tfor i := 0; i < n; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif gFull[i][j] == 0 {\n\t\t\t\tg.AddEdge(i, j, 0, 0)\n\t\t\t}\n\t\t}\n\t}\n\n\td2 := spfa(g, 0, n - 1)\n\tif d2 == n {\n\t\tfmt.Fprintf(writer, \"-1\\n\")\n\t\treturn\n\t}\n\n\tans := d1\n\tif d1 < d2 {\n\t\tans = d2\n\t}\n\tfmt.Fprintf(writer, \"%d\\n\", ans)\n}\n","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"],"human_solution":"\/\/ Author: sighduck\n\/\/ URL: https:\/\/codeforces.com\/problemset\/problem\/601\/A\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n)\n\ntype Edge struct {\n\tfrom int\n\tto int\n}\n\ntype QueueItem struct {\n\ttown int\n\td int\n}\n\nfunc bfs(n int, matrix [][]int, flag int) int {\n\tqueue := []QueueItem{{1, 0}}\n\tvisited := make(map[int]bool)\n\tvisited[1] = true\n\tfor len(queue) > 0 {\n\t\tcurrent := queue[0]\n\t\tqueue = queue[1:]\n\t\tif current.town == n {\n\t\t\treturn current.d\n\t\t}\n\t\tfor v := 1; v <= n; v++ {\n\t\t\tif !visited[v] && matrix[current.town-1][v-1] == flag {\n\t\t\t\tvisited[v] = true\n\t\t\t\tqueue = append(queue, QueueItem{v, current.d + 1})\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}\n\nfunc createMatrix(n int, edges []Edge) [][]int {\n\tadjMatrix := make([][]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tadjMatrix[i] = make([]int, n)\n\t}\n\tfor _, edge := range edges {\n\t\tadjMatrix[edge.to-1][edge.from-1] = 1\n\t\tadjMatrix[edge.from-1][edge.to-1] = 1\n\t}\n\treturn adjMatrix\n}\n\nfunc Solve(n int, edges []Edge) int {\n\tmatrix := createMatrix(n, edges)\n\tif matrix[0][n-1] == 1 {\n\t\treturn bfs(n, matrix, 0)\n\t}\n\treturn bfs(n, matrix, 1)\n}\n\nfunc main() {\n\treader := bufio.NewReader(os.Stdin)\n\twriter := bufio.NewWriter(os.Stdout)\n\tdefer writer.Flush()\n\n\tvar n, m int\n\tfmt.Fscanf(reader, \"%d %d\\n\", &n, &m)\n\tedges := make([]Edge, m)\n\tfor i := 0; i < m; i++ {\n\t\tfmt.Fscanf(reader, \"%d %d\\n\", &edges[i].from, &edges[i].to)\n\t}\n\n\tfmt.Fprintf(writer, \"%d\\n\", Solve(n, edges))\n}\n","testcases":"[{'input': '4 2\\r\\n1 3\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 5\\r\\n4 2\\r\\n3 5\\r\\n4 5\\r\\n5 1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 4\\r\\n1 2\\r\\n3 2\\r\\n3 4\\r\\n5 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '20 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '381 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 1\\r\\n1 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 5\\r\\n1 3\\r\\n2 1\\r\\n3 4\\r\\n4 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '20 1\\r\\n20 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '21 1\\r\\n21 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\n100 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '400 1\\r\\n1 400\\r\\n', 'output': ['2\\r\\n']}, {'input': '5 5\\r\\n2 5\\r\\n1 2\\r\\n1 4\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['2\\r\\n']}]","id":405} {"difficulty":1000,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"0515ac888937a4dda30cad5e2383164f","execute_outcome":"WRONG_ANSWER","source_code":"let lines = '';\nprocess.stdin.on('data', c => lines += c);\n\nconst solution = () => {\n\tlet line = lines.split('\\n');\n\tlet [n, k] = line[0].split(' ').map(v => parseInt(v,10));\n\tlet s = line[1];\n\tlet r = '';\n\tfor(let i = 0; i < n; i++){\n\t\tlet c = s[i];\n\t\tif (i === 0 && c > 1 && k > 0) {\n\t\t\tr += 1;\n\t\t\tk--;\n\t\t} else if (i === 0 && n == 1 && k > 0) {\n\t\t\tr += 0;\n\t\t\tk--;\n\t\t} else if (i !== 0 && c > 0 && k > 0) {\n\t\t\tr += 0;\n\t\t\tk--;\n\t\t} else {\n\t\t\tr += c;\n\t\t}\n\t}\n\t\n\tconsole.log(r);\n\tprocess.exit(0);\n}\n\nprocess.stdin.on('end', solution);\n","description":"Ania has a large integer $$$S$$$. Its decimal representation has length $$$n$$$ and doesn't contain any leading zeroes. Ania is allowed to change at most $$$k$$$ digits of $$$S$$$. She wants to do it in such a way that $$$S$$$ still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq n \\leq 200\\,000$$$, $$$0 \\leq k \\leq n$$$) \u2014 the number of digits in the decimal representation of $$$S$$$ and the maximum allowed number of changed digits. The second line contains the integer $$$S$$$. It's guaranteed that $$$S$$$ has exactly $$$n$$$ digits and doesn't contain any leading zeroes.","output_specification":"Output the minimal possible value of $$$S$$$ which Ania can end with. Note that the resulting integer should also have $$$n$$$ digits.","notes":"NoteA number has leading zeroes if it consists of at least two digits and its first digit is $$$0$$$. For example, numbers $$$00$$$, $$$00069$$$ and $$$0101$$$ have leading zeroes, while $$$0$$$, $$$3000$$$ and $$$1010$$$ don't have leading zeroes.","sample_inputs":["5 3\n51528","3 2\n102","1 1\n1"],"sample_outputs":["10028","100","0"],"human_solution":"const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\n\nvar line = 0;\nvar n, k;\nvar S;\n\nrl.on('line', (data) => {\n\t++line;\n\t\n\tvar arr = data.split(' ');\n\t\n\tif(line===1) {\n\t\tn = parseInt(arr[0]);\n\t\tk = parseInt(arr[1]);\n\t} else {\n\t\tS = arr[0];\n\t\tvar array = S;\n\t\tvar result = '';\n\/\/\t\tconsole.log(array)\n\t\t\n\t\tif(k===0) {\n\t\t\tconsole.log(S);\n\t\t} else if(n===1){\n\t\t\tconsole.log(0);\n\t\t} else {\n\t\t\tvar idx=1;\n\t\t\tif(array[0]!=='1'){\n\t\t\t\t--k;\n\t\t\t}\n\t\t\tresult+='1';\n\t\t\tfor(; idx {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n const len1 = +readLine();\n const arr1 = readLine()\n .split(\" \")\n .map((n) => parseInt(n));\n const len2 = +readLine();\n const arr2 = readLine()\n .split(\" \")\n .map((n) => parseInt(n));\n\n let max = Number.MIN_SAFE_INTEGER;\n let count = 0;\n\n for (let i = 0; i < len2; i++) {\n const a = arr2[i];\n for (let j = 0; j < len1; j++) {\n const b = arr1[j];\n const div = a \/ b;\n if (Number.isInteger(div)) {\n if (div > max) {\n max = div;\n count = 0;\n }\n if (div === max) count++;\n }\n }\n }\n console.log(count);\n}\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":407} {"difficulty":900,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"10_A","execute_outcome":"RUNTIME_ERROR","source_code":"var lll = readline().split(' ')\r\nvar n = lll[0]\r\nvar P1 = lll[1]\r\nvar P2 = lll[2]\r\nvar P3 = lll[3]\r\nvar T1 = lll[4]\r\nvar T2 = lll[5]\r\n\r\nvar ss = []\r\n\r\nwhile (lll = readline()) ss.push(lll.split(' '))\r\n\r\nvar pows = 0\r\nvar pse\r\n\r\nfor (var i = 0; i < ss.length; i++) {\r\n var s = ss[i]\r\n pows += (s[1] - s[0]) * P1\r\n if (pse) {\r\n var w = s[0] - pse\r\n pows += Math.min(w, T1) * P1\r\n w -= T1\r\n if (w) {\r\n pows += Math.min(w, T2) * P2\r\n w -= T2\r\n if (w) {\r\n pows += w * P3\r\n }\r\n }\r\n }\r\n pse = s[1]\r\n}\r\n\r\nprint(pows)","description":"Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt per minute. T1 minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to P2 watt per minute. Finally, after T2 minutes from the start of the screensaver, laptop switches to the \"sleep\" mode and consumes P3 watt per minute. If Tom moves the mouse or touches the keyboard when the laptop is in the second or in the third mode, it switches to the first (normal) mode. Tom's work with the laptop can be divided into n time periods [l1,r1],[l2,r2],...,[ln,rn]. During each interval Tom continuously moves the mouse and presses buttons on the keyboard. Between the periods Tom stays away from the laptop. Find out the total amount of power consumed by the laptop during the period [l1,rn].","input_specification":"The first line contains 6 integer numbers n, P1, P2, P3, T1, T2 (1\u2264n\u2264100,0\u2264P1,P2,P3\u2264100,1\u2264T1,T2\u226460). The following n lines contain description of Tom's work. Each i-th of these lines contains two space-separated integers li and ri (0\u2264li {\r\n \/**\r\n * Three rings to the elven-kings under the sky,\r\n * Seven for the dwarf-lords in their halls of stone,\r\n * Nine for mortal men doomed to die...\r\n *\/\r\n let mithrandir = 0;\r\n\r\n const [\r\n _, \r\n activeStateCost, \r\n screensaverCost, \r\n sleepStateCost, \r\n fromActiveToScreensaverDuration,\r\n fromScreensaverToSleepStateDuration,\r\n ...periods\r\n ] = data\r\n .trim()\r\n .split(\/\\n| \/)\r\n .map(el => +el);\r\n \r\n const inactivePeriods = [];\r\n const activePeriods = [];\r\n \r\n activePeriods.push(periods[1] - periods[0]);\r\n\r\n for(let i=2; i sum += val * activeStateCost, 0);\r\n mithrandir += inactivePeriods.reduce((holder, val) => {\r\n let sum = 0;\r\n if(val - fromActiveToScreensaverDuration > 0) {\r\n sum += fromActiveToScreensaverDuration * activeStateCost;\r\n val -= fromActiveToScreensaverDuration;\r\n\r\n if(val - fromScreensaverToSleepStateDuration > 0) {\r\n sum += fromScreensaverToSleepStateDuration * screensaverCost;\r\n val -= fromScreensaverToSleepStateDuration;\r\n\r\n if(val > 0) {\r\n sum += val * sleepStateCost;\r\n }\r\n } else {\r\n sum += val * screensaverCost;\r\n }\r\n } else {\r\n sum += val * activeStateCost;\r\n }\r\n\r\n return sum + holder;\r\n }, 0);\r\n\r\n console.log(mithrandir);\r\n}\r\n\r\nprocess.stdin.on('data', c => data += c);\r\nprocess.stdin.on('end', solve);","testcases":"[{'input': ['1 3 2 1 5 10\\r\\n0 10\\r\\n'], 'output': ['30']}, {'input': ['2 8 4 2 5 10\\r\\n20 30\\r\\n50 100\\r\\n'], 'output': ['570']}, {'input': ['3 15 9 95 39 19\\r\\n873 989\\r\\n1003 1137\\r\\n1172 1436\\r\\n'], 'output': ['8445']}, {'input': ['4 73 2 53 58 16\\r\\n51 52\\r\\n209 242\\r\\n281 407\\r\\n904 945\\r\\n'], 'output': ['52870']}, {'input': ['5 41 20 33 43 4\\r\\n46 465\\r\\n598 875\\r\\n967 980\\r\\n1135 1151\\r\\n1194 1245\\r\\n'], 'output': ['46995']}, {'input': ['6 88 28 100 53 36\\r\\n440 445\\r\\n525 614\\r\\n644 844\\r\\n1238 1261\\r\\n1305 1307\\r\\n1425 1434\\r\\n'], 'output': ['85540']}, {'input': ['7 46 61 55 28 59\\r\\n24 26\\r\\n31 61\\r\\n66 133\\r\\n161 612\\r\\n741 746\\r\\n771 849\\r\\n1345 1357\\r\\n'], 'output': ['67147']}, {'input': ['8 83 18 30 28 5\\r\\n196 249\\r\\n313 544\\r\\n585 630\\r\\n718 843\\r\\n1040 1194\\r\\n1207 1246\\r\\n1268 1370\\r\\n1414 1422\\r\\n'], 'output': ['85876']}, {'input': ['9 31 65 27 53 54\\r\\n164 176\\r\\n194 210\\r\\n485 538\\r\\n617 690\\r\\n875 886\\r\\n888 902\\r\\n955 957\\r\\n1020 1200\\r\\n1205 1282\\r\\n'], 'output': ['38570']}, {'input': ['30 3 1 58 44 7\\r\\n11 13\\r\\n14 32\\r\\n37 50\\r\\n70 74\\r\\n101 106\\r\\n113 129\\r\\n184 195\\r\\n197 205\\r\\n213 228\\r\\n370 394\\r\\n443 446\\r\\n457 460\\r\\n461 492\\r\\n499 585\\r\\n602 627\\r\\n709 776\\r\\n812 818\\r\\n859 864\\r\\n910 913\\r\\n918 964\\r\\n1000 1010\\r\\n1051 1056\\r\\n1063 1075\\r\\n1106 1145\\r\\n1152 1189\\r\\n1211 1212\\r\\n1251 1259\\r\\n1272 1375\\r\\n1412 1417\\r\\n1430 1431\\r\\n'], 'output': ['11134']}, {'input': ['30 42 3 76 28 26\\r\\n38 44\\r\\n55 66\\r\\n80 81\\r\\n84 283\\r\\n298 314\\r\\n331 345\\r\\n491 531\\r\\n569 579\\r\\n597 606\\r\\n612 617\\r\\n623 701\\r\\n723 740\\r\\n747 752\\r\\n766 791\\r\\n801 827\\r\\n842 846\\r\\n853 891\\r\\n915 934\\r\\n945 949\\r\\n955 964\\r\\n991 1026\\r\\n1051 1059\\r\\n1067 1179\\r\\n1181 1191\\r\\n1214 1226\\r\\n1228 1233\\r\\n1294 1306\\r\\n1321 1340\\r\\n1371 1374\\r\\n1375 1424\\r\\n'], 'output': ['59043']}, {'input': ['30 46 5 93 20 46\\r\\n12 34\\r\\n40 41\\r\\n54 58\\r\\n100 121\\r\\n162 182\\r\\n220 349\\r\\n358 383\\r\\n390 398\\r\\n401 403\\r\\n408 409\\r\\n431 444\\r\\n466 470\\r\\n471 535\\r\\n556 568\\r\\n641 671\\r\\n699 709\\r\\n767 777\\r\\n786 859\\r\\n862 885\\r\\n912 978\\r\\n985 997\\r\\n1013 1017\\r\\n1032 1038\\r\\n1047 1048\\r\\n1062 1080\\r\\n1094 1097\\r\\n1102 1113\\r\\n1122 1181\\r\\n1239 1280\\r\\n1320 1369\\r\\n'], 'output': ['53608']}, {'input': ['30 50 74 77 4 57\\r\\n17 23\\r\\n24 61\\r\\n67 68\\r\\n79 87\\r\\n93 101\\r\\n104 123\\r\\n150 192\\r\\n375 377\\r\\n398 414\\r\\n461 566\\r\\n600 633\\r\\n642 646\\r\\n657 701\\r\\n771 808\\r\\n812 819\\r\\n823 826\\r\\n827 833\\r\\n862 875\\r\\n880 891\\r\\n919 920\\r\\n928 959\\r\\n970 1038\\r\\n1057 1072\\r\\n1074 1130\\r\\n1165 1169\\r\\n1171 1230\\r\\n1265 1276\\r\\n1279 1302\\r\\n1313 1353\\r\\n1354 1438\\r\\n'], 'output': ['84067']}, {'input': ['30 54 76 95 48 16\\r\\n9 11\\r\\n23 97\\r\\n112 116\\r\\n126 185\\r\\n214 223\\r\\n224 271\\r\\n278 282\\r\\n283 348\\r\\n359 368\\r\\n373 376\\r\\n452 463\\r\\n488 512\\r\\n532 552\\r\\n646 665\\r\\n681 685\\r\\n699 718\\r\\n735 736\\r\\n750 777\\r\\n791 810\\r\\n828 838\\r\\n841 858\\r\\n874 1079\\r\\n1136 1171\\r\\n1197 1203\\r\\n1210 1219\\r\\n1230 1248\\r\\n1280 1292\\r\\n1324 1374\\r\\n1397 1435\\r\\n1438 1439\\r\\n'], 'output': ['79844']}, {'input': ['30 58 78 12 41 28\\r\\n20 26\\r\\n27 31\\r\\n35 36\\r\\n38 99\\r\\n103 104\\r\\n106 112\\r\\n133 143\\r\\n181 246\\r\\n248 251\\r\\n265 323\\r\\n350 357\\r\\n378 426\\r\\n430 443\\r\\n466 476\\r\\n510 515\\r\\n517 540\\r\\n542 554\\r\\n562 603\\r\\n664 810\\r\\n819 823\\r\\n826 845\\r\\n869 895\\r\\n921 973\\r\\n1002 1023\\r\\n1102 1136\\r\\n1143 1148\\r\\n1155 1288\\r\\n1316 1388\\r\\n1394 1403\\r\\n1434 1437\\r\\n'], 'output': ['82686']}, {'input': ['30 62 80 97 25 47\\r\\n19 20\\r\\n43 75\\r\\n185 188\\r\\n199 242\\r\\n252 258\\r\\n277 310\\r\\n316 322\\r\\n336 357\\r\\n398 399\\r\\n404 436\\r\\n443 520\\r\\n549 617\\r\\n637 649\\r\\n679 694\\r\\n705 715\\r\\n725 730\\r\\n731 756\\r\\n768 793\\r\\n806 833\\r\\n834 967\\r\\n1003 1079\\r\\n1088 1097\\r\\n1100 1104\\r\\n1108 1121\\r\\n1127 1164\\r\\n1240 1263\\r\\n1274 1307\\r\\n1367 1407\\r\\n1419 1425\\r\\n1433 1437\\r\\n'], 'output': ['92356']}, {'input': ['30 100 48 14 9 7\\r\\n26 55\\r\\n75 107\\r\\n145 146\\r\\n158 167\\r\\n197 199\\r\\n201 213\\r\\n222 238\\r\\n257 265\\r\\n271 338\\r\\n357 439\\r\\n454 462\\r\\n463 562\\r\\n633 660\\r\\n670 691\\r\\n696 829\\r\\n844 864\\r\\n880 888\\r\\n891 894\\r\\n895 900\\r\\n950 973\\r\\n1004 1007\\r\\n1018 1021\\r\\n1045 1049\\r\\n1062 1073\\r\\n1138 1184\\r\\n1240 1272\\r\\n1278 1315\\r\\n1403 1410\\r\\n1412 1418\\r\\n1426 1434\\r\\n'], 'output': ['107490']}, {'input': ['30 3 50 32 1 18\\r\\n46 60\\r\\n66 94\\r\\n99 141\\r\\n162 239\\r\\n309 334\\r\\n400 550\\r\\n594 630\\r\\n659 663\\r\\n664 701\\r\\n735 736\\r\\n741 755\\r\\n756 801\\r\\n823 854\\r\\n865 915\\r\\n937 964\\r\\n984 986\\r\\n990 1007\\r\\n1008 1031\\r\\n1052 1064\\r\\n1073 1080\\r\\n1190 1191\\r\\n1192 1254\\r\\n1265 1266\\r\\n1272 1273\\r\\n1274 1277\\r\\n1284 1302\\r\\n1308 1312\\r\\n1358 1383\\r\\n1388 1389\\r\\n1390 1401\\r\\n'], 'output': ['25258']}, {'input': ['30 7 52 49 46 37\\r\\n2 73\\r\\n129 130\\r\\n131 140\\r\\n143 150\\r\\n187 190\\r\\n217 238\\r\\n248 271\\r\\n375 426\\r\\n465 470\\r\\n475 503\\r\\n506 541\\r\\n569 571\\r\\n578 585\\r\\n680 683\\r\\n690 738\\r\\n742 761\\r\\n868 877\\r\\n890 892\\r\\n904 915\\r\\n935 961\\r\\n1076 1100\\r\\n1103 1114\\r\\n1232 1244\\r\\n1246 1247\\r\\n1257 1261\\r\\n1271 1276\\r\\n1280 1298\\r\\n1346 1360\\r\\n1373 1382\\r\\n1407 1419\\r\\n'], 'output': ['23992']}]","id":408} {"difficulty":900,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"129_A","execute_outcome":"RUNTIME_ERROR","source_code":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n \r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n \r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on(\"end\", () => {\r\n inputString = inputString.split(\"\\n\");\r\n main();\r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n \r\n\/\/ ********** Code Start **********\r\n\r\nfunction main() {\r\n \/\/ your code goes here\r\n let a = parseInt(readline())\r\nlet bags = readline().split(' ')\r\nlet odd = 0, type = 0;\r\nbags.forEach(x => {\r\n if(parseInt(x)%2===1)\r\n odd++;\r\n})\r\nif(odd % 2 === 1)\r\n type = 1;\r\nelse {\r\n type = bags.length - odd;\r\n}\r\nprint(type)\r\n\r\n}\r\n","description":"Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there are many cookies, Olga decided that it's no big deal if she steals a bag. However, she doesn't want the sisters to quarrel because of nothing when they divide the cookies. That's why Olga wants to steal a bag with cookies so that the number of cookies in the remaining bags was even, that is, so that Anna and Maria could evenly divide it into two (even 0 remaining cookies will do, just as any other even number). How many ways there are to steal exactly one cookie bag so that the total number of cookies in the remaining bags was even?","input_specification":"The first line contains the only integer n (1\u2264n\u2264100) \u2014 the number of cookie bags Anna and Maria have. The second line contains n integers ai (1\u2264ai\u2264100) \u2014 the number of cookies in the i-th bag.\n","output_specification":"Print in the only line the only number \u2014 the sought number of ways. If there are no such ways print 0.\n","notes":"In the first sample Olga should take the only bag so that the twins ended up with the even number of cookies.\nIn the second sample Olga can take any of five bags with two cookies or any of three bags with four cookies \u2014 5+3=8 ways in total.\nIn the third sample, no matter which bag with two cookies Olga chooses, the twins are left with 2*9+99=117 cookies. Thus, Olga has only one option: to take the bag with 99 cookies.\n","sample_inputs":["1\n1\n","10\n1 2 2 3 4 4 4 2 2 2\n","11\n2 2 2 2 2 2 2 2 2 2 99\n"],"sample_outputs":["1\n","8\n","1\n"],"human_solution":"let i = '';\nprocess.stdin.on('data', c => i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os');\n const lines = i.split(EOL);\n var n = lines[0];\n var k = lines[1].split(' ');\n var even = 0;\n var odd = 0;\n for(var j = 0; j < n; j++){\n if(k[j] % 2 === 0){\n even++;\n }else{\n odd++;\n }\n }\n if(odd % 2 == 1){\n console.log(odd);\n }else{\n console.log(even);\n }\n});","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n1 2 2 3 4 4 4 2 2 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 99\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n7 7 7 7 7 7 7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['8\\r\\n1 2 3 4 5 6 7 8\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100\\r\\n1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['99\\r\\n99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['82\\r\\n43 44 96 33 23 42 33 66 53 87 8 90 43 91 40 88 51 18 48 62 59 10 22 20 54 6 13 63 2 56 31 52 98 42 54 32 26 77 9 24 33 91 16 30 39 34 78 82 73 90 12 15 67 76 30 18 44 86 84 98 65 54 100 79 28 34 40 56 11 43 72 35 86 59 89 40 30 33 7 19 44 15\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['17\\r\\n50 14 17 77 74 74 38 76 41 27 45 29 66 98 38 73 38\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['94\\r\\n81 19 90 99 26 11 86 44 78 36 80 59 99 90 78 72 71 20 94 56 42 40 71 84 10 85 10 70 52 27 39 55 90 16 48 25 7 79 99 100 38 10 99 56 3 4 78 9 16 57 14 40 52 54 57 70 30 86 56 84 97 60 59 69 49 66 23 92 90 46 86 73 53 47 1 83 14 20 24 66 13 45 41 14 86 75 55 88 48 95 82 24 47 87\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['88\\r\\n64 95 12 90 40 65 98 45 52 54 79 7 81 25 98 19 68 82 41 53 35 50 5 22 32 21 8 39 8 6 72 27 81 30 12 79 21 42 60 2 66 87 46 93 62 78 52 71 76 32 78 94 86 85 55 15 34 76 41 20 32 26 94 81 89 45 74 49 11 40 40 39 49 46 80 85 90 23 80 40 86 58 70 26 48 93 23 53\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['84\\r\\n95 9 43 43 13 84 60 90 1 8 97 99 54 34 59 83 33 15 51 26 40 12 66 65 19 30 29 78 92 60 25 13 19 84 71 73 12 24 54 49 16 41 11 40 57 59 34 40 39 9 71 83 1 77 79 53 94 47 78 55 77 85 29 52 80 90 53 77 97 97 27 79 28 23 83 25 26 22 49 86 63 56 3 32\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['47\\r\\n61 97 76 94 91 22 2 68 62 73 90 47 16 79 44 71 98 68 43 6 53 52 40 27 68 67 43 96 14 91 60 61 96 24 97 13 32 65 85 96 81 77 34 18 23 14 80\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['69\\r\\n71 1 78 74 58 89 30 6 100 90 22 61 11 59 14 74 27 25 78 61 45 19 25 33 37 4 52 43 53 38 9 100 56 67 69 38 76 91 63 60 93 52 28 61 9 98 8 14 57 63 89 64 98 51 36 66 36 86 13 82 50 91 52 64 86 78 78 83 81\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['52\\r\\n38 78 36 75 19 3 56 1 39 97 24 79 84 16 93 55 96 64 12 24 1 86 80 29 12 32 36 36 73 39 76 65 53 98 30 20 28 8 86 43 70 22 75 69 62 65 81 25 53 40 71 59\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['74\\r\\n81 31 67 97 26 75 69 81 11 13 13 74 77 88 52 20 52 64 66 75 72 28 41 54 26 75 41 91 75 15 18 36 13 83 63 61 14 48 53 63 19 67 35 48 23 65 73 100 44 55 92 88 99 17 73 25 83 7 31 89 12 80 98 39 42 75 14 29 81 35 77 87 33 94\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['44\\r\\n46 56 31 31 37 71 94 2 14 100 45 72 36 72 80 3 38 54 42 98 50 32 31 42 62 31 45 50 95 100 18 17 64 22 18 25 52 56 70 57 43 40 81 28\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['22\\r\\n28 57 40 74 51 4 45 84 99 12 95 14 92 60 47 81 84 51 31 91 59 42\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['59\\r\\n73 45 94 76 41 49 65 13 74 66 36 25 47 75 40 23 92 72 11 32 32 8 81 26 68 56 41 8 76 47 96 55 70 11 84 14 83 18 70 22 30 39 28 100 48 11 92 45 78 69 86 1 54 90 98 91 13 17 35\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['63\\r\\n20 18 44 94 68 57 16 43 74 55 68 24 21 95 76 84 50 50 47 86 86 12 58 55 28 72 86 18 34 45 81 88 3 72 41 9 60 90 81 93 12 6 9 6 2 41 1 7 9 29 81 14 64 80 20 36 67 54 7 5 35 81 22\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['28\\r\\n49 84 48 19 44 91 11 82 96 95 88 90 71 82 87 25 31 23 18 13 98 45 26 65 35 12 31 14\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['61\\r\\n34 18 28 64 28 45 9 77 77 20 63 92 79 16 16 100 86 2 91 91 57 15 31 95 10 88 84 5 82 83 53 98 59 17 97 80 76 80 81 3 91 81 87 93 61 46 10 49 6 22 21 75 63 89 21 81 30 19 67 38 77\\r\\n'], 'output': ['35\\r\\n']}, {'input': ['90\\r\\n41 90 43 1 28 75 90 50 3 70 76 64 81 63 25 69 83 82 29 91 59 66 21 61 7 55 72 49 38 69 72 20 64 58 30 81 61 29 96 14 39 5 100 20 29 98 75 29 44 78 97 45 26 77 73 59 22 99 41 6 3 96 71 20 9 18 96 18 90 62 34 78 54 5 41 6 73 33 2 54 26 21 18 6 45 57 43 73 95 75\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['45\\r\\n93 69 4 27 20 14 71 48 79 3 32 26 49 30 57 88 13 56 49 61 37 32 47 41 41 70 45 68 82 18 8 6 25 20 15 13 71 99 28 6 52 34 19 59 26\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['33\\r\\n29 95 48 49 91 10 83 71 47 25 66 36 51 12 34 10 54 74 41 96 89 26 89 1 42 33 1 62 9 32 49 65 78\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['34\\r\\n98 24 42 36 41 82 28 58 89 34 77 70 76 44 74 54 66 100 13 79 4 88 21 1 11 45 91 29 87 100 29 54 82 78\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['29\\r\\n91 84 26 84 9 63 52 9 65 56 90 2 36 7 67 33 91 14 65 38 53 36 81 83 85 14 33 95 51\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['100\\r\\n2 88 92 82 87 100 78 28 84 43 78 32 43 33 97 19 15 52 29 84 57 72 54 13 99 28 82 79 40 70 34 92 91 53 9 88 27 43 14 92 72 37 26 37 20 95 19 34 49 64 33 37 34 27 80 79 9 54 99 68 25 4 68 73 46 66 24 78 3 87 26 52 50 84 4 95 23 83 39 58 86 36 33 16 98 2 84 19 53 12 69 60 10 11 78 17 79 92 77 59\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['100\\r\\n2 95 45 73 9 54 20 97 57 82 88 26 18 71 25 27 75 54 31 11 58 85 69 75 72 91 76 5 25 80 45 49 4 73 8 81 81 38 5 12 53 77 7 96 90 35 28 80 73 94 19 69 96 17 94 49 69 9 32 19 5 12 46 29 26 40 59 59 6 95 82 50 72 2 45 69 12 5 72 29 39 72 23 96 81 28 28 56 68 58 37 41 30 1 90 84 15 24 96 43\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n27 72 35 91 13 10 35 45 24 55 83 84 63 96 29 79 34 67 63 92 48 83 18 77 28 27 49 66 29 88 55 15 6 58 14 67 94 36 77 7 7 64 61 52 71 18 36 99 76 6 50 67 16 13 41 7 89 73 61 51 78 22 78 32 76 100 3 31 89 71 63 53 15 85 77 54 89 33 68 74 3 23 57 5 43 89 75 35 9 86 90 11 31 46 48 37 74 17 77 8\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['100\\r\\n69 98 69 88 11 49 55 8 25 91 17 81 47 26 15 73 96 71 18 42 42 61 48 14 92 78 35 72 4 27 62 75 83 79 17 16 46 80 96 90 82 54 37 69 85 21 67 70 96 10 46 63 21 59 56 92 54 88 77 30 75 45 44 29 86 100 51 11 65 69 66 56 82 63 27 1 51 51 13 10 3 55 26 85 34 16 87 72 13 100 81 71 90 95 86 50 83 55 55 54\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n34 35 99 64 2 66 78 93 20 48 12 79 19 10 87 7 42 92 60 79 5 2 24 89 57 48 63 92 74 4 16 51 7 12 90 48 87 17 18 73 51 58 97 97 25 38 15 97 96 73 67 91 6 75 14 13 87 79 75 3 15 55 35 95 71 45 10 13 20 37 82 26 2 22 13 83 97 84 39 79 43 100 54 59 98 8 61 34 7 65 75 44 24 77 73 88 34 95 44 77\\r\\n'], 'output': ['55\\r\\n']}, {'input': ['100\\r\\n15 86 3 1 51 26 74 85 37 87 64 58 10 6 57 26 30 47 85 65 24 72 50 40 12 35 91 47 91 60 47 87 95 34 80 91 26 3 36 39 14 86 28 70 51 44 28 21 72 79 57 61 16 71 100 94 57 67 36 74 24 21 89 85 25 2 97 67 76 53 76 80 97 64 35 13 8 32 21 52 62 61 67 14 74 73 66 44 55 76 24 3 43 42 99 61 36 80 38 66\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['100\\r\\n45 16 54 54 80 94 74 93 75 85 58 95 79 30 81 2 84 4 57 23 92 64 78 1 50 36 13 27 56 54 10 77 87 1 5 38 85 74 94 82 30 45 72 83 82 30 81 82 82 3 69 82 7 92 39 60 94 42 41 5 3 17 67 21 79 44 79 96 28 3 53 68 79 89 63 83 1 44 4 31 84 15 73 77 19 66 54 6 73 1 67 24 91 11 86 45 96 82 20 89\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n84 23 50 32 90 71 92 43 58 70 6 82 7 55 85 19 70 89 12 26 29 56 74 30 2 27 4 39 63 67 91 81 11 33 75 10 82 88 39 43 43 80 68 35 55 67 53 62 73 65 86 74 43 51 14 48 42 92 83 57 22 33 24 99 5 27 78 96 7 28 11 15 8 38 85 67 5 92 24 96 57 59 14 95 91 4 9 18 45 33 74 83 64 85 14 51 51 94 29 2\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n77 56 56 45 73 55 32 37 39 50 30 95 79 21 44 34 51 43 86 91 39 30 85 15 35 93 100 14 57 31 80 79 38 40 88 4 91 54 7 95 76 26 62 84 17 33 67 47 6 82 69 51 17 2 59 24 11 12 31 90 12 11 55 38 72 49 30 50 42 46 5 97 9 9 30 45 86 23 19 82 40 42 5 40 35 98 35 32 60 60 5 28 84 35 21 49 68 53 68 23\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n78 38 79 61 45 86 83 83 86 90 74 69 2 84 73 39 2 5 20 71 24 80 54 89 58 34 77 40 39 62 2 47 28 53 97 75 88 98 94 96 33 71 44 90 47 36 19 89 87 98 90 87 5 85 34 79 82 3 42 88 89 63 35 7 89 30 40 48 12 41 56 76 83 60 80 80 39 56 77 4 72 96 30 55 57 51 7 19 11 1 66 1 91 87 11 62 95 85 79 25\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n5 34 23 20 76 75 19 51 17 82 60 13 83 6 65 16 20 43 66 54 87 10 87 73 50 24 16 98 33 28 80 52 54 82 26 92 14 13 84 92 94 29 61 21 60 20 48 94 24 20 75 70 58 27 68 45 86 89 29 8 67 38 83 48 18 100 11 22 46 84 52 97 70 19 50 75 3 7 52 53 72 41 18 31 1 38 49 53 11 64 99 76 9 87 48 12 100 32 44 71\\r\\n'], 'output': ['58\\r\\n']}, {'input': ['100\\r\\n76 89 68 78 24 72 73 95 98 72 58 15 2 5 56 32 9 65 50 70 94 31 29 54 89 52 31 93 43 56 26 35 72 95 51 55 78 70 11 92 17 5 54 94 81 31 78 95 73 91 95 37 59 9 53 48 65 55 84 8 45 97 64 37 96 34 36 53 66 17 72 48 99 23 27 18 92 84 44 73 60 78 53 29 68 99 19 39 61 40 69 6 77 12 47 29 15 4 8 45\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n82 40 31 53 8 50 85 93 3 84 54 17 96 59 51 42 18 19 35 84 79 31 17 46 54 82 72 49 35 73 26 89 61 73 3 50 12 29 25 77 88 21 58 24 22 89 96 54 82 29 96 56 77 16 1 68 90 93 20 23 57 22 31 18 92 90 51 14 50 72 31 54 12 50 66 62 2 34 17 45 68 50 87 97 23 71 1 72 17 82 42 15 20 78 4 49 66 59 10 17\\r\\n'], 'output': ['54\\r\\n']}, {'input': ['100\\r\\n32 82 82 24 39 53 48 5 29 24 9 37 91 37 91 95 1 97 84 52 12 56 93 47 22 20 14 17 40 22 79 34 24 2 69 30 69 29 3 89 21 46 60 92 39 29 18 24 49 18 40 22 60 13 77 50 39 64 50 70 99 8 66 31 90 38 20 54 7 21 5 56 41 68 69 20 54 89 69 62 9 53 43 89 81 97 15 2 52 78 89 65 16 61 59 42 56 25 32 52\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['100\\r\\n72 54 23 24 97 14 99 87 15 25 7 23 17 87 72 31 71 87 34 82 51 77 74 85 62 38 24 7 84 48 98 21 29 71 70 84 25 58 67 92 18 44 32 9 81 15 53 29 63 18 86 16 7 31 38 99 70 32 89 16 23 11 66 96 69 82 97 59 6 9 49 80 85 19 6 9 52 51 85 74 53 46 73 55 31 63 78 61 34 80 77 65 87 77 92 52 89 8 52 31\\r\\n'], 'output': ['44\\r\\n']}, {'input': ['100\\r\\n56 88 8 19 7 15 11 54 35 50 19 57 63 72 51 43 50 19 57 90 40 100 8 92 11 96 30 32 59 65 93 47 62 3 50 41 30 50 72 83 61 46 83 60 20 46 33 1 5 18 83 22 34 16 41 95 63 63 7 59 55 95 91 29 64 60 64 81 45 45 10 9 88 37 69 85 21 82 41 76 42 34 47 78 51 83 65 100 13 22 59 76 63 1 26 86 36 94 99 74\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['100\\r\\n27 89 67 60 62 80 43 50 28 88 72 5 94 11 63 91 18 78 99 3 71 26 12 97 74 62 23 24 22 3 100 72 98 7 94 32 12 75 61 88 42 48 10 14 45 9 48 56 73 76 70 70 79 90 35 39 96 37 81 11 19 65 99 39 23 79 34 61 35 74 90 37 73 23 46 21 94 84 73 58 11 89 13 9 10 85 42 78 73 32 53 39 49 90 43 5 28 31 97 75\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n33 24 97 96 1 14 99 51 13 65 67 20 46 88 42 44 20 49 5 89 98 83 15 40 74 83 58 3 10 79 34 2 69 28 37 100 55 52 14 8 44 94 97 89 6 42 11 28 30 33 55 56 20 57 52 25 75 1 87 42 62 41 37 12 54 85 95 80 42 36 94 96 28 76 54 36 4 17 26 24 62 15 17 79 84 36 92 78 74 91 96 77 54 92 81 91 62 98 37 37\\r\\n'], 'output': ['43\\r\\n']}, {'input': ['100\\r\\n86 24 61 15 11 85 1 31 47 36 23 36 59 34 3 27 16 29 82 28 58 52 52 66 71 61 98 39 60 20 67 41 67 90 73 29 92 17 70 95 58 98 58 32 21 73 46 56 87 72 80 75 40 27 94 31 59 92 93 37 14 99 96 21 97 23 81 91 52 52 96 94 92 28 38 29 52 16 57 27 17 24 91 21 79 55 96 98 95 94 23 78 79 12 77 35 32 75 100 82\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n88 85 41 37 69 21 7 69 36 5 92 26 64 75 22 46 67 20 70 22 62 66 38 24 47 49 68 30 90 31 67 86 86 82 9 51 43 45 48 42 73 44 31 94 45 60 54 66 20 87 11 94 34 32 87 66 56 28 75 39 37 90 72 93 55 72 31 42 30 71 87 61 4 12 12 81 23 61 56 98 71 32 30 33 96 63 92 16 8 78 47 91 47 54 49 3 81 82 41 5\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n1 1 3 2 2\\r\\n'], 'output': ['3\\r\\n']}]","id":409} {"difficulty":1200,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"129_B","execute_outcome":"WRONG_ANSWER","source_code":"\"use strict\";\r\n\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n\r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\n\r\nprocess.stdin.on(\"end\", (_) => {\r\n inputString = inputString\r\n .trim()\r\n .split(\"\\n\")\r\n .map((string) => {\r\n return string.trim();\r\n });\r\n\r\n main();\r\n});\r\n\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n\/\/ Make a Snippet for the code above this and then write your logic in main();\r\n\r\nfunction main() { \r\n \r\n \r\n let [n,m] = readline().split(\" \").map(x=>+x);\r\n \r\n \r\n let matrix = [];\r\n for (let i = 0; i < m; i++) {\r\n matrix.push(\r\n readline()\r\n .split(\" \")\r\n .map((x) => +x)\r\n );\r\n }\r\n \r\n \r\n \r\n studentsAndShoelaces(n,m,matrix);\r\n \r\n \r\n \r\n \r\n \r\n \r\n}\r\n \r\n \r\nlet graph = {};\r\nlet counter = 0;\r\n\r\nfunction studentsAndShoelaces(n, m, studentsConnections) {\r\n graph = {};\r\n counter = 0;\r\n for (let i = 0; i < m; i++) {\r\n const [a, b] = studentsConnections[i];\r\n\r\n graph[a] ? graph[a].push(b) : (graph[a] = [b]);\r\n\r\n graph[b] ? graph[b].push(a) : (graph[b] = [a]);\r\n }\r\n\r\n removeSingles();\r\n\r\n console.log(counter);\r\n}\r\n\r\nfunction removeSingles() {\r\n \/\/ console.log(graph);\r\n\r\n let toRemoveNodes = [];\r\n for (const node in graph) {\r\n if (graph[node].length === 1) {\r\n toRemoveNodes.push(node);\r\n\r\n delete graph[node];\r\n }\r\n }\r\n\r\n if (toRemoveNodes.length) {\r\n for (const node in graph) {\r\n graph[node] = graph[node].filter((x) => toRemoveNodes.includes(`${x}`));\r\n }\r\n counter++;\r\n\r\n toRemoveNodes = [];\r\n\r\n removeSingles();\r\n } else {\r\n return;\r\n }\r\n}\r\n\r\n","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\u2264a,b\u2264n,a\u2260b). It is guaranteed that no two students are tied with more than one lace. No lace ties a student to himself.\n","output_specification":"Print the single number \u2014 the number of groups of students that will be kicked out from the club.\n","notes":"In 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.\nIn 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.\nIn 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.\n","sample_inputs":["3 3\n1 2\n2 3\n3 1\n","6 3\n1 2\n2 3\n3 4\n","6 5\n1 4\n2 4\n3 4\n5 4\n6 4\n"],"sample_outputs":["0\n","2\n","1\n"],"human_solution":"\"use strict\";\r\n\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n\r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\n\r\nprocess.stdin.on(\"end\", (_) => {\r\n inputString = inputString\r\n .trim()\r\n .split(\"\\n\")\r\n .map((string) => {\r\n return string.trim();\r\n });\r\n\r\n main();\r\n});\r\n\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n\/\/ Make a Snippet for the code above this and then write your logic in main();\r\n\r\nfunction main() { \r\n \r\n \r\n let [n,m] = readline().split(\" \").map(x=>+x);\r\n \r\n \r\n let matrix = [];\r\n for (let i = 0; i < m; i++) {\r\n matrix.push(\r\n readline()\r\n .split(\" \")\r\n .map((x) => x)\r\n );\r\n }\r\n \r\n \r\n \r\n studentsAndShoelaces(n,m,matrix);\r\n \r\n \r\n \r\n \r\n \r\n \r\n}\r\n let graph = {};\r\nlet counter = 0;\r\n\r\nfunction studentsAndShoelaces(n, m, studentsConnections) {\r\n graph = {};\r\n counter = 0;\r\n\r\n for (let i = 0; i < m; i++) {\r\n const [a, b] = studentsConnections[i];\r\n\r\n graph[a] ? graph[a].push(b) : (graph[a] = [b]);\r\n\r\n graph[b] ? graph[b].push(a) : (graph[b] = [a]);\r\n }\r\n\r\n removeSingles();\r\n\r\n console.log(counter);\r\n}\r\n\r\nfunction removeSingles() {\r\n let toRemoveNodes = [];\r\n for (const node in graph) {\r\n if (graph[node].length === 1) {\r\n toRemoveNodes.push(node);\r\n\r\n delete graph[node];\r\n }\r\n }\r\n\r\n if (toRemoveNodes.length) {\r\n for (const node in graph) {\r\n graph[node] = graph[node].filter((x) => !toRemoveNodes.includes(x));\r\n }\r\n counter++;\r\n\r\n toRemoveNodes = [];\r\n\r\n removeSingles();\r\n } else {\r\n return;\r\n }\r\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":410} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"136_A","execute_outcome":"WRONG_ANSWER","source_code":"const rl = require('readline').createInterface( process.stdin, process.stdout );\r\n\r\nrl.question( '', ans => {\r\n let arr;\r\n rl.on( 'line', line => {\r\n arr = line.split(\" \");\r\n solve( arr );\r\n rl.close();\r\n } )\r\n} )\r\n\r\nfunction solve( arr ){\r\n let output = [];\r\n\r\n arr.map( (n, i) => {\r\n output[n-1] = i+1;\r\n } )\r\n\r\n console.log(output);\r\n}","description":"Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there.If there's one thing Petya likes more that receiving gifts, that's watching others giving gifts to somebody else. Thus, he safely hid the laptop until the next New Year and made up his mind to watch his friends exchanging gifts while he does not participate in the process. He numbered all his friends with integers from 1 to n. Petya remembered that a friend number i gave a gift to a friend number pi. He also remembered that each of his friends received exactly one gift.Now Petya wants to know for each friend i the number of a friend who has given him a gift.","input_specification":"The first line contains one integer n (1\u2264n\u2264100) \u2014 the quantity of friends Petya invited to the party. The second line contains n space-separated integers: the i-th number is pi \u2014 the number of a friend who gave a gift to friend number i. It is guaranteed that each friend received exactly one gift. It is possible that some friends do not share Petya's ideas of giving gifts to somebody else. Those friends gave the gifts to themselves.\n","output_specification":"Print n space-separated integers: the i-th number should equal the number of the friend who gave a gift to friend number i.\n","notes":null,"sample_inputs":["4\n2 3 4 1\n","3\n1 3 2\n","2\n1 2\n"],"sample_outputs":["4 1 2 3\n","1 3 2\n","1 2\n"],"human_solution":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n \r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n \r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on('end', _ => {\r\n inputString = inputString.trim().split('\\n').map(string => {\r\n return string.trim();\r\n });\r\n \r\n main(); \r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n \r\n\r\n\/\/ ********** Code Start **********\r\n \r\nfunction main (){\r\n let n = readline()\r\n let friends = readline().split(\" \").map(i => parseInt(i))\r\n let answer = new Array(n)\r\n for (let i = 0; i < n; i++) {\r\n answer[friends[i]-1] = i+1 \r\n }\r\n answer = answer.join(\" \")\r\n print(answer)\r\n}","testcases":"[{'input': ['4\\r\\n2 3 4 1\\r\\n'], 'output': ['4 1 2 3\\r\\n']}, {'input': ['3\\r\\n1 3 2\\r\\n'], 'output': ['1 3 2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n1 3 2 6 4 5 7 9 8 10\\r\\n'], 'output': ['1 3 2 5 6 4 7 9 8 10\\r\\n']}, {'input': ['5\\r\\n5 4 3 2 1\\r\\n'], 'output': ['5 4 3 2 1\\r\\n']}, {'input': ['20\\r\\n2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19\\r\\n']}, {'input': ['21\\r\\n3 2 1 6 5 4 9 8 7 12 11 10 15 14 13 18 17 16 21 20 19\\r\\n'], 'output': ['3 2 1 6 5 4 9 8 7 12 11 10 15 14 13 18 17 16 21 20 19\\r\\n']}, {'input': ['10\\r\\n3 4 5 6 7 8 9 10 1 2\\r\\n'], 'output': ['9 10 1 2 3 4 5 6 7 8\\r\\n']}, {'input': ['8\\r\\n1 5 3 7 2 6 4 8\\r\\n'], 'output': ['1 5 3 7 2 6 4 8\\r\\n']}, {'input': ['50\\r\\n49 22 4 2 20 46 7 32 5 19 48 24 26 15 45 21 44 11 50 43 39 17 31 1 42 34 3 27 36 25 12 30 13 33 28 35 18 6 8 37 38 14 10 9 29 16 40 23 41 47\\r\\n'], 'output': ['24 4 27 3 9 38 7 39 44 43 18 31 33 42 14 46 22 37 10 5 16 2 48 12 30 13 28 35 45 32 23 8 34 26 36 29 40 41 21 47 49 25 20 17 15 6 50 11 1 19\\r\\n']}, {'input': ['34\\r\\n13 20 33 30 15 11 27 4 8 2 29 25 24 7 3 22 18 10 26 16 5 1 32 9 34 6 12 14 28 19 31 21 23 17\\r\\n'], 'output': ['22 10 15 8 21 26 14 9 24 18 6 27 1 28 5 20 34 17 30 2 32 16 33 13 12 19 7 29 11 4 31 23 3 25\\r\\n']}, {'input': ['92\\r\\n23 1 6 4 84 54 44 76 63 34 61 20 48 13 28 78 26 46 90 72 24 55 91 89 53 38 82 5 79 92 29 32 15 64 11 88 60 70 7 66 18 59 8 57 19 16 42 21 80 71 62 27 75 86 36 9 83 73 74 50 43 31 56 30 17 33 40 81 49 12 10 41 22 77 25 68 51 2 47 3 58 69 87 67 39 37 35 65 14 45 52 85\\r\\n'], 'output': ['2 78 80 4 28 3 39 43 56 71 35 70 14 89 33 46 65 41 45 12 48 73 1 21 75 17 52 15 31 64 62 32 66 10 87 55 86 26 85 67 72 47 61 7 90 18 79 13 69 60 77 91 25 6 22 63 44 81 42 37 11 51 9 34 88 40 84 76 82 38 50 20 58 59 53 8 74 16 29 49 68 27 57 5 92 54 83 36 24 19 23 30\\r\\n']}, {'input': ['49\\r\\n30 24 33 48 7 3 17 2 8 35 10 39 23 40 46 32 18 21 26 22 1 16 47 45 41 28 31 6 12 43 27 11 13 37 19 15 44 5 29 42 4 38 20 34 14 9 25 36 49\\r\\n'], 'output': ['21 8 6 41 38 28 5 9 46 11 32 29 33 45 36 22 7 17 35 43 18 20 13 2 47 19 31 26 39 1 27 16 3 44 10 48 34 42 12 14 25 40 30 37 24 15 23 4 49\\r\\n']}, {'input': ['12\\r\\n3 8 7 4 6 5 2 1 11 9 10 12\\r\\n'], 'output': ['8 7 1 4 6 5 3 2 10 11 9 12\\r\\n']}, {'input': ['78\\r\\n16 56 36 78 21 14 9 77 26 57 70 61 41 47 18 44 5 31 50 74 65 52 6 39 22 62 67 69 43 7 64 29 24 40 48 51 73 54 72 12 19 34 4 25 55 33 17 35 23 53 10 8 27 32 42 68 20 63 3 2 1 71 58 46 13 30 49 11 37 66 38 60 28 75 15 59 45 76\\r\\n'], 'output': ['61 60 59 43 17 23 30 52 7 51 68 40 65 6 75 1 47 15 41 57 5 25 49 33 44 9 53 73 32 66 18 54 46 42 48 3 69 71 24 34 13 55 29 16 77 64 14 35 67 19 36 22 50 38 45 2 10 63 76 72 12 26 58 31 21 70 27 56 28 11 62 39 37 20 74 78 8 4\\r\\n']}, {'input': ['64\\r\\n64 57 40 3 15 8 62 18 33 59 51 19 22 13 4 37 47 45 50 35 63 11 58 42 46 21 7 2 41 48 32 23 28 38 17 12 24 27 49 31 60 6 30 25 61 52 26 54 9 14 29 20 44 39 55 10 34 16 5 56 1 36 53 43\\r\\n'], 'output': ['61 28 4 15 59 42 27 6 49 56 22 36 14 50 5 58 35 8 12 52 26 13 32 37 44 47 38 33 51 43 40 31 9 57 20 62 16 34 54 3 29 24 64 53 18 25 17 30 39 19 11 46 63 48 55 60 2 23 10 41 45 7 21 1\\r\\n']}, {'input': ['49\\r\\n38 20 49 32 14 41 39 45 25 48 40 19 26 43 34 12 10 3 35 42 5 7 46 47 4 2 13 22 16 24 33 15 11 18 29 31 23 9 44 36 6 17 37 1 30 28 8 21 27\\r\\n'], 'output': ['44 26 18 25 21 41 22 47 38 17 33 16 27 5 32 29 42 34 12 2 48 28 37 30 9 13 49 46 35 45 36 4 31 15 19 40 43 1 7 11 6 20 14 39 8 23 24 10 3\\r\\n']}, {'input': ['78\\r\\n17 50 30 48 33 12 42 4 18 53 76 67 38 3 20 72 51 55 60 63 46 10 57 45 54 32 24 62 8 11 35 44 65 74 58 28 2 6 56 52 39 23 47 49 61 1 66 41 15 77 7 27 78 13 14 34 5 31 37 21 40 16 29 69 59 43 64 36 70 19 25 73 71 75 9 68 26 22\\r\\n'], 'output': ['46 37 14 8 57 38 51 29 75 22 30 6 54 55 49 62 1 9 70 15 60 78 42 27 71 77 52 36 63 3 58 26 5 56 31 68 59 13 41 61 48 7 66 32 24 21 43 4 44 2 17 40 10 25 18 39 23 35 65 19 45 28 20 67 33 47 12 76 64 69 73 16 72 34 74 11 50 53\\r\\n']}, {'input': ['29\\r\\n14 21 27 1 4 18 10 17 20 23 2 24 7 9 28 22 8 25 12 15 11 6 16 29 3 26 19 5 13\\r\\n'], 'output': ['4 11 25 5 28 22 13 17 14 7 21 19 29 1 20 23 8 6 27 9 2 16 10 12 18 26 3 15 24\\r\\n']}, {'input': ['82\\r\\n6 1 10 75 28 66 61 81 78 63 17 19 58 34 49 12 67 50 41 44 3 15 59 38 51 72 36 11 46 29 18 64 27 23 13 53 56 68 2 25 47 40 69 54 42 5 60 55 4 16 24 79 57 20 7 73 32 80 76 52 82 37 26 31 65 8 39 62 33 71 30 9 77 43 48 74 70 22 14 45 35 21\\r\\n'], 'output': ['2 39 21 49 46 1 55 66 72 3 28 16 35 79 22 50 11 31 12 54 82 78 34 51 40 63 33 5 30 71 64 57 69 14 81 27 62 24 67 42 19 45 74 20 80 29 41 75 15 18 25 60 36 44 48 37 53 13 23 47 7 68 10 32 65 6 17 38 43 77 70 26 56 76 4 59 73 9 52 58 8 61\\r\\n']}, {'input': ['82\\r\\n74 18 15 69 71 77 19 26 80 20 66 7 30 82 22 48 21 44 52 65 64 61 35 49 12 8 53 81 54 16 11 9 40 46 13 1 29 58 5 41 55 4 78 60 6 51 56 2 38 36 34 62 63 25 17 67 45 14 32 37 75 79 10 47 27 39 31 68 59 24 50 43 72 70 42 28 76 23 57 3 73 33\\r\\n'], 'output': ['36 48 80 42 39 45 12 26 32 63 31 25 35 58 3 30 55 2 7 10 17 15 78 70 54 8 65 76 37 13 67 59 82 51 23 50 60 49 66 33 40 75 72 18 57 34 64 16 24 71 46 19 27 29 41 47 79 38 69 44 22 52 53 21 20 11 56 68 4 74 5 73 81 1 61 77 6 43 62 9 28 14\\r\\n']}, {'input': ['45\\r\\n2 32 34 13 3 15 16 33 22 12 31 38 42 14 27 7 36 8 4 19 45 41 5 35 10 11 39 20 29 44 17 9 6 40 37 28 25 21 1 30 24 18 43 26 23\\r\\n'], 'output': ['39 1 5 19 23 33 16 18 32 25 26 10 4 14 6 7 31 42 20 28 38 9 45 41 37 44 15 36 29 40 11 2 8 3 24 17 35 12 27 34 22 13 43 30 21\\r\\n']}, {'input': ['45\\r\\n4 32 33 39 43 21 22 35 45 7 14 5 16 9 42 31 24 36 17 29 41 25 37 34 27 20 11 44 3 13 19 2 1 10 26 30 38 18 6 8 15 23 40 28 12\\r\\n'], 'output': ['33 32 29 1 12 39 10 40 14 34 27 45 30 11 41 13 19 38 31 26 6 7 42 17 22 35 25 44 20 36 16 2 3 24 8 18 23 37 4 43 21 15 5 28 9\\r\\n']}, {'input': ['74\\r\\n48 72 40 67 17 4 27 53 11 32 25 9 74 2 41 24 56 22 14 21 33 5 18 55 20 7 29 36 69 13 52 19 38 30 68 59 66 34 63 6 47 45 54 44 62 12 50 71 16 10 8 64 57 73 46 26 49 42 3 23 35 1 61 39 70 60 65 43 15 28 37 51 58 31\\r\\n'], 'output': ['62 14 59 6 22 40 26 51 12 50 9 46 30 19 69 49 5 23 32 25 20 18 60 16 11 56 7 70 27 34 74 10 21 38 61 28 71 33 64 3 15 58 68 44 42 55 41 1 57 47 72 31 8 43 24 17 53 73 36 66 63 45 39 52 67 37 4 35 29 65 48 2 54 13\\r\\n']}, {'input': ['47\\r\\n9 26 27 10 6 34 28 42 39 22 45 21 11 43 14 47 38 15 40 32 46 1 36 29 17 25 2 23 31 5 24 4 7 8 12 19 16 44 37 20 18 33 30 13 35 41 3\\r\\n'], 'output': ['22 27 47 32 30 5 33 34 1 4 13 35 44 15 18 37 25 41 36 40 12 10 28 31 26 2 3 7 24 43 29 20 42 6 45 23 39 17 9 19 46 8 14 38 11 21 16\\r\\n']}, {'input': ['49\\r\\n14 38 6 29 9 49 36 43 47 3 44 20 34 15 7 11 1 28 12 40 16 37 31 10 42 41 33 21 18 30 5 27 17 35 25 26 45 19 2 13 23 32 4 22 46 48 24 39 8\\r\\n'], 'output': ['17 39 10 43 31 3 15 49 5 24 16 19 40 1 14 21 33 29 38 12 28 44 41 47 35 36 32 18 4 30 23 42 27 13 34 7 22 2 48 20 26 25 8 11 37 45 9 46 6\\r\\n']}, {'input': ['100\\r\\n78 56 31 91 90 95 16 65 58 77 37 89 33 61 10 76 62 47 35 67 69 7 63 83 22 25 49 8 12 30 39 44 57 64 48 42 32 11 70 43 55 50 99 24 85 73 45 14 54 21 98 84 74 2 26 18 9 36 80 53 75 46 66 86 59 93 87 68 94 13 72 28 79 88 92 29 52 82 34 97 19 38 1 41 27 4 40 5 96 100 51 6 20 23 81 15 17 3 60 71\\r\\n'], 'output': ['83 54 98 86 88 92 22 28 57 15 38 29 70 48 96 7 97 56 81 93 50 25 94 44 26 55 85 72 76 30 3 37 13 79 19 58 11 82 31 87 84 36 40 32 47 62 18 35 27 42 91 77 60 49 41 2 33 9 65 99 14 17 23 34 8 63 20 68 21 39 100 71 46 53 61 16 10 1 73 59 95 78 24 52 45 64 67 74 12 5 4 75 66 69 6 89 80 51 43 90\\r\\n']}, {'input': ['22\\r\\n12 8 11 2 16 7 13 6 22 21 20 10 4 14 18 1 5 15 3 19 17 9\\r\\n'], 'output': ['16 4 19 13 17 8 6 2 22 12 3 1 7 14 18 5 21 15 20 11 10 9\\r\\n']}, {'input': ['72\\r\\n16 11 49 51 3 27 60 55 23 40 66 7 53 70 13 5 15 32 18 72 33 30 8 31 46 12 28 67 25 38 50 22 69 34 71 52 58 39 24 35 42 9 41 26 62 1 63 65 36 64 68 61 37 14 45 47 6 57 54 20 17 2 56 59 29 10 4 48 21 43 19 44\\r\\n'], 'output': ['46 62 5 67 16 57 12 23 42 66 2 26 15 54 17 1 61 19 71 60 69 32 9 39 29 44 6 27 65 22 24 18 21 34 40 49 53 30 38 10 43 41 70 72 55 25 56 68 3 31 4 36 13 59 8 63 58 37 64 7 52 45 47 50 48 11 28 51 33 14 35 20\\r\\n']}, {'input': ['63\\r\\n21 56 11 10 62 24 20 42 28 52 38 2 37 43 48 22 7 8 40 14 13 46 53 1 23 4 60 63 51 36 25 12 39 32 49 16 58 44 31 61 33 50 55 54 45 6 47 41 9 57 30 29 26 18 19 27 15 34 3 35 59 5 17\\r\\n'], 'output': ['24 12 59 26 62 46 17 18 49 4 3 32 21 20 57 36 63 54 55 7 1 16 25 6 31 53 56 9 52 51 39 34 41 58 60 30 13 11 33 19 48 8 14 38 45 22 47 15 35 42 29 10 23 44 43 2 50 37 61 27 40 5 28\\r\\n']}, {'input': ['18\\r\\n2 16 8 4 18 12 3 6 5 9 10 15 11 17 14 13 1 7\\r\\n'], 'output': ['17 1 7 4 9 8 18 3 10 11 13 6 16 15 12 2 14 5\\r\\n']}, {'input': ['47\\r\\n6 9 10 41 25 3 4 37 20 1 36 22 29 27 11 24 43 31 12 17 34 42 38 39 13 2 7 21 18 5 15 35 44 26 33 46 19 40 30 14 28 23 47 32 45 8 16\\r\\n'], 'output': ['10 26 6 7 30 1 27 46 2 3 15 19 25 40 31 47 20 29 37 9 28 12 42 16 5 34 14 41 13 39 18 44 35 21 32 11 8 23 24 38 4 22 17 33 45 36 43\\r\\n']}, {'input': ['96\\r\\n41 91 48 88 29 57 1 19 44 43 37 5 10 75 25 63 30 78 76 53 8 92 18 70 39 17 49 60 9 16 3 34 86 59 23 79 55 45 72 51 28 33 96 40 26 54 6 32 89 61 85 74 7 82 52 31 64 66 94 95 11 22 2 73 35 13 42 71 14 47 84 69 50 67 58 12 77 46 38 68 15 36 20 93 27 90 83 56 87 4 21 24 81 62 80 65\\r\\n'], 'output': ['7 63 31 90 12 47 53 21 29 13 61 76 66 69 81 30 26 23 8 83 91 62 35 92 15 45 85 41 5 17 56 48 42 32 65 82 11 79 25 44 1 67 10 9 38 78 70 3 27 73 40 55 20 46 37 88 6 75 34 28 50 94 16 57 96 58 74 80 72 24 68 39 64 52 14 19 77 18 36 95 93 54 87 71 51 33 89 4 49 86 2 22 84 59 60 43\\r\\n']}, {'input': ['73\\r\\n67 24 39 22 23 20 48 34 42 40 19 70 65 69 64 21 53 11 59 15 26 10 30 33 72 29 55 25 56 71 8 9 57 49 41 61 13 12 6 27 66 36 47 50 73 60 2 37 7 4 51 17 1 46 14 62 35 3 45 63 43 58 54 32 31 5 28 44 18 52 68 38 16\\r\\n'], 'output': ['53 47 58 50 66 39 49 31 32 22 18 38 37 55 20 73 52 69 11 6 16 4 5 2 28 21 40 67 26 23 65 64 24 8 57 42 48 72 3 10 35 9 61 68 59 54 43 7 34 44 51 70 17 63 27 29 33 62 19 46 36 56 60 15 13 41 1 71 14 12 30 25 45\\r\\n']}, {'input': ['81\\r\\n25 2 78 40 12 80 69 13 49 43 17 33 23 54 32 61 77 66 27 71 24 26 42 55 60 9 5 30 7 37 45 63 53 11 38 44 68 34 28 52 67 22 57 46 47 50 8 16 79 62 4 36 20 14 73 64 6 76 35 74 58 10 29 81 59 31 19 1 75 39 70 18 41 21 72 65 3 48 15 56 51\\r\\n'], 'output': ['68 2 77 51 27 57 29 47 26 62 34 5 8 54 79 48 11 72 67 53 74 42 13 21 1 22 19 39 63 28 66 15 12 38 59 52 30 35 70 4 73 23 10 36 31 44 45 78 9 46 81 40 33 14 24 80 43 61 65 25 16 50 32 56 76 18 41 37 7 71 20 75 55 60 69 58 17 3 49 6 64\\r\\n']}, {'input': ['12\\r\\n12 3 1 5 11 6 7 10 2 8 9 4\\r\\n'], 'output': ['3 9 2 12 4 6 7 10 11 8 5 1\\r\\n']}, {'input': ['47\\r\\n7 21 41 18 40 31 12 28 24 14 43 23 33 10 19 38 26 8 34 15 29 44 5 13 39 25 3 27 20 42 35 9 2 1 30 46 36 32 4 22 37 45 6 47 11 16 17\\r\\n'], 'output': ['34 33 27 39 23 43 1 18 32 14 45 7 24 10 20 46 47 4 15 29 2 40 12 9 26 17 28 8 21 35 6 38 13 19 31 37 41 16 25 5 3 30 11 22 42 36 44\\r\\n']}, {'input': ['8\\r\\n1 3 5 2 4 8 6 7\\r\\n'], 'output': ['1 4 2 5 3 7 8 6\\r\\n']}, {'input': ['38\\r\\n28 8 2 33 20 32 26 29 23 31 15 38 11 37 18 21 22 19 4 34 1 35 16 7 17 6 27 30 36 12 9 24 25 13 5 3 10 14\\r\\n'], 'output': ['21 3 36 19 35 26 24 2 31 37 13 30 34 38 11 23 25 15 18 5 16 17 9 32 33 7 27 1 8 28 10 6 4 20 22 29 14 12\\r\\n']}, {'input': ['10\\r\\n2 9 4 6 10 1 7 5 3 8\\r\\n'], 'output': ['6 1 9 3 8 4 7 10 2 5\\r\\n']}, {'input': ['23\\r\\n20 11 15 1 5 12 23 9 2 22 13 19 16 14 7 4 8 21 6 17 18 10 3\\r\\n'], 'output': ['4 9 23 16 5 19 15 17 8 22 2 6 11 14 3 13 20 21 12 1 18 10 7\\r\\n']}, {'input': ['10\\r\\n2 4 9 3 6 8 10 5 1 7\\r\\n'], 'output': ['9 1 4 2 8 5 10 6 3 7\\r\\n']}, {'input': ['55\\r\\n9 48 23 49 11 24 4 22 34 32 17 45 39 13 14 21 19 25 2 31 37 7 55 36 20 51 5 12 54 10 35 40 43 1 46 18 53 41 38 26 29 50 3 42 52 27 8 28 47 33 6 16 30 44 15\\r\\n'], 'output': ['34 19 43 7 27 51 22 47 1 30 5 28 14 15 55 52 11 36 17 25 16 8 3 6 18 40 46 48 41 53 20 10 50 9 31 24 21 39 13 32 38 44 33 54 12 35 49 2 4 42 26 45 37 29 23\\r\\n']}, {'input': ['58\\r\\n49 13 12 54 2 38 56 11 33 25 26 19 28 8 23 41 20 36 46 55 15 35 9 7 32 37 58 6 3 14 47 31 40 30 53 44 4 50 29 34 10 43 39 57 5 22 27 45 51 42 24 16 18 21 52 17 48 1\\r\\n'], 'output': ['58 5 29 37 45 28 24 14 23 41 8 3 2 30 21 52 56 53 12 17 54 46 15 51 10 11 47 13 39 34 32 25 9 40 22 18 26 6 43 33 16 50 42 36 48 19 31 57 1 38 49 55 35 4 20 7 44 27\\r\\n']}, {'input': ['34\\r\\n20 25 2 3 33 29 1 16 14 7 21 9 32 31 6 26 22 4 27 23 24 10 34 12 19 15 5 18 28 17 13 8 11 30\\r\\n'], 'output': ['7 3 4 18 27 15 10 32 12 22 33 24 31 9 26 8 30 28 25 1 11 17 20 21 2 16 19 29 6 34 14 13 5 23\\r\\n']}, {'input': ['53\\r\\n47 29 46 25 23 13 7 31 33 4 38 11 35 16 42 14 15 43 34 39 28 18 6 45 30 1 40 20 2 37 5 32 24 12 44 26 27 3 19 51 36 21 22 9 10 50 41 48 49 53 8 17 52\\r\\n'], 'output': ['26 29 38 10 31 23 7 51 44 45 12 34 6 16 17 14 52 22 39 28 42 43 5 33 4 36 37 21 2 25 8 32 9 19 13 41 30 11 20 27 47 15 18 35 24 3 1 48 49 46 40 53 50\\r\\n']}, {'input': ['99\\r\\n77 87 90 48 53 38 68 6 28 57 35 82 63 71 60 41 3 12 86 65 10 59 22 67 33 74 93 27 24 1 61 43 25 4 51 52 15 88 9 31 30 42 89 49 23 21 29 32 46 73 37 16 5 69 56 26 92 64 20 54 75 14 98 13 94 2 95 7 36 66 58 8 50 78 84 45 11 96 76 62 97 80 40 39 47 85 34 79 83 17 91 72 19 44 70 81 55 99 18\\r\\n'], 'output': ['30 66 17 34 53 8 68 72 39 21 77 18 64 62 37 52 90 99 93 59 46 23 45 29 33 56 28 9 47 41 40 48 25 87 11 69 51 6 84 83 16 42 32 94 76 49 85 4 44 73 35 36 5 60 97 55 10 71 22 15 31 80 13 58 20 70 24 7 54 95 14 92 50 26 61 79 1 74 88 82 96 12 89 75 86 19 2 38 43 3 91 57 27 65 67 78 81 63 98\\r\\n']}, {'input': ['32\\r\\n17 29 2 6 30 8 26 7 1 27 10 9 13 24 31 21 15 19 22 18 4 11 25 28 32 3 23 12 5 14 20 16\\r\\n'], 'output': ['9 3 26 21 29 4 8 6 12 11 22 28 13 30 17 32 1 20 18 31 16 19 27 14 23 7 10 24 2 5 15 25\\r\\n']}, {'input': ['65\\r\\n18 40 1 60 17 19 4 6 12 49 28 58 2 25 13 14 64 56 61 34 62 30 59 51 26 8 33 63 36 48 46 7 43 21 31 27 11 44 29 5 32 23 35 9 53 57 52 50 15 38 42 3 54 65 55 41 20 24 22 47 45 10 39 16 37\\r\\n'], 'output': ['3 13 52 7 40 8 32 26 44 62 37 9 15 16 49 64 5 1 6 57 34 59 42 58 14 25 36 11 39 22 35 41 27 20 43 29 65 50 63 2 56 51 33 38 61 31 60 30 10 48 24 47 45 53 55 18 46 12 23 4 19 21 28 17 54\\r\\n']}, {'input': ['71\\r\\n35 50 55 58 25 32 26 40 63 34 44 53 24 18 37 7 64 27 56 65 1 19 2 43 42 14 57 47 22 13 59 61 39 67 30 45 54 38 33 48 6 5 3 69 36 21 41 4 16 46 20 17 15 12 10 70 68 23 60 31 52 29 66 28 51 49 62 11 8 9 71\\r\\n'], 'output': ['21 23 43 48 42 41 16 69 70 55 68 54 30 26 53 49 52 14 22 51 46 29 58 13 5 7 18 64 62 35 60 6 39 10 1 45 15 38 33 8 47 25 24 11 36 50 28 40 66 2 65 61 12 37 3 19 27 4 31 59 32 67 9 17 20 63 34 57 44 56 71\\r\\n']}, {'input': ['74\\r\\n33 8 42 63 64 61 31 74 11 50 68 14 36 25 57 30 7 44 21 15 6 9 23 59 46 3 73 16 62 51 40 60 41 54 5 39 35 28 48 4 58 12 66 69 13 26 71 1 24 19 29 52 37 2 20 43 18 72 17 56 34 38 65 67 27 10 47 70 53 32 45 55 49 22\\r\\n'], 'output': ['48 54 26 40 35 21 17 2 22 66 9 42 45 12 20 28 59 57 50 55 19 74 23 49 14 46 65 38 51 16 7 70 1 61 37 13 53 62 36 31 33 3 56 18 71 25 67 39 73 10 30 52 69 34 72 60 15 41 24 32 6 29 4 5 63 43 64 11 44 68 47 58 27 8\\r\\n']}, {'input': ['96\\r\\n78 10 82 46 38 91 77 69 2 27 58 80 79 44 59 41 6 31 76 11 42 48 51 37 19 87 43 25 52 32 1 39 63 29 21 65 53 74 92 16 15 95 90 83 30 73 71 5 50 17 96 33 86 60 67 64 20 26 61 40 55 88 94 93 9 72 47 57 14 45 22 3 54 68 13 24 4 7 56 81 89 70 49 8 84 28 18 62 35 36 75 23 66 85 34 12\\r\\n'], 'output': ['31 9 72 77 48 17 78 84 65 2 20 96 75 69 41 40 50 87 25 57 35 71 92 76 28 58 10 86 34 45 18 30 52 95 89 90 24 5 32 60 16 21 27 14 70 4 67 22 83 49 23 29 37 73 61 79 68 11 15 54 59 88 33 56 36 93 55 74 8 82 47 66 46 38 91 19 7 1 13 12 80 3 44 85 94 53 26 62 81 43 6 39 64 63 42 51\\r\\n']}, {'input': ['7\\r\\n2 1 5 7 3 4 6\\r\\n'], 'output': ['2 1 5 6 3 7 4\\r\\n']}, {'input': ['51\\r\\n8 33 37 2 16 22 24 30 4 9 5 15 27 3 18 39 31 26 10 17 46 41 25 14 6 1 29 48 36 20 51 49 21 43 19 13 38 50 47 34 11 23 28 12 42 7 32 40 44 45 35\\r\\n'], 'output': ['26 4 14 9 11 25 46 1 10 19 41 44 36 24 12 5 20 15 35 30 33 6 42 7 23 18 13 43 27 8 17 47 2 40 51 29 3 37 16 48 22 45 34 49 50 21 39 28 32 38 31\\r\\n']}, {'input': ['27\\r\\n12 14 7 3 20 21 25 13 22 15 23 4 2 24 10 17 19 8 26 11 27 18 9 5 6 1 16\\r\\n'], 'output': ['26 13 4 12 24 25 3 18 23 15 20 1 8 2 10 27 16 22 17 5 6 9 11 14 7 19 21\\r\\n']}, {'input': ['71\\r\\n51 13 20 48 54 23 24 64 14 62 71 67 57 53 3 30 55 43 33 25 39 40 66 6 46 18 5 19 61 16 32 68 70 41 60 44 29 49 27 69 50 38 10 17 45 56 9 21 26 63 28 35 7 59 1 65 2 15 8 11 12 34 37 47 58 22 31 4 36 42 52\\r\\n'], 'output': ['55 57 15 68 27 24 53 59 47 43 60 61 2 9 58 30 44 26 28 3 48 66 6 7 20 49 39 51 37 16 67 31 19 62 52 69 63 42 21 22 34 70 18 36 45 25 64 4 38 41 1 71 14 5 17 46 13 65 54 35 29 10 50 8 56 23 12 32 40 33 11\\r\\n']}, {'input': ['9\\r\\n8 5 2 6 1 9 4 7 3\\r\\n'], 'output': ['5 3 9 7 2 4 8 1 6\\r\\n']}, {'input': ['29\\r\\n10 24 11 5 26 25 2 9 22 15 8 14 29 21 4 1 23 17 3 12 13 16 18 28 19 20 7 6 27\\r\\n'], 'output': ['16 7 19 15 4 28 27 11 8 1 3 20 21 12 10 22 18 23 25 26 14 9 17 2 6 5 29 24 13\\r\\n']}, {'input': ['60\\r\\n39 25 42 4 55 60 16 18 47 1 11 40 7 50 19 35 49 54 12 3 30 38 2 58 17 26 45 6 33 43 37 32 52 36 15 23 27 59 24 20 28 14 8 9 13 29 44 46 41 21 5 48 51 22 31 56 57 53 10 34\\r\\n'], 'output': ['10 23 20 4 51 28 13 43 44 59 11 19 45 42 35 7 25 8 15 40 50 54 36 39 2 26 37 41 46 21 55 32 29 60 16 34 31 22 1 12 49 3 30 47 27 48 9 52 17 14 53 33 58 18 5 56 57 24 38 6\\r\\n']}, {'input': ['50\\r\\n37 45 22 5 12 21 28 24 18 47 20 25 8 50 14 2 34 43 11 16 49 41 48 1 19 31 39 46 32 23 15 42 3 35 38 30 44 26 10 9 40 36 7 17 33 4 27 6 13 29\\r\\n'], 'output': ['24 16 33 46 4 48 43 13 40 39 19 5 49 15 31 20 44 9 25 11 6 3 30 8 12 38 47 7 50 36 26 29 45 17 34 42 1 35 27 41 22 32 18 37 2 28 10 23 21 14\\r\\n']}, {'input': ['30\\r\\n8 29 28 16 17 25 27 15 21 11 6 20 2 13 1 30 5 4 24 10 14 3 23 18 26 9 12 22 19 7\\r\\n'], 'output': ['15 13 22 18 17 11 30 1 26 20 10 27 14 21 8 4 5 24 29 12 9 28 23 19 6 25 7 3 2 16\\r\\n']}, {'input': ['46\\r\\n15 2 44 43 38 19 31 42 4 37 29 30 24 45 27 41 8 20 33 7 35 3 18 46 36 26 1 28 21 40 16 22 32 11 14 13 12 9 25 39 10 6 23 17 5 34\\r\\n'], 'output': ['27 2 22 9 45 42 20 17 38 41 34 37 36 35 1 31 44 23 6 18 29 32 43 13 39 26 15 28 11 12 7 33 19 46 21 25 10 5 40 30 16 8 4 3 14 24\\r\\n']}, {'input': ['9\\r\\n4 8 6 5 3 9 2 7 1\\r\\n'], 'output': ['9 7 5 1 4 3 8 2 6\\r\\n']}, {'input': ['46\\r\\n31 30 33 23 45 7 36 8 11 3 32 39 41 20 1 28 6 27 18 24 17 5 16 37 26 13 22 14 2 38 15 46 9 4 19 21 12 44 10 35 25 34 42 43 40 29\\r\\n'], 'output': ['15 29 10 34 22 17 6 8 33 39 9 37 26 28 31 23 21 19 35 14 36 27 4 20 41 25 18 16 46 2 1 11 3 42 40 7 24 30 12 45 13 43 44 38 5 32\\r\\n']}, {'input': ['66\\r\\n27 12 37 48 46 21 34 58 38 28 66 2 64 32 44 31 13 36 40 15 19 11 22 5 30 29 6 7 61 39 20 42 23 54 51 33 50 9 60 8 57 45 49 10 62 41 59 3 55 63 52 24 25 26 43 56 65 4 16 14 1 35 18 17 53 47\\r\\n'], 'output': ['61 12 48 58 24 27 28 40 38 44 22 2 17 60 20 59 64 63 21 31 6 23 33 52 53 54 1 10 26 25 16 14 36 7 62 18 3 9 30 19 46 32 55 15 42 5 66 4 43 37 35 51 65 34 49 56 41 8 47 39 29 45 50 13 57 11\\r\\n']}, {'input': ['13\\r\\n3 12 9 2 8 5 13 4 11 1 10 7 6\\r\\n'], 'output': ['10 4 1 8 6 13 12 5 3 11 9 2 7\\r\\n']}, {'input': ['80\\r\\n21 25 56 50 20 61 7 74 51 69 8 2 46 57 45 71 14 52 17 43 9 30 70 78 31 10 38 13 23 15 37 79 6 16 77 73 80 4 49 48 18 28 26 58 33 41 64 22 54 72 59 60 40 63 53 27 1 5 75 67 62 34 19 39 68 65 44 55 3 32 11 42 76 12 35 47 66 36 24 29\\r\\n'], 'output': ['57 12 69 38 58 33 7 11 21 26 71 74 28 17 30 34 19 41 63 5 1 48 29 79 2 43 56 42 80 22 25 70 45 62 75 78 31 27 64 53 46 72 20 67 15 13 76 40 39 4 9 18 55 49 68 3 14 44 51 52 6 61 54 47 66 77 60 65 10 23 16 50 36 8 59 73 35 24 32 37\\r\\n']}, {'input': ['63\\r\\n9 49 53 25 40 46 43 51 54 22 58 16 23 26 10 47 5 27 2 8 61 59 19 35 63 56 28 20 34 4 62 38 6 55 36 31 57 15 29 33 1 48 50 37 7 30 18 42 32 52 12 41 14 21 45 11 24 17 39 13 44 60 3\\r\\n'], 'output': ['41 19 63 30 17 33 45 20 1 15 56 51 60 53 38 12 58 47 23 28 54 10 13 57 4 14 18 27 39 46 36 49 40 29 24 35 44 32 59 5 52 48 7 61 55 6 16 42 2 43 8 50 3 9 34 26 37 11 22 62 21 31 25\\r\\n']}, {'input': ['26\\r\\n11 4 19 13 17 9 2 24 6 5 22 23 14 15 3 25 16 8 18 10 21 1 12 26 7 20\\r\\n'], 'output': ['22 7 15 2 10 9 25 18 6 20 1 23 4 13 14 17 5 19 3 26 21 11 12 8 16 24\\r\\n']}, {'input': ['69\\r\\n40 22 11 66 4 27 31 29 64 53 37 55 51 2 7 36 18 52 6 1 30 21 17 20 14 9 59 62 49 68 3 50 65 57 44 5 67 46 33 13 34 15 24 48 63 58 38 25 41 35 16 54 32 10 60 61 39 12 69 8 23 45 26 47 56 43 28 19 42\\r\\n'], 'output': ['20 14 31 5 36 19 15 60 26 54 3 58 40 25 42 51 23 17 68 24 22 2 61 43 48 63 6 67 8 21 7 53 39 41 50 16 11 47 57 1 49 69 66 35 62 38 64 44 29 32 13 18 10 52 12 65 34 46 27 55 56 28 45 9 33 4 37 30 59\\r\\n']}, {'input': ['6\\r\\n4 3 6 5 1 2\\r\\n'], 'output': ['5 6 2 1 4 3\\r\\n']}, {'input': ['9\\r\\n7 8 5 3 1 4 2 9 6\\r\\n'], 'output': ['5 7 4 6 3 9 1 2 8\\r\\n']}, {'input': ['41\\r\\n27 24 16 30 25 8 32 2 26 20 39 33 41 22 40 14 36 9 28 4 34 11 31 23 19 18 17 35 3 10 6 13 5 15 29 38 7 21 1 12 37\\r\\n'], 'output': ['39 8 29 20 33 31 37 6 18 30 22 40 32 16 34 3 27 26 25 10 38 14 24 2 5 9 1 19 35 4 23 7 12 21 28 17 41 36 11 15 13\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20\\r\\n2 6 4 18 7 10 17 13 16 8 14 9 20 5 19 12 1 3 15 11\\r\\n'], 'output': ['17 1 18 3 14 2 5 10 12 6 20 16 8 11 19 9 7 4 15 13\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['2 1\\r\\n']}, {'input': ['60\\r\\n2 4 31 51 11 7 34 20 3 14 18 23 48 54 15 36 38 60 49 40 5 33 41 26 55 58 10 8 13 9 27 30 37 1 21 59 44 57 35 19 46 43 42 45 12 22 39 32 24 16 6 56 53 52 25 17 47 29 50 28\\r\\n'], 'output': ['34 1 9 2 21 51 6 28 30 27 5 45 29 10 15 50 56 11 40 8 35 46 12 49 55 24 31 60 58 32 3 48 22 7 39 16 33 17 47 20 23 43 42 37 44 41 57 13 19 59 4 54 53 14 25 52 38 26 36 18\\r\\n']}, {'input': ['14\\r\\n14 6 3 12 11 2 7 1 10 9 8 5 4 13\\r\\n'], 'output': ['8 6 3 13 12 2 7 11 10 9 5 4 14 1\\r\\n']}, {'input': ['81\\r\\n13 43 79 8 7 21 73 46 63 4 62 78 56 11 70 68 61 53 60 49 16 27 59 47 69 5 22 44 77 57 52 48 1 9 72 81 28 55 58 33 51 18 31 17 41 20 42 3 32 54 19 2 75 34 64 10 65 50 30 29 67 12 71 66 74 15 26 23 6 38 25 35 37 24 80 76 40 45 39 36 14\\r\\n'], 'output': ['33 52 48 10 26 69 5 4 34 56 14 62 1 81 66 21 44 42 51 46 6 27 68 74 71 67 22 37 60 59 43 49 40 54 72 80 73 70 79 77 45 47 2 28 78 8 24 32 20 58 41 31 18 50 38 13 30 39 23 19 17 11 9 55 57 64 61 16 25 15 63 35 7 65 53 76 29 12 3 75 36\\r\\n']}, {'input': ['42\\r\\n41 11 10 8 21 37 32 19 31 25 1 15 36 5 6 27 4 3 13 7 16 17 2 23 34 24 38 28 12 20 30 42 18 26 39 35 33 40 9 14 22 29\\r\\n'], 'output': ['11 23 18 17 14 15 20 4 39 3 2 29 19 40 12 21 22 33 8 30 5 41 24 26 10 34 16 28 42 31 9 7 37 25 36 13 6 27 35 38 1 32\\r\\n']}, {'input': ['97\\r\\n20 6 76 42 4 18 35 59 39 63 27 7 66 47 61 52 15 36 88 93 19 33 10 92 1 34 46 86 78 57 51 94 77 29 26 73 41 2 58 97 43 65 17 74 21 49 25 3 91 82 95 12 96 13 84 90 69 24 72 37 16 55 54 71 64 62 48 89 11 70 80 67 30 40 44 85 53 83 79 9 56 45 75 87 22 14 81 68 8 38 60 50 28 23 31 32 5\\r\\n'], 'output': ['25 38 48 5 97 2 12 89 80 23 69 52 54 86 17 61 43 6 21 1 45 85 94 58 47 35 11 93 34 73 95 96 22 26 7 18 60 90 9 74 37 4 41 75 82 27 14 67 46 92 31 16 77 63 62 81 30 39 8 91 15 66 10 65 42 13 72 88 57 70 64 59 36 44 83 3 33 29 79 71 87 50 78 55 76 28 84 19 68 56 49 24 20 32 51 53 40\\r\\n']}, {'input': ['62\\r\\n15 27 46 6 8 51 14 56 23 48 42 49 52 22 20 31 29 12 47 3 62 34 37 35 32 57 19 25 5 60 61 38 18 10 11 55 45 53 17 30 9 36 4 50 41 16 44 28 40 59 24 1 13 39 26 7 33 58 2 43 21 54\\r\\n'], 'output': ['52 59 20 43 29 4 56 5 41 34 35 18 53 7 1 46 39 33 27 15 61 14 9 51 28 55 2 48 17 40 16 25 57 22 24 42 23 32 54 49 45 11 60 47 37 3 19 10 12 44 6 13 38 62 36 8 26 58 50 30 31 21\\r\\n']}, {'input': ['61\\r\\n35 27 4 61 52 32 41 46 14 37 17 54 55 31 11 26 44 49 15 30 9 50 45 39 7 38 53 3 58 40 13 56 18 19 28 6 43 5 21 42 20 34 2 25 36 12 33 57 16 60 1 8 59 10 22 23 24 48 51 47 29\\r\\n'], 'output': ['51 43 28 3 38 36 25 52 21 54 15 46 31 9 19 49 11 33 34 41 39 55 56 57 44 16 2 35 61 20 14 6 47 42 1 45 10 26 24 30 7 40 37 17 23 8 60 58 18 22 59 5 27 12 13 32 48 29 53 50 4\\r\\n']}, {'input': ['59\\r\\n31 26 36 15 17 19 10 53 11 34 13 46 55 9 44 7 8 37 32 52 47 25 51 22 35 39 41 4 43 24 5 27 20 57 6 38 3 28 21 40 50 18 14 56 33 45 12 2 49 59 54 29 16 48 42 58 1 30 23\\r\\n'], 'output': ['57 48 37 28 31 35 16 17 14 7 9 47 11 43 4 53 5 42 6 33 39 24 59 30 22 2 32 38 52 58 1 19 45 10 25 3 18 36 26 40 27 55 29 15 46 12 21 54 49 41 23 20 8 51 13 44 34 56 50\\r\\n']}, {'input': ['10\\r\\n2 10 7 4 1 5 8 6 3 9\\r\\n'], 'output': ['5 1 9 4 6 8 3 7 10 2\\r\\n']}, {'input': ['14\\r\\n14 2 1 8 6 12 11 10 9 7 3 4 5 13\\r\\n'], 'output': ['3 2 11 12 13 5 10 4 9 8 7 6 14 1\\r\\n']}, {'input': ['43\\r\\n28 38 15 14 31 42 27 30 19 33 43 26 22 29 18 32 3 13 1 8 35 34 4 12 11 17 41 21 5 25 39 37 20 23 7 24 16 10 40 9 6 36 2\\r\\n'], 'output': ['19 43 17 23 29 41 35 20 40 38 25 24 18 4 3 37 26 15 9 33 28 13 34 36 30 12 7 1 14 8 5 16 10 22 21 42 32 2 31 39 27 6 11\\r\\n']}, {'input': ['86\\r\\n39 11 20 31 28 76 29 64 35 21 41 71 12 82 5 37 80 73 38 26 79 75 23 15 59 45 47 6 3 62 50 49 51 22 2 65 86 60 70 42 74 17 1 30 55 44 8 66 81 27 57 77 43 13 54 32 72 46 48 56 14 34 78 52 36 85 24 19 69 83 25 61 7 4 84 33 63 58 18 40 68 10 67 9 16 53\\r\\n'], 'output': ['43 35 29 74 15 28 73 47 84 82 2 13 54 61 24 85 42 79 68 3 10 34 23 67 71 20 50 5 7 44 4 56 76 62 9 65 16 19 1 80 11 40 53 46 26 58 27 59 32 31 33 64 86 55 45 60 51 78 25 38 72 30 77 8 36 48 83 81 69 39 12 57 18 41 22 6 52 63 21 17 49 14 70 75 66 37\\r\\n']}, {'input': ['99\\r\\n65 78 56 98 33 24 61 40 29 93 1 64 57 22 25 52 67 95 50 3 31 15 90 68 71 83 38 36 6 46 89 26 4 87 14 88 72 37 23 43 63 12 80 96 5 34 73 86 9 48 92 62 99 10 16 20 66 27 28 2 82 70 30 94 49 8 84 69 18 60 58 59 44 39 21 7 91 76 54 19 75 85 74 47 55 32 97 77 51 13 35 79 45 42 11 41 17 81 53\\r\\n'], 'output': ['11 60 20 33 45 29 76 66 49 54 95 42 90 35 22 55 97 69 80 56 75 14 39 6 15 32 58 59 9 63 21 86 5 46 91 28 38 27 74 8 96 94 40 73 93 30 84 50 65 19 89 16 99 79 85 3 13 71 72 70 7 52 41 12 1 57 17 24 68 62 25 37 47 83 81 78 88 2 92 43 98 61 26 67 82 48 34 36 31 23 77 51 10 64 18 44 87 4 53\\r\\n']}, {'input': ['100\\r\\n42 23 48 88 36 6 18 70 96 1 34 40 46 22 39 55 85 93 45 67 71 75 59 9 21 3 86 63 65 68 20 38 73 31 84 90 50 51 56 95 72 33 49 19 83 76 54 74 100 30 17 98 15 94 4 97 5 99 81 27 92 32 89 12 13 91 87 29 60 11 52 43 35 58 10 25 16 80 28 2 44 61 8 82 66 69 41 24 57 62 78 37 79 77 53 7 14 47 26 64\\r\\n'], 'output': ['10 80 26 55 57 6 96 83 24 75 70 64 65 97 53 77 51 7 44 31 25 14 2 88 76 99 60 79 68 50 34 62 42 11 73 5 92 32 15 12 87 1 72 81 19 13 98 3 43 37 38 71 95 47 16 39 89 74 23 69 82 90 28 100 29 85 20 30 86 8 21 41 33 48 22 46 94 91 93 78 59 84 45 35 17 27 67 4 63 36 66 61 18 54 40 9 56 52 58 49\\r\\n']}, {'input': ['99\\r\\n8 68 94 75 71 60 57 58 6 11 5 48 65 41 49 12 46 72 95 59 13 70 74 7 84 62 17 36 55 76 38 79 2 85 23 10 32 99 87 50 83 28 54 91 53 51 1 3 97 81 21 89 93 78 61 26 82 96 4 98 25 40 31 44 24 47 30 52 14 16 39 27 9 29 45 18 67 63 37 43 90 66 19 69 88 22 92 77 34 42 73 80 56 64 20 35 15 33 86\\r\\n'], 'output': ['47 33 48 59 11 9 24 1 73 36 10 16 21 69 97 70 27 76 83 95 51 86 35 65 61 56 72 42 74 67 63 37 98 89 96 28 79 31 71 62 14 90 80 64 75 17 66 12 15 40 46 68 45 43 29 93 7 8 20 6 55 26 78 94 13 82 77 2 84 22 5 18 91 23 4 30 88 54 32 92 50 57 41 25 34 99 39 85 52 81 44 87 53 3 19 58 49 60 38\\r\\n']}, {'input': ['99\\r\\n12 99 88 13 7 19 74 47 23 90 16 29 26 11 58 60 64 98 37 18 82 67 72 46 51 85 17 92 87 20 77 36 78 71 57 35 80 54 73 15 14 62 97 45 31 79 94 56 76 96 28 63 8 44 38 86 49 2 52 66 61 59 10 43 55 50 22 34 83 53 95 40 81 21 30 42 27 3 5 41 1 70 69 25 93 48 65 6 24 89 91 33 39 68 9 4 32 84 75\\r\\n'], 'output': ['81 58 78 96 79 88 5 53 95 63 14 1 4 41 40 11 27 20 6 30 74 67 9 89 84 13 77 51 12 75 45 97 92 68 36 32 19 55 93 72 80 76 64 54 44 24 8 86 57 66 25 59 70 38 65 48 35 15 62 16 61 42 52 17 87 60 22 94 83 82 34 23 39 7 99 49 31 33 46 37 73 21 69 98 26 56 29 3 90 10 91 28 85 47 71 50 43 18 2\\r\\n']}, {'input': ['99\\r\\n20 79 26 75 99 69 98 47 93 62 18 42 43 38 90 66 67 8 13 84 76 58 81 60 64 46 56 23 78 17 86 36 19 52 85 39 48 27 96 49 37 95 5 31 10 24 12 1 80 35 92 33 16 68 57 54 32 29 45 88 72 77 4 87 97 89 59 3 21 22 61 94 83 15 44 34 70 91 55 9 51 50 73 11 14 6 40 7 63 25 2 82 41 65 28 74 71 30 53\\r\\n'], 'output': ['48 91 68 63 43 86 88 18 80 45 84 47 19 85 74 53 30 11 33 1 69 70 28 46 90 3 38 95 58 98 44 57 52 76 50 32 41 14 36 87 93 12 13 75 59 26 8 37 40 82 81 34 99 56 79 27 55 22 67 24 71 10 89 25 94 16 17 54 6 77 97 61 83 96 4 21 62 29 2 49 23 92 73 20 35 31 64 60 66 15 78 51 9 72 42 39 65 7 5\\r\\n']}, {'input': ['99\\r\\n74 20 9 1 60 85 65 13 4 25 40 99 5 53 64 3 36 31 73 44 55 50 45 63 98 51 68 6 47 37 71 82 88 34 84 18 19 12 93 58 86 7 11 46 90 17 33 27 81 69 42 59 56 32 95 52 76 61 96 62 78 43 66 21 49 97 75 14 41 72 89 16 30 79 22 23 15 83 91 38 48 2 87 26 28 80 94 70 54 92 57 10 8 35 67 77 29 24 39\\r\\n'], 'output': ['4 82 16 9 13 28 42 93 3 92 43 38 8 68 77 72 46 36 37 2 64 75 76 98 10 84 48 85 97 73 18 54 47 34 94 17 30 80 99 11 69 51 62 20 23 44 29 81 65 22 26 56 14 89 21 53 91 40 52 5 58 60 24 15 7 63 95 27 50 88 31 70 19 1 67 57 96 61 74 86 49 32 78 35 6 41 83 33 71 45 79 90 39 87 55 59 66 25 12\\r\\n']}, {'input': ['99\\r\\n50 94 2 18 69 90 59 83 75 68 77 97 39 78 25 7 16 9 49 4 42 89 44 48 17 96 61 70 3 10 5 81 56 57 88 6 98 1 46 67 92 37 11 30 85 41 8 36 51 29 20 71 19 79 74 93 43 34 55 40 38 21 64 63 32 24 72 14 12 86 82 15 65 23 66 22 28 53 13 26 95 99 91 52 76 27 60 45 47 33 73 84 31 35 54 80 58 62 87\\r\\n'], 'output': ['38 3 29 20 31 36 16 47 18 30 43 69 79 68 72 17 25 4 53 51 62 76 74 66 15 80 86 77 50 44 93 65 90 58 94 48 42 61 13 60 46 21 57 23 88 39 89 24 19 1 49 84 78 95 59 33 34 97 7 87 27 98 64 63 73 75 40 10 5 28 52 67 91 55 9 85 11 14 54 96 32 71 8 92 45 70 99 35 22 6 83 41 56 2 81 26 12 37 82\\r\\n']}, {'input': ['99\\r\\n19 93 14 34 39 37 33 15 52 88 7 43 69 27 9 77 94 31 48 22 63 70 79 17 50 6 81 8 76 58 23 74 86 11 57 62 41 87 75 51 12 18 68 56 95 3 80 83 84 29 24 61 71 78 59 96 20 85 90 28 45 36 38 97 1 49 40 98 44 67 13 73 72 91 47 10 30 54 35 42 4 2 92 26 64 60 53 21 5 82 46 32 55 66 16 89 99 65 25\\r\\n'], 'output': ['65 82 46 81 89 26 11 28 15 76 34 41 71 3 8 95 24 42 1 57 88 20 31 51 99 84 14 60 50 77 18 92 7 4 79 62 6 63 5 67 37 80 12 69 61 91 75 19 66 25 40 9 87 78 93 44 35 30 55 86 52 36 21 85 98 94 70 43 13 22 53 73 72 32 39 29 16 54 23 47 27 90 48 49 58 33 38 10 96 59 74 83 2 17 45 56 64 68 97\\r\\n']}, {'input': ['99\\r\\n86 25 50 51 62 39 41 67 44 20 45 14 80 88 66 7 36 59 13 84 78 58 96 75 2 43 48 47 69 12 19 98 22 38 28 55 11 76 68 46 53 70 85 34 16 33 91 30 8 40 74 60 94 82 87 32 37 4 5 10 89 73 90 29 35 26 23 57 27 65 24 3 9 83 77 72 6 31 15 92 93 79 64 18 63 42 56 1 52 97 17 81 71 21 49 99 54 95 61\\r\\n'], 'output': ['88 25 72 58 59 77 16 49 73 60 37 30 19 12 79 45 91 84 31 10 94 33 67 71 2 66 69 35 64 48 78 56 46 44 65 17 57 34 6 50 7 86 26 9 11 40 28 27 95 3 4 89 41 97 36 87 68 22 18 52 99 5 85 83 70 15 8 39 29 42 93 76 62 51 24 38 75 21 82 13 92 54 74 20 43 1 55 14 61 63 47 80 81 53 98 23 90 32 96\\r\\n']}, {'input': ['100\\r\\n66 44 99 15 43 79 28 33 88 90 49 68 82 38 9 74 4 58 29 81 31 94 10 42 89 21 63 40 62 61 18 6 84 72 48 25 67 69 71 85 98 34 83 70 65 78 91 77 93 41 23 24 87 11 55 12 59 73 36 97 7 14 26 39 30 27 45 20 50 17 53 2 57 47 95 56 75 19 37 96 16 35 8 3 76 60 13 86 5 32 64 80 46 51 54 100 1 22 52 92\\r\\n'], 'output': ['97 72 84 17 89 32 61 83 15 23 54 56 87 62 4 81 70 31 78 68 26 98 51 52 36 63 66 7 19 65 21 90 8 42 82 59 79 14 64 28 50 24 5 2 67 93 74 35 11 69 94 99 71 95 55 76 73 18 57 86 30 29 27 91 45 1 37 12 38 44 39 34 58 16 77 85 48 46 6 92 20 13 43 33 40 88 53 9 25 10 47 100 49 22 75 80 60 41 3 96\\r\\n']}, {'input': ['99\\r\\n3 73 32 37 25 15 93 63 85 8 91 78 80 5 39 48 46 7 83 70 23 96 9 29 77 53 30 20 56 50 13 45 21 76 87 99 65 31 16 18 14 72 51 28 43 2 81 34 38 40 66 54 74 26 71 4 61 17 58 24 22 33 49 36 42 11 12 55 60 27 62 90 79 92 94 68 1 52 84 41 86 35 69 75 47 10 64 88 97 98 67 19 89 95 59 82 57 44 6\\r\\n'], 'output': ['77 46 1 56 14 99 18 10 23 86 66 67 31 41 6 39 58 40 92 28 33 61 21 60 5 54 70 44 24 27 38 3 62 48 82 64 4 49 15 50 80 65 45 98 32 17 85 16 63 30 43 78 26 52 68 29 97 59 95 69 57 71 8 87 37 51 91 76 83 20 55 42 2 53 84 34 25 12 73 13 47 96 19 79 9 81 35 88 93 72 11 74 7 75 94 22 89 90 36\\r\\n']}, {'input': ['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 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']}]","id":411} {"difficulty":1000,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"137_B","execute_outcome":"WRONG_ANSWER","source_code":"let i = '';\r\n\r\nprocess.stdin.on('data', c => i += c);\r\nprocess.stdin.on('end', () => {\r\n const { EOL } = require('os');\r\n\r\n \/\/ program starts here\r\n const lines = i.split(EOL);\r\n\r\n \/\/ get the numbers, sort the numbers, use reduce to count duplicates\r\n let dupes = 0;\r\n lines[1].split(\" \").sort().reduce((a, b) => {\r\n dupes += a === b;\r\n return b;\r\n }, undefined);\r\n console.log(dupes);\r\n})\r\n\r\n","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,a2,...,an 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\u2264n\u22645000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1\u2264ai\u22645000,1\u2264i\u2264n).\n","output_specification":"Print the only number \u2014 the minimum number of changes needed to get the permutation.\n","notes":"The first sample contains the permutation, which is why no replacements are required.\nIn the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.\nIn the third sample we can replace the second element with number 4 and the fourth element with number 2.\n","sample_inputs":["3\n3 1 2\n","2\n2 2\n","5\n5 3 3 3 1\n"],"sample_outputs":["0\n","1\n","2\n"],"human_solution":"\/\/Don't have to see. start------------------------------------------\r\nvar read = require('readline').createInterface({\r\n\tinput: process.stdin, output: process.stdout\r\n});\r\nvar obj; var inLine = []; var outputList = [];var retcode = new Set();\r\nread.on('line', function(input){\r\n\tvar tmp = input.split(' ');\r\n\tfor(var i = 0; i < tmp.length; i++){\r\n\t\tinLine.push(tmp[i]);\r\n\t\tif(i == tmp.length - 1){\r\n\t\t\tretcode.add(inLine.length);\r\n\t\t}\r\n\t}\r\n});\r\nread.on('close', function(){\r\n\tobj = init(inLine);\r\n\tconsole.error('\\n\u00e2\u0086\u0091\u00e5\u0085\u00a5\u00e5\u008a\u009b \u00e2\u0086\u0093\u00e5\u0087\u00ba\u00e5\u008a\u009b');\r\n\tMain();\r\n\tconsole.log(myconv(outputList, 9));\r\n});\r\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\r\nfunction nextArray(size, code){\r\n\tvar ret = new Array(size);\r\n\tfor(var i = 0; i < size; i++){\r\n\t\tif(code == 'int'){\r\n\t\t\tret[i] = nextInt();\r\n\t\t}else if(code == 'long'){\r\n\t\t\tret[i] = BigInt(next());\r\n\t\t}else{\r\n\t\t\tret[i] = next();\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\nfunction nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}\r\nfunction nextCharArray(){return myconv(next(),6);}\r\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}\r\nfunction getCountMap(list){\r\n\tvar map = {};\r\n\tfor(var i = 0; i < list.length; i++){\r\n\t\tif(map[list[i]] == null){\r\n\t\t\tmap[list[i]] = 0;\r\n\t\t}\r\n\t\tmap[list[i]]++;\r\n\t}\r\n\treturn map;\r\n}\r\nfunction init(input){ \r\n\treturn {\r\n\t\tlist : input, index : 0, max : input.length,\r\n\t\thasNext : function(){return (this.index < this.max);},\r\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u00e2\u0080\u009aThere is no more input';}},\r\n\t\tisReturn : function(){return retcode.has(this.index);}\r\n\t};\r\n}\r\nfunction myout(s){outputList.push(s);}\r\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\r\nfunction isReturn(){return obj.isReturn();}\r\n\/\/param \"no\" is\r\n\/\/unknown or outlier : return i. 1: parseInt.\r\n\/\/2: split space. 4: split space and parseInt.\r\n\/\/6: split 1 character. 7: split 1 character and parseInt.\r\n\/\/8: join space. 9: join nextline. 0: join no character.\r\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\r\n\r\n\/\/Don't have to see. end------------------------------------------\r\nfunction Main(){\r\n\tvar N = nextInt();\r\n\tvar list = nextIntArray(N);\r\n\tvar count = new Array(5001).fill(0);\r\n\tfor(var i = 0; i < N; i++){\r\n\t\tcount[list[i]]++;\r\n\t}\r\n\tvar output = 0;\r\n\tfor(var i = 1; i <= N; i++){\r\n\t\tif(count[i] == 0){\r\n\t\t\toutput++;\r\n\t\t}\r\n\t}\r\n\tmyout(output);\r\n}\r\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":412} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"144_A","execute_outcome":"WRONG_ANSWER","source_code":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n \r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n \r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on('end', _ => {\r\n inputString = inputString.trim().split('\\n').map(string => {\r\n return string.trim();\r\n });\r\n \r\n main(); \r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n \r\n\r\n\/\/ ********** Code Start **********\r\n \r\nfunction main (){\r\n let n = parseInt(readline())\r\n let soldiers = readline().split(\" \").map(height => parseInt(height))\r\n \r\n let maxIndex = 0;\r\n let minIndex = 0;\r\n let maxHeight = soldiers[0];\r\n let minHeight = soldiers[0];\r\n\r\n for (let i = 1; i < n; i++) {\r\n if (soldiers[i] >= maxHeight) {\r\n maxHeight = soldiers[i];\r\n maxIndex = i;\r\n }\r\n\r\n if (soldiers[i] <= minHeight) {\r\n minHeight = soldiers[i];\r\n minIndex = i;\r\n }\r\n }\r\n\r\n let res = 0\r\n \r\n if (maxIndex < minIndex) res = (n-1) - minIndex + maxIndex \r\n if (maxIndex > minIndex) res = (n-1) - minIndex + maxIndex - 1 \r\n\r\n print(res)\r\n\r\n}","description":"A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their height. But as there's virtually no time to do that, the soldiers lined up in the arbitrary order. However, the general is rather short-sighted and he thinks that the soldiers lined up correctly if the first soldier in the line has the maximum height and the last soldier has the minimum height. Please note that the way other solders are positioned does not matter, including the case when there are several soldiers whose height is maximum or minimum. Only the heights of the first and the last soldier are important.For example, the general considers the sequence of heights (4, 3, 4, 2, 1, 1) correct and the sequence (4, 3, 1, 2, 2) wrong.Within one second the colonel can swap any two neighboring soldiers. Help him count the minimum time needed to form a line-up which the general will consider correct.","input_specification":"The first input line contains the only integer n (2\u2264n\u2264100) which represents the number of soldiers in the line. The second line contains integers a1,a2,...,an (1\u2264ai\u2264100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. The numbers are space-separated. Numbers a1,a2,...,an are not necessarily different.\n","output_specification":"Print the only integer \u2014 the minimum number of seconds the colonel will need to form a line-up the general will like.\n","notes":"In the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).\nIn the second sample the colonel may swap the soldiers in the following sequence:\n (10, 10, 58, 31, 63, 40, 76) (10, 58, 10, 31, 63, 40, 76) (10, 58, 10, 31, 63, 76, 40) (10, 58, 10, 31, 76, 63, 40) (10, 58, 31, 10, 76, 63, 40) (10, 58, 31, 76, 10, 63, 40) (10, 58, 31, 76, 63, 10, 40) (10, 58, 76, 31, 63, 10, 40) (10, 76, 58, 31, 63, 10, 40) (76, 10, 58, 31, 63, 10, 40) (76, 10, 58, 31, 63, 40, 10) ","sample_inputs":["4\n33 44 11 22\n","7\n10 10 58 31 63 40 76\n"],"sample_outputs":["2\n","10\n"],"human_solution":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n \r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n \r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on('end', _ => {\r\n inputString = inputString.trim().split('\\n').map(string => {\r\n return string.trim();\r\n });\r\n \r\n main(); \r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n \r\n\r\n\/\/ ********** Code Start **********\r\n \r\nfunction main (){\r\n let n = parseInt(readline())\r\n let soldiers = readline().split(\" \").map(height => parseInt(height))\r\n \r\n let maxIndex = 0;\r\n let minIndex = 0;\r\n let maxHeight = soldiers[0];\r\n let minHeight = soldiers[0];\r\n\r\n for (let i = 1; i < n; i++) {\r\n if (soldiers[i] > maxHeight) {\r\n maxHeight = soldiers[i];\r\n maxIndex = i;\r\n }\r\n\r\n if (soldiers[i] <= minHeight) {\r\n minHeight = soldiers[i];\r\n minIndex = i;\r\n }\r\n }\r\n\r\n let res = 0\r\n \r\n if (maxIndex < minIndex) res = (n-1) - minIndex + maxIndex \r\n if (maxIndex > minIndex) res = (n-1) - minIndex + maxIndex - 1 \r\n\r\n print(res)\r\n\r\n}","testcases":"[{'input': ['4\\r\\n33 44 11 22\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['7\\r\\n10 10 58 31 63 40 76\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['2\\r\\n88 89\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n100 95 100 100 88\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7\\r\\n48 48 48 48 45 45 45\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n68 47 67 29 63 71 71 65 54 56\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['15\\r\\n77 68 96 60 92 75 61 60 66 79 80 65 60 95 92\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['3\\r\\n1 2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20\\r\\n30 30 30 14 30 14 30 30 30 14 30 14 14 30 14 14 30 14 14 14\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['35\\r\\n37 41 46 39 47 39 44 47 44 42 44 43 47 39 46 39 38 42 39 37 40 44 41 42 41 42 39 42 36 36 42 36 42 42 42\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['40\\r\\n99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 98 99 99 99 99 99 99 99 99 100 99 99 99 99 99 99\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['50\\r\\n48 52 44 54 53 56 62 49 39 41 53 39 40 64 53 50 62 48 40 52 51 48 40 52 61 62 62 61 48 64 55 57 56 40 48 58 41 60 60 56 64 50 64 45 48 45 46 63 59 57\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['57\\r\\n7 24 17 19 6 19 10 11 12 22 14 5 5 11 13 10 24 19 24 24 24 11 21 20 4 14 24 24 18 13 24 3 20 3 3 3 3 9 3 9 22 22 16 3 3 3 15 11 3 3 8 17 10 13 3 14 13\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['65\\r\\n58 50 35 44 35 37 36 58 38 36 58 56 56 49 48 56 58 43 40 44 52 44 58 58 57 50 43 35 55 39 38 49 53 56 50 42 41 56 34 57 49 38 34 51 56 38 58 40 53 46 48 34 38 43 49 49 58 56 41 43 44 34 38 48 36\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['69\\r\\n70 48 49 48 49 71 48 53 55 69 48 53 54 58 53 63 48 48 69 67 72 75 71 75 74 74 57 63 65 60 48 48 65 48 48 51 50 49 62 53 76 68 76 56 76 76 64 76 76 57 61 76 73 51 59 76 65 50 69 50 76 67 76 63 62 74 74 58 73\\r\\n'], 'output': ['73\\r\\n']}, {'input': ['75\\r\\n70 65 64 71 71 64 71 64 68 71 65 64 65 68 71 66 66 69 68 63 69 65 71 69 68 68 71 67 71 65 65 65 71 71 65 69 63 66 62 67 64 63 62 64 67 65 62 69 62 64 69 62 67 64 67 70 64 63 64 64 69 62 62 64 70 62 62 68 67 69 62 64 66 70 68\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['84\\r\\n92 95 84 85 94 80 90 86 80 92 95 84 86 83 86 83 93 91 95 92 84 88 82 84 84 84 80 94 93 80 94 80 95 83 85 80 95 95 80 84 86 92 83 81 90 87 81 89 92 93 80 87 90 85 93 85 93 94 93 89 94 83 93 91 80 83 90 94 95 80 95 92 85 84 93 94 94 82 91 95 95 89 85 94\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['90\\r\\n86 87 72 77 82 71 75 78 61 67 79 90 64 94 94 74 85 87 73 76 71 71 60 69 77 73 76 80 82 57 62 57 57 83 76 72 75 87 72 94 77 85 59 82 86 69 62 80 95 73 83 94 79 85 91 68 85 74 93 95 68 75 89 93 83 78 95 78 83 77 81 85 66 92 63 65 75 78 67 91 77 74 59 86 77 76 90 67 70 64\\r\\n'], 'output': ['104\\r\\n']}, {'input': ['91\\r\\n94 98 96 94 95 98 98 95 98 94 94 98 95 95 99 97 97 94 95 98 94 98 96 98 96 98 97 95 94 94 94 97 94 96 98 98 98 94 96 95 94 95 97 97 97 98 94 98 96 95 98 96 96 98 94 97 96 98 97 95 97 98 94 95 94 94 97 94 96 97 97 93 94 95 95 94 96 98 97 96 94 98 98 96 96 96 96 96 94 96 97\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['92\\r\\n44 28 32 29 41 41 36 39 40 39 41 35 41 28 35 27 41 34 28 38 43 43 41 38 27 26 28 36 30 29 39 32 35 35 32 30 39 30 37 27 41 41 28 30 43 31 35 33 36 28 44 40 41 35 31 42 37 38 37 34 39 40 27 40 33 33 44 43 34 33 34 34 35 38 38 37 30 39 35 41 45 42 41 32 33 33 31 30 43 41 43 43\\r\\n'], 'output': ['145\\r\\n']}, {'input': ['93\\r\\n46 32 52 36 39 30 57 63 63 30 32 44 27 59 46 38 40 45 44 62 35 36 51 48 39 58 36 51 51 51 48 58 59 36 29 35 31 49 64 60 34 38 42 56 33 42 52 31 63 34 45 51 35 45 33 53 33 62 31 38 66 29 51 54 28 61 32 45 57 41 36 34 47 36 31 28 67 48 52 46 32 40 64 58 27 53 43 57 34 66 43 39 26\\r\\n'], 'output': ['76\\r\\n']}, {'input': ['94\\r\\n56 55 54 31 32 42 46 29 24 54 40 40 20 45 35 56 32 33 51 39 26 56 21 56 51 27 29 39 56 52 54 43 43 55 48 51 44 49 52 49 23 19 19 28 20 26 45 33 35 51 42 36 25 25 38 23 21 35 54 50 41 20 37 28 42 20 22 43 37 34 55 21 24 38 19 41 45 34 19 33 44 54 38 31 23 53 35 32 47 40 39 31 20 34\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['95\\r\\n57 71 70 77 64 64 76 81 81 58 63 75 81 77 71 71 71 60 70 70 69 67 62 64 78 64 69 62 76 76 57 70 68 77 70 68 73 77 79 73 60 57 69 60 74 65 58 75 75 74 73 73 65 75 72 57 81 62 62 70 67 58 76 57 79 81 68 64 58 77 70 59 79 64 80 58 71 59 81 71 80 64 78 80 78 65 70 68 78 80 57 63 64 76 81\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['96\\r\\n96 95 95 95 96 97 95 97 96 95 98 96 97 95 98 96 98 96 98 96 98 95 96 95 95 95 97 97 95 95 98 98 95 96 96 95 97 96 98 96 95 97 97 95 97 97 95 94 96 96 97 96 97 97 96 94 94 97 95 95 95 96 95 96 95 97 97 95 97 96 95 94 97 97 97 96 97 95 96 94 94 95 97 94 94 97 97 97 95 97 97 95 94 96 95 95\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['97\\r\\n14 15 12 12 13 15 12 15 12 12 12 12 12 14 15 15 13 12 15 15 12 12 12 13 14 15 15 13 14 15 14 14 14 14 12 13 12 13 13 12 15 12 13 13 15 12 15 13 12 13 13 13 14 13 12 15 14 13 14 15 13 14 14 13 14 12 15 12 14 12 13 14 15 14 13 15 13 12 15 15 15 13 15 15 13 14 16 16 16 13 15 13 15 14 15 15 15\\r\\n'], 'output': ['104\\r\\n']}, {'input': ['98\\r\\n37 69 35 70 58 69 36 47 41 63 60 54 49 35 55 50 35 53 52 43 35 41 40 49 38 35 48 70 42 35 35 65 56 54 44 59 59 48 51 49 59 67 35 60 69 35 58 50 35 44 48 69 41 58 44 45 35 47 70 61 49 47 37 39 35 51 44 70 72 65 36 41 63 63 48 66 45 50 50 71 37 52 72 67 72 39 72 39 36 64 48 72 69 49 45 72 72 67\\r\\n'], 'output': ['100\\r\\n']}, {'input': ['99\\r\\n31 31 16 15 19 31 19 22 29 27 12 22 28 30 25 33 26 25 19 22 34 21 17 33 31 22 16 26 22 30 31 17 13 33 13 17 28 25 18 33 27 22 31 22 13 27 20 22 23 15 24 32 29 13 16 20 32 33 14 33 19 27 16 28 25 17 17 28 18 26 32 33 19 23 30 13 14 23 24 28 14 28 22 20 30 14 24 23 17 29 18 28 29 21 28 18 16 24 32\\r\\n'], 'output': ['107\\r\\n']}, {'input': ['100\\r\\n37 54 39 29 32 49 21 13 34 21 16 42 34 27 16 26 7 34 51 9 11 27 16 40 36 7 48 52 30 42 42 52 51 11 32 26 6 7 28 54 48 51 6 54 42 20 51 48 46 4 4 31 47 6 9 16 8 23 36 50 49 30 47 37 45 24 48 26 8 50 18 24 27 13 39 7 37 34 5 43 42 19 34 23 52 38 35 6 29 11 53 49 21 29 36 22 45 33 51 22\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['100\\r\\n41 5 20 23 5 47 28 28 64 5 12 14 34 56 22 48 6 52 39 55 62 40 24 54 39 28 56 27 35 51 14 24 38 10 55 20 39 62 52 2 30 55 49 48 15 23 59 44 31 28 66 29 62 59 31 13 28 12 50 45 41 47 29 27 64 66 14 39 62 22 44 63 24 5 63 17 42 7 25 41 49 33 31 51 63 3 37 66 19 9 2 40 16 45 56 21 34 29 39 61\\r\\n'], 'output': ['59\\r\\n']}, {'input': ['100\\r\\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95\\r\\n'], 'output': ['99\\r\\n']}, {'input': ['100\\r\\n81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n100 99\\r\\n'], 'output': ['0\\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 92 93 94 95 96 97 98 99 100\\r\\n'], 'output': ['197\\r\\n']}, {'input': ['100\\r\\n87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['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': ['0\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 2 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 3 2\\r\\n'], 'output': ['2\\r\\n']}]","id":413} {"difficulty":900,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"152_A","execute_outcome":"WRONG_ANSWER","source_code":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n\r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n\r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on(\"end\", () => {\r\n inputString = inputString.split(\"\\n\");\r\n main();\r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n\r\n\/\/ ********** Code Start **********\r\n\r\nfunction main() {\r\n \/\/ Number \/\/\r\n \/\/ String \/\/\r\n let temp = readline()\r\n .replace(\/\\r\/g, \"\")\r\n .split(\" \")\r\n .map((x) => parseInt(x));\r\n let n = temp[0];\r\n let m = temp[1];\r\n let array = [];\r\n for (let i = 0; i < n; i++) {\r\n let temp = readline()\r\n .replace(\/\\r\/g, \"\")\r\n .split(\"\")\r\n .map((x) => parseInt(x));\r\n array.push(temp);\r\n }\r\n let count = 0;\r\n let pointer = 0;\r\n let marked = [];\r\nwhile (pointer < m) {\r\n let temp = [];\r\n for (let i = 0; i < n; i++) {\r\n temp.push(array[i][pointer]);\r\n }\r\n let best = temp.sort(function (a, b) {\r\n return a - b;\r\n })[temp.length - 1];\r\n for (let j = 0; j < temp.length; j++) {\r\n if (temp[j] == best) {\r\n let exit = marked.find((item) => item == j + 1);\r\n if (!exit) {\r\n marked.push(j + 1);\r\n }\r\n }\r\n }\r\n pointer++;\r\n}\r\nconsole.log(marked.length);\r\n}\r\n","description":"Vasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got his hands on a group's gradebook.Overall the group has n students. They received marks for m subjects. Each student got a mark from 1 to 9 (inclusive) for each subject.Let's consider a student the best at some subject, if there is no student who got a higher mark for this subject. Let's consider a student successful, if there exists a subject he is the best at.Your task is to find the number of successful students in the group.","input_specification":"The first input line contains two integers n and m (1\u2264n,m\u2264100) \u2014 the number of students and the number of subjects, correspondingly. Next n lines each containing m characters describe the gradebook. Each character in the gradebook is a number from 1 to 9. Note that the marks in a rows are not sepatated by spaces.\n","output_specification":"Print the single number \u2014 the number of successful students in the given group.\n","notes":"In the first sample test the student number 1 is the best at subjects 1 and 3, student 2 is the best at subjects 1 and 2, but student 3 isn't the best at any subject.\nIn the second sample test each student is the best at at least one subject.\n","sample_inputs":["3 3\n223\n232\n112\n","3 5\n91728\n11828\n11111\n"],"sample_outputs":["2\n","3\n"],"human_solution":"const readline = require('readline');\r\nconst rl = readline.createInterface({\r\n input: process.stdin,\r\n output: process.stdout,\r\n terminal: false\r\n});\r\nlet c = 0;\r\nconst students = [];\r\nlet n, m;\r\n \r\nrl.on('line', (d) => {\r\n if (c === 0) {\r\n [n, m] = d.split(' ').map(Number);\r\n c++;\r\n return;\r\n }\r\n \r\n const marks = d;\r\n students.push(marks);\r\n c++;\r\n});\r\n \r\nrl.on('close', () => {\r\n const bests = new Set();\r\n for (let i = 0; i < students[0].length; i++) {\r\n let best = 0;\r\n for (let j = 0; j < students.length; j++) {\r\n if (students[j][i] > best) {\r\n best = students[j][i];\r\n }\r\n }\r\n \r\n for (let z = 0; z < students.length; z++) {\r\n if (students[z][i] === best) {\r\n bests.add(z);\r\n }\r\n }\r\n }\r\n \r\n console.log(bests.size);\r\n});","testcases":"[{'input': ['3 3\\r\\n223\\r\\n232\\r\\n112\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 5\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 2\\r\\n48\\r\\n27\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1\\r\\n4\\r\\n6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 2\\r\\n57\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 4\\r\\n2553\\r\\n6856\\r\\n5133\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['8 7\\r\\n6264676\\r\\n7854895\\r\\n3244128\\r\\n2465944\\r\\n8958761\\r\\n1378945\\r\\n3859353\\r\\n6615285\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['9 8\\r\\n61531121\\r\\n43529859\\r\\n18841327\\r\\n88683622\\r\\n98995641\\r\\n62741632\\r\\n57441743\\r\\n49396792\\r\\n63381994\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 20\\r\\n26855662887514171367\\r\\n48525577498621511535\\r\\n47683778377545341138\\r\\n47331616748732562762\\r\\n44876938191354974293\\r\\n24577238399664382695\\r\\n42724955594463126746\\r\\n79187344479926159359\\r\\n48349683283914388185\\r\\n82157191115518781898\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['20 15\\r\\n471187383859588\\r\\n652657222494199\\r\\n245695867594992\\r\\n726154672861295\\r\\n614617827782772\\r\\n862889444974692\\r\\n373977167653235\\r\\n645434268565473\\r\\n785993468314573\\r\\n722176861496755\\r\\n518276853323939\\r\\n723712762593348\\r\\n728935312568886\\r\\n373898548522463\\r\\n769777587165681\\r\\n247592995114377\\r\\n182375946483965\\r\\n497496542536127\\r\\n988239919677856\\r\\n859844339819143\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['13 9\\r\\n514562255\\r\\n322655246\\r\\n135162979\\r\\n733845982\\r\\n473117129\\r\\n513967187\\r\\n965649829\\r\\n799122777\\r\\n661249521\\r\\n298618978\\r\\n659352422\\r\\n747778378\\r\\n723261619\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['75 1\\r\\n2\\r\\n3\\r\\n8\\r\\n3\\r\\n2\\r\\n1\\r\\n3\\r\\n1\\r\\n5\\r\\n1\\r\\n5\\r\\n4\\r\\n8\\r\\n8\\r\\n4\\r\\n2\\r\\n5\\r\\n1\\r\\n7\\r\\n6\\r\\n3\\r\\n2\\r\\n2\\r\\n3\\r\\n5\\r\\n5\\r\\n2\\r\\n4\\r\\n7\\r\\n7\\r\\n9\\r\\n2\\r\\n9\\r\\n5\\r\\n1\\r\\n4\\r\\n9\\r\\n5\\r\\n2\\r\\n4\\r\\n6\\r\\n6\\r\\n3\\r\\n3\\r\\n9\\r\\n3\\r\\n3\\r\\n2\\r\\n3\\r\\n4\\r\\n2\\r\\n6\\r\\n9\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n7\\r\\n2\\r\\n3\\r\\n2\\r\\n9\\r\\n7\\r\\n4\\r\\n9\\r\\n1\\r\\n7\\r\\n5\\r\\n6\\r\\n8\\r\\n3\\r\\n4\\r\\n3\\r\\n4\\r\\n6\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['92 3\\r\\n418\\r\\n665\\r\\n861\\r\\n766\\r\\n529\\r\\n416\\r\\n476\\r\\n676\\r\\n561\\r\\n995\\r\\n415\\r\\n185\\r\\n291\\r\\n176\\r\\n776\\r\\n631\\r\\n556\\r\\n488\\r\\n118\\r\\n188\\r\\n437\\r\\n496\\r\\n466\\r\\n131\\r\\n914\\r\\n118\\r\\n766\\r\\n365\\r\\n113\\r\\n897\\r\\n386\\r\\n639\\r\\n276\\r\\n946\\r\\n759\\r\\n169\\r\\n494\\r\\n837\\r\\n338\\r\\n351\\r\\n783\\r\\n311\\r\\n261\\r\\n862\\r\\n598\\r\\n132\\r\\n246\\r\\n982\\r\\n575\\r\\n364\\r\\n615\\r\\n347\\r\\n374\\r\\n368\\r\\n523\\r\\n132\\r\\n774\\r\\n161\\r\\n552\\r\\n492\\r\\n598\\r\\n474\\r\\n639\\r\\n681\\r\\n635\\r\\n342\\r\\n516\\r\\n483\\r\\n141\\r\\n197\\r\\n571\\r\\n336\\r\\n175\\r\\n596\\r\\n481\\r\\n327\\r\\n841\\r\\n133\\r\\n142\\r\\n146\\r\\n246\\r\\n396\\r\\n287\\r\\n582\\r\\n556\\r\\n996\\r\\n479\\r\\n814\\r\\n497\\r\\n363\\r\\n963\\r\\n162\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['100 1\\r\\n1\\r\\n6\\r\\n9\\r\\n1\\r\\n1\\r\\n5\\r\\n5\\r\\n4\\r\\n6\\r\\n9\\r\\n6\\r\\n1\\r\\n7\\r\\n8\\r\\n7\\r\\n3\\r\\n8\\r\\n8\\r\\n7\\r\\n6\\r\\n2\\r\\n1\\r\\n5\\r\\n8\\r\\n7\\r\\n3\\r\\n5\\r\\n4\\r\\n9\\r\\n7\\r\\n1\\r\\n2\\r\\n4\\r\\n1\\r\\n6\\r\\n5\\r\\n1\\r\\n3\\r\\n9\\r\\n4\\r\\n5\\r\\n8\\r\\n1\\r\\n2\\r\\n1\\r\\n9\\r\\n7\\r\\n3\\r\\n7\\r\\n1\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n3\\r\\n9\\r\\n7\\r\\n2\\r\\n4\\r\\n7\\r\\n1\\r\\n6\\r\\n8\\r\\n1\\r\\n5\\r\\n6\\r\\n1\\r\\n1\\r\\n2\\r\\n9\\r\\n7\\r\\n4\\r\\n9\\r\\n1\\r\\n9\\r\\n4\\r\\n1\\r\\n3\\r\\n5\\r\\n2\\r\\n4\\r\\n4\\r\\n6\\r\\n5\\r\\n1\\r\\n4\\r\\n5\\r\\n8\\r\\n4\\r\\n7\\r\\n6\\r\\n5\\r\\n6\\r\\n9\\r\\n5\\r\\n8\\r\\n1\\r\\n5\\r\\n1\\r\\n6\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['100 2\\r\\n71\\r\\n87\\r\\n99\\r\\n47\\r\\n22\\r\\n87\\r\\n49\\r\\n73\\r\\n21\\r\\n12\\r\\n77\\r\\n43\\r\\n18\\r\\n41\\r\\n78\\r\\n62\\r\\n61\\r\\n16\\r\\n64\\r\\n89\\r\\n81\\r\\n54\\r\\n53\\r\\n92\\r\\n93\\r\\n94\\r\\n68\\r\\n93\\r\\n15\\r\\n68\\r\\n42\\r\\n93\\r\\n28\\r\\n19\\r\\n86\\r\\n16\\r\\n97\\r\\n17\\r\\n11\\r\\n43\\r\\n72\\r\\n76\\r\\n54\\r\\n95\\r\\n58\\r\\n53\\r\\n48\\r\\n45\\r\\n85\\r\\n85\\r\\n74\\r\\n21\\r\\n44\\r\\n51\\r\\n89\\r\\n75\\r\\n76\\r\\n17\\r\\n38\\r\\n62\\r\\n81\\r\\n22\\r\\n66\\r\\n59\\r\\n89\\r\\n85\\r\\n91\\r\\n87\\r\\n12\\r\\n97\\r\\n52\\r\\n87\\r\\n43\\r\\n89\\r\\n51\\r\\n58\\r\\n57\\r\\n98\\r\\n78\\r\\n68\\r\\n82\\r\\n41\\r\\n87\\r\\n29\\r\\n75\\r\\n72\\r\\n48\\r\\n14\\r\\n35\\r\\n71\\r\\n74\\r\\n91\\r\\n66\\r\\n67\\r\\n42\\r\\n98\\r\\n52\\r\\n54\\r\\n22\\r\\n41\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['5 20\\r\\n11111111111111111111\\r\\n11111111111111111111\\r\\n11111111111111111111\\r\\n99999999999999999999\\r\\n11111111111111111119\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 3\\r\\n111\\r\\n111\\r\\n999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3\\r\\n119\\r\\n181\\r\\n711\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['15 5\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n91728\\r\\n11828\\r\\n11111\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['2 20\\r\\n22222222222222222222\\r\\n11111111111111111111\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3\\r\\n233\\r\\n222\\r\\n111\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 15\\r\\n222222222222222\\r\\n111111111111119\\r\\n111111111111119\\r\\n111111111111111\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 1\\r\\n1\\r\\n9\\r\\n9\\r\\n9\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 3\\r\\n123\\r\\n321\\r\\n132\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 3\\r\\n113\\r\\n332\\r\\n322\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 100\\r\\n2222222222222222222222222222222222222222222222222222222222222222222222221222222222222222222222222222\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111119111111111111111111111111111\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 3\\r\\n321\\r\\n231\\r\\n123\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 100\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\\r\\n2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3\\r\\n221\\r\\n111\\r\\n111\\r\\n'], 'output': ['3\\r\\n']}]","id":414} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"155_A","execute_outcome":"WRONG_ANSWER","source_code":"const readLine = require('readline').createInterface({input: process.stdin,output: process.stdout,});\r\n \r\nlet n = false;\r\nreadLine.on('line',\r\n (w) => {\r\n if (n === false){\r\n n = Number(w);\r\n return;\r\n }\r\n const input = w.split(' ')\r\n let actuacionSorprendente = 0\r\n let maxNum = input[0];\r\n let minNum = input[0];\r\n if (input.length > 1) {\r\n for (let i = 1; i < input.length; i++) {\r\n const element = Number(input[i]);\r\n if (element > maxNum) {\r\n maxNum = element;\r\n actuacionSorprendente++\r\n\r\n }\r\n if (element < minNum) {\r\n minNum = element;\r\n actuacionSorprendente++\r\n }\r\n }\r\n }\r\n console.log(actuacionSorprendente, maxNum, minNum );\r\n }\r\n );","description":"Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For each contest where this coder participated, he wrote out a single non-negative number \u2014 the number of points his favorite coder earned in the contest. Vasya wrote out the points for the contest in the order, in which the contests run (naturally, no two contests ran simultaneously).Vasya considers a coder's performance in a contest amazing in two situations: he can break either his best or his worst performance record. First, it is amazing if during the contest the coder earns strictly more points that he earned on each past contest. Second, it is amazing if during the contest the coder earns strictly less points that he earned on each past contest. A coder's first contest isn't considered amazing. Now he wants to count the number of amazing performances the coder had throughout his whole history of participating in contests. But the list of earned points turned out long and Vasya can't code... That's why he asks you to help him.","input_specification":"The first line contains the single integer n (1\u2264n\u22641000) \u2014 the number of contests where the coder participated.\nThe next line contains n space-separated non-negative integer numbers \u2014 they are the points which the coder has earned. The points are given in the chronological order. All points do not exceed 10000.\n","output_specification":"Print the single number \u2014 the number of amazing performances the coder has had during his whole history of participating in the contests.\n","notes":"In the first sample the performances number 2 and 3 are amazing.\nIn the second sample the performances number 2, 4, 9 and 10 are amazing.\n","sample_inputs":["5\n100 50 200 150 200\n","10\n4664 6496 5814 7010 5762 5736 6944 4850 3698 7242\n"],"sample_outputs":["2\n","4\n"],"human_solution":"let fs = require(\"fs\");\n\nlet txt = fs\n .readFileSync(0, \"utf-8\")\n .split(\/[\\n\\r]\/)\n .filter((data) => data.length > 0);\nlet arr = txt[1]\n .split(\" \")\n .map((d) => d.trim())\n .filter((d) => d.length > 0)\n .map((d) => Number(d));\n\nlet min = arr[1];\nlet max = arr[1];\nlet amazing = 0;\narr.forEach((data) => {\n if (data > max) {\n max = data;\n ++amazing;\n } else if (data < min) {\n min = data;\n ++amazing;\n }\n});\n\nconsole.log(amazing);\n","testcases":"[{'input': ['5\\r\\n100 50 200 150 200\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10\\r\\n4664 6496 5814 7010 5762 5736 6944 4850 3698 7242\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n100 36 53 7 81\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n7 36 53 81 100\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n100 81 53 36 7\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10\\r\\n8 6 3 4 9 10 7 7 1 3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10\\r\\n1627 1675 1488 1390 1812 1137 1746 1324 1952 1862\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10\\r\\n1 3 3 4 6 7 7 8 9 10\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10\\r\\n1952 1862 1812 1746 1675 1627 1488 1390 1324 1137\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['25\\r\\n1448 4549 2310 2725 2091 3509 1565 2475 2232 3989 4231 779 2967 2702 608 3739 721 1552 2767 530 3114 665 1940 48 4198\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['33\\r\\n1097 1132 1091 1104 1049 1038 1023 1080 1104 1029 1035 1061 1049 1060 1088 1106 1105 1087 1063 1076 1054 1103 1047 1041 1028 1120 1126 1063 1117 1110 1044 1093 1101\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['34\\r\\n821 5536 2491 6074 7216 9885 764 1603 778 8736 8987 771 617 1587 8943 7922 439 7367 4115 8886 7878 6899 8811 5752 3184 3401 9760 9400 8995 4681 1323 6637 6554 6498\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['68\\r\\n6764 6877 6950 6768 6839 6755 6726 6778 6699 6805 6777 6985 6821 6801 6791 6805 6940 6761 6677 6999 6911 6699 6959 6933 6903 6843 6972 6717 6997 6756 6789 6668 6735 6852 6735 6880 6723 6834 6810 6694 6780 6679 6698 6857 6826 6896 6979 6968 6957 6988 6960 6700 6919 6892 6984 6685 6813 6678 6715 6857 6976 6902 6780 6686 6777 6686 6842 6679\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['60\\r\\n9000 9014 9034 9081 9131 9162 9174 9199 9202 9220 9221 9223 9229 9235 9251 9260 9268 9269 9270 9298 9307 9309 9313 9323 9386 9399 9407 9495 9497 9529 9531 9544 9614 9615 9627 9627 9643 9654 9656 9657 9685 9699 9701 9736 9745 9758 9799 9827 9843 9845 9854 9854 9885 9891 9896 9913 9942 9963 9986 9992\\r\\n'], 'output': ['57\\r\\n']}, {'input': ['100\\r\\n7 61 12 52 41 16 34 99 30 44 48 89 31 54 21 1 48 52 61 15 35 87 21 76 64 92 44 81 16 93 84 92 32 15 68 76 53 39 26 4 11 26 7 4 99 99 61 65 55 85 65 67 47 39 2 74 63 49 98 87 5 94 22 30 25 42 31 84 49 23 89 60 16 26 92 27 9 57 75 61 94 35 83 47 99 100 63 24 91 88 79 10 15 45 22 64 3 11 89 83\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100\\r\\n9999 9999 9999 9998 9998 9998 9997 9996 9996 9995 9993 9993 9991 9990 9989 9986 9984 9984 9983 9981 9981 9980 9980 9980 9979 9977 9977 9977 9977 9977 9976 9976 9975 9975 9973 9972 9972 9972 9972 9971 9969 9969 9969 9968 9967 9965 9962 9962 9962 9962 9960 9958 9958 9955 9954 9954 9954 9954 9950 9949 9949 9947 9943 9943 9940 9940 9939 9937 9937 9937 9936 9935 9932 9932 9931 9929 9927 9927 9926 9923 9919 9919 9918 9918 9918 9917 9917 9916 9916 9915 9914 9911 9910 9907 9907 9906 9905 9905 9904 9901\\r\\n'], 'output': ['57\\r\\n']}, {'input': ['100\\r\\n158 159 157 156 155 154 160 153 161 152 162 163 151 164 150 165 149 148 147 166 146 167 145 144 143 142 168 141 169 170 140 139 138 137 171 136 135 134 172 173 174 133 175 132 177 178 131 179 180 130 129 181 128 127 182 126 183 125 124 184 123 122 121 120 119 118 117 185 186 187 188 189 116 190 115 191 192 193 114 113 112 111 110 109 108 194 195 107 106 105 196 197 104 198 199 103 102 200 101 100\\r\\n'], 'output': ['99\\r\\n']}, {'input': ['2\\r\\n0 10000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n5 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n10 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}]","id":415} {"difficulty":1100,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"158_B","execute_outcome":"WRONG_ANSWER","source_code":"(()=>{\"use strict\";var t={188:function(t,e,n){var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,\"__esModule\",{value:!0}),e.singleWordInput=e.singleInput=e.testInput=void 0;const l=o(n(58)).default.createInterface({input:process.stdin,output:process.stdout});e.testInput=t=>{let e=[],n=0;l.on(\"line\",(function(o){if(e.push(o),1===e.length&&(n=+e[0]),e.length===n+1){e.shift(),l.close();for(let n=0;n{let e=[];l.on(\"line\",(function(n){if(e.push(n),2===e.length){l.close();let n=e[1].split(\" \").map(Number);console.log(t(n))}}))},e.singleWordInput=t=>{let e=[];l.on(\"line\",(function(n){e.push(n),1===e.length&&(l.close(),console.log(t(n)))}))}},58:t=>{t.exports=require(\"readline\")}},e={};function n(o){var l=e[o];if(void 0!==l)return l.exports;var s=e[o]={exports:{}};return t[o].call(s.exports,s,s.exports,n),s.exports}n(188).singleInput((function(t){let e=0,n=0,o=0,l=0;for(const s of t)4===s&&e++,3===s&&l++,2===s&&o++,1===s&&n++;return e+=Math.floor(o\/2),o%=2,l>n?(e+=0!==n?l-n:0,l-=n,e+l+o):(e+=0!==l?n-(n-l):0,n-=l,1===o&&(e++,n=Math.max(o-2,0)),e+Math.floor(n\/4)+(n%4>0?1:0))}))})();","description":"After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1\u2264si\u22644), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum number of cars will the children need if all members of each group should ride in the same taxi (but one taxi can take more than one group)?","input_specification":"The first line contains integer n (1\u2264n\u226410^5) \u2014 the number of groups of schoolchildren. The second line contains a sequence of integers s1,s2,...,sn (1\u2264si\u22644). The integers are separated by a space, si is the number of children in the i-th group.\n","output_specification":"Print the single number \u2014 the minimum number of taxis necessary to drive all children to Polycarpus.\n","notes":"In the first test we can sort the children into four cars like this:\n the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are other ways to sort the groups into four cars.\n","sample_inputs":["5\n1 2 4 3 3\n","8\n2 3 4 4 2 1 3 1\n"],"sample_outputs":["4\n","5\n"],"human_solution":"let input = \"\";\r\nprocess.stdin.on(\"data\", (data) => (input += data));\r\nprocess.stdin.on(\"end\", () => {\r\n let lines = input.split(\"\\n\");\r\n let n = lines.shift();\r\n let count = [0, 0, 0, 0, 0];\r\n lines\r\n .shift()\r\n .trim()\r\n .split(\" \")\r\n .forEach((x) => count[x]++);\r\n let res = count[4];\r\n res += Math.floor(count[2] \/ 2);\r\n count[2] = count[2] % 2;\r\n let min13 = Math.min(count[1], count[3]);\r\n res += min13;\r\n count[1] -= min13;\r\n count[3] -= min13;\r\n if (count[2]) {\r\n count[1] -= Math.min(2, count[1]);\r\n res++;\r\n }\r\n res += Math.ceil(count[1] \/ 4);\r\n res += count[3];\r\n console.log(res);\r\n});\r\n","testcases":"[{'input': ['5\\r\\n1 2 4 3 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['8\\r\\n2 3 4 4 2 1 3 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5\\r\\n4 4 4 4 4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['12\\r\\n1 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n3 2 1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n2 4 1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n4 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n3 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n4 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n4 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n4 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n2 2 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n3 1 3 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n1 4 1 4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n2 2 3 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n2 4 4 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n3 3 4 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['3\\r\\n1 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n1 3 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n4 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n3 2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n2 4 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n3 4 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n2 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n1 3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n4 4 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n3 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n4 2 4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n4 3 4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n4 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n3 1 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n2 1 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n3 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n4 4 3 2\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4\\r\\n1 4 3 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n2 2 4 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n3 2 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n2 4 2 3 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n1 3 4 1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n1 1 2 4 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n1 3 2 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['8\\r\\n1 1 2 1 1 1 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['78\\r\\n2 2 2 2 3 3 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 1 2 2 3 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['7\\r\\n2 2 2 1 2 1 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['9\\r\\n3 1 2 1 1 1 1 1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\n3 1 2 2 2 2 2 2 1 2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['18\\r\\n1 3 3 3 1 1 3 1 1 1 3 3 3 3 1 3 1 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['26\\r\\n3 1 3 3 1 3 2 3 1 3 3 2 1 2 3 2 2 1 2 1 2 1 1 3 2 1\\r\\n'], 'output': ['13\\r\\n']}]","id":416} {"difficulty":1100,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"160_B","execute_outcome":"WRONG_ANSWER","source_code":"let i = '';\nprocess.stdin.on('data', c => i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os');\n const lines = i.split(EOL);\n var n = lines[0];\n var k = lines[1].split('').map(Number);\n var l = n;\n var a = 0;\n var b = 0;\n for(var j = 0; j < n; j++){\n if(k[j] >= k[l]){\n a++;\n }else if(k[j] < k[l]){\n b++;\n }\n l++;\n }\n if(a == n || b == n){\n console.log('YES');\n }else{\n console.log('NO');\n }\n});","description":"Each of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket is lucky. Let us remind you that a ticket is lucky if the sum of digits in its first half matches the sum of digits in its second half.But of course, not every ticket can be lucky. Far from it! Moreover, sometimes one look at a ticket can be enough to say right away that the ticket is not lucky. So, let's consider the following unluckiness criterion that can definitely determine an unlucky ticket. We'll say that a ticket is definitely unlucky if each digit from the first half corresponds to some digit from the second half so that each digit from the first half is strictly less than the corresponding digit from the second one or each digit from the first half is strictly more than the corresponding digit from the second one. Each digit should be used exactly once in the comparisons. In other words, there is such bijective correspondence between the digits of the first and the second half of the ticket, that either each digit of the first half turns out strictly less than the corresponding digit of the second half or each digit of the first half turns out strictly more than the corresponding digit from the second half.For example, ticket 2421 meets the following unluckiness criterion and will not be considered lucky (the sought correspondence is 2>1 and 4>2), ticket 0135 also meets the criterion (the sought correspondence is 0<3 and 1<5), and ticket 3754 does not meet the criterion. You have a ticket in your hands, it contains 2n digits. Your task is to check whether it meets the unluckiness criterion.","input_specification":"The first line contains an integer n (1\u2264n\u2264100). The second line contains a string that consists of 2n digits and defines your ticket.\n","output_specification":"In the first line print \"YES\" if the ticket meets the unluckiness criterion. Otherwise, print \"NO\" (without the quotes).\n","notes":null,"sample_inputs":["2\n2421\n","2\n0135\n","2\n3754\n"],"sample_outputs":["YES\n","YES\n","NO\n"],"human_solution":"let input = \"\";\r\nprocess.stdin.on(\"data\", (chunk) => {\r\n input += chunk;\r\n});\r\nprocess.stdin.on(\"end\", () => {\r\n let lines = input.trim().split(\"\\n\");\r\n let n = parseInt(lines[0]);\r\n let num = lines[1].trim();\r\n let a = num\r\n .slice(0, n)\r\n .split(\"\")\r\n .map((element) => parseInt(element))\r\n .sort((a, b) => a - b);\r\n let b = num\r\n .slice(n)\r\n .split(\"\")\r\n .map((element) => parseInt(element))\r\n .sort((a, b) => a - b);\r\n let flag = true;\r\n if (a[0] > b[0]) {\r\n for (let i = 1; i < num.length \/ 2; i++) {\r\n if (a[i] <= b[i]) {\r\n flag = false;\r\n break;\r\n }\r\n }\r\n } else if (a[0] < b[0]) {\r\n for (let i = 0; i < num.length \/ 2; i++) {\r\n if (a[i] >= b[i]) {\r\n flag = false;\r\n break;\r\n }\r\n }\r\n } else {\r\n flag = false;\r\n }\r\n if (flag) {\r\n console.log(\"YES\");\r\n } else {\r\n console.log(\"NO\");\r\n }\r\n});\r\n","testcases":"[{'input': ['2\\r\\n2421\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n0135\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n3754\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n33\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n3444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n221323\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n132432\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n10\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n999000\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5\\r\\n2563434512\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n01101001000011011110\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n10001222212022211120\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n36828132853144011224\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20\\r\\n1011022122111202122200100211021100001122\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['20\\r\\n5232324254212415411311123313002001301121\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20\\r\\n7405800505032736115894335199688161431589\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20\\r\\n3415010010430312351463661555326552265642\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n2102200200102000012010102011211201121112001112220022023331220132002222113003003302101312001033110321\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n5612454122355331521225634515354651153334442245234623042403102434401340330012200102111030242232001423\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n0013011201111112210231333121030031021132323232322331422253215312454431312252454531121325154332452522\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n1333113332002310001130333200002120101112101000001001122200021012010112000102121102212021200102011000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n7768982292275759939882751465173844816331588199736866065335518782157581162167237401803021840688341656\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n5060172568971658079607579942843871533766899530593457744544240062187820782803777264583028807003285606\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n32033233210213232101210131232021120310331112120033001231123232221200213021203033300033131302232100038528951495743459997297531816949698487426212357538284284222536535855445278621151486932989238531899512\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n02002102210011010100120120200220102011120101221112212222120020210120100100210020110121012200202122003345665163205330111020604514053164225655212253500113103534213313020162345540026653211623642123220355\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n77183123282838517843664381789267288922656323541699343586762218319159218294863295482798464649254394971213132422224212223202404302223411433322333414121022024111412343110143421202444434024400100413442214\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n10001111012200211011000121001200011210000020102102001022212010122102202221201112010122020001101100108897949728635541168542364573471936555772537461654157812311614931827469976934765219573155999659346292\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n01232301021031212111013002303211223032012113201031332103213332222202203330122103103121131233013000116022330435355138573123144360458655075068170808157467335580232261005471574645456707410743351868832288\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n29984263744168545119858476736999712929651758223788987449661283528958984743292587725324189134223179864351053241163312352223630541424435625146656004416300322106250255412140420461130552626644306153634053\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n31600324621210624556500610052054505630313425345404534213653266122646254136660603332516425411106060211654812165791554127683771773326741719787895359171717963263779732526239927838412657412425615852874991\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n09\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n11111111112222222222\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n2231\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n123022\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2322\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n123456789000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n22222222224444444444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5\\r\\n1257823589\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n158159\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n22343424233121404112342221440103014430444234223303320243202210332120013031314432132430043330110313112023440313043212221301033103041340034304442240323002140112031424013224122404204110340334110122004100\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n378954\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n22222222222222222222222222222222222222222222222222111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n123012\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n43242352435435435423653231443242342313412343253241432423524354354354236532314432423423134123432532417897987897897979897879879878979787987987987987989978979878978979798978798798789797879879879879879899\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n000100\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n0001\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n111117\\r\\n'], 'output': ['NO\\r\\n']}]","id":417} {"difficulty":1100,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"166_A","execute_outcome":"WRONG_ANSWER","source_code":"\r\nconsole.log(\"hello\")","description":"Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given teams very well. Let's say that team a solved pa problems with total penalty time ta and team b solved pb problems with total penalty time tb. Team a gets a higher place than team b in the end, if it either solved more problems on the contest, or solved the same number of problems but in less total time. In other words, team a gets a higher place than team b in the final results' table if either pa>pb, or pa=pb and ta {\r\n input += chunk;\r\n});\r\nprocess.stdin.on(\"end\", () => {\r\n let lines = input.trim().split(\"\\n\");\r\n let [n, k] = lines[0]\r\n .trim()\r\n .split(\" \")\r\n .map((element) => parseInt(element));\r\n let teams = [];\r\n for (let i = 0; i < n; i++) {\r\n let [problems, time] = lines[i + 1]\r\n .trim()\r\n .split(\" \")\r\n .map((element) => parseInt(element));\r\n teams.push([problems, time]);\r\n }\r\n teams.sort((a, b) => {\r\n if (a[0] > b[0]) {\r\n return -1;\r\n } else if (a[0] < b[0]) {\r\n return 1;\r\n } else {\r\n if (a[1] < b[1]) {\r\n return -1;\r\n } else if (a[1] > b[1]) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n });\r\n let i = k - 1;\r\n let count = 0;\r\n while (i >= 0) {\r\n if (teams[i][0] === teams[k - 1][0] && teams[i][1] === teams[k - 1][1]) {\r\n count++;\r\n i--;\r\n } else {\r\n break;\r\n }\r\n }\r\n i = k;\r\n while (i < n) {\r\n if (teams[i][0] === teams[k - 1][0] && teams[i][1] === teams[k - 1][1]) {\r\n count++;\r\n i++;\r\n } else {\r\n break;\r\n }\r\n }\r\n console.log(count);\r\n});\r\n","testcases":"[{'input': ['7 2\\r\\n4 10\\r\\n4 10\\r\\n4 10\\r\\n3 20\\r\\n2 1\\r\\n2 1\\r\\n1 10\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 4\\r\\n3 1\\r\\n3 1\\r\\n5 3\\r\\n3 1\\r\\n3 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 1\\r\\n2 2\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6 3\\r\\n2 2\\r\\n3 1\\r\\n2 2\\r\\n4 5\\r\\n2 2\\r\\n4 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 5\\r\\n3 1\\r\\n10 2\\r\\n2 2\\r\\n1 10\\r\\n10 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 2\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 3\\r\\n10 3\\r\\n6 10\\r\\n5 2\\r\\n5 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 3\\r\\n10 10\\r\\n10 10\\r\\n1 1\\r\\n10 10\\r\\n4 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 1\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n28 28\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 2\\r\\n1 2\\r\\n1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 3\\r\\n2 3\\r\\n4 2\\r\\n5 3\\r\\n2 4\\r\\n3 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 22\\r\\n4 9\\r\\n8 1\\r\\n3 7\\r\\n1 2\\r\\n3 8\\r\\n9 8\\r\\n8 5\\r\\n2 10\\r\\n5 8\\r\\n1 3\\r\\n1 8\\r\\n2 3\\r\\n7 9\\r\\n10 2\\r\\n9 9\\r\\n7 3\\r\\n8 6\\r\\n10 6\\r\\n5 4\\r\\n8 1\\r\\n1 5\\r\\n6 8\\r\\n9 5\\r\\n9 5\\r\\n3 2\\r\\n3 3\\r\\n3 8\\r\\n7 5\\r\\n4 5\\r\\n8 10\\r\\n8 2\\r\\n3 5\\r\\n3 2\\r\\n1 1\\r\\n7 2\\r\\n2 7\\r\\n6 8\\r\\n10 4\\r\\n7 5\\r\\n1 7\\r\\n6 5\\r\\n3 1\\r\\n4 9\\r\\n2 3\\r\\n3 6\\r\\n5 8\\r\\n4 10\\r\\n10 7\\r\\n7 10\\r\\n9 8\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 6\\r\\n11 20\\r\\n18 13\\r\\n1 13\\r\\n3 11\\r\\n4 17\\r\\n15 10\\r\\n15 8\\r\\n9 16\\r\\n11 17\\r\\n16 3\\r\\n3 20\\r\\n14 13\\r\\n12 15\\r\\n9 10\\r\\n14 2\\r\\n12 12\\r\\n13 17\\r\\n6 10\\r\\n20 9\\r\\n2 8\\r\\n13 7\\r\\n7 20\\r\\n15 3\\r\\n1 20\\r\\n2 13\\r\\n2 5\\r\\n14 7\\r\\n10 13\\r\\n15 12\\r\\n15 5\\r\\n17 6\\r\\n9 11\\r\\n18 5\\r\\n10 1\\r\\n15 14\\r\\n3 16\\r\\n6 12\\r\\n4 1\\r\\n14 9\\r\\n7 14\\r\\n8 17\\r\\n17 13\\r\\n4 6\\r\\n19 16\\r\\n5 6\\r\\n3 15\\r\\n4 19\\r\\n15 20\\r\\n2 10\\r\\n20 10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 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\\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\\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\\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\\n1 1\\r\\n1 1\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['50 28\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['50 40\\r\\n2 3\\r\\n3 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n3 1\\r\\n1 1\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n1 3\\r\\n2 1\\r\\n3 1\\r\\n1 1\\r\\n3 1\\r\\n3 1\\r\\n2 2\\r\\n1 1\\r\\n3 3\\r\\n3 1\\r\\n3 2\\r\\n2 3\\r\\n3 3\\r\\n3 1\\r\\n1 3\\r\\n2 3\\r\\n2 1\\r\\n3 2\\r\\n3 3\\r\\n3 1\\r\\n2 1\\r\\n2 2\\r\\n1 3\\r\\n3 3\\r\\n1 1\\r\\n3 2\\r\\n1 2\\r\\n2 3\\r\\n2 1\\r\\n2 2\\r\\n3 2\\r\\n1 3\\r\\n3 1\\r\\n1 1\\r\\n3 3\\r\\n2 3\\r\\n2 1\\r\\n2 3\\r\\n2 3\\r\\n1 2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['50 16\\r\\n2 1\\r\\n3 2\\r\\n5 2\\r\\n2 2\\r\\n3 4\\r\\n4 4\\r\\n3 3\\r\\n4 1\\r\\n2 3\\r\\n1 5\\r\\n4 1\\r\\n2 2\\r\\n1 5\\r\\n3 2\\r\\n2 1\\r\\n5 4\\r\\n5 2\\r\\n5 4\\r\\n1 1\\r\\n3 5\\r\\n2 1\\r\\n4 5\\r\\n5 1\\r\\n5 5\\r\\n5 4\\r\\n2 4\\r\\n1 2\\r\\n5 5\\r\\n4 4\\r\\n1 5\\r\\n4 2\\r\\n5 1\\r\\n2 4\\r\\n2 5\\r\\n2 2\\r\\n3 4\\r\\n3 1\\r\\n1 1\\r\\n5 5\\r\\n2 2\\r\\n3 4\\r\\n2 4\\r\\n5 2\\r\\n4 1\\r\\n3 1\\r\\n1 1\\r\\n4 1\\r\\n4 4\\r\\n1 4\\r\\n1 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 32\\r\\n6 6\\r\\n4 2\\r\\n5 5\\r\\n1 1\\r\\n2 4\\r\\n6 5\\r\\n2 3\\r\\n6 5\\r\\n2 3\\r\\n6 3\\r\\n1 4\\r\\n1 6\\r\\n3 3\\r\\n2 4\\r\\n3 2\\r\\n6 2\\r\\n4 1\\r\\n3 3\\r\\n3 1\\r\\n5 5\\r\\n1 2\\r\\n2 1\\r\\n5 4\\r\\n3 1\\r\\n4 4\\r\\n5 6\\r\\n4 1\\r\\n2 5\\r\\n3 1\\r\\n4 6\\r\\n2 3\\r\\n1 1\\r\\n6 5\\r\\n2 6\\r\\n3 3\\r\\n2 6\\r\\n2 3\\r\\n2 6\\r\\n3 4\\r\\n2 6\\r\\n4 5\\r\\n5 4\\r\\n1 6\\r\\n3 2\\r\\n5 1\\r\\n4 1\\r\\n4 6\\r\\n4 2\\r\\n1 2\\r\\n5 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 48\\r\\n5 1\\r\\n6 4\\r\\n3 2\\r\\n2 1\\r\\n4 7\\r\\n3 6\\r\\n7 1\\r\\n7 5\\r\\n6 5\\r\\n5 6\\r\\n4 7\\r\\n5 7\\r\\n5 7\\r\\n5 5\\r\\n7 3\\r\\n3 5\\r\\n4 3\\r\\n5 4\\r\\n6 2\\r\\n1 6\\r\\n6 3\\r\\n6 5\\r\\n5 2\\r\\n4 2\\r\\n3 1\\r\\n1 1\\r\\n5 6\\r\\n1 3\\r\\n6 5\\r\\n3 7\\r\\n1 5\\r\\n7 5\\r\\n6 5\\r\\n3 6\\r\\n2 7\\r\\n5 3\\r\\n5 3\\r\\n4 7\\r\\n5 2\\r\\n6 5\\r\\n5 7\\r\\n7 1\\r\\n2 3\\r\\n5 5\\r\\n2 6\\r\\n4 1\\r\\n6 2\\r\\n6 5\\r\\n3 3\\r\\n1 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 8\\r\\n5 3\\r\\n7 3\\r\\n4 3\\r\\n7 4\\r\\n2 2\\r\\n4 4\\r\\n5 4\\r\\n1 1\\r\\n7 7\\r\\n4 8\\r\\n1 1\\r\\n6 3\\r\\n1 5\\r\\n7 3\\r\\n6 5\\r\\n4 5\\r\\n8 6\\r\\n3 6\\r\\n2 1\\r\\n3 2\\r\\n2 5\\r\\n7 6\\r\\n5 8\\r\\n1 3\\r\\n5 5\\r\\n8 4\\r\\n4 5\\r\\n4 4\\r\\n8 8\\r\\n7 2\\r\\n7 2\\r\\n3 6\\r\\n2 8\\r\\n8 3\\r\\n3 2\\r\\n4 5\\r\\n8 1\\r\\n3 2\\r\\n8 7\\r\\n6 3\\r\\n2 3\\r\\n5 1\\r\\n3 4\\r\\n7 2\\r\\n6 3\\r\\n7 3\\r\\n3 3\\r\\n6 4\\r\\n2 2\\r\\n5 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20 16\\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\\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': ['20\\r\\n']}, {'input': ['20 20\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['30 16\\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\\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\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['30 22\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['30 22\\r\\n1 1\\r\\n1 3\\r\\n2 3\\r\\n3 1\\r\\n2 3\\r\\n3 1\\r\\n1 2\\r\\n3 3\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n3 1\\r\\n3 2\\r\\n2 3\\r\\n3 1\\r\\n1 3\\r\\n2 3\\r\\n3 1\\r\\n1 2\\r\\n1 2\\r\\n2 3\\r\\n2 1\\r\\n3 3\\r\\n3 2\\r\\n1 3\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n3 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['50 16\\r\\n2 1\\r\\n3 2\\r\\n5 2\\r\\n2 2\\r\\n3 4\\r\\n4 4\\r\\n3 3\\r\\n4 1\\r\\n2 3\\r\\n1 5\\r\\n4 1\\r\\n2 2\\r\\n1 5\\r\\n3 2\\r\\n2 1\\r\\n5 4\\r\\n5 2\\r\\n5 4\\r\\n1 1\\r\\n3 5\\r\\n2 1\\r\\n4 5\\r\\n5 1\\r\\n5 5\\r\\n5 4\\r\\n2 4\\r\\n1 2\\r\\n5 5\\r\\n4 4\\r\\n1 5\\r\\n4 2\\r\\n5 1\\r\\n2 4\\r\\n2 5\\r\\n2 2\\r\\n3 4\\r\\n3 1\\r\\n1 1\\r\\n5 5\\r\\n2 2\\r\\n3 4\\r\\n2 4\\r\\n5 2\\r\\n4 1\\r\\n3 1\\r\\n1 1\\r\\n4 1\\r\\n4 4\\r\\n1 4\\r\\n1 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 22\\r\\n4 9\\r\\n8 1\\r\\n3 7\\r\\n1 2\\r\\n3 8\\r\\n9 8\\r\\n8 5\\r\\n2 10\\r\\n5 8\\r\\n1 3\\r\\n1 8\\r\\n2 3\\r\\n7 9\\r\\n10 2\\r\\n9 9\\r\\n7 3\\r\\n8 6\\r\\n10 6\\r\\n5 4\\r\\n8 1\\r\\n1 5\\r\\n6 8\\r\\n9 5\\r\\n9 5\\r\\n3 2\\r\\n3 3\\r\\n3 8\\r\\n7 5\\r\\n4 5\\r\\n8 10\\r\\n8 2\\r\\n3 5\\r\\n3 2\\r\\n1 1\\r\\n7 2\\r\\n2 7\\r\\n6 8\\r\\n10 4\\r\\n7 5\\r\\n1 7\\r\\n6 5\\r\\n3 1\\r\\n4 9\\r\\n2 3\\r\\n3 6\\r\\n5 8\\r\\n4 10\\r\\n10 7\\r\\n7 10\\r\\n9 8\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 22\\r\\n29 15\\r\\n18 10\\r\\n6 23\\r\\n38 28\\r\\n34 40\\r\\n40 1\\r\\n16 26\\r\\n22 33\\r\\n14 30\\r\\n26 7\\r\\n15 16\\r\\n22 40\\r\\n14 15\\r\\n6 28\\r\\n32 27\\r\\n33 3\\r\\n38 22\\r\\n40 17\\r\\n16 27\\r\\n21 27\\r\\n34 26\\r\\n5 15\\r\\n34 9\\r\\n38 23\\r\\n7 36\\r\\n17 6\\r\\n19 37\\r\\n40 1\\r\\n10 28\\r\\n9 14\\r\\n8 31\\r\\n40 8\\r\\n14 2\\r\\n24 16\\r\\n38 33\\r\\n3 37\\r\\n2 9\\r\\n21 21\\r\\n40 26\\r\\n28 33\\r\\n24 31\\r\\n10 12\\r\\n27 27\\r\\n17 4\\r\\n38 5\\r\\n21 31\\r\\n5 12\\r\\n29 7\\r\\n39 12\\r\\n26 14\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 14\\r\\n4 20\\r\\n37 50\\r\\n46 19\\r\\n20 25\\r\\n47 10\\r\\n6 34\\r\\n12 41\\r\\n47 9\\r\\n22 28\\r\\n41 34\\r\\n47 40\\r\\n12 42\\r\\n9 4\\r\\n15 15\\r\\n27 8\\r\\n38 9\\r\\n4 17\\r\\n8 13\\r\\n47 7\\r\\n9 38\\r\\n30 48\\r\\n50 7\\r\\n41 34\\r\\n23 11\\r\\n16 37\\r\\n2 32\\r\\n18 46\\r\\n37 48\\r\\n47 41\\r\\n13 9\\r\\n24 50\\r\\n46 14\\r\\n33 49\\r\\n9 50\\r\\n35 30\\r\\n49 44\\r\\n42 49\\r\\n39 15\\r\\n33 42\\r\\n3 18\\r\\n44 15\\r\\n44 28\\r\\n9 17\\r\\n16 4\\r\\n10 36\\r\\n4 22\\r\\n47 17\\r\\n24 12\\r\\n2 31\\r\\n6 30\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 1\\r\\n50 50\\r\\n50 50\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2\\r\\n50 50\\r\\n50 50\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 1\\r\\n50 50\\r\\n50 49\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 2\\r\\n50 50\\r\\n50 49\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n49 50\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 50\\r\\n50 49\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['10 1\\r\\n3 1\\r\\n3 2\\r\\n3 2\\r\\n2 3\\r\\n2 3\\r\\n2 3\\r\\n2 4\\r\\n2 4\\r\\n2 4\\r\\n2 4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 3\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 2\\r\\n1 2\\r\\n1 3\\r\\n1 5\\r\\n1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6 1\\r\\n4 3\\r\\n4 2\\r\\n5 1\\r\\n5 2\\r\\n5 3\\r\\n5 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n2 1\\r\\n1 3\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 1\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 10\\r\\n3 1\\r\\n3 2\\r\\n3 2\\r\\n2 3\\r\\n2 3\\r\\n2 3\\r\\n2 4\\r\\n2 4\\r\\n2 4\\r\\n2 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 1\\r\\n5 5\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n5 5\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n'], 'output': ['2\\r\\n']}]","id":418} {"difficulty":1100,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"169_B","execute_outcome":"WRONG_ANSWER","source_code":"const readline = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet firstNum, secondNum;\nreadline.on('line', function (line) {\n if (line !== \"\\n\") {\n if (!firstNum) {\n firstNum = line;\n } else {\n secondNum = line;\n const num1 = firstNum.split(\"\");\n const num2 = secondNum.split(\"\");\n num2.sort((a, b) => b - a);\n\n for (let i = 0; i < num1.length; i++) {\n \n for (let j = i; j < num2.length; j++) {\n if (num1[i] < num2[j]) {\n num1[i] = num2[j];\n num2.splice(j, 1);\n }\n else {\n break;\n }\n }\n }\n\n console.log(num1.join(\"\"));\n\n process.exit();\n }\n }\n});\n \t\t\t \t\t \t\t \t\t \t \t\t \t\t\t","description":"You are given an integer a that consists of n digits. You are also given a sequence of digits s of length m. The digit in position j (1\u2264j\u2264m) of sequence s means that you can choose an arbitrary position i (1\u2264i\u2264n) in a and replace the digit in the chosen position i with sj. Each element in the sequence s can participate in no more than one replacing operation.Your task is to perform such sequence of replacements, that the given number a gets maximum value. You are allowed to use not all elements from s.","input_specification":"The first line contains positive integer a. Its length n is positive and doesn't exceed 10^5. The second line contains sequence of digits s. Its length m is positive and doesn't exceed 10^5. The digits in the sequence s are written consecutively without any separators.\nThe given number a doesn't contain leading zeroes. \n","output_specification":"Print the maximum value that can be obtained from a after a series of replacements. You are allowed to use not all elements from s. The printed number shouldn't contain any leading zeroes.\n","notes":null,"sample_inputs":["1024\n010\n","987\n1234567\n"],"sample_outputs":["1124\n","987\n"],"human_solution":"const readline = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet firstNum, secondNum;\nreadline.on('line', function (line) {\n if (line !== \"\\n\") {\n if (!firstNum) {\n firstNum = line;\n } else {\n secondNum = line;\n const num1 = firstNum.split(\"\");\n const num2 = secondNum.split(\"\");\n num2.sort((a, b) => b - a);\n let j = 0;\n for (let i = 0; i < num1.length; i++) {\n \n if (num1[i] < num2[j]) {\n num1[i] = num2[j];\n j++;\n }\n \n if(j > num2.length){\n break;\n }\n }\n\n console.log(num1.join(\"\"));\n\n process.exit();\n }\n }\n});\n\t \t\t \t\t\t\t\t \t \t \t\t \t \t\t","testcases":"[{'input': ['1024\\r\\n010\\r\\n'], 'output': ['1124\\r\\n']}, {'input': ['987\\r\\n1234567\\r\\n'], 'output': ['987\\r\\n']}, {'input': ['10\\r\\n1\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['11\\r\\n1\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['12\\r\\n2\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['123456\\r\\n9999\\r\\n'], 'output': ['999956\\r\\n']}, {'input': ['909090\\r\\n000111\\r\\n'], 'output': ['919191\\r\\n']}, {'input': ['588\\r\\n24\\r\\n'], 'output': ['588\\r\\n']}, {'input': ['25206\\r\\n88\\r\\n'], 'output': ['88206\\r\\n']}, {'input': ['9776247464\\r\\n8629\\r\\n'], 'output': ['9986647464\\r\\n']}, {'input': ['3666566898\\r\\n3001\\r\\n'], 'output': ['3666566898\\r\\n']}, {'input': ['3338860467\\r\\n5848\\r\\n'], 'output': ['8858864467\\r\\n']}, {'input': ['9768757689\\r\\n1010\\r\\n'], 'output': ['9768757689\\r\\n']}, {'input': ['6669490269\\r\\n6240849376\\r\\n'], 'output': ['9879696469\\r\\n']}, {'input': ['1794210278\\r\\n50931901955213461294\\r\\n'], 'output': ['9999965578\\r\\n']}, {'input': ['6997854871\\r\\n15113453341706470344\\r\\n'], 'output': ['7997876875\\r\\n']}, {'input': ['8947769539\\r\\n22900332144661023400\\r\\n'], 'output': ['9967769649\\r\\n']}, {'input': ['9885783638\\r\\n20241242140301231211\\r\\n'], 'output': ['9885784648\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n1234567890\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['123\\r\\n987987\\r\\n'], 'output': ['998\\r\\n']}, {'input': ['1000\\r\\n32119\\r\\n'], 'output': ['9321\\r\\n']}, {'input': ['31\\r\\n4\\r\\n'], 'output': ['41\\r\\n']}, {'input': ['504\\r\\n91111\\r\\n'], 'output': ['914\\r\\n']}, {'input': ['100001\\r\\n23\\r\\n'], 'output': ['320001\\r\\n']}, {'input': ['87\\r\\n9\\r\\n'], 'output': ['97\\r\\n']}, {'input': ['786796787566545376\\r\\n00101\\r\\n'], 'output': ['786796787566545376\\r\\n']}, {'input': ['123456789012345678905764345\\r\\n00001\\r\\n'], 'output': ['123456789112345678905764345\\r\\n']}, {'input': ['111\\r\\n2222222299999999\\r\\n'], 'output': ['999\\r\\n']}, {'input': ['111\\r\\n789\\r\\n'], 'output': ['987\\r\\n']}, {'input': ['1\\r\\n99\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['1099\\r\\n9\\r\\n'], 'output': ['9099\\r\\n']}, {'input': ['123\\r\\n456\\r\\n'], 'output': ['654\\r\\n']}]","id":419} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"172_A","execute_outcome":"WRONG_ANSWER","source_code":"let i = ''\nprocess.stdin.on('data', c => i += c)\nprocess.stdin.on('end', () => {\n const {EOL} = require('os')\n const lines = i.split(EOL);\n solve(lines); \n});\n\nfunction solve(lines){ \n\n const [ n, ...phoneNumbers ] = lines;\n let result = phoneNumbers[0].length;\n for(let i = 1; i < n-1; i++ ) {\n for(let j = 0; j <= result - 1; j++ ){\n if(phoneNumbers[i].charAt(j) !== phoneNumbers[i+1].charAt(j)) {\n result = j;\n break;\n }\n }\n }\n console.log(result);\n}","description":"Polycarpus has n friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings s1,s2,...,sn. All these strings consist only of digits and have the same length. Once Polycarpus needed to figure out Tarasov city phone code. He assumed that the phone code of the city is the longest common prefix of all phone numbers of his friends. In other words, it is the longest string c which is a prefix (the beginning) of each si for all i (1\u2264i\u2264n). Help Polycarpus determine the length of the city phone code. ","input_specification":"The first line of the input contains an integer n (2\u2264n\u22643\u00b710^4) \u2014 the number of Polycarpus's friends. The following n lines contain strings s1,s2,...,sn \u2014 the phone numbers of Polycarpus's friends. It is guaranteed that all strings consist only of digits and have the same length from 1 to 20, inclusive. It is also guaranteed that all strings are different.\n","output_specification":"Print the number of digits in the city phone code.\n","notes":"A prefix of string t is a string that is obtained by deleting zero or more digits from the end of string t. For example, string \"00209\" has 6 prefixes: \"\" (an empty prefix), \"0\", \"00\", \"002\", \"0020\", \"00209\".\nIn the first sample the city phone code is string \"00\".\nIn the second sample the city phone code is an empty string.\nIn the third sample the city phone code is string \"770123456789\".\n","sample_inputs":["4\n00209\n00219\n00999\n00909\n","2\n1\n2\n","3\n77012345678999999999\n77012345678901234567\n77012345678998765432\n"],"sample_outputs":["2\n","0\n","12\n"],"human_solution":"\/\/Don't have to see. start------------------------------------------\r\nvar read = require('readline').createInterface({\r\n\tinput: process.stdin, output: process.stdout\r\n});\r\nvar obj; var inLine = []; var outputList = [];var retcode = new Set();\r\nread.on('line', function(input){\r\n\tvar tmp = input.split(' ');\r\n\tfor(var i = 0; i < tmp.length; i++){\r\n\t\tinLine.push(tmp[i]);\r\n\t\tif(i == tmp.length - 1){\r\n\t\t\tretcode.add(inLine.length);\r\n\t\t}\r\n\t}\r\n});\r\nread.on('close', function(){\r\n\tobj = init(inLine);\r\n\tconsole.error('\\n\u00e2\u0086\u0091\u00e5\u0085\u00a5\u00e5\u008a\u009b \u00e2\u0086\u0093\u00e5\u0087\u00ba\u00e5\u008a\u009b');\r\n\tMain();\r\n\tconsole.log(myconv(outputList, 9));\r\n});\r\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\r\nfunction nextArray(size, code){\r\n\tvar ret = new Array(size);\r\n\tfor(var i = 0; i < size; i++){\r\n\t\tif(code == 'int'){\r\n\t\t\tret[i] = nextInt();\r\n\t\t}else{\r\n\t\t\tret[i] = next();\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\nfunction nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}\r\nfunction nextCharArray(){return myconv(next(),6);}\r\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}\r\nfunction init(input){ \r\n\treturn {\r\n\t\tlist : input, index : 0, max : input.length,\r\n\t\thasNext : function(){return (this.index < this.max);},\r\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u00e2\u0080\u009aThere is no more input';}},\r\n\t\tisReturn : function(){return retcode.has(this.index);}\r\n\t};\r\n}\r\nfunction myout(s){outputList.push(s);}\r\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\r\nfunction isReturn(){return obj.isReturn();}\r\n\/\/param \"no\" is\r\n\/\/unknown or outlier : return i. 1: parseInt.\r\n\/\/2: split space. 4: split space and parseInt.\r\n\/\/6: split 1 character. 7: split 1 character and parseInt.\r\n\/\/8: join space. 9: join nextline. 0: join no character.\r\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\r\n\r\n\/\/Don't have to see. end------------------------------------------\r\nfunction Main(){\r\n\tvar N = nextInt();\r\n\tvar list = new Array(N);\r\n\tfor(var i = 0; i < N; i++){\r\n\t\tlist[i] = next();\r\n\t}\r\n\tfor(var i = 0; i < list[0].length; i++){\r\n\t\tvar s = list[0][i];\r\n\t\tfor(var j = 0; j < N; j++){\r\n\t\t\tif(s != list[j][i]){\r\n\t\t\t\tmyout(i);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tmyout(list[0].length);\r\n}\r\n","testcases":"[{'input': ['4\\r\\n00209\\r\\n00219\\r\\n00999\\r\\n00909\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1\\r\\n2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n77012345678999999999\\r\\n77012345678901234567\\r\\n77012345678998765432\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['5\\r\\n4491183345\\r\\n4491184811\\r\\n4491162340\\r\\n4491233399\\r\\n4491449214\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10\\r\\n15424\\r\\n10953\\r\\n19176\\r\\n15514\\r\\n16284\\r\\n18680\\r\\n19305\\r\\n13816\\r\\n16168\\r\\n15924\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n4906361343\\r\\n8985777485\\r\\n1204265609\\r\\n7088384855\\r\\n4127287014\\r\\n7904807820\\r\\n3032139021\\r\\n5999959109\\r\\n6477458281\\r\\n3244359368\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n3717208309\\r\\n3717208306\\r\\n3717208302\\r\\n3717208301\\r\\n3717208303\\r\\n3717208308\\r\\n3717208304\\r\\n3717208307\\r\\n3717208300\\r\\n3717208305\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['9\\r\\n2881\\r\\n2808\\r\\n2868\\r\\n2874\\r\\n2894\\r\\n2870\\r\\n2818\\r\\n2896\\r\\n2890\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n4\\r\\n9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n29867863763143509570\\r\\n59261213969200291523\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n84\\r\\n62\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n75970434466248453472\\r\\n75970434466248453476\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['10\\r\\n17254072509168593435\\r\\n17254072509168593433\\r\\n17254072509168593430\\r\\n17254072509168593432\\r\\n17254072509168593439\\r\\n17254072509168593436\\r\\n17254072509168593438\\r\\n17254072509168593437\\r\\n17254072509168593431\\r\\n17254072509168593434\\r\\n'], 'output': ['19\\r\\n']}]","id":420} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"22_A","execute_outcome":"WRONG_ANSWER","source_code":"let i = '';\nprocess.stdin.on('data', c => i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os');\n const lines = i.split(EOL);\n var n = lines[0];\n var k = lines[1].split(' ').map(Number).sort(function(a, b){return a - b});\n var a = [];\n for(var j = 1; j <= n; j++){\n if(k[j] != k[j - 1]){\n a.push(k[j - 1]);\n }\n }\n if(n == 1){\n console.log('NO')\n }else{\n console.log(a[1])\n }\n});","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\u2264n\u2264100) \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.\n","output_specification":"If the given sequence has the second order statistics, output this order statistics, otherwise output NO.\n","notes":null,"sample_inputs":["4\n1 2 2 -4\n","5\n1 2 3 1 1\n"],"sample_outputs":["1\n","2\n"],"human_solution":"let i = '';\nprocess.stdin.on('data', c => i += c);\nprocess.stdin.on('end', () => {\n const {EOL} = require('os');\n const lines = i.split(EOL);\n var n = lines[0];\n var k = lines[1].split(' ').map(Number).sort(function(a, b){return a - b});\n var a = [];\n for(var j = 1; j <= n; j++){\n if(k[j] != k[j - 1]){\n a.push(k[j - 1]);\n }\n }\n if(a[1] === undefined){\n console.log('NO');\n }else{\n console.log(a[1]);\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":421} {"difficulty":1500,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"22_B","execute_outcome":"WRONG_ANSWER","source_code":"const fs = require('fs');\r\nconst input = fs.readFileSync(0, 'utf8').trim().split(\/[\\n\\r]+\/);\r\nconst log = (...args) => console.log(...args);\r\n\r\nlet count = 0;\r\nconst readnum = () => input[count++].trim().split(' ').map(a => +a);\r\nconst readword = () => input[count++].trim().split(' ');\r\n\r\nlet [N,M] = readnum();\r\nlet mat = [];\r\nfor (let i=0; i 1 && cur < cnt[stack[stack.length-1]]) {\r\n let lastIdx = stack.pop(), lastCnt = cnt[lastIdx];\r\n \r\n res = Math.max(res, 2 * (lastCnt + (i - 1 - stack[stack.length-1]))); \r\n }\r\n \r\n stack.push(i);\r\n }\r\n \r\n while (stack.length > 1) {\r\n let lastIdx = stack.pop(), lastCnt = cnt[lastIdx];\r\n \r\n res = Math.max(res, 2 * (lastCnt + (cnt.length - 1 - stack[stack.length-1])));\r\n }\r\n }\r\n \r\n return res;\r\n};\r\n","description":"Bob wants to put a new bargaining table in his office. To do so he measured the office room thoroughly and drew its plan: Bob's office room is a rectangular room n\u00d7m meters. Each square meter of the room is either occupied by some furniture, or free. A bargaining table is rectangular, and should be placed so, that its sides are parallel to the office walls. Bob doesn't want to change or rearrange anything, that's why all the squares that will be occupied by the table should be initially free. Bob wants the new table to sit as many people as possible, thus its perimeter should be maximal. Help Bob find out the maximum possible perimeter of a bargaining table for his office.","input_specification":"The first line contains 2 space-separated numbers n and m (1\u2264n,m\u226425) \u2014 the office room dimensions. Then there follow n lines with m characters 0 or 1 each. 0 stands for a free square meter of the office room. 1 stands for an occupied square meter. It's guaranteed that at least one square meter in the room is free.\n","output_specification":"Output one number \u2014 the maximum possible perimeter of a bargaining table for Bob's office room.\n","notes":null,"sample_inputs":["3 3\n000\n010\n000\n","5 4\n1100\n0000\n0000\n0000\n0000\n"],"sample_outputs":["8\n","16\n"],"human_solution":"'use strict';\r\n\r\nfunction solve(n, m, a) {\r\n const h = new Array(m).fill(0);\r\n let res = 0;\r\n for (let i = 0; i < n; i++) {\r\n for (let j = 0; j < m; j++) {\r\n if (a[i][j]) h[j] = 0;else h[j]++;\r\n }\r\n const stack = [];\r\n for (let j = 0; j <= m; j++) {\r\n while (stack.length && (j === m || h[stack[stack.length - 1]] > h[j])) {\r\n var _stack;\r\n const cur = stack.pop(),\r\n p = (_stack = stack[stack.length - 1]) !== null && _stack !== void 0 ? _stack : -1;\r\n if (h[cur]) res = Math.max(res, (j - p - 1) * 2 + h[cur] * 2);\r\n }\r\n stack.push(j);\r\n }\r\n }\r\n return res;\r\n}\r\n\r\nasync function main(r) {\r\n const rns = async () => {\r\n return (await r()).split(' ').filter(s => s !== '').map(Number);\r\n };\r\n try {\r\n let t = 1;\r\n let res = new Array(t);\r\n for (let i = 0; i < t; i++) {\r\n const [n, m] = await rns();\r\n const a = [];\r\n let tmp = n;\r\n while (tmp--) {\r\n a.push((await r()).split('').map(Number));\r\n }\r\n res[i] = solve(n, m, a);\r\n }\r\n return res.join('\\n');\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', async () => {\r\n inputs = str.split('\\n').values();\r\n const output = await main(read);\r\n process.stdout.write(output);\r\n});\r\n","testcases":"[{'input': ['3 3\\r\\n000\\r\\n010\\r\\n000\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 4\\r\\n1100\\r\\n0000\\r\\n0000\\r\\n0000\\r\\n0000\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['3 3\\r\\n000\\r\\n110\\r\\n000\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['4 2\\r\\n00\\r\\n10\\r\\n11\\r\\n00\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3 5\\r\\n00001\\r\\n00000\\r\\n10100\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['1 1\\r\\n0\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 11\\r\\n11111111101\\r\\n01111111111\\r\\n11101111111\\r\\n01111110111\\r\\n11111111111\\r\\n11111111111\\r\\n11111111111\\r\\n11110111111\\r\\n11111111111\\r\\n11111111111\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7 7\\r\\n1110111\\r\\n1111111\\r\\n1111101\\r\\n1111101\\r\\n1111111\\r\\n1100111\\r\\n1011111\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10 10\\r\\n0110001011\\r\\n0101010111\\r\\n0010110100\\r\\n1010000110\\r\\n0111100011\\r\\n1010100100\\r\\n1010010000\\r\\n1011100011\\r\\n1110011000\\r\\n0010100101\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['20 20\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n00000000000000000000\\r\\n'], 'output': ['80\\r\\n']}, {'input': ['25 1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['25 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\\n'], 'output': ['52\\r\\n']}, {'input': ['1 25\\r\\n1111111111111111011010110\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 25\\r\\n0000000000000000000000000\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['3 4\\r\\n1111\\r\\n1101\\r\\n1011\\r\\n'], 'output': ['4\\r\\n']}]","id":422} {"difficulty":1400,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"26_B","execute_outcome":"WRONG_ANSWER","source_code":"const fs = require('fs');\nconst input = fs.readFileSync(0, 'utf8').trim().split(\/[\\n\\r]+\/);\nconst log = (...args) => console.log(...args);\n\nlet count = 0;\nconst readnum = () => input[count++].trim().split(' ').map(a => +a);\nconst readword = () => input[count++].trim().split(' ');\n\nlet str = readword()[0];\nconsole.log(solve(str));\n\nfunction solve(str) {\n function f(str, par) {\n let cur = 0, bal = 0, max = 0;\n for (let ch of str) {\n cur++;\n\n if (ch == par) {\n bal++;\n } else {\n bal--;\n } \n\n if (bal == 0)\n max = Math.max(cur, max);\n\n if (bal < 0) {\n bal = 0;\n cur = 0;\n } \n }\n\n return max;\n }\n\n return Math.max(f(str, '('), f([...str].reverse().join(''), ')'));\n}\n","description":"A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters \u00ab+\u00bb and \u00ab1\u00bb into this sequence. For example, sequences \u00ab(())()\u00bb, \u00ab()\u00bb and \u00ab(()(()))\u00bb are regular, while \u00ab)(\u00bb, \u00ab(()\u00bb and \u00ab(()))(\u00bb are not.One day Johnny got bracket sequence. He decided to remove some of the brackets from it in order to obtain a regular bracket sequence. What is the maximum length of a regular bracket sequence which can be obtained?","input_specification":"Input consists of a single line with non-empty string of \u00ab(\u00bb and \u00ab)\u00bb characters. Its length does not exceed 10^6.\n","output_specification":"Output the maximum possible length of a regular bracket sequence.\n","notes":null,"sample_inputs":["(()))(\n","((()())\n"],"sample_outputs":["4\n","6\n"],"human_solution":"\/\/Don't have to see. start------------------------------------------\r\nvar read = require('readline').createInterface({\r\n\tinput: process.stdin, output: process.stdout\r\n});\r\nvar obj; var inLine = []; var outputList = [];var retcode = new Set();\r\nread.on('line', function(input){\r\n\tvar tmp = input.split(' ');\r\n\tfor(var i = 0; i < tmp.length; i++){\r\n\t\tinLine.push(tmp[i]);\r\n\t\tif(i == tmp.length - 1){\r\n\t\t\tretcode.add(inLine.length);\r\n\t\t}\r\n\t}\r\n});\r\nread.on('close', function(){\r\n\tobj = init(inLine);\r\n\tconsole.error('\\n\u00e2\u0086\u0091\u00e5\u0085\u00a5\u00e5\u008a\u009b \u00e2\u0086\u0093\u00e5\u0087\u00ba\u00e5\u008a\u009b');\r\n\tMain();\r\n\tconsole.log(myconv(outputList, 9));\r\n});\r\nfunction makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}\r\nfunction nextArray(size, code){\r\n\tvar ret = new Array(size);\r\n\tfor(var i = 0; i < size; i++){\r\n\t\tif(code == 'int'){\r\n\t\t\tret[i] = nextInt();\r\n\t\t}else{\r\n\t\t\tret[i] = next();\r\n\t\t}\r\n\t}\r\n\treturn ret;\r\n}\r\nfunction nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}\r\nfunction nextCharArray(){return myconv(next(),6);}\r\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}\r\nfunction init(input){ \r\n\treturn {\r\n\t\tlist : input, index : 0, max : input.length,\r\n\t\thasNext : function(){return (this.index < this.max);},\r\n\t\tnext : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException \u00e2\u0080\u009aThere is no more input';}},\r\n\t\tisReturn : function(){return retcode.has(this.index);}\r\n\t};\r\n}\r\nfunction myout(s){outputList.push(s);}\r\nfunction myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}\r\nfunction isReturn(){return obj.isReturn();}\r\n\/\/param \"no\" is\r\n\/\/unknown or outlier : return i. 1: parseInt.\r\n\/\/2: split space. 4: split space and parseInt.\r\n\/\/6: split 1 character. 7: split 1 character and parseInt.\r\n\/\/8: join space. 9: join nextline. 0: join no character.\r\nfunction myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}\r\n\r\n\/\/Don't have to see. end------------------------------------------\r\nfunction Main(){\r\n\tvar s = next();\r\n\tvar queue = [];\r\n\tvar N = s.length;\r\n\tfor(var i = 0; i < N; i++){\r\n\t\tif(s[i] == \"(\"){\r\n\t\t\tqueue.push(\"(\");\r\n\t\t}else{\r\n\t\t\tif(queue.length > 0 && queue[queue.length - 1] == \"(\"){\r\n\t\t\t\tqueue.pop();\r\n\t\t\t}else{\r\n\t\t\t\tqueue.push(\")\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tmyout(N - queue.length);\r\n}\r\n","testcases":"[{'input': ['(()))(\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['((()())\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['(\\r\\n'], 'output': ['0\\r\\n']}, {'input': [')\\r\\n'], 'output': ['0\\r\\n']}, {'input': [')(()(\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['))))))(\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['()()(()(((\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['()))(()((((()(())\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['())))((()())())))))())\\r\\n'], 'output': ['14\\r\\n']}, {'input': [')))((((())(()((()((((()()())((\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['))()()((()()))())()(((((((())((((((((())()()((())(\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['))())))))))())))))()()))()()))))())))))()))))))))))))(()))())(()))))(()))))())))((((()()))))()))()))\\r\\n'], 'output': ['48\\r\\n']}]","id":423} {"difficulty":1200,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"33_A","execute_outcome":"WRONG_ANSWER","source_code":"\"use strict\";\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding(\"utf-8\");\r\n \r\nfunction print(x) {\r\n console.log(x);\r\n}\r\nlet inputString = \"\";\r\nlet currentLine = 0;\r\n \r\nprocess.stdin.on(\"data\", (inputStdin) => {\r\n inputString += inputStdin;\r\n});\r\nprocess.stdin.on(\"end\", () => {\r\n inputString = inputString.split(\"\\n\");\r\n main();\r\n});\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n \r\n\/\/ ********** Code Start **********\r\n\r\nfunction main() {\r\nvar word = readline()\r\nvar output\r\n\r\nif (isNaN(Number(word))) {\r\n var wordLength = word.length\r\n if (wordLength >= 10) {\r\n output = `${word[0]}${wordLength - 2}${word[wordLength - 1]}`\r\n } else {\r\n output = word\r\n }\r\n}\r\nconsole.log(output)\r\n\r\n\r\n}\r\n\r\n\r\n","description":"In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are \"relaxing\".For a long time our heroine had been searching the sea for crucians, but a great misfortune happened. Her teeth started to ache, and she had to see the local dentist, lobster Ashot. As a professional, Ashot quickly relieved Valerie from her toothache. Moreover, he managed to determine the cause of Valerie's developing caries (for what he was later nicknamed Cap).It turned that Valerie eats too many crucians. To help Valerie avoid further reoccurrence of toothache, Ashot found for each Valerie's tooth its residual viability. Residual viability of a tooth is a value equal to the amount of crucians that Valerie can eat with this tooth. Every time Valerie eats a crucian, viability of all the teeth used for it will decrease by one. When the viability of at least one tooth becomes negative, the shark will have to see the dentist again. Unhappy, Valerie came back home, where a portion of crucians was waiting for her. For sure, the shark couldn't say no to her favourite meal, but she had no desire to go back to the dentist. That's why she decided to eat the maximum amount of crucians from the portion but so that the viability of no tooth becomes negative. As Valerie is not good at mathematics, she asked you to help her to find out the total amount of crucians that she can consume for dinner.We should remind you that while eating one crucian Valerie uses exactly one row of teeth and the viability of each tooth from this row decreases by one.","input_specification":"The first line contains three integers n, m, k (1\u2264m\u2264n\u22641000,0\u2264k\u226410^6) \u2014 total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1\u2264r\u2264m) \u2014 index of the row, where belongs the corresponding tooth, and c (0\u2264c\u226410^6) \u2014 its residual viability.\nIt's guaranteed that each tooth row has positive amount of teeth.\n","output_specification":"In the first line output the maximum amount of crucians that Valerie can consume for dinner.\n","notes":null,"sample_inputs":["4 3 18\n2 3\n1 2\n3 6\n2 3\n","2 2 13\n1 13\n2 12\n"],"sample_outputs":["11\n","13\n"],"human_solution":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\n\r\nlet n, m, k, indicator = 0, row, health, sum = 0;\r\nlet myMap = new Map();\r\n\r\nrl.on('line', (input) => {\r\n if (indicator == 0) {\r\n [n, m, k] = input.split(' ').map(item => parseInt(item));\r\n indicator++;\r\n }\r\n else {\r\n [row, health] = input.split(' ').map(item => parseInt(item));\r\n\r\n if (!myMap.has(row) || myMap.has(row) && myMap.get(row) > health)\r\n myMap.set(row, health);\r\n }\r\n\r\n}).on('close', () => {\r\n\r\n for(let[key, value] of myMap)\r\n sum += value;\r\n\r\n console.log( (sum > k) ? k : sum);\r\n});\r\n","testcases":"[{'input': ['4 3 18\\r\\n2 3\\r\\n1 2\\r\\n3 6\\r\\n2 3\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['2 2 13\\r\\n1 13\\r\\n2 12\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['5 4 8\\r\\n4 6\\r\\n4 5\\r\\n1 3\\r\\n2 0\\r\\n3 3\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 1 0\\r\\n1 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 1 30\\r\\n1 8\\r\\n1 15\\r\\n1 5\\r\\n1 17\\r\\n1 9\\r\\n1 16\\r\\n1 16\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4 2 8\\r\\n1 9\\r\\n1 10\\r\\n1 4\\r\\n2 6\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['10 4 14\\r\\n2 6\\r\\n1 5\\r\\n2 8\\r\\n2 6\\r\\n2 5\\r\\n4 1\\r\\n4 0\\r\\n2 4\\r\\n3 4\\r\\n1 0\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['54 22 1009\\r\\n15 7\\r\\n17 7\\r\\n11 9\\r\\n5 11\\r\\n12 9\\r\\n13 8\\r\\n13 12\\r\\n22 11\\r\\n20 9\\r\\n20 7\\r\\n16 11\\r\\n19 12\\r\\n3 12\\r\\n15 9\\r\\n1 12\\r\\n2 10\\r\\n16 10\\r\\n16 10\\r\\n14 10\\r\\n9 11\\r\\n9 9\\r\\n14 8\\r\\n10 10\\r\\n16 12\\r\\n1 8\\r\\n3 8\\r\\n21 11\\r\\n18 12\\r\\n2 6\\r\\n9 11\\r\\n11 7\\r\\n15 9\\r\\n20 11\\r\\n6 8\\r\\n8 8\\r\\n19 11\\r\\n15 7\\r\\n9 9\\r\\n22 7\\r\\n12 9\\r\\n17 9\\r\\n17 11\\r\\n12 7\\r\\n15 9\\r\\n5 11\\r\\n11 6\\r\\n18 8\\r\\n7 10\\r\\n4 10\\r\\n13 12\\r\\n4 8\\r\\n20 6\\r\\n15 12\\r\\n9 7\\r\\n'], 'output': ['180\\r\\n']}, {'input': ['1 1 1000000\\r\\n1 1000000\\r\\n'], 'output': ['1000000\\r\\n']}, {'input': ['4 3 181818\\r\\n3 1299\\r\\n1 1694\\r\\n3 1164\\r\\n2 1278\\r\\n'], 'output': ['4136\\r\\n']}, {'input': ['50 50 0\\r\\n33 0\\r\\n26 0\\r\\n30 0\\r\\n41 0\\r\\n38 0\\r\\n36 0\\r\\n16 0\\r\\n7 0\\r\\n23 0\\r\\n5 0\\r\\n39 0\\r\\n29 0\\r\\n40 0\\r\\n47 0\\r\\n24 0\\r\\n43 0\\r\\n14 0\\r\\n10 0\\r\\n20 0\\r\\n3 0\\r\\n6 0\\r\\n34 0\\r\\n13 0\\r\\n18 0\\r\\n21 0\\r\\n9 0\\r\\n8 0\\r\\n22 0\\r\\n25 0\\r\\n4 0\\r\\n11 0\\r\\n17 0\\r\\n32 0\\r\\n44 0\\r\\n49 0\\r\\n50 0\\r\\n27 0\\r\\n28 0\\r\\n45 0\\r\\n12 0\\r\\n35 0\\r\\n15 0\\r\\n42 0\\r\\n31 0\\r\\n2 0\\r\\n1 0\\r\\n48 0\\r\\n19 0\\r\\n37 0\\r\\n46 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['19 12 199\\r\\n7 1\\r\\n8 6\\r\\n6 14\\r\\n1 7\\r\\n4 1\\r\\n6 6\\r\\n3 4\\r\\n1 5\\r\\n9 2\\r\\n5 3\\r\\n11 3\\r\\n9 4\\r\\n1 12\\r\\n4 7\\r\\n7 3\\r\\n12 14\\r\\n2 1\\r\\n10 8\\r\\n6 12\\r\\n'], 'output': ['54\\r\\n']}]","id":424} {"difficulty":1400,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"38_C","execute_outcome":"RUNTIME_ERROR","source_code":"var max=0;\r\nvar temp=0;\r\nvar arr = readline().split(' ');\r\nvar n=arr[0];\r\nvar l=arr[1];\r\nvar stripes=readline().split(' ');\r\nvar ans = [];\r\nfor (var i = 0; i < n; i++){\r\n if (max < stripes[i]){\r\n max = stripes[i];}\r\n}\r\n for (var i = l; i <= max; i++)\r\n {\r\n for (var j = 0; j < n; j++)\r\n {\r\n temp += parseInt(stripes[j] \/ i);\r\n }\r\n ans.push(temp * i);\r\n temp = 0;\r\n }\r\n for (var i = 0; i < ans.lenght; i++)\r\n if (max < ans[i])\r\n max = ans[i];\r\n\r\n if (max > l)\r\n print(max);\r\n else\r\n print(0);","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u00d7d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2264n,l\u2264100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2264ai\u2264100).\n","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.\n","notes":"In the first sample test the required window is 2\u00d74 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.\n","sample_inputs":["4 2\n1 2 3 4\n","5 3\n5 5 7 3 1\n","2 3\n1 2\n"],"sample_outputs":["8\n","15\n","0\n"],"human_solution":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\nvar cont = [], minLen,N = 0, woodCounter = 0, ans = 0, maxLen,helper = 0;\r\n\r\nrl.on('line', (input) => {\r\n if(N === 0){\r\n cont = input.split(' ').map(item => parseInt(item));\r\n N = cont[0];\r\n minLen = cont[1];\r\n }\r\n else{\r\n cont = input.split(' ').map(item => parseInt(item));\r\n maxLen = Math.max(...cont);\r\n \r\n for (let len = minLen; len <= maxLen; len++) {\r\n helper = 0;\r\n cont.forEach(item => {\r\n helper += parseInt(item \/ len); \r\n });\r\n if(ans < helper * len)\r\n ans = helper * len;\r\n \r\n }\r\n console.log(ans);\r\n rl.close();\r\n }\r\n \r\n \r\n\r\n });\r\n\r\n\r\n \/*\r\nN = 4 minLen = 2\r\n1 2 3 4\r\n\r\n --\r\n --\r\n --\r\n --\r\n 2*4 == 8\r\n\r\n ---\r\n ---\r\n\r\n 2*3 == 6\r\n\r\n ----\r\n 1*4 == 4\r\n\r\n \r\n \r\n\r\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":425} {"difficulty":1100,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"46_B","execute_outcome":"WRONG_ANSWER","source_code":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\nconst { parse } = require('path');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\nlet i = 0, n = 0, myMap = new Map();\r\n\r\nrl.on('line', (input) => {\r\n if (i == 0) {\r\n let arr = input.split(' ').map(it => parseInt(it));\r\n myMap.set('S', arr[0]);\r\n myMap.set('M', arr[1]);\r\n myMap.set('L', arr[2]);\r\n myMap.set('XL', arr[3]);\r\n myMap.set('XXL', arr[4]);\r\n i++;\r\n }\r\n else if (i == 1) {\r\n n = parseInt(input)\r\n i++;\r\n }\r\n else {\r\n switch (input) {\r\n case 'S':\r\n if (myMap.get('S') > 0) {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n break;\r\n case 'M':\r\n if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('S') > 0) {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('L') - 1);\r\n }\r\n else {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n break;\r\n case 'L':\r\n if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break;\r\n case 'XL':\r\n if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break;\r\n default:\r\n if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break; \r\n\r\n }\r\n }\r\n\r\n});","description":"One day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what sizes should be ordered, and on the other hand, one doesn't want to order too many T-shirts (and we do not exactly paper the walls with the oversupply). After considerable brain racking and some pre-estimating, the sponsor representatives ordered a certain number of T-shirts of sizes S, M, L, XL and XXL. The T-shirts turned out to bring good luck, that's why on the contest day there built up a line of K participants willing to get one. Every contestant is characterized by his\/her desired T-shirt size (so it happens that for all the participants it is also one of the sizes S, M, L, XL and XXL). The participants come up to get a T-shirt one by one and try to choose the most suitable one, choosing it like this. If there is still a T-shirt of the optimal size left, that he\/she takes it without further ado. Otherwise the contestant would prefer to choose a T-shirt with the size as close to the optimal one as possible (the distance between neighboring sizes is considered equal to one). If the variant of choice is not unique, the contestant will take a T-shirt of a bigger size (in case he\/she grows more). For example, for a person whose optimal size is L the preference list looks like this: L, XL, M, XXL, S. Using the data on how many T-shirts of every size had been ordered by the organizers, on the size of contestants in the line determine who got a T-shirt of what size.","input_specification":"The first line contains five non-negative integers NS,NM,NL,NXL,NXXL not exceeding 1000 which represent the number of T-shirts of the corresponding sizes. The second line contains an integer K (1\u2264K\u22641000) which represents the number of participants. The next K lines contain the optimal T-shirt sizes for the contestants. The sizes are given in the order in which the participants stand in the line. It is guaranteed that NS+NM+NL+NXL+NXXL\u2265K.\n","output_specification":"For each contestant, print a line containing the size of the T-shirt he\/she got.\n","notes":null,"sample_inputs":["1 0 2 0 1\n3\nXL\nXXL\nM\n"],"sample_outputs":["XXL\nL\nL\n"],"human_solution":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\nconst { parse } = require('path');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\nlet i = 0, n = 0, myMap = new Map();\r\n\r\nrl.on('line', (input) => {\r\n if (i == 0) {\r\n let arr = input.split(' ').map(it => parseInt(it));\r\n myMap.set('S', arr[0]);\r\n myMap.set('M', arr[1]);\r\n myMap.set('L', arr[2]);\r\n myMap.set('XL', arr[3]);\r\n myMap.set('XXL', arr[4]);\r\n i++;\r\n }\r\n else if (i == 1) {\r\n n = parseInt(input)\r\n i++;\r\n }\r\n else {\r\n switch (input) {\r\n case 'S':\r\n if (myMap.get('S') > 0) {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n break;\r\n case 'M':\r\n if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('S') > 0) {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n break;\r\n case 'L':\r\n if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break;\r\n case 'XL':\r\n if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break;\r\n default:\r\n if (myMap.get('XXL') > 0) {\r\n console.log('XXL');\r\n myMap.set('XXL', myMap.get('XXL') - 1);\r\n }\r\n else if (myMap.get('XL') > 0) {\r\n console.log('XL');\r\n myMap.set('XL', myMap.get('XL') - 1);\r\n }\r\n else if (myMap.get('L') > 0) {\r\n console.log('L');\r\n myMap.set('L', myMap.get('L') - 1);\r\n }\r\n else if (myMap.get('M') > 0) {\r\n console.log('M');\r\n myMap.set('M', myMap.get('M') - 1);\r\n }\r\n else {\r\n console.log('S');\r\n myMap.set('S', myMap.get('S') - 1);\r\n }\r\n break; \r\n\r\n }\r\n }\r\n\r\n});","testcases":"[{'input': ['1 0 2 0 1\\r\\n3\\r\\nXL\\r\\nXXL\\r\\nM\\r\\n'], 'output': ['XXL\\r\\nL\\r\\nL\\r\\n']}, {'input': ['0 0 0 0 1\\r\\n1\\r\\nS\\r\\n'], 'output': ['XXL\\r\\n']}, {'input': ['1 0 1 0 1\\r\\n1\\r\\nS\\r\\n'], 'output': ['S\\r\\n']}, {'input': ['1 0 0 0 1\\r\\n2\\r\\nS\\r\\nL\\r\\n'], 'output': ['S\\r\\nXXL\\r\\n']}, {'input': ['1 1 1 1 1\\r\\n2\\r\\nXL\\r\\nM\\r\\n'], 'output': ['XL\\r\\nM\\r\\n']}, {'input': ['1 0 1 1 1\\r\\n3\\r\\nS\\r\\nXXL\\r\\nL\\r\\n'], 'output': ['S\\r\\nXXL\\r\\nL\\r\\n']}, {'input': ['1 0 2 1 1\\r\\n4\\r\\nS\\r\\nXXL\\r\\nL\\r\\nM\\r\\n'], 'output': ['S\\r\\nXXL\\r\\nL\\r\\nL\\r\\n']}, {'input': ['1 0 3 0 1\\r\\n5\\r\\nS\\r\\nS\\r\\nS\\r\\nXL\\r\\nL\\r\\n'], 'output': ['S\\r\\nL\\r\\nL\\r\\nXXL\\r\\nL\\r\\n']}, {'input': ['2 1 0 1 3\\r\\n4\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\n'], 'output': ['XL\\r\\nM\\r\\nS\\r\\nS\\r\\n']}, {'input': ['2 2 0 2 1\\r\\n6\\r\\nS\\r\\nXXL\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\n'], 'output': ['S\\r\\nXXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nM\\r\\n']}, {'input': ['3 1 1 4 1\\r\\n10\\r\\nXL\\r\\nL\\r\\nL\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nM\\r\\n'], 'output': ['XL\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nS\\r\\n']}, {'input': ['14 3 1 0 2\\r\\n10\\r\\nS\\r\\nXL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nL\\r\\n'], 'output': ['S\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nS\\r\\nL\\r\\nM\\r\\nM\\r\\nS\\r\\nS\\r\\n']}, {'input': ['44 314 100 272 270\\r\\n10\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nL\\r\\nL\\r\\n'], 'output': ['XXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nL\\r\\nL\\r\\n']}, {'input': ['2 22 11 9 6\\r\\n20\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nM\\r\\nL\\r\\nS\\r\\nS\\r\\nXL\\r\\n'], 'output': ['XL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nM\\r\\nL\\r\\nS\\r\\nM\\r\\nXL\\r\\n']}, {'input': ['13 0 2 4 41\\r\\n20\\r\\nS\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nL\\r\\nL\\r\\nM\\r\\n'], 'output': ['S\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nL\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\n']}, {'input': ['5 7 2 9 7\\r\\n30\\r\\nS\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nXL\\r\\nL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nL\\r\\nXL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nM\\r\\nM\\r\\nM\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nL\\r\\n'], 'output': ['S\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nXXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nXL\\r\\n']}, {'input': ['3 17 3 21 16\\r\\n50\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nM\\r\\nS\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nL\\r\\nS\\r\\nXL\\r\\nS\\r\\nM\\r\\nS\\r\\nL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nL\\r\\nL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nL\\r\\nL\\r\\nM\\r\\nL\\r\\nS\\r\\nM\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nS\\r\\nL\\r\\n'], 'output': ['L\\r\\nXL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nM\\r\\nM\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nL\\r\\nM\\r\\nXL\\r\\nM\\r\\nM\\r\\nM\\r\\nL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\n']}, {'input': ['2 36 4 48 10\\r\\n50\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nS\\r\\nS\\r\\nL\\r\\nM\\r\\nM\\r\\nXXL\\r\\nS\\r\\nS\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nS\\r\\nM\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nM\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nL\\r\\nS\\r\\nXL\\r\\n'], 'output': ['XXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nM\\r\\nM\\r\\nL\\r\\nM\\r\\nM\\r\\nXXL\\r\\nM\\r\\nM\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nM\\r\\nM\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\n']}, {'input': ['450 65 82 309 94\\r\\n50\\r\\nM\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nM\\r\\nXL\\r\\nS\\r\\nL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nL\\r\\nS\\r\\nXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\n'], 'output': ['M\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nM\\r\\nXL\\r\\nS\\r\\nL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nL\\r\\nS\\r\\nXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\n']}, {'input': ['200 910 49 294 547\\r\\n50\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nS\\r\\nL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\n'], 'output': ['XXL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nS\\r\\nL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\n']}, {'input': ['85 80 1 27 7\\r\\n100\\r\\nXXL\\r\\nM\\r\\nM\\r\\nS\\r\\nL\\r\\nL\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nM\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nS\\r\\nM\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nM\\r\\nS\\r\\nXL\\r\\nS\\r\\nXL\\r\\nS\\r\\nXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nL\\r\\nM\\r\\nXL\\r\\nM\\r\\nS\\r\\nL\\r\\nM\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nM\\r\\nS\\r\\nM\\r\\nL\\r\\nXXL\\r\\nXXL\\r\\nM\\r\\nS\\r\\nS\\r\\nL\\r\\nXXL\\r\\nM\\r\\nXXL\\r\\nM\\r\\nS\\r\\nM\\r\\nXXL\\r\\nM\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nL\\r\\nL\\r\\nS\\r\\nS\\r\\nS\\r\\nL\\r\\nM\\r\\nL\\r\\nXXL\\r\\nL\\r\\nL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nS\\r\\nL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nM\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nL\\r\\nXXL\\r\\n'], 'output': ['XXL\\r\\nM\\r\\nM\\r\\nS\\r\\nL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXL\\r\\nS\\r\\nM\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nXL\\r\\nS\\r\\nXL\\r\\nS\\r\\nXL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nS\\r\\nXL\\r\\nM\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nM\\r\\nS\\r\\nM\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nS\\r\\nS\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nM\\r\\nS\\r\\nM\\r\\nXL\\r\\nM\\r\\nM\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nM\\r\\nS\\r\\nM\\r\\nM\\r\\nS\\r\\nS\\r\\nS\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nS\\r\\nS\\r\\nS\\r\\nM\\r\\nM\\r\\nM\\r\\nS\\r\\nM\\r\\nM\\r\\nS\\r\\nS\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\nM\\r\\n']}, {'input': ['302 143 40 63 452\\r\\n100\\r\\nXXL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nM\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nXXL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nS\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nL\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nM\\r\\nXL\\r\\nL\\r\\nS\\r\\nS\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nL\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nM\\r\\nS\\r\\nM\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nM\\r\\nL\\r\\nXXL\\r\\n'], 'output': ['XXL\\r\\nM\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nXL\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nXXL\\r\\nM\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nXXL\\r\\nS\\r\\nL\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nS\\r\\nXXL\\r\\nL\\r\\nXXL\\r\\nM\\r\\nS\\r\\nL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nL\\r\\nM\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nXL\\r\\nXL\\r\\nM\\r\\nM\\r\\nXL\\r\\nL\\r\\nS\\r\\nS\\r\\nXL\\r\\nS\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nS\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nS\\r\\nL\\r\\nL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nXL\\r\\nM\\r\\nS\\r\\nM\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nS\\r\\nXL\\r\\nXL\\r\\nM\\r\\nXL\\r\\nXXL\\r\\nXXL\\r\\nXL\\r\\nL\\r\\nS\\r\\nM\\r\\nXXL\\r\\nM\\r\\nL\\r\\nXXL\\r\\n']}]","id":426} {"difficulty":1200,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"48_B","execute_outcome":"WRONG_ANSWER","source_code":"var getArr = function() {\r\n\treturn readline().split(' ').map(function (a) {\r\n\t\treturn parseInt(a);\r\n\t})\r\n};\r\n\r\nvar getTree = function(arr, x, y, a, b) {\r\n\tvar res = 0;\r\n\tfor (var i = 0; i < a; i++) {\r\n\t\tfor (var j = 0; j < b; j++) {\r\n\t\t\tres += arr[x + i][y + j];\r\n\t\t}\r\n\t}\r\n\treturn res;\r\n};\r\n\r\nvar data = [];\r\nvar input;\r\n\r\ninput = getArr();\r\nvar m = input[0];\r\nvar n = input[1];\r\nfor (var k = 0; k < m; k++) {\r\n\tdata.push(getArr());\r\n}\r\ninput = getArr();\r\nvar a = input[0];\r\nvar b = input[1];\r\n\r\nvar min = getTree(data, 0, 0, a, b);\r\nfor (var i = 0; i < m - a + 1; i++) {\r\n\tfor (var j = 0; j < n - b + 1; j++) {\r\n\t\tmin = Math.min(min, getTree(data, i, j, a, b));\r\n\t}\r\n}\r\n\r\nprint(min);","description":"Vasya has a beautiful garden where wonderful fruit trees grow and yield fantastic harvest every year. But lately thieves started to sneak into the garden at nights and steal the fruit too often. Vasya can\u2019t spend the nights in the garden and guard the fruit because there\u2019s no house in the garden! Vasya had been saving in for some time and finally he decided to build the house. The rest is simple: he should choose in which part of the garden to build the house. In the evening he sat at his table and drew the garden\u2019s plan. On the plan the garden is represented as a rectangular checkered field n\u00d7m in size divided into squares whose side length is 1. In some squares Vasya marked the trees growing there (one shouldn\u2019t plant the trees too close to each other that\u2019s why one square contains no more than one tree). Vasya wants to find a rectangular land lot a\u00d7b squares in size to build a house on, at that the land lot border should go along the lines of the grid that separates the squares. All the trees that grow on the building lot will have to be chopped off. Vasya loves his garden very much, so help him choose the building land lot location so that the number of chopped trees would be as little as possible.","input_specification":"The first line contains two integers n and m (1\u2264n,m\u226450) which represent the garden location. The next n lines contain m numbers 0 or 1, which describe the garden on the scheme. The zero means that a tree doesn\u2019t grow on this square and the 1 means that there is a growing tree. The last line contains two integers a and b (1\u2264a,b\u226450). Note that Vasya can choose for building an a\u00d7b rectangle as well a b\u00d7a one, i.e. the side of the lot with the length of a can be located as parallel to the garden side with the length of n, as well as parallel to the garden side with the length of m.\n","output_specification":"Print the minimum number of trees that needs to be chopped off to select a land lot a\u00d7b in size to build a house on. It is guaranteed that at least one lot location can always be found, i. e. either a\u2264n and b\u2264m, or a\u2264m \u0438 b\u2264n.\n","notes":"In the second example the upper left square is (1,1) and the lower right is (3,2).\n","sample_inputs":["2 2\n1 0\n1 1\n1 1\n","4 5\n0 0 1 0 1\n0 1 1 1 0\n1 0 1 0 1\n1 1 1 1 1\n2 3\n"],"sample_outputs":["0\n","2\n"],"human_solution":"const readline = require('readline');\r\n\r\nconst rl = readline.createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\n\r\nvar calculate = function (cont, row, col, a, b) {\r\n let ct = 0;\r\n for (let i = row; i < row + a; i++)\r\n for (let j = col; j < col + b; j++)\r\n ct += cont[i][j];\r\n return ct;\r\n}\r\n\r\nlet n = -1, m = -1, cont = new Array(), a, b, i = 0, temp = new Array();\r\nrl.on('line', (input) => {\r\n\r\n if (n === -1) {\r\n temp = input.split(' ').map(item => { return parseInt(item) });\r\n n = temp[0], m = temp[1];\r\n }\r\n else if (i++ < n) {\r\n cont.push(input.split(' ').map(item => { return parseInt(item) }));\r\n }\r\n else {\r\n temp = input.split(' ').map(item => { return parseInt(item) });\r\n a = temp[0], b = temp[1];\r\n }\r\n\r\n}).on('close', () => {\r\n \/\/console.log(cont);\r\n let ans = n * m, trees;\r\n for (let i = 0; i < n; i++) {\r\n for (let j = 0; j < m; j++) {\r\n\r\n if (i + a <= n && j + b <= m) {\r\n trees = calculate(cont, i, j, a, b);\r\n if (ans > trees) ans = trees;\r\n }\r\n\r\n if (i + b <= n && j + a <= m) {\r\n trees = calculate(cont, i, j, b, a);\r\n if (ans > trees) ans = trees;\r\n }\r\n }\r\n }\r\n console.log(ans);\r\n});\r\n","testcases":"[{'input': ['2 2\\r\\n1 0\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 5\\r\\n0 0 1 0 1\\r\\n0 1 1 1 0\\r\\n1 0 1 0 1\\r\\n1 1 1 1 1\\r\\n2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 3\\r\\n0 0 0\\r\\n0 0 0\\r\\n0 0 0\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 2\\r\\n1 1\\r\\n1 1\\r\\n1 0\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 3\\r\\n1 0 1\\r\\n0 1 0\\r\\n3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1 1\\r\\n0\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 4\\r\\n1 0 1 0\\r\\n0 1 0 1\\r\\n1 0 1 0\\r\\n2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 4\\r\\n1 1 1 1\\r\\n1 0 0 1\\r\\n1 1 1 1\\r\\n3 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 10\\r\\n1 1 1 0 0 0 0 1 1 0\\r\\n1 1 1 0 1 1 0 1 1 1\\r\\n1 0 1 1 0 1 1 1 1 0\\r\\n0 1 1 1 1 1 1 1 1 1\\r\\n1 1 1 1 0 1 1 1 1 1\\r\\n1 1 1 1 0 0 1 1 1 1\\r\\n1 1 1 1 0 1 1 1 0 1\\r\\n0 1 1 1 1 1 1 0 1 0\\r\\n1 1 1 1 1 0 0 1 0 1\\r\\n1 1 0 1 0 1 1 1 1 0\\r\\n5 4\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['10 10\\r\\n0 1 1 1 1 1 1 0 1 1\\r\\n0 1 1 1 1 1 0 0 1 1\\r\\n1 1 0 0 1 1 0 0 0 0\\r\\n0 0 0 0 1 0 1 1 1 0\\r\\n1 0 1 0 1 0 1 1 1 1\\r\\n1 0 0 1 1 1 1 1 0 1\\r\\n0 0 0 1 1 0 1 1 1 0\\r\\n1 0 1 1 1 1 1 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n0 0 0 1 1 0 0 1 1 1\\r\\n1 10\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 10\\r\\n1 0 1 1 1 1 0 0 1 1\\r\\n1 1 1 1 1 1 1 1 0 1\\r\\n1 0 0 1 1 1 1 1 1 1\\r\\n1 0 1 1 1 1 0 1 1 1\\r\\n0 0 1 0 1 1 1 1 1 1\\r\\n1 1 1 0 0 1 1 1 1 1\\r\\n0 1 1 0 1 1 0 1 1 0\\r\\n1 0 1 1 1 0 1 1 1 1\\r\\n1 0 1 1 1 0 1 1 0 1\\r\\n1 1 0 1 1 1 0 0 1 0\\r\\n10 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 7\\r\\n0 1 1 0 0 1 1\\r\\n1 1 0 0 0 0 1\\r\\n0 1 0 0 0 1 0\\r\\n0 1 0 1 1 1 1\\r\\n1 1 0 1 0 0 1\\r\\n0 1 0 0 0 0 0\\r\\n0 1 0 0 1 0 1\\r\\n0 1 0 1 1 0 0\\r\\n1 1 0 1 1 1 0\\r\\n1 1 0 0 0 1 0\\r\\n1 8\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 8\\r\\n1 1 0 1 1 1 0 0\\r\\n0 1 0 1 1 1 1 1\\r\\n1 1 0 0 1 0 0 1\\r\\n0 1 1 1 1 0 1 0\\r\\n0 1 1 0 1 1 0 1\\r\\n0 1 1 0 0 1 0 1\\r\\n1 0 0 0 1 1 0 1\\r\\n0 1 1 0 1 1 1 1\\r\\n0 1 1 1 0 1 0 1\\r\\n1 1 0 1 1 0 1 1\\r\\n4 9\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['10 10\\r\\n1 0 1 1 1 1 1 1 1 1\\r\\n1 1 1 0 1 1 0 1 1 1\\r\\n1 1 1 0 1 1 1 1 0 1\\r\\n1 1 0 1 1 1 0 0 0 1\\r\\n0 1 0 1 1 1 0 1 1 1\\r\\n1 0 1 0 1 0 1 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n1 1 1 1 1 1 1 0 1 1\\r\\n1 1 1 1 0 1 1 1 1 1\\r\\n0 1 1 1 1 0 1 1 0 1\\r\\n10 10\\r\\n'], 'output': ['80\\r\\n']}, {'input': ['10 10\\r\\n0 1 1 0 0 0 1 0 0 0\\r\\n0 0 1 1 1 1 0 1 0 0\\r\\n1 1 0 1 1 0 0 1 0 0\\r\\n1 0 0 0 0 0 0 0 1 0\\r\\n0 0 0 1 0 0 0 1 0 0\\r\\n0 1 0 0 1 0 0 0 1 0\\r\\n0 1 0 1 1 1 1 0 0 0\\r\\n1 0 0 1 0 1 0 0 0 0\\r\\n0 0 0 0 1 0 0 0 0 0\\r\\n1 1 0 0 0 0 0 0 1 0\\r\\n3 7\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 10\\r\\n1 1 1 0 1 1 1 1 0 0\\r\\n1 1 1 1 1 0 0 0 0 1\\r\\n0 1 1 0 0 1 1 1 0 0\\r\\n1 1 1 1 0 1 1 1 1 1\\r\\n1 0 0 1 0 1 1 1 1 1\\r\\n1 1 1 1 1 1 0 1 0 1\\r\\n1 1 1 1 1 1 1 1 0 0\\r\\n0 1 0 0 1 1 1 1 1 1\\r\\n0 1 1 1 0 1 0 1 0 0\\r\\n1 1 0 1 0 1 1 1 1 0\\r\\n6 7\\r\\n'], 'output': ['27\\r\\n']}, {'input': ['10 8\\r\\n0 1 1 1 1 1 1 0\\r\\n0 0 1 1 1 1 1 1\\r\\n0 1 0 1 1 1 1 0\\r\\n0 0 1 0 1 0 1 1\\r\\n0 1 1 1 1 1 1 1\\r\\n0 1 0 1 0 0 1 1\\r\\n0 0 0 0 0 0 0 1\\r\\n1 1 1 1 1 0 1 1\\r\\n1 1 1 0 1 1 1 0\\r\\n1 1 0 0 1 1 0 1\\r\\n8 10\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['10 1\\r\\n0\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n1 5\\r\\n'], 'output': ['4\\r\\n']}]","id":427} {"difficulty":1300,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"56_B","execute_outcome":"WRONG_ANSWER","source_code":"const readline = require('readline').createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\nlet i = 0;\r\nlet orginal = [];\r\nlet swapped = [];\r\nreadline.on('line', line => {\r\n i++;\r\n if (i === 1) {\r\n orginal = [...Array(parseInt(line)).keys()];\r\n orginal.splice(0, 1);\r\n }\r\n else {\r\n readline.close();\r\n swapped = line.split(' ').map((x) => {\r\n return parseInt(x);\r\n });\r\n difference = orginal.reduce((list, coin, index) => {\r\n if (coin !== swapped[index]) {\r\n list.push(coin)\r\n }\r\n return list\r\n }, []);\r\n if (difference.length === 0) {\r\n console.log(0, 0)\r\n } else {\r\n const firstIndex = orginal.indexOf(difference[0]);\r\n const lastIndex = orginal.indexOf(difference[difference.length - 1]);\r\n const originalPart = orginal.slice(firstIndex, lastIndex + 1)\r\n const reversedPart = swapped.slice(firstIndex, lastIndex + 1); \r\n if (isEqual(originalPart, reversedPart.reverse())) {\r\n console.log(difference[0], difference[difference.length - 1])\r\n } else {\r\n console.log(0, 0)\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\nfunction isEqual(a, b) \r\n{ \r\n \/\/ if length is not equal \r\n if(a.length!=b.length) \r\n return false; \r\n else\r\n { \r\n \/\/ comapring each element of array \r\n return a.reduce((value, e, index) => {\r\n if (e === b[index]) {\r\n value = true\r\n return value\r\n }\r\n value = false\r\n return value\r\n }, false)\r\n } \r\n}","description":"Vasya collects coins: he has exactly one coin for every year from 1 to n. Naturally, Vasya keeps all the coins in his collection in the order in which they were released. Once Vasya's younger brother made a change \u2014 he took all the coins whose release year dated from l to r inclusively and put them in the reverse order. That is, he took a certain segment [l,r] and reversed it. At that the segment's endpoints did not coincide. For example, if n=8, then initially Vasya's coins were kept in the order 1 2 3 4 5 6 7 8. If Vasya's younger brother chose the segment [2,6], then after the reversal the coin order will change to 1 6 5 4 3 2 7 8. Vasya suspects that someone else could have spoilt the permutation after his brother. Help him to find that out. Check if the given permutation can be obtained from the permutation 1 2 ... n using exactly one segment reversal. If it is possible, find the segment itself.","input_specification":"The first line contains an integer n (1\u2264n\u22641000) which is the number of coins in Vasya's collection. The second line contains space-separated n integers which are the spoilt sequence of coins. It is guaranteed that the given sequence is a permutation, i.e. it contains only integers from 1 to n, and every number is used exactly 1 time.\n","output_specification":"If it is impossible to obtain the given permutation from the original one in exactly one action, print 0 0. Otherwise, print two numbers l r (1\u2264l {\r\n i++;\r\n if (i === 1) {\r\n orginal = Array.from({length: parseInt(line) + 1}, (x, k) => k);\r\n orginal.splice(0, 1);\r\n }\r\n else {\r\n readline.close();\r\n swapped = line.split(' ').map((x) => {\r\n return parseInt(x);\r\n });\r\n difference = orginal.reduce((list, coin, index) => {\r\n if (coin !== swapped[index]) {\r\n list.push(coin)\r\n }\r\n return list\r\n }, []);\r\n if (difference.length === 0) {\r\n console.log(0, 0)\r\n } else {\r\n const firstIndex = orginal.indexOf(difference[0]);\r\n const lastIndex = orginal.indexOf(difference[difference.length - 1]);\r\n const originalPart = orginal.slice(firstIndex, lastIndex + 1)\r\n const reversedPart = swapped.slice(firstIndex, lastIndex + 1); \r\n if (isEqual(originalPart, reversedPart.reverse())) {\r\n console.log(difference[0], difference[difference.length - 1])\r\n } else {\r\n console.log(0, 0)\r\n }\r\n }\r\n\r\n }\r\n});\r\n\r\nfunction isEqual(a, b) \r\n{ \r\n \/\/ if length is not equal \r\n if(a.length!=b.length) \r\n return false; \r\n else\r\n { \r\n \/\/ comapring each element of array \r\n return a.reduce((value, e, index) => {\r\n if (e === b[index]) {\r\n value = true\r\n return value\r\n }\r\n value = false\r\n return value\r\n }, false)\r\n } \r\n}","testcases":"[{'input': ['8\\r\\n1 6 5 4 3 2 7 8\\r\\n'], 'output': ['2 6\\r\\n']}, {'input': ['4\\r\\n2 3 4 1\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['4\\r\\n1 2 3 4\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['8\\r\\n1 3 2 4 6 5 7 8\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['8\\r\\n1 3 4 2 6 5 7 8\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['149\\r\\n9 120 122 97 93 70 85 56 102 16 103 112 88 84 118 135 113 62 65 19 89 15 108 73 82 21 147 27 115 130 136 6 1 90 29 94 149 17 53 132 99 123 64 95 71 67 141 126 59 8 10 114 121 134 107 87 128 79 66 55 72 39 31 111 60 137 2 4 23 129 133 47 12 54 100 77 98 30 86 125 11 5 45 148 57 49 91 28 74 18 140 3 144 78 142 101 110 131 127 20 63 139 96 32 80 50 52 69 75 76 119 26 33 109 48 116 117 35 44 83 124 68 7 14 51 40 41 104 22 105 42 38 46 37 61 146 13 106 43 36 25 143 92 138 24 81 145 34 58\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['35\\r\\n7 33 34 15 16 24 5 27 1 19 17 22 29 3 4 23 31 11 21 35 32 2 12 20 8 9 6 28 18 26 30 14 13 10 25\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['114\\r\\n26 20 11 61 28 89 49 42 103 74 99 71 19 67 111 85 92 13 31 18 47 91 23 95 40 29 79 2 109 70 33 82 90 5 21 77 45 41 15 86 35 46 58 87 83 62 43 9 66 3 106 14 73 107 17 22 110 104 4 100 32 52 54 55 112 96 97 44 98 75 94 80 72 69 59 57 60 108 65 30 64 78 16 10 53 84 27 6 76 7 93 114 37 105 8 113 68 1 102 24 63 39 34 51 101 25 12 48 81 36 88 56 38 50\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['133\\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 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 128 129 130 131 132 133\\r\\n'], 'output': ['85 127\\r\\n']}, {'input': ['4\\r\\n1 2 4 3\\r\\n'], 'output': ['3 4\\r\\n']}, {'input': ['4\\r\\n1 4 3 2\\r\\n'], 'output': ['2 4\\r\\n']}]","id":428} {"difficulty":1200,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"59_B","execute_outcome":"WRONG_ANSWER","source_code":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\nlet n = -1, arr = [];\r\n\r\nrl.on('line', (input) => {\r\n if (n == -1)\r\n n = parseInt(input);\r\n else {\r\n arr = input.split(' ').map(it => parseInt(it));\r\n let sum = 0, minOdd = 101;\r\n arr.forEach(lm => {\r\n if (lm % 2 != 0 && lm < minOdd)\r\n minOdd = lm;\r\n sum += lm;\r\n });\r\n if (n == 1 && sum % 2 != 0)\r\n console.log(sum);\r\n else if (n == 1)\r\n console.log(0);\r\n else if (sum % 2 == 0)\r\n console.log(sum - minOdd)\r\n else\r\n console.log(sum)\r\n\r\n rl.close()\r\n }\r\n})\r\n","description":"Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several camomiles and tears off the petals one by one. After each petal she pronounces alternatively \"Loves\" and \"Doesn't love\", at that Marina always starts with \"Loves\". There are n camomiles growing in the field, possessing the numbers of petals equal to a1,a2,... an. Marina wants to pick a bouquet with the maximal possible total number of petals so that the result would still be \"Loves\". Help her do that; find the maximal number of petals possible in the bouquet.","input_specification":"The first line contains an integer n (1\u2264n\u2264100), which is the number of flowers growing in the field. The second line contains n integers ai (1\u2264ai\u2264100) which represent the number of petals on a given i-th camomile.\n","output_specification":"Print a single number which is the maximal number of petals in the bouquet, the fortune telling on which would result in \"Loves\". If there are no such bouquet, print 0 instead. The bouquet may consist of a single flower.\n","notes":null,"sample_inputs":["1\n1\n","1\n2\n","3\n5 6 7\n"],"sample_outputs":["1\n","0\n","13\n"],"human_solution":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\n\r\nconst rl = readline.createInterface({ input, output });\r\n\r\n\r\nlet n = -1, cont = []\r\n\r\n\r\nrl.on('line', (input) => {\r\n if (n == -1)\r\n n = parseInt(input);\r\n\r\n else {\r\n cont = input.split(' ').map(it => parseInt(it));\r\n let minOdd = 101, sum = 0\r\n cont.forEach(it => {\r\n if (it % 2 != 0 && minOdd > it)\r\n minOdd = it\r\n sum += it\r\n });\r\n\r\n if (n == 1)\r\n console.log((sum % 2 != 0) ? sum : 0)\r\n else if (sum % 2 == 0 && minOdd != 101)\r\n console.log(sum - minOdd)\r\n else if (sum % 2 == 0)\r\n console.log(0)\r\n else\r\n console.log(sum)\r\n\r\n rl.close()\r\n }\r\n\r\n});","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n5 6 7\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['2\\r\\n5 7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4\\r\\n4 3 1 2\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10\\r\\n90 72 76 60 22 87 5 67 17 65\\r\\n'], 'output': ['561\\r\\n']}, {'input': ['10\\r\\n18 42 20 68 88 10 87 37 55 51\\r\\n'], 'output': ['439\\r\\n']}, {'input': ['100\\r\\n25 43 35 79 53 13 91 91 45 65 83 57 9 41 39 85 45 71 51 61 59 31 13 63 39 25 21 79 39 91 67 21 61 97 75 93 83 29 79 59 97 11 37 63 51 39 55 91 23 21 17 47 23 35 75 49 5 69 99 5 7 41 17 25 89 15 79 21 63 53 81 43 91 59 91 69 99 85 15 91 51 49 37 65 7 89 81 21 93 61 63 97 93 45 17 13 69 57 25 75\\r\\n'], 'output': ['5355\\r\\n']}, {'input': ['100\\r\\n22 93 43 39 5 39 55 89 97 7 35 63 75 85 97 75 35 91 5 29 97 69 23 97 95 59 23 81 87 67 85 95 33 41 57 9 39 25 55 9 87 57 69 31 23 27 13 81 51 11 61 35 69 59 51 33 73 29 77 75 9 15 41 93 65 89 69 37 51 11 57 21 97 95 13 67 23 69 3 29 83 97 7 49 13 51 65 33 99 9 27 99 55 47 37 11 37 13 91 79\\r\\n'], 'output': ['5193\\r\\n']}, {'input': ['100\\r\\n82 6 42 34 4 32 12 50 16 58 48 92 44 94 36 94 96 50 68 38 78 10 18 88 38 66 60 72 76 24 60 62 86 8 16 14 74 54 38 100 88 28 44 78 90 42 20 24 90 21 81 29 53 95 75 5 57 31 37 69 55 65 1 67 61 71 17 99 15 15 67 77 19 95 79 87 29 97 13 95 61 91 45 77 91 79 55 81 37 81 15 89 67 61 19 25 97 53 7 95\\r\\n'], 'output': ['5445\\r\\n']}, {'input': ['100\\r\\n64 16 64 48 12 88 18 38 12 14 90 82 68 40 90 78 66 50 56 50 78 12 18 100 14 92 70 96 90 26 60 94 88 26 70 100 34 86 8 38 72 24 32 80 56 28 32 48 92 52 71 43 95 23 71 89 51 93 61 39 75 3 19 79 71 11 33 21 61 29 13 55 61 23 17 45 93 11 15 29 45 91 43 9 41 37 99 67 25 33 83 55 59 85 59 41 67 67 37 17\\r\\n'], 'output': ['5217\\r\\n']}, {'input': ['100\\r\\n12 84 30 14 36 18 4 82 26 22 10 88 96 84 50 100 88 40 70 94 94 58 16 50 80 38 94 100 34 20 22 54 34 58 92 18 6 8 22 92 82 28 42 54 96 8 18 40 64 90 58 63 97 89 17 11 21 55 71 91 47 93 55 95 39 81 51 7 77 13 25 65 51 47 47 49 19 35 67 5 7 65 65 65 79 33 71 15 17 91 13 43 81 31 7 17 17 93 9 25\\r\\n'], 'output': ['4945\\r\\n']}, {'input': ['100\\r\\n64 58 12 86 50 16 48 32 30 2 30 36 4 6 96 84 58 94 14 50 28 100 32 84 54 76 26 100 42 100 76 32 86 72 84 16 36 10 26 82 54 64 78 66 62 30 4 80 28 16 44 82 8 2 24 56 28 98 20 92 30 10 28 32 44 18 58 2 12 64 14 4 12 84 16 14 8 78 94 98 34 16 28 76 82 50 40 78 28 16 60 58 64 68 56 46 24 72 72 69\\r\\n'], 'output': ['4725\\r\\n']}, {'input': ['100\\r\\n92 46 50 24 68 60 70 30 52 22 18 74 68 98 20 82 4 46 26 68 100 78 84 58 74 98 38 88 68 86 64 80 82 100 20 22 98 98 52 6 94 10 48 68 2 18 38 22 22 82 44 20 66 72 36 58 64 6 36 60 4 96 76 64 12 90 10 58 64 60 74 28 90 26 24 60 40 58 2 16 76 48 58 36 82 60 24 44 4 78 28 38 8 12 40 16 38 6 66 24\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['99\\r\\n49 37 55 57 97 79 53 25 89 13 15 77 91 51 73 39 29 83 13 43 79 15 89 97 67 25 23 77 71 41 15 83 39 13 43 1 51 49 1 11 95 57 65 7 79 43 51 33 33 71 97 73 3 65 73 55 21 7 37 75 39 9 21 47 31 97 33 11 61 79 67 63 81 21 77 57 73 19 21 47 55 11 37 31 71 5 15 73 23 93 83 25 37 17 23 75 77 97 93\\r\\n'], 'output': ['4893\\r\\n']}, {'input': ['99\\r\\n26 77 13 25 33 67 89 57 49 35 7 15 17 5 1 73 53 19 35 83 31 49 51 1 25 23 3 63 19 9 53 25 65 43 27 71 3 95 77 89 95 85 67 27 93 3 11 45 99 31 21 35 83 31 43 93 75 93 3 51 11 29 73 3 33 63 57 71 43 15 69 55 53 7 13 73 7 5 57 61 97 53 13 39 79 19 35 71 27 97 19 57 39 51 89 63 21 47 53\\r\\n'], 'output': ['4451\\r\\n']}, {'input': ['99\\r\\n50 22 22 94 100 18 74 2 98 16 66 54 14 90 38 26 12 30 32 66 26 54 44 36 52 30 54 56 36 16 16 34 22 40 64 94 18 2 40 42 76 56 24 18 36 64 14 96 50 69 53 9 27 61 81 37 29 1 21 79 17 81 41 23 89 29 47 65 17 11 95 21 19 71 1 73 45 25 19 83 93 27 21 31 25 3 91 89 59 35 35 7 9 1 97 55 25 65 93\\r\\n'], 'output': ['4333\\r\\n']}, {'input': ['99\\r\\n86 16 38 20 68 60 84 16 28 88 60 48 80 28 4 92 70 60 46 46 20 34 12 100 76 2 40 10 8 86 6 80 50 66 12 34 14 28 26 70 46 64 34 96 10 90 98 96 56 88 49 73 69 93 1 93 23 65 67 45 21 29 5 9 63 31 87 13 97 99 63 57 49 17 49 49 7 37 7 15 53 1 59 53 61 83 91 97 3 71 65 25 13 87 99 15 9 5 87\\r\\n'], 'output': ['4849\\r\\n']}, {'input': ['99\\r\\n82 36 50 30 80 2 48 48 92 10 70 46 72 46 4 60 60 40 4 78 98 8 88 82 70 44 76 50 64 48 82 74 50 100 98 8 60 72 26 50 94 54 58 20 10 66 20 72 26 20 22 29 21 17 31 69 75 91 77 93 81 71 93 91 65 37 41 69 19 15 67 79 39 9 53 69 73 93 85 45 51 5 73 87 49 95 35 71 1 3 65 81 61 59 73 89 79 73 25\\r\\n'], 'output': ['5439\\r\\n']}, {'input': ['99\\r\\n28 50 100 90 56 60 54 16 54 62 48 6 2 14 40 48 28 48 58 68 90 74 82 2 98 4 74 64 34 98 94 24 44 74 50 18 40 100 80 96 10 42 66 46 26 26 84 34 68 84 74 48 8 90 2 36 40 32 18 76 90 64 38 92 86 84 56 84 74 90 4 2 50 34 18 28 30 2 18 80 52 34 10 86 96 76 30 64 88 76 74 4 50 22 20 96 90 12 42\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['99\\r\\n58 100 2 54 80 84 74 46 92 74 90 4 92 92 18 88 100 80 42 34 80 62 92 94 8 48 98 44 4 74 48 22 26 90 98 44 14 54 80 24 60 50 58 62 94 18 20 4 56 58 52 80 88 82 10 40 36 46 14 22 54 10 36 10 20 76 48 98 2 68 26 96 16 92 50 78 28 8 80 84 82 26 62 20 60 84 2 80 70 98 50 30 64 6 92 58 16 88 27\\r\\n'], 'output': ['5353\\r\\n']}, {'input': ['42\\r\\n26 24 14 18 96 30 56 72 10 32 94 62 68 11 75 45 39 49 37 29 9 1 63 47 81 67 79 81 93 31 69 61 73 67 81 7 37 87 61 17 21 65\\r\\n'], 'output': ['2085\\r\\n']}, {'input': ['42\\r\\n62 46 24 100 68 48 6 4 16 60 48 52 26 56 52 20 100 14 72 80 72 52 76 15 17 23 1 91 71 39 93 5 93 47 59 77 37 17 33 51 39 85\\r\\n'], 'output': ['2047\\r\\n']}, {'input': ['50\\r\\n88 68 16 44 72 6 2 50 2 36 26 98 16 30 6 10 88 76 50 90 44 28 84 28 100 57 59 91 51 37 19 79 69 79 95 81 75 89 19 87 31 49 77 35 79 7 85 41 83 91\\r\\n'], 'output': ['2723\\r\\n']}, {'input': ['1\\r\\n31\\r\\n'], 'output': ['31\\r\\n']}, {'input': ['1\\r\\n44\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n21 63\\r\\n'], 'output': ['63\\r\\n']}, {'input': ['2\\r\\n90 95\\r\\n'], 'output': ['185\\r\\n']}, {'input': ['2\\r\\n54 28\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n68 96 32 50 55 67 27 93 81 77\\r\\n'], 'output': ['619\\r\\n']}, {'input': ['5\\r\\n36 56 38 6 28\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n34 72 80 5 47 9\\r\\n'], 'output': ['247\\r\\n']}, {'input': ['100\\r\\n99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99\\r\\n'], 'output': ['9801\\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': ['0\\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 99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 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': ['9999\\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 99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 99 100 100 100 100 100\\r\\n'], 'output': ['9899\\r\\n']}, {'input': ['100\\r\\n100 100 100 100 100 100 100 100 100 1 100 100 100 100 100 100 100 100 100 100 100 1 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 3 100 100 100 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': ['9705\\r\\n']}, {'input': ['5\\r\\n6 6 6 6 6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n2 3 5 8\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['4\\r\\n2 4 6 8\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n2 3 5 4\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['3\\r\\n5 7 9\\r\\n'], 'output': ['21\\r\\n']}]","id":429} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"5ebfad36e56d30c58945c5800139b880","execute_outcome":"WRONG_ANSWER","source_code":"const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nconst arr = [];\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n arr.push(d.split(' ').map(Number));\n\n c++;\n});\n\nrl.on('close', () => {\n let ans = 0;\n\n for (let i = 0; i < arr.length; i++) {\n for (let j = 0; j < arr.length; j++) {\n ans += arr[i][j];\n }\n }\n\n if (arr.length > 3) {\n ans -= arr[0][1];\n ans -= arr[0][arr.length - 2];\n ans -= arr[arr.length - 1][1];\n ans -= arr[arr.length - 1][arr.length - 2];\n ans -= arr[1][0];\n ans -= arr[1][arr.length - 1];\n ans -= arr[arr.length - 2][0];\n ans -= arr[arr.length - 2][arr.length - 1];\n }\n\n console.log(ans);\n});\n","description":"The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n\u2009\u00d7\u2009n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: Elements of the main diagonal. Elements of the secondary diagonal. Elements of the \"middle\" row \u2014 the row which has exactly rows above it and the same number of rows below it. Elements of the \"middle\" column \u2014 the column that has exactly columns to the left of it and the same number of columns to the right of it. The figure shows a 5\u2009\u00d7\u20095 matrix. The good elements are marked with green. Help the Smart Beaver count the sum of good elements of the given matrix.","input_specification":"The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0\u2009\u2264\u2009aij\u2009\u2264\u2009100) separated by single spaces \u2014 the elements of the given matrix. The input limitations for getting 30 points are: 1\u2009\u2264\u2009n\u2009\u2264\u20095 The input limitations for getting 100 points are: 1\u2009\u2264\u2009n\u2009\u2264\u2009101 ","output_specification":"Print a single integer \u2014 the sum of good matrix elements.","notes":"NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure.","sample_inputs":["3\n1 2 3\n4 5 6\n7 8 9","5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1"],"sample_outputs":["45","17"],"human_solution":"const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nconst arr = [];\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n return;\n }\n\n arr.push(d.split(' ').map(Number));\n\n c++;\n});\n\nrl.on('close', () => {\n let ans = 0;\n let n = arr.length;\n\n for (let i = 0; i < arr.length; i++) {\n for (let j = 0; j < arr.length; j++) {\n if (i == j || i == Math.floor(n \/ 2) || j == Math.floor(n \/ 2) || i + j == n-1) {\n ans += arr[i][j];\n }\n }\n }\n\n console.log(ans);\n});\n","testcases":"[{'input': '3\\r\\n1 2 3\\r\\n4 5 6\\r\\n7 8 9\\r\\n', 'output': ['45']}, {'input': '5\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['17']}, {'input': '1\\r\\n3\\r\\n', 'output': ['3']}, {'input': '5\\r\\n27 7 3 11 72\\r\\n19 49 68 19 59\\r\\n41 25 37 64 65\\r\\n8 39 96 62 90\\r\\n13 37 43 26 33\\r\\n', 'output': ['756']}, {'input': '3\\r\\n19 7 16\\r\\n12 15 5\\r\\n15 15 5\\r\\n', 'output': ['109']}, {'input': '3\\r\\n36 4 33\\r\\n11 46 32\\r\\n20 49 34\\r\\n', 'output': ['265']}, {'input': '3\\r\\n79 91 74\\r\\n33 82 22\\r\\n18 28 54\\r\\n', 'output': ['481']}, {'input': '5\\r\\n7 0 8 1 7\\r\\n5 1 1 0 4\\r\\n4 2 8 1 6\\r\\n1 2 3 2 7\\r\\n6 0 1 9 6\\r\\n', 'output': ['65']}, {'input': '5\\r\\n27 20 28 11 17\\r\\n25 21 1 20 14\\r\\n14 22 28 1 6\\r\\n1 2 23 2 7\\r\\n6 0 1 29 6\\r\\n', 'output': ['225']}, {'input': '5\\r\\n57 50 58 41 17\\r\\n25 21 1 50 44\\r\\n44 22 28 31 36\\r\\n31 32 23 32 37\\r\\n6 0 31 59 6\\r\\n', 'output': ['495']}, {'input': '5\\r\\n57 80 28 41 47\\r\\n85 51 61 50 74\\r\\n44 82 28 31 36\\r\\n31 32 23 32 37\\r\\n66 60 31 59 6\\r\\n', 'output': ['705']}, {'input': '5\\r\\n13 58 10 17 43\\r\\n61 73 100 0 9\\r\\n52 38 16 22 96\\r\\n11 4 14 67 62\\r\\n70 89 7 98 83\\r\\n', 'output': ['708']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n0 0 0 0 0\\r\\n0 0 0 0 0\\r\\n0 0 0 0 0\\r\\n0 0 0 0 0\\r\\n', 'output': ['0']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n1 0 0 0 0\\r\\n0 0 0 0 0\\r\\n1 0 0 0 0\\r\\n0 0 0 0 0\\r\\n', 'output': ['0']}, {'input': '5\\r\\n0 1 0 1 0\\r\\n0 0 0 0 1\\r\\n0 0 5 0 0\\r\\n0 0 0 0 1\\r\\n0 0 0 0 0\\r\\n', 'output': ['5']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n0 1 0 0 0\\r\\n0 0 0 0 0\\r\\n0 1 0 0 0\\r\\n0 1 0 0 0\\r\\n', 'output': ['3']}, {'input': '3\\r\\n0 0 0\\r\\n0 0 0\\r\\n0 0 0\\r\\n', 'output': ['0']}, {'input': '11\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0']}, {'input': '101\\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 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 1...', 'output': ['40100']}, {'input': '21\\r\\n30 26 39 30 0 5 30 2 20 8 39 14 32 21 9 1 23 13 11 18 12\\r\\n20 12 22 18 10 14 1 15 27 24 17 32 34 4 17 14 9 13 13 1 28\\r\\n14 17 12 31 7 15 25 28 1 17 30 34 37 3 1 26 39 21 8 12 9\\r\\n32 4 2 5 38 39 35 10 39 3 27 4 16 37 0 29 31 26 24 0 37\\r\\n0 2 24 27 0 10 20 17 26 1 29 10 3 28 19 36 19 3 13 23 1\\r\\n37 32 11 35 10 10 15 32 25 24 31 9 36 20 22 15 32 27 28 6 9\\r\\n30 26 3 30 14 4 18 17 38 21 20 10 20 9 30 20 8 39 5 23 24\\r\\n39 17 16 11 35 31 38 36 15 12 22 18 5 30 18 6 5 29 13 36 3\\r\\n2 26 30 11 15 13 5 9 24 34 17 12 8 6 ...', 'output': ['1430']}, {'input': '31\\r\\n44 8 16 14 39 17 35 19 9 33 10 33 40 9 35 15 26 10 30 9 27 8 0 45 17 13 10 3 10 0 7\\r\\n41 29 21 14 11 39 12 14 3 41 13 22 49 19 46 3 37 7 16 15 18 45 36 0 13 11 4 19 31 40 10\\r\\n28 11 44 2 40 1 46 17 31 33 40 13 22 34 40 24 37 35 39 5 3 17 34 0 26 46 18 7 33 19 13\\r\\n18 45 26 13 26 45 16 27 19 44 46 4 19 5 36 40 33 40 47 38 43 12 32 12 33 49 37 28 29 20 19\\r\\n20 7 10 21 21 35 4 34 5 35 21 48 47 26 48 26 14 24 9 9 0 27 26 11 18 26 2 32 32 38 30\\r\\n11 5 40 32 33 15 41 37 33 2 0 9 40 6 4 20 32 4 35 16 23 30 3 39 48...', 'output': ['2799']}, {'input': '41\\r\\n7 50 28 33 31 26 52 55 5 49 1 14 43 55 41 56 52 43 47 39 20 58 46 45 14 39 38 30 25 25 19 22 50 26 25 7 9 2 18 19 18\\r\\n0 2 6 32 54 40 23 2 51 58 57 10 44 18 24 16 43 22 35 24 40 5 20 11 16 3 30 37 16 47 55 18 54 46 34 59 22 47 46 32 12\\r\\n41 52 40 8 53 21 30 25 56 44 41 55 43 50 6 47 17 7 34 48 37 12 4 39 5 46 31 50 58 42 31 14 57 20 48 6 25 29 40 7 30\\r\\n48 55 41 25 45 32 50 57 17 57 22 21 45 57 55 23 17 9 42 29 18 33 13 46 22 0 26 11 16 15 4 34 52 34 44 15 57 7 43 29 41\\r\\n44 26 59 28 23 54 28 47 4 18 39 27...', 'output': ['4847']}, {'input': '51\\r\\n6 38 56 42 19 15 57 57 64 36 8 8 1 7 32 69 61 64 11 60 5 47 43 12 1 48 42 17 1 58 65 62 36 6 16 60 59 14 50 9 38 12 69 48 48 14 62 26 47 7 27\\r\\n64 32 6 69 27 34 57 41 35 0 45 49 26 63 50 2 17 5 28 56 14 49 44 42 38 57 23 41 21 12 13 26 63 36 59 65 23 35 27 62 13 49 55 47 43 61 1 59 21 15 22\\r\\n32 19 10 3 67 43 34 3 12 46 47 43 31 21 15 15 15 67 19 68 32 67 4 55 47 35 63 40 69 13 62 44 35 8 38 1 16 45 65 24 23 15 4 61 33 68 43 55 40 55 68\\r\\n25 36 9 48 23 42 36 33 32 25 50 53 28 62 67 54 48 54 37 43 1 11 12 ...', 'output': ['6784']}, {'input': '61\\r\\n34 0 70 50 73 34 44 65 23 57 53 10 50 49 2 21 55 5 79 69 57 58 13 15 24 48 64 14 6 4 74 70 22 25 23 40 70 73 59 70 31 38 73 72 42 6 54 13 53 15 44 5 55 47 19 63 48 79 45 47 4\\r\\n72 49 3 57 71 28 53 63 29 2 19 32 42 42 46 24 27 59 0 7 18 17 49 20 5 37 43 68 25 12 29 28 32 31 13 3 32 75 2 59 7 41 0 1 44 33 37 67 56 74 52 51 36 69 16 73 4 11 59 13 21\\r\\n68 47 37 35 26 77 27 30 78 36 3 46 57 53 28 69 36 21 36 51 12 2 49 0 64 41 78 69 62 23 34 12 14 62 71 9 12 75 74 9 59 6 62 58 56 42 22 27 13 5 35 6 55 34 58 7...', 'output': ['9995']}, {'input': '71\\r\\n88 33 18 58 24 44 48 60 39 60 12 20 70 59 2 12 37 11 57 35 34 34 61 67 4 25 72 48 3 72 29 7 34 17 16 89 13 5 84 80 36 87 62 56 86 63 56 45 27 78 86 11 2 67 50 20 58 35 63 46 20 30 28 42 50 9 54 22 63 36 38\\r\\n81 83 75 65 72 11 43 30 28 19 37 78 70 8 21 0 6 40 66 40 50 16 46 85 78 28 81 75 48 16 6 58 35 32 3 83 31 61 64 70 43 39 21 68 41 15 84 72 27 13 68 81 30 78 75 75 53 14 74 12 89 51 58 15 60 10 62 20 11 77 47\\r\\n52 27 71 43 68 60 77 22 45 19 57 28 53 0 80 9 43 4 52 54 54 41 74 39 48 29 22 14 88 48 85 5...', 'output': ['12576']}, {'input': '81\\r\\n78 19 98 68 62 12 38 99 40 25 39 35 10 50 74 15 37 67 56 60 78 47 75 30 35 96 18 77 64 2 28 29 66 9 4 42 59 64 8 20 15 51 56 97 95 29 22 25 16 71 20 57 87 55 36 5 30 84 26 87 81 92 46 99 97 44 20 91 81 61 1 42 72 39 72 49 22 62 65 3 70\\r\\n90 29 54 59 87 27 88 62 65 45 15 99 22 57 3 76 2 65 53 42 46 8 81 53 20 52 91 6 25 1 11 3 32 48 11 3 39 12 49 22 52 67 37 11 34 48 6 9 55 19 11 11 3 34 89 35 14 50 43 52 35 42 43 90 31 72 39 47 52 67 51 76 44 16 13 65 16 19 0 41 64\\r\\n54 1 44 26 26 10 70 38 57 6 48 48 74 ...', 'output': ['15873']}, {'input': '91\\r\\n39 94 2 30 62 12 44 19 52 30 81 73 57 34 67 32 83 18 69 61 57 85 45 65 39 28 59 16 75 84 9 25 20 0 94 49 49 3 46 73 81 79 12 83 69 85 16 86 35 92 14 77 64 62 43 51 8 23 51 18 28 34 42 15 22 27 26 51 73 42 100 14 11 85 24 15 19 77 87 3 4 29 81 95 100 1 52 88 27 53 39\\r\\n83 88 10 74 16 22 4 12 55 61 88 16 84 18 9 9 88 52 34 84 47 87 80 23 60 15 46 24 52 83 73 51 49 93 55 44 77 54 66 95 88 0 36 7 55 79 74 20 71 63 62 94 97 28 61 13 53 32 45 66 27 12 23 17 35 99 48 74 36 29 57 44 30 3 64 0 2 32 68 9 32 20 56...', 'output': ['17862']}, {'input': '13\\r\\n58 80 65 83 1 10 57 49 21 81 41 97 43\\r\\n34 3 74 62 43 59 4 10 63 29 54 44 10\\r\\n66 6 39 73 37 8 95 18 43 25 14 74 0\\r\\n88 46 100 77 25 66 100 30 96 84 75 100 86\\r\\n5 98 5 62 89 16 71 97 81 22 76 80 51\\r\\n85 44 80 54 83 41 83 93 47 14 48 75 10\\r\\n20 22 16 99 57 49 44 69 98 40 69 34 66\\r\\n89 72 66 82 20 35 43 84 61 95 31 66 96\\r\\n22 3 55 3 23 41 40 97 55 56 87 21 98\\r\\n75 84 97 99 98 14 75 43 50 66 46 83 36\\r\\n67 46 78 68 74 30 52 55 31 68 82 3 48\\r\\n36 46 12 99 69 19 62 81 49 75 43 59 71\\r\\n45 91 47 15 59 69 13 3 19 35 70 13 ...', 'output': ['2791']}, {'input': '15\\r\\n0 2 1 2 1 0 2 0 2 2 2 2 2 0 2\\r\\n2 0 1 0 1 1 2 2 0 2 2 0 3 0 1\\r\\n3 3 2 2 2 1 2 3 2 3 1 2 3 3 2\\r\\n0 3 0 3 3 3 2 1 0 2 3 2 3 3 2\\r\\n3 0 0 2 1 2 3 1 1 1 2 2 2 1 0\\r\\n1 3 2 3 3 0 3 2 0 3 1 2 3 0 3\\r\\n2 2 3 2 0 0 2 3 0 1 2 1 1 2 1\\r\\n2 1 3 2 3 3 2 2 2 0 3 3 1 1 3\\r\\n0 2 1 3 1 2 0 0 1 0 0 2 0 0 0\\r\\n3 1 2 1 2 3 2 3 2 1 0 2 2 0 3\\r\\n0 0 1 3 3 0 1 1 0 0 2 3 0 3 0\\r\\n2 3 0 3 1 1 2 2 1 3 2 3 0 0 2\\r\\n3 0 2 2 3 3 0 2 2 2 0 1 0 0 3\\r\\n2 2 2 1 2 2 2 0 2 2 2 2 0 2 3\\r\\n2 2 3 0 0 0 0 2 1 1 1 3 2 2 0\\r\\n', 'output': ['97']}, {'input': '15\\r\\n19 46 78 15 39 5 100 4 70 73 94 27 58 30 70\\r\\n73 79 100 20 10 74 97 89 41 2 98 17 55 91 23\\r\\n35 63 10 47 50 46 42 59 97 19 12 68 78 33 38\\r\\n61 32 79 78 55 55 67 36 75 27 40 78 20 85 50\\r\\n36 25 92 80 96 67 64 88 69 99 77 84 73 25 44\\r\\n80 62 51 65 46 82 42 65 61 33 23 82 25 42 10\\r\\n42 78 20 10 26 72 30 55 4 16 76 87 20 46 43\\r\\n36 14 37 63 9 89 28 47 63 59 64 20 3 53 72\\r\\n23 36 49 50 75 58 64 4 25 98 39 60 70 73 80\\r\\n77 1 74 66 19 32 58 51 71 73 30 79 29 64 53\\r\\n43 45 71 20 15 70 97 81 43 9 38 52 77 71 42\\r\\n25 83 58...', 'output': ['2834']}, {'input': '99\\r\\n21 78 61 45 70 38 37 11 13 78 49 73 76 33 55 4 95 33 87 23 26 58 83 48 40 81 42 11 94 5 44 93 94 80 58 47 21 12 44 31 90 88 81 1 40 50 3 2 93 77 48 34 64 13 37 67 28 74 73 79 12 92 79 12 95 33 21 88 61 17 11 82 54 47 57 80 0 32 10 17 42 75 36 44 44 80 60 50 44 68 63 80 81 100 53 37 19 98 74\\r\\n28 42 28 32 83 53 4 43 81 40 77 95 59 60 77 22 48 82 18 5 65 2 47 60 30 52 80 47 41 67 5 7 94 85 91 59 38 80 27 62 62 80 13 90 87 62 52 17 74 60 32 1 19 95 47 97 33 91 61 29 9 77 100 83 72 6 7 22 65 34 100 66 13 23...', 'output': ['19845']}, {'input': '101\\r\\n18 16 14 15 27 68 40 46 74 41 18 97 15 89 91 46 20 3 97 16 26 30 89 9 13 91 61 72 55 54 5 59 61 21 77 0 2 85 17 58 91 40 20 33 66 8 91 77 76 44 49 91 56 60 10 97 88 71 56 92 99 11 60 47 4 47 37 8 64 63 76 28 17 54 93 41 9 76 42 45 6 88 7 12 4 52 79 58 22 99 29 27 28 23 84 55 9 21 23 15 37\\r\\n39 38 9 3 77 43 28 63 50 6 27 28 33 72 27 15 61 11 19 45 81 38 28 14 15 42 0 31 24 75 15 24 84 56 84 66 77 57 14 12 9 85 93 99 34 47 57 22 17 40 21 6 52 19 85 49 83 49 27 84 32 28 86 30 40 65 72 40 25 92 47 92 88 4 ...', 'output': ['20055']}, {'input': '97\\r\\n27 78 81 22 67 32 27 89 20 75 30 31 61 70 56 6 77 77 25 96 63 81 23 27 48 93 59 96 7 65 58 27 68 19 52 94 95 84 81 0 23 7 14 71 79 21 1 19 21 73 94 31 66 36 26 44 39 70 49 35 56 22 74 12 16 51 69 91 12 1 98 46 40 69 62 49 24 26 66 27 10 65 28 67 55 14 76 65 38 80 99 23 43 44 75 53 93\\r\\n96 41 29 71 5 11 100 32 72 84 46 0 9 81 28 79 70 50 73 60 89 47 91 89 76 47 55 54 5 83 49 91 56 48 45 60 54 53 59 29 8 94 9 28 72 88 7 69 66 14 24 15 42 73 91 31 13 40 23 72 38 79 83 98 16 53 15 50 96 77 100 34 78 39 51 3...', 'output': ['19356']}, {'input': '11\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0\\r\\n0 0 0 0 0 0 0 0 0 0 0...', 'output': ['0']}, {'input': '101\\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 10...', 'output': ['40100']}, {'input': '21\\r\\n30 26 39 30 0 5 30 2 20 8 39 14 32 21 9 1 23 13 11 18 12\\r\\n20 12 22 18 10 14 1 15 27 24 17 32 34 4 17 14 9 13 13 1 28\\r\\n14 17 12 31 7 15 25 28 1 17 30 34 37 3 1 26 39 21 8 12 9\\r\\n32 4 2 5 38 39 35 10 39 3 27 4 16 37 0 29 31 26 24 0 37\\r\\n0 2 24 27 0 10 20 ...', 'output': ['1430']}, {'input': '31\\r\\n44 8 16 14 39 17 35 19 9 33 10 33 40 9 35 15 26 10 30 9 27 8 0 45 17 13 10 3 10 0 7\\r\\n41 29 21 14 11 39 12 14 3 41 13 22 49 19 46 3 37 7 16 15 18 45 36 0 13 11 4 19 31 40 10\\r\\n28 11 44 2 40 1 46 17 31 33 40 13 22 34 40 24 37 35 39 5 3 17 34 0 26 46 18 7...', 'output': ['2799']}, {'input': '41\\r\\n7 50 28 33 31 26 52 55 5 49 1 14 43 55 41 56 52 43 47 39 20 58 46 45 14 39 38 30 25 25 19 22 50 26 25 7 9 2 18 19 18\\r\\n0 2 6 32 54 40 23 2 51 58 57 10 44 18 24 16 43 22 35 24 40 5 20 11 16 3 30 37 16 47 55 18 54 46 34 59 22 47 46 32 12\\r\\n41 52 40 8 53 2...', 'output': ['4847']}, {'input': '51\\r\\n6 38 56 42 19 15 57 57 64 36 8 8 1 7 32 69 61 64 11 60 5 47 43 12 1 48 42 17 1 58 65 62 36 6 16 60 59 14 50 9 38 12 69 48 48 14 62 26 47 7 27\\r\\n64 32 6 69 27 34 57 41 35 0 45 49 26 63 50 2 17 5 28 56 14 49 44 42 38 57 23 41 21 12 13 26 63 36 59 65 23 3...', 'output': ['6784']}, {'input': '61\\r\\n34 0 70 50 73 34 44 65 23 57 53 10 50 49 2 21 55 5 79 69 57 58 13 15 24 48 64 14 6 4 74 70 22 25 23 40 70 73 59 70 31 38 73 72 42 6 54 13 53 15 44 5 55 47 19 63 48 79 45 47 4\\r\\n72 49 3 57 71 28 53 63 29 2 19 32 42 42 46 24 27 59 0 7 18 17 49 20 5 37 43...', 'output': ['9995']}, {'input': '71\\r\\n88 33 18 58 24 44 48 60 39 60 12 20 70 59 2 12 37 11 57 35 34 34 61 67 4 25 72 48 3 72 29 7 34 17 16 89 13 5 84 80 36 87 62 56 86 63 56 45 27 78 86 11 2 67 50 20 58 35 63 46 20 30 28 42 50 9 54 22 63 36 38\\r\\n81 83 75 65 72 11 43 30 28 19 37 78 70 8 21 ...', 'output': ['12576']}, {'input': '81\\r\\n78 19 98 68 62 12 38 99 40 25 39 35 10 50 74 15 37 67 56 60 78 47 75 30 35 96 18 77 64 2 28 29 66 9 4 42 59 64 8 20 15 51 56 97 95 29 22 25 16 71 20 57 87 55 36 5 30 84 26 87 81 92 46 99 97 44 20 91 81 61 1 42 72 39 72 49 22 62 65 3 70\\r\\n90 29 54 59 87...', 'output': ['15873']}, {'input': '91\\r\\n39 94 2 30 62 12 44 19 52 30 81 73 57 34 67 32 83 18 69 61 57 85 45 65 39 28 59 16 75 84 9 25 20 0 94 49 49 3 46 73 81 79 12 83 69 85 16 86 35 92 14 77 64 62 43 51 8 23 51 18 28 34 42 15 22 27 26 51 73 42 100 14 11 85 24 15 19 77 87 3 4 29 81 95 100 1...', 'output': ['17862']}, {'input': '13\\r\\n58 80 65 83 1 10 57 49 21 81 41 97 43\\r\\n34 3 74 62 43 59 4 10 63 29 54 44 10\\r\\n66 6 39 73 37 8 95 18 43 25 14 74 0\\r\\n88 46 100 77 25 66 100 30 96 84 75 100 86\\r\\n5 98 5 62 89 16 71 97 81 22 76 80 51\\r\\n85 44 80 54 83 41 83 93 47 14 48 75 10\\r\\n20 22 16 99 57 4...', 'output': ['2791']}, {'input': '15\\r\\n0 2 1 2 1 0 2 0 2 2 2 2 2 0 2\\r\\n2 0 1 0 1 1 2 2 0 2 2 0 3 0 1\\r\\n3 3 2 2 2 1 2 3 2 3 1 2 3 3 2\\r\\n0 3 0 3 3 3 2 1 0 2 3 2 3 3 2\\r\\n3 0 0 2 1 2 3 1 1 1 2 2 2 1 0\\r\\n1 3 2 3 3 0 3 2 0 3 1 2 3 0 3\\r\\n2 2 3 2 0 0 2 3 0 1 2 1 1 2 1\\r\\n2 1 3 2 3 3 2 2 2 0 3 3 1 1 3\\r\\n0 2...', 'output': ['97']}, {'input': '15\\r\\n19 46 78 15 39 5 100 4 70 73 94 27 58 30 70\\r\\n73 79 100 20 10 74 97 89 41 2 98 17 55 91 23\\r\\n35 63 10 47 50 46 42 59 97 19 12 68 78 33 38\\r\\n61 32 79 78 55 55 67 36 75 27 40 78 20 85 50\\r\\n36 25 92 80 96 67 64 88 69 99 77 84 73 25 44\\r\\n80 62 51 65 46 82 42 6...', 'output': ['2834']}, {'input': '99\\r\\n21 78 61 45 70 38 37 11 13 78 49 73 76 33 55 4 95 33 87 23 26 58 83 48 40 81 42 11 94 5 44 93 94 80 58 47 21 12 44 31 90 88 81 1 40 50 3 2 93 77 48 34 64 13 37 67 28 74 73 79 12 92 79 12 95 33 21 88 61 17 11 82 54 47 57 80 0 32 10 17 42 75 36 44 44 80...', 'output': ['19845']}, {'input': '101\\r\\n18 16 14 15 27 68 40 46 74 41 18 97 15 89 91 46 20 3 97 16 26 30 89 9 13 91 61 72 55 54 5 59 61 21 77 0 2 85 17 58 91 40 20 33 66 8 91 77 76 44 49 91 56 60 10 97 88 71 56 92 99 11 60 47 4 47 37 8 64 63 76 28 17 54 93 41 9 76 42 45 6 88 7 12 4 52 79 5...', 'output': ['20055']}, {'input': '97\\r\\n27 78 81 22 67 32 27 89 20 75 30 31 61 70 56 6 77 77 25 96 63 81 23 27 48 93 59 96 7 65 58 27 68 19 52 94 95 84 81 0 23 7 14 71 79 21 1 19 21 73 94 31 66 36 26 44 39 70 49 35 56 22 74 12 16 51 69 91 12 1 98 46 40 69 62 49 24 26 66 27 10 65 28 67 55 14...', 'output': ['19356']}]","id":430} {"difficulty":900,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"63_A","execute_outcome":"RUNTIME_ERROR","source_code":"const prompt = require('prompt-sync')();\r\n\r\nfunction sort(members) {\r\n var rats = []\r\n var womanChildren = []\r\n var men = []\r\n var captain = []\r\n for (const member of members) {\r\n if (member.status == \"rat\")\r\n rats.push(member.name)\r\n if (member.status == \"woman\" || member.status == \"child\")\r\n womanChildren.push(member.name)\r\n if (member.status == \"man\")\r\n men.push(member.name)\r\n if (member.status == \"captain\")\r\n captain.push(member.name)\r\n }\r\n const out = [...rats, ...womanChildren, ...men, ...captain]\r\n return out\r\n}\r\n\r\nfunction sinking_ship() {\r\n var members = []\r\n var number = parseInt(prompt())\r\n for (let i = 0; i < number; i++) {\r\n const line = prompt()\r\n const words = line.split(\" \")\r\n members.push({\r\n name: words[0],\r\n status: words[1]\r\n })\r\n }\r\n const result = sort(members)\r\n for (const res of result) {\r\n console.log(res);\r\n }\r\n}\r\n\r\n\r\nconst final = sinking_ship()","description":"The ship crashed into a reef and is sinking. Now the entire crew must be evacuated. All n crew members have already lined up in a row (for convenience let's label them all from left to right with positive integers from 1 to n) and await further instructions. However, one should evacuate the crew properly, in a strict order. Specifically:The first crew members to leave the ship are rats. Then women and children (both groups have the same priority) leave the ship. After that all men are evacuated from the ship. The captain leaves the sinking ship last.If we cannot determine exactly who should leave the ship first for any two members of the crew by the rules from the previous paragraph, then the one who stands to the left in the line leaves the ship first (or in other words, the one whose number in the line is less).For each crew member we know his status as a crew member, and also his name. All crew members have different names. Determine the order in which to evacuate the crew.","input_specification":"The first line contains an integer n, which is the number of people in the crew (1\u2264n\u2264100). Then follow n lines. The i-th of those lines contains two words \u2014 the name of the crew member who is i-th in line, and his status on the ship. The words are separated by exactly one space. There are no other spaces in the line. The names consist of Latin letters, the first letter is uppercase, the rest are lowercase. The length of any name is from 1 to 10 characters. The status can have the following values: rat for a rat, woman for a woman, child for a child, man for a man, captain for the captain. The crew contains exactly one captain.\n","output_specification":"Print n lines. The i-th of them should contain the name of the crew member who must be the i-th one to leave the ship.\n","notes":null,"sample_inputs":["6\nJack captain\nAlice woman\nCharlie man\nTeddy rat\nBob child\nJulia woman\n"],"sample_outputs":["Teddy\nAlice\nBob\nJulia\nCharlie\nJack\n"],"human_solution":"const readline = require('readline');\r\nconst { stdin: input, stdout: output } = require('process');\r\nconst rl = readline.createInterface({ input, output });\r\n\r\n\r\nclass Info {\r\n constructor(rowNum, name, identity) {\r\n this.rowNum = rowNum;\r\n this.name = name;\r\n this.identity = identity;\r\n }\r\n};\r\n\r\nlet i = 0, cont = [];\r\n\r\nrl.on('line', (input) => {\r\n if (i === 0)\r\n i++;\r\n else {\r\n let spaceInd = input.indexOf(' ');\r\n let name = input.substring(0, spaceInd);\r\n let identity = input.substring(spaceInd + 1);\r\n cont.push(new Info(i, name, identity));\r\n i++;\r\n }\r\n\r\n\r\n\r\n}).on('close', () => {\r\n cont.sort((obj1, obj2) => {\r\n if (obj1.identity == 'rat' && obj2.identity != 'rat')\r\n return -1;\r\n\r\n if (obj1.identity != 'rat' && obj2.identity == 'rat')\r\n return 1;\r\n\r\n \/\/woman and children\r\n if ((obj1.identity == 'woman' || obj1.identity == 'child') && (obj2.identity != 'woman' && obj2.identity != 'child'))\r\n return -1;\r\n\r\n if ((obj1.identity != 'woman' && obj1.identity != 'child') && (obj2.identity == 'woman' || obj2.identity == 'child'))\r\n return 1;\r\n\r\n if (obj1.identity == 'man' && obj2.identity != 'man')\r\n return -1;\r\n\r\n if (obj1.identity != 'man' && obj2.identity == 'man')\r\n return 1;\r\n\r\n return obj1.rowNums - obj2.rowNums;\r\n })\r\n\r\n for (let obj of cont) {\r\n console.log(obj.name);\r\n }\r\n\r\n})","testcases":"[{'input': ['6\\r\\nJack captain\\r\\nAlice woman\\r\\nCharlie man\\r\\nTeddy rat\\r\\nBob child\\r\\nJulia woman\\r\\n'], 'output': ['Teddy\\r\\nAlice\\r\\nBob\\r\\nJulia\\r\\nCharlie\\r\\nJack\\r\\n']}, {'input': ['1\\r\\nA captain\\r\\n'], 'output': ['A\\r\\n']}, {'input': ['1\\r\\nAbcdefjhij captain\\r\\n'], 'output': ['Abcdefjhij\\r\\n']}, {'input': ['5\\r\\nA captain\\r\\nB man\\r\\nD woman\\r\\nC child\\r\\nE rat\\r\\n'], 'output': ['E\\r\\nD\\r\\nC\\r\\nB\\r\\nA\\r\\n']}, {'input': ['10\\r\\nCap captain\\r\\nD child\\r\\nC woman\\r\\nA woman\\r\\nE child\\r\\nMan man\\r\\nB child\\r\\nF woman\\r\\nRat rat\\r\\nRatt rat\\r\\n'], 'output': ['Rat\\r\\nRatt\\r\\nD\\r\\nC\\r\\nA\\r\\nE\\r\\nB\\r\\nF\\r\\nMan\\r\\nCap\\r\\n']}, {'input': ['5\\r\\nJoyxnkypf captain\\r\\nDxssgr woman\\r\\nKeojmnpd rat\\r\\nGdv man\\r\\nHnw man\\r\\n'], 'output': ['Keojmnpd\\r\\nDxssgr\\r\\nGdv\\r\\nHnw\\r\\nJoyxnkypf\\r\\n']}, {'input': ['11\\r\\nJue rat\\r\\nWyglbyphk rat\\r\\nGjlgu child\\r\\nGi man\\r\\nAttx rat\\r\\nTheorpkgx man\\r\\nYm rat\\r\\nX child\\r\\nB captain\\r\\nEnualf rat\\r\\nKktsgyuyv woman\\r\\n'], 'output': ['Jue\\r\\nWyglbyphk\\r\\nAttx\\r\\nYm\\r\\nEnualf\\r\\nGjlgu\\r\\nX\\r\\nKktsgyuyv\\r\\nGi\\r\\nTheorpkgx\\r\\nB\\r\\n']}, {'input': ['22\\r\\nWswwcvvm woman\\r\\nBtmfats rat\\r\\nI rat\\r\\nOcmtsnwx man\\r\\nUrcqv rat\\r\\nYghnogt woman\\r\\nWtyfc man\\r\\nWqle child\\r\\nUjfrelpu rat\\r\\nDstixj man\\r\\nAhksnio woman\\r\\nKhkvaap woman\\r\\nSjppvwm rat\\r\\nEgdmsv rat\\r\\nDank rat\\r\\nNquicjnw rat\\r\\nLh captain\\r\\nTdyaqaqln rat\\r\\nQtj rat\\r\\nTfgwijvq rat\\r\\nNbiso child\\r\\nNqthvbf woman\\r\\n'], 'output': ['Btmfats\\r\\nI\\r\\nUrcqv\\r\\nUjfrelpu\\r\\nSjppvwm\\r\\nEgdmsv\\r\\nDank\\r\\nNquicjnw\\r\\nTdyaqaqln\\r\\nQtj\\r\\nTfgwijvq\\r\\nWswwcvvm\\r\\nYghnogt\\r\\nWqle\\r\\nAhksnio\\r\\nKhkvaap\\r\\nNbiso\\r\\nNqthvbf\\r\\nOcmtsnwx\\r\\nWtyfc\\r\\nDstixj\\r\\nLh\\r\\n']}, {'input': ['36\\r\\nKqxmtwmsf child\\r\\nIze woman\\r\\nDlpr child\\r\\nK woman\\r\\nF captain\\r\\nRjwfeuhba rat\\r\\nBbv rat\\r\\nS rat\\r\\nMnmg woman\\r\\nSmzyx woman\\r\\nSr man\\r\\nQmhroracn rat\\r\\nSoqpuqock rat\\r\\nPibdq man\\r\\nIlrkrptx rat\\r\\nZaecfyqka man\\r\\nMmersfs child\\r\\nVvvocqi man\\r\\nHjeqxvq rat\\r\\nMpmb woman\\r\\nWmgu woman\\r\\nCerelmhoxi child\\r\\nA man\\r\\nDylv man\\r\\nXrdgmmtcpq woman\\r\\nXj woman\\r\\nCeh child\\r\\nOfccguo man\\r\\nNevr man\\r\\nAknkwdkq child\\r\\nBmo man\\r\\nLqo woman\\r\\nVej child\\r\\nT child\\r\\nRlijc man\\r\\nNsdtpdg woman\\r\\n'], 'output': ['Rjwfeuhba\\r\\nBbv\\r\\nS\\r\\nQmhroracn\\r\\nSoqpuqock\\r\\nIlrkrptx\\r\\nHjeqxvq\\r\\nKqxmtwmsf\\r\\nIze\\r\\nDlpr\\r\\nK\\r\\nMnmg\\r\\nSmzyx\\r\\nMmersfs\\r\\nMpmb\\r\\nWmgu\\r\\nCerelmhoxi\\r\\nXrdgmmtcpq\\r\\nXj\\r\\nCeh\\r\\nAknkwdkq\\r\\nLqo\\r\\nVej\\r\\nT\\r\\nNsdtpdg\\r\\nSr\\r\\nPibdq\\r\\nZaecfyqka\\r\\nVvvocqi\\r\\nA\\r\\nDylv\\r\\nOfccguo\\r\\nNevr\\r\\nBmo\\r\\nRlijc\\r\\nF\\r\\n']}, {'input': ['2\\r\\nA captain\\r\\nB man\\r\\n'], 'output': ['B\\r\\nA\\r\\n']}, {'input': ['2\\r\\nB woman\\r\\nA captain\\r\\n'], 'output': ['B\\r\\nA\\r\\n']}, {'input': ['2\\r\\nX child\\r\\nY captain\\r\\n'], 'output': ['X\\r\\nY\\r\\n']}, {'input': ['2\\r\\nX captain\\r\\nY rat\\r\\n'], 'output': ['Y\\r\\nX\\r\\n']}, {'input': ['6\\r\\nAbdelrhman captain\\r\\nAlice woman\\r\\nCharlie man\\r\\nTeddy rat\\r\\nBob child\\r\\nJulia woman\\r\\n'], 'output': ['Teddy\\r\\nAlice\\r\\nBob\\r\\nJulia\\r\\nCharlie\\r\\nAbdelrhman\\r\\n']}, {'input': ['4\\r\\nAratos captain\\r\\nMind child\\r\\nAman woman\\r\\nCarrot man\\r\\n'], 'output': ['Mind\\r\\nAman\\r\\nCarrot\\r\\nAratos\\r\\n']}]","id":431} {"difficulty":1200,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"63_B","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"const readline = require('readline').createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\nlet isFirstLine = false;\r\nlet number;\r\nlet maxRank;\r\nlet soldiers;\r\nlet coin = 0;\r\nreadline.on('line', line => {\r\n if (isFirstLine) {\r\n let firstLine = line.split(' ');\r\n number = firstLine[0];\r\n maxRank = firstLine[1]\r\n isFirstLine = false;\r\n } else {\r\n soldiers = line.split(' ');\r\n readline.close();\r\n while(true) {\r\n if(soldiers.every(function(soldier){\r\n return soldier == maxRank;\r\n })){\r\n break;\r\n }\r\n soldiers = soldiers.map(function(soldier, index, self){\r\n if(index === self.indexOf(soldier) && soldier < maxRank){\r\n soldier++;\r\n }\r\n return soldier;\r\n });\r\n coin++;\r\n }\r\n console.log(coin);\r\n }\r\n}) ","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\u2264n,k\u2264100). 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\u2264i\u2264n, 1\u2264ai\u2264k).\n","output_specification":"Print a single integer \u2014 the number of golden coins needed to raise all the soldiers to the maximal rank.\n","notes":"In the first example the ranks will be raised in the following manner:\n1 2 2 3 \u2192 2 2 3 4 \u2192 2 3 4 4 \u2192 3 4 4 4 \u2192 4 4 4 4\nThus totals to 4 training sessions that require 4 golden coins.\n","sample_inputs":["4 4\n1 2 2 3\n","4 3\n1 1 1 1\n"],"sample_outputs":["4","5"],"human_solution":"const readline = require('readline').createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n});\r\nlet isFirstLine = true;\r\nlet number;\r\nlet maxRank;\r\nlet soldiers;\r\nlet coin = 0;\r\nreadline.on('line', line => {\r\n if (isFirstLine) {\r\n let firstLine = line.split(' ').map(x => parseInt(x));\r\n number = firstLine[0];\r\n maxRank = firstLine[1]\r\n isFirstLine = false;\r\n } else {\r\n soldiers = line.split(' ').map(x => parseInt(x));\r\n readline.close();\r\n while (soldiers.some(s => s < maxRank)) {\r\n coin++\r\n let currentSoldeir = 0;\r\n for (let i = 0; i < soldiers.length; i++) {\r\n const soldeir = soldiers[i];\r\n if (soldeir == maxRank) break\r\n if (currentSoldeir < soldeir) {\r\n soldiers[i]++\r\n currentSoldeir = soldeir;\r\n }\r\n soldiers = soldiers.sort((a, b) => a - b)\r\n }\r\n }\r\n console.log(coin);\r\n }\r\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":432} {"difficulty":800,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"b69170c8377623beb66db4706a02ffc6","execute_outcome":"COMPILATION_ERROR","source_code":"var data = \"\";\n\nprocess.stdin.on(\"data\", x => data += x);\n\n\/\/ process.on(\"SIGINT\", () => {\nprocess.stdin.on(\"end\", () => {\n\n var eol = data.indexOf(\"\\r\")+1 ? (data.indexOf(\"\\n\")+1 ? \"\\r\\n\" : \"\\r\") : \"\\n\";\n\n var lines = data.split(eol);\n\n\tvar lines0 = +lines.shift();\n\n var n = +lines0.split(\" \")[0];\n\n if(lines[lines.length-1] == \"\") lines.pop();\n\n for(let i = 0; i < n; i++) {\n\n var arr = [];\n var l = f.length;\n for(let ii = 0; ii < l; ii++) arr.push(lines[l*i+ii]);\n if(!l) {\n arr = lines;\n i = n;\n }\n f.apply({lines0}, arr);\n }\n\n\tconsole.log(ans);\n\n process.exit(0);\n});\n\nvar ans = \"\";\n\nfunction f(l) {\n\treturn l > 2 ? 0 : (l-1)\/2\n}\n","description":"There are two sisters Alice and Betty. You have $$$n$$$ candies. You want to distribute these $$$n$$$ candies between two sisters in such a way that: Alice will get $$$a$$$ ($$$a > 0$$$) candies; Betty will get $$$b$$$ ($$$b > 0$$$) candies; each sister will get some integer number of candies; Alice will get a greater amount of candies than Betty (i.e. $$$a > b$$$); all the candies will be given to one of two sisters (i.e. $$$a+b=n$$$). Your task is to calculate the number of ways to distribute exactly $$$n$$$ candies between sisters in a way described above. Candies are indistinguishable.Formally, find the number of ways to represent $$$n$$$ as the sum of $$$n=a+b$$$, where $$$a$$$ and $$$b$$$ are positive integers and $$$a>b$$$.You have to answer $$$t$$$ independent test cases.","input_specification":"The first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) \u2014 the number of test cases. Then $$$t$$$ test cases follow. The only line of a test case contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^9$$$) \u2014 the number of candies you have.","output_specification":"For each test case, print the answer \u2014 the number of ways to distribute exactly $$$n$$$ candies between two sisters in a way described in the problem statement. If there is no way to satisfy all the conditions, print $$$0$$$.","notes":"NoteFor the test case of the example, the $$$3$$$ possible ways to distribute candies are: $$$a=6$$$, $$$b=1$$$; $$$a=5$$$, $$$b=2$$$; $$$a=4$$$, $$$b=3$$$. ","sample_inputs":["6\n7\n1\n2\n3\n2000000000\n763243547"],"sample_outputs":["3\n0\n0\n1\n999999999\n381621773"],"human_solution":"'use strict';\n\nconst rl = require('readline')\n .createInterface({ input: process.stdin, output: process.stdout });\nconst write = (...args) => {\n process.stdout.write(args.join(' '));\n};\n\nconst lines = [];\nrl.on('line', line => {\n lines.push(line);\n});\n\nrl.on('close', main);\n\nlet rli = 0;\nfunction readline() {\n return lines[rli++];\n}\n \nfunction main() {\n const time = parseInt(readline());\n for(let t = 0; t < time; ++t) {\n let number = Math.ceil(parseInt(readline())\/2);\n if(number > 0) {\n number = number - 1;\n }\n write(`${number}\\n`);\n }\n \/\/write(`${one_line}\\n`);\n}\n\n\/\/ solved by: asmjaime\n","testcases":"[{'input': '6\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773']}, {'input': '10000\\r\\n1999998163\\r\\n1999998749\\r\\n3608\\r\\n1999995797\\r\\n3253\\r\\n1999998518\\r\\n3146\\r\\n938\\r\\n1999996903\\r\\n2957\\r\\n966\\r\\n1738464254\\r\\n2474\\r\\n2226\\r\\n1999997073\\r\\n1999995579\\r\\n1168\\r\\n91\\r\\n1999998757\\r\\n1999999297\\r\\n3541\\r\\n3769\\r\\n70\\r\\n3838\\r\\n1045411991\\r\\n1999996556\\r\\n4163\\r\\n1999999008\\r\\n1999997424\\r\\n1999997409\\r\\n3413\\r\\n2952\\r\\n1999996689\\r\\n1911\\r\\n1999998790\\r\\n1999997406\\r\\n4161\\r\\n1999998785\\r\\n2273\\r\\n1999998472\\r\\n973\\r\\n2749\\r\\n1999996019\\r\\n1999998967\\r\\n1999999115\\r\\n1999998605\\r\\n3081\\r\\n1633009152\\r\\n1999997493\\r\\n1999996534\\r\\n1999997510\\r\\n1999999805\\r\\n1956085790\\r\\n3818\\r\\n1999997...', 'output': ['999999081\\r\\n999999374\\r\\n1803\\r\\n999997898\\r\\n1626\\r\\n999999258\\r\\n1572\\r\\n468\\r\\n999998451\\r\\n1478\\r\\n482\\r\\n869232126\\r\\n1236\\r\\n1112\\r\\n999998536\\r\\n999997789\\r\\n583\\r\\n45\\r\\n999999378\\r\\n999999648\\r\\n1770\\r\\n1884\\r\\n34\\r\\n1918\\r\\n522705995\\r\\n999998277\\r\\n2081\\r\\n999999503\\r\\n999998711\\r\\n999998704\\r\\n1706\\r\\n1475\\r\\n999998344\\r\\n955\\r\\n999999394\\r\\n999998702\\r\\n2080\\r\\n999999392\\r\\n1136\\r\\n999999235\\r\\n486\\r\\n1374\\r\\n999998009\\r\\n999999483\\r\\n999999557\\r\\n999999302\\r\\n1540\\r\\n816504575\\r\\n999998746\\r\\n999998266\\r\\n999998754\\r\\n999999902\\r\\n978042894\\r\\n1908\\r\\n999998701\\r\\n999999380\\r\\n999998341\\r\\n1743\\r\\n9999979...', '999999081\\n999999374\\n1803\\n999997898\\n1626\\n999999258\\n1572\\n468\\n999998451\\n1478\\n482\\n869232126\\n1236\\n1112\\n999998536\\n999997789\\n583\\n45\\n999999378\\n999999648\\n1770\\n1884\\n34\\n1918\\n522705995\\n999998277\\n2081\\n999999503\\n999998711\\n999998704\\n1706\\n1475\\n999998344\\n955\\n999999394\\n999998702\\n2080\\n999999392\\n1136\\n999999235\\n486\\n1374\\n999998009\\n999999483\\n999999557\\n999999302\\n1540\\n816504575\\n999998746\\n999998266\\n999998754\\n999999902\\n978042894\\n1908\\n999998701\\n999999380\\n999998341\\n1743\\n999997960\\n953\\n999998982\\n936778166\\n301\\n999999608\\n879\\n261\\n999998090...']}, {'input': '2\\r\\n1\\r\\n2\\r\\n', 'output': ['0\\r\\n0', '0\\n0']}, {'input': '1\\r\\n108139\\r\\n', 'output': ['54069']}, {'input': '5\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0\\n0\\n0', '0\\r\\n0\\r\\n0\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\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', 'output': ['0\\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', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0']}, {'input': '1\\r\\n121112422\\r\\n', 'output': ['60556210']}, {'input': '1\\r\\n1411\\r\\n', 'output': ['705']}, {'input': '39\\r\\n2\\r\\n3\\r\\n5\\r\\n7\\r\\n9\\r\\n8\\r\\n6\\r\\n5\\r\\n4\\r\\n4\\r\\n9\\r\\n4\\r\\n5\\r\\n6\\r\\n8\\r\\n1\\r\\n5\\r\\n4\\r\\n3\\r\\n10\\r\\n7\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n5\\r\\n6\\r\\n2\\r\\n5\\r\\n9\\r\\n9\\r\\n6\\r\\n6\\r\\n4\\r\\n5\\r\\n3\\r\\n10\\r\\n10\\r\\n1\\r\\n', 'output': ['0\\n1\\n2\\n3\\n4\\n3\\n2\\n2\\n1\\n1\\n4\\n1\\n2\\n2\\n3\\n0\\n2\\n1\\n1\\n4\\n3\\n0\\n0\\n1\\n1\\n2\\n2\\n0\\n2\\n4\\n4\\n2\\n2\\n1\\n2\\n1\\n4\\n4\\n0', '0\\r\\n1\\r\\n2\\r\\n3\\r\\n4\\r\\n3\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n0\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n0\\r\\n2\\r\\n4\\r\\n4\\r\\n2\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n4\\r\\n4\\r\\n0']}, {'input': '39\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n32\\r\\n32\\r\\n34\\r\\n35\\r\\n36\\r\\n37\\r\\n35\\r\\n39\\r\\n', 'output': ['0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15\\n15\\n15\\n16\\n17\\n17\\n18\\n17\\n19', '0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15\\r\\n15\\r\\n15\\r\\n16\\r\\n17\\r\\n17\\r\\n18\\r\\n17\\r\\n19']}, {'input': '98\\r\\n710\\r\\n896\\r\\n635\\r\\n909\\r\\n528\\r\\n799\\r\\n184\\r\\n970\\r\\n731\\r\\n285\\r\\n481\\r\\n62\\r\\n829\\r\\n815\\r\\n204\\r\\n927\\r\\n48\\r\\n958\\r\\n858\\r\\n549\\r\\n722\\r\\n900\\r\\n290\\r\\n96\\r\\n414\\r\\n323\\r\\n488\\r\\n140\\r\\n494\\r\\n286\\r\\n783\\r\\n551\\r\\n896\\r\\n580\\r\\n724\\r\\n766\\r\\n841\\r\\n914\\r\\n200\\r\\n170\\r\\n384\\r\\n664\\r\\n14\\r\\n203\\r\\n582\\r\\n203\\r\\n678\\r\\n502\\r\\n677\\r\\n318\\r\\n189\\r\\n144\\r\\n97\\r\\n330\\r\\n169\\r\\n20\\r\\n492\\r\\n233\\r\\n198\\r\\n876\\r\\n697\\r\\n624\\r\\n877\\r\\n514\\r\\n828\\r\\n41\\r\\n575\\r\\n959\\r\\n499\\r\\n786\\r\\n621\\r\\n878\\r\\n547\\r\\n409\\r\\n194\\r\\n59\\r\\n657\\r\\n893\\r\\n230\\r\\n559\\r\\n170\\r\\n238\\r\\n752\\r\\n854\\r\\n385\\r\\n365\\r\\n415\\r\\n505\\r\\n584\\r\\n434\\r\\n135\\r\\n136\\r\\n610\\r\\n525\\r\\n945\\r\\n889\\r\\n941\\r\\n579\\r\\n', 'output': ['354\\r\\n447\\r\\n317\\r\\n454\\r\\n263\\r\\n399\\r\\n91\\r\\n484\\r\\n365\\r\\n142\\r\\n240\\r\\n30\\r\\n414\\r\\n407\\r\\n101\\r\\n463\\r\\n23\\r\\n478\\r\\n428\\r\\n274\\r\\n360\\r\\n449\\r\\n144\\r\\n47\\r\\n206\\r\\n161\\r\\n243\\r\\n69\\r\\n246\\r\\n142\\r\\n391\\r\\n275\\r\\n447\\r\\n289\\r\\n361\\r\\n382\\r\\n420\\r\\n456\\r\\n99\\r\\n84\\r\\n191\\r\\n331\\r\\n6\\r\\n101\\r\\n290\\r\\n101\\r\\n338\\r\\n250\\r\\n338\\r\\n158\\r\\n94\\r\\n71\\r\\n48\\r\\n164\\r\\n84\\r\\n9\\r\\n245\\r\\n116\\r\\n98\\r\\n437\\r\\n348\\r\\n311\\r\\n438\\r\\n256\\r\\n413\\r\\n20\\r\\n287\\r\\n479\\r\\n249\\r\\n392\\r\\n310\\r\\n438\\r\\n273\\r\\n204\\r\\n96\\r\\n29\\r\\n328\\r\\n446\\r\\n114\\r\\n279\\r\\n84\\r\\n118\\r\\n375\\r\\n426\\r\\n192\\r\\n182\\r\\n207\\r\\n252\\r\\n291\\r\\n216\\r\\n67\\r\\n67\\r\\n304\\r\\n262\\r\\n472\\r\\n444\\r\\n470\\r\\n289', '354\\n447\\n317\\n454\\n263\\n399\\n91\\n484\\n365\\n142\\n240\\n30\\n414\\n407\\n101\\n463\\n23\\n478\\n428\\n274\\n360\\n449\\n144\\n47\\n206\\n161\\n243\\n69\\n246\\n142\\n391\\n275\\n447\\n289\\n361\\n382\\n420\\n456\\n99\\n84\\n191\\n331\\n6\\n101\\n290\\n101\\n338\\n250\\n338\\n158\\n94\\n71\\n48\\n164\\n84\\n9\\n245\\n116\\n98\\n437\\n348\\n311\\n438\\n256\\n413\\n20\\n287\\n479\\n249\\n392\\n310\\n438\\n273\\n204\\n96\\n29\\n328\\n446\\n114\\n279\\n84\\n118\\n375\\n426\\n192\\n182\\n207\\n252\\n291\\n216\\n67\\n67\\n304\\n262\\n472\\n444\\n470\\n289']}, {'input': '102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n1...', 'output': ['50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50', '50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50']}, {'input': '1411\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...', 'output': ['0\\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\\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...', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0...']}, {'input': '3\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0', '0\\r\\n0\\r\\n0']}, {'input': '1\\r\\n10\\r\\n', 'output': ['4']}, {'input': '7\\r\\n1\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['0\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773', '0\\n3\\n0\\n0\\n1\\n999999999\\n381621773']}, {'input': '3\\r\\n3\\r\\n4\\r\\n5\\r\\n', 'output': ['1\\r\\n1\\r\\n2', '1\\n1\\n2']}, {'input': '31\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n', 'output': ['0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15', '0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15']}, {'input': '1\\r\\n54334\\r\\n', 'output': ['27166']}, {'input': '1\\r\\n54332\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54331\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54335\\r\\n', 'output': ['27167']}, {'input': '1\\r\\n54330\\r\\n', 'output': ['27164']}]","id":433} {"difficulty":1200,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n \n main();\n});\n\nfunction readline() {\n return inputString[currentLine++];\n}\n\nfunction pi(a) {\n return parseInt(a);\n}\n\nfunction ti(a){\n for(let i = 0; i < a.length; i++)\n a[i] = pi(a[i]);\n\n return a;\n}\n\nfunction dsu(n){\n this.parent = new Array(n);\n for(let i = 0; i < n; i++)\n this.parent[i] = i;\n\n this.find = (x) => {\n if(this.parent[x] === x)\n return this.parent[x];\n\n return this.find(this.parent[x]);\n }\n\n this.union = (x,y) => {\n this.parent[this.find(x)] = this.find(y);\n }\n}\n\nfunction main(){\n let n = pi(readline());\n let mapX = new Array(1005);\n let mapY = new Array(1005);\n mapX.fill(-1);\n mapY.fill(-1);\n let uf = new dsu(n);\n\n for(let i = 0; i < n; i++){\n let [x,y] = ti(readline().split(' '));\n if(mapX[x] !== -1){\n uf.union(mapX[x], i);\n }else{\n mapX[x] = i;\n }\n\n if(mapY[y] !== -1){\n uf.union(mapY[y], i);\n }else{\n mapY[y] = i;\n }\n }\n\n let res = 0;\n for(let i = 0; i < n; i++)\n if(uf.parent[i] === i)\n res += 1;\n \n console.log(Math.floor(res \/ 2));\n}","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"],"human_solution":"\/\/ author: Oscar Ramos\n\n\/\/\/ Source Code\n\/\/ const input = require('competitive-programming-js').inputReader\n\/\/ const { forn, vector, range } = require('..\/utils\/utils')\n\/\/ \n\/\/ const n = input.readNumber()\n\/\/ \n\/\/ const coords = []\n\/\/ forn(n, () => {\n\/\/ const [x, y] = input.readNumberArray()\n\/\/ coords.push([x, y])\n\/\/ })\n\/\/ \n\/\/ const visited = vector(n, false)\n\/\/ \n\/\/ let ans = -1\n\/\/ \n\/\/ const dfs = i => {\n\/\/ if (!visited[i]) {\n\/\/ visited[i] = true\n\/\/ forn(n, (j => {\n\/\/ if (coords[i][0] === coords[j][0] ||\n\/\/ coords[i][1] === coords[j][1]) {\n\/\/ dfs(j)\n\/\/ }\n\/\/ }))\n\/\/ }\n\/\/ }\n\/\/ \n\/\/ forn(n, i => {\n\/\/ if (!visited[i]) {\n\/\/ ans += 1\n\/\/ }\n\/\/ dfs(i)\n\/\/ })\n\/\/ \n\/\/ console.log(ans)\n\/\/ \n\n!function(n){var t={};function r(e){if(t[e])return t[e].exports;var o=t[e]={i:e,l:!1,exports:{}};return n[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:e})},r.r=function(n){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(n,\"__esModule\",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&\"object\"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,\"default\",{enumerable:!0,value:n}),2&t&&\"string\"!=typeof n)for(var o in n)r.d(e,o,function(t){return n[t]}.bind(null,o));return e},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,\"a\",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p=\"\",r(r.s=1)}([function(n,t){n.exports=function(n){return null!=n&&\"object\"==typeof n&&!0===n[\"@@functional\/placeholder\"]}},function(n,t,r){n.exports=r(2)},function(n,t,r){let e,o=0,u={readNumber:function(){return Number(e[o++])},readNumberArray:function(){return e[o++].split(\" \").map(n=>Number(n))}};var c=\"\";process.stdin.resume(),process.stdin.setEncoding(\"utf8\"),process.stdin.on(\"data\",(function(n){c+=n})).on(\"end\",(function(){e=c.trim().split(\"\\n\").map(n=>n.trim());const{forn:n,vector:t,range:o}=r(3),i=u.readNumber(),f=[];n(i,()=>{const[n,t]=u.readNumberArray();f.push([n,t])});const a=t(i,!1);let s=-1;const p=t=>{a[t]||(a[t]=!0,n(i,n=>{f[t][0]!==f[n][0]&&f[t][1]!==f[n][1]||p(n)}))};n(i,n=>{a[n]||(s+=1),p(n)}),console.log(s)}))},function(n,t,r){const e=r(4);n.exports={forn:(n,t)=>e(0,n).map(n=>t(n)),fornm:(n,t,r)=>e(0,n).map(n=>e(0,t).map(t=>r(n,t))),matrix:(n,t,r)=>e(0,n).map(()=>e(0,t).map(()=>r)),vector:(n,t)=>e(0,n).map(()=>t),range:e}},function(n,t,r){var e=r(5),o=r(7),u=e((function(n,t){if(!o(n)||!o(t))throw new TypeError(\"Both arguments to range must be numbers\");for(var r=[],e=n;e {\n arr += i\n})\n\n\nprocess.stdin.on('end', () => {\n arr = arr.split('\\n')\n const hw = arr.shift().split(' ')\n const n = parseInt(hw[0])\n const m = parseInt(hw[1])\n\n const graph = new Map()\n for(let i = 1; i <= n; i++) {\n graph.set(i, 0)\n }\n\n for(let i = 0; i < m; i++) {\n const edge = arr.shift().split(' ')\n graph.set(parseInt(edge[0]), graph.get(parseInt(edge[0])) + 1)\n graph.set(parseInt(edge[1]), graph.get(parseInt(edge[1])) + 1)\n }\n\n const deg = new Map()\n graph.forEach((v, k) => {\n if(!deg.get(v)) deg.set(v, 1)\n else deg.set(v, deg.get(v) + 1)\n })\n\n \/\/ console.log(graph)\n \/\/ console.log(deg)\n if(deg.size <= 3){\n var iterator1 = deg.keys()\n const ak = iterator1.next().value\n const bk = iterator1.next().value\n const ck = iterator1.next().value\n const a = deg.get(ak)\n const b = deg.get(bk)\n const c = deg.get(ck)\n \/\/ console.log(a,b,c, ak, bk)\n if(a == (b + c)\n || b == (a + c)\n || c == (a + b)\n || (a % 3 == 0 && b == undefined && c == undefined)\n || (a == b && c == undefined)){\n \/\/ console.log(graph)\n graph.forEach((v, k) => {\n \/\/ console.log(v)\n if(v == ak){\n process.stdout.write('1 ')\n }\n else if(v == bk){\n process.stdout.write('2 ')\n }\n else{\n process.stdout.write('3 ')\n }\n })\n console.log()\n }\n else{\n console.log(-1)\n }\n }\n else{\n console.log(-1)\n }\n})","description":"You have a simple undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.Let's make a definition.Let $$$v_1$$$ and $$$v_2$$$ be two some nonempty subsets of vertices that do not intersect. Let $$$f(v_{1}, v_{2})$$$ be true if and only if all the conditions are satisfied: There are no edges with both endpoints in vertex set $$$v_1$$$. There are no edges with both endpoints in vertex set $$$v_2$$$. For every two vertices $$$x$$$ and $$$y$$$ such that $$$x$$$ is in $$$v_1$$$ and $$$y$$$ is in $$$v_2$$$, there is an edge between $$$x$$$ and $$$y$$$. Create three vertex sets ($$$v_{1}$$$, $$$v_{2}$$$, $$$v_{3}$$$) which satisfy the conditions below; All vertex sets should not be empty. Each vertex should be assigned to only one vertex set. $$$f(v_{1}, v_{2})$$$, $$$f(v_{2}, v_{3})$$$, $$$f(v_{3}, v_{1})$$$ are all true. Is it possible to create such three vertex sets? If it's possible, print matching vertex set for each vertex.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$3 \\le n \\le 10^{5}$$$, $$$0 \\le m \\le \\text{min}(3 \\cdot 10^{5}, \\frac{n(n-1)}{2})$$$)\u00a0\u2014 the number of vertices and edges in the graph.\nThe $$$i$$$-th of the next $$$m$$$ lines contains two integers $$$a_{i}$$$ and $$$b_{i}$$$ ($$$1 \\le a_{i} \\lt b_{i} \\le n$$$)\u00a0\u2014 it means there is an edge between $$$a_{i}$$$ and $$$b_{i}$$$. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.\n","output_specification":"If the answer exists, print $$$n$$$ integers. $$$i$$$-th integer means the vertex set number (from $$$1$$$ to $$$3$$$) of $$$i$$$-th vertex. Otherwise, print $$$-1$$$.\nIf there are multiple answers, print any.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"const readline = require('readline')\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n})\nconst lines = []\nrl.on('line', (input) => {\n lines.push(input);\n})\nrl.on('close', () => {\n\/\/ (function() {\n \/\/ const lines = require('fs').readFileSync('test.in', 'utf8').split('\\n')\n let l = 0;\n let t = 1\/\/+lines[l++]\n const output = []\n for (let i = 0; i < t; i++) {\n const [n, m] = lines[l++].trim().split(' ').map(Number)\n const edges = lines.slice(l, l + m).map(str => str.trim().split(' ').map(Number))\n l += m\n output[i] = solve(n, edges)\n }\n console.log(output.join('\\n'))\n\/\/ })()\n})\n\nfunction solve(n, edges) {\n const adj = {}\n for (let u = 1; u <= n; u++) {\n adj[u] = {}\n }\n edges.forEach(([a, b]) => {\n adj[a][b] = 1\n adj[b][a] = 1\n })\n\n const gs = Array(n + 1)\n const vs = []\n let g = 1\n for (let u = 1; u <= n; u++) {\n if (gs[u]) continue\n if (g > 3) return -1\n const temp = [u]\n gs[u] = g\n for (let v = u + 1; v <= n; v++) {\n if (!adj[u][v] && !gs[v]) {\n gs[v] = g\n temp.push(v)\n }\n }\n vs.push(temp)\n g++\n }\n\/\/ console.log(gs, vs)\n if (vs.length < 3) return -1\n for (let i = 0; i < vs.length; i++) {\n for (let a = 0; a < vs[i].length; a++) {\n const u = vs[i][a]\n for (let j = i + 1; j < vs.length; j++) {\n for (let b = 0; b < vs[j].length; b++) {\n const v = vs[j][b]\n if (!adj[u][v]) return -1\n }\n }\n }\n }\n for (let [u, v] of edges) {\n if (gs[u] === gs[v]) return -1\n }\n gs.shift()\n return gs.join(' ')\n}\n","testcases":"[{'input': ['6 11\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n'], 'output': ['1 2 2 3 3 3 ']}, {'input': ['4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n'], 'output': ['1 2 3 ']}, {'input': ['6 9\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 1\\r\\n1 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['4 3\\r\\n1 4\\r\\n2 4\\r\\n3 4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['21 35\\r\\n1 4\\r\\n2 4\\r\\n1 5\\r\\n2 5\\r\\n1 6\\r\\n2 6\\r\\n1 7\\r\\n2 7\\r\\n1 8\\r\\n2 8\\r\\n1 9\\r\\n2 9\\r\\n1 10\\r\\n2 10\\r\\n1 11\\r\\n2 11\\r\\n1 12\\r\\n2 12\\r\\n1 13\\r\\n2 13\\r\\n1 14\\r\\n2 14\\r\\n1 15\\r\\n2 15\\r\\n1 16\\r\\n2 16\\r\\n1 17\\r\\n2 17\\r\\n1 18\\r\\n2 18\\r\\n1 19\\r\\n2 19\\r\\n1 20\\r\\n2 20\\r\\n3 21\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['6 12\\r\\n1 2\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 3\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n2 5\\r\\n2 6\\r\\n4 5\\r\\n4 6\\r\\n'], 'output': ['1 2 1 2 3 3 ']}, {'input': ['12 17\\r\\n1 4\\r\\n2 4\\r\\n1 5\\r\\n2 5\\r\\n1 6\\r\\n2 6\\r\\n1 7\\r\\n2 7\\r\\n1 8\\r\\n2 8\\r\\n1 9\\r\\n2 9\\r\\n1 10\\r\\n2 10\\r\\n1 11\\r\\n2 11\\r\\n3 12\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5 4\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n'], 'output': ['-1\\r\\n']}]","id":435} {"difficulty":1600,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"156_B","execute_outcome":"WRONG_ANSWER","source_code":"'use strict';\r\n\r\nfunction solve(n, m, s) {\r\n console.log(n, m, s);\r\n const segTree = new SegTree(new Array(n).fill(0));\r\n for (let str of s) {\r\n const num = Number(str.slice(1)) - 1;\r\n if (str[0] === '+') {\r\n segTree.update(num, num, 1);\r\n } else {\r\n segTree.update(0, num - 1, 1);\r\n segTree.update(num + 1, n - 1, 1);\r\n }\r\n }\r\n const suspects = new Set();\r\n for (let i = 0; i < n; i++) {\r\n const count = segTree.query(i, i);\r\n if (count === m) suspects.add(i);\r\n }\r\n const res = new Array(n);\r\n for (let i = 0; i < n; i++) {\r\n const str = s[i];\r\n const num = Number(str.slice(1)) - 1;\r\n if (str[0] === '+') {\r\n if (suspects.has(num)) {\r\n if (suspects.size === 1) res[i] = 'Truth';else res[i] = 'Not defined';\r\n } else {\r\n res[i] = 'Lie';\r\n }\r\n } else {\r\n if (suspects.has(num)) {\r\n if (suspects.size === 1) res[i] = 'Lie';else res[i] = 'Not defined';\r\n } else {\r\n res[i] = 'Truth';\r\n }\r\n }\r\n }\r\n return res.join('\\n');\r\n}\r\nclass SegTree {\r\n constructor(nums = [], n = nums.length - 1) {\r\n this.nums = nums;\r\n this.n = n;\r\n this.root = this._newNode();\r\n this._build(this.root, 0, n);\r\n this.update = (x, y, z) => {\r\n if (x > y) return;\r\n x = Math.max(x, 0);\r\n y = Math.min(y, n);\r\n return this._update(this.root, 0, n, x, y, z);\r\n };\r\n this.query = (x, y) => {\r\n if (x > y) return 0;\r\n x = Math.max(x, 0);\r\n y = Math.min(y, n);\r\n return this._query(this.root, 0, n, x, y);\r\n };\r\n }\r\n _newNode(val = 0, left = null, right = null) {\r\n return {\r\n val,\r\n left,\r\n right,\r\n add: 0\r\n };\r\n }\r\n _down(node, l, r) {\r\n const {\r\n left,\r\n right\r\n } = node;\r\n if (!left || !right) return;\r\n const mid = Math.floor((l + r) \/ 2);\r\n left.add += node.add;\r\n left.val += node.add * (mid - l + 1);\r\n right.add += node.add;\r\n right.val += node.add * (r - mid);\r\n node.add = 0;\r\n }\r\n _up(node) {\r\n const {\r\n left,\r\n right\r\n } = node;\r\n if (!left || !right) return;\r\n node.val = left.val + right.val;\r\n }\r\n _build(node = this.root, l, r) {\r\n if (l === r) {\r\n var _this$nums$l;\r\n node.val = (_this$nums$l = this.nums[l]) !== null && _this$nums$l !== void 0 ? _this$nums$l : 0;\r\n return;\r\n }\r\n const mid = Math.floor((l + r) \/ 2);\r\n node.left = this._newNode();\r\n node.right = this._newNode();\r\n this._build(node.left, l, mid);\r\n this._build(node.right, mid + 1, r);\r\n node.val = node.left.val + node.right.val;\r\n }\r\n _update(node, l, r, x, y, z) {\r\n if (!node) return;\r\n if (l === x && r === y) {\r\n node.add += z;\r\n node.val += z * (r - l + 1);\r\n return;\r\n }\r\n this._down(node, l, r);\r\n const mid = Math.floor((l + r) \/ 2);\r\n if (y <= mid) this._update(node.left, l, mid, x, y, z);else if (x > mid) this._update(node.right, mid + 1, r, x, y, z);else this._update(node.left, l, mid, x, mid, z), this._update(node.right, mid + 1, r, mid + 1, y, z);\r\n this._up(node);\r\n }\r\n _query(node, l, r, x, y) {\r\n if (y < x) return 0;\r\n if (!node) return 0;\r\n if (l === x && r === y) return node.val;\r\n this._down(node, l, r);\r\n let res = 0,\r\n mid = Math.floor((l + r) \/ 2);\r\n if (y <= mid) res = this._query(node.left, l, mid, x, y);else if (x > mid) res = this._query(node.right, mid + 1, r, x, y);else res = this._query(node.left, l, mid, x, mid) + this._query(node.right, mid + 1, r, mid + 1, y);\r\n this._up(node);\r\n return res;\r\n }\r\n}\r\n\r\nasync function main(read) {\r\n try {\r\n let res = [];\r\n let t = 1;\r\n while (t--) {\r\n const [n, m] = (await read()).split(' ').map(Number);\r\n const a = [];\r\n let tmp = n;\r\n while (tmp--) {\r\n a.push(await read());\r\n }\r\n res.push(solve(n, m, a));\r\n }\r\n console.log(res.join('\\n'));\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', () => {\r\n inputs = str.split('\\n').values();\r\n main(read);\r\n});\r\n","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=i).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\u2264n\u226410^5,0\u2264m\u2264n) \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\u2264ai\u2264n).\nIt is guaranteed that at least one suspect exists, such that if he committed the crime, then exactly m people told the truth.\n","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.\n","notes":"The 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.\nIn 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.\nIn 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.\n","sample_inputs":["1 1\n+1\n","3 2\n-1\n-2\n-3\n","4 1\n+2\n-3\n+4\n-1\n"],"sample_outputs":["Truth\n","Not defined\nNot defined\nNot defined\n","Lie\nNot defined\nLie\nNot defined\n"],"human_solution":"'use strict';\r\n\r\nfunction solve(n, m, s) {\r\n const diff = new Array(n + 2).fill(0);\r\n for (let str of s) {\r\n const num = Number(str.slice(1));\r\n if (str[0] === '+') {\r\n diff[num]++;\r\n diff[num + 1]--;\r\n } else {\r\n diff[0]++;\r\n diff[num]--;\r\n diff[num + 1]++;\r\n diff[n + 1]--;\r\n }\r\n }\r\n const suspects = new Set();\r\n let sum = diff[0];\r\n for (let i = 1; i <= n; i++) {\r\n sum += diff[i];\r\n if (sum === m) suspects.add(i);\r\n }\r\n const res = new Array(n);\r\n for (let i = 0; i < n; i++) {\r\n const str = s[i];\r\n const num = Number(str.slice(1));\r\n if (str[0] === '+') {\r\n if (suspects.has(num)) {\r\n if (suspects.size === 1) res[i] = 'Truth';else res[i] = 'Not defined';\r\n } else {\r\n res[i] = 'Lie';\r\n }\r\n } else {\r\n if (suspects.has(num)) {\r\n if (suspects.size === 1) res[i] = 'Lie';else res[i] = 'Not defined';\r\n } else {\r\n res[i] = 'Truth';\r\n }\r\n }\r\n }\r\n return res.join('\\n');\r\n}\r\n\r\nasync function main(read) {\r\n try {\r\n let res = [];\r\n let t = 1;\r\n while (t--) {\r\n const [n, m] = (await read()).split(' ').map(Number);\r\n const a = [];\r\n let tmp = n;\r\n while (tmp--) {\r\n a.push(await read());\r\n }\r\n res.push(solve(n, m, a));\r\n }\r\n console.log(res.join('\\n'));\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n}\r\n\r\nlet inputs,\r\n str = '';\r\nfunction read() {\r\n return inputs.next().value.trim();\r\n}\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf8');\r\nprocess.stdin.on('data', input => str += input);\r\nprocess.stdin.on('end', () => {\r\n inputs = str.split('\\n').values();\r\n main(read);\r\n});\r\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":436} {"difficulty":1600,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"175_C","execute_outcome":"WRONG_ANSWER","source_code":"var readline = require('readline')\r\nconst rl = readline.createInterface({\r\n input: process.stdin,\r\n output: process.stdout\r\n})\r\nvar inputs = []\r\n\r\nconst fn = debounce(function () {\r\n var n = +inputs[0];\r\n var monsters = inputs.slice(1, n + 1).map(function (str) {\r\n return str.split(' ').map(function (x) {\r\n return +x;\r\n });\r\n });\r\n var t = +inputs[n + 1];\r\n var p = inputs[n + 2].split(' ').map(function (x) {\r\n return +x;\r\n });\r\n monsters.sort(function (a, b) {\r\n return a[1] - b[1];\r\n });\r\n var i = 0,\r\n j = 0,\r\n sum = 0,\r\n ans = 0,\r\n pre = 0,\r\n factor = 1;\r\n for (; i < n; i++) {\r\n var _a = monsters[i],\r\n cnt = _a[0],\r\n score = _a[1];\r\n sum += cnt;\r\n while (sum > p[j] && j < t) {\r\n ans += (p[j] - pre) * score * factor;\r\n \/\/ console.log(ans, p[j], pre, score, factor)\r\n pre = p[j];\r\n j++;\r\n factor++;\r\n }\r\n if (sum <= p[j]) {\r\n ans += (sum - pre) * score * factor;\r\n \/\/ console.log(ans, p[j], pre, score, factor)\r\n pre = sum;\r\n }\r\n }\r\n write(ans + '');\r\n})\r\nrl.on('line', function (line) {\r\n inputs.push(line.trim());\r\n fn()\r\n})\r\n\r\nfunction debounce(cb, delay) {\r\n if (delay === void 0) {\r\n delay = 100;\r\n }\r\n var timer = -1;\r\n return function () {\r\n if (timer !== -1) {\r\n clearTimeout(timer);\r\n }\r\n timer = setTimeout(function () {\r\n cb();\r\n timer = -1;\r\n }, delay);\r\n };\r\n}\r\n\r\nfunction write(x) {\r\n console.log(x)\r\n}","description":"Vasya plays the Geometry Horse.The game goal is to destroy geometric figures of the game world. A certain number of points is given for destroying each figure depending on the figure type and the current factor value. There are n types of geometric figures. The number of figures of type ki and figure cost ci is known for each figure type. A player gets ci\u00b7f points for destroying one figure of type i, where f is the current factor. The factor value can be an integer number from 1 to t+1, inclusive. At the beginning of the game the factor value is equal to 1. The factor is set to i+1 after destruction of pi (1\u2264i\u2264t) figures, so the (pi+1)-th figure to be destroyed is considered with factor equal to i+1.Your task is to determine the maximum number of points Vasya can get after he destroys all figures. Take into account that Vasya is so tough that he can destroy figures in any order chosen by him.","input_specification":"The first line contains the only integer number n (1\u2264n\u2264100) \u2014 the number of figure types.\nEach of the following n lines contains two integer numbers ki and ci (1\u2264ki\u226410^9,0\u2264ci\u22641000), separated with space \u2014 the number of figures of the i-th type and the cost of one i-type figure, correspondingly.\nThe next line contains the only integer number t (1\u2264t\u2264100) \u2014 the number that describe the factor's changes. \nThe next line contains t integer numbers pi (1\u2264p1 p[j] && j < t) {\r\n ans += BigInt(p[j] - pre) * score * factor;\r\n \/\/ console.log(ans, p[j], pre, score, factor)\r\n pre = p[j];\r\n j++;\r\n factor++;\r\n }\r\n if (sum <= p[j]) {\r\n ans += BigInt(sum - pre) * score * factor;\r\n \/\/ console.log(ans, p[j], pre, score, factor)\r\n pre = sum;\r\n }\r\n }\r\n write(ans + '');\r\n})\r\nrl.on('line', function (line) {\r\n inputs.push(line.trim());\r\n fn()\r\n})\r\n\r\nfunction debounce(cb, delay) {\r\n if (delay === void 0) {\r\n delay = 100;\r\n }\r\n var timer = -1;\r\n return function () {\r\n if (timer !== -1) {\r\n clearTimeout(timer);\r\n }\r\n timer = setTimeout(function () {\r\n cb();\r\n timer = -1;\r\n }, delay);\r\n };\r\n}\r\n\r\nfunction write(x) {\r\n console.log(x)\r\n}","testcases":"[{'input': ['1\\r\\n5 10\\r\\n2\\r\\n3 6\\r\\n'], 'output': ['70']}, {'input': ['2\\r\\n3 8\\r\\n5 10\\r\\n1\\r\\n20\\r\\n'], 'output': ['74']}, {'input': ['3\\r\\n10 3\\r\\n20 2\\r\\n30 1\\r\\n3\\r\\n30 50 60\\r\\n'], 'output': ['200']}, {'input': ['1\\r\\n100 1000\\r\\n1\\r\\n1\\r\\n'], 'output': ['199000']}, {'input': ['1\\r\\n1 1000\\r\\n1\\r\\n1\\r\\n'], 'output': ['1000']}, {'input': ['1\\r\\n1 1000\\r\\n1\\r\\n2\\r\\n'], 'output': ['1000']}, {'input': ['2\\r\\n1000000000 1000\\r\\n1 1\\r\\n1\\r\\n10\\r\\n'], 'output': ['1999999991001']}, {'input': ['6\\r\\n5 9\\r\\n63 3\\r\\n30 4\\r\\n25 6\\r\\n48 2\\r\\n29 9\\r\\n8\\r\\n105 137 172 192 632 722 972 981\\r\\n'], 'output': ['2251']}, {'input': ['7\\r\\n9902 9\\r\\n5809 6\\r\\n2358 0\\r\\n6868 7\\r\\n9630 2\\r\\n8302 10\\r\\n9422 3\\r\\n4\\r\\n2148 4563 8488 9575\\r\\n'], 'output': ['1481866']}, {'input': ['9\\r\\n60129 6\\r\\n44235 10\\r\\n13131 8\\r\\n2012 2\\r\\n27536 4\\r\\n38950 6\\r\\n39080 2\\r\\n13892 3\\r\\n48709 0\\r\\n1\\r\\n23853\\r\\n'], 'output': ['2751752']}, {'input': ['10\\r\\n3466127 4\\r\\n3477072 1\\r\\n9690039 9\\r\\n9885165 6\\r\\n2559197 4\\r\\n3448456 3\\r\\n9169542 1\\r\\n6915866 2\\r\\n1702896 10\\r\\n8934261 5\\r\\n6\\r\\n3041416 5811699 5920083 8250213 8694306 8899250\\r\\n'], 'output': ['1843409345']}, {'input': ['4\\r\\n4059578 5\\r\\n20774712 1\\r\\n64867825 7\\r\\n5606945 8\\r\\n1\\r\\n337246111\\r\\n'], 'output': ['540002937']}, {'input': ['16\\r\\n196661091 17\\r\\n765544213 322\\r\\n134522506 115\\r\\n914609421 163\\r\\n219016066 227\\r\\n835576807 856\\r\\n682158845 914\\r\\n11248128 145\\r\\n876496017 854\\r\\n141052597 530\\r\\n163180278 315\\r\\n407245991 60\\r\\n294673989 270\\r\\n2976249 26\\r\\n674132026 519\\r\\n347829904 23\\r\\n16\\r\\n6280951514 53396669509 79113951711 87247958777 121933859963 219062570855 250484361488 292915737777 357877371567 638447479028 646055798354 733144914116 746148995326 752707219571 888597178968 929325038582\\r\\n'], 'output': ['3493909415554']}, {'input': ['12\\r\\n559720489 0\\r\\n961035680 0\\r\\n953017025 0\\r\\n333351645 0\\r\\n840947432 0\\r\\n265712969 0\\r\\n484023361 0\\r\\n215786741 0\\r\\n880533785 0\\r\\n678800187 0\\r\\n817395626 0\\r\\n591321601 0\\r\\n13\\r\\n2165448470 32644841954 456375244913 510187375384 524722185932 628130306204 701569710739 731515209935 745407119699 772031092452 783514111802 933457816308 991905864630\\r\\n'], 'output': ['0']}, {'input': ['22\\r\\n2 103\\r\\n10 84\\r\\n7 834\\r\\n9 527\\r\\n3 415\\r\\n10 943\\r\\n1 633\\r\\n9 444\\r\\n7 639\\r\\n2 146\\r\\n9 208\\r\\n5 637\\r\\n4 1000\\r\\n4 606\\r\\n6 43\\r\\n2 437\\r\\n4 855\\r\\n1 70\\r\\n4 780\\r\\n8 214\\r\\n2 196\\r\\n1 261\\r\\n61\\r\\n2 3 6 9 11 12 13 16 17 19 21 24 26 29 31 33 35 36 38 39 40 42 44 46 49 52 53 54 56 59 61 64 66 67 70 72 75 77 78 80 83 84 87 90 92 93 95 98 100 102 105 107 109 112 114 115 116 117 120 122 125\\r\\n'], 'output': ['2004140']}, {'input': ['14\\r\\n3 689\\r\\n4 4\\r\\n6 40\\r\\n10 309\\r\\n2 216\\r\\n5 575\\r\\n1 203\\r\\n5 216\\r\\n10 544\\r\\n7 979\\r\\n1 19\\r\\n1 876\\r\\n8 505\\r\\n4 217\\r\\n51\\r\\n1 4 5 8 12 18 20 22 26 30 33 39 43 46 50 52 57 59 63 68 73 74 78 79 82 85 90 96 100 104 109 113 118 119 122 126 130 136 138 140 144 147 149 150 156 157 163 164 169 174 178\\r\\n'], 'output': ['412722']}, {'input': ['2\\r\\n3 116\\r\\n3 869\\r\\n80\\r\\n3 5 11 17 23 31 33 41 42 49 51 53 58 60 65 70 79 84 87 88 89 93 98 102 109 110 111 114 123 129 134 142 143 152 160 162 166 167 174 179 186 191 199 205 214 219 224 227 236 241 249 252 260 268 272 275 282 288 292 293 297 302 310 314 317 319 321 330 336 340 349 358 366 374 378 383 387 390 397 405\\r\\n'], 'output': ['6431']}, {'input': ['20\\r\\n1 529\\r\\n15 864\\r\\n1 26\\r\\n7 582\\r\\n7 914\\r\\n4 535\\r\\n5 371\\r\\n15 500\\r\\n13 912\\r\\n1 354\\r\\n7 327\\r\\n7 470\\r\\n4 277\\r\\n20 656\\r\\n8 501\\r\\n8 419\\r\\n16 569\\r\\n2 587\\r\\n13 294\\r\\n11 37\\r\\n77\\r\\n1 3 6 8 9 11 12 13 14 16 18 20 22 24 27 30 33 34 35 36 38 40 43 44 46 49 52 54 56 57 60 63 64 66 68 70 73 74 75 77 78 79 80 81 84 86 89 92 93 95 96 97 99 101 103 106 109 111 112 114 115 118 119 120 121 122 123 124 125 128 130 133 134 137 139 140 142\\r\\n'], 'output': ['4860712']}, {'input': ['20\\r\\n1 676\\r\\n10 2\\r\\n10 467\\r\\n7 826\\r\\n7 138\\r\\n8 76\\r\\n8 148\\r\\n2 121\\r\\n7 527\\r\\n3 571\\r\\n10 410\\r\\n7 174\\r\\n2 318\\r\\n6 97\\r\\n3 919\\r\\n8 684\\r\\n3 586\\r\\n4 570\\r\\n10 494\\r\\n8 582\\r\\n74\\r\\n1 6 10 15 20 22 25 26 27 29 32 33 34 37 39 44 49 52 53 55 56 61 65 66 70 72 74 77 79 80 83 85 88 91 95 98 103 106 107 112 114 119 124 129 133 137 138 140 144 146 147 149 153 155 157 160 165 168 172 173 177 180 181 184 188 193 198 201 206 208 209 213 216 218\\r\\n'], 'output': ['1497278']}, {'input': ['1\\r\\n555 100\\r\\n10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['605000']}, {'input': ['1\\r\\n1 1\\r\\n1\\r\\n100000000000\\r\\n'], 'output': ['1']}, {'input': ['12\\r\\n1000000000 1\\r\\n1000000000 2\\r\\n1000000000 3\\r\\n1000000000 4\\r\\n1000000000 5\\r\\n1000000000 6\\r\\n1000000000 7\\r\\n1000000000 8\\r\\n1000000000 9\\r\\n1000000000 10\\r\\n1000000000 11\\r\\n1000000000 12\\r\\n1\\r\\n10000000000\\r\\n'], 'output': ['101000000000']}, {'input': ['11\\r\\n1000000000 1\\r\\n1000000000 2\\r\\n1000000000 3\\r\\n1000000000 4\\r\\n1000000000 5\\r\\n1000000000 6\\r\\n1000000000 7\\r\\n1000000000 8\\r\\n1000000000 9\\r\\n1000000000 10\\r\\n1000000000 11\\r\\n1\\r\\n10000000000\\r\\n'], 'output': ['77000000000']}, {'input': ['1\\r\\n10 10\\r\\n3\\r\\n1 2 3\\r\\n'], 'output': ['340']}, {'input': ['1\\r\\n1000000000 1000\\r\\n2\\r\\n3 6\\r\\n'], 'output': ['2999999991000']}, {'input': ['1\\r\\n100 100\\r\\n3\\r\\n3 6 9\\r\\n'], 'output': ['38200']}, {'input': ['1\\r\\n10 1\\r\\n10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['55']}, {'input': ['1\\r\\n10 10\\r\\n5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['450']}, {'input': ['10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n10 10\\r\\n1\\r\\n1\\r\\n'], 'output': ['1990']}, {'input': ['1\\r\\n10 10\\r\\n2\\r\\n3 6\\r\\n'], 'output': ['210']}, {'input': ['10\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1000 1000\\r\\n1\\r\\n1000000\\r\\n'], 'output': ['10000000']}]","id":437} {"difficulty":1700,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"18_B","execute_outcome":"RUNTIME_ERROR","source_code":"'use strict'\r\n\r\nlet lll = readline().split(' ').map(v => parseInt(v))\r\n\r\nconst N = lll[0]\r\nconst D = lll[1]\r\nconst M = lll[2]\r\nconst L = lll[3]\r\n\r\nconst MAX = (N - 1) * M + L\r\nconsole.log(MAX)\r\n\r\nlet cur = 0\r\nlet d = D\r\n\r\n;(function () {\r\n while (true) {\r\n cur += D\r\n if (cur > MAX) return print(cur)\r\n\r\n let pop = d % M\r\n if (pop < L) {\r\n let ss = Math.floor(L \/ D)\r\n cur += D * ss\r\n d += D * ss\r\n }\r\n if (pop > L) return print(cur)\r\n d = D + pop\r\n }\r\n})()","description":"In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k-1)m,(k-1)m+l], and l {\n const [n, d, m, l] = line.split(' ').map(Number);\n let platforms = [];\n for (let i = 0; i < n; i++) {\n platforms.push([(i * m), ((i * m) + l)]);\n }\n let coordinate = 0;\n while (true) {\n coordinate += d;\n let onPlatform = false;\n for (let i = 0; i < n; i++) {\n if (coordinate >= platforms[i][0] && coordinate <= platforms[i][1]) {\n onPlatform = true;\n break;\n }\n }\n if (!onPlatform) {\n console.log(coordinate);\n break;\n }\n }\n});\n","testcases":"[{'input': ['2 2 5 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 4 11 8\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['228385 744978 699604 157872\\r\\n'], 'output': ['2979912\\r\\n']}, {'input': ['773663 427904 329049 243542\\r\\n'], 'output': ['1283712\\r\\n']}, {'input': ['835293 627183 442142 361649\\r\\n'], 'output': ['1254366\\r\\n']}, {'input': ['896922 310109 71587 16487\\r\\n'], 'output': ['310109\\r\\n']}, {'input': ['958552 993036 701031 109903\\r\\n'], 'output': ['993036\\r\\n']}, {'input': ['20182 192314 814124 268107\\r\\n'], 'output': ['384628\\r\\n']}, {'input': ['81812 875240 443569 287155\\r\\n'], 'output': ['875240\\r\\n']}, {'input': ['3 6 6 3\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['3 16 6 3\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['3 4 6 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['680892 333996 619800 374820\\r\\n'], 'output': ['1001988\\r\\n']}, {'input': ['658990 366800 43771 676\\r\\n'], 'output': ['366800\\r\\n']}, {'input': ['637089 915955 984094 706836\\r\\n'], 'output': ['915955\\r\\n']}, {'input': ['615188 948759 924417 924407\\r\\n'], 'output': ['183286007415\\r\\n']}, {'input': ['593287 497915 864740 864733\\r\\n'], 'output': ['82319789035\\r\\n']}, {'input': ['87738 530718 805063 805047\\r\\n'], 'output': ['11387616126\\r\\n']}, {'input': ['65837 79874 229034 229024\\r\\n'], 'output': ['1636218890\\r\\n']}, {'input': ['755991 187301 743241 743232\\r\\n'], 'output': ['2217831141\\r\\n']}, {'input': ['402841 635488 123613 122628\\r\\n'], 'output': ['49568064\\r\\n']}, {'input': ['999463 261665 255021 255007\\r\\n'], 'output': ['1596941495\\r\\n']}, {'input': ['43496 179847 327622 327621\\r\\n'], 'output': ['14250356892\\r\\n']}, {'input': ['105126 379125 440715 440713\\r\\n'], 'output': ['46330970625\\r\\n']}, {'input': ['1000000 1 1000000 999999\\r\\n'], 'output': ['1000000000000\\r\\n']}, {'input': ['1000000 16 999952 999951\\r\\n'], 'output': ['999952000000\\r\\n']}, {'input': ['1000000 49 999983 999982\\r\\n'], 'output': ['999983000023\\r\\n']}, {'input': ['1000000 3 999997 999996\\r\\n'], 'output': ['999997000002\\r\\n']}, {'input': ['1000000 11 999989 999988\\r\\n'], 'output': ['999989000010\\r\\n']}, {'input': ['1000000 64 999956 999955\\r\\n'], 'output': ['999956000000\\r\\n']}, {'input': ['1000000 531 999106 999105\\r\\n'], 'output': ['999106000236\\r\\n']}, {'input': ['1000000 337 999956 999955\\r\\n'], 'output': ['999956000119\\r\\n']}, {'input': ['1 1 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1000000 5 3\\r\\n'], 'output': ['1000000\\r\\n']}, {'input': ['1000000 1000000 1000000 999999\\r\\n'], 'output': ['1000000000000\\r\\n']}]","id":438} {"difficulty":1700,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"53_B","execute_outcome":"WRONG_ANSWER","source_code":"function calculateCutArea(input) {\n const [h, w] = input.split(' ').map(Number);\n \n \/\/ Initialize variables to store the best cut area\n let bestHeight = 0;\n let bestWidth = 0;\n let bestArea = 0;\n \n \/\/ Iterate over possible height values\n for (let height = h; height >= Math.ceil(h * 0.8); height--) {\n \/\/ Calculate the corresponding width based on the height and the allowed ratio\n const width = Math.floor(height \/ 0.8);\n \n \/\/ Check if the width is a power of 2\n if ((width & (width - 1)) === 0) {\n \/\/ Calculate the area of the current cut area\n const area = height * width;\n \n \/\/ Update the best cut area if the current area is larger\n if (area > bestArea) {\n bestHeight = height;\n bestWidth = width;\n bestArea = area;\n }\n }\n }\n \n return `${bestHeight} ${bestWidth}`;\n}\n\nconst inputs = ['2 1\\n', '2 2\\n', '5 5\\n'];\nconst outputs = inputs.map(calculateCutArea);\n\nJSON.stringify(outputs);","description":"One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the height\/width quotient) can vary from 0.8 to 1.25 inclusively. Besides, at least one side of the cut area should have a size, equal to some power of number 2 (2^x for some integer x). If those rules don't indicate the size of the cut are clearly, then the way with which the cut part possesses the largest area is chosen. Of course, both sides of the cut area should be integer. If there are several answers to this problem, you should choose the answer with the maximal height.","input_specification":"The first line contains a pair of integers h and w (1\u2264h,w\u226410^9) which are the height and width of the uploaded photo in pixels.\n","output_specification":"Print two integers which are the height and width of the cut area.\n","notes":null,"sample_inputs":["2 1\n","2 2\n","5 5\n"],"sample_outputs":["1 1\n","2 2\n","5 4\n"],"human_solution":"function cutArea(h, w) {\n let min = Math.min(h, w);\n let max = Math.max(h, w);\n let power = Math.floor(Math.log2(min));\n let minCut = Math.pow(2, power);\n let maxCut = Math.min(max, Math.floor(minCut * 1.25));\n if (maxCut \/ minCut < 0.8) {\n minCut = Math.floor(maxCut \/ 1.25);\n }\n return [maxCut, minCut].sort((a, b) => b - a).join(' ');\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nlet input = [];\nrl.on('line', function (line) {\n input.push(line);\n}).on('close', function () {\n const [h, w] = input[0].split(' ').map(Number);\n console.log(cutArea(h, w));\n process.exit();\n});","testcases":"[{'input': ['2 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['2 2\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['5 4\\r\\n']}, {'input': ['9 10\\r\\n'], 'output': ['8 10\\r\\n']}, {'input': ['15 13\\r\\n'], 'output': ['10 8\\r\\n']}, {'input': ['47 46\\r\\n'], 'output': ['40 32\\r\\n']}, {'input': ['99 100\\r\\n'], 'output': ['80 64\\r\\n']}, {'input': ['939 887\\r\\n'], 'output': ['640 512\\r\\n']}, {'input': ['4774 4806\\r\\n'], 'output': ['4096 4806\\r\\n']}, {'input': ['39271 49032\\r\\n'], 'output': ['32768 40960\\r\\n']}, {'input': ['483242 484564\\r\\n'], 'output': ['327680 262144\\r\\n']}, {'input': ['4939191 4587461\\r\\n'], 'output': ['4939191 4194304\\r\\n']}, {'input': ['9909199 9945873\\r\\n'], 'output': ['8388608 9945873\\r\\n']}, {'input': ['49829224 49889315\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49728622 49605627\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49934587 49239195\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48298903 49928606\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49874820 49474021\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48945079 49798393\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['99692141 99232337\\r\\n'], 'output': ['83886080 67108864\\r\\n']}, {'input': ['998557701 924591072\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['644590722 593296648\\r\\n'], 'output': ['644590722 536870912\\r\\n']}, {'input': ['792322809 775058858\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['971840165 826141527\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['944976601 976175854\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['1000000000 1000000000\\r\\n'], 'output': ['671088640 536870912\\r\\n']}]","id":439} {"difficulty":2100,"lang":"JavaScript","lang_cluster":"JavaScript","src_uid":"5_D","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ Generated by CoffeeScript 1.4.0\n(function() {\n var UniAccel, a, d, l, r, sa, sc, sd, sf, su, sv, sw, td, tf, tu, v, vb, w, _ref, _ref1;\n\n UniAccel = {\n vel_change_disp: function(v0, v1, a) {\n return (v1 * v1 - v0 * v0) \/ (2 * a);\n },\n disp_time: function(s, v0, a) {\n return (Math.sqrt(v0 * v0 + 2 * a * s) - v0) \/ a;\n }\n };\n\n _ref = readline().split(' ').map(function(x) {\n return parseInt(x);\n }), a = _ref[0], v = _ref[1];\n\n _ref1 = readline().split(' ').map(function(x) {\n return parseInt(x);\n }), l = _ref1[0], d = _ref1[1], w = _ref1[2];\n\n sw = UniAccel.vel_change_disp(0, w, a);\n\n sv = UniAccel.vel_change_disp(0, v, a);\n\n if (w > v || sw >= d) {\n if (sv > l) {\n print(1);\n print(UniAccel.disp_time(l, 0, a).toFixed(5));\n } else {\n print(2);\n print((v \/ a + (l - sv) \/ v).toFixed(5));\n }\n } else {\n sf = UniAccel.vel_change_disp(w, v, a);\n tf = 0;\n r = l - d;\n if (sf > r) {\n tf = UniAccel.disp_time(r, w, a);\n } else {\n tf = UniAccel.disp_time(sf, w, a) + (r - sf) \/ v;\n }\n su = UniAccel.vel_change_disp(0, v, a);\n sd = UniAccel.vel_change_disp(v, w, -a);\n sa = su + sd;\n if (sa <= d) {\n print(3);\n sc = d - sa;\n tu = UniAccel.disp_time(su, 0, a);\n td = UniAccel.disp_time(sd, v, -a);\n print((tu + sc \/ v + td + tf).toFixed(5));\n } else {\n print(4);\n vb = Math.sqrt(a * d + (w * w) \/ 2);\n su = UniAccel.vel_change_disp(0, vb, a);\n sd = UniAccel.vel_change_disp(vb, w, -a);\n tu = UniAccel.disp_time(su, 0, a);\n td = UniAccel.disp_time(sd, vb, -a);\n print((tu + td + tf).toFixed(5));\n }\n }\n\n}).call(this);\n","description":"Everybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Traffic signs in Berland are a bit peculiar, because they limit the speed only at that point on the road where they are placed. Right after passing the sign it is allowed to drive at any speed.It is known that the car of an average Berland citizen has the acceleration (deceleration) speed of a km\/h^2, and has maximum speed of v km\/h. The road has the length of l km, and the speed sign, limiting the speed to w km\/h, is placed d km (1\u2264d {\n let t1, t2, t3, t4, t5, t6, t7, t8, t9;\n let v1 = Math.sqrt(2 * a * d);\n let v2 = Math.sqrt(2 * a * (l - d));\n if (v < w) {\n if (v < v1 && v < v2) {\n t1 = v \/ a;\n t2 = (l - a * t1 * t1 \/ 2) \/ v;\n return t1 + t2;\n } else if (v1 < v2) {\n t1 = v1 \/ a;\n t2 = (l - a * t1 * t1 \/ 2) \/ v1;\n return t1 + t2;\n } else {\n t1 = v2 \/ a;\n t2 = (l - a * t1 * t1 \/ 2) \/ v2;\n return t1 + t2;\n }\n } else {\n if (v1 < w) {\n t1 = v1 \/ a;\n t2 = (l - a * t1 * t1 \/ 2) \/ v1;\n return t1 + t2;\n } else {\n t1 = w \/ a;\n t2 = (d - a * t1 * t1 \/ 2) \/ w;\n if (v2 < v) {\n t3 = v2 \/ a;\n t4 = (l - d - a * t3 * t3 \/ 2) \/ v2;\n return t1 + t2 + t3 + t4;\n } else {\n t3 = (v * v - w * w) \/ (2 * a);\n t4 = (l - d - t3) \/ v;\n return t1 + t2 + t3 \/ v + t4;\n }\n }\n }\n}\n\nrl.on('line', (line) => {\n let [a, v] = line.split(' ').map(Number);\n let [l, d, w] = line.split(' ').map(Number);\n console.log(getMinTime(a, v, l, d, w).toFixed(5));\n});","testcases":"[{'input': ['1 1\\r\\n2 1 3\\r\\n'], 'output': ['2.500000000000\\r\\n']}, {'input': ['5 70\\r\\n200 170 40\\r\\n'], 'output': ['8.965874696353\\r\\n']}, {'input': ['6 80\\r\\n100 50 10\\r\\n'], 'output': ['7.312347829731\\r\\n']}, {'input': ['7 80\\r\\n100 50 50\\r\\n'], 'output': ['5.345224838248\\r\\n']}, {'input': ['8 80\\r\\n100 50 199\\r\\n'], 'output': ['5.000000000000\\r\\n']}, {'input': ['200 1000\\r\\n3 2 1\\r\\n'], 'output': ['0.290249882934\\r\\n']}, {'input': ['200 1000\\r\\n3 2 10000\\r\\n'], 'output': ['0.173205080757\\r\\n']}, {'input': ['200 1000\\r\\n1000 500 1023\\r\\n'], 'output': ['3.162277660168\\r\\n']}, {'input': ['200 1000\\r\\n1000 999 10\\r\\n'], 'output': ['4.482261988326\\r\\n']}, {'input': ['20 40\\r\\n10000 1 30\\r\\n'], 'output': ['251.000000000000\\r\\n']}, {'input': ['20 40\\r\\n10000 799 30\\r\\n'], 'output': ['251.125000000000\\r\\n']}, {'input': ['20 40\\r\\n9958 9799 30\\r\\n'], 'output': ['250.075000000000\\r\\n']}, {'input': ['9998 9999\\r\\n3 2 1\\r\\n'], 'output': ['0.042231317453\\r\\n']}, {'input': ['9998 9999\\r\\n3 2 6580\\r\\n'], 'output': ['0.024497347285\\r\\n']}, {'input': ['9998 9999\\r\\n800 40 10000\\r\\n'], 'output': ['0.400040006001\\r\\n']}, {'input': ['9998 9999\\r\\n800 516 124\\r\\n'], 'output': ['0.668565367679\\r\\n']}, {'input': ['4 120\\r\\n5112 3000 130\\r\\n'], 'output': ['57.600000000000\\r\\n']}, {'input': ['4 120\\r\\n5112 3000 113\\r\\n'], 'output': ['57.702083333333\\r\\n']}, {'input': ['9000 1\\r\\n10000 9999 1\\r\\n'], 'output': ['10000.000055555556\\r\\n']}, {'input': ['2 10000\\r\\n270 64 16\\r\\n'], 'output': ['16.431676725155\\r\\n']}, {'input': ['2 20\\r\\n270 64 16\\r\\n'], 'output': ['18.500000000000\\r\\n']}, {'input': ['2 16\\r\\n270 64 16\\r\\n'], 'output': ['20.875000000000\\r\\n']}, {'input': ['2000 10000\\r\\n8000 4000 4000\\r\\n'], 'output': ['2.828427124746\\r\\n']}, {'input': ['2000 4000\\r\\n8000 4000 4000\\r\\n'], 'output': ['3.000000000000\\r\\n']}, {'input': ['2000 10\\r\\n8000 4000 4000\\r\\n'], 'output': ['800.002500000000\\r\\n']}, {'input': ['7143 4847\\r\\n4193 2677 1991\\r\\n'], 'output': ['1.438097228927\\r\\n']}, {'input': ['5744 5873\\r\\n3706 1656 8898\\r\\n'], 'output': ['1.142252435725\\r\\n']}, {'input': ['7992 3250\\r\\n9987 6772 5806\\r\\n'], 'output': ['3.276251405251\\r\\n']}, {'input': ['240 4275\\r\\n6270 1836 6361\\r\\n'], 'output': ['7.228416147400\\r\\n']}, {'input': ['5369 9035\\r\\n1418 879 3344\\r\\n'], 'output': ['0.726785762909\\r\\n']}, {'input': ['7062 9339\\r\\n2920 1289 8668\\r\\n'], 'output': ['0.909374070882\\r\\n']}, {'input': ['8755 9643\\r\\n1193 27 3992\\r\\n'], 'output': ['0.522044043034\\r\\n']}, {'input': ['448 3595\\r\\n2696 1020 5667\\r\\n'], 'output': ['3.469252698452\\r\\n']}, {'input': ['2141 3899\\r\\n968 262 991\\r\\n'], 'output': ['0.967126013479\\r\\n']}, {'input': ['3834 4202\\r\\n2471 607 6315\\r\\n'], 'output': ['1.136044961574\\r\\n']}, {'input': ['5527 8154\\r\\n3974 3550 1639\\r\\n'], 'output': ['1.555031897139\\r\\n']}, {'input': ['7220 8458\\r\\n2246 1326 6963\\r\\n'], 'output': ['0.788771617656\\r\\n']}, {'input': ['8914 8762\\r\\n3749 1899 2287\\r\\n'], 'output': ['1.172208101814\\r\\n']}, {'input': ['607 2714\\r\\n2021 1483 3963\\r\\n'], 'output': ['2.580499677039\\r\\n']}, {'input': ['9788 8432\\r\\n2795 2025 3436\\r\\n'], 'output': ['0.863942827831\\r\\n']}, {'input': ['26 12\\r\\n17 13 29\\r\\n'], 'output': ['1.647435897436\\r\\n']}, {'input': ['12 42\\r\\n6 5 19\\r\\n'], 'output': ['1.000000000000\\r\\n']}, {'input': ['50 22\\r\\n42 1 12\\r\\n'], 'output': ['2.129090909091\\r\\n']}, {'input': ['38 3\\r\\n47 16 4\\r\\n'], 'output': ['15.706140350877\\r\\n']}, {'input': ['24 33\\r\\n35 2 45\\r\\n'], 'output': ['1.748106060606\\r\\n']}, {'input': ['11 13\\r\\n24 15 37\\r\\n'], 'output': ['2.437062937063\\r\\n']}, {'input': ['49 43\\r\\n12 6 30\\r\\n'], 'output': ['0.699854212224\\r\\n']}, {'input': ['35 23\\r\\n17 12 20\\r\\n'], 'output': ['1.078881987578\\r\\n']}, {'input': ['23 4\\r\\n5 2 13\\r\\n'], 'output': ['1.336956521739\\r\\n']}, {'input': ['8 28\\r\\n22 4 29\\r\\n'], 'output': ['2.345207879912\\r\\n']}, {'input': ['38 35\\r\\n16 12 38\\r\\n'], 'output': ['0.917662935482\\r\\n']}, {'input': ['21 41\\r\\n26 18 47\\r\\n'], 'output': ['1.573591584939\\r\\n']}, {'input': ['2 50\\r\\n21 1 6\\r\\n'], 'output': ['4.582575694956\\r\\n']}, {'input': ['32 7\\r\\n15 6 17\\r\\n'], 'output': ['2.252232142857\\r\\n']}, {'input': ['15 13\\r\\n10 3 26\\r\\n'], 'output': ['1.202564102564\\r\\n']}, {'input': ['46 20\\r\\n4 2 35\\r\\n'], 'output': ['0.417028828114\\r\\n']}, {'input': ['26 28\\r\\n46 9 44\\r\\n'], 'output': ['2.181318681319\\r\\n']}, {'input': ['9 35\\r\\n41 22 3\\r\\n'], 'output': ['4.577276992968\\r\\n']}, {'input': ['39 42\\r\\n35 19 12\\r\\n'], 'output': ['1.803482716151\\r\\n']}, {'input': ['28 24\\r\\n31 13 21\\r\\n'], 'output': ['1.733630952381\\r\\n']}]","id":440} {"difficulty":1900,"lang":"Node.js","lang_cluster":"JavaScript","src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","execute_outcome":"RUNTIME_ERROR","source_code":"\"use strict\";\nvar input = '';\nvar inputResolve;\nvar inputPromise = new Promise(resolve => inputResolve = resolve);\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', () => {\n inputResolve();\n});\n(async () => {\n var t = Date.now();\n await inputPromise;\n var inputs = input.split(\/\\r?\\n\/);\n var [n, k] = inputs[0].split(' ').map(v => +v);\n var h = inputs[1].split(' ').map(v => +v);\n var tree = new SplayTree();\n tree.insert(h[0]);\n var max = 1;\n var allRes = [];\n var i = 0, j = 0;\n while (i < n) {\n while (j < n) {\n j++;\n if (!h[j])\n break;\n tree.insert(h[j]);\n if (tree.max() - tree.min() > k)\n break;\n }\n if (max < j - i) {\n max = j - i;\n allRes = [(i + 1) + ' ' + j];\n }\n else if (max == j - i) {\n allRes.push((i + 1) + ' ' + j);\n }\n max = Math.max(j - i, max);\n tree.remove(h[i++]);\n while (tree.max() - tree.min() > k) {\n tree.remove(h[i++]);\n }\n }\n console.log(max, allRes.length);\n console.log(allRes.join('\\n'));\n \/\/ console.log(Date.now() - t)\n})();\nvar SplayTree = eval(`\n(function () {\n var Node = \/** @class *\/ (function () {\n function Node(key, data) {\n this.next = null;\n this.key = key;\n this.data = data;\n this.left = null;\n this.right = null;\n }\n return Node;\n }());\n\n \/* follows \"An implementation of top-down splaying\"\n * by D. Sleator March 1992\n *\/\n function DEFAULT_COMPARE(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n \/**\n * Simple top down splay, not requiring i to be in the tree t.\n *\/\n function splay(i, t, comparator) {\n var N = new Node(null, null);\n var l = N;\n var r = N;\n while (true) {\n var cmp = comparator(i, t.key);\n \/\/if (i < t.key) {\n if (cmp < 0) {\n if (t.left === null)\n break;\n \/\/if (i < t.left.key) {\n if (comparator(i, t.left.key) < 0) {\n var y = t.left; \/* rotate right *\/\n t.left = y.right;\n y.right = t;\n t = y;\n if (t.left === null)\n break;\n }\n r.left = t; \/* link right *\/\n r = t;\n t = t.left;\n \/\/} else if (i > t.key) {\n }\n else if (cmp > 0) {\n if (t.right === null)\n break;\n \/\/if (i > t.right.key) {\n if (comparator(i, t.right.key) > 0) {\n var y = t.right; \/* rotate left *\/\n t.right = y.left;\n y.left = t;\n t = y;\n if (t.right === null)\n break;\n }\n l.right = t; \/* link left *\/\n l = t;\n t = t.right;\n }\n else\n break;\n }\n \/* assemble *\/\n l.right = t.left;\n r.left = t.right;\n t.left = N.right;\n t.right = N.left;\n return t;\n }\n function insert(i, data, t, comparator) {\n var node = new Node(i, data);\n if (t === null) {\n node.left = node.right = null;\n return node;\n }\n t = splay(i, t, comparator);\n var cmp = comparator(i, t.key);\n if (cmp < 0) {\n node.left = t.left;\n node.right = t;\n t.left = null;\n }\n else if (cmp >= 0) {\n node.right = t.right;\n node.left = t;\n t.right = null;\n }\n return node;\n }\n function split(key, v, comparator) {\n var left = null;\n var right = null;\n if (v) {\n v = splay(key, v, comparator);\n var cmp = comparator(v.key, key);\n if (cmp === 0) {\n left = v.left;\n right = v.right;\n }\n else if (cmp < 0) {\n right = v.right;\n v.right = null;\n left = v;\n }\n else {\n left = v.left;\n v.left = null;\n right = v;\n }\n }\n return { left: left, right: right };\n }\n function merge(left, right, comparator) {\n if (right === null)\n return left;\n if (left === null)\n return right;\n right = splay(left.key, right, comparator);\n right.left = left;\n return right;\n }\n var Tree = \/** @class *\/ (function () {\n function Tree(comparator) {\n if (comparator === void 0) { comparator = DEFAULT_COMPARE; }\n this._root = null;\n this._size = 0;\n this._comparator = comparator;\n }\n \/**\n * Inserts a key, allows duplicates\n *\/\n Tree.prototype.insert = function (key, data) {\n this._size++;\n return this._root = insert(key, data, this._root, this._comparator);\n };\n \/**\n * Adds a key, if it is not present in the tree\n *\/\n Tree.prototype.add = function (key, data) {\n var node = new Node(key, data);\n if (this._root === null) {\n node.left = node.right = null;\n this._size++;\n this._root = node;\n }\n var comparator = this._comparator;\n var t = splay(key, this._root, comparator);\n var cmp = comparator(key, t.key);\n if (cmp === 0)\n this._root = t;\n else {\n if (cmp < 0) {\n node.left = t.left;\n node.right = t;\n t.left = null;\n }\n else if (cmp > 0) {\n node.right = t.right;\n node.left = t;\n t.right = null;\n }\n this._size++;\n this._root = node;\n }\n return this._root;\n };\n \/**\n * @param {Key} key\n * @return {Node|null}\n *\/\n Tree.prototype.remove = function (key) {\n this._root = this._remove(key, this._root, this._comparator);\n };\n \/**\n * Deletes i from the tree if it's there\n *\/\n Tree.prototype._remove = function (i, t, comparator) {\n var x;\n if (t === null)\n return null;\n t = splay(i, t, comparator);\n var cmp = comparator(i, t.key);\n if (cmp === 0) { \/* found it *\/\n if (t.left === null) {\n x = t.right;\n }\n else {\n x = splay(i, t.left, comparator);\n x.right = t.right;\n }\n this._size--;\n return x;\n }\n return t; \/* It wasn't there *\/\n };\n \/**\n * Removes and returns the node with smallest key\n *\/\n Tree.prototype.pop = function () {\n var node = this._root;\n if (node) {\n while (node.left)\n node = node.left;\n this._root = splay(node.key, this._root, this._comparator);\n this._root = this._remove(node.key, this._root, this._comparator);\n return { key: node.key, data: node.data };\n }\n return null;\n };\n \/**\n * Find without splaying\n *\/\n Tree.prototype.findStatic = function (key) {\n var current = this._root;\n var compare = this._comparator;\n while (current) {\n var cmp = compare(key, current.key);\n if (cmp === 0)\n return current;\n else if (cmp < 0)\n current = current.left;\n else\n current = current.right;\n }\n return null;\n };\n Tree.prototype.find = function (key) {\n if (this._root) {\n this._root = splay(key, this._root, this._comparator);\n if (this._comparator(key, this._root.key) !== 0)\n return null;\n }\n return this._root;\n };\n Tree.prototype.contains = function (key) {\n var current = this._root;\n var compare = this._comparator;\n while (current) {\n var cmp = compare(key, current.key);\n if (cmp === 0)\n return true;\n else if (cmp < 0)\n current = current.left;\n else\n current = current.right;\n }\n return false;\n };\n Tree.prototype.forEach = function (visitor, ctx) {\n var current = this._root;\n var Q = []; \/* Initialize stack s *\/\n var done = false;\n while (!done) {\n if (current !== null) {\n Q.push(current);\n current = current.left;\n }\n else {\n if (Q.length !== 0) {\n current = Q.pop();\n visitor.call(ctx, current);\n current = current.right;\n }\n else\n done = true;\n }\n }\n return this;\n };\n\n Tree.prototype.range = function (low, high, fn, ctx) {\n var Q = [];\n var compare = this._comparator;\n var node = this._root;\n var cmp;\n while (Q.length !== 0 || node) {\n if (node) {\n Q.push(node);\n node = node.left;\n }\n else {\n node = Q.pop();\n cmp = compare(node.key, high);\n if (cmp > 0) {\n break;\n }\n else if (compare(node.key, low) >= 0) {\n if (fn.call(ctx, node))\n return this; \/\/ stop if smth is returned\n }\n node = node.right;\n }\n }\n return this;\n };\n \/**\n * Returns array of keys\n *\/\n Tree.prototype.keys = function () {\n var keys = [];\n this.forEach(function (_a) {\n var key = _a.key;\n return keys.push(key);\n });\n return keys;\n };\n \/**\n * Returns array of all the data in the nodes\n *\/\n Tree.prototype.values = function () {\n var values = [];\n this.forEach(function (_a) {\n var data = _a.data;\n return values.push(data);\n });\n return values;\n };\n Tree.prototype.min = function () {\n if (this._root)\n return this.minNode(this._root).key;\n return null;\n };\n Tree.prototype.max = function () {\n if (this._root)\n return this.maxNode(this._root).key;\n return null;\n };\n Tree.prototype.minNode = function (t) {\n if (t === void 0) { t = this._root; }\n if (t)\n while (t.left)\n t = t.left;\n return t;\n };\n Tree.prototype.maxNode = function (t) {\n if (t === void 0) { t = this._root; }\n if (t)\n while (t.right)\n t = t.right;\n return t;\n };\n \/**\n * Returns node at given index\n *\/\n Tree.prototype.at = function (index) {\n var current = this._root;\n var done = false;\n var i = 0;\n var Q = [];\n while (!done) {\n if (current) {\n Q.push(current);\n current = current.left;\n }\n else {\n if (Q.length > 0) {\n current = Q.pop();\n if (i === index)\n return current;\n i++;\n current = current.right;\n }\n else\n done = true;\n }\n }\n return null;\n };\n Tree.prototype.next = function (d) {\n var root = this._root;\n var successor = null;\n if (d.right) {\n successor = d.right;\n while (successor.left)\n successor = successor.left;\n return successor;\n }\n var comparator = this._comparator;\n while (root) {\n var cmp = comparator(d.key, root.key);\n if (cmp === 0)\n break;\n else if (cmp < 0) {\n successor = root;\n root = root.left;\n }\n else\n root = root.right;\n }\n return successor;\n };\n Tree.prototype.prev = function (d) {\n var root = this._root;\n var predecessor = null;\n if (d.left !== null) {\n predecessor = d.left;\n while (predecessor.right)\n predecessor = predecessor.right;\n return predecessor;\n }\n var comparator = this._comparator;\n while (root) {\n var cmp = comparator(d.key, root.key);\n if (cmp === 0)\n break;\n else if (cmp < 0)\n root = root.left;\n else {\n predecessor = root;\n root = root.right;\n }\n }\n return predecessor;\n };\n Tree.prototype.clear = function () {\n this._root = null;\n this._size = 0;\n return this;\n };\n Tree.prototype.toList = function () {\n return toList(this._root);\n };\n \/**\n * Bulk-load items. Both array have to be same size\n *\/\n Tree.prototype.load = function (keys, values, presort) {\n if (values === void 0) { values = []; }\n if (presort === void 0) { presort = false; }\n var size = keys.length;\n var comparator = this._comparator;\n \/\/ sort if needed\n if (presort)\n sort(keys, values, 0, size - 1, comparator);\n if (this._root === null) { \/\/ empty tree\n this._root = loadRecursive(keys, values, 0, size);\n this._size = size;\n }\n else { \/\/ that re-builds the whole tree from two in-order traversals\n var mergedList = mergeLists(this.toList(), createList(keys, values), comparator);\n size = this._size + size;\n this._root = sortedListToBST({ head: mergedList }, 0, size);\n }\n return this;\n };\n Tree.prototype.isEmpty = function () { return this._root === null; };\n Object.defineProperty(Tree.prototype, \"size\", {\n get: function () { return this._size; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Tree.prototype, \"root\", {\n get: function () { return this._root; },\n enumerable: true,\n configurable: true\n });\n Tree.prototype.toString = function (printNode) {\n if (printNode === void 0) { printNode = function (n) { return String(n.key); }; }\n var out = [];\n printRow(this._root, '', true, function (v) { return out.push(v); }, printNode);\n return out.join('');\n };\n Tree.prototype.update = function (key, newKey, newData) {\n var comparator = this._comparator;\n var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;\n if (comparator(key, newKey) < 0) {\n right = insert(newKey, newData, right, comparator);\n }\n else {\n left = insert(newKey, newData, left, comparator);\n }\n this._root = merge(left, right, comparator);\n };\n Tree.prototype.split = function (key) {\n return split(key, this._root, this._comparator);\n };\n return Tree;\n }());\n function loadRecursive(keys, values, start, end) {\n var size = end - start;\n if (size > 0) {\n var middle = start + Math.floor(size \/ 2);\n var key = keys[middle];\n var data = values[middle];\n var node = new Node(key, data);\n node.left = loadRecursive(keys, values, start, middle);\n node.right = loadRecursive(keys, values, middle + 1, end);\n return node;\n }\n return null;\n }\n function createList(keys, values) {\n var head = new Node(null, null);\n var p = head;\n for (var i = 0; i < keys.length; i++) {\n p = p.next = new Node(keys[i], values[i]);\n }\n p.next = null;\n return head.next;\n }\n function toList(root) {\n var current = root;\n var Q = [];\n var done = false;\n var head = new Node(null, null);\n var p = head;\n while (!done) {\n if (current) {\n Q.push(current);\n current = current.left;\n }\n else {\n if (Q.length > 0) {\n current = p = p.next = Q.pop();\n current = current.right;\n }\n else\n done = true;\n }\n }\n p.next = null; \/\/ that'll work even if the tree was empty\n return head.next;\n }\n function sortedListToBST(list, start, end) {\n var size = end - start;\n if (size > 0) {\n var middle = start + Math.floor(size \/ 2);\n var left = sortedListToBST(list, start, middle);\n var root = list.head;\n root.left = left;\n list.head = list.head.next;\n root.right = sortedListToBST(list, middle + 1, end);\n return root;\n }\n return null;\n }\n function mergeLists(l1, l2, compare) {\n var head = new Node(null, null); \/\/ dummy\n var p = head;\n var p1 = l1;\n var p2 = l2;\n while (p1 !== null && p2 !== null) {\n if (compare(p1.key, p2.key) < 0) {\n p.next = p1;\n p1 = p1.next;\n }\n else {\n p.next = p2;\n p2 = p2.next;\n }\n p = p.next;\n }\n if (p1 !== null) {\n p.next = p1;\n }\n else if (p2 !== null) {\n p.next = p2;\n }\n return head.next;\n }\n function sort(keys, values, left, right, compare) {\n if (left >= right)\n return;\n var pivot = keys[(left + right) >> 1];\n var i = left - 1;\n var j = right + 1;\n while (true) {\n do\n i++;\n while (compare(keys[i], pivot) < 0);\n do\n j--;\n while (compare(keys[j], pivot) > 0);\n if (i >= j)\n break;\n var tmp = keys[i];\n keys[i] = keys[j];\n keys[j] = tmp;\n tmp = values[i];\n values[i] = values[j];\n values[j] = tmp;\n }\n sort(keys, values, left, j, compare);\n sort(keys, values, j + 1, right, compare);\n }\n\n return Tree;\n\n})();\n`);\n","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"],"human_solution":"\/**\n * 10.12 night\n * https:\/\/codeforces.com\/problemset\/problem\/6\/E\n *\n * reference:\n * https:\/\/codeforces.com\/problemset\/status\/6\/problem\/E\/page\/46?order=BY_PROGRAM_LENGTH_ASC\n * https:\/\/codeforces.com\/problemset\/submission\/6\/94367599\n *\/\n\nfunction For(a, b, fn) {\n if (!fn) return For(0, a - 1, b);\n let res;\n for (let i = a; i <= b; i++) {\n if ((res = fn(i)) != null) return res;\n }\n}\n\nfunction ForR(a, b, fn) {\n if (!fn) return ForR(a - 1, 0, b);\n let res;\n for (let i = a; i >= b; i--) {\n if ((res = fn(i)) != null) return res;\n }\n}\n\nfunction Arr(a, b, fn, init) {\n if (typeof (b) == 'function') return Arr(0, a - 1, b, fn);\n if (b < a) return [];\n let arr = Array(b - a + 1).fill(0);\n if (init) init(arr);\n for (let i = a; i <= b; i++) arr[i] = fn(i, arr);\n return arr;\n}\n\nObject.defineProperty(Object.prototype, '$k', {\n value: function () {\n return Object.keys(this)\n }\n});\nObject.defineProperty(Object.prototype, '$v', {\n value: function () {\n return Object.values(this)\n }\n});\nObject.defineProperty(Object.prototype, '$kv', {\n value: function () {\n return Object.entries(this)\n }\n});\nArray.prototype.sum = function (fn) {\n return this.reduce((p, v) => p + (fn ? fn(v) : v), 0)\n};\nArray.prototype.uniq = function (fn) {\n let set = new Set();\n return this.filter(v => {\n let newValue = !set.has(fn ? fn(v) : v);\n set.add(fn ? fn(v) : v);\n return newValue;\n });\n};\nArray.prototype.toObj = function (fn) {\n return this.map(v => fn ? fn(v) : v).reduce((p, v) => {\n p[v[0]] = v[1];\n return p;\n }, {})\n};\nArray.prototype.min = function (fn) {\n let min = 1e20, index = -1, x;\n for (let i = 0; i < this.length; i++) {\n x = fn ? fn(this[i], i, this) : this[i];\n if (x < min) {\n min = x;\n index = i\n }\n }\n return [this[index], index, min];\n};\nArray.prototype.max = function (fn) {\n let max = -1e20, index = -1, x;\n for (let i = 0; i < this.length; i++) {\n x = fn ? fn(this[i], i, this) : this[i];\n if (x > max) {\n max = x;\n index = i\n }\n }\n return [this[index], index, max];\n};\nArray.prototype.rev = function (first, last) {\n for (let i = first; i < (first + last) \/ 2; i++) {\n [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]\n }\n};\nArray.prototype.set = function (pos, arr) {\n for (let i = pos; i < pos + arr.length; i++) {\n this[i] = arr[i - pos];\n }\n};\nArray.prototype.for = function (a, b, fn) {\n let res;\n for (let i = a; i <= b; i++) {\n if ((res = fn(this[i], i, this)) != null) return res;\n }\n};\nArray.prototype.forR = function (a, b, fn) {\n let res\n for (let i = a; i >= b; i--) {\n if ((res = fn(this[i], i, this)) != null) return res;\n }\n};\n\nfunction gcd(a, b) {\n while (b) [a, b] = [b, a % b];\n return a;\n}\n\nfunction mul(a, b, m) {\n return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m\n}\n\nfunction pow(a, n, m) {\n let r = 1;\n while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]\n return r;\n}\n\nlet MOD = 998244353;\n\nfunction inv(b) {\n for (let a = MOD, u = 0, v = 1, t; b; v = t)\n (t = a \/ b | 0, a -= t * b, u -= t * v, t = a, a = b, b = t, t = u, u = v);\n return (u + MOD) % MOD;\n}\n\nlet input = '';\nprocess.stdin.on('data', c => input += c);\nprocess.stdin.on('end', main);\n\nfunction main() {\n let inp = input.split(\/\\s+\/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],\n out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, min = Math.min, max = Math.max,\n abs = Math.abs;\n\n let [n, k] = $(2), h = $(n), tree = new AVLTree();\n tree.insert(h[0]);\n let Max = 1;\n let allRes = [];\n let i = 0, j = 0;\n while (i < n) {\n while (j < n) {\n j++;\n if (!h[j]) break;\n tree.insert(h[j]);\n if (tree.max() - tree.min() > k) break;\n }\n if (Max < j - i) {\n Max = j - i;\n allRes = [(i + 1) + ' ' + j];\n } else if (Max == j - i) {\n allRes.push((i + 1) + ' ' + j);\n }\n Max = max(j - i, Max);\n tree.remove(h[i++]);\n while (tree.max() - tree.min() > k) {\n tree.remove(h[i++]);\n }\n }\n log(Max, allRes.length);\n log(allRes.join('\\n'));\n}\n\n\n\nlet AVLTree = (function () {\n function print(root, printNode) {\n if (printNode === void 0) printNode = function (n) {\n return n.key;\n };\n\n let out = [];\n row(root, '', true, function (v) {\n return out.push(v);\n }, printNode);\n return out.join('');\n }\n\n function isBalanced(root) {\n if (root === null) {\n return true;\n }\n let lh = height(root.left);\n let rh = height(root.right);\n if (Math.abs(lh - rh) <= 1 &&\n isBalanced(root.left) &&\n isBalanced(root.right)) {\n return true;\n }\n return false;\n }\n\n function height(node) {\n return node ? (1 + Math.max(height(node.left), height(node.right))) : 0;\n }\n\n function loadRecursive(parent, keys, values, start, end) {\n let size = end - start;\n if (size > 0) {\n let middle = start + Math.floor(size \/ 2);\n let key = keys[middle];\n let data = values[middle];\n let node = { key: key, data: data, parent: parent };\n node.left = loadRecursive(node, keys, values, start, middle);\n node.right = loadRecursive(node, keys, values, middle + 1, end);\n return node;\n }\n return null;\n }\n\n function markBalance(node) {\n if (node === null) {\n return 0;\n }\n let lh = markBalance(node.left);\n let rh = markBalance(node.right);\n\n node.balanceFactor = lh - rh;\n return Math.max(lh, rh) + 1;\n }\n\n function sort(keys, values, left, right, compare) {\n if (left >= right) {\n return;\n }\n let pivot = keys[(left + right) >> 1];\n let i = left - 1;\n let j = right + 1;\n while (true) {\n do {\n i++;\n } while (compare(keys[i], pivot) < 0);\n do {\n j--;\n } while (compare(keys[j], pivot) > 0);\n if (i >= j) {\n break;\n }\n let tmp = keys[i];\n keys[i] = keys[j];\n keys[j] = tmp;\n\n tmp = values[i];\n values[i] = values[j];\n values[j] = tmp;\n }\n\n sort(keys, values, left, j, compare);\n sort(keys, values, j + 1, right, compare);\n }\n\n function DEFAULT_COMPARE(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function rotateLeft(node) {\n let rightNode = node.right;\n node.right = rightNode.left;\n\n if (rightNode.left) {\n rightNode.left.parent = node;\n }\n\n rightNode.parent = node.parent;\n if (rightNode.parent) {\n if (rightNode.parent.left === node) {\n rightNode.parent.left = rightNode;\n } else {\n rightNode.parent.right = rightNode;\n }\n }\n\n node.parent = rightNode;\n rightNode.left = node;\n\n node.balanceFactor += 1;\n if (rightNode.balanceFactor < 0) {\n node.balanceFactor -= rightNode.balanceFactor;\n }\n\n rightNode.balanceFactor += 1;\n if (node.balanceFactor > 0) {\n rightNode.balanceFactor += node.balanceFactor;\n }\n return rightNode;\n }\n\n function rotateRight(node) {\n let leftNode = node.left;\n node.left = leftNode.right;\n if (node.left) {\n node.left.parent = node;\n }\n\n leftNode.parent = node.parent;\n if (leftNode.parent) {\n if (leftNode.parent.left === node) {\n leftNode.parent.left = leftNode;\n } else {\n leftNode.parent.right = leftNode;\n }\n }\n\n node.parent = leftNode;\n leftNode.right = node;\n\n node.balanceFactor -= 1;\n if (leftNode.balanceFactor > 0) {\n node.balanceFactor -= leftNode.balanceFactor;\n }\n\n leftNode.balanceFactor -= 1;\n if (node.balanceFactor < 0) {\n leftNode.balanceFactor += node.balanceFactor;\n }\n\n return leftNode;\n }\n\n let AVLTree = function AVLTree(comparator, noDuplicates) {\n if (noDuplicates === void 0) noDuplicates = false;\n\n this._comparator = comparator || DEFAULT_COMPARE;\n this._root = null;\n this._size = 0;\n this._noDuplicates = !!noDuplicates;\n };\n\n let prototypeAccessors = { size: { configurable: true } };\n\n AVLTree.prototype.destroy = function destroy() {\n return this.clear();\n };\n\n AVLTree.prototype.clear = function clear() {\n this._root = null;\n this._size = 0;\n return this;\n };\n\n prototypeAccessors.size.get = function () {\n return this._size;\n };\n\n AVLTree.prototype.contains = function contains(key) {\n if (this._root) {\n let node = this._root;\n let comparator = this._comparator;\n while (node) {\n let cmp = comparator(key, node.key);\n if (cmp === 0) {\n return true;\n } else if (cmp < 0) {\n node = node.left;\n } else {\n node = node.right;\n }\n }\n }\n return false;\n };\n\n AVLTree.prototype.next = function next(node) {\n let successor = node;\n if (successor) {\n if (successor.right) {\n successor = successor.right;\n while (successor.left) {\n successor = successor.left;\n }\n } else {\n successor = node.parent;\n while (successor && successor.right === node) {\n node = successor;\n successor = successor.parent;\n }\n }\n }\n return successor;\n };\n\n AVLTree.prototype.prev = function prev(node) {\n let predecessor = node;\n if (predecessor) {\n if (predecessor.left) {\n predecessor = predecessor.left;\n while (predecessor.right) {\n predecessor = predecessor.right;\n }\n } else {\n predecessor = node.parent;\n while (predecessor && predecessor.left === node) {\n node = predecessor;\n predecessor = predecessor.parent;\n }\n }\n }\n return predecessor;\n };\n\n\n AVLTree.prototype.forEach = function forEach(callback) {\n let current = this._root;\n let s = [], done = false, i = 0;\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n callback(current, i++);\n current = current.right;\n } else {\n done = true;\n }\n }\n }\n return this;\n };\n\n AVLTree.prototype.range = function range(low, high, fn, ctx) {\n let this$1 = this;\n let Q = [];\n let compare = this._comparator;\n let node = this._root, cmp;\n while (Q.length !== 0 || node) {\n if (node) {\n Q.push(node);\n node = node.left;\n } else {\n node = Q.pop();\n cmp = compare(node.key, high);\n if (cmp > 0) {\n break;\n } else if (compare(node.key, low) >= 0) {\n if (fn.call(ctx, node)) {\n return this$1;\n }\n }\n node = node.right;\n }\n }\n return this;\n };\n\n AVLTree.prototype.keys = function keys() {\n let current = this._root;\n let s = [], r = [], done = false;\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.key);\n current = current.right;\n } else {\n done = true;\n }\n }\n }\n return r;\n };\n\n AVLTree.prototype.values = function values() {\n let current = this._root;\n let s = [], r = [], done = false;\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.data);\n current = current.right;\n } else {\n done = true;\n }\n }\n }\n return r;\n };\n\n AVLTree.prototype.at = function at(index) {\n let current = this._root;\n let s = [], done = false, i = 0;\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n if (i === index) {\n return current;\n }\n i++;\n current = current.right;\n } else {\n done = true;\n }\n }\n }\n return null;\n };\n\n AVLTree.prototype.minNode = function minNode() {\n let node = this._root;\n if (!node) {\n return null;\n }\n while (node.left) {\n node = node.left;\n }\n return node;\n };\n\n AVLTree.prototype.maxNode = function maxNode() {\n let node = this._root;\n if (!node) {\n return null;\n }\n while (node.right) {\n node = node.right;\n }\n return node;\n };\n\n AVLTree.prototype.min = function min() {\n let node = this._root;\n if (!node) {\n return null;\n }\n while (node.left) {\n node = node.left;\n }\n return node.key;\n };\n\n AVLTree.prototype.max = function max() {\n let node = this._root;\n if (!node) {\n return null;\n }\n while (node.right) {\n node = node.right;\n }\n return node.key;\n };\n\n AVLTree.prototype.isEmpty = function isEmpty() {\n return !this._root;\n };\n\n AVLTree.prototype.pop = function pop() {\n let node = this._root, returnValue = null;\n if (node) {\n while (node.left) {\n node = node.left;\n }\n returnValue = { key: node.key, data: node.data };\n this.remove(node.key);\n }\n return returnValue;\n };\n\n AVLTree.prototype.find = function find(key) {\n let root = this._root;\n let subtree = root, cmp;\n let compare = this._comparator;\n while (subtree) {\n cmp = compare(key, subtree.key);\n if (cmp === 0) {\n return subtree;\n } else if (cmp < 0) {\n subtree = subtree.left;\n } else {\n subtree = subtree.right;\n }\n }\n\n return null;\n };\n\n AVLTree.prototype.insert = function insert(key, data) {\n let this$1 = this;\n if (!this._root) {\n this._root = {\n parent: null, left: null, right: null, balanceFactor: 0,\n key: key, data: data\n };\n this._size++;\n return this._root;\n }\n\n let compare = this._comparator;\n let node = this._root;\n let parent = null;\n let cmp = 0;\n\n if (this._noDuplicates) {\n while (node) {\n cmp = compare(key, node.key);\n parent = node;\n if (cmp === 0) {\n return null;\n } else if (cmp < 0) {\n node = node.left;\n } else {\n node = node.right;\n }\n }\n } else {\n while (node) {\n cmp = compare(key, node.key);\n parent = node;\n if (cmp <= 0) {\n node = node.left;\n } \/\/return null;\n else {\n node = node.right;\n }\n }\n }\n\n let newNode = {\n left: null,\n right: null,\n balanceFactor: 0,\n parent: parent, key: key, data: data\n };\n let newRoot;\n if (cmp <= 0) {\n parent.left = newNode;\n } else {\n parent.right = newNode;\n }\n\n while (parent) {\n cmp = compare(parent.key, key);\n if (cmp < 0) {\n parent.balanceFactor -= 1;\n } else {\n parent.balanceFactor += 1;\n }\n\n if (parent.balanceFactor === 0) {\n break;\n } else if (parent.balanceFactor < -1) {\n if (parent.right.balanceFactor === 1) {\n rotateRight(parent.right);\n }\n newRoot = rotateLeft(parent);\n if (parent === this$1._root) {\n this$1._root = newRoot;\n }\n break;\n } else if (parent.balanceFactor > 1) {\n if (parent.left.balanceFactor === -1) {\n rotateLeft(parent.left);\n }\n newRoot = rotateRight(parent);\n\n if (parent === this$1._root) {\n this$1._root = newRoot;\n }\n break;\n }\n parent = parent.parent;\n }\n\n this._size++;\n return newNode;\n };\n\n AVLTree.prototype.remove = function remove(key) {\n let this$1 = this;\n if (!this._root) {\n return null;\n }\n let node = this._root;\n let compare = this._comparator;\n let cmp = 0;\n while (node) {\n cmp = compare(key, node.key);\n if (cmp === 0) {\n break;\n } else if (cmp < 0) {\n node = node.left;\n } else {\n node = node.right;\n }\n }\n if (!node) {\n return null;\n }\n\n let returnValue = node.key;\n let max, min;\n\n if (node.left) {\n max = node.left;\n\n while (max.left || max.right) {\n while (max.right) {\n max = max.right;\n }\n\n node.key = max.key;\n node.data = max.data;\n if (max.left) {\n node = max;\n max = max.left;\n }\n }\n\n node.key = max.key;\n node.data = max.data;\n node = max;\n }\n\n if (node.right) {\n min = node.right;\n\n while (min.left || min.right) {\n while (min.left) {\n min = min.left;\n }\n\n node.key = min.key;\n node.data = min.data;\n if (min.right) {\n node = min;\n min = min.right;\n }\n }\n\n node.key = min.key;\n node.data = min.data;\n node = min;\n }\n\n let parent = node.parent;\n let pp = node;\n let newRoot;\n\n while (parent) {\n if (parent.left === pp) {\n parent.balanceFactor -= 1;\n } else {\n parent.balanceFactor += 1;\n }\n\n if (parent.balanceFactor < -1) {\n if (parent.right.balanceFactor === 1) {\n rotateRight(parent.right);\n }\n newRoot = rotateLeft(parent);\n\n if (parent === this$1._root) {\n this$1._root = newRoot;\n }\n parent = newRoot;\n } else if (parent.balanceFactor > 1) {\n if (parent.left.balanceFactor === -1) {\n rotateLeft(parent.left);\n }\n newRoot = rotateRight(parent);\n if (parent === this$1._root) {\n this$1._root = newRoot;\n }\n parent = newRoot;\n }\n if (parent.balanceFactor === -1 || parent.balanceFactor === 1) {\n break;\n }\n pp = parent;\n parent = parent.parent;\n }\n\n if (node.parent) {\n if (node.parent.left === node) {\n node.parent.left = null;\n } else {\n node.parent.right = null;\n }\n }\n\n if (node === this._root) {\n this._root = null;\n }\n\n this._size--;\n return returnValue;\n };\n\n AVLTree.prototype.load = function load(keys, values, presort) {\n if (keys === void 0) keys = [];\n if (values === void 0) values = [];\n\n if (this._size !== 0) {\n throw new Error('bulk-load: tree is not empty');\n }\n let size = keys.length;\n if (presort) {\n sort(keys, values, 0, size - 1, this._comparator);\n }\n this._root = loadRecursive(null, keys, values, 0, size);\n markBalance(this._root);\n this._size = size;\n return this;\n };\n\n AVLTree.prototype.isBalanced = function isBalanced$1() {\n return isBalanced(this._root);\n };\n\n AVLTree.prototype.toString = function toString(printNode) {\n return print(this._root, printNode);\n };\n\n Object.defineProperties(AVLTree.prototype, prototypeAccessors);\n\n AVLTree.default = AVLTree;\n\n return AVLTree;\n\n})();\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":441} {"difficulty":1000,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"0515ac888937a4dda30cad5e2383164f","execute_outcome":"WRONG_ANSWER","source_code":"fun main() {\n val (n, k) = readLine()!!\n .split(\" \")\n .map { it.toInt() }\n val s = readLine()!!\n var cnv = 0\n var ans = \"1\"\n for (i in 0 until n) {\n if (i == 0) {\n if (s[i] != '1') {\n cnv += 1\n }\n continue\n } else {\n if (s[i] != '0') {\n cnv += 1\n }\n ans += \"0\"\n }\n if (cnv == k) {\n ans += s.substring(i + 1)\n break\n }\n }\n println(if (ans == \"1\") \"0\" else ans)\n}\n","description":"Ania has a large integer $$$S$$$. Its decimal representation has length $$$n$$$ and doesn't contain any leading zeroes. Ania is allowed to change at most $$$k$$$ digits of $$$S$$$. She wants to do it in such a way that $$$S$$$ still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq n \\leq 200\\,000$$$, $$$0 \\leq k \\leq n$$$) \u2014 the number of digits in the decimal representation of $$$S$$$ and the maximum allowed number of changed digits. The second line contains the integer $$$S$$$. It's guaranteed that $$$S$$$ has exactly $$$n$$$ digits and doesn't contain any leading zeroes.","output_specification":"Output the minimal possible value of $$$S$$$ which Ania can end with. Note that the resulting integer should also have $$$n$$$ digits.","notes":"NoteA number has leading zeroes if it consists of at least two digits and its first digit is $$$0$$$. For example, numbers $$$00$$$, $$$00069$$$ and $$$0101$$$ have leading zeroes, while $$$0$$$, $$$3000$$$ and $$$1010$$$ don't have leading zeroes.","sample_inputs":["5 3\n51528","3 2\n102","1 1\n1"],"sample_outputs":["10028","100","0"],"human_solution":"private fun readLn() = readLine()!! \/\/ string line\nprivate fun readInt() = readLn().toInt() \/\/ single int\nprivate fun readLong() = readLn().toLong() \/\/ single long\nprivate fun readStrings() = readLn().split(\" \") \/\/ list of strings\n\nprivate fun readInts() = readStrings().map { it.toInt() } \/\/ list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } \/\/ list of Longs\n\nvar n = 0\n\n\nfun main() {\n\n var (n, k) = readInts()\n\n val s = readLine()!!\n\n val sb = StringBuilder()\n\n if (s.length == 1){\n if (k > 0){\n print(\"0\")\n } else {\n print(s)\n }\n return\n }\n\n for ((i, c) in s.withIndex()) {\n if (k == 0) {\n sb.append(c)\n continue\n }\n\n if (i == 0) {\n if (c != '1') {\n sb.append('1')\n k--\n } else {\n sb.append(c)\n }\n } else if (c != '0') {\n k--\n sb.append('0')\n } else {\n sb.append(c)\n }\n }\n\n print(sb)\n}\n","testcases":"[{'input': '5 3\\r\\n51528\\r\\n', 'output': ['10028']}, {'input': '3 2\\r\\n102\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '8 3\\r\\n76185080\\r\\n', 'output': ['10085080']}, {'input': '10 9\\r\\n6605076924\\r\\n', 'output': ['1000000000']}, {'input': '17 14\\r\\n70419129275429261\\r\\n', 'output': ['10000000000000061']}, {'input': '199998 156775\\r\\n7634835512546227964243675139267315515577320237799637891529762314202017056236453683463308322179478107714532692736127575938520704751962381411698645433174487533559358321355930286745679211230306497827539374809663293796414447998709546787238564494719936067978838018924333308448159811275761513662350712828112159370994524797946201631497195474204565415159556215408393442798737977256084296355518425255430478805792621099352145489884245660406882249088247622551866815094192404242822804505500195699678136715085...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 2\\r\\n771112621109427812643673718074851764530689179759522591776981347807280232051563479817701294504068444683925657775712189272916643598581280840476981946390136592530160890213039665570819989634882772014581123884548476129114444089853125242596962777622415395884132936832620353838491107480004705925531447086202872507603787398475272973977883161172711023044040076388597092521402114312141786014676329287040828537689063290700494627878117322477780331244252157257615979675788502631313114376908083415265271825142311855...', 'output': ['1011126211094278126436737180748517645306891797595225917769813478072802320515634798177012945040684446839256577757121892729166435985812808404769819463901365925301608902130396655708199896348827720145811238845484761291144440898531252425969627776224153958841329368326203538384911074800047059255314470862028725076037873984752729739778831611727110230440400763885970925214021143121417860146763292870408285376890632907004946278781173224777803312442521572576159796757885026313131143769080834152652718251423118555804948582...']}, {'input': '200000 187545\\r\\n1301932000014086050003493008300090088600008905090000090726720050602018004305000000700039502080000000000804105230405000900500088030035200500800855026204010050500010740072080660018636955073996700000035002008600100300004080060050758040037000509580004102081000660006058000482268044600010070000000600070000003080064000030800000680000750000004322050608600400970480084802503000000400630507000200002000001005804040800800090005802057000428580020800925000000629700040000413000100370770900000020000090020500...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 108920\\r\\n1000060080705000000204167000210030260410030008740020004440300400704400002246004600000000280000009000003000600100402000001018908014000000000700009400007010506000008040000081093000007290200799770220020090000090000003750029800400018800610035060000778074010010070342570100000309000400900109573300780000002000580000008110565008609045902500004700309400341000270000800541701003044061539000504007102204600020200000000410080008800040014043020001740001009909604006083100000306000008080010000306019090006920...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 0\\r\\n256460096885481118333385694194593424724739000857078402894729701905592008141621922999353883420223647081763072129620176745092485803472555520197554536813418150418668888561749524693799305459423468508526178216363770325370737637707298927860518980996754247764234637679566129316759583799946805627150829867078807856652337888873045390190273863335903317485821289778295646610247705331477977491374901408118245671900293927177708527564320879813680266512784477174618257362818880763121593493992240288309416423252322589...', 'output': ['2564600968854811183333856941945934247247390008570784028947297019055920081416219229993538834202236470817630721296201767450924858034725555201975545368134181504186688885617495246937993054594234685085261782163637703253707376377072989278605189809967542477642346376795661293167595837999468056271508298670788078566523378888730453901902738633359033174858212897782956466102477053314779774913749014081182456719002939271777085275643208798136802665127844771746182573628188807631215934939922402883094164232523225896946463143...']}, {'input': '1 0\\r\\n1\\r\\n', 'output': ['1']}, {'input': '1 1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '2 1\\r\\n16\\r\\n', 'output': ['10']}, {'input': '199998 1\\r\\n393793459125730434817326505196085664401836690611040699365444699554396567481294672734190867935101303782403762614914695106676085805233526531077883925316679432454645499725035536054511270853595067746389612754512677963407959910298501740600753730291829759092013350224236537453749695855228708627576745877006835358665778204750554336289003281805557831681316447819422395981821587041818138679267179845673476645222792419445270267854570200477975677775848636560868302397070651219976608387583798999637359541316043303...', 'output': ['1937934591257304348173265051960856644018366906110406993654446995543965674812946727341908679351013037824037626149146951066760858052335265310778839253166794324546454997250355360545112708535950677463896127545126779634079599102985017406007537302918297590920133502242365374537496958552287086275767458770068353586657782047505543362890032818055578316813164478194223959818215870418181386792671798456734766452227924194452702678545702004779756777758486365608683023970706512199766083875837989996373595413160433037914192167...']}, {'input': '1 0\\r\\n0\\r\\n', 'output': ['0']}, {'input': '400 224\\r\\n3403471829631665055630257676709588054274069759668265706060902871201473941465824155677441158274936877159724887320158357490042422725165554784088776427589353335344063521672837620180854587939835953567037285547297153069505169565026205894046634052941764635777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118\\r\\n', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118']}, {'input': '1 0\\r\\n7\\r\\n', 'output': ['7']}, {'input': '30001 3687\\r\\n4879192340040210090371839649725898645819068470953339807944387968566809980170694714689568391058070568669565556001147862733255297572185796382230959350902061126937291655379996336535818031441002901288810081315372322742150381341152172532929586842038085743018527749089883673304076590435577643595823925084516541240697072236066890237191637478444052629650299572670262123127495201287721836078729470595572382868026441586623803689911342230360110538673179021296182761497570880783531361319832799494113744343814346...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '1 1\\r\\n9\\r\\n', 'output': ['0']}, {'input': '200000 38987\\r\\n76547795344979180295054210128630519504720553087786617591179063355165277050010800500919098736157692909606440488419230571151305874941386099145638002486943253041385929903189240704372570279164739070920245500523417056463480725895142260414739614203125827132260399332409961148788603352128175214468463293051554232404622569836095853346138387735994831271987736838622488963205796989636461581587213002982703456678244029796890854541824300618965779648737201358064901552552135936371807846933513367765608458110676...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n6460919550116632947975329737843793545236004047782108596534898123057253397260469884887006447373686860765441991750069970261923059655977307450939819192459072743822235871752239218106124430454880896265366218869237362174028558375318768755925219864762612285510997026013758388494629568802512355717750245845107715580333327502926161629218455221202583429645434847277896131705531441501475955858572369832897721621131980865577036189025532131971953553814709481914469596257388306747828391809722245306699413411356...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 180000\\r\\n9286117824715039989999736422374781884612984621858762074834566600961603517152352735549120665833482175119005317968171609951234595077176340999613167085078113630149499963897453833136536185540829393433131144347288914693721741432644933889416271480298131676680040597613465738188321726645084008821977045447857551641906525603448963266537865723315776809482680723682113527494815672911819578085994601036108229286294416703575942970998720095863251394147350975897963975493513231689411282318956457883748074239936...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '5 4\\r\\n39837\\r\\n', 'output': ['10007']}, {'input': '50 30\\r\\n57206210120809502631460958076295309729525641641207\\r\\n', 'output': ['10000000000000000000000000000000000000525641641207']}, {'input': '1007 227\\r\\n369799753553096434212687991038890334035927231543168858070363240543707094851004011833546324278654842112185372843388625808742617383357633200469817324198361676851033219633460115249216685327348387483420593801099766213228912614693858934416795750496016581432964640991389901515295952359505287110013873006017098823518143738023806132465622999469686472455422850159238870901537707018878862333427679379258787429175993594228281458543965661564527149998125389241781729944715267138852336209263357013249353365630301197...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004329646409913899015152959523595052871100138730060170988235181437380238061324656229994696864724554228501592388709015377070188788623334276793792587874291759935942282814585439656615645271499981253892417817299447152671388523362092633570132493533656303011977386208557...']}, {'input': '200000 115883\\r\\n2827598722404843878394338738400265508106504152501270300221275146405910260468705816133192242761521885478231751746733067543198108040164336590532649752514637122116183049796533213177428365653624032802274504819895081417821483054448617694493086660221342348252961651777999310547071904394447885642496063169952269344168248485570225037351961780490886353728688696791957504642834707407902831439040324401593442009455549209814087473740461121097636313114425724581495619327798682412667883550806628933794919641259...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 189016\\r\\n8416570810017947799345366245078545563060867951133843463654077942101407592653938857977547381029040691849115146855959823582926802977252493901665144141970754517157599890945319344469867753613264046987787640052143993567764617851230536541653443136278486466556306793654923504647164029627821833277786952281911088641656772278631961340215855281140528251402412512927863990092036900991949353394435401099491371631409700722234576482621310820225343236454865691230822555516565709427343903368050866632422516548258...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 167461\\r\\n3206034925895567066888019409555989055917283638539640987330840691986340901091285419615291003659395213547844117278189300000448972461050871482816547410380426547709241564981816209111235849764373041087269479006869844988533891914109097219526276297728401721820429870716530719442072568598657571188900284564564598745870786857232505646728989857796675717471643943277223802206690334370807779370367768124252032251265638353636571475165110321018144037214277697268552443843181594498917633998597790442500539400524...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 21257\\r\\n44238960540540399079380242266731890700609403619472760007061267571428334037102918118752841521938648875551027597345220240908862764992885902871379464657862623367496599353782269710632200373004719407545316738755312387383814463173569764303033377637752411311816380248291023629183766989210112931198686632466234288853956206441696813735148071146419670152515759258185718973302514749658468772753904356563283604788308404726875408100418719283160487507951147249719290590821488722695303392048575123466568873086805...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 44357\\r\\n93333192597026512176815315293321734076497304923578001284021054296259224275585800839794398341409078876994334203979905365584045106874714895982250663201231184557035827543194251454094227697985895358234195034291595869308581214790550473721423513798474163524284955776857005795032871710866852351639387239633644520469116345457022619176007318426990358530241027423401935295649358641417228997507447929003896390875027755861897034241802774873465494445856936268435579453157280432124684728711434457495750468741969...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199033\\r\\n9562475203625759746707785966654413048735096081794862651254941808251820762773935427336876973684436897689371203248974318238246237695069165133400485413602104140143788767778225877751617574119145493578782177450427992509861796676189366615328753903844704324959837649108323782873361897137809322915297840041401157146037172352953907682526984141304190711584060218096282515834339047498067515566837279395849437620451737762461342815506022514957516109855972163698584716904813928943681292087902463663438317932736...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 170000\\r\\n3913915994642697697068963716167447315467551489827800141559679559075740187983956330933176444195368834633971243230038152411012393823719029418928176806191130256121684431281388232758427708370450251279891286938341958980524672861384032979614504035143487945567588388365457227518415795423587413884635833455433955608933042928701966518829427448161236453167057098435014584458826943662674175676728265459598337668185029005721022505587759835093144219035819689601313026735782513243943394741063330555806376207658...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199997 190000\\r\\n2611566865624277085686743605084826361393478369330618445377254081355948171705185770366238370879604476405532972172684641535374648236073859897122593987641677216626971177570245111474701939613364722185246632577785379726413466571867339419697213701866787984064673743403069775130439828526057608245054485455644600298905641341911565951517745699909161462338230794579418191139865987264464782699342660463557293538565289896039262820158236693272255963501987670682930198614286125250562177178065109415863812573667...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199998\\r\\n5226295693272515932955906141172464664794325832463650925111357112660308794448535195539499902492266941035983585725090710160650749337604021144987925265375618330734221762004307435246532165634575179128547059807918762778771255467658504849956368939758887537175055104228887917312939399327925422637266391391743214324093433782448530821995504679841305590835338381300556636358933189575787051381364261348518393185561193905124721917500955091301228889880860201268208287603358978753985359622263972937993927354483...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 10261\\r\\n10072000970000600012706000002096008764300020900840080007092000500404000008000000000058215800062975440087090007216000010450009000100152740043008300442809848046940095504241070540209206108000400009061023608710600000008000739000281008000081050150000600581000000000026768009302006200820021015000650000000014801028000209808700050003000608737000000002230210000264500057005000707000700008080060000000008902000006006018004000001305159213907000008001900000000500150090000030604300206080050098002064003000088...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 87158\\r\\n24022000060085800102807501265840001010660000990000075050800000050000104016020008040060003060533052080752009000160608020002930000425767816883560204970012552065000440001775040236070986700007003003000055000000500010660006434130600900754300009002640200600030000005005406000478006100005001909107007800083009060016008725602000501002100425600004070409700060060131600002004000007960000048000206066940320009042906209000000001400010004077070001024072030050277000900090001854310980000400002600060901500935600...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 123819\\r\\n1000070000038093004000489005400500000690010077000950100907070080030100103810020000649050100097804009063040254000763000004003900040200030050200700009050092000800000607007000050639048800000540060050000000004400008760070200005463300000079205004576000606260000004600004054780570200230200030077000002072008000827661200000007048000000050000047000600100000030037100600065690003000642009060090000048050830600408900000100000360000009800600000250700000900951850405808004000000015375098007208602000156000105...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 84557\\r\\n36000600000001000020005906800030000001570004000200510500000007040211030001040800002409032000400020803501000800000000009040041529110793500000000069108000008502150000860730009500000050850800000007069248000000008000869904000206010009007000204103007000002000700348002440500004300700007000002099603978650030105060610364190000400907011050000044000104005820000000901004024070207200803808481000091401451400000012601005030200460000000108517087700604009024018006849508980303043027241010077700240000003064905...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 868\\r\\n1400001060200017042503601108900020100040080600020600070005000720200014700368022601100604202000034030646070030004703402370672066280800000107022001306005041320180021000600247100020000200050067020686200039940000604150005000060000004010008000900970050906085000044341000008096900906000702001004008277044100018066606702164909050030000877043310700501260005088040300300410780082000903300009561401850001000000059060003070303400055060904000003061709030560801020000009000000017401033309079008076000008470000005...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 156059\\r\\n1706005864440400040010560020000000000020024050070200005900000080003050050901004004087110966504007872090016909000000000000500088077000080070146300001616490072754010259900700302000036704704352050496030060280260000080502100000010100210000005700000800018504040700600000012235908002009004608220500900170100560200090002103004060500730030505000804280800404069023000570035471164041700000050010900000075060003000900000109500000064005000032088407907002440350607570790800100000000009200000230092078830285403...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 200000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '200000 200000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '200000 200000\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 7\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '2 2\\r\\n10\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n10000\\r\\n', 'output': ['10000']}, {'input': '1 1\\r\\n5\\r\\n', 'output': ['0']}, {'input': '2 2\\r\\n99\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n55555\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n123\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '4 4\\r\\n1111\\r\\n', 'output': ['1000']}, {'input': '4 4\\r\\n1234\\r\\n', 'output': ['1000']}, {'input': '5 5\\r\\n11111\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n12345\\r\\n', 'output': ['10000']}, {'input': '2 1\\r\\n99\\r\\n', 'output': ['19']}, {'input': '6 6\\r\\n123456\\r\\n', 'output': ['100000']}, {'input': '1 0\\r\\n5\\r\\n', 'output': ['5']}, {'input': '5 5\\r\\n56789\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n555\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n185\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n888\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n99999\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n11234\\r\\n', 'output': ['10000']}, {'input': '4 4\\r\\n9999\\r\\n', 'output': ['1000']}, {'input': '1 1\\r\\n8\\r\\n', 'output': ['0']}, {'input': '5 5\\r\\n51528\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n100\\r\\n', 'output': ['100']}, {'input': '6 2\\r\\n123456\\r\\n', 'output': ['100456']}, {'input': '2 2\\r\\n11\\r\\n', 'output': ['10']}, {'input': '3 3\\r\\n999\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n65412\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n111\\r\\n', 'output': ['100']}, {'input': '4 4\\r\\n5555\\r\\n', 'output': ['1000']}, {'input': '10 5\\r\\n1000054300\\r\\n', 'output': ['1000000000']}, {'input': '5 5\\r\\n54321\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n300\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '1 0\\r\\n2\\r\\n', 'output': ['2']}]","id":442} {"difficulty":1400,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"08f1ba79ced688958695a7cfcfdda035","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val l = r.readLine()!!.toInt()\n val day = r.readLine()!!.split(\" \").map { it.toInt() }\n fun f(i: Int, type: Int): Int =\n when{\n i == l-1 -> if (type==day[i]||day[i]==3) 0 else 1\n type==day[i]||day[i]==3 -> f(i+1, 3-type)\n else -> 1+ minOf(f(i+1, type), f(i+1, 3-type))\n }\n println(minOf(f(0, 1), f(0, 2)))\n}","description":"Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options: on this day the gym is closed and the contest is not carried out; on this day the gym is closed and the contest is carried out; on this day the gym is open and the contest is not carried out; on this day the gym is open and the contest is carried out. On each of days Vasya can either have a rest or write the contest (if it is carried out on this day), or do sport (if the gym is open on this day).Find the minimum number of days on which Vasya will have a rest (it means, he will not do sport and write the contest at the same time). The only limitation that Vasya has \u2014 he does not want to do the same activity on two consecutive days: it means, he will not do sport on two consecutive days, and write the contest on two consecutive days.","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of days of Vasya's vacations. The second line contains the sequence of integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u20093) separated by space, where: ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; ai equals 1, if on the i-th day of vacations the gym is closed, but the contest is carried out; ai equals 2, if on the i-th day of vacations the gym is open and the contest is not carried out; ai equals 3, if on the i-th day of vacations the gym is open and the contest is carried out.","output_specification":"Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses: to do sport on any two consecutive days, to write the contest on any two consecutive days. ","notes":"NoteIn the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.In the third test Vasya can do sport either on a day number 1 or number 2. He can not do sport in two days, because it will be contrary to the his limitation. Thus, he will have a rest for only one day.","sample_inputs":["4\n1 3 2 0","7\n1 3 3 2 1 2 3","2\n2 2"],"sample_outputs":["2","0","1"],"human_solution":"\/\/ compile : kotlinc newyear.kt -include-runtime -d test.jar\n\/\/ run : java -jar test.jar\n\nprivate fun readLn() = readLine()!! \/\/ string line\nprivate fun readInt() = readLn().toInt() \/\/ single int\nprivate fun readStrings() = readLn().split(\" \") \/\/ list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } \/\/ list of ints\n\nfun main()\n{\n\t\/\/ var state = Array(4,{0})\n\tvar dp = Array(105,{IntArray(4)})\n\n\tvar n = readInt()\n\tvar arr = readInts()\n\t\/\/ arr = readInts()\n\n\tfor(i in 1..n)\n\t\tfor(j in 0..2)\n\t\t\tdp[i][j] = 1000000\n\tfor(i in 0..2)\n\t\tdp[0][i] = 0\n\tfor(i in 1..n)\n\t{\n\t\tvar r = arr[i-1]\n\t\t\/\/ println(\"${r} ${dp[i][0]} ${dp[i][1]} ${dp[i][2]}\")\n\t\tdp[i][0] = 1+minOf(dp[i-1][0],dp[i-1][1],dp[i-1][2])\n\t\tif(r==1)\n\t\t\tdp[i][1] = minOf(dp[i-1][0],dp[i-1][2])\n\t\tif(r==2)\n\t\t\tdp[i][2] = minOf(dp[i-1][0],dp[i-1][1])\n\t\tif(r==3)\n\t\t{\n\t\t\tdp[i][1] = minOf(dp[i-1][0],dp[i-1][2])\n\t\t\tdp[i][2] = minOf(dp[i-1][0],dp[i-1][1])\n\t\t}\n\t\t\/\/ println(\"${r} ${dp[i][0]} ${dp[i][1]} ${dp[i][2]}\")\n\t}\n\n\tvar res = minOf(dp[n][0],dp[n][1],dp[n][2])\n\tprintln(\"${res}\")\n}","testcases":"[{'input': '4\\r\\n1 3 2 0\\r\\n', 'output': ['2']}, {'input': '7\\r\\n1 3 3 2 1 2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1']}, {'input': '1\\r\\n0\\r\\n', 'output': ['1']}, {'input': '10\\r\\n0 0 1 1 0 0 0 0 1 0\\r\\n', 'output': ['8']}, {'input': '100\\r\\n3 2 3 3 3 2 3 1 3 2 2 3 2 3 3 3 3 3 3 1 2 2 3 1 3 3 2 2 2 3 1 0 3 3 3 2 3 3 1 1 3 1 3 3 3 1 3 1 3 0 1 3 2 3 2 1 1 3 2 3 3 3 2 3 1 3 3 3 3 2 2 2 1 3 1 3 3 3 3 1 3 2 3 3 0 3 3 3 3 3 1 0 2 1 3 3 0 2 3 3\\r\\n', 'output': ['16']}, {'input': '10\\r\\n2 3 0 1 3 1 2 2 1 0\\r\\n', 'output': ['3']}, {'input': '45\\r\\n3 3 2 3 2 3 3 3 0 3 3 3 3 3 3 3 1 3 2 3 2 3 2 2 2 3 2 3 3 3 3 3 1 2 3 3 2 2 2 3 3 3 3 1 3\\r\\n', 'output': ['6']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '2\\r\\n3 3\\r\\n', 'output': ['0']}, {'input': '3\\r\\n3 3 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 2\\r\\n', 'output': ['1']}, {'input': '10\\r\\n2 2 3 3 3 3 2 1 3 2\\r\\n', 'output': ['2']}, {'input': '15\\r\\n0 1 0 0 0 2 0 1 0 0 0 2 0 0 0\\r\\n', 'output': ['11']}, {'input': '15\\r\\n1 3 2 2 2 3 3 3 3 2 3 2 2 1 1\\r\\n', 'output': ['4']}, {'input': '15\\r\\n3 1 3 2 3 2 2 2 3 3 3 3 2 3 2\\r\\n', 'output': ['3']}, {'input': '20\\r\\n0 2 0 1 0 0 0 1 2 0 1 1 1 0 1 1 0 1 1 0\\r\\n', 'output': ['12']}, {'input': '20\\r\\n2 3 2 3 3 3 3 2 0 3 1 1 2 3 0 3 2 3 0 3\\r\\n', 'output': ['5']}, {'input': '20\\r\\n3 3 3 3 2 3 3 2 1 3 3 2 2 2 3 2 2 2 2 2\\r\\n', 'output': ['4']}, {'input': '25\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 2 0 0 2 0 0 1 0 2 0 1 1\\r\\n', 'output': ['16']}, {'input': '25\\r\\n1 3 3 2 2 3 3 3 3 3 1 2 2 3 2 0 2 1 0 1 3 2 2 3 3\\r\\n', 'output': ['5']}, {'input': '25\\r\\n2 3 1 3 3 2 1 3 3 3 1 3 3 1 3 2 3 3 1 3 3 3 2 3 3\\r\\n', 'output': ['3']}, {'input': '30\\r\\n0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 2 0 0 1 1 2 0 0 0\\r\\n', 'output': ['22']}, {'input': '30\\r\\n1 1 3 2 2 0 3 2 3 3 1 2 0 1 1 2 3 3 2 3 1 3 2 3 0 2 0 3 3 2\\r\\n', 'output': ['9']}, {'input': '30\\r\\n1 2 3 2 2 3 3 3 3 3 3 3 3 3 3 1 2 2 3 2 3 3 3 2 1 3 3 3 1 3\\r\\n', 'output': ['2']}, {'input': '35\\r\\n0 1 1 0 0 2 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 2 1 0 2 2 1 0 1 0 1 1 1 0 0\\r\\n', 'output': ['21']}, {'input': '35\\r\\n2 2 0 3 2 2 0 3 3 1 1 3 3 1 2 2 0 2 2 2 2 3 1 0 2 1 3 2 2 3 2 3 3 1 2\\r\\n', 'output': ['11']}, {'input': '35\\r\\n1 2 2 3 3 3 3 3 2 2 3 3 2 3 3 2 3 2 3 3 2 2 2 3 3 2 3 3 3 1 3 3 2 2 2\\r\\n', 'output': ['7']}, {'input': '40\\r\\n2 0 1 1 0 0 0 0 2 0 1 1 1 0 0 1 0 0 0 0 0 2 0 0 0 2 1 1 1 3 0 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['28']}, {'input': '40\\r\\n2 2 3 2 0 2 3 2 1 2 3 0 2 3 2 1 1 3 1 1 0 2 3 1 3 3 1 1 3 3 2 2 1 3 3 3 2 3 3 1\\r\\n', 'output': ['10']}, {'input': '40\\r\\n1 3 2 3 3 2 3 3 2 2 3 1 2 1 2 2 3 1 2 2 1 2 2 2 1 2 2 3 2 3 2 3 2 3 3 3 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '45\\r\\n2 1 0 0 0 2 1 0 1 0 0 2 2 1 1 0 0 2 0 0 0 0 0 0 1 0 0 2 0 0 1 1 0 0 1 0 0 1 1 2 0 0 2 0 2\\r\\n', 'output': ['29']}, {'input': '45\\r\\n3 3 2 3 3 3 2 2 3 2 3 1 3 2 3 2 2 1 1 3 2 3 2 1 3 1 2 3 2 2 0 3 3 2 3 2 3 2 3 2 0 3 1 1 3\\r\\n', 'output': ['8']}, {'input': '50\\r\\n3 0 0 0 2 0 0 0 0 0 0 0 2 1 0 2 0 1 0 1 3 0 2 1 1 0 0 1 1 0 0 1 2 1 1 2 1 1 0 0 0 0 0 0 0 1 2 2 0 0\\r\\n', 'output': ['32']}, {'input': '50\\r\\n3 3 3 3 1 0 3 3 0 2 3 1 1 1 3 2 3 3 3 3 3 1 0 1 2 2 3 3 2 3 0 0 0 2 1 0 1 2 2 2 2 0 2 2 2 1 2 3 3 2\\r\\n', 'output': ['16']}, {'input': '50\\r\\n3 2 3 1 2 1 2 3 3 2 3 3 2 1 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 2 3 3 3 3 2 3 1 2 3 3 2 3 3 1 2 2 1 1 3 3\\r\\n', 'output': ['7']}, {'input': '55\\r\\n0 0 1 1 0 1 0 0 1 0 1 0 0 0 2 0 0 1 0 0 0 1 0 0 0 0 3 1 0 0 0 1 0 0 0 0 2 0 0 0 2 0 2 1 0 0 0 0 0 0 0 0 2 0 0\\r\\n', 'output': ['40']}, {'input': '55\\r\\n3 0 3 3 3 2 0 2 3 0 3 2 3 3 0 3 3 1 3 3 1 2 3 2 0 3 3 2 1 2 3 2 3 0 3 2 2 1 2 3 2 2 1 3 2 2 3 1 3 2 2 3 3 2 2\\r\\n', 'output': ['13']}, {'input': '55\\r\\n3 3 1 3 2 3 2 3 2 2 3 3 3 3 3 1 1 3 3 2 3 2 3 2 0 1 3 3 3 3 2 3 2 3 1 1 2 2 2 3 3 3 3 3 2 2 2 3 2 3 3 3 3 1 3\\r\\n', 'output': ['7']}, {'input': '60\\r\\n0 1 0 0 0 0 0 0 0 2 1 1 3 0 0 0 0 0 1 0 1 1 0 0 0 3 0 1 0 1 0 2 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0\\r\\n', 'output': ['44']}, {'input': '60\\r\\n3 2 1 3 2 2 3 3 3 1 1 3 2 2 3 3 1 3 2 2 3 3 2 2 2 2 0 2 2 3 2 3 0 3 3 3 2 3 3 0 1 3 2 1 3 1 1 2 1 3 1 1 2 2 1 3 3 3 2 2\\r\\n', 'output': ['15']}, {'input': '60\\r\\n3 2 2 3 2 3 2 3 3 2 3 2 3 3 2 3 3 3 3 3 3 2 3 3 1 2 3 3 3 2 1 3 3 1 3 1 3 0 3 3 3 2 3 2 3 2 3 3 1 1 2 3 3 3 3 2 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '65\\r\\n1 0 2 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 2 0 2 1 0 2 1 0 1 0 1 1 0 1 1 1 2 1 0 1 0 0 0 0 1 2 2 1 0 0 1 2 1 2 0 2 0 0 0 1 1\\r\\n', 'output': ['35']}, {'input': '65\\r\\n2 2 2 3 0 2 1 2 3 3 1 3 1 2 1 3 2 3 2 2 2 1 2 0 3 1 3 1 1 3 1 3 3 3 3 3 1 3 0 3 1 3 1 2 2 3 2 0 3 1 3 2 1 2 2 2 3 3 2 3 3 3 2 2 3\\r\\n', 'output': ['13']}, {'input': '65\\r\\n3 2 3 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 3 3 2 2 2 3 3 2 3 3 2 3 3 3 3 2 3 3 3 2 2 3 3 3 3 3 3 2 2 3 3 2 3 3 1 3 3 3 3\\r\\n', 'output': ['6']}, {'input': '70\\r\\n1 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 1 1 1 3 1 1 0 1 2 0 2 1 0 0 0 1 1 1 1 1 0 0 1 0 0 0 1 1 1 3 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1\\r\\n', 'output': ['43']}, {'input': '70\\r\\n2 3 3 3 1 3 3 1 2 1 1 2 2 3 0 2 3 3 1 3 3 2 2 3 3 3 2 2 2 2 1 3 3 0 2 1 1 3 2 3 3 2 2 3 1 3 1 2 3 2 3 3 2 2 2 3 1 1 2 1 3 3 2 2 3 3 3 1 1 1\\r\\n', 'output': ['16']}, {'input': '70\\r\\n3 3 2 2 1 2 1 2 2 2 2 2 3 3 2 3 3 3 3 2 2 2 2 3 3 3 1 3 3 3 2 3 3 3 3 2 3 3 1 3 1 3 2 3 3 2 3 3 3 2 3 2 3 3 1 2 3 3 2 2 2 3 2 3 3 3 3 3 3 1\\r\\n', 'output': ['10']}, {'input': '75\\r\\n1 0 0 1 1 0 0 1 0 1 2 0 0 2 1 1 0 0 0 0 0 0 2 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 1 2 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0\\r\\n', 'output': ['51']}, {'input': '75\\r\\n1 3 3 3 1 1 3 2 3 3 1 3 3 3 2 1 3 2 2 3 1 1 1 1 1 1 2 3 3 3 3 3 3 2 3 3 3 3 3 2 3 3 2 2 2 1 2 3 3 2 2 3 0 1 1 3 3 0 0 1 1 3 2 3 3 3 3 1 2 2 3 3 3 3 1\\r\\n', 'output': ['16']}, {'input': '75\\r\\n3 3 3 3 2 2 3 2 2 3 2 2 1 2 3 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 3 3 3 2 3 2 2 2 3 3 1 3 2 2 3 3 3 0 3 2 1 3 3 2 3 3 3 3 1 2 3 3 3 2 2 3 3 3 3 2 2 3 3 1\\r\\n', 'output': ['11']}, {'input': '80\\r\\n0 0 0 0 2 0 1 1 1 1 1 0 0 0 0 2 0 0 1 0 0 0 0 1 1 0 2 2 1 1 0 1 0 1 0 1 1 1 0 1 2 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 2 2 0 1 1 0 0 0 0 0 0 0 0 1\\r\\n', 'output': ['56']}, {'input': '80\\r\\n2 2 3 3 2 1 0 1 0 3 2 2 3 2 1 3 1 3 3 2 3 3 3 2 3 3 3 2 1 3 3 1 3 3 3 3 3 3 2 2 2 1 3 2 1 3 2 1 1 0 1 1 2 1 3 0 1 2 3 2 2 3 2 3 1 3 3 2 1 1 0 3 3 3 3 1 2 1 2 0\\r\\n', 'output': ['17']}, {'input': '80\\r\\n2 3 3 2 2 2 3 3 2 3 3 3 3 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 1 3 2 3 3 0 3 1 2 3 3 1 2 3 2 3 3 2 3 3 3 3 3 2 2 3 0 3 3 3 3 3 2 2 3 2 3 3 3 3 3 2 3 2 3 3 3 3 2 3\\r\\n', 'output': ['9']}, {'input': '85\\r\\n0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 2 0 1 0 0 2 0 1 1 0 0 0 0 2 2 0 0 0 1 0 0 0 1 2 0 1 0 0 0 2 1 1 2 0 3 1 0 2 2 1 0 0 1 1 0 0 0 0 1 0 2 1 1 2 1 0 0 1 2 1 2 0 0 1 0 1 0\\r\\n', 'output': ['54']}, {'input': '85\\r\\n2 3 1 3 2 3 1 3 3 2 1 2 1 2 2 3 2 2 3 2 0 3 3 2 1 2 2 2 3 3 2 3 3 3 2 1 1 3 1 3 2 2 2 3 3 2 3 2 3 1 1 3 2 3 1 3 3 2 3 3 2 2 3 0 1 1 2 2 2 2 1 2 3 1 3 3 1 3 2 2 3 2 3 3 3\\r\\n', 'output': ['19']}, {'input': '85\\r\\n1 2 1 2 3 2 3 3 3 3 3 3 3 2 1 3 2 3 3 3 3 2 3 3 3 1 3 3 3 3 2 3 3 3 3 3 3 2 2 1 3 3 3 3 2 2 3 1 1 2 3 3 3 2 3 3 3 3 3 2 3 3 3 2 2 3 3 1 1 1 3 3 3 3 1 3 3 3 1 3 3 1 3 2 3\\r\\n', 'output': ['9']}, {'input': '90\\r\\n2 0 1 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 2 2 0 2 0 0 2 1 0 2 0 1 0 1 0 0 1 2 2 0 0 1 0 0 1 0 1 0 2 0 1 1 1 0 1 1 0 1 0 2 0 1 0 1 0 0 0 1 0 0 1 2 0 0 0 1 0 0 2 2 0 0 0 0 0 1 3 1 1 0 1\\r\\n', 'output': ['57']}, {'input': '90\\r\\n2 3 3 3 2 3 2 1 3 0 3 2 3 3 2 1 3 3 2 3 2 3 3 2 1 3 1 3 3 1 2 2 3 3 2 1 2 3 2 3 0 3 3 2 2 3 1 0 3 3 1 3 3 3 3 2 1 2 2 1 3 2 1 3 3 1 2 0 2 2 3 2 2 3 3 3 1 3 2 1 2 3 3 2 3 2 3 3 2 1\\r\\n', 'output': ['17']}, {'input': '90\\r\\n2 3 2 3 2 2 3 3 2 3 2 1 2 3 3 3 2 3 2 3 3 2 3 3 3 1 3 3 1 3 2 3 2 2 1 3 3 3 3 3 3 3 3 3 3 2 3 2 3 2 1 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 1 3 2 3 3 3 2 2 3 2 3 2 1 3 2\\r\\n', 'output': ['9']}, {'input': '95\\r\\n0 0 3 0 2 0 1 0 0 2 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 0 0 2 1 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 2 0 1 2 2 0 0 1 0 2 0 0 0 1 0 2 1 2 1 0 1 0 0 0 1 0 0 1 1 2 1 1 1 1 2 0 0 0 0 0 1 1 0 1\\r\\n', 'output': ['61']}, {'input': '95\\r\\n2 3 3 2 1 1 3 3 3 2 3 3 3 2 3 2 3 3 3 2 3 2 2 3 3 2 1 2 3 3 3 1 3 0 3 3 1 3 3 1 0 1 3 3 3 0 2 1 3 3 3 3 0 1 3 2 3 3 2 1 3 1 2 1 1 2 3 0 3 3 2 1 3 2 1 3 3 3 2 2 3 2 3 3 3 2 1 3 3 3 2 3 3 1 2\\r\\n', 'output': ['15']}, {'input': '95\\r\\n2 3 3 2 3 2 2 1 3 1 2 1 2 3 1 2 3 3 1 3 3 3 1 2 3 2 2 2 2 3 3 3 2 2 3 3 3 3 3 1 2 2 3 3 3 3 2 3 2 2 2 3 3 2 3 3 3 3 3 3 3 0 3 2 0 3 3 1 3 3 3 2 3 2 3 2 3 3 3 3 2 2 1 1 3 3 3 3 3 1 3 3 3 3 2\\r\\n', 'output': ['14']}, {'input': '100\\r\\n1 0 2 0 0 0 0 2 0 0 0 1 0 1 0 0 1 0 1 2 0 1 1 0 0 1 0 1 1 0 0 0 2 0 1 0 0 2 0 0 0 0 0 1 1 1 0 0 1 0 2 0 0 0 0 1 0 1 0 1 0 1 0 1 2 2 0 0 2 0 1 0 1 0 1 0 0 0 1 0 0 2 1 1 1 0 0 1 0 0 0 2 0 0 2 1 1 0 0 2\\r\\n', 'output': ['63']}, {'input': '100\\r\\n3 2 1 3 2 3 2 3 2 2 3 1 3 3 3 3 3 2 2 3 2 2 3 2 3 3 3 2 3 1 2 1 3 3 3 3 1 3 3 3 3 3 2 3 2 1 3 3 1 2 2 3 1 3 3 1 2 2 1 3 1 3 2 2 3 3 1 3 2 3 1 2 1 2 3 3 2 2 1 2 3 3 3 3 3 1 3 3 3 3 2 1 3 0 3 3 3 2 3 3\\r\\n', 'output': ['15']}, {'input': '100\\r\\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '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': ['50']}, {'input': '100\\r\\n2 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 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['50']}, {'input': '99\\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\\r\\n', 'output': ['49']}, {'input': '100\\r\\n2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1\\r\\n', 'output': ['0']}, {'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': ['100']}, {'input': '2\\r\\n0 3\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2 1\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0\\r\\n', 'output': ['50']}]","id":443} {"difficulty":1200,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"134_A","execute_outcome":"WRONG_ANSWER","source_code":"private fun readInt() = readString().toInt()\r\nprivate fun readString() = readLine().toString()\r\nprivate fun readDouble() = readString().toDouble()\r\nprivate fun readListString() = readString().split(\" \")\r\nprivate fun readListInt() = readString().split(\" \").map { it.toInt() }\r\n\r\n\r\nfun main() {\r\n\r\n readInt()\r\n val nums = readListInt()\r\n var sum = 0L\r\n for (n in nums)\r\n sum += n\r\n val ans = mutableListOf()\r\n for (i in 0 until nums.size) {\r\n val left = sum - nums[i]\r\n if (left \/ (nums.size - 1) == nums[i].toLong()) {\r\n ans.add(i + 1)\r\n }\r\n }\r\n println(ans.size)\r\n if (ans.isNotEmpty()) {\r\n println(ans.joinToString(\" \"))\r\n }\r\n\r\n}\r\n\r\n\r\n","description":"You are given a sequence of positive integers a1,a2,...,an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).","input_specification":"The first line contains the integer n (2\u2264n\u22642\u00b710^5). The second line contains elements of the sequence a1,a2,...,an (1\u2264ai\u22641000). All the elements are positive integers.\n","output_specification":"Print on the first line the number of the sought indices. Print on the second line the sought indices in the increasing order. All indices are integers from 1 to n.\nIf the sought elements do not exist, then the first output line should contain number 0. In this case you may either not print the second line or print an empty line.\n","notes":null,"sample_inputs":["5\n1 2 3 4 5\n","4\n50 50 50 50\n"],"sample_outputs":["1\n3 ","4\n1 2 3 4 "],"human_solution":"private fun readInt() = readString().toInt()\r\nprivate fun readString() = readLine().toString()\r\nprivate fun readDouble() = readString().toDouble()\r\nprivate fun readListString() = readString().split(\" \")\r\nprivate fun readListInt() = readString().split(\" \").map { it.toInt() }\r\n\r\n\r\nfun main() {\r\n\r\n readInt()\r\n val nums = readListInt()\r\n var sum = 0L\r\n for (n in nums)\r\n sum += n\r\n val ans = mutableListOf()\r\n for (i in 0 until nums.size) {\r\n val left = sum - nums[i]\r\n if (left \/ (nums.size - 1) == nums[i].toLong() && nums[i]*(nums.size-1L)==left) {\r\n ans.add(i + 1)\r\n }\r\n }\r\n println(ans.size)\r\n if (ans.isNotEmpty()) {\r\n println(ans.joinToString(\" \"))\r\n }\r\n\r\n}\r\n\r\n\r\n","testcases":"[{'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['1\\r\\n3 ']}, {'input': ['4\\r\\n50 50 50 50\\r\\n'], 'output': ['4\\r\\n1 2 3 4 ']}, {'input': ['3\\r\\n2 3 1\\r\\n'], 'output': ['1\\r\\n1 ']}, {'input': ['2\\r\\n4 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['2\\r\\n1 2 ']}, {'input': ['10\\r\\n3 3 3 3 3 4 3 3 3 2\\r\\n'], 'output': ['8\\r\\n1 2 3 4 5 7 8 9 ']}, {'input': ['10\\r\\n15 7 10 7 7 7 4 4 7 2\\r\\n'], 'output': ['5\\r\\n2 4 5 6 9 ']}, {'input': ['6\\r\\n2 2 2 2 2 2\\r\\n'], 'output': ['6\\r\\n1 2 3 4 5 6 ']}, {'input': ['6\\r\\n3 3 3 3 3 3\\r\\n'], 'output': ['6\\r\\n1 2 3 4 5 6 ']}, {'input': ['4\\r\\n6 6 6 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n3 3 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n7 6 6 6 6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n3 5 5 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n99 100 99\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n5 6 5 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n1 1 2 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n4 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n1 1 1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 2 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n1 1 2 3 3 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n4 5 5 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 3 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n1 2 3 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n1 2 3 4 6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n3 4 5 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n2 3 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n3 4 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n10 5 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n5 6 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n1 2 3 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n2 2 3 3 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n4 3 6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 1 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['15\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['15\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ']}]","id":444} {"difficulty":900,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"160_A","execute_outcome":"RUNTIME_ERROR","source_code":"fun main() {\r\n val n = readln().toInt()\r\n val coins = readln().split(\" \").map{ it.toInt() }\r\n var sum = 0\r\n var count = 0\r\n\r\n coins.sortedDescending()\r\n\r\n for (coin in coins) {\r\n sum += coin\r\n count++\r\n if (sum > coins.sum() - sum) {\r\n break\r\n }\r\n }\r\n println(count)\r\n}","description":"Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like.Now let's imagine a typical morning in your family. You haven't woken up yet, and Mom is already going to work. She has been so hasty that she has nearly forgotten to leave the two of her darling children some money to buy lunches in the school cafeteria. She fished in the purse and found some number of coins, or to be exact, n coins of arbitrary values a1,a2,...,an. But as Mom was running out of time, she didn't split the coins for you two. So she scribbled a note asking you to split the money equally.As you woke up, you found Mom's coins and read her note. \"But why split the money equally?\" \u2014 you thought. After all, your twin is sleeping and he won't know anything. So you decided to act like that: pick for yourself some subset of coins so that the sum of values of your coins is strictly larger than the sum of values of the remaining coins that your twin will have. However, you correctly thought that if you take too many coins, the twin will suspect the deception. So, you've decided to stick to the following strategy to avoid suspicions: you take the minimum number of coins, whose sum of values is strictly more than the sum of values of the remaining coins. On this basis, determine what minimum number of coins you need to take to divide them in the described manner.","input_specification":"The first line contains integer n (1\u2264n\u2264100) \u2014 the number of coins. The second line contains a sequence of n integers a1, a2, ..., an (1\u2264ai\u2264100) \u2014 the coins' values. All numbers are separated with spaces.\n","output_specification":"In the single line print the single number \u2014 the minimum needed number of coins.\n","notes":"In the first sample you will have to take 2 coins (you and your twin have sums equal to 6,0 correspondingly). If you take 1 coin, you get sums 3,3. If you take 0 coins, you get sums 0,6. Those variants do not satisfy you as your sum should be strictly more that your twins' sum.\nIn the second sample one coin isn't enough for us, too. You can pick coins with values 1,2 or 2,2. In any case, the minimum number of coins equals 2. \n","sample_inputs":["2\n3 3\n","3\n2 1 2\n"],"sample_outputs":["2\n","2\n"],"human_solution":"\r\nimport java.util.Scanner\r\n\r\nfun main(args: Array) {\r\n val scanner = Scanner(System.`in`)\r\n val n = scanner.nextInt();\r\n var sum = 0\r\n val arr = mutableListOf()\r\n for (i in 0 until n) {\r\n val x = scanner.nextInt()\r\n arr.add(x)\r\n sum += x\r\n }\r\n\r\n arr.sortDescending()\r\n var cs = 0\r\n var cc = 0\r\n while (arr.size > 0) {\r\n cs += arr[0]\r\n cc++\r\n arr.removeAt(0)\r\n if (cs > arr.sum()) break\r\n }\r\n println(cc)\r\n}\r\n\r\n","testcases":"[{'input': ['2\\r\\n3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n2 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n4 2 2 2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['7\\r\\n1 10 1 2 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3 2 3 3 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n2 1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6\\r\\n1 1 1 1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7\\r\\n10 10 5 5 5 5 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\n2 1 2 2 2 1 1 2 1 2 2 1 1 1 1 2 1 1 1 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n4 2 4 4 3 4 2 2 4 2 3 1 1 2 2 3 3 3 1 4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n35 26 41 40 45 46 22 26 39 23 11 15 47 42 18 15 27 10 45 40\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n7 84 100 10 31 35 41 2 63 44 57 4 63 11 23 49 98 71 16 90\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['50\\r\\n19 2 12 26 17 27 10 26 17 17 5 24 11 15 3 9 16 18 19 1 25 23 18 6 2 7 25 7 21 25 13 29 16 9 25 3 14 30 18 4 10 28 6 10 8 2 2 4 8 28\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['70\\r\\n2 18 18 47 25 5 14 9 19 46 36 49 33 32 38 23 32 39 8 29 31 17 24 21 10 15 33 37 46 21 22 11 20 35 39 13 11 30 28 40 39 47 1 17 24 24 21 46 12 2 20 43 8 16 44 11 45 10 13 44 31 45 45 46 11 10 33 35 23 42\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['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': ['51\\r\\n']}, {'input': ['100\\r\\n1 2 2 1 2 1 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 2 2 1 2 1 2 1 2 2 2 1 2 1 2 2 1 1 2 2 1 1 2 2 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 1 2 2 1 1 1 1 2 1 1 1 1 2 2 2 2\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['100\\r\\n1 2 3 2 1 2 2 3 1 3 3 2 2 1 1 2 2 1 1 1 1 2 3 3 2 1 1 2 2 2 3 3 3 2 1 3 1 3 3 2 3 1 2 2 2 3 2 1 1 3 3 3 3 2 1 1 2 3 2 2 3 2 3 2 2 3 2 2 2 2 3 3 3 1 3 3 1 1 2 3 2 2 2 2 3 3 3 2 1 2 3 1 1 2 3 3 1 3 3 2\\r\\n'], 'output': ['36\\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': ['33\\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': ['30\\r\\n']}, {'input': ['100\\r\\n16 9 11 8 11 4 9 17 4 8 4 10 9 10 6 3 3 15 1 6 1 15 12 18 6 14 13 18 1 7 18 4 10 7 10 12 3 16 14 4 10 8 10 7 19 13 15 1 4 8 16 10 6 4 3 16 11 10 7 3 4 16 1 20 1 11 4 16 10 7 7 12 18 19 3 17 19 3 4 19 2 12 11 3 18 20 2 2 14 4 20 13 13 11 16 20 19 14 7 2\\r\\n'], 'output': ['29\\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': ['30\\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': ['29\\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 92 93 94 95 96 97 98 99 100\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n4 1 2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n2 2 2 4 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n100 99 99 100\\r\\n'], 'output': ['2\\r\\n']}]","id":445} {"difficulty":1100,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"186_A","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ A. Comparing Strings\r\n\r\n\/\/ region Preamble\r\n\r\nimport java.util.concurrent.ConcurrentHashMap\r\nimport kotlin.math.*\r\n\r\n\/\/ IO\r\nval reader = System.`in`.bufferedReader()\r\nval writer = System.out.bufferedWriter()\r\n\r\nfun readLn(): String = reader.readLine()\r\nfun readInt() = readLn().toInt()\r\nfun readLong() = readLn().toLong()\r\nfun readDouble() = readLn().toDouble()\r\nfun readWords() = readLn().split(\" \")\r\nfun readInts() = readWords().map { it.toInt() }\r\nfun readLongs() = readWords().map { it.toLong() }\r\nfun readDoubles() = readWords().map { it.toDouble() }\r\nfun readLines(n: Int) = List(n) { readLn() }\r\n\r\nfun Boolean.yesNo() = if (this) \"YES\" else \"NO\"\r\nfun writeLn(s: String) = writer.write(\"$s\\n\")\r\n\r\n@JvmName(\"writeLn1\")\r\nfun String.writeLn() = writer.write(\"\\n\")\r\n\r\n\/\/ Functional\r\nfun List.cumulativeSum1() = runningFold(0) { x, y -> x + y }\r\nfun List.cumulativeSum() = cumulativeSum1().drop(1)\r\n\r\n@JvmName(\"cumulativeSum1Long\")\r\nfun List.cumulativeSum1() = runningFold(0L) { x, y -> x + y }\r\n\r\n@JvmName(\"cumulativeSumLong\")\r\nfun List.cumulativeSum() = cumulativeSum1().drop(1)\r\n\r\nfun List.isDistinct() = size == toSet().size\r\n\r\nfun List.histogram() = groupingBy { it }.eachCount().withDefault { 0 }\r\nfun String.histogram() = groupingBy { it }.eachCount().withDefault { 0 }\r\n\r\nfun List.groupContiguous(): List> {\r\n val groups = mutableListOf>()\r\n forEach { e ->\r\n if (e == groups.lastOrNull()?.lastOrNull()) {\r\n groups.last().add(e)\r\n } else {\r\n groups.add(mutableListOf(e))\r\n }\r\n }\r\n return groups\r\n}\r\n\r\nfun permutationsWithReplacement(input: Set, n: Int): List> =\r\n if (n <= 0) listOf(emptyList())\r\n else input.flatMap { first ->\r\n permutationsWithReplacement(input, n - 1).map { rest ->\r\n listOf(first) + rest\r\n }\r\n }\r\n\r\nfun permutations(input: Set): List> {\r\n if (input.isEmpty()) return listOf(emptyList())\r\n\r\n val first = input.first()\r\n val tail = input.drop(1).toSet()\r\n\r\n return permutations(tail).flatMap { rest ->\r\n (0..rest.size).map {\r\n buildList {\r\n addAll(rest.take(it))\r\n add(first)\r\n addAll(rest.drop(it))\r\n }\r\n }\r\n }\r\n}\r\n\r\nfun combinations(input: Set, n: Int): Set> {\r\n if (n <= 0) return setOf(emptySet())\r\n if (input.isEmpty()) return emptySet()\r\n\r\n val first = input.take(1).toSet()\r\n val tail = input.drop(1).toSet()\r\n\r\n return combinations(tail, n - 1).map { rest -> first + rest }.toSet() + combinations(tail, n)\r\n}\r\n\r\n\/\/ Math\r\nfun Int.isOdd() = this % 2 == 1\r\nfun Long.isOdd() = this % 2 == 1L\r\nfun Int.isEven() = !isOdd()\r\nfun Long.isEven() = !isOdd()\r\nfun Int.isZero() = this == 0\r\nfun Long.isZero() = this == 0L\r\nfun Int.isPositive() = this > 0\r\nfun Long.isPositive() = this > 0L\r\nfun Int.isNegative() = this < 0\r\nfun Long.isNegative() = this < 0L\r\nfun Int.isPositiveOrZero() = this >= 0\r\nfun Long.isPositiveOrZero() = this >= 0L\r\nfun Int.isNegativeOrZero() = this <= 0\r\nfun Long.isNegativeOrZero() = this <= 0L\r\n\r\ninfix fun Int.divides(o: Int) = o % this == 0\r\ninfix fun Long.divides(o: Long) = o % this == 0L\r\ninfix fun Int.divisibleBy(o: Int) = o divides this\r\ninfix fun Long.divisibleBy(o: Long) = o divides this\r\n\r\ninfix fun Int.floorDiv(o: Int) = floor(toDouble() \/ o).toInt()\r\ninfix fun Long.floorDiv(o: Long) = floor(toDouble() \/ o).toInt()\r\ninfix fun Int.ceilDiv(o: Int) = ceil(toDouble() \/ o).toInt()\r\ninfix fun Long.ceilDiv(o: Long) = ceil(toDouble() \/ o).toInt()\r\n\r\ninfix fun Int.mod(m: Int) = ((this % m) + m) % m\r\ninfix fun Long.mod(m: Long) = ((this % m) + m) % m\r\n\r\n\/\/ Number Theory\r\nfun primeSieve(n: Int): List {\r\n val s = BooleanArray(n + 1) { true }\r\n val limit = sqrt(n.toDouble()).toInt()\r\n (2..limit).forEach { i ->\r\n if (s[i]) (i * i..n).forEach { j -> s[j] = false }\r\n }\r\n return s.toList()\r\n}\r\n\r\nfun primes(n: Int) = primeSieve(n).mapIndexedNotNull { i, p -> i.takeIf { p } }\r\n\r\n\/\/ DP\r\ninline fun memoize(crossinline fn: (I) -> O): ((I) -> O) = with(ConcurrentHashMap()) {\r\n { input -> get(input) ?: fn(input).also { output -> set(input, output) } }\r\n}\r\n\/\/ endregion\r\n\r\nfun solve(p: String, q: String): Boolean {\r\n if (p.length != q.length)\r\n return false\r\n val m = p.zip(q).withIndex().filter { (_, v) -> v.first != v.second }.map { it.index }\r\n if (m.size != 2)\r\n return false\r\n val (i, j) = m\r\n if (j - 1 != i)\r\n return false\r\n return p[i] == q[j] && p[j] == q[i]\r\n}\r\n\r\nfun main() {\r\n val (p, q) = readLines(2)\r\n println(solve(p, q).yesNo())\r\n}","description":"Some dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told \"no genome, no degree\". That means that all dwarves should write a thesis on genome. Dwarven genome is far from simple. It is represented by a string that consists of lowercase Latin letters.Dwarf Misha has already chosen the subject for his thesis: determining by two dwarven genomes, whether they belong to the same race. Two dwarves belong to the same race if we can swap two characters in the first dwarf's genome and get the second dwarf's genome as a result. Help Dwarf Misha and find out whether two gnomes belong to the same race or not.","input_specification":"The first line contains the first dwarf's genome: a non-empty string, consisting of lowercase Latin letters.\nThe second line contains the second dwarf's genome: a non-empty string, consisting of lowercase Latin letters.\nThe number of letters in each genome doesn't exceed 10^5. It is guaranteed that the strings that correspond to the genomes are different. The given genomes may have different length.\n","output_specification":"Print \"YES\", if the dwarves belong to the same race. Otherwise, print \"NO\".\n","notes":" First example: you can simply swap two letters in string \"ab\". So we get \"ba\". Second example: we can't change string \"aa\" into string \"ab\", because \"aa\" does not contain letter \"b\". ","sample_inputs":["ab\nba\n","aa\nab\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"\r\n\/\/ A. Comparing Strings\r\n\r\n\/\/ region Preamble\r\n\r\nimport java.util.concurrent.ConcurrentHashMap\r\nimport kotlin.math.*\r\n\r\n\/\/ IO\r\nval reader = System.`in`.bufferedReader()\r\nval writer = System.out.bufferedWriter()\r\n\r\nfun readLn(): String = reader.readLine()\r\nfun readInt() = readLn().toInt()\r\nfun readLong() = readLn().toLong()\r\nfun readDouble() = readLn().toDouble()\r\nfun readWords() = readLn().split(\" \")\r\nfun readInts() = readWords().map { it.toInt() }\r\nfun readLongs() = readWords().map { it.toLong() }\r\nfun readDoubles() = readWords().map { it.toDouble() }\r\nfun readLines(n: Int) = List(n) { readLn() }\r\n\r\nfun Boolean.yesNo() = if (this) \"YES\" else \"NO\"\r\nfun writeLn(s: String) = writer.write(\"$s\\n\")\r\n\r\n@JvmName(\"writeLn1\")\r\nfun String.writeLn() = writer.write(\"\\n\")\r\n\r\n\/\/ Functional\r\nfun List.cumulativeSum1() = runningFold(0) { x, y -> x + y }\r\nfun List.cumulativeSum() = cumulativeSum1().drop(1)\r\n\r\n@JvmName(\"cumulativeSum1Long\")\r\nfun List.cumulativeSum1() = runningFold(0L) { x, y -> x + y }\r\n\r\n@JvmName(\"cumulativeSumLong\")\r\nfun List.cumulativeSum() = cumulativeSum1().drop(1)\r\n\r\nfun List.isDistinct() = size == toSet().size\r\n\r\nfun List.histogram() = groupingBy { it }.eachCount().withDefault { 0 }\r\nfun String.histogram() = groupingBy { it }.eachCount().withDefault { 0 }\r\n\r\nfun List.groupContiguous(): List> {\r\n val groups = mutableListOf>()\r\n forEach { e ->\r\n if (e == groups.lastOrNull()?.lastOrNull()) {\r\n groups.last().add(e)\r\n } else {\r\n groups.add(mutableListOf(e))\r\n }\r\n }\r\n return groups\r\n}\r\n\r\nfun permutationsWithReplacement(input: Set, n: Int): List> =\r\n if (n <= 0) listOf(emptyList())\r\n else input.flatMap { first ->\r\n permutationsWithReplacement(input, n - 1).map { rest ->\r\n listOf(first) + rest\r\n }\r\n }\r\n\r\nfun permutations(input: Set): List> {\r\n if (input.isEmpty()) return listOf(emptyList())\r\n\r\n val first = input.first()\r\n val tail = input.drop(1).toSet()\r\n\r\n return permutations(tail).flatMap { rest ->\r\n (0..rest.size).map {\r\n buildList {\r\n addAll(rest.take(it))\r\n add(first)\r\n addAll(rest.drop(it))\r\n }\r\n }\r\n }\r\n}\r\n\r\nfun combinations(input: Set, n: Int): Set> {\r\n if (n <= 0) return setOf(emptySet())\r\n if (input.isEmpty()) return emptySet()\r\n\r\n val first = input.take(1).toSet()\r\n val tail = input.drop(1).toSet()\r\n\r\n return combinations(tail, n - 1).map { rest -> first + rest }.toSet() + combinations(tail, n)\r\n}\r\n\r\n\/\/ Math\r\nfun Int.isOdd() = this % 2 == 1\r\nfun Long.isOdd() = this % 2 == 1L\r\nfun Int.isEven() = !isOdd()\r\nfun Long.isEven() = !isOdd()\r\nfun Int.isZero() = this == 0\r\nfun Long.isZero() = this == 0L\r\nfun Int.isPositive() = this > 0\r\nfun Long.isPositive() = this > 0L\r\nfun Int.isNegative() = this < 0\r\nfun Long.isNegative() = this < 0L\r\nfun Int.isPositiveOrZero() = this >= 0\r\nfun Long.isPositiveOrZero() = this >= 0L\r\nfun Int.isNegativeOrZero() = this <= 0\r\nfun Long.isNegativeOrZero() = this <= 0L\r\n\r\ninfix fun Int.divides(o: Int) = o % this == 0\r\ninfix fun Long.divides(o: Long) = o % this == 0L\r\ninfix fun Int.divisibleBy(o: Int) = o divides this\r\ninfix fun Long.divisibleBy(o: Long) = o divides this\r\n\r\ninfix fun Int.floorDiv(o: Int) = floor(toDouble() \/ o).toInt()\r\ninfix fun Long.floorDiv(o: Long) = floor(toDouble() \/ o).toInt()\r\ninfix fun Int.ceilDiv(o: Int) = ceil(toDouble() \/ o).toInt()\r\ninfix fun Long.ceilDiv(o: Long) = ceil(toDouble() \/ o).toInt()\r\n\r\ninfix fun Int.mod(m: Int) = ((this % m) + m) % m\r\ninfix fun Long.mod(m: Long) = ((this % m) + m) % m\r\n\r\n\/\/ Number Theory\r\nfun primeSieve(n: Int): List {\r\n val s = BooleanArray(n + 1) { true }\r\n val limit = sqrt(n.toDouble()).toInt()\r\n (2..limit).forEach { i ->\r\n if (s[i]) (i * i..n).forEach { j -> s[j] = false }\r\n }\r\n return s.toList()\r\n}\r\n\r\nfun primes(n: Int) = primeSieve(n).mapIndexedNotNull { i, p -> i.takeIf { p } }\r\n\r\n\/\/ DP\r\ninline fun memoize(crossinline fn: (I) -> O): ((I) -> O) = with(ConcurrentHashMap()) {\r\n { input -> get(input) ?: fn(input).also { output -> set(input, output) } }\r\n}\r\n\/\/ endregion\r\n\r\nfun solve(p: String, q: String): Boolean {\r\n if (p.length != q.length)\r\n return false\r\n val m = p.zip(q).withIndex().filter { (_, v) -> v.first != v.second }.map { it.index }\r\n if (m.size != 2)\r\n return false\r\n val (i, j) = m\r\n return p[i] == q[j] && p[j] == q[i]\r\n}\r\n\r\nfun main() {\r\n val (p, q) = readLines(2)\r\n println(solve(p, q).yesNo())\r\n}","testcases":"[{'input': ['ab\\r\\nba\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['aa\\r\\nab\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['a\\r\\nza\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['vvea\\r\\nvvae\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['rtfabanpc\\r\\natfabrnpc\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['mt\\r\\ntm\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['qxolmbkkt\\r\\naovlajmlf\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['b\\r\\ng\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ab\\r\\naba\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ba\\r\\na\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['a\\r\\nab\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['a\\r\\naa\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['a\\r\\nz\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aabb\\r\\nbbaa\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ab\\r\\nbd\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['bac\\r\\ndae\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abc\\r\\nakl\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['cb\\r\\naa\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abaab\\r\\naabba\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aab\\r\\naaa\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abcde\\r\\nedcba\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abab\\r\\nbaba\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ab\\r\\nbac\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abcd\\r\\naqcb\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abc\\r\\nbad\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ab\\r\\nca\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abc\\r\\nab\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ab\\r\\nbae\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aaaabcccca\\r\\naaaadccccb\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['acaa\\r\\nabca\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aba\\r\\naab\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['ah\\r\\nla\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aab\\r\\naa\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['abab\\r\\nabcd\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['ed\\r\\nab\\r\\n'], 'output': ['NO\\r\\n']}]","id":446} {"difficulty":1200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val n : Int = sc.nextInt()\n val p = IntArray(n)\n val abcde = IntArray(5)\n val count = IntArray(5)\n var total : Int = 0\n\n for (i in 0 until n) p[i] = sc.nextInt()\n for (i in 0..4) abcde[i] = sc.nextInt()\n\n for (i in 0 until n) {\n total += p[i]\n for (i in 4 downTo 0) {\n if (abcde[i] <= total) {\n count[i] += (total \/ abcde[i])\n total %= abcde[i]\n }\n }\n }\n\n for (i in 0..4) println(count[i])\n print(total)\n\n}","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"],"human_solution":"import java.util.Scanner\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val n : Int = sc.nextInt()\n val p = IntArray(n)\n val abcde = IntArray(5)\n val count = LongArray(5)\n var total : Long = 0\n\n for (i in 0 until n) p[i] = sc.nextInt()\n for (i in 0..4) abcde[i] = sc.nextInt()\n\n for (i in 0 until n) {\n total += p[i]\n for (j in 4 downTo 0) {\n if (abcde[j] <= total) {\n count[j] += (total \/ abcde[j])\n total %= abcde[j]\n }\n }\n }\n\n for (i in 0..4) println(count[i])\n print(total)\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":447} {"difficulty":1300,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"230_B","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\nimport java.io.*\n\nval INPUT = System.`in`\nval read = INPUT.bufferedReader()\nfun main() {\n\n \n val n = 1000001;\n var prime = Array(n+5){true}\n prime[0]=false; prime[1]=false;\n \n for(i in 2..n+1){\n if(prime[i]==true)\n for(j in 2*i..n+1 step i)\n prime[j]=false\n }\n \n var h = HashSet();\n for(i in 0..n){\n if(prime[i]==true)\n h.add(i.toLong()*i.toLong())\n }\n\n \n var s = StringTokenizer(read.readLine())\n var N = s.nextToken().toInt()\n s = StringTokenizer(read.readLine())\n for(i in 1..N){\n if(h.contains(s.nextToken().toLong()))\n println(\"YES\")\n else\n println(\"NO\")\n }\n\n\n}\n","description":"We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t \u0422-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is \u0422-prime or not.","input_specification":"The first line contains a single positive integer, n (1\u2264n\u226410^5), showing how many numbers are in the array. The next line contains n space-separated integers xi (1\u2264xi\u226410^12).\nPlease, do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is advised to use the cin, cout streams or the %I64d specifier.\n","output_specification":"Print n lines: the i-th line should contain \"YES\" (without the quotes), if number xi is \u0422-prime, and \"NO\" (without the quotes), if it isn't.\n","notes":"The given test has three numbers. The first number 4 has exactly three divisors \u2014 1, 2 and 4, thus the answer for this number is \"YES\". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is \"NO\".\n","sample_inputs":["3\n4 5 6\n"],"sample_outputs":["YES\nNO\nNO\n"],"human_solution":"import java.io.BufferedReader\r\nimport java.io.InputStreamReader\r\nimport java.util.StringTokenizer\r\n\r\nfun main() = with(BufferedReader(InputStreamReader(System.`in`))) {\r\n var sb: StringBuilder = StringBuilder()\r\n var n: Int = readLine().toInt()\r\n var primes: BooleanArray = BooleanArray(1000001)\r\n\r\n primes[0] = true\r\n primes[1] = true\r\n\r\n for (i in 2..1000000) {\r\n if (!primes[i]) {\r\n for (j in i * 2..1000000 step (i)) {\r\n primes[j] = true\r\n }\r\n }\r\n }\r\n\r\n fun square(n: Long): Int {\r\n var sqrtN = Math.sqrt(n.toDouble())\r\n if (sqrtN == sqrtN.toInt().toDouble()) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n }\r\n\r\n var st: StringTokenizer = StringTokenizer(readLine())\r\n while (st.hasMoreTokens()) {\r\n var cur: Long = st.nextToken().toLong();\r\n if (cur == 4L) {\r\n sb.append(\"YES\")\r\n } else if (cur % 2 == 0L) {\r\n sb.append(\"NO\")\r\n } else if (!primes[Math.sqrt(cur.toDouble())\r\n .toInt()] && square(cur) == 1\r\n ) {\r\n sb.append(\"YES\")\r\n } else {\r\n sb.append(\"NO\")\r\n }\r\n sb.append('\\n')\r\n }\r\n println(sb)\r\n}","testcases":"[{'input': ['3\\r\\n4 5 6\\r\\n'], 'output': ['YES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['2\\r\\n48 49\\r\\n'], 'output': ['NO\\r\\nYES\\r\\n']}, {'input': ['10\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n'], 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n36\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n999966000289\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n999993399999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['9\\r\\n111 121 131 111 121 131 111 121 131\\r\\n'], 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n976197352729\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n1000000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n9\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6\\r\\n549755813888 847288609443 762939453125 678223072849 285311670611 137858491849\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['3\\r\\n223092870 6469693230 200560490130\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['2\\r\\n81 25\\r\\n'], 'output': ['NO\\r\\nYES\\r\\n']}, {'input': ['1\\r\\n16\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['22\\r\\n1 2 3 4 5 6 7 8 9 10 12752041 64 121 144 27550356289 124 24657 23756 135153365 25235235235 42351351 81\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n225\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n1521\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n81\\r\\n'], 'output': ['NO\\r\\n']}]","id":448} {"difficulty":800,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"231_A","execute_outcome":"RUNTIME_ERROR","source_code":"fun main() {\n val n = readLine()!!.toInt() \/\/ Read the number of problems (n)\n\n repeat(n) {\n val (petya, vasya, tonya) = readLine()!!.split(\" \").map { it.toInt() }\n\n \/\/ Process the views of Petya, Vasya, and Tonya here\n \/\/ You can perform any calculations or operations needed\n\n \/\/ Example: Determine if the majority is sure about the solution\n if ((petya + vasya + tonya) >= 2) {\n println(\"1\") \/\/ Majority is sure\n } else {\n println(\"0\") \/\/ Majority is not sure\n }\n }\n}\n\n \t \t\t \t\t \t\t\t \t\t \t\t \t\t","description":"One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.","input_specification":"The first input line contains a single integer n (1\u2264n\u22641000) \u2014 the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.\n","output_specification":"Print a single integer \u2014 the number of problems the friends will implement on the contest.\n","notes":"In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. \nIn the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.\n","sample_inputs":["3\n1 1 0\n1 1 1\n1 0 0\n","2\n1 0 0\n0 1 1\n"],"sample_outputs":["2\n","1\n"],"human_solution":"fun main(args: Array) {\r\n val n = readln().toInt()\r\n var count = 0\r\n for (i in 0 until n){\r\n val s = readln().split(\" \").map { it.toInt() }\r\n if(s.sum() >= 2) count++\r\n }\r\n println(count)\r\n}","testcases":"[{'input': ['3\\r\\n1 1 0\\r\\n1 1 1\\r\\n1 0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1 0 0\\r\\n0 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n1 0 0\\r\\n1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n1 0 0\\r\\n0 1 0\\r\\n1 1 1\\r\\n0 0 1\\r\\n0 0 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n0 1 0\\r\\n0 1 0\\r\\n1 1 0\\r\\n1 0 0\\r\\n0 0 1\\r\\n0 1 1\\r\\n1 1 1\\r\\n1 1 0\\r\\n0 0 0\\r\\n0 0 0\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['15\\r\\n0 1 0\\r\\n1 0 0\\r\\n1 1 0\\r\\n1 1 1\\r\\n0 1 0\\r\\n0 0 1\\r\\n1 0 1\\r\\n1 0 1\\r\\n1 0 1\\r\\n0 0 0\\r\\n1 1 1\\r\\n1 1 0\\r\\n0 1 1\\r\\n1 1 0\\r\\n1 1 1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['50\\r\\n0 0 0\\r\\n0 1 1\\r\\n1 1 1\\r\\n0 1 0\\r\\n1 0 1\\r\\n1 1 1\\r\\n0 0 1\\r\\n1 0 0\\r\\n1 1 0\\r\\n1 0 1\\r\\n0 1 0\\r\\n0 0 1\\r\\n1 1 0\\r\\n0 1 0\\r\\n1 1 0\\r\\n0 0 0\\r\\n1 1 1\\r\\n1 0 1\\r\\n0 0 1\\r\\n1 1 0\\r\\n1 1 1\\r\\n0 1 1\\r\\n1 1 0\\r\\n0 0 0\\r\\n0 0 0\\r\\n1 1 1\\r\\n0 0 0\\r\\n1 1 1\\r\\n0 1 1\\r\\n0 0 1\\r\\n0 0 0\\r\\n0 0 0\\r\\n1 1 0\\r\\n1 1 0\\r\\n1 0 1\\r\\n1 0 0\\r\\n1 0 1\\r\\n1 0 1\\r\\n0 1 1\\r\\n1 1 0\\r\\n1 1 0\\r\\n0 1 0\\r\\n1 0 1\\r\\n0 0 0\\r\\n0 0 0\\r\\n0 0 0\\r\\n0 0 1\\r\\n1 1 1\\r\\n0 1 1\\r\\n1 0 1\\r\\n'], 'output': ['29\\r\\n']}, {'input': ['1\\r\\n1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['8\\r\\n0 0 0\\r\\n0 0 1\\r\\n0 0 0\\r\\n0 1 1\\r\\n1 0 0\\r\\n1 0 1\\r\\n1 1 0\\r\\n1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['16\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n'], 'output': ['16\\r\\n']}]","id":449} {"difficulty":800,"lang":"Kotlin 1.7","lang_cluster":"Kotlin","src_uid":"233_A","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.Scanner\r\nfun main(){\r\n val input=Scanner(System.`in`)\r\n val n=input.nextInt()\r\n result(n)\r\n }\r\nval result:(Int)->Unit={\r\n if(it==1){\r\n println(-1)\r\n }else{\r\n var c=0\r\n if(it%2!=0){\r\n c=1\r\n }\r\n var i=1\r\n while(i<=it-c-1){\r\n if(i!=1){\r\n print(\" \")\r\n }\r\n if(it%2!=0&&i==it-2){\r\n print(\"${i+2} $i ${i+1}\")\r\n break\r\n }\r\n print(\"${i+1} $i\")\r\n i+=2\r\n }\r\n }\r\n}\r\n","description":"A permutation is a sequence of integers p1,p2,...,pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of permutation p1,p2,...,pn.Nickolas adores permutations. He likes some permutations more than the others. He calls such permutations perfect. A perfect permutation is such permutation p that for any i (1\u2264i\u2264n) (n is the permutation size) the following equations hold ppi=i and pi\u2260i. Nickolas asks you to print any perfect permutation of size n for the given n.","input_specification":"A single line contains a single integer n (1\u2264n\u2264100) \u2014 the permutation size.\n","output_specification":"If a perfect permutation of size n doesn't exist, print a single integer -1. Otherwise print n distinct integers from 1 to n, p1,p2,...,pn \u2014 permutation p, that is perfect. Separate printed numbers by whitespaces.\n","notes":null,"sample_inputs":["1\n","2\n","4\n"],"sample_outputs":["-1\n","2 1 \n","2 1 4 3 \n"],"human_solution":"import java.util.LinkedList\r\nimport java.util.Scanner\r\nfun main(){\r\n val input=Scanner(System.`in`)\r\n val n=input.nextInt()\r\n result(n)\r\n }\r\nval result:(Int)->Unit={\r\n if(it%2!=0){\r\n println(-1)\r\n }else{\r\n var c=0\r\n if(it%2!=0){\r\n c=1\r\n }\r\n var i=1\r\n while(i<=it-c-1){\r\n if(i!=1){\r\n print(\" \")\r\n }\r\n if(it%2!=0&&i==it-2){\r\n print(\"${i+2} $i ${i+1}\")\r\n break\r\n }\r\n print(\"${i+1} $i\")\r\n i+=2\r\n }\r\n }\r\n}\r\n\r\n","testcases":"[{'input': ['1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['2 1 \\r\\n']}, {'input': ['4\\r\\n'], 'output': ['2 1 4 3 \\r\\n']}, {'input': ['3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['2 1 4 3 6 5 \\r\\n']}, {'input': ['7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 \\r\\n']}, {'input': ['8\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 \\r\\n']}, {'input': ['9\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 \\r\\n']}, {'input': ['11\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 \\r\\n']}, {'input': ['51\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['52\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 \\r\\n']}, {'input': ['84\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 \\r\\n']}, {'input': ['86\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 \\r\\n']}, {'input': ['100\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 \\r\\n']}, {'input': ['98\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 \\r\\n']}, {'input': ['96\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 \\r\\n']}, {'input': ['33\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['34\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 \\r\\n']}, {'input': ['36\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 \\r\\n']}, {'input': ['38\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 \\r\\n']}, {'input': ['40\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 \\r\\n']}, {'input': ['42\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 \\r\\n']}, {'input': ['44\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 \\r\\n']}, {'input': ['46\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 \\r\\n']}, {'input': ['48\\r\\n'], 'output': ['2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 \\r\\n']}]","id":450} {"difficulty":1100,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"fun main() {\n fun readInt() = readLine()!!.toInt()\n\n readLine()\n val dominoes = readLine()!!\n var count = 0\n var sol = 0\n var first = true\n var lastLeft = true\n for (c in dominoes)\n when (c) {\n '.' -> count++\n 'R' -> {\n sol += count\n count = 0\n lastLeft = false\n }\n 'L' -> {\n if (!first) sol += count % 2\n first = false\n count = 0\n lastLeft = true\n }\n }\n if (lastLeft) sol += count\n print(sol)\n}","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"],"human_solution":"import java.util.*\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val n : Int = sc.nextInt()\n val s : CharArray = sc.next().toCharArray()\n var count = 0\n\n for (i in 0 until n) {\n if (s[i] == 'R') {\n for (j in (i + 1) until n) {\n if (s[j] == 'L') {\n for (k in i..j) s[k] = 'x'\n if ((j - i) % 2 == 0) count++\n break\n }\n }\n } else continue\n }\n\n for (i in 0 until n) {\n if (s[i] == 'L') {\n for (j in 0..i) s[j] = 'x'\n break\n } else if (s[i] == '.') continue\n else break\n }\n\n for (i in (n - 1) downTo 0) {\n if (s[i] == 'R') {\n for (j in (n - 1) downTo i) s[j] = 'x'\n break\n } else if (s[i] == '.') continue\n else break\n }\n\n for (i in 0 until n)\n if (s[i] == '.')\n count++\n\n print(count)\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":451} {"difficulty":1100,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"5d11fa8528f1dc873d50b3417bef8c79","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/xXHEQR_MAENXx\n\/\/ You are not prepared!\n@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.random.Random\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\n\n\/\/@JvmField val INPUT = File(\"input.txt\").inputStream()\n\/\/@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n \/\/ Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C127 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\ninline fun String.sort(): String {\n var bhgdf = toCharArray()\n bhgdf.sort()\n return String(bhgdf)\n}\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val n = readInt()\n var ar = readIntArray(n)\n\n var res = 1\n for (i in 0..n-1) {\n var cur = 1\n if (i > 0) for (j in i-1 downTo 0) {\n println(\"$j \")\n if (ar[j] <= ar[j+1]) {\n ++cur\n }\n else {\n break\n }\n }\n\n if (i < n) for (j in i+1..n-1) {\n if (ar[j] <= ar[j-1]) {\n ++cur\n }\n else {\n break\n }\n }\n \/\/println(\"$res $cur\")\n res = max(res, cur)\n }\n println(res)\n}\n","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"],"human_solution":"fun main(args: Array) {\n val size = readLine()!!.toInt()\n val list = readLine()!!.split(\" \").map { it.toInt() }.toList()\n\n\n var max = 0\n list.forEachIndexed { index, element ->\n var (right, left) = getRightAndLeft(index)\n\n var sumLeft = 0\n var currentLeft = 0\n var canGoLeft: Boolean = false\n\n if (index == 0) {\n canGoLeft = false\n } else {\n currentLeft = list[left]\n canGoLeft = leftable(left, element, currentLeft)\n }\n\n while (canGoLeft) {\n sumLeft++\n if (left >= 0)\n currentLeft = list[left]\n left--\n if (left == -1)\n canGoLeft = false\n else\n canGoLeft = leftable(left, currentLeft, list[left])\n }\n\n var sumRight = 0\n var canGoRight = false\n var currentRight = 0\n\n if (index == size - 1)\n canGoRight = false\n else {\n currentRight = list[right]\n canGoRight = rightable(right, size, element, currentRight)\n }\n\n\n while (canGoRight) {\n sumRight++\n if (right < size)\n currentRight = list[right]\n right++\n if (right == size)\n canGoRight = false\n else\n canGoRight = rightable(right, size, currentRight, list[right])\n\n }\n\n if (sumRight + sumLeft > max) {\n max = sumRight + sumLeft\n }\n if (max == size - 1) {\n return@forEachIndexed\n }\n\n }\n\n print(max + 1)\n\n\/\/\n}\n\n\nprivate fun leftable(left: Int, element: Int, item: Int) =\n (left >= 0 && element >= item)\n\nprivate fun rightable(right: Int, size: Int, element: Int, item: Int) =\n (right < size && element >= item)\n\n\nfun getRightAndLeft(index: Int): Pair {\n return Pair(index + 1, index - 1)\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":452} {"difficulty":800,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"69850c2af99d60711bcff5870575e15e","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var arr = IntArray(n-1)\n\n for (i in 0..n - 2) {\n arr[i] = reader.nextInt()\n }\n var a: Int = reader.nextInt()\n var b: Int = reader.nextInt()\n\n var sum = 0\n var d = b - a\n var i = 0\n\n while(d > 0){\n sum = sum + arr[i]\n i++\n d--\n }\n println(sum)\n}\n","description":"The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i\u2009+\u20091. Reaching a certain rank i having not reached all the previous i\u2009-\u20091 ranks is impossible.Vasya has just reached a new rank of a, but he dreams of holding the rank of b. Find for how many more years Vasya should serve in the army until he can finally realize his dream.","input_specification":"The first input line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100). The second line contains n\u2009-\u20091 integers di (1\u2009\u2264\u2009di\u2009\u2264\u2009100). The third input line contains two integers a and b (1\u2009\u2264\u2009a\u2009<\u2009b\u2009\u2264\u2009n). The numbers on the lines are space-separated.","output_specification":"Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.","notes":null,"sample_inputs":["3\n5 6\n1 2","3\n5 6\n1 3"],"sample_outputs":["5","11"],"human_solution":"import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var arr = IntArray(n-1)\n\n for (i in 0..n - 2) {\n arr[i] = reader.nextInt()\n }\n var a: Int = reader.nextInt()\n var b: Int = reader.nextInt()\n var sum = 0\n\n while(a!=b){\n sum = sum + arr[a-1]\n a++\n }\n println(sum)\n}\n","testcases":"[{'input': '3\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '3\\r\\n5 6\\r\\n1 3\\r\\n', 'output': ['11\\r\\n']}, {'input': '2\\r\\n55\\r\\n1 2\\r\\n', 'output': ['55\\r\\n']}, {'input': '3\\r\\n85 78\\r\\n1 3\\r\\n', 'output': ['163\\r\\n']}, {'input': '4\\r\\n63 4 49\\r\\n2 3\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n93 83 42 56\\r\\n2 5\\r\\n', 'output': ['181\\r\\n']}, {'input': '6\\r\\n22 9 87 89 57\\r\\n1 6\\r\\n', 'output': ['264\\r\\n']}, {'input': '7\\r\\n52 36 31 23 74 78\\r\\n2 7\\r\\n', 'output': ['242\\r\\n']}, {'input': '8\\r\\n82 14 24 5 91 49 94\\r\\n3 8\\r\\n', 'output': ['263\\r\\n']}, {'input': '9\\r\\n12 40 69 39 59 21 59 5\\r\\n4 6\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n95 81 32 59 71 30 50 61 100\\r\\n1 6\\r\\n', 'output': ['338\\r\\n']}, {'input': '15\\r\\n89 55 94 4 15 69 19 60 91 77 3 94 91 62\\r\\n3 14\\r\\n', 'output': ['617\\r\\n']}, {'input': '20\\r\\n91 1 41 51 95 67 92 35 23 70 44 91 57 50 21 8 9 71 40\\r\\n8 17\\r\\n', 'output': ['399\\r\\n']}, {'input': '25\\r\\n70 95 21 84 97 39 12 98 53 24 78 29 84 65 70 22 100 17 69 27 62 48 35 80\\r\\n8 23\\r\\n', 'output': ['846\\r\\n']}, {'input': '30\\r\\n35 69 50 44 19 56 86 56 98 24 21 2 61 24 85 30 2 22 57 35 59 84 12 77 92 53 50 92 9\\r\\n1 16\\r\\n', 'output': ['730\\r\\n']}, {'input': '35\\r\\n2 34 47 15 27 61 6 88 67 20 53 65 29 68 77 5 78 86 44 98 32 81 91 79 54 84 95 23 65 97 22 33 42 87\\r\\n8 35\\r\\n', 'output': ['1663\\r\\n']}, {'input': '40\\r\\n32 88 59 36 95 45 28 78 73 30 97 13 13 47 48 100 43 21 22 45 88 25 15 13 63 25 72 92 29 5 25 11 50 5 54 51 48 84 23\\r\\n7 26\\r\\n', 'output': ['862\\r\\n']}, {'input': '45\\r\\n83 74 73 95 10 31 100 26 29 15 80 100 22 70 31 88 9 56 19 70 2 62 48 30 27 47 52 50 94 44 21 94 23 85 15 3 95 72 43 62 94 89 68 88\\r\\n17 40\\r\\n', 'output': ['1061\\r\\n']}, {'input': '50\\r\\n28 8 16 29 19 82 70 51 96 84 74 72 17 69 12 21 37 21 39 3 18 66 19 49 86 96 94 93 2 90 96 84 59 88 58 15 61 33 55 22 35 54 51 29 64 68 29 38 40\\r\\n23 28\\r\\n', 'output': ['344\\r\\n']}, {'input': '60\\r\\n24 28 25 21 43 71 64 73 71 90 51 83 69 43 75 43 78 72 56 61 99 7 23 86 9 16 16 94 23 74 18 56 20 72 13 31 75 34 35 86 61 49 4 72 84 7 65 70 66 52 21 38 6 43 69 40 73 46 5\\r\\n28 60\\r\\n', 'output': ['1502\\r\\n']}, {'input': '70\\r\\n69 95 34 14 67 61 6 95 94 44 28 94 73 66 39 13 19 71 73 71 28 48 26 22 32 88 38 95 43 59 88 77 80 55 17 95 40 83 67 1 38 95 58 63 56 98 49 2 41 4 73 8 78 41 64 71 60 71 41 61 67 4 4 19 97 14 39 20 27\\r\\n9 41\\r\\n', 'output': ['1767\\r\\n']}, {'input': '80\\r\\n65 15 43 6 43 98 100 16 69 98 4 54 25 40 2 35 12 23 38 29 10 89 30 6 4 8 7 96 64 43 11 49 89 38 20 59 54 85 46 16 16 89 60 54 28 37 32 34 67 9 78 30 50 87 58 53 99 48 77 3 5 6 19 99 16 20 31 10 80 76 82 56 56 83 72 81 84 60 28\\r\\n18 24\\r\\n', 'output': ['219\\r\\n']}, {'input': '90\\r\\n61 35 100 99 67 87 42 90 44 4 81 65 29 63 66 56 53 22 55 87 39 30 34 42 27 80 29 97 85 28 81 22 50 22 24 75 67 86 78 79 94 35 13 97 48 76 68 66 94 13 82 1 22 85 5 36 86 73 65 97 43 56 35 26 87 25 74 47 81 67 73 75 99 75 53 38 70 21 66 78 38 17 57 40 93 57 68 55 1\\r\\n12 44\\r\\n', 'output': ['1713\\r\\n']}, {'input': '95\\r\\n37 74 53 96 65 84 65 72 95 45 6 77 91 35 58 50 51 51 97 30 51 20 79 81 92 10 89 34 40 76 71 54 26 34 73 72 72 28 53 19 95 64 97 10 44 15 12 38 5 63 96 95 86 8 36 96 45 53 81 5 18 18 47 97 65 9 33 53 41 86 37 53 5 40 15 76 83 45 33 18 26 5 19 90 46 40 100 42 10 90 13 81 40 53\\r\\n6 15\\r\\n', 'output': ['570\\r\\n']}, {'input': '96\\r\\n51 32 95 75 23 54 70 89 67 3 1 51 4 100 97 30 9 35 56 38 54 77 56 98 43 17 60 43 72 46 87 61 100 65 81 22 74 38 16 96 5 10 54 22 23 22 10 91 9 54 49 82 29 73 33 98 75 8 4 26 24 90 71 42 90 24 94 74 94 10 41 98 56 63 18 43 56 21 26 64 74 33 22 38 67 66 38 60 64 76 53 10 4 65 76\\r\\n21 26\\r\\n', 'output': ['328\\r\\n']}, {'input': '97\\r\\n18 90 84 7 33 24 75 55 86 10 96 72 16 64 37 9 19 71 62 97 5 34 85 15 46 72 82 51 52 16 55 68 27 97 42 72 76 97 32 73 14 56 11 86 2 81 59 95 60 93 1 22 71 37 77 100 6 16 78 47 78 62 94 86 16 91 56 46 47 35 93 44 7 86 70 10 29 45 67 62 71 61 74 39 36 92 24 26 65 14 93 92 15 28 79 59\\r\\n6 68\\r\\n', 'output': ['3385\\r\\n']}, {'input': '98\\r\\n32 47 26 86 43 42 79 72 6 68 40 46 29 80 24 89 29 7 21 56 8 92 13 33 50 79 5 7 84 85 24 23 1 80 51 21 26 55 96 51 24 2 68 98 81 88 57 100 64 84 54 10 14 2 74 1 89 71 1 20 84 85 17 31 42 58 69 67 48 60 97 90 58 10 21 29 2 21 60 61 68 89 77 39 57 18 61 44 67 100 33 74 27 40 83 29 6\\r\\n8 77\\r\\n', 'output': ['3319\\r\\n']}, {'input': '99\\r\\n46 5 16 66 53 12 84 89 26 27 35 68 41 44 63 17 88 43 80 15 59 1 42 50 53 34 75 16 16 55 92 30 28 11 12 71 27 65 11 28 86 47 24 10 60 47 7 53 16 75 6 49 56 66 70 3 20 78 75 41 38 57 89 23 16 74 30 39 1 32 49 84 9 33 25 95 75 45 54 59 17 17 29 40 79 96 47 11 69 86 73 56 91 4 87 47 31 24\\r\\n23 36\\r\\n', 'output': ['514\\r\\n']}, {'input': '100\\r\\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 27 85 85 63\\r\\n43 92\\r\\n', 'output': ['2599\\r\\n']}, {'input': '51\\r\\n85 38 22 38 42 36 55 24 36 80 49 15 66 91 88 61 46 82 1 61 89 92 6 56 28 8 46 80 56 90 91 38 38 17 69 64 57 68 13 44 45 38 8 72 61 39 87 2 73 88\\r\\n15 27\\r\\n', 'output': ['618\\r\\n']}, {'input': '2\\r\\n3\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n6 8 22 22\\r\\n2 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '6\\r\\n3 12 27 28 28\\r\\n3 4\\r\\n', 'output': ['27\\r\\n']}, {'input': '9\\r\\n1 2 2 2 2 3 3 5\\r\\n3 7\\r\\n', 'output': ['9\\r\\n']}, {'input': '10\\r\\n1 1 1 1 1 1 1 1 1\\r\\n6 8\\r\\n', 'output': ['2\\r\\n']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3\\r\\n5 17\\r\\n', 'output': ['23\\r\\n']}, {'input': '25\\r\\n1 1 1 4 5 6 8 11 11 11 11 12 13 14 14 14 15 16 16 17 17 17 19 19\\r\\n4 8\\r\\n', 'output': ['23\\r\\n']}, {'input': '35\\r\\n1 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\\r\\n30 31\\r\\n', 'output': ['2\\r\\n']}, {'input': '45\\r\\n1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 9 9 10 10 10\\r\\n42 45\\r\\n', 'output': ['30\\r\\n']}, {'input': '50\\r\\n1 8 8 13 14 15 15 16 19 21 22 24 26 31 32 37 45 47 47 47 50 50 51 54 55 56 58 61 61 61 63 63 64 66 66 67 67 70 71 80 83 84 85 92 92 94 95 95 100\\r\\n4 17\\r\\n', 'output': ['285\\r\\n']}, {'input': '60\\r\\n1 2 4 4 4 6 6 8 9 10 10 13 14 18 20 20 21 22 23 23 26 29 30 32 33 34 35 38 40 42 44 44 46 48 52 54 56 56 60 60 66 67 68 68 69 73 73 74 80 80 81 81 82 84 86 86 87 89 89\\r\\n56 58\\r\\n', 'output': ['173\\r\\n']}, {'input': '70\\r\\n1 2 3 3 4 5 5 7 7 7 8 8 8 8 9 9 10 12 12 12 12 13 16 16 16 16 16 16 17 17 18 18 20 20 21 23 24 25 25 26 29 29 29 29 31 32 32 34 35 36 36 37 37 38 39 39 40 40 40 40 41 41 42 43 44 44 44 45 45\\r\\n62 65\\r\\n', 'output': ['126\\r\\n']}, {'input': '80\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12\\r\\n17 65\\r\\n', 'output': ['326\\r\\n']}, {'input': '90\\r\\n1 1 3 5 8 9 10 11 11 11 11 12 13 14 15 15 15 16 16 19 19 20 22 23 24 25 25 28 29 29 30 31 33 34 35 37 37 38 41 43 43 44 45 47 51 54 55 56 58 58 59 59 60 62 66 67 67 67 68 68 69 70 71 72 73 73 76 77 77 78 78 78 79 79 79 82 83 84 85 85 87 87 89 93 93 93 95 99 99\\r\\n28 48\\r\\n', 'output': ['784\\r\\n']}, {'input': '95\\r\\n2 2 3 3 4 6 6 7 7 7 9 10 12 12 12 12 13 14 15 16 17 18 20 20 20 20 21 21 21 21 22 22 22 22 22 23 23 23 25 26 26 27 27 27 28 29 29 30 30 31 32 33 34 36 37 37 38 39 39 39 42 43 43 43 45 47 48 50 50 51 52 53 54 54 54 55 55 55 58 59 60 61 61 61 61 62 62 63 64 65 66 67 67 67\\r\\n64 93\\r\\n', 'output': ['1636\\r\\n']}, {'input': '96\\r\\n1 1 2 3 3 5 8 9 9 10 10 10 11 11 11 11 11 12 13 13 13 14 15 15 16 16 17 17 17 17 18 18 20 20 20 21 21 21 23 24 24 25 25 26 27 27 27 27 29 29 29 30 30 30 32 32 32 32 32 32 33 33 34 34 34 35 35 35 36 36 37 37 37 38 39 40 41 41 41 41 42 42 43 43 45 45 45 46 46 47 47 49 50 52 52\\r\\n76 96\\r\\n', 'output': ['898\\r\\n']}, {'input': '98\\r\\n2 3 4 4 5 7 8 10 10 10 11 11 12 12 12 12 13 14 15 15 16 16 18 19 19 20 21 21 21 21 22 23 24 25 26 26 27 27 27 27 29 29 30 30 31 31 37 40 40 40 41 41 41 42 43 44 44 44 46 46 47 49 49 50 50 50 51 53 55 55 56 56 56 56 56 57 57 58 59 60 60 60 62 62 63 64 64 64 65 66 66 67 68 70 70 71 71\\r\\n8 90\\r\\n', 'output': ['3016\\r\\n']}, {'input': '99\\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\\r\\n66 95\\r\\n', 'output': ['29\\r\\n']}, {'input': '100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 16 16 16 17 17\\r\\n39 52\\r\\n', 'output': ['82\\r\\n']}, {'input': '51\\r\\n5 7 9 16 19 25 26 29 29 30 31 32 32 41 43 44 47 49 50 50 51 52 54 55 56 63 64 66 67 70 74 74 77 78 79 80 80 85 86 87 89 89 90 92 93 94 94 95 95 97\\r\\n3 44\\r\\n', 'output': ['2268\\r\\n']}]","id":453} {"difficulty":900,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"6b22e93f7e429693dcfe3c099346dcda","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.Scanner\nfun main()\n{\n var n = readLine()!!.toInt()\n var s = readLine()!!.toString()\n if(n>26)println(\"Yes\")\n else{\n var str=\"abcdefghijklmnopqrstuvwxyz\"\n var f=0\n for(i in 0..str.length-1)\n {\n var c=0\n for(j in 0..s.length-1)\n {\n if(s[j]==str[i])c+=1\n }\n if(c>=2)\n {\n f=1\n break\n }\n }\n if(f==1)println(\"Yes\")\n else println(\"No\")\n }\n}","description":"Panic is rising in the committee for doggo standardization\u00a0\u2014 the puppies of the new brood have been born multi-colored! In total there are 26 possible colors of puppies in the nature and they are denoted by letters from 'a' to 'z' inclusive.The committee rules strictly prohibit even the smallest diversity between doggos and hence all the puppies should be of the same color. Thus Slava, the committee employee, has been assigned the task to recolor some puppies into other colors in order to eliminate the difference and make all the puppies have one common color.Unfortunately, due to bureaucratic reasons and restricted budget, there's only one operation Slava can perform: he can choose a color $$$x$$$ such that there are currently at least two puppies of color $$$x$$$ and recolor all puppies of the color $$$x$$$ into some arbitrary color $$$y$$$. Luckily, this operation can be applied multiple times (including zero).For example, if the number of puppies is $$$7$$$ and their colors are represented as the string \"abababc\", then in one operation Slava can get the results \"zbzbzbc\", \"bbbbbbc\", \"aaaaaac\", \"acacacc\" and others. However, if the current color sequence is \"abababc\", then he can't choose $$$x$$$='c' right now, because currently only one puppy has the color 'c'.Help Slava and the committee determine whether it is possible to standardize all the puppies, i.e. after Slava's operations all the puppies should have the same color.","input_specification":"The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^5$$$)\u00a0\u2014 the number of puppies. The second line contains a string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters, where the $$$i$$$-th symbol denotes the $$$i$$$-th puppy's color.","output_specification":"If it's possible to recolor all puppies into one color, print \"Yes\". Otherwise print \"No\". Output the answer without quotation signs.","notes":"NoteIn the first example Slava can perform the following steps: take all puppies of color 'a' (a total of two) and recolor them into 'b'; take all puppies of color 'd' (a total of two) and recolor them into 'c'; take all puppies of color 'b' (three puppies for now) and recolor them into 'c'. In the second example it's impossible to recolor any of the puppies.In the third example all the puppies' colors are the same; thus there's no need to recolor anything.","sample_inputs":["6\naabddc","3\nabc","3\njjj"],"sample_outputs":["Yes","No","Yes"],"human_solution":"fun main() {\n val t = readLine()!!.toInt()\n val z = readLine()!!.toCharArray()\n val sett = z.toHashSet()\n if (sett.size == t && t > 1)\n {\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n }\n","testcases":"[{'input': '6\\r\\naabddc\\r\\n', 'output': ['Yes', 'YES']}, {'input': '3\\r\\nabc\\r\\n', 'output': ['No', 'NO']}, {'input': '3\\r\\njjj\\r\\n', 'output': ['Yes', 'YES']}, {'input': '1\\r\\nd\\r\\n', 'output': ['Yes', 'YES']}, {'input': '26\\r\\nadtopxgnculmhfkezrwsvqbiyj\\r\\n', 'output': ['No', 'NO']}, {'input': '100000\\r\\ncganvvbggmnbccuregvlvbjgbvggdeutrdjjectltnvatrkcmncjgbvdugvbnurrvaadgnbkkmlomnkducjrtrjntavaclbemtgkvdbmgvarumuuecocdmacrlvrmudgajvmggbadomgertmoollmrkrvtbdtjotlrnlomjbogctdodarkboaljmvtjkmrmvttodlkeugnendgbrkavnjgodmcenmguaartgkokbudgcdjcuoeuudgrmmegourvadmltbljcbkejtgjjbncnektmbdjcvvurnvakcbdlbdblcckbamoojutultaomtddruuctegbmdvvlcnotbgrvcngtmdgjatbbjdejrodvvakcgubjtououanrvdkoreuljbklombankndmuncgvglovoljoegmtltnblnlcjuruueteagcnvrtmubcntelrcnougnurmlggattbbuulgbetkakkvcrtomncaoretvgbdrtuauukvkcg...', 'output': ['Yes', 'YES']}, {'input': '100000\\r\\nggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...', 'output': ['Yes', 'YES']}, {'input': '2\\r\\naz\\r\\n', 'output': ['No', 'NO']}, {'input': '100000\\r\\nquiddxogvdgpyhaytufmzlaathrlowulynbdpboglizxskbkihwyrjpcjexzwbbxifyumetcgmzausudcncwkthvxhzxwynfmvmjmujwpfeuhdjuscikotmontcndrbehkimcjqhyxxpjcaiuksahuhxfriybuwkfmogrzgcxnukhticdyvatiuuvnnngesgbusqkmpuktuaqrtulxblamcwjubnetqfpkeitpqrgcdiozcozfqrcrtteucsigsbszjfjpumoiiiljrmtfywbzokjoqgbhoghdqvkeopineonomdssexsbmnoenjhgnclkwaxlrqlquvuzqacfvuijrylhwslxqbfotqsfnqbirqcnywpenlcrkaotisswsqykjjrbuauhhubynrsuwgvmpowobkfyhaohcukymmicbkannwxpugmabvqbyzmkedxmseapbvbqqqyvgcscpfstqhxueivinqehorniojsbtfdkdxzkzydmk...', 'output': ['Yes', 'YES']}, {'input': '5\\r\\nfnfvn\\r\\n', 'output': ['Yes', 'YES']}, {'input': '7\\r\\nkssssss\\r\\n', 'output': ['Yes', 'YES']}, {'input': '100000\\r\\nypiibktskqroouudfrprylovornrrxlusoddaakotakiyqlvtrzkxzpxtopbbukluqrdtbbfzuuriudrfqxaqsamsltsisxynaiykulxylxkzuvxuvqxorvtrzalyuyfxdvsbokkuxzfaimsfbavlbufurvntxqmtdnbpzmspivdlbuiidkpkqykovuiyaamkuonnbnafaoazaiupmbmamrrkalfbulnipxafifnrumfzaaqbkkvxzzrdyrddtsaqqypqqqnpkzfkkmirksdaayqxivvpfasrsnzovkqrynnlnxkzmirxlqrdkousimlosixlvuytfmmfrmstrliprbqvdmpmonfnffxfrstdmtyqqsmzdsurzlpfbadtrdmrxisqoumrxxxvsbtparmmusszrplyadsqamqqntalxfmnmzixaxlutvutodyidflsfmompoaoatllntaaanvqffbyymuapamtrpuofuvvdavmryfbupmmmt...', 'output': ['Yes', 'YES']}, {'input': '10\\r\\nuyouuzyyrb\\r\\n', 'output': ['Yes', 'YES']}, {'input': '100000\\r\\nyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy...', 'output': ['Yes', 'YES']}, {'input': '3\\r\\ngcw\\r\\n', 'output': ['No', 'NO']}, {'input': '15\\r\\nnrnuugruronnsur\\r\\n', 'output': ['Yes', 'YES']}, {'input': '27\\r\\nmnpsweykjdvaxyiqtgcuzhbfrlo\\r\\n', 'output': ['Yes', 'YES']}, {'input': '2\\r\\naa\\r\\n', 'output': ['Yes', 'YES']}, {'input': '2\\r\\nba\\r\\n', 'output': ['No', 'NO']}, {'input': '3\\r\\naba\\r\\n', 'output': ['Yes', 'YES']}, {'input': '2\\r\\nzz\\r\\n', 'output': ['Yes', 'YES']}, {'input': '1\\r\\ne\\r\\n', 'output': ['Yes', 'YES']}, {'input': '4\\r\\nabab\\r\\n', 'output': ['Yes', 'YES']}, {'input': '4\\r\\nabcc\\r\\n', 'output': ['Yes', 'YES']}, {'input': '6\\r\\naabcde\\r\\n', 'output': ['Yes', 'YES']}, {'input': '3\\r\\nzza\\r\\n', 'output': ['Yes', 'YES']}, {'input': '27\\r\\nabcdefghijklmnopqrstuvwxyza\\r\\n', 'output': ['Yes', 'YES']}, {'input': '5\\r\\naabcd\\r\\n', 'output': ['Yes', 'YES']}, {'input': '3\\r\\naaa\\r\\n', 'output': ['Yes', 'YES']}, {'input': '9\\r\\nabcdefghh\\r\\n', 'output': ['Yes', 'YES']}, {'input': '6\\r\\nabcdee\\r\\n', 'output': ['Yes', 'YES']}, {'input': '4\\r\\naabc\\r\\n', 'output': ['Yes', 'YES']}, {'input': '4\\r\\nabca\\r\\n', 'output': ['Yes', 'YES']}, {'input': '10\\r\\naabcdefghi\\r\\n', 'output': ['Yes', 'YES']}, {'input': '5\\r\\nabvca\\r\\n', 'output': ['Yes', 'YES']}, {'input': '100000\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...', 'output': ['Yes', 'YES']}]","id":454} {"difficulty":800,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"WRONG_ANSWER","source_code":"import java.util.*\nfun main(args: Array) {var reader = Scanner(System.`in`)\n var numOfChild = reader.nextInt()\n var numOfThrow = numOfChild-1\n var c=1\n var w=1\n for (i in 1..numOfThrow)\n {\n c= c+w\n if (c>=numOfChild)\n {\n c-=numOfChild\n }\n w++\n print(\"$c \")\n }\n}","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"],"human_solution":"import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var list: MutableList = mutableListOf()\n\n var c = 1\n var s = 1\n for(i in 1..n){\n c++\n\n if(c<=n){\n list.add(c)\n }\n else{\n list.add(c%n)\n }\n c = c + s\n s++\n }\n for(i in 0..n-2) {\n if(list[i]==0) {\n print(n)\n }\n else {\n print(list[i])\n }\n print(\" \")\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":455} {"difficulty":1300,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"88d56c1e3a7ffa94354ce0c70d8e958f","execute_outcome":"RUNTIME_ERROR","source_code":"fun main(args: Array) {\n val n = readLine()!!.toInt()\n var s = readLine()!!.split(\":\").toMutableList()\n if (n == 12) {\n if (s[0].toInt() > 12) {\n if (s[0][1].toInt() != 1) s[0] = \"0\" + s[0].drop(1)\n else s[0] = \"1\" + s[0].drop(1)\n } else if (s[0].toInt() == 0) s[0] = \"1\" + s[0].drop(1)\n } else if (s[0].toInt() > 23) s[0] = \"0\" + s[0].drop(1)\n\n if (s[1].toInt() >= 60) s[1] = \"0\" + s[1].drop(1)\n print(s.joinToString(\":\"))\n}","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"],"human_solution":"import java.io.*\nimport java.util.*\n\nfun dif(a: Int, b: Int) : Int {\n val x = a - b\n return (if (x \/ 10 == 0) 0 else 1) + (if (x % 10 == 0) 0 else 1)\n}\n\nfun solve(start: Int, end: Int, num: Int) : Int {\n var minDif = 3\n var minv = -1\n for (i in start..end) {\n var d = dif(i, num)\n if (d < minDif) {\n minDif = d\n minv = i\n }\n }\n return minv\n}\n\nfun main(args : Array) {\n\/\/ val fin = Scanner(File(\"a.in\"))\n val fin = Scanner(System.`in`)\n val form = fin.nextInt()\n val sh = if (form == 12) 1 else 0\n val eh = if (form == 12) 12 else 23\n val sm = 0\n val em = 59\n val str = fin.next()\n val hours = str.substring(0, 2).toInt()\n val mins = str.substring(3, 5).toInt()\n print(\"%02d\".format(solve(sh, eh, hours)))\n print(\":\")\n print(\"%02d\".format(solve(sm, em, mins)))\n fin.close()\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":456} {"difficulty":800,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"b69170c8377623beb66db4706a02ffc6","execute_outcome":"WRONG_ANSWER","source_code":"fun main()= repeat(readLine()!!.toInt()){ var r = readLine()!!.toInt();print(if (r % 2 == 0) (r\/2) -1 else r\/2) }","description":"There are two sisters Alice and Betty. You have $$$n$$$ candies. You want to distribute these $$$n$$$ candies between two sisters in such a way that: Alice will get $$$a$$$ ($$$a > 0$$$) candies; Betty will get $$$b$$$ ($$$b > 0$$$) candies; each sister will get some integer number of candies; Alice will get a greater amount of candies than Betty (i.e. $$$a > b$$$); all the candies will be given to one of two sisters (i.e. $$$a+b=n$$$). Your task is to calculate the number of ways to distribute exactly $$$n$$$ candies between sisters in a way described above. Candies are indistinguishable.Formally, find the number of ways to represent $$$n$$$ as the sum of $$$n=a+b$$$, where $$$a$$$ and $$$b$$$ are positive integers and $$$a>b$$$.You have to answer $$$t$$$ independent test cases.","input_specification":"The first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) \u2014 the number of test cases. Then $$$t$$$ test cases follow. The only line of a test case contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^9$$$) \u2014 the number of candies you have.","output_specification":"For each test case, print the answer \u2014 the number of ways to distribute exactly $$$n$$$ candies between two sisters in a way described in the problem statement. If there is no way to satisfy all the conditions, print $$$0$$$.","notes":"NoteFor the test case of the example, the $$$3$$$ possible ways to distribute candies are: $$$a=6$$$, $$$b=1$$$; $$$a=5$$$, $$$b=2$$$; $$$a=4$$$, $$$b=3$$$. ","sample_inputs":["6\n7\n1\n2\n3\n2000000000\n763243547"],"sample_outputs":["3\n0\n0\n1\n999999999\n381621773"],"human_solution":"fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n repeat(r.readLine()!!.toInt()){\n val n = r.readLine()!!.toInt()\n when{\n n == 1 || n ==2 -> {\n println(0)}\n else -> println((n+1)\/2-1)\n }\n }\n}","testcases":"[{'input': '6\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773']}, {'input': '10000\\r\\n1999998163\\r\\n1999998749\\r\\n3608\\r\\n1999995797\\r\\n3253\\r\\n1999998518\\r\\n3146\\r\\n938\\r\\n1999996903\\r\\n2957\\r\\n966\\r\\n1738464254\\r\\n2474\\r\\n2226\\r\\n1999997073\\r\\n1999995579\\r\\n1168\\r\\n91\\r\\n1999998757\\r\\n1999999297\\r\\n3541\\r\\n3769\\r\\n70\\r\\n3838\\r\\n1045411991\\r\\n1999996556\\r\\n4163\\r\\n1999999008\\r\\n1999997424\\r\\n1999997409\\r\\n3413\\r\\n2952\\r\\n1999996689\\r\\n1911\\r\\n1999998790\\r\\n1999997406\\r\\n4161\\r\\n1999998785\\r\\n2273\\r\\n1999998472\\r\\n973\\r\\n2749\\r\\n1999996019\\r\\n1999998967\\r\\n1999999115\\r\\n1999998605\\r\\n3081\\r\\n1633009152\\r\\n1999997493\\r\\n1999996534\\r\\n1999997510\\r\\n1999999805\\r\\n1956085790\\r\\n3818\\r\\n1999997...', 'output': ['999999081\\r\\n999999374\\r\\n1803\\r\\n999997898\\r\\n1626\\r\\n999999258\\r\\n1572\\r\\n468\\r\\n999998451\\r\\n1478\\r\\n482\\r\\n869232126\\r\\n1236\\r\\n1112\\r\\n999998536\\r\\n999997789\\r\\n583\\r\\n45\\r\\n999999378\\r\\n999999648\\r\\n1770\\r\\n1884\\r\\n34\\r\\n1918\\r\\n522705995\\r\\n999998277\\r\\n2081\\r\\n999999503\\r\\n999998711\\r\\n999998704\\r\\n1706\\r\\n1475\\r\\n999998344\\r\\n955\\r\\n999999394\\r\\n999998702\\r\\n2080\\r\\n999999392\\r\\n1136\\r\\n999999235\\r\\n486\\r\\n1374\\r\\n999998009\\r\\n999999483\\r\\n999999557\\r\\n999999302\\r\\n1540\\r\\n816504575\\r\\n999998746\\r\\n999998266\\r\\n999998754\\r\\n999999902\\r\\n978042894\\r\\n1908\\r\\n999998701\\r\\n999999380\\r\\n999998341\\r\\n1743\\r\\n9999979...', '999999081\\n999999374\\n1803\\n999997898\\n1626\\n999999258\\n1572\\n468\\n999998451\\n1478\\n482\\n869232126\\n1236\\n1112\\n999998536\\n999997789\\n583\\n45\\n999999378\\n999999648\\n1770\\n1884\\n34\\n1918\\n522705995\\n999998277\\n2081\\n999999503\\n999998711\\n999998704\\n1706\\n1475\\n999998344\\n955\\n999999394\\n999998702\\n2080\\n999999392\\n1136\\n999999235\\n486\\n1374\\n999998009\\n999999483\\n999999557\\n999999302\\n1540\\n816504575\\n999998746\\n999998266\\n999998754\\n999999902\\n978042894\\n1908\\n999998701\\n999999380\\n999998341\\n1743\\n999997960\\n953\\n999998982\\n936778166\\n301\\n999999608\\n879\\n261\\n999998090...']}, {'input': '2\\r\\n1\\r\\n2\\r\\n', 'output': ['0\\r\\n0', '0\\n0']}, {'input': '1\\r\\n108139\\r\\n', 'output': ['54069']}, {'input': '5\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0\\n0\\n0', '0\\r\\n0\\r\\n0\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\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', 'output': ['0\\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', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0']}, {'input': '1\\r\\n121112422\\r\\n', 'output': ['60556210']}, {'input': '1\\r\\n1411\\r\\n', 'output': ['705']}, {'input': '39\\r\\n2\\r\\n3\\r\\n5\\r\\n7\\r\\n9\\r\\n8\\r\\n6\\r\\n5\\r\\n4\\r\\n4\\r\\n9\\r\\n4\\r\\n5\\r\\n6\\r\\n8\\r\\n1\\r\\n5\\r\\n4\\r\\n3\\r\\n10\\r\\n7\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n5\\r\\n6\\r\\n2\\r\\n5\\r\\n9\\r\\n9\\r\\n6\\r\\n6\\r\\n4\\r\\n5\\r\\n3\\r\\n10\\r\\n10\\r\\n1\\r\\n', 'output': ['0\\n1\\n2\\n3\\n4\\n3\\n2\\n2\\n1\\n1\\n4\\n1\\n2\\n2\\n3\\n0\\n2\\n1\\n1\\n4\\n3\\n0\\n0\\n1\\n1\\n2\\n2\\n0\\n2\\n4\\n4\\n2\\n2\\n1\\n2\\n1\\n4\\n4\\n0', '0\\r\\n1\\r\\n2\\r\\n3\\r\\n4\\r\\n3\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n0\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n0\\r\\n2\\r\\n4\\r\\n4\\r\\n2\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n4\\r\\n4\\r\\n0']}, {'input': '39\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n7\\r\\n1\\r\\n2\\r\\n', 'output': ['3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0\\n1\\n999999999\\n381621773\\n3\\n0\\n0', '3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773\\r\\n3\\r\\n0\\r\\n0']}, {'input': '39\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n32\\r\\n32\\r\\n34\\r\\n35\\r\\n36\\r\\n37\\r\\n35\\r\\n39\\r\\n', 'output': ['0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15\\n15\\n15\\n16\\n17\\n17\\n18\\n17\\n19', '0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15\\r\\n15\\r\\n15\\r\\n16\\r\\n17\\r\\n17\\r\\n18\\r\\n17\\r\\n19']}, {'input': '98\\r\\n710\\r\\n896\\r\\n635\\r\\n909\\r\\n528\\r\\n799\\r\\n184\\r\\n970\\r\\n731\\r\\n285\\r\\n481\\r\\n62\\r\\n829\\r\\n815\\r\\n204\\r\\n927\\r\\n48\\r\\n958\\r\\n858\\r\\n549\\r\\n722\\r\\n900\\r\\n290\\r\\n96\\r\\n414\\r\\n323\\r\\n488\\r\\n140\\r\\n494\\r\\n286\\r\\n783\\r\\n551\\r\\n896\\r\\n580\\r\\n724\\r\\n766\\r\\n841\\r\\n914\\r\\n200\\r\\n170\\r\\n384\\r\\n664\\r\\n14\\r\\n203\\r\\n582\\r\\n203\\r\\n678\\r\\n502\\r\\n677\\r\\n318\\r\\n189\\r\\n144\\r\\n97\\r\\n330\\r\\n169\\r\\n20\\r\\n492\\r\\n233\\r\\n198\\r\\n876\\r\\n697\\r\\n624\\r\\n877\\r\\n514\\r\\n828\\r\\n41\\r\\n575\\r\\n959\\r\\n499\\r\\n786\\r\\n621\\r\\n878\\r\\n547\\r\\n409\\r\\n194\\r\\n59\\r\\n657\\r\\n893\\r\\n230\\r\\n559\\r\\n170\\r\\n238\\r\\n752\\r\\n854\\r\\n385\\r\\n365\\r\\n415\\r\\n505\\r\\n584\\r\\n434\\r\\n135\\r\\n136\\r\\n610\\r\\n525\\r\\n945\\r\\n889\\r\\n941\\r\\n579\\r\\n', 'output': ['354\\r\\n447\\r\\n317\\r\\n454\\r\\n263\\r\\n399\\r\\n91\\r\\n484\\r\\n365\\r\\n142\\r\\n240\\r\\n30\\r\\n414\\r\\n407\\r\\n101\\r\\n463\\r\\n23\\r\\n478\\r\\n428\\r\\n274\\r\\n360\\r\\n449\\r\\n144\\r\\n47\\r\\n206\\r\\n161\\r\\n243\\r\\n69\\r\\n246\\r\\n142\\r\\n391\\r\\n275\\r\\n447\\r\\n289\\r\\n361\\r\\n382\\r\\n420\\r\\n456\\r\\n99\\r\\n84\\r\\n191\\r\\n331\\r\\n6\\r\\n101\\r\\n290\\r\\n101\\r\\n338\\r\\n250\\r\\n338\\r\\n158\\r\\n94\\r\\n71\\r\\n48\\r\\n164\\r\\n84\\r\\n9\\r\\n245\\r\\n116\\r\\n98\\r\\n437\\r\\n348\\r\\n311\\r\\n438\\r\\n256\\r\\n413\\r\\n20\\r\\n287\\r\\n479\\r\\n249\\r\\n392\\r\\n310\\r\\n438\\r\\n273\\r\\n204\\r\\n96\\r\\n29\\r\\n328\\r\\n446\\r\\n114\\r\\n279\\r\\n84\\r\\n118\\r\\n375\\r\\n426\\r\\n192\\r\\n182\\r\\n207\\r\\n252\\r\\n291\\r\\n216\\r\\n67\\r\\n67\\r\\n304\\r\\n262\\r\\n472\\r\\n444\\r\\n470\\r\\n289', '354\\n447\\n317\\n454\\n263\\n399\\n91\\n484\\n365\\n142\\n240\\n30\\n414\\n407\\n101\\n463\\n23\\n478\\n428\\n274\\n360\\n449\\n144\\n47\\n206\\n161\\n243\\n69\\n246\\n142\\n391\\n275\\n447\\n289\\n361\\n382\\n420\\n456\\n99\\n84\\n191\\n331\\n6\\n101\\n290\\n101\\n338\\n250\\n338\\n158\\n94\\n71\\n48\\n164\\n84\\n9\\n245\\n116\\n98\\n437\\n348\\n311\\n438\\n256\\n413\\n20\\n287\\n479\\n249\\n392\\n310\\n438\\n273\\n204\\n96\\n29\\n328\\n446\\n114\\n279\\n84\\n118\\n375\\n426\\n192\\n182\\n207\\n252\\n291\\n216\\n67\\n67\\n304\\n262\\n472\\n444\\n470\\n289']}, {'input': '102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n102\\r\\n1...', 'output': ['50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50\\n50', '50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50\\r\\n50']}, {'input': '1411\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...', 'output': ['0\\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\\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...', '0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0\\n0...']}, {'input': '3\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['0\\n0\\n0', '0\\r\\n0\\r\\n0']}, {'input': '1\\r\\n10\\r\\n', 'output': ['4']}, {'input': '7\\r\\n1\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n2000000000\\r\\n763243547\\r\\n', 'output': ['0\\r\\n3\\r\\n0\\r\\n0\\r\\n1\\r\\n999999999\\r\\n381621773', '0\\n3\\n0\\n0\\n1\\n999999999\\n381621773']}, {'input': '3\\r\\n3\\r\\n4\\r\\n5\\r\\n', 'output': ['1\\r\\n1\\r\\n2', '1\\n1\\n2']}, {'input': '31\\r\\n1\\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\\n17\\r\\n18\\r\\n19\\r\\n20\\r\\n21\\r\\n22\\r\\n23\\r\\n24\\r\\n25\\r\\n26\\r\\n27\\r\\n28\\r\\n29\\r\\n30\\r\\n31\\r\\n', 'output': ['0\\r\\n0\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n3\\r\\n4\\r\\n4\\r\\n5\\r\\n5\\r\\n6\\r\\n6\\r\\n7\\r\\n7\\r\\n8\\r\\n8\\r\\n9\\r\\n9\\r\\n10\\r\\n10\\r\\n11\\r\\n11\\r\\n12\\r\\n12\\r\\n13\\r\\n13\\r\\n14\\r\\n14\\r\\n15', '0\\n0\\n1\\n1\\n2\\n2\\n3\\n3\\n4\\n4\\n5\\n5\\n6\\n6\\n7\\n7\\n8\\n8\\n9\\n9\\n10\\n10\\n11\\n11\\n12\\n12\\n13\\n13\\n14\\n14\\n15']}, {'input': '1\\r\\n54334\\r\\n', 'output': ['27166']}, {'input': '1\\r\\n54332\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54331\\r\\n', 'output': ['27165']}, {'input': '1\\r\\n54335\\r\\n', 'output': ['27167']}, {'input': '1\\r\\n54330\\r\\n', 'output': ['27164']}]","id":457} {"difficulty":1000,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"COMPILATION_ERROR","source_code":"import java.util.Scanner\n\nval checker: (String, Int) -> Boolean = {str, int -> str.length < int}\nval diffvals: String -> Int= {word -> word.chars().distinct().count()}\n\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var word = inp.next()\n var diffs = inp.nextInt()\n \n if(checker(word, diffs)) {\n println(\"impossible\")\n } else {\n println(word.length - diffs)\n }\n}","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"],"human_solution":"fun main() {\n val input = readLine()!!\n val size = input.toCharArray().distinct().size\n val desired = readLine()!!.toInt()\n if (desired > input.length) {\n println(\"impossible\")\n } else {\n val ans = (desired - size).coerceAtLeast(0)\n println(ans)\n }\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":458} {"difficulty":1000,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val input = scanner.nextInt()\n\n val countList = MutableList(input) {n -> false}\n var result = 0\n\n repeat(input) {\n val nextNum = scanner.nextInt()\n\n if (countList[nextNum - 1]) {\n result++\n } else {\n countList[nextNum - 1] = true\n }\n }\n\n println(result)\n}","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"],"human_solution":"import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val input = scanner.nextInt()\n\n val countList = MutableList(input) {n -> false}\n var currentCount = 0\n var result = 0\n\n while (scanner.hasNext()) {\n val nextNum = scanner.nextInt()\n\n if (currentCount == input) {\n break\n }\n currentCount++\n\n if (nextNum > input) {\n result++\n } else {\n if (countList[nextNum - 1]) {\n result++\n } else {\n countList[nextNum - 1] = true\n }\n }\n\n if (result == input) {\n break\n } else {\n continue\n }\n }\n\n println(result)\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":459} {"difficulty":1200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n var drift = MutableList(n) {\n val (a, b) = r.readLine()!!.split(\" \").map { it.toInt() }\n Pair(a, b)\n }\n var ans = 0\n while (drift.isNotEmpty()) {\n ans++\n val (x, y) = drift.removeAt(0)\n val i = drift.indexOfFirst { it.first == x || it.second == y }\n val cadidate = mutableListOf>()\n var nodDone = false\n if (i != -1) {\n cadidate += drift.removeAt(i)\n nodDone = true\n }\n while (nodDone) {\n nodDone = false\n for ((x1, y1) in cadidate) {\n val ind = drift.indexOfFirst { it.first == x1 || it.second == y1 }\n if (ind != -1) {\n nodDone = true\n cadidate += drift.removeAt(ind)\n break\n }\n }\n }\n }\n println(ans - 1)\n}","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"],"human_solution":"import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\nval scanner = Scanner(System.`in`)\nvar n = scanner.nextInt()\nval arr = Array>>(1000) { y -> Array>(1000) { Pair(it, y) } }\nvar x = IntArray(1000) { -1 }\nvar y = IntArray(1000) { -1 }\nfun get(x: Int, y: Int): Pair {\n if (arr[y][x].first != x || arr[y][x].second != y)\n arr[y][x] = get(arr[y][x].first, arr[y][x].second)\n return arr[y][x]\n}\nfun join(x1: Int, y1: Int, x2: Int, y2: Int) {\n val root = get(x1, y1)\n arr[root.second][root.first] = get(x2, y2)\n}\n\nfun run() {\n\n var res = 0\n for (i in 0 until n) {\n val a = scanner.nextInt() - 1\n val b = scanner.nextInt() - 1\n if (x[b] != -1 && y[a] != -1 && get(b, x[b]) != get(y[a], a))\n res--\n if (x[b] != -1)\n join(b, a, b, x[b])\n if (y[a] != -1)\n join(b, a, y[a], a)\n if (x[b] == -1 && y[a] == -1)\n res++\n if (x[b] == -1)\n x[b] = a\n if (y[a] == -1)\n y[a] = b\n }\n println(res - 1)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\nfun Array.print() {\n for (i in this)\n i.print()\n}","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":460} {"difficulty":800,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"d54201591f7284da5e9ce18984439f4e","execute_outcome":"WRONG_ANSWER","source_code":"fun main() {\n val x = getInputInt()\n val y = getInputInt()\n val z = getInputInt()\n\n val a = getInputInt()\n val b = getInputInt()\n val c = getInputInt()\n\n val grapesMap = mutableMapOf(\n \"green\" to a,\n \"purple\" to b,\n \"black\" to c\n )\n\n provideAndrew(grapesMap, x)\n provideDmitri(grapesMap, y)\n provideMichal(grapesMap, z)\n if (isValidDistribution(grapesMap)) println(\"YES\")\n else println(\"NO\")\n}\n\nprivate fun getInputString() = readLine()!!\nprivate fun getInputInt() = getInputString().toInt()\n\nprivate fun provideAndrew(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted)\n}\n\nprivate fun provideDmitri(grapesMap: MutableMap, wanted: Int) {\n val purple = grapesMap[\"purple\"]!!\n if(wanted <= purple) {\n grapesMap[\"purple\"] = purple.minus(wanted)\n return\n }\n grapesMap[\"purple\"] = 0\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted - purple)\n}\n\nprivate fun provideMichal(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"black\"] = grapesMap[\"black\"]!!.minus(wanted)\n}\n\nprivate fun isValidDistribution(grapesMap: MutableMap) =\n grapesMap.filter { it.value >= 0 }.size == grapesMap.size","description":"The Duck songFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.Andrew, Dmitry and Michal are all grapes' lovers, however their preferences of grapes are different. To make all of them happy, the following should happen: Andrew, Dmitry and Michal should eat at least $$$x$$$, $$$y$$$ and $$$z$$$ grapes, respectively. Andrew has an extreme affinity for green grapes, thus he will eat green grapes and green grapes only. On the other hand, Dmitry is not a fan of black grapes\u00a0\u2014 any types of grapes except black would do for him. In other words, Dmitry can eat green and purple grapes. Michal has a common taste\u00a0\u2014 he enjoys grapes in general and will be pleased with any types of grapes, as long as the quantity is sufficient.Knowing that his friends are so fond of grapes, Aki decided to host a grape party with them. He has prepared a box with $$$a$$$ green grapes, $$$b$$$ purple grapes and $$$c$$$ black grapes.However, Aki isn't sure if the box he prepared contains enough grapes to make everyone happy. Can you please find out whether it's possible to distribute grapes so that everyone is happy or Aki has to buy some more grapes?It is not required to distribute all the grapes, so it's possible that some of them will remain unused.","input_specification":"The first line contains three integers $$$x$$$, $$$y$$$ and $$$z$$$ ($$$1 \\le x, y, z \\le 10^5$$$)\u00a0\u2014 the number of grapes Andrew, Dmitry and Michal want to eat. The second line contains three integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$1 \\le a, b, c \\le 10^5$$$)\u00a0\u2014 the number of green, purple and black grapes in the box.","output_specification":"If there is a grape distribution that allows everyone to be happy, print \"YES\", otherwise print \"NO\".","notes":"NoteIn the first example, there is only one possible distribution:Andrew should take $$$1$$$ green grape, Dmitry should take $$$3$$$ remaining green grapes and $$$3$$$ purple grapes, and Michal will take $$$2$$$ out of $$$3$$$ available black grapes.In the second test, there is no possible distribution, since Andrew is not be able to eat enough green grapes. :(","sample_inputs":["1 6 2\n4 3 3","5 1 1\n4 3 2"],"sample_outputs":["YES","NO"],"human_solution":" fun main(args:Array){\n val (a, b, c) = readLine()!!.split(' ')\n var x1:Int = a.toInt()\n var y1:Int = b.toInt()\n var z1:Int = c.toInt()\n val (a1, b1, c1) = readLine()!!.split(' ')\n var x:Int = a1.toInt()\n var y:Int = b1.toInt()\n var z:Int = c1.toInt()\n var flag = 0\n if(x1 <= x && flag == 0) {x -= x1}\n else {flag = 1}\n \n if(y1 <= (y + x) && flag == 0) \n {\n if(y1 <= y) y -= y1\n else {\n x -= (y1 - y)\n y = 0\n }\n }\n else {flag = 1}\n \n if(z1 <= (x + y + z) && flag == 0) {flag = 0}\n else { flag = 1} \n \n if(flag == 0) {println(\"YES\")}\n else {println(\"NO\")}\n}","testcases":"[{'input': '1 6 2\\r\\n4 3 3\\r\\n', 'output': ['YES']}, {'input': '5 1 1\\r\\n4 3 2\\r\\n', 'output': ['NO']}, {'input': '1 1 100000\\r\\n4 2 99995\\r\\n', 'output': ['NO']}, {'input': '1 2 3\\r\\n3 2 1\\r\\n', 'output': ['YES']}, {'input': '1 8 4\\r\\n3 1 9\\r\\n', 'output': ['NO']}, {'input': '6 1 2\\r\\n4 9 6\\r\\n', 'output': ['NO']}, {'input': '100000 100000 100000\\r\\n100000 100000 100000\\r\\n', 'output': ['YES']}, {'input': '3 2 1\\r\\n1 2 3\\r\\n', 'output': ['NO']}, {'input': '99999 99998 99997\\r\\n99997 99998 99999\\r\\n', 'output': ['NO']}, {'input': '1 7 9\\r\\n4 5 7\\r\\n', 'output': ['NO']}, {'input': '99999 100000 100000\\r\\n100000 100000 100000\\r\\n', 'output': ['YES']}, {'input': '100000 99999 100000\\r\\n100000 100000 100000\\r\\n', 'output': ['YES']}, {'input': '100000 100000 99999\\r\\n100000 100000 100000\\r\\n', 'output': ['YES']}, {'input': '100000 100000 100000\\r\\n99999 100000 100000\\r\\n', 'output': ['NO']}, {'input': '100000 100000 100000\\r\\n100000 99999 100000\\r\\n', 'output': ['NO']}, {'input': '100000 100000 100000\\r\\n100000 100000 99999\\r\\n', 'output': ['NO']}, {'input': '4 6 4\\r\\n4 5 6\\r\\n', 'output': ['NO']}, {'input': '6 1 9\\r\\n1 7 8\\r\\n', 'output': ['NO']}, {'input': '4 10 5\\r\\n4 10 5\\r\\n', 'output': ['YES']}, {'input': '10 1 7\\r\\n1 9 10\\r\\n', 'output': ['NO']}, {'input': '2 7 9\\r\\n7 2 5\\r\\n', 'output': ['NO']}, {'input': '4 4 1\\r\\n2 6 6\\r\\n', 'output': ['NO']}, {'input': '7 3 9\\r\\n7 8 4\\r\\n', 'output': ['YES']}, {'input': '2 8 5\\r\\n6 5 4\\r\\n', 'output': ['YES']}, {'input': '80000 80004 80000\\r\\n80000 80006 80009\\r\\n', 'output': ['YES']}, {'input': '80004 80010 80005\\r\\n80005 80005 80006\\r\\n', 'output': ['NO']}, {'input': '80004 80000 80005\\r\\n80008 80001 80004\\r\\n', 'output': ['YES']}, {'input': '80001 80009 80008\\r\\n80006 80006 80003\\r\\n', 'output': ['NO']}, {'input': '80010 80001 80005\\r\\n80009 80002 80005\\r\\n', 'output': ['NO']}, {'input': '80003 80009 80004\\r\\n80007 80005 80009\\r\\n', 'output': ['YES']}, {'input': '80002 80005 80007\\r\\n80008 80005 80001\\r\\n', 'output': ['YES']}, {'input': '80003 80006 80001\\r\\n80004 80001 80010\\r\\n', 'output': ['NO']}, {'input': '1 10 7\\r\\n1 6 1\\r\\n', 'output': ['NO']}, {'input': '29 42 41\\r\\n94 70 42\\r\\n', 'output': ['YES']}, {'input': '945 294 738\\r\\n724 168 735\\r\\n', 'output': ['NO']}, {'input': '4235 5782 8602\\r\\n7610 3196 4435\\r\\n', 'output': ['NO']}, {'input': '13947 31881 67834\\r\\n62470 11361 74085\\r\\n', 'output': ['YES']}, {'input': '2 2 10\\r\\n100 1 1\\r\\n', 'output': ['YES']}, {'input': '1 2 4\\r\\n1 3 3\\r\\n', 'output': ['YES']}, {'input': '2 2 6\\r\\n3 3 3\\r\\n', 'output': ['NO']}, {'input': '5 5 10\\r\\n10 1 40\\r\\n', 'output': ['YES']}, {'input': '1 2 1\\r\\n1 1 2\\r\\n', 'output': ['NO']}, {'input': '1 2 7\\r\\n2 3 4\\r\\n', 'output': ['NO']}, {'input': '5 5 4\\r\\n11 1 1\\r\\n', 'output': ['NO']}, {'input': '1 2 6\\r\\n2 3 4\\r\\n', 'output': ['YES']}, {'input': '3 3 3\\r\\n3 2 10\\r\\n', 'output': ['NO']}, {'input': '5 5 1\\r\\n5 4 6\\r\\n', 'output': ['NO']}, {'input': '10 2 10\\r\\n12 2 10\\r\\n', 'output': ['YES']}, {'input': '1 3 1\\r\\n7 1 2\\r\\n', 'output': ['YES']}, {'input': '5 4 1\\r\\n5 3 2\\r\\n', 'output': ['NO']}, {'input': '2 2 2\\r\\n2 1 3\\r\\n', 'output': ['NO']}, {'input': '1 2 1\\r\\n1 1 50\\r\\n', 'output': ['NO']}, {'input': '10 1 5\\r\\n10 1 5\\r\\n', 'output': ['YES']}, {'input': '3 5 2\\r\\n3 3 10\\r\\n', 'output': ['NO']}, {'input': '2 1 1\\r\\n10 10 10\\r\\n', 'output': ['YES']}, {'input': '1 2 3\\r\\n1 2 1\\r\\n', 'output': ['NO']}, {'input': '3 6 2\\r\\n3 7 2\\r\\n', 'output': ['YES']}, {'input': '5 4 6\\r\\n5 2 100\\r\\n', 'output': ['NO']}, {'input': '3 3 3\\r\\n3 2 4\\r\\n', 'output': ['NO']}, {'input': '1 3 2\\r\\n10 1 2\\r\\n', 'output': ['YES']}, {'input': '10 20 1\\r\\n10 19 10\\r\\n', 'output': ['NO']}, {'input': '5 7 5\\r\\n7 5 3\\r\\n', 'output': ['NO']}, {'input': '3 3 6\\r\\n3 3 10\\r\\n', 'output': ['YES']}, {'input': '2 2 2\\r\\n2 3 1\\r\\n', 'output': ['YES']}, {'input': '2 2 1\\r\\n2 1 2\\r\\n', 'output': ['NO']}, {'input': '3 7 2\\r\\n3 5 5\\r\\n', 'output': ['NO']}, {'input': '4 4 1\\r\\n5 1 9\\r\\n', 'output': ['NO']}, {'input': '1 2 3\\r\\n1 2 10\\r\\n', 'output': ['YES']}, {'input': '5 5 6\\r\\n5 7 5\\r\\n', 'output': ['YES']}, {'input': '2 2 3\\r\\n3 1 1\\r\\n', 'output': ['NO']}, {'input': '1 2 5\\r\\n1 1 65\\r\\n', 'output': ['NO']}, {'input': '4 1 2\\r\\n4 1 2\\r\\n', 'output': ['YES']}, {'input': '3 5 10\\r\\n6 5 5\\r\\n', 'output': ['NO']}, {'input': '5 5 5\\r\\n13 1 1\\r\\n', 'output': ['YES']}, {'input': '5 4 7\\r\\n6 5 8\\r\\n', 'output': ['YES']}, {'input': '3 4 3\\r\\n3 4 2\\r\\n', 'output': ['NO']}, {'input': '10000 10000 10000\\r\\n10000 10000 9999\\r\\n', 'output': ['NO']}, {'input': '2 2 3\\r\\n8 1 1\\r\\n', 'output': ['YES']}, {'input': '5 10 1\\r\\n5 5 10\\r\\n', 'output': ['NO']}, {'input': '2 4 5\\r\\n2 4 5\\r\\n', 'output': ['YES']}, {'input': '3 2 2\\r\\n3 1 10\\r\\n', 'output': ['NO']}, {'input': '5 100 200\\r\\n5 10 20\\r\\n', 'output': ['NO']}, {'input': '9 22 1\\r\\n10 20 30\\r\\n', 'output': ['NO']}, {'input': '77 31 57\\r\\n81 5 100\\r\\n', 'output': ['NO']}, {'input': '1 1 2\\r\\n1 1 2\\r\\n', 'output': ['YES']}, {'input': '38 59 70\\r\\n81 97 5\\r\\n', 'output': ['YES']}, {'input': '1 1 100\\r\\n50 50 50\\r\\n', 'output': ['YES']}, {'input': '5 100 5\\r\\n10 10 10\\r\\n', 'output': ['NO']}, {'input': '1 3 1\\r\\n1 2 2\\r\\n', 'output': ['NO']}, {'input': '1 1 9\\r\\n3 3 5\\r\\n', 'output': ['YES']}, {'input': '5 5 5\\r\\n5 5 1\\r\\n', 'output': ['NO']}, {'input': '3 2 1\\r\\n3 1 2\\r\\n', 'output': ['NO']}, {'input': '4 2 1\\r\\n4 1 2\\r\\n', 'output': ['NO']}, {'input': '3 100 1\\r\\n3 1 100\\r\\n', 'output': ['NO']}]","id":461} {"difficulty":2200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"104cf5253e027929f257364b3874c38b","execute_outcome":"RUNTIME_ERROR","source_code":"import java.lang.Long.max\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n val arr = ArrayList()\n for (i in 0..n - 1) {\n arr.add(scanner.nextInt())\n }\n\n val w = ArrayList()\n val o = ArrayList()\n val r = ArrayList()\n\n scanner.nextLine()\n val st = scanner.nextLine()\n\n for (i in 0..n - 1) {\n if (st.get(i) == 'W') {\n w.add(arr.get(i))\n }\n if (st.get(i) == 'O') {\n o.add(arr.get(i))\n }\n if (st.get(i) == 'R') {\n r.add(arr.get(i))\n }\n }\n\n Collections.sort(w, Collections.reverseOrder())\n Collections.sort(o, Collections.reverseOrder())\n Collections.sort(r, Collections.reverseOrder())\n\n var fl1 = false\n var fl2 = false\n\n var sum1: Long = 0L\n var sum2: Long = 0L\n\n var pos1 = 0\n var pos2 = 0\n\n if (o.size + w.size < k && o.size + r.size < k) {\n println(-1)\n return\n }\n\n if (o.size + w.size >= k) {\n while (pos1 + pos2 != k - 1) {\n if (pos1 == w.size || pos2 < o.size && w.get(pos1) < o.get(pos2)) {\n sum1 += o.get(pos2)\n pos2 += 1\n fl2 = true\n } else {\n sum1 += w.get(pos1)\n pos1 += 1\n fl1 = true\n }\n }\n\n if (fl1 && fl2) {\n if (pos2 == o.size || pos1 < w.size && w.get(pos1) >= o.get(pos2)) {\n sum1 += w.get(pos1)\n } else {\n sum1 += o.get(pos2)\n }\n } else if (pos2 != o.size && fl1) {\n sum1 += o.get(pos2)\n fl2 = true\n } else {\n sum1 += w.get(pos1)\n fl1 = true\n }\n }\n if (!fl1 || !fl2) {\n sum1 = -1\n }\n\n pos1 = 0\n pos2 = 0\n fl1 = false\n fl2 = false\n if (o.size + r.size >= k) {\n while (pos1 + pos2 != k - 1) {\n if (pos1 == r.size || pos2 < o.size && r.get(pos1) < o.get(pos2)) {\n sum2 += o.get(pos2)\n pos2 += 1\n fl2 = true\n } else {\n sum2 += r.get(pos1)\n pos1 += 1\n fl1 = true\n }\n }\n\n if (fl1 && fl2) {\n if (pos2 == o.size || pos1 < r.size && r.get(pos1) >= o.get(pos2)) {\n sum2 += r.get(pos1)\n } else {\n sum2 += o.get(pos2)\n }\n } else if (pos2 != o.size && fl1) {\n sum2 += o.get(pos2)\n fl2 = true\n } else {\n sum2 += r.get(pos1)\n fl1 = true\n }\n }\n if (!fl1 || !fl2) {\n sum2 = -1\n }\n\n println(max(sum1, sum2))\n}","description":"Arkady decided to buy roses for his girlfriend.A flower shop has white, orange and red roses, and the total amount of them is n. Arkady thinks that red roses are not good together with white roses, so he won't buy a bouquet containing both red and white roses. Also, Arkady won't buy a bouquet where all roses have the same color. Arkady wants to buy exactly k roses. For each rose in the shop he knows its beauty and color: the beauty of the i-th rose is bi, and its color is ci ('W' for a white rose, 'O' for an orange rose and 'R' for a red rose). Compute the maximum possible total beauty of a bouquet of k roses satisfying the constraints above or determine that it is not possible to make such a bouquet.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u2009200\u2009000) \u2014 the number of roses in the show and the number of roses Arkady wants to buy. The second line contains a sequence of integers b1,\u2009b2,\u2009...,\u2009bn (1\u2009\u2264\u2009bi\u2009\u2264\u200910\u2009000), where bi equals the beauty of the i-th rose. The third line contains a string c of length n, consisting of uppercase English letters 'W', 'O' and 'R', where ci denotes the color of the i-th rose: 'W' denotes white, 'O' \u00a0\u2014 orange, 'R' \u2014 red.","output_specification":"Print the maximum possible total beauty of a bouquet of k roses that satisfies the constraints above. If it is not possible to make a single such bouquet, print -1.","notes":"NoteIn the first example Arkady wants to buy 3 roses. He can, for example, buy both red roses (their indices are 1 and 2, and their total beauty is 7) and the only orange rose (its index is 3, its beauty is 4). This way the total beauty of the bouquet is 11. In the second example Arkady can not buy a bouquet because all roses have the same color.","sample_inputs":["5 3\n4 3 4 1 6\nRROWW","5 2\n10 20 14 20 11\nRRRRR","11 5\n5 6 3 2 3 4 7 5 4 5 6\nRWOORWORROW"],"sample_outputs":["11","-1","28"],"human_solution":"import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply done@ {\n\n val n = int\n val k = int\n\n val d = ints(n)\n val colors = str(n)\n\n val red = (0 until n).filter { colors[it] == 'R' }.map { d[it] }.toIntArray()\n val orange = (0 until n).filter { colors[it] == 'O' }.map { d[it] }.toIntArray()\n val white = (0 until n).filter { colors[it] == 'W' }.map { d[it] }.toIntArray()\n\n if (k < 2 || orange.isEmpty() || (red.isEmpty() && white.isEmpty())) {\n cout .. -1 .. nl\n return@done\n }\n\n fun compose(a: IntArray, b: IntArray): Int {\n if (a.size + b.size < k || a.isEmpty() || b.isEmpty())\n return -1\n var ia = 1\n var ib = 1\n var res = a[0] + b[0]\n repeat(k - 2) {\n if (ia == a.size)\n res += b[ib++]\n else if (ib == b.size)\n res += a[ia++]\n else {\n if (a[ia] > b[ib])\n res += a[ia++]\n else\n res += b[ib++]\n }\n }\n return res\n }\n\n red.sortDescending()\n orange.sortDescending()\n white.sortDescending()\n\n val ans = max(compose(red, orange), compose(white, orange))\n cout .. ans .. nl\n\n\n }.cout.flush()\n}\n\n\/\/ @formatter:off\nprivate val io = object {\n private val `in` = System.`in`\n private fun ll(): Long {\n var x: Int; var q = false; var n = 0L; do x = `in`.read() while (x < 33); if (x == 45) { q = true; x = `in`.read() }\n do { n = n * 10 - x + 48; x = `in`.read() } while (x > 32); return if (q) n else -n\n }\n val int get() = ll().toInt(); val long get() = ll()\n fun ints(n: Int = int): IntArray { return IntArray(n) { int } }\n fun ints1(n: Int = int): IntArray { return IntArray(n) { int - 1 } }\n val cout = PrintWriter(System.out); val nl = \"\\n\"\n private var buf = CharArray(32)\n private var bufSize = 32\n fun str(expect: Int = 32): String {\n var ix = 0\n var x: Int\n if (bufSize < expect)\n buf = CharArray(expect)\n do x = `in`.read() while (x < 33)\n do {\n if (ix == bufSize) { bufSize *= 2; buf = buf.copyOf(bufSize) }\n buf[ix++] = x.toChar()\n x = `in`.read()\n } while (x > 32)\n return java.lang.String.copyValueOf(buf, 0, ix)\n }\n operator fun PrintWriter.rangeTo(a: Int): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: Long): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: IntArray): PrintWriter { a.forEach { print(it); print(\" \") }; return this }\n operator fun PrintWriter.rangeTo(a: String): PrintWriter { write(a); return this }\n} \/\/ @formatter:on\n\n\/* ----------- *\/\n\n","testcases":"[{'input': '5 3\\r\\n4 3 4 1 6\\r\\nRROWW\\r\\n', 'output': ['11']}, {'input': '5 2\\r\\n10 20 14 20 11\\r\\nRRRRR\\r\\n', 'output': ['-1']}, {'input': '11 5\\r\\n5 6 3 2 3 4 7 5 4 5 6\\r\\nRWOORWORROW\\r\\n', 'output': ['28']}, {'input': '15 10\\r\\n8560 6244 9607 5137 7187 3217 5527 9919 282 8748 3529 6110 5767 521 3393\\r\\nOWRWOORWRORWWRO\\r\\n', 'output': ['64282']}, {'input': '10 4\\r\\n1208 5835 2637 5827 3722 6837 3499 6438 43 5333\\r\\nWRRWRWRWRW\\r\\n', 'output': ['-1']}, {'input': '13 3\\r\\n9675 8988 5499 6356 5083 6067 5580 4580 6735 3617 9536 8218 3265\\r\\nRRWRRROWRWWWW\\r\\n', 'output': ['24243']}, {'input': '13 7\\r\\n8543 3460 1282 3956 8203 762 6059 9361 4427 8868 5849 3439 8891\\r\\nWWOOOOWOWWRWO\\r\\n', 'output': ['54352']}, {'input': '30 15\\r\\n7926 577 5009 7237 4395 3239 8994 4429 8126 2925 139 320 4442 3397 1292 2800 9505 6043 5946 8058 4031 6871 4689 1977 73 440 5320 5290 4707 387\\r\\nOOWOWWORRWOWORWRRRRWORROOWWROW\\r\\n', 'output': ['91633']}, {'input': '200000 33622\\r\\n8441 109 8724 2873 2489 1789 8977 9580 3157 9961 5941 2676 8596 6759 8630 4956 3261 3436 9915 7306 8414 8955 4906 1613 4263 2751 9202 834 1373 5031 3756 2983 7310 7044 5704 9088 2864 1312 8303 3998 1308 1290 1983 5707 3972 4030 361 5302 9675 7203 8197 6738 4545 9330 9318 5896 2502 7819 3839 6252 9107 323 6772 5206 7515 6197 2623 8562 1080 1137 9113 895 9777 8379 9183 4964 5743 286 1894 3389 5740 5757 901 3744 9803 1395 7364 7857 4801 5434 852 9679 8359 7986 9419 6474 9519 9011 2247 773 3564 8...', 'output': ['307924573']}, {'input': '200000 57164\\r\\n4744 6508 9469 1056 5663 2295 1108 9399 7700 382 6910 5940 1095 7030 1162 4604 9730 3204 7377 3578 2875 6507 8536 538 4978 6397 5814 8580 8500 4446 2987 763 4913 9013 2160 8576 3187 1182 4765 4234 4176 5332 8418 3008 1679 5940 252 4903 741 4199 7972 3869 6213 7028 4952 1836 6086 8889 7401 6111 806 6671 7866 2733 9927 4093 2828 4640 828 7918 8696 449 5463 8320 4359 7081 9002 4634 2733 4525 7634 9652 1281 8934 7843 9025 7940 6885 6785 4986 3197 6519 7798 7244 7625 6859 23 1131 5825 3147 1517 57...', 'output': ['489941452']}, {'input': '200000 82290\\r\\n6157 1935 1006 9065 4464 4478 559 4869 8330 9609 8275 7622 4545 175 5272 4694 180 363 8806 1880 3225 696 6206 1382 8686 6528 1727 2053 2418 7651 7103 4414 5066 6213 6225 4290 1919 1947 379 1894 3698 6741 7495 1317 4059 3786 8225 1957 7565 6974 2731 9703 8240 7749 42 9552 5084 9196 1643 3664 1331 9046 2141 8960 6013 822 7776 8831 5956 3478 3107 1467 1252 1733 2646 8112 1959 2041 2170 9524 3518 9694 892 55 7610 5799 5149 2147 2361 5004 4411 8126 1408 8440 8770 2021 6327 5690 2212 2610 7751 1056...', 'output': ['-1']}, {'input': '200000 118994\\r\\n1344 1987 8874 5481 3723 2831 6406 7634 4841 1495 4783 9713 6884 9177 3820 1493 7800 4336 7536 7605 6636 316 9427 8510 8102 5517 6320 7337 5100 5311 9413 9232 8578 9630 7310 3114 410 6875 2375 2419 7161 5366 8453 5866 2324 9739 747 3800 5643 653 3877 7406 7629 9742 5485 2119 2789 6201 6658 9863 8433 4119 794 3564 9319 1049 3837 5710 4946 6110 4695 1374 7368 803 9966 4764 7426 261 244 8152 8062 9689 3272 1498 1709 9269 3569 5232 4608 1059 8797 1023 8567 2024 7704 4219 6511 1137 7332 9498 8776...', 'output': ['837297028']}, {'input': '200000 120641\\r\\n6946 6266 9123 828 9456 8251 6350 1621 5738 1313 3110 5376 3073 3915 1499 6033 7912 9853 5020 4151 7437 7289 3171 4556 6028 1229 8475 1982 6214 7284 3613 7094 891 2930 4569 2928 3892 3951 5704 6267 9862 4888 6727 2120 76 6228 6755 1654 3368 3882 3873 6687 8335 1150 9852 2109 8064 2816 6401 8087 3849 235 4874 3663 837 6414 8112 3082 1926 8882 696 7795 6163 3108 5113 8887 1409 5125 652 2114 9823 5148 2532 7032 4153 8453 642 6129 849 2766 6803 6358 1784 7885 4420 8350 9935 5692 7589 1743 98 850...', 'output': ['843717306']}, {'input': '200000 2\\r\\n7348 6934 6293 57 5257 5526 3588 7713 3630 1158 4102 5430 5568 6574 7008 7984 2007 4916 5086 2882 7500 3111 7467 628 1143 7287 465 7863 9891 3455 8153 1412 2088 561 3209 7973 9261 1250 181 3291 2628 6776 6731 4715 9641 8132 4311 1905 7848 8219 6776 2000 4627 356 8165 8969 6667 3812 95 7611 7409 6488 2363 6436 6638 3192 6149 9709 5346 730 2438 9956 5156 8297 1249 8879 1826 6151 9720 4099 7034 4120 3659 2732 6107 6174 6698 930 5841 7535 7421 6436 5870 8975 2735 8456 9853 6249 3061 5226 937 149 2530...', 'output': ['-1']}, {'input': '200000 2\\r\\n2845 8701 819 6641 6172 7427 2967 2817 2435 3764 8897 7991 2984 4119 3663 471 1720 1102 4693 2124 3804 4466 7129 5896 7755 4025 5051 9912 4217 3366 752 2538 3372 8440 7740 7577 5759 9315 9214 3102 5480 49 3236 9522 4467 6214 6736 5874 1609 7421 1555 5947 2512 1279 5415 2210 5043 7056 1882 5642 3284 5727 3893 8588 9605 7009 1380 1287 1885 7893 3809 1174 6733 2368 9221 8321 243 5473 5090 1430 2696 4054 7324 2399 4937 2142 8476 392 2635 5020 9061 8000 9584 1436 5359 9964 8320 2477 7719 9000 5374 378...', 'output': ['-1']}, {'input': '200000 149440\\r\\n6037 4366 7637 8259 6188 7560 8788 8773 3852 1407 5551 1008 1658 4855 398 7283 7082 3707 4421 2273 820 9531 9546 3324 8752 7517 8322 5704 3359 6934 6144 7305 3637 9446 2839 505 1120 7133 9707 6428 7255 7266 8570 5110 4465 482 6176 3728 3776 5058 6048 5928 924 1297 3814 89 8324 1517 7372 1623 9460 2620 3851 4614 1041 418 3954 9175 3699 3430 1668 9229 4531 8395 6818 3456 6950 5464 5215 7704 3277 9443 2241 3276 2172 2662 5737 539 6141 1225 5153 7559 3430 5963 453 1742 9669 2830 2393 7415 4374 2...', 'output': ['-1']}, {'input': '199999 199999\\r\\n8829 6746 4862 8745 9923 6456 8038 5407 4854 5265 9741 9628 8570 5911 9566 7301 9445 9015 7522 8123 5019 3240 1709 3885 9735 8781 7366 6370 7954 9581 5281 4114 8469 9021 9648 8614 9980 8778 7943 4047 6543 9826 9871 5537 9646 9274 4468 5305 9990 8208 4263 2113 6532 6235 8072 6099 9023 5735 7008 9771 6045 7139 9622 9233 7372 7724 4297 8427 8530 3973 7790 4337 6871 9423 8096 9507 2795 7171 7437 4615 4441 9000 7988 9098 9466 8724 7201 9716 9062 7787 9739 8340 9939 9644 7666 8508 6222 1854 4625 8...', 'output': ['-1']}, {'input': '199999 199999\\r\\n9671 7010 6679 9203 6111 7419 7368 7321 8031 8744 4356 8334 3859 3178 6911 4656 8619 9524 3069 8277 6031 9303 4844 9067 7233 7201 7155 6843 8223 4577 8037 7202 6890 7351 4226 6550 9629 7416 7394 7800 6874 7577 9177 5561 7324 7104 9402 9806 7714 9991 9330 3617 9957 5155 9936 6387 7792 9573 9153 9623 8502 5624 5660 6426 6726 9337 6950 7876 9237 8424 1681 9592 5569 7512 7561 9990 8161 4118 5150 8901 9875 7634 5437 5624 2449 7577 9114 9573 9782 8590 9443 8561 8959 9946 9353 7356 9745 7286 9016 7...', 'output': ['-1']}, {'input': '199999 199999\\r\\n2614 9157 8541 6697 7236 7876 7856 2775 6947 5714 6366 9675 5055 9592 8725 8391 8855 4930 5136 9516 5513 7375 9378 6443 6302 9968 8544 9773 6674 9032 3207 6940 3830 5741 6795 9981 4956 8854 4564 7435 8432 9813 6785 8602 6842 9522 9564 9815 6952 9272 4283 8359 4558 7330 7859 7497 8365 8015 8165 9809 8679 9895 9157 6807 7934 7162 8638 5507 9727 7704 8289 8390 6030 6102 9528 6224 9389 9865 8175 9581 7513 5044 6988 9584 3199 8598 8953 5533 7223 5416 9520 8526 6095 5551 9421 9216 9589 7802 4311 5...', 'output': ['-1']}, {'input': '200000 200000\\r\\n6010 9435 8321 5212 5175 9219 4238 8586 7824 4918 4803 6488 4792 8585 9615 9628 8655 8249 6550 1392 6278 6175 8750 9829 5454 6442 6670 6101 6078 9158 7441 9797 7235 8747 9093 9182 7810 7959 9704 7953 9352 9225 9614 7839 7207 9472 8121 9791 7580 7348 9839 5385 4454 9932 7505 5525 5236 6905 9767 8409 9993 9356 2671 5612 5091 9435 5622 9309 3584 3366 9016 9196 9225 8994 8466 9375 7707 9726 8161 9452 6676 6530 6775 8868 8551 4813 4416 7225 7733 8035 9388 8039 6876 6722 7257 7344 8870 4825 907 53...', 'output': ['1499644156']}, {'input': '200000 200000\\r\\n4500 6623 9150 3184 5331 2170 6864 8972 9521 6840 3496 7703 2937 4100 9084 6525 8685 5218 4745 7759 8964 6105 4288 9620 6778 9889 6324 8462 8353 9939 8778 4766 9962 3549 9241 4678 9143 8272 8755 9728 7450 5865 4700 8417 9144 9641 7551 5796 8362 8093 9468 9147 7763 8866 9450 6692 4465 9652 8464 5367 9487 9534 5763 6404 8599 8895 6090 9159 9240 9294 5803 2401 8674 7903 6513 8660 7603 8022 6503 2313 5922 5744 7700 4830 4412 9373 9426 7625 9805 8805 8689 6027 5642 6950 8289 5358 9830 8446 3289 8...', 'output': ['1501006141']}, {'input': '199999 116387\\r\\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1000...', 'output': ['1163870000']}, {'input': '199999 1\\r\\n9596 1475 4 8131 1661 3920 4756 7809 8332 6062 61 1795 1963 2388 5343 6316 8237 5502 3445 6888 852 8072 9353 8311 2042 7941 9596 5894 5499 8625 2488 7039 2167 7981 792 798 1481 607 7754 5710 1310 6323 8080 8222 1100 6181 7485 4105 3668 8212 3044 1708 9096 6595 7229 7677 4882 3668 2119 75 2475 7270 1707 2214 8486 2671 3569 2085 4957 7519 1795 3515 5595 6234 2951 3627 2608 1372 10 1892 369 1935 8252 1044 7583 4419 5220 3315 9402 8300 9537 2892 4613 2068 7521 7541 5536 4755 8789 5033 7613 9214 4962 ...', 'output': ['-1']}, {'input': '199999 1\\r\\n7694 9450 9402 1211 3152 7507 2155 3857 3454 6713 70 5817 9511 7067 8741 1431 5660 3033 7414 1291 2414 9426 6186 8839 5709 6849 4903 6873 7696 4364 7170 3285 4249 6078 8834 9246 6820 8512 8459 3273 6238 2973 6627 4074 3794 2505 8841 5937 2810 7401 7811 7510 1614 1980 4933 4157 9421 1067 9329 5349 2778 6760 7005 3448 2255 5927 2190 2272 7046 2224 9006 2925 9742 4266 1391 5309 3988 1203 532 2731 4106 6718 4392 4190 3266 7175 9150 3171 2865 4938 8819 5878 2779 4341 7299 6196 2669 8729 7240 7235 962 ...', 'output': ['-1']}, {'input': '199999 1\\r\\n1271 2401 1168 4465 5575 9539 5053 1267 1349 1060 3791 1668 9493 2046 6770 4209 9855 827 5787 458 1068 8940 4094 370 1001 4638 6930 9962 4812 8337 1792 9671 2355 982 8203 250 4284 2185 7075 4927 3804 7001 8893 2236 9739 6894 4326 2359 5155 8866 2263 6712 8706 7974 1255 584 4101 6538 6532 8343 915 8545 7385 739 8071 4908 9111 8493 3898 5785 5600 4515 7630 6896 8117 3839 18 7626 1600 1302 5203 1074 3030 2877 5570 9718 5109 6987 8933 335 7160 1420 9988 2602 4943 2811 9221 1027 9506 1512 5585 3397 37...', 'output': ['-1']}, {'input': '200000 14562\\r\\n1074 3692 3923 8705 9027 2559 8311 9245 2273 7095 3139 6108 4367 889 8815 9177 1895 7899 6851 185 1048 4130 1968 4429 1834 3625 1024 1445 9673 2824 8369 3274 6105 3465 2654 7586 323 7906 8830 1570 1791 4299 4373 6271 65 7507 4131 7837 7048 7743 5013 4204 4401 6572 2599 9121 7529 522 9399 1618 4125 4194 2394 4123 6580 8448 4762 3541 4384 1815 1241 9650 6294 8375 4828 9921 4637 5001 4250 2960 6664 3223 3398 5288 2755 6729 5871 8574 704 105 6048 3372 9836 7367 6626 2098 5930 741 2066 8638 140 98...', 'output': ['139678207']}, {'input': '200000 40699\\r\\n9394 3552 291 1910 1874 4510 41 3804 3351 2739 7912 258 3681 7240 6121 4300 5771 9317 9966 7976 9941 6800 1115 3809 1918 561 8204 1016 1918 1985 6462 1647 1599 5718 5978 3049 1326 6066 3504 7398 5204 8847 2795 6184 4371 7460 9412 1549 5257 2635 4715 739 5486 8156 9896 4625 2321 2217 7823 884 1169 6466 1348 2382 905 39 331 3181 6164 5199 1718 5395 1855 5536 7742 4312 4044 9010 1987 2681 7127 4653 9786 7747 4003 4289 8870 1799 8346 2777 5634 3061 5477 6812 3199 2923 6441 3700 7238 6832 8339 873...', 'output': ['344700860']}, {'input': '1 1\\r\\n100\\r\\nO\\r\\n', 'output': ['-1']}, {'input': '200000 200000\\r\\n1 1 1 1 1 1 1 1487 2572 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3618 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4434 1 1 1 4400 1 1 1 1 1 1 1 1 508 1 9472 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 641 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2173 1 4437 1 1 1 1 1 1 1 1 1 9541 1 1 1 3177 1 1 1 1 5168 1 1 1 1 1 1 1 1 270 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5151 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8465 1 1 1 1 1 1 1 1 1 1 1 1...', 'output': ['50195000']}, {'input': '1 1\\r\\n1059\\r\\nO\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n9907 4483\\r\\nOO\\r\\n', 'output': ['-1']}, {'input': '1 1\\r\\n6750\\r\\nW\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n144 174\\r\\nOW\\r\\n', 'output': ['318']}, {'input': '3 2\\r\\n776 4797 9449\\r\\nOWO\\r\\n', 'output': ['14246']}, {'input': '2 2\\r\\n3486 8968\\r\\nWW\\r\\n', 'output': ['-1']}, {'input': '3 2\\r\\n2330 2140 3440\\r\\nWOW\\r\\n', 'output': ['5580']}, {'input': '4 2\\r\\n1175 8186 4321 1810\\r\\nWWOO\\r\\n', 'output': ['12507']}, {'input': '1 1\\r\\n6479\\r\\nR\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n8512 9903\\r\\nOR\\r\\n', 'output': ['18415']}, {'input': '3 2\\r\\n7035 5046 7357\\r\\nOOR\\r\\n', 'output': ['14392']}, {'input': '2 2\\r\\n6442 4558\\r\\nWR\\r\\n', 'output': ['-1']}, {'input': '3 2\\r\\n9700 698 2122\\r\\nOWR\\r\\n', 'output': ['11822']}, {'input': '4 3\\r\\n254 4510 2194 9543\\r\\nWOOR\\r\\n', 'output': ['16247']}, {'input': '3 2\\r\\n517 6744 2364\\r\\nRWW\\r\\n', 'output': ['-1']}, {'input': '4 2\\r\\n2884 2918 8629 9905\\r\\nRWOW\\r\\n', 'output': ['18534']}, {'input': '5 2\\r\\n7882 871 789 4432 7664\\r\\nOWORW\\r\\n', 'output': ['15546']}, {'input': '2 2\\r\\n2926 8428\\r\\nRR\\r\\n', 'output': ['-1']}, {'input': '3 2\\r\\n7926 1770 3255\\r\\nORR\\r\\n', 'output': ['11181']}, {'input': '4 2\\r\\n2578 7910 108 3809\\r\\nOROR\\r\\n', 'output': ['10488']}, {'input': '3 2\\r\\n5920 9303 7542\\r\\nWRR\\r\\n', 'output': ['-1']}, {'input': '4 2\\r\\n5909 4286 5444 6473\\r\\nOWRR\\r\\n', 'output': ['12382']}, {'input': '5 2\\r\\n96 6627 8780 3764 970\\r\\nRROWO\\r\\n', 'output': ['15407']}, {'input': '4 2\\r\\n6657 1489 9138 4273\\r\\nRRWW\\r\\n', 'output': ['-1']}, {'input': '5 2\\r\\n1598 6700 334 6455 9292\\r\\nWORWR\\r\\n', 'output': ['15992']}, {'input': '6 2\\r\\n6231 9178 9845 5932 5477 6659\\r\\nORRWOW\\r\\n', 'output': ['16076']}, {'input': '1 1\\r\\n780\\r\\nO\\r\\n', 'output': ['-1']}, {'input': '1 1\\r\\n3214\\r\\nW\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n8455 5432\\r\\nOW\\r\\n', 'output': ['13887']}, {'input': '1 1\\r\\n6555\\r\\nR\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n1120 5670\\r\\nOR\\r\\n', 'output': ['6790']}, {'input': '3 2\\r\\n8884 4514 1673\\r\\nORW\\r\\n', 'output': ['13398']}, {'input': '1 1\\r\\n6908\\r\\nO\\r\\n', 'output': ['-1']}, {'input': '1 1\\r\\n3934\\r\\nW\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n8856 7299\\r\\nWO\\r\\n', 'output': ['16155']}, {'input': '1 1\\r\\n2683\\r\\nR\\r\\n', 'output': ['-1']}, {'input': '2 2\\r\\n9094 5772\\r\\nRO\\r\\n', 'output': ['14866']}, {'input': '3 2\\r\\n518 9438 7938\\r\\nWOR\\r\\n', 'output': ['17376']}, {'input': '200000 29745\\r\\n7073 6112 6944 5512 40 8173 8992 9790 8918 9838 8802 7408 5140 3227 9374 4678 7992 8837 9048 8008 2380 7150 5843 3084 79 2102 3141 401 6265 171 7888 8959 8084 8760 3150 4024 4616 13 6054 3792 322 3197 6847 8534 79 2666 4858 1510 9148 5398 63 5336 5722 2157 5685 6669 2688 2465 4381 2714 6785 1913 8459 8430 8989 1866 7936 4675 3502 8095 9700 2184 8433 6181 843 9743 5275 1803 3290 5858 1720 9994 9094 8347 8921 6234 7288 292 3565 1324 4268 979 3233 7456 7909 9964 7503 732 4756 1701 5153 2329 3523...', 'output': ['264679927']}, {'input': '200000 37150\\r\\n6558 9566 8707 6647 8725 2011 9258 7148 3258 823 6232 4296 1961 7316 7854 9342 1086 1217 68 4268 9713 1820 2696 1700 4964 1471 8846 6622 2864 6676 6522 5213 7732 6173 5493 1178 2354 8041 266 6918 3061 57 2834 9620 3643 8975 373 4545 7787 5965 6779 1446 7063 6192 9912 1853 2252 6003 3721 7157 9612 4114 2131 4558 6716 9072 4385 2595 5888 8540 2616 4023 4990 6415 7678 3721 1822 3611 7001 3698 6738 966 1139 3768 1173 7333 9338 1633 8969 4754 7009 5048 9264 8643 4443 4446 3741 6275 2758 3377 1799 ...', 'output': ['325193194']}, {'input': '200000 6632\\r\\n6402 3082 5992 9803 9151 8792 5401 7813 3843 259 1665 1854 534 1596 6207 2287 7826 4579 5148 5372 533 6502 4511 2162 2112 5248 6463 8881 4980 6262 5400 8580 3047 7638 5442 3497 2839 4027 7145 8017 3764 3564 6146 6722 3847 8251 7372 3163 3085 3981 363 6632 6703 1229 7922 4951 230 6890 9012 9834 330 5913 9039 4187 1220 2807 3545 8970 523 6821 149 5156 8597 1564 8051 4439 1739 8 7744 6489 1174 3249 6141 1367 346 4308 9501 6314 3166 9215 5595 4699 4967 3360 6455 2837 2583 1721 7350 2448 4614 2130 ...', 'output': ['65176032']}, {'input': '200000 14000\\r\\n7534 4420 5739 3389 8937 1180 7479 4332 9475 1692 7933 6167 5435 7889 1376 2684 6098 1219 6839 9605 2039 8628 3185 7825 8375 7305 8174 9057 3938 1120 9463 1609 5800 3606 9689 6487 13 2705 7169 1638 5647 6712 8837 8489 9589 9085 723 547 3050 3232 1454 6926 1468 82 6410 6436 9636 4745 2236 3415 1097 707 5153 9058 6551 2575 3072 272 4124 9848 2362 6142 5241 791 3734 947 1517 5633 811 173 5293 1143 4299 1765 5630 2240 8190 6190 7957 9088 7574 8259 4834 8254 2877 1627 8436 6819 9105 1896 1358 771 ...', 'output': ['132718301']}, {'input': '200000 61224\\r\\n2934 3647 7145 3178 8914 7623 3322 9083 4417 2525 1627 7897 2445 7326 9961 9929 8959 9263 9801 3340 8460 3182 3522 2446 3695 5262 8880 4315 4393 1639 7239 1775 4987 720 7753 6591 5806 5084 7860 3053 267 4382 1607 791 1305 4745 2471 8283 4139 4085 4898 2128 2805 5643 1647 1954 7592 3782 9104 2523 4681 9676 8076 3630 5825 9929 64 9210 5137 1592 4715 1086 1512 2098 6459 3474 8783 5948 3189 240 2816 3950 6988 8084 9591 1494 7112 8235 1443 9650 8213 9670 6856 6813 7474 5418 4037 6044 5168 1321 493...', 'output': ['471694518']}, {'input': '200000 86844\\r\\n9237 5053 8660 7094 6289 3828 8094 2366 8944 7054 9275 3087 2414 3600 5521 6232 8797 7683 9655 2813 1152 4299 449 5697 8411 1501 9244 5249 4398 7823 3230 9448 144 9622 5807 2807 2283 1252 6658 8156 8079 4944 515 5647 3218 7670 203 5691 979 6820 1522 4569 8556 1447 5488 8658 4359 8367 542 6720 329 2753 9625 6095 5754 3031 8234 5377 4642 451 4122 1718 8996 4077 256 4657 229 8917 7079 460 6950 7345 9163 9310 9477 1321 7694 454 7317 6379 7221 8431 4482 6800 8459 4365 3844 3219 2878 6152 9436 5566...', 'output': ['655268901']}, {'input': '200000 10266\\r\\n737 1494 6074 4171 2040 5088 2742 3766 7328 1818 5241 6711 8540 2287 3736 7892 5229 7121 3783 1973 8903 7035 8155 3868 7803 352 3298 1999 3896 4950 2335 1875 8184 9798 8034 9945 8965 877 7273 5182 7213 9413 151 3566 5519 5232 5442 9444 9000 4634 8139 1021 904 8178 4781 2117 5529 3582 1755 6079 3357 5262 3579 7066 6107 3547 9991 8874 8202 3144 6889 593 7226 7180 2208 1257 5296 2887 4425 3784 5939 7876 9168 1895 138 5251 9165 1416 2091 9756 947 8190 2422 1606 4775 2211 2947 1456 8665 3304 2180 ...', 'output': ['99905267']}, {'input': '200000 14605\\r\\n8330 2272 6461 9158 5649 4159 1738 3697 3394 3928 25 9381 1719 9990 8885 6566 7885 5642 1897 3666 1179 2285 8749 708 4875 8943 8193 5547 1766 1661 9396 1177 2265 7358 5227 6837 1881 1078 2385 7994 9709 2262 7418 7767 9337 7593 1837 4511 5992 9741 3268 7071 2559 7228 4124 2172 8829 8314 2319 8508 4676 2502 2819 8927 2553 3557 314 8145 918 6664 1087 8381 4532 9413 2732 4770 792 4311 8179 9463 7255 8467 5000 396 8158 9576 9565 3814 95 3945 5604 1951 9340 4812 7832 2108 9289 460 6185 5879 3100 57...', 'output': ['140404899']}, {'input': '10 4\\r\\n9513 754 5917 1337 2337 1387 3499 9873 9138 7647\\r\\nWROWWOWWRO\\r\\n', 'output': ['32950']}, {'input': '20 5\\r\\n3747 219 7826 7713 6886 466 1136 7069 1234 7556 3657 6017 9965 2847 6880 362 3179 4676 5934 4913\\r\\nWWWOWOWOWOROWOWWWOWW\\r\\n', 'output': ['40129']}, {'input': '100 50\\r\\n7428 3937 2090 6557 9269 9147 3239 8669 8086 1286 6118 2002 3082 2982 7965 4335 5674 381 4321 3602 3930 7596 1770 4105 4340 7304 7897 8526 127 4413 2663 8705 4348 3008 4909 3672 9411 8282 3474 6743 9298 9136 6256 3703 4464 9306 7139 3545 9800 7047 7265 9561 3217 6896 5662 4917 9821 4213 2901 7169 2630 5643 9392 8393 6298 8930 8183 3191 1497 9071 1357 2462 6026 4828 5500 805 4804 6016 5071 9459 755 5162 9013 5469 6078 1324 5137 5539 9557 1548 3960 5028 2020 3197 7146 1182 2621 8388 652 6333\\r\\nOOWOOOO...', 'output': ['363882']}, {'input': '10000 5750\\r\\n5375 6223 2668 1422 888 7551 2795 8037 2830 6702 9481 2126 6473 1557 9985 187 456 8633 2367 9179 9217 7259 3210 5561 1176 8088 6636 1816 5319 8226 3280 5149 5371 3623 3608 3501 2530 2166 3439 2174 825 1285 9004 546 296 4390 3633 7605 4619 8150 3891 2113 2273 7781 2991 3068 3434 385 3671 3212 8210 4731 6550 6773 7409 5983 3525 8590 6316 7764 3490 4121 59 3180 5278 5332 5002 2175 8646 791 9949 9293 6071 4176 1311 1166 3099 6030 7233 7631 8626 5815 6979 1408 598 2016 463 5462 1644 9720 9432 2519 4...', 'output': ['32756429']}, {'input': '50001 13458\\r\\n2699 4855 4846 4925 4942 7797 5027 5069 6473 9965 275 3604 8607 9949 4455 5614 1298 4734 8653 9025 129 3968 8695 6890 9768 9906 9939 4527 7087 7266 246 4948 9931 6666 3332 5304 6087 9083 4561 9194 133 6257 9464 6842 2814 5609 3662 2925 6764 5788 2849 1927 4976 8478 1041 3614 6957 2250 4961 6500 8396 7786 4359 3576 2274 8332 5248 156 1899 4892 1126 7744 1129 4282 2897 3938 5953 3708 8240 8260 4103 1415 8796 4779 3136 6171 355 3602 9605 2616 1365 8999 1489 769 7364 711 8960 525 6362 8639 6468 39...', 'output': ['107359241']}, {'input': '100001 26065\\r\\n8537 6978 8240 3862 9482 5609 9378 7035 9514 7721 9173 8733 4238 2265 8718 6535 308 805 9074 5523 1967 5156 2482 9428 8831 2350 9400 6684 2934 7206 665 1118 5526 1530 5939 8592 9442 4560 3298 1181 9707 9925 742 8809 7164 6051 6539 9933 8374 3 2520 5500 9157 1645 7238 9588 6248 8454 5066 992 2966 9531 1524 3097 7549 5242 8732 8412 3006 9105 5506 9080 3892 7790 2583 2529 8676 1835 5101 7081 3007 113 6372 6575 1051 7134 945 3751 4939 1569 2 1511 4945 5904 3 6172 1220 3488 7190 4323 5363 1882 290...', 'output': ['210010477']}, {'input': '150000 21832\\r\\n5345 734 5647 5623 5371 3613 9834 5612 1897 5234 7408 1513 5818 6636 6811 133 3792 4695 4506 4937 1657 2182 3310 8232 8877 7520 5034 6334 274 636 5661 6896 3841 9346 3728 3386 8567 9853 3723 9889 4351 3832 1331 7500 6924 125 9272 5092 3939 1783 9097 5392 4131 2966 2705 6949 1474 3642 7179 8073 3004 333 684 4177 4410 2670 9917 755 9330 9317 7442 1704 8691 3810 194 2519 3170 9755 7497 7239 9125 1173 5483 4478 5682 7505 1826 1412 3709 3728 3030 6254 9248 8583 4529 3842 3716 6191 2252 5093 7452 6...', 'output': ['200404723']}, {'input': '190000 31590\\r\\n5084 5695 8718 8736 3153 3728 4940 5125 6992 2691 2911 4835 1596 4211 8827 4758 3476 6847 4180 3435 4808 8139 2680 3026 9225 540 8327 8549 1617 7808 9795 2008 2371 2219 8362 8481 5981 1460 9869 2077 327 6585 6256 7994 5916 5540 7433 2096 3074 481 6141 8859 7990 7216 3183 5602 8149 7994 1774 6849 6608 1017 3760 8024 6708 7068 4763 8886 9312 7747 2017 5311 3801 7723 4323 6978 2625 9026 9976 1534 6349 6482 4649 3681 8409 1992 38 3374 1761 8782 9456 8414 8102 2569 3595 8790 3352 4411 4985 7587 84...', 'output': ['286420202']}, {'input': '199999 49817\\r\\n8652 516 2921 9326 8742 3275 7762 2151 9607 7451 3644 9541 7397 6973 552 603 5718 9385 3833 3172 7465 3814 5927 5894 1084 8833 8166 2462 7688 4231 2136 5197 5926 739 9122 527 4804 8406 1693 1384 6929 4026 1492 996 4266 5844 6852 1399 7336 9073 3780 8477 5598 8510 9869 232 5165 5333 6719 8385 3387 6845 8489 428 358 6830 6071 2218 9250 3474 6810 9212 710 6057 3663 7817 9745 7263 3355 7459 1988 4127 2620 3976 502 1434 1790 5806 8430 9214 3325 9421 4364 5868 7730 7831 3527 881 5669 1254 3318 1445...', 'output': ['405807281']}, {'input': '199999 193089\\r\\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1000...', 'output': ['-1']}, {'input': '199999 172031\\r\\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1000...', 'output': ['-1']}, {'input': '200000 155472\\r\\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1000...', 'output': ['1554720000']}, {'input': '200000 83515\\r\\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000...', 'output': ['835150000']}, {'input': '199999 76539\\r\\n1685 4709 2899 3651 6031 4444 8909 5247 3437 2828 2102 1738 6363 3186 1690 6445 9624 9951 4799 5292 7691 3591 9169 789 4213 6174 7775 232 5733 5356 2557 1515 851 2156 3726 5438 1938 9039 6934 9246 4071 7867 4487 2787 9221 7229 8868 4530 2886 5901 7072 4139 6138 3013 5422 6502 7544 6513 8064 8495 8093 7920 3959 4496 4798 4356 6292 7224 1532 5613 6570 3032 3502 4072 865 6883 6956 9053 4418 1480 3575 531 493 3940 5149 8707 8313 191 2782 3388 714 8497 217 517 6553 1728 2932 688 9408 7993 7480 768...', 'output': ['546581033']}, {'input': '199999 124399\\r\\n6013 6545 543 2596 3680 2173 160 2056 6225 6498 7456 6280 2431 3181 4493 9011 7245 9130 4954 8868 3851 2190 5973 87 4467 4209 4952 4518 6487 6540 7508 277 4323 1968 2643 3848 4442 5550 1262 466 1751 7104 2669 6462 5417 2845 9801 7327 7529 6432 2098 8254 4909 439 717 6817 6667 9683 6146 9690 8686 4663 7874 7546 5739 6006 7993 2483 2437 8362 4321 591 7964 328 3634 5869 2064 9347 2775 4079 2644 4343 9334 3955 9462 5607 4174 5885 7873 7566 2879 3009 9165 208 8344 8692 8878 4843 9436 9754 1377 66...', 'output': ['663343239']}, {'input': '199999 1215\\r\\n6474 953 1859 1319 4113 8106 3941 9418 5693 5272 3133 938 7496 5539 1876 3486 2561 225 1268 7435 548 4698 906 9859 8080 6045 3707 1558 9063 7868 2006 2954 6020 304 8667 3354 9840 8097 377 3659 4921 1290 9920 74 5286 7424 1135 9555 8639 9082 9734 7987 4913 9601 3698 9877 735 325 9296 5674 6509 619 7747 8473 7295 5299 6178 6293 277 9460 3139 9715 9398 5126 2049 9301 6782 3224 1525 6598 1543 5981 1067 5053 7351 4398 1720 8428 845 726 6526 9639 9275 7923 4334 3502 7077 1727 8038 6449 6209 8875 914...', 'output': ['12094874']}, {'input': '200000 34710\\r\\n5498 122 6021 8811 8502 138 5813 6741 1797 6774 1349 5129 1910 3649 3552 1682 8152 5445 2727 2814 168 555 5173 5673 7637 6587 9427 2733 2247 6435 1510 8890 6012 4945 6185 9882 2170 4788 3860 6451 4099 3088 6575 5305 1715 9637 1874 4461 233 4769 7205 8848 5248 8733 3634 8924 5789 7362 3442 401 979 4002 4260 652 1419 603 7751 9244 1010 1822 9403 8202 3680 7163 4621 1501 8398 5967 22 706 2717 7598 2469 8288 7031 7075 9532 8926 4346 8852 8678 8717 7597 8876 8327 9484 3447 7229 1877 9417 7389 4506...', 'output': ['286957347']}, {'input': '200000 15100\\r\\n4331 9569 3851 3578 1112 4750 3279 6879 2437 8700 9693 745 5171 1086 4289 3973 4999 5619 339 4098 6955 860 6699 9595 6686 7057 5154 2623 5063 9861 4360 836 8278 1523 5899 3055 7483 2670 5976 9134 25 536 2365 863 2327 3903 7474 6828 9003 4085 4540 542 9276 4359 120 7387 1041 6582 7904 1414 6269 6495 4095 281 5609 7624 2423 8401 8993 9623 7973 1076 1426 5124 6498 3175 9482 9828 1021 1930 1743 9392 7133 8349 4248 1241 6627 7703 6850 8710 993 1867 8041 1976 8927 8429 7778 7144 1335 6869 5944 1967...', 'output': ['139604237']}, {'input': '199999 64123\\r\\n5288 9718 4702 3746 7818 4019 4372 3068 4288 9820 2209 7771 9211 1295 108 2614 6297 1770 7404 3721 2992 7753 2505 9285 1617 2556 9125 9639 6815 1919 9126 7517 8746 4680 3624 8851 729 5565 9866 7327 2608 2220 1735 3351 2415 4732 8401 5302 1818 6264 2551 650 454 8989 8530 1947 4465 2719 2846 3842 6770 6337 3037 7396 7876 4821 4588 747 3889 662 9854 7435 7436 4178 1255 9016 5208 5671 4420 5874 7386 2579 6669 9694 8983 7370 3923 5897 700 5187 5755 7255 4037 6019 2243 9484 1636 6443 908 5515 2065 ...', 'output': ['486565908']}, {'input': '199999 7357\\r\\n489 4945 7274 4815 9926 8740 954 5925 2655 5662 171 4252 9977 6898 4012 6249 5546 217 5333 7974 3210 7309 6561 1001 3190 8996 4494 490 4409 9182 9009 544 5862 3544 590 9912 5874 1543 3888 1373 2582 1815 4191 1979 3567 1270 8240 267 6604 2210 9031 9054 9031 6297 1804 9392 272 2892 2890 9199 8576 2838 7488 6978 7759 7842 7976 6090 736 8047 3296 3765 9902 8798 8833 8924 3035 1577 3874 3285 7664 2860 6881 6899 7325 5638 1476 858 7009 5275 5924 6939 588 3570 8482 2945 7236 94 6877 8006 2444 8661 10...', 'output': ['71585959']}, {'input': '199999 17504\\r\\n618 3495 2158 1363 8552 974 1846 3874 4386 8250 8951 5146 5521 1554 3817 9901 3973 9656 1871 1222 5133 1816 397 4152 7116 9336 835 1151 4558 5190 9544 1678 8810 8555 4526 4823 7932 7951 1728 7494 3570 6621 5768 6572 1609 2787 3509 8757 652 1559 506 2732 4892 5084 5052 6088 7174 4070 8191 2647 9657 8450 7337 622 6292 3525 5898 8377 943 5529 8725 3490 1638 9226 8267 7971 5420 7158 7341 2310 7137 8358 5787 663 5726 8387 9877 1528 6418 3456 2459 4656 3651 9165 8557 480 6318 4167 9551 1896 766 540...', 'output': ['163490284']}, {'input': '200000 32540\\r\\n9908 6209 8600 2823 6745 6815 7518 1507 3741 802 4455 7799 5586 4142 4832 2287 8525 6066 9815 4851 3158 985 1264 579 88 8265 715 8954 9562 8264 3919 2101 2177 1693 760 4440 3506 6631 6779 238 2664 2827 9995 5090 980 5112 9247 6465 970 3213 294 8077 477 972 7035 3652 9739 6053 5996 2899 9811 4420 9716 8569 8092 5037 6358 8480 5316 3812 2502 5848 7055 7394 4019 7508 9559 8480 6519 3708 6105 1810 9256 3 1210 3289 4628 980 6237 9109 5180 3761 8785 8646 962 2026 5289 8443 756 1970 9636 2010 5031 5...', 'output': ['272216516']}, {'input': '200000 12930\\r\\n2811 6208 4309 6825 7442 9510 6841 8787 1981 7557 431 679 3656 3169 8569 7168 7485 664 7283 148 3925 8666 8395 8054 9863 2768 6647 1469 9661 8912 5595 8021 9947 502 8295 7101 800 2206 6814 1986 2532 7720 3151 7680 1064 3131 5530 5684 8569 9771 6600 5049 5192 728 5264 191 7365 8028 351 4726 8059 2764 8215 9520 4061 1733 4911 5544 8200 1680 8631 7042 4299 4993 8720 4329 7742 7366 6458 8592 2953 7176 9535 5790 8309 7982 7491 7427 2145 5385 1411 3047 4157 2963 379 5977 602 5214 3626 6387 381 3452...', 'output': ['120897492']}]","id":462} {"difficulty":1800,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"1b17a7b3b41077843ee1d6e0607720d6","execute_outcome":"COMPILATION_ERROR","source_code":"\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n val length = if (string[0] == '-') string.length - 1 else string.length\n val count1 = withNOnes(string, count, length)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int, length: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n\/\/ n < length -> oneBasedArithmetic(string, count)\n n > length -> Int.MAX_VALUE\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> {\n val rem = (num % nOnes).toString()\n val quotient = num \/ nOnes\n if (quotient == 0L && rem.length == n+1){\n withNOnes((num + nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient.unaryMinus()).toInt())\n }\n else -> {\n val rem = (num % nOnes).toString()\n val quotient = num \/ nOnes\n if (quotient == 0L && rem.length == n){\n withNOnes((num - nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient).toInt())\n }\n }\n}\n\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num < 0L -> withNOnes((num + nOnes).toString(), count + n + 1, n)\n else -> withNOnes((nOnes - num).toString(), count + n + 1, n)\n }\n}","description":"Prof. Vasechkin wants to represent positive integer n as a sum of addends, where each addends is an integer number containing only 1s. For example, he can represent 121 as 121=111+11+\u20131. Help him to find the least number of digits 1 in such sum.","input_specification":"The first line of the input contains integer n (1\u2009\u2264\u2009n\u2009<\u20091015).","output_specification":"Print expected minimal number of digits 1.","notes":null,"sample_inputs":["121"],"sample_outputs":["6"],"human_solution":"import kotlin.math.*\n \nfun readLn() = readLine()!! \/\/ string line\nfun readInt() = readLn().toInt() \/\/ single int\nfun readStrings() = readLn().split(\" \") \/\/ list of strings\nfun readInts() = readStrings().map { it.toInt() } \/\/ list of ints\nfun readLongs() = readStrings().map { it.toLong() } \/\/ list of ints\nfun readLong() = readLn().toLong() \/\/ list of strings\n \nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n \/ 10\n }\n return ret\n}\n \nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n \n \nfun main() {\n val n =readLong()\n val res = getCount(n, getLength(n) + 1 )\n \/\/ println(res)\n println(get1Count(res))\n}\n \nfun get1Count(lst:List):Int\n{\n var ret = 0\n for(i in 0 until lst.size)\n { \n val item = lst[i]\n ret+=(i+1)*item.absoluteValue\n }\n return ret\n}\n \nfun getCount(_n:Long, _l:Int):MutableList\n{ \n if (_n ==0L && _l ==0)\n return mutableListOf()\n \n var n =if (_n> 0) _n else -_n\n \n val l = _l\n \n if (l == 1)\n { \n return mutableListOf(n.toInt()) \n }\n \n \n val l1 = get1(l)\n \n val bDigit = (n \/ l1).toInt() \n val tDigit = bDigit + 1\n \n val solb = getCount(n - l1 * bDigit, l - 1)\n val vb = get1Count(solb) + bDigit * l\n \n val solt = getCount(l1 * tDigit - n, l - 1) \n for (i in 0 until solt.size) {\n solt[i] = -solt[i]\n }\n val vt = get1Count(solt) + tDigit * l\n\n if (vb < vt)\n {\n solb.add(0)\n solb[l-1] = bDigit\n return solb\n }\n else\n {\n solt.add(0)\n solt[l-1] = tDigit\n return solt \n }\n\n \n}\n","testcases":"[{'input': '121\\r\\n', 'output': ['6']}, {'input': '10\\r\\n', 'output': ['3']}, {'input': '72\\r\\n', 'output': ['15']}, {'input': '1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n', 'output': ['2']}, {'input': '3\\r\\n', 'output': ['3']}, {'input': '4\\r\\n', 'output': ['4']}, {'input': '5\\r\\n', 'output': ['5']}, {'input': '6\\r\\n', 'output': ['6']}, {'input': '7\\r\\n', 'output': ['6']}, {'input': '11\\r\\n', 'output': ['2']}, {'input': '12\\r\\n', 'output': ['3']}, {'input': '2038946593\\r\\n', 'output': ['145']}, {'input': '81924761239462\\r\\n', 'output': ['321']}, {'input': '973546235465729\\r\\n', 'output': ['263']}, {'input': '999999999999999\\r\\n', 'output': ['32']}, {'input': '21\\r\\n', 'output': ['5']}, {'input': '79\\r\\n', 'output': ['10']}, {'input': '33\\r\\n', 'output': ['6']}, {'input': '185\\r\\n', 'output': ['16']}, {'input': '513\\r\\n', 'output': ['25']}, {'input': '634\\r\\n', 'output': ['22']}, {'input': '5300\\r\\n', 'output': ['32']}, {'input': '3724\\r\\n', 'output': ['34']}, {'input': '2148\\r\\n', 'output': ['21']}, {'input': '82415\\r\\n', 'output': ['53']}, {'input': '35839\\r\\n', 'output': ['45']}, {'input': '79263\\r\\n', 'output': ['45']}, {'input': '274634\\r\\n', 'output': ['62']}, {'input': '690762\\r\\n', 'output': ['65']}, {'input': '374186\\r\\n', 'output': ['65']}, {'input': '2673749\\r\\n', 'output': ['81']}, {'input': '5789877\\r\\n', 'output': ['61']}, {'input': '1873301\\r\\n', 'output': ['59']}, {'input': '30272863\\r\\n', 'output': ['118']}, {'input': '33388991\\r\\n', 'output': ['57']}, {'input': '11472415\\r\\n', 'output': ['72']}, {'input': '345871978\\r\\n', 'output': ['95']}, {'input': '528988106\\r\\n', 'output': ['118']}, {'input': '302038826\\r\\n', 'output': ['128']}, {'input': '1460626450\\r\\n', 'output': ['152']}, {'input': '3933677170\\r\\n', 'output': ['159']}, {'input': '6816793298\\r\\n', 'output': ['153']}, {'input': '75551192860\\r\\n', 'output': ['151']}, {'input': '28729276284\\r\\n', 'output': ['212']}, {'input': '67612392412\\r\\n', 'output': ['178']}, {'input': '532346791975\\r\\n', 'output': ['158']}, {'input': '575524875399\\r\\n', 'output': ['189']}, {'input': '614407991527\\r\\n', 'output': ['236']}, {'input': '2835997166898\\r\\n', 'output': ['275']}, {'input': '1079175250322\\r\\n', 'output': ['188']}, {'input': '8322353333746\\r\\n', 'output': ['169']}, {'input': '26602792766013\\r\\n', 'output': ['288']}, {'input': '42845970849437\\r\\n', 'output': ['325']}, {'input': '59089148932861\\r\\n', 'output': ['265']}, {'input': '842369588365127\\r\\n', 'output': ['330']}, {'input': '768617061415848\\r\\n', 'output': ['390']}, {'input': '694855944531976\\r\\n', 'output': ['348']}, {'input': '898453513288965\\r\\n', 'output': ['248']}, {'input': '98596326741327\\r\\n', 'output': ['260']}, {'input': '59191919191919\\r\\n', 'output': ['342']}]","id":463} {"difficulty":2100,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"3979abbe7bad0f3b5cab15c1cba19f6b","execute_outcome":"RUNTIME_ERROR","source_code":"\/**\n * Created by yakutovd on 17.03.2018.\n *\/\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeSet\n\n\/**\n * Created by yakutovd on 17.03.2018.\n *\/\nfun main(args: Array) {\n try {\n val out = PrintWriter(System.out)\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = Integer.parseInt(br.readLine())\n val set = TreeSet()\n\n for (i in 0..(n - 1)) {\n val st = StringTokenizer(br.readLine())\n val l = Integer.parseInt(st.nextToken())\n val r = Integer.parseInt(st.nextToken())\n val pair = Pair(l, r)\n var L = l\n var R = r\n while (true) {\n val toRight = set.ceiling(pair)\n if (toRight != null && toRight.l <= r) {\n R = Math.max(R, toRight.r)\n set.remove(toRight)\n } else {\n break\n }\n }\n while (true) {\n val toLeft = set.floor(pair)\n if (toLeft != null && toLeft.r >= l) {\n L = Math.min(L, toLeft.l)\n set.remove(toLeft)\n } else {\n break\n }\n }\n set.add(Pair(L, R))\n out.print(set.size.toString() + \" \")\n }\n out.println()\n out.close()\n } catch (ex : IOException) {\n }\n}\n\nclass Pair(internal var l: Int, internal var r: Int) : Comparable {\n\n\n override fun compareTo(o: Pair): Int {\n return if (l != o.l) {\n Integer.compare(l, o.l)\n } else Integer.compare(r, o.r)\n }\n}\n","description":"There is a straight line colored in white. n black segments are added on it one by one.After each segment is added, determine the number of connected components of black segments (i.\u00a0e. the number of black segments in the union of the black segments). In particular, if one segment ends in a point x, and another segment starts in the point x, these two segments belong to the same connected component.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009200\u2009000) \u2014 the number of segments. The i-th of the next n lines contains two integers li and ri (1\u2009\u2264\u2009li\u2009<\u2009ri\u2009\u2264\u2009109) \u2014 the coordinates of the left and the right ends of the i-th segment. The segments are listed in the order they are added on the white line.","output_specification":"Print n integers \u2014 the number of connected components of black segments after each segment is added. ","notes":"NoteIn the first example there are two components after the addition of the first two segments, because these segments do not intersect. The third added segment intersects the left segment and touches the right segment at the point 4 (these segments belong to the same component, according to the statements). Thus the number of connected components of black segments is equal to 1 after that.","sample_inputs":["3\n1 3\n4 5\n2 4","9\n10 20\n50 60\n30 40\n70 80\n90 100\n60 70\n10 40\n40 50\n80 90"],"sample_outputs":["1 2 1","1 2 3 4 5 4 3 2 1"],"human_solution":"\/**\n * Created by yakutovd on 17.03.2018.\n *\/\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeSet\n\n\/**\n * Created by yakutovd on 17.03.2018.\n *\/\nfun main(args: Array) {\n try {\n val out = PrintWriter(System.out)\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = Integer.parseInt(br.readLine())\n val set = TreeSet()\n\n for (i in 0..(n - 1)) {\n val st = StringTokenizer(br.readLine())\n val l = Integer.parseInt(st.nextToken())\n val r = Integer.parseInt(st.nextToken())\n val pair = Pair(l, r)\n var L = l\n var R = r\n while (true) {\n val toRight = set.ceiling(pair)\n if (toRight != null && toRight.l <= r) {\n L = Math.min(L, toRight.l)\n R = Math.max(R, toRight.r)\n set.remove(toRight)\n } else {\n break\n }\n }\n while (true) {\n val toLeft = set.floor(pair)\n if (toLeft != null && toLeft.r >= l) {\n L = Math.min(L, toLeft.l)\n R = Math.max(R, toLeft.r)\n set.remove(toLeft)\n } else {\n break\n }\n }\n set.add(Pair(L, R))\n out.print(set.size.toString() + \" \")\n }\n out.println()\n out.close()\n } catch (ex : IOException) {\n }\n}\n\nclass Pair(internal var l: Int, internal var r: Int) : Comparable {\n\n\n override fun compareTo(o: Pair): Int {\n return if (l != o.l) {\n Integer.compare(l, o.l)\n } else Integer.compare(r, o.r)\n }\n}\n","testcases":"[{'input': '3\\r\\n1 3\\r\\n4 5\\r\\n2 4\\r\\n', 'output': ['1 2 1']}, {'input': '9\\r\\n10 20\\r\\n50 60\\r\\n30 40\\r\\n70 80\\r\\n90 100\\r\\n60 70\\r\\n10 40\\r\\n40 50\\r\\n80 90\\r\\n', 'output': ['1 2 3 4 5 4 3 2 1']}, {'input': '4\\r\\n1 3\\r\\n4 5\\r\\n2 3\\r\\n3 4\\r\\n', 'output': ['1 2 2 1']}, {'input': '1\\r\\n1 1000000000\\r\\n', 'output': ['1']}, {'input': '1\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '2\\r\\n400 500\\r\\n1 1000000000\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['1 2']}, {'input': '2\\r\\n3 4\\r\\n1 3\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 5\\r\\n3 5\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n5 6\\r\\n1 4\\r\\n', 'output': ['1 2']}, {'input': '2\\r\\n5 6\\r\\n1 5\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n4 5\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n4 6\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n4 7\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n5 6\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n5 7\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n4 6\\r\\n6 7\\r\\n', 'output': ['1 1']}, {'input': '5\\r\\n13 15\\r\\n10 11\\r\\n13 17\\r\\n15 19\\r\\n7 11\\r\\n', 'output': ['1 2 2 2 2']}, {'input': '7\\r\\n9 11\\r\\n18 20\\r\\n8 11\\r\\n17 18\\r\\n16 21\\r\\n11 12\\r\\n26 27\\r\\n', 'output': ['1 2 2 2 2 2 3']}, {'input': '20\\r\\n22 26\\r\\n54 58\\r\\n49 51\\r\\n95 98\\r\\n35 37\\r\\n80 81\\r\\n30 31\\r\\n71 74\\r\\n69 71\\r\\n88 89\\r\\n71 73\\r\\n52 56\\r\\n59 62\\r\\n47 49\\r\\n57 58\\r\\n34 36\\r\\n7 8\\r\\n22 23\\r\\n40 44\\r\\n71 73\\r\\n', 'output': ['1 2 3 4 5 6 7 8 8 9 9 9 10 10 10 10 11 11 12 12']}, {'input': '30\\r\\n78 80\\r\\n37 39\\r\\n66 68\\r\\n47 55\\r\\n39 43\\r\\n48 56\\r\\n44 52\\r\\n7 9\\r\\n27 34\\r\\n34 36\\r\\n90 96\\r\\n13 22\\r\\n76 79\\r\\n9 16\\r\\n75 83\\r\\n1 11\\r\\n74 76\\r\\n56 62\\r\\n61 65\\r\\n77 83\\r\\n48 53\\r\\n48 50\\r\\n22 29\\r\\n39 46\\r\\n70 72\\r\\n24 26\\r\\n1 9\\r\\n40 45\\r\\n13 22\\r\\n46 49\\r\\n', 'output': ['1 2 3 4 4 4 4 5 6 6 7 8 8 7 7 7 7 7 7 7 7 7 6 5 6 6 6 6 6 6']}, {'input': '50\\r\\n719 721\\r\\n564 575\\r\\n582 593\\r\\n404 423\\r\\n437 439\\r\\n261 278\\r\\n497 514\\r\\n314 315\\r\\n576 590\\r\\n34 46\\r\\n190 196\\r\\n411 423\\r\\n870 873\\r\\n309 310\\r\\n850 860\\r\\n802 821\\r\\n642 643\\r\\n612 613\\r\\n229 235\\r\\n675 682\\r\\n51 53\\r\\n531 532\\r\\n870 882\\r\\n85 95\\r\\n691 707\\r\\n2 12\\r\\n983 995\\r\\n467 476\\r\\n201 211\\r\\n899 916\\r\\n362 369\\r\\n805 825\\r\\n220 233\\r\\n40 52\\r\\n800 819\\r\\n553 573\\r\\n651 667\\r\\n298 312\\r\\n837 841\\r\\n470 474\\r\\n828 835\\r\\n427 440\\r\\n288 295\\r\\n796 803\\r\\n947 957\\r\\n796 807\\r\\n394 407\\r\\n734 740\\r\\n790 801\\r\\n359 375\\r\\n', 'output': ['1 2 3 4 5 6 7 8 8 9 10 10 11 12 13 14 15 16 17 18 19 20 20 21 22 23 24 25 26 27 28 28 28 27 27 27 28 28 29 29 30 30 31 31 32 32 32 33 33 33']}, {'input': '100\\r\\n465 482\\r\\n1966 1977\\r\\n1726 1745\\r\\n1096 1109\\r\\n550 564\\r\\n452 466\\r\\n92 111\\r\\n256 260\\r\\n461 481\\r\\n1689 1708\\r\\n1887 1893\\r\\n779 793\\r\\n1437 1456\\r\\n1969 1983\\r\\n812 824\\r\\n181 201\\r\\n1089 1093\\r\\n1096 1116\\r\\n629 640\\r\\n1060 1061\\r\\n1140 1153\\r\\n828 842\\r\\n1442 1454\\r\\n43 48\\r\\n1928 1929\\r\\n1621 1639\\r\\n664 667\\r\\n1976 1988\\r\\n1994 1996\\r\\n402 414\\r\\n994 1000\\r\\n265 285\\r\\n1531 1532\\r\\n1290 1299\\r\\n1652 1669\\r\\n295 305\\r\\n1653 1665\\r\\n771 774\\r\\n1417 1423\\r\\n1718 1725\\r\\n54 56\\r\\n432 442\\r\\n1956 1973\\r\\n844 855\\r\\n404 422\\r\\n377 385\\r\\n250 258\\r\\n1567 1576\\r\\n527 531\\r\\n1422 1434\\r\\n530 546\\r\\n1...', 'output': ['1 2 3 4 5 5 6 7 7 8 9 10 11 11 12 13 14 14 15 16 17 18 18 19 20 21 22 22 23 24 25 26 27 28 29 30 30 31 32 33 34 35 35 36 36 37 37 38 39 39 39 40 41 41 41 42 43 42 42 42 42 41 42 43 43 44 45 45 46 47 47 47 48 48 49 48 49 49 49 49 49 50 49 49 50 50 51 52 53 54 53 54 55 56 55 56 57 57 57 57']}, {'input': '1000\\r\\n20862 20891\\r\\n62330 62427\\r\\n23928 23991\\r\\n63994 64064\\r\\n33681 33776\\r\\n49894 49904\\r\\n97516 97533\\r\\n90136 90137\\r\\n41807 41865\\r\\n53071 53142\\r\\n49275 49306\\r\\n44287 44358\\r\\n68149 68161\\r\\n46321 46356\\r\\n2515 2590\\r\\n41341 41439\\r\\n63341 63379\\r\\n46393 46423\\r\\n86770 86850\\r\\n94342 94428\\r\\n48239 48316\\r\\n61961 61993\\r\\n30773 30834\\r\\n30138 30170\\r\\n77214 77227\\r\\n36711 36763\\r\\n35492 35494\\r\\n47849 47895\\r\\n40662 40746\\r\\n56287 56300\\r\\n47250 47306\\r\\n63244 63252\\r\\n48070 48137\\r\\n73694 73728\\r\\n34338 34391\\r\\n89261 89289\\r\\n47724 47799\\r\\n22574 22660\\r\\n30591 30596\\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 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 87 87 87 88 89 90 91 92 93 94 95 96 97 98 99 100 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 135 136 137 138 138 139 140 141 142 143 144 145 146 147 147 14...']}, {'input': '10000\\r\\n672396 672539\\r\\n526642 527482\\r\\n437627 438558\\r\\n770606 771064\\r\\n526256 527095\\r\\n1630 2406\\r\\n313420 314002\\r\\n137073 137929\\r\\n29681 30271\\r\\n99854 100289\\r\\n700009 700427\\r\\n180498 181184\\r\\n638963 639486\\r\\n845844 846805\\r\\n603481 603812\\r\\n577205 577536\\r\\n157393 157529\\r\\n809955 810046\\r\\n219791 220431\\r\\n476136 476849\\r\\n663953 664136\\r\\n39872 39923\\r\\n930590 931328\\r\\n194238 194726\\r\\n78560 79391\\r\\n54592 55433\\r\\n562263 562458\\r\\n792115 793046\\r\\n697707 697878\\r\\n922419 923121\\r\\n814369 815196\\r\\n125164 125509\\r\\n291476 291678\\r\\n557507 558182\\r\\n952266 ...', 'output': ['1 2 3 4 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 43 44 45 46 47 48 49 50 51 52 52 53 54 55 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 69 70 71 72 72 73 74 75 76 77 78 79 80 81 82 83 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 98 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 119 120 121 122 123 124 125 126 127 128 129 130 131 131 132 133 134 135 136 136 136 137 138 139 140 141 141 142 143 1...']}, {'input': '100000\\r\\n820559010 820559374\\r\\n813293991 813294011\\r\\n44005390 44006109\\r\\n399229438 399230279\\r\\n325099987 325100589\\r\\n14764170 14764227\\r\\n895771859 895772503\\r\\n71665774 71666156\\r\\n830271445 830272046\\r\\n816103772 816103785\\r\\n75807756 75807900\\r\\n563070683 563071385\\r\\n374800262 374800985\\r\\n709303639 709303766\\r\\n492225617 492226011\\r\\n731454954 731455571\\r\\n17285616 17285928\\r\\n214541679 214542288\\r\\n677146331 677146711\\r\\n124554550 124555031\\r\\n116790987 116791373\\r\\n594061011 594061703\\r\\n721222806 721223438\\r\\n550112606 550113467\\r\\n562203141...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '100001\\r\\n4111092 4112460\\r\\n3350744 3351621\\r\\n9192745 9193241\\r\\n6023325 6024351\\r\\n7880433 7880894\\r\\n3898632 3899918\\r\\n592884 593221\\r\\n119233 121131\\r\\n2829899 2830124\\r\\n6937403 6937617\\r\\n4979661 4981507\\r\\n4340247 4340940\\r\\n8320404 8321697\\r\\n67802 68944\\r\\n8789443 8789850\\r\\n5553417 5554437\\r\\n5712567 5713089\\r\\n9986964 9988067\\r\\n6318661 6319123\\r\\n134831 136473\\r\\n6120072 6120408\\r\\n5486605 5488295\\r\\n9341891 9343861\\r\\n3224175 3225236\\r\\n3432441 3432914\\r\\n7984993 7985698\\r\\n7701950 7703804\\r\\n7708129 7709849\\r\\n8171614 8172844\\r\\n4600013 4601592\\r\\n153...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 133 134 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153...']}, {'input': '150001\\r\\n431794762 431795589\\r\\n701008621 701011174\\r\\n797803163 797805793\\r\\n373074621 373074655\\r\\n663640634 663641653\\r\\n303293252 303295624\\r\\n3019449 3021153\\r\\n924325741 924327724\\r\\n406135523 406137260\\r\\n304884012 304884510\\r\\n140335244 140337425\\r\\n260507416 260508812\\r\\n579779427 579781002\\r\\n112834709 112837616\\r\\n159423783 159424004\\r\\n94736530 94737115\\r\\n300172664 300173901\\r\\n279699807 279700113\\r\\n415324893 415326808\\r\\n784162637 784163428\\r\\n781089065 781089597\\r\\n422381643 422383329\\r\\n959758993 959761840\\r\\n687354688 687356799\\r\\n14810...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '199999\\r\\n732187370 732191061\\r\\n981484077 981485383\\r\\n919470432 919471863\\r\\n375984020 375986956\\r\\n559556714 559558736\\r\\n297785551 297788426\\r\\n446900791 446901667\\r\\n444466521 444470179\\r\\n282007179 282009872\\r\\n821848301 821851806\\r\\n36394499 36397199\\r\\n472996643 472997857\\r\\n30361323 30365069\\r\\n262185853 262189827\\r\\n250808852 250809730\\r\\n998284212 998288210\\r\\n840717963 840719490\\r\\n621722466 621723108\\r\\n968378928 968381340\\r\\n668146619 668147180\\r\\n463273209 463275189\\r\\n565983402 565986648\\r\\n51206870 51208276\\r\\n562722036 562722325\\r\\n71697...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '200000\\r\\n618313 620566\\r\\n145360 145843\\r\\n351665 353047\\r\\n151987 152793\\r\\n764690 767035\\r\\n744746 746801\\r\\n905750 907028\\r\\n277143 279741\\r\\n720778 721327\\r\\n25372 25994\\r\\n563036 563914\\r\\n666752 668615\\r\\n590279 592432\\r\\n977930 980385\\r\\n692904 695742\\r\\n196837 197697\\r\\n636808 636879\\r\\n780820 781167\\r\\n543838 545439\\r\\n605632 606101\\r\\n141258 143593\\r\\n747646 750491\\r\\n38337 40656\\r\\n472438 472857\\r\\n612953 614387\\r\\n775367 776971\\r\\n210623 211311\\r\\n463322 466049\\r\\n354949 357327\\r\\n130788 131333\\r\\n731375 734093\\r\\n368428 369054\\r\\n631913 634432\\r\\n223139 22590...', '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 27 28 29 30 31 32 33 34 35 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 51 52 53 54 55 56 56 56 56 56 57 58 59 60 60 61 62 63 64 65 66 67 67 67 68 69 70 70 71 71 71 72 73 74 75 76 76 77 77 78 79 80 81 82 83 83 83 84 85 86 87 88 88 89 90 91 92 91 92 93 94 95 96 97 97 98 99 100 101 102 102 103 104 105 105 105 106 107 108 108 109 109 110 110 111 111 111 112 113 114 115 115 116 116 117 118 119 120 120 121 122 123 122 122 122 123 124 ...']}, {'input': '200000\\r\\n6435726 6442897\\r\\n4867597 4875449\\r\\n2909672 2912851\\r\\n4998123 5007193\\r\\n9981399 9988288\\r\\n8611170 8618879\\r\\n7470962 7471432\\r\\n5588498 5589158\\r\\n9271056 9279804\\r\\n7824424 7829208\\r\\n5129325 5131210\\r\\n1823396 1827161\\r\\n5560949 5563826\\r\\n4905134 4906453\\r\\n814775 817882\\r\\n4962490 4963036\\r\\n4206046 4215962\\r\\n7726283 7729406\\r\\n2694655 2702231\\r\\n6468117 6474274\\r\\n2040672 2042859\\r\\n7534157 7535154\\r\\n808769 816510\\r\\n5085638 5088188\\r\\n5844416 5848571\\r\\n9271573 9281171\\r\\n1224663 1227595\\r\\n3409319 3409990\\r\\n4545211 4553799\\r\\n4022533 402931...', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 22 23 24 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 106 106 107 108 109 110 111 112 113 114 115 116 116 117 118 119 120 121 122 123 124 124 125 125 126 127 128 129 130 130 131 132 133 134 134 135 135 136 137 138 139 140 141 142 143 ...']}, {'input': '200000\\r\\n25953340 26023171\\r\\n93219421 93261890\\r\\n55339994 55435210\\r\\n7139619 7234090\\r\\n530534 589890\\r\\n61790999 61875445\\r\\n53074632 53128731\\r\\n43178657 43266214\\r\\n53080666 53106105\\r\\n571291 646771\\r\\n34336708 34382420\\r\\n39506039 39560496\\r\\n26968187 26988756\\r\\n85074280 85085109\\r\\n80530288 80548768\\r\\n85425755 85497752\\r\\n28796556 28870942\\r\\n34159835 34233265\\r\\n5232737 5295261\\r\\n4850498 4910827\\r\\n96273972 96280135\\r\\n78574601 78645044\\r\\n93114790 93182339\\r\\n94276381 94373395\\r\\n88276691 88315289\\r\\n90585058 90629705\\r\\n10257552 10330093\\r\\n6729...', 'output': ['1 2 3 4 5 6 7 8 8 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 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 65 66 67 68 69 70 71 72 73 74 75 76 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 98 99 100 101 102 103 104 105 105 106 107 108 109 110 110 111 112 113 114 115 116 117 117 118 119 120 121 122 123 124 125 126 127 128 129 130 130 131 132 133 134 135 136 137 137 138 139 140 140 141 142 143 144 145...']}, {'input': '200000\\r\\n65707518 65818791\\r\\n45566557 45777306\\r\\n69112472 69813106\\r\\n6670815 7406499\\r\\n2867811 3413360\\r\\n83082576 83277981\\r\\n20558079 20742992\\r\\n11432244 12320007\\r\\n89285941 89302304\\r\\n77684987 77977152\\r\\n71616398 72135266\\r\\n75267984 75706582\\r\\n44234199 44501008\\r\\n23221137 23847742\\r\\n86148853 86244334\\r\\n13980106 14032973\\r\\n23335475 23562398\\r\\n9506009 9508064\\r\\n91265633 92150582\\r\\n66584552 67539605\\r\\n44807629 45392643\\r\\n46509201 47022827\\r\\n53037743 53806700\\r\\n32752220 33537222\\r\\n44978587 45822570\\r\\n68965071 69671546\\r\\n16910874 169183...', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 16 17 18 19 20 21 22 23 22 22 23 23 24 25 26 26 26 27 27 27 28 29 30 31 31 32 33 33 34 35 36 36 37 38 38 39 40 40 39 40 39 40 41 41 42 43 44 45 45 45 46 47 48 48 49 50 50 50 51 52 51 52 53 54 55 55 56 57 57 57 57 57 58 58 59 60 60 61 62 62 62 62 62 63 63 63 63 63 63 64 65 66 66 66 66 65 65 65 65 65 66 66 65 66 66 67 66 66 66 66 66 66 67 68 68 67 67 66 67 67 67 67 67 65 65 66 67 68 68 68 68 68 69 69 70 70 70 71 72 72 72 73 73 73 73 73 74 75 76 76 76 75 76 75 75 75 76 7...']}, {'input': '200000\\r\\n12672196 19826521\\r\\n79807555 83070853\\r\\n78881762 85524101\\r\\n2554513 10843084\\r\\n62131236 66529215\\r\\n71975008 75977192\\r\\n31110807 34453618\\r\\n8606251 17141587\\r\\n11559148 13073806\\r\\n5706132 12926674\\r\\n50645631 58366612\\r\\n10884268 13262522\\r\\n57189386 66033989\\r\\n58318154 65819213\\r\\n41344976 50579794\\r\\n40215642 49595142\\r\\n49892379 57926227\\r\\n48342037 52216272\\r\\n30606815 37262193\\r\\n57415123 66250584\\r\\n86302787 86555755\\r\\n90458008 98502044\\r\\n23253430 32924845\\r\\n54534867 58112811\\r\\n65569561 74311159\\r\\n88021717 88497174\\r\\n79299695 854...', 'output': ['1 2 2 3 4 5 6 5 5 5 6 6 5 5 6 6 5 5 5 5 6 7 7 7 6 7 7 7 7 7 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 5 5 5 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...']}, {'input': '200000\\r\\n705393034 705393035\\r\\n887434298 887434299\\r\\n790754408 790754409\\r\\n51529733 51529734\\r\\n957317869 957317870\\r\\n963134068 963134069\\r\\n664993238 664993239\\r\\n90104782 90104783\\r\\n116346208 116346209\\r\\n542904185 542904186\\r\\n147348317 147348318\\r\\n896283066 896283067\\r\\n174907228 174907229\\r\\n953567876 953567877\\r\\n11388965 11388966\\r\\n516088615 516088616\\r\\n620455003 620455004\\r\\n620828826 620828827\\r\\n332280648 332280649\\r\\n825722989 825722990\\r\\n571485028 571485029\\r\\n99313514 99313515\\r\\n479970730 479970731\\r\\n380882278 380882279\\r\\n8505058...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '200000\\r\\n78582 78583\\r\\n136472 136473\\r\\n159916 159917\\r\\n74224 74225\\r\\n130709 130710\\r\\n63815 63816\\r\\n102947 102948\\r\\n117941 117942\\r\\n43298 43299\\r\\n98377 98378\\r\\n95993 95994\\r\\n62839 62840\\r\\n22944 22945\\r\\n30054 30055\\r\\n155275 155276\\r\\n173601 173602\\r\\n116637 116638\\r\\n23232 23233\\r\\n108633 108634\\r\\n124764 124765\\r\\n21489 21490\\r\\n79115 79116\\r\\n2244 2245\\r\\n152515 152516\\r\\n67622 67623\\r\\n70407 70408\\r\\n180810 180811\\r\\n198434 198435\\r\\n15460 15461\\r\\n105851 105852\\r\\n193426 193427\\r\\n94588 94589\\r\\n72852 72853\\r\\n88325 88326\\r\\n111939 111940\\r\\n165074 165075\\r\\n173...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '2\\r\\n1 2\\r\\n2 1000000000\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n999999999 1000000000\\r\\n999999998 999999999\\r\\n', 'output': ['1 1']}, {'input': '2\\r\\n999999999 1000000000\\r\\n999999997 999999998\\r\\n', 'output': ['1 2']}, {'input': '200000\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2...', 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...']}, {'input': '200000\\r\\n5291 118029\\r\\n44945 194933\\r\\n137957 156597\\r\\n66694 141600\\r\\n34204 104199\\r\\n433 193714\\r\\n1273 184332\\r\\n101597 118933\\r\\n141659 141667\\r\\n82474 190445\\r\\n17041 78466\\r\\n154328 194211\\r\\n75563 191172\\r\\n22206 199257\\r\\n6755 195344\\r\\n16726 61307\\r\\n142453 197492\\r\\n22954 175334\\r\\n10862 57460\\r\\n12629 154285\\r\\n15448 142772\\r\\n17620 35241\\r\\n140249 185239\\r\\n31373 127744\\r\\n87425 162001\\r\\n27521 52248\\r\\n88053 105868\\r\\n15828 196573\\r\\n37280 141084\\r\\n163141 171386\\r\\n22128 143552\\r\\n51362 124748\\r\\n66265 137371\\r\\n49114 100023\\r\\n54108 55815\\r\\n24689 133912\\r\\n322...', 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...']}, {'input': '199999\\r\\n163077 163078\\r\\n119245 119246\\r\\n157443 157444\\r\\n113885 113886\\r\\n130885 130886\\r\\n192309 192310\\r\\n51757 51758\\r\\n175035 175036\\r\\n126655 126656\\r\\n187163 187164\\r\\n16273 16274\\r\\n100743 100744\\r\\n69873 69874\\r\\n84331 84332\\r\\n199173 199174\\r\\n65541 65542\\r\\n118831 118832\\r\\n18113 18114\\r\\n80577 80578\\r\\n113891 113892\\r\\n62245 62246\\r\\n68357 68358\\r\\n101191 101192\\r\\n123393 123394\\r\\n196669 196670\\r\\n10143 10144\\r\\n57477 57478\\r\\n128525 128526\\r\\n66559 66560\\r\\n180893 180894\\r\\n141457 141458\\r\\n95657 95658\\r\\n45329 45330\\r\\n161203 161204\\r\\n117453 117454\\r\\n3675 3...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '199999\\r\\n129461 129462\\r\\n132701 132702\\r\\n125757 125758\\r\\n198951 198952\\r\\n168327 168328\\r\\n42045 42046\\r\\n69095 69096\\r\\n117851 117852\\r\\n173159 173160\\r\\n62475 62476\\r\\n97513 97514\\r\\n173855 173856\\r\\n26411 26412\\r\\n64207 64208\\r\\n86649 86650\\r\\n190561 190562\\r\\n51331 51332\\r\\n199175 199176\\r\\n133463 133464\\r\\n155753 155754\\r\\n79081 79082\\r\\n14189 14190\\r\\n32507 32508\\r\\n151649 151650\\r\\n162855 162856\\r\\n188481 188482\\r\\n197521 197522\\r\\n85591 85592\\r\\n152079 152080\\r\\n45927 45928\\r\\n127359 127360\\r\\n195495 195496\\r\\n181089 181090\\r\\n197647 197648\\r\\n81531 81532\\r\\n196793...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}, {'input': '200000\\r\\n396471333 396471391\\r\\n684182013 684182026\\r\\n995143967 995146373\\r\\n144242489 144245218\\r\\n223524402 223525764\\r\\n584909136 584910498\\r\\n472460837 472460888\\r\\n700804352 700811242\\r\\n774717347 774721899\\r\\n314506290 314508520\\r\\n379750461 379752130\\r\\n810463361 810464962\\r\\n153610384 153610665\\r\\n932352839 932356467\\r\\n841186389 841186530\\r\\n147106450 147107435\\r\\n412810746 412812227\\r\\n422229710 422235085\\r\\n530468195 530469509\\r\\n349919401 349920424\\r\\n443058022 443060409\\r\\n430903922 430905424\\r\\n970769990 970770136\\r\\n512089466 512092241\\r...', '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 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155...']}]","id":464} {"difficulty":2700,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"40002052843ca0357dbd3158b16d59f4","execute_outcome":"RUNTIME_ERROR","source_code":"fun main() {\n\treadLn()\n\tval a = readInts().sorted()\n\tval m = a.last()\n\/\/\tval isPrime = (0..m).map { i -> (i >= 2) && (2 until i).all { j -> i % j != 0 } }\n\tval myPrimes = MutableList(m + 1) { listOf() }\n\tval factPrimes = MutableList(m + 1) { listOf() }\n\tfor (i in 2..m) {\n\t\tval j = (2..i).first { j -> i % j == 0 }\n\t\tmyPrimes[i] = myPrimes[i \/ j].plus(j)\n\t\tfactPrimes[i] = factPrimes[i - 1].plus(myPrimes[i]).sortedDescending()\n\t}\n\tvar ans = 0\n\tfor (x in a) {\n\t\tans += factPrimes[x].size\n\t}\n\tvar x = 0\n\tvar b = a;\n\twhile (true) {\n\t\tval count = mutableMapOf()\n\t\tfor (v in b) {\n\t\t\tval f = factPrimes[v]\n\t\t\tif (x >= f.size) continue\n\t\t\tval p = f[x]\n\t\t\tcount[p] = count.getOrDefault(p, 0) + 1\n\t\t}\n\t\tval p = count.keys.firstOrNull { p -> count[p]!! * 2 > a.size } ?: break\n\t\tval c = count[p]!!\n\t\tans += a.size - 2 * c\n\t\tb = b.filter { v ->\n\t\t\tval f = factPrimes[v]\n\t\t\tx < f.size && f[x] == p\n\t\t}\n\t\tx++\n\t}\n\tprintln(ans)\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n","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"],"human_solution":"import java.util.*\nimport kotlin.math.min\n\nfun main() {\n val children = Array(11000) { mutableMapOf() }\n val parent = IntArray(11000)\n val nodes = mutableListOf(1)\n var id = 5001\n var k = 1\n var j = 1\n fun recur(node: Int) {\n while (DATA[j] != ')') {\n var l = 0\n while (DATA[j].isDigit()) {\n l *= 10\n l += DATA[j] - '0'\n j++\n }\n if (DATA[j] == '(') {\n j++\n id++\n parent[id] = node\n children[node][id] = l\n nodes.add(id)\n recur(id)\n } else {\n j++\n k++\n parent[k] = node\n children[node][k] = l\n nodes.add(k)\n }\n }\n j++\n }\n recur(1)\n val n = readLine()!!.toInt()\n val subtree = IntArray(12001)\n val tokenizer = StringTokenizer(readLine()!!)\n for (j in 1..n) {\n val k = tokenizer.nextToken().toInt()\n subtree[k]++\n }\n for (k in nodes.reversed()) {\n subtree[parent[k]] += subtree[k]\n }\n var curr = 0L\n for (k in nodes) {\n if (parent[k] != 0) {\n curr += subtree[k].toLong() * children[parent[k]][k]!!.toLong()\n }\n }\n var answer = curr\n val stack = Stack()\n for (child in children[1].keys) {\n stack.push(child)\n }\n while (!stack.isEmpty()) {\n var k = stack.pop()\n if (k > 0) {\n stack.push(-k)\n val l = children[parent[k]][k]!!.toLong()\n curr -= subtree[k].toLong() * l\n curr += (n - subtree[k]).toLong() * l\n answer = min(answer, curr)\n for (child in children[k].keys) {\n stack.push(child)\n }\n } else {\n k = -k\n val l = children[parent[k]][k]!!.toLong()\n curr += subtree[k].toLong() * l\n curr -= (n - subtree[k]).toLong() * l\n }\n }\n println(answer)\n}\n\nconst val DATA = \"(1*2(0*2*)2(3*5*)2(2(4(0*3*)9*)13*)8(8*11*)3(17*3(16*18(0*4*)))14(15*18*)4(2(3(24*27*)32*)36*)4(9(9(19*23*)34*)6(16(23*26*)45*))18(38*41*)5(4(51(0*5*)58*)10(54*24(32*36*)))5(71*5(68*17(53*57*)))20(65*68*)6(10(73*16(60*63*))91*)12(13(31(42*47*)12(68*71*))4(94*97*))7(4(11(43(49*53*)9(89*93*))115*)121*)48(81*85*)8(126*15(14(99*102(0*6*))6(118*121*)))14(6(131*134*)29(113*116*))93(67*72*)10(156*11(42(105*108*)10(6(137*139*)148*)))10(60(110*37(78*82*))181*)10(19(25(138*142*)169*)9(181*26(157*161*)))10(8(6(15(41(127*131*)174*)192*)200*)21(189*102(89*95*)))53(14(162*165*)39(143*147*))39(201*204*)12(36(196*26(174*177*))241*)152(102*107*)23(38(199*202*)57(185*190*))13(1(17(4(5(231*234*)241*)26(222*225*))36(234*20(46(170*175*)223*)))11(271*7(266*63(28(178*181*)213*))))23(285(0*7*)42(252*255*))14(36(29(242*246*)277*)45(76(194*198*)278*))46(292*295*)14(1(10(82(235*239*)323*)29(31(275*139(138*144*))316*))23(77(248*251*)331*))153(216*220*)44(18(312*9(307*26(284*287*)))40(302*306*))16(375*13(364*30(107(229*235*)186(158*163*))))16(24(369*66(306*309*))401*)39(33(9(12(42(283*288*)332*)347*)359*)395*)17(14(28(376*57(27(295*298*)330*))417*)433*)191(260*265*)32(72(353*356*)10(12(18(390*394*)6(408*34(377*379*)))43(73(318*322*)398*)))300(184*191*)20(472*95(379*49(333*337*)))135(367*371*)20(1(14(181(291*296*)479*)37(17(441*30(413*417*))466*))66(440*11(28(404*409*)83(356*360*))))19(1(16(12(493*496*)510*)39(489*17(265(209*215*)482*)))17(524*36(46(37(407*411*)450*)499*)))19(176(377*54(329*333*))565*)110(475*479*)91(9(490*65(428*431*))509*)39(15(8(84(455*459*)545*)556*)92(481*484*))269(347*353*)39(15(121(448*214(237*242*))24(138(418*421*)14(30(518*520*)554*)))243(366*370*))24(89(111(429*434*)547*)118(520*523(0*8*)))24(53(597*13(587*17(59(513*517*)579*)))664*)42(27(126(494*499*)66(561*564*))16(643*646*))309(396*401*)26(129(556*22(539*542*))101(78(516*519*)601*))26(703*83(622*145(480*485*)))83(657*660*)47(15(682*36(51(598*39(562*565*))26(43(307(281*288*)597*)643*)))13(709*712*))27(1(50(192(503*507*)32(669*116(557*561*)))69(46(646*207(441*446*))701*))21(752*29(85(640*645*)105(627*631*))))47(190(577*581*)80(693*696*))211(613*618*)29(801*37(228(538*542*)773*))29(20(46(745*49(699*233(468*475*)))110(695*17(681*46(318(319*325*)646*))))19(822*57(14(753*757*)153(620*624*))))29(39(815*63(755*758*))57(805*231(576*582*)))29(20(184(667*670*)70(27(62(697*701*)43(722*137(589*592*)))54(749*752*)))898*)161(767*771*)245(90(598*602*)34(662*668*))31(41(16(15(845*848*)865*)149(735*738*))930*)31(171(231(529*535*)768*)57(168(34(682*685*)723*)16(877*880*)))118(23(47(797*802*)10(842*845*))46(834*838*))127(109(767*219(551*555*))52(835*189(648*653*)))33(24(160(805*809*)971*)997*)33(279(344(375*383*)730*)46(62(903*906*)971*))33(26(145(75(772*776*)179(674*679*))1005*)62(971*228(745*750*)))33(1041*198(845*259(589*595*)))82(32(972*68(907*909*))89(26(300(597*602*)905*)91(842*847*)))60(2(100(948*951*)19(1034*17(33(987*90(899*903*))205(823*829*))))186(888*891*))416(722*727*)36(1108*46(36(26(8(994*997*)133(876*879*))13(1028*1030*))84(149(849*852*)1004*)))747(424*431*)81(122(976*15(964*967*))36(121(950*952*)1076*))291(77(826*72(759*763*))915*)39(65(90(1013*1017*)1109*)27(1149*383(768*775*)))39(26(18(104(373(665*670*)1045*)1152*)1172*)236(63(901*904*)972*))39(1209*214(52(945*949*)1005*))389(870*874*)40(181(15(1028*1033*)1051*)1234*)40(30(75(205(925*930*)32(1105*1108*))58(33(1126*29(1101*1103*))43(120(1005*29(979*983*))1135*)))1268*)40(178(385(706*713*)1100*)76(155(1049*141(911*915*))734(479*485*)))72(88(1176*1180*)425(845*849*))130(18(64(1135*29(16(1094*48(1048*119(932*936*)))1124*))1219*)1240*)42(30(560(739*744*)1306*)1338*)99(20(395(867*873*)168(1102*98(1007*1010*)))1299*)43(107(197(1052*1056*)168(1087(0*9*)1100*))31(44(1302*84(11(1209*1213*)38(1188*1191*)))324(1035*1040*)))276(1163*1167*)43(1(57(1343*438(908*912*))31(44(20(49(9(65(1191*41(154(998*1004*)1160*))1269*)46(101(1134*1138*)1241*))1339*)55(1306*1310*))1411*))427(1018*222(799*805*)))43(1455*33(1424*44(257(1125*1131*)303(1087*1091*))))43(62(1410*56(30(1327*105(184(1041*1045*)25(1206*1211*)))1373*))60(160(1273*1276*)1439*))43(195(45(1260*1264*)154(191(966*972*)1166*))1517*)43(80(105(1333*1337*)1444*)140(408(978*983*)1395*))366(1213*1217*)82(366(1136*1140*)179(1329*78(1254*689(568*576*))))45(36(325(1199*1202*)74(12(149(1294*1298*)1449*)28(44(1392*1394*)278(1164*1168*))))1586*)81(139(83(313(1016*1021*)1336*)1422*)206(1357*1362*))80(33(309(105(1123*1128*)1236*)1548*)276(1307*1310*))778(889*895*)113(95(55(1411*1414*)1472*)46(379(1145*1148*)1530*))221(116(59(1294*1300*)1362*)34(1447*182(1267*1272*)))50(1660*236(1426*265(1164*1169*)))158(1563*1566*)50(1(274(1400*49(1355*1359*))128(1556*319(1239*316(929*933*))))67(294(1338*1341*)193(1445*358(1089*1094*))))50(38(109(1566*1570*)1681*)95(1626*72(40(1516*101(152(1267*1270*)1425*))622(947*955*))))162(1633*1636*)289(102(1408*1412*)138(1379*1382*))120(131(917(642*649*)93(178(1297*1301*)1482*))1709*)146(15(1669*1672*)71(94(1524*1529*)65(1561*1564*)))596(1251*1256*)55(1798*39(27(83(277(1374*1377*)131(107(1420*1423*)44(1490*1492*)))1753*)148(1634*11(1626*467(1161*1168*)))))55(1834*492(342(1002*1007*)1353*))95(70(1736*31(1708*300(1410*1415*)))272(1546*1549*))94(58(306(1459*1464*)584(1188*1192*))192(29(1615*1620*)140(1511*1515*)))56(1(69(1816*506(1313*1317*))95(1799*185(63(1553*1558*)1623*)))39(1867*660(1209*1214*)))56(252(51(214(1397*1402*)285(1333*1340*))1679*)146(1787*81(1708*1712*)))56(40(33(89(16(18(1744*1747*)1768*)172(1616*138(1480*59(1425*1428*))))1889*)1924*)1966*)96(105(756(1066*1073*)289(1542*1545*))34(1907*292(1618*246(1375*1379*))))253(346(1449*731(723*729*))32(56(1721*1723*)1783*))58(2011*218(185(337(1273*1277*)1620*)87(1720*1724*)))315(69(1704*122(1586*1589*))1783*)59(105(246(1689*1694*)1942*)145(37(1867*317(1553*1557*))799(1114*1119*)))101(236(1786*1791*)62(280(1687*1690*)662(1310*1316*)))60(2082*420(1664*42(1625*1630*)))60(78(54(1961*13(1951*1953*))435(1588*1592*))257(1850*1094(758*767*)))104(611(1464*1468*)34(2047*2050*))61(179(129(1820*63(1761*1764*))169(1791*1794*))108(119(102(1815*260(1557*1562*))176(34(1716*1719*)396(1361*1367*)))26(2034*2037*)))61(44(33(2095*2098*)106(62(1965*1968*)108(420(1504*1510*)1932*)))76(211(1905*1908*)2122*))61(198(108(188(1705*1709*)711(1188*1195*))2017*)45(184(1988*23(1967*142(62(1767*1770*)1835*)))139(2047*2051*)))1093(1204*1210*)62(44(381(1817*1821*)70(259(1875*1878*)220(224(1695*1701*)1927*)))355(273(1635*1639*)1916*))204(2130*2133*)246(2092*105(425(1566*1570*)1998*))536(1814*1819*)65(44(174(2073*2076*)69(25(432(67(1659*1666*)1736*)2171*)299(110(1789*1793*)1907*)))2321*)65(443(422(1457*1463*)1887*)43(2(2287*40(2249*228(17(320(1687*1690*)405(1609*1612*))2039*)))217(134(191(1769*1773*)1966*)2104*)))251(101(2078*252(1829*1833*))2190*)729(1713*1717*)67(356(2024*21(2007*2010*))2389*)67(118(1417(855*863*)2282*)183(61(188(167(1803*1806*)1977*)36(184(1947*1951*)2137*))33(2205*42(248(1918*404(1517*1521*))2177*))))67(2436*47(2391*724(1669*1675*)))984(1530*1535*)68(316(298(1838*1842*)2143*)2461*)68(93(82(242(2045*2050*)58(2236*548(1691*1696*)))29(30(204(2124*2126*)2333*)400(412(1553*1561*)1976*)))119(68(154(112(2047*709(1340*1346*))40(21(2108*2111*)2135*))2333*)31(2372*2375*)))160(2434*132(2305*490(1818*1822*)))69(254(330(1952*1958*)2290*)90(228(2228*2231*)89(2373*467(1908*1913*))))68(1(52(489(2019*2024*)2515*)296(2273*147(375(1753*1758*)2136*)))224(2358*284(2077*2083*)))68(54(39(384(2115*125(1994*1997*))2509*)2550*)663(1943*77(1869*1875*)))122(264(2298*2301*)332(2235*2239*))229(2465*191(80(2197*2199*)59(586(1639*1644*)2233*)))122(230(2361*13(2352*322(2032*2036*)))625(1978*1983*))71(95(36(241(2288*2292*)2535*)433(2141*2144*))93(96(2485*39(239(30(754(1425*1433*)2189*)2222*)2464*))37(2565*449(2118*2122*))))330(374(232(1837*1842*)2077*)2454*)72(186(1563(964*971*)2536*)350(426(1948*1952*)2383*))72(164(2570*63(47(2463*764(1701*1706*))2520*))2749*)203(325(2294*2299*)281(138(2207*2210*)23(213(2115*2119*)455(1879*1884*))))129(462(2256*2262*)72(201(2453*2456*)164(2495*2499*)))73(1(2791*97(68(326(2302*309(508(1489*1495*)2006*))215(2429*2431*))252(2465*2468*)))403(2417*671(1748*1755*)))131(208(2564*2567*)556(2221*2225*))74(223(347(244(2025*2029*)2276*)9(2618*2621*))2855*)811(2119*2124*)175(217(13(2531*150(60(2324*2327(0*10*))198(2202*2207*)))2570*)163(835(1792*1796*)2634*))535(2438*2443*)245(211(57(2466*77(115(2277*2281*)2400*))2536*)2750*)77(1(58(779(2081*2087*)2868*)201(2727*388(2341*103(2243*2246*))))59(2882*167(2717*2721*)))1201(1824*1829*)136(45(2850*37(419(290(2107*2112*)2405*)61(755(2010*2017*)444(2330*2333*))))371(2551*2555*))489(2574*2578*)377(64(346(2281*2286*)142(2493*2496*))12(2692*2696*))81(56(45(71(95(2738*113(398(2230*2234*)156(2481*2483*)))311(2539*2542*))2927*)270(653(2051*2055*)136(966(1608*1615*)2583*)))100(624(2323*2326*)71(409(2473*2476*)2888*)))346(531(2264*196(2075*2079*))2809*)969(2187*2192*)83(3079*232(128(2721*2724*)2856*))141(147(206(2678*2682*)797(2093*2098*))571(2473*2476*))185(249(329(2426*129(2303*2306*))177(2590*2594*))3023*)85(229(73(256(2566*2570*)2828*)227(2678*2681*))147(2992*453(2541*2546*)))143(450(2639*2642*)382(768(1944*1951*)384(2337*2341*)))86(101(3064*1390(1677*1682*))487(209(2479*2482*)2696*))85(1(58(42(170(2914*379(2538*2541*))49(153(2891*924(1969*1975*))246(2808*2813*)))3152*)212(202(2798*356(2444*2449*))3009*))59(90(119(2956*670(2289*2294*))36(3049*371(30(2651*2653*)2687*)))659(2527*2531*)))2192(1143*1152*)86(3259*183(166(505(207(2200*2204*)2415*)2922*)181(80(2830*91(137(2604*2609*)2750*))2924*)))146(89(190(2950*2954*)340(2806*2809*))157(181(2902*2907*)748(2342*2347*)))87(106(3206*629(2580*2583*))272(39(208(2801*760(2044*2050*))334(2686*2689*))203(2862*2866*)))87(184(3158*206(221(367(2367*2370*)2743*)2967*))3359*)149(521(517(2260*2266*)305(2480*2484*))191(3121*3125*))88(152(30(3196*3199*)602(2629*66(2567*2571*)))311(3082*1297(1787*1794*)))88(3403*63(3342*89(412(2843*2847*)73(28(182(17(2961*2965*)2984*)416(2754*456(2301*2305*)))126(3081*3085*)))))88(3437*836(795(1808*1814*)2616*))567(42(196(2736*2740*)2938*)69(89(2826*2829*)2921*))89(919(2550*424(2132*2136*))65(3416*52(3366*3369*)))699(2877*2881*)90(286(861(2344*2350*)3214*)349(502(2651*2654*)3160*))90(3510*118(200(116(75(3003*181(2825*2830*))356(2732*2737*))3211*)273(14(3127*3130*)201(2946*452(2496*2503*)))))158(48(167(1400(1865*1870*)3273*)45(71(3327*637(2692*2696*))101(3305*3309*)))595(2910*2913*))91(385(1001(2190*2196*)3199*)67(3519*49(84(232(3156*377(2784*2787*))31(3368*3370*))205(257(3026*3030*)168(64(86(2972*2974*)3065*)273(205(104(2549*2553*)2661*)2870*))))))563(3161*3165*)92(512(1219(1906*1915*)3137*)3651*)92(164(194(3294*3298*)3494*)828(254(2578*2582*)2841*))712(3050*3054*)93(70(831(2773*2777*)3610*)688(2994*1708(1289*1297*)))163(473(3151*3154*)1024(2605*2610*))828(2970*2974*)95(271(3437*510(2931*2935*))3718*)95(70(98(157(32(3362*637(2729*2732*))70(267(182(2885*2888*)3076*)76(3269*3273*)))436(3142*3146*))3682*)3754*)1338(2512*2518*)96(3761*128(1334(2301*2306*)454(3189*427(2765*2769*))))95(1(72(373(3334*3339*)99(45(30(28(157(213(67(220(2855*322(2537*2540*))3087*)159(2997*3000*))3375*)3536*)3566*)93(85(3421*129(3294*3298*))160(77(3278*3281*)1025(2335*2343*))))3668*))71(3770*58(3714*116(265(3336*1325(2013*2019*))447(454(2710*2715*)3172*)))))172(3695*137(58(3502*64(149(3293*3295*)3447*))736(2836*2842*))))95(219(3669*419(3253*145(3110*380(2734*2738*))))3903*)169(267(400(228(2935*2941*)3171*)3574*)1458(2385*2390*))313(3705*31(367(60(633(2617*2621*)385(2875*2880*))3328*)655(3042*3047*)))97(3950*71(2(3879*61(40(112(3668*3672*)337(808(2641*2646*)3456*))3836*))61(115(94(3631*67(3567*443(3126*3132*)))474(3264*84(3183*3187*)))86(156(3621*3623*)3782*))))97(70(1498(2433*2439*)3939*)176(408(3427*618(2811*2817*))387(205(3253*3256*)783(2681*2689*))))97(133(356(177(3370*3374*)3553*)41(149(3722*123(3602*3605*))234(208(3437*3442*)3652*)))513(38(156(3355*3358*)326(3192*3195*))3563*))577(3597*351(190(3061*3065*)3258*))1209(2978*2983*)393(355(580(2865*2869*)3453*)3812*)100(72(60(90(3884*527(3360*3363*))3983*)4045*)4119*)321(160(1594(2145*2153*)63(3686*351(3338*240(3101*90(3015*3018*)))))3925*)394(3853*602(64(3191*3195*)3263*))1495(2765*2770*)103(4163*476(3689*216(560(2916*2922*)2033(1451*1458*))))103(74(474(3636*3640*)105(435(115(3461*320(3144*3147*))3587*)4024*))136(195(3874*3877*)278(3797*1242(2557*2562*))))103(74(902(3243*3250*)192(332(3630*49(3584*128(3459*3464*)))3975*))818(99(3326*3329*)3433*))1170(3185*3189*)104(678(3578*752(2830*2835*))4267*)975(3397*3403*)244(228(3907*216(3694*3697*))4144*)182(450(3757*468(3293*175(3121*3126*)))375(3846*3849*))107(547(1516(2237*2243*)3761*)75(156(103(3976*387(3592*35(3563*3566*)))162(3932*544(3390*3394*)))289(3969*3972*)))106(1(518(1189(2630*2637*)3828*)141(347(3860*3863*)661(3552*92(120(3342*3346*)205(3264*219(3051*3055*))))))4376*)184(346(3953*27(199(3731*3734*)3936*))233(4078*82(4000*810(3192*3197*))))107(142(4258*53(393(3815*94(3724*3727*))517(2174(1525*1535*)3711*)))237(397(482(3309*375(2939*2944*))3803*)4203*))107(309(4132*180(3956*3959*))787(432(3231*3234*)3671*))629(231(165(3541*3545*)3713*)3949*)251(52(675(3601*3605*)4282*)203(4134*485(3652*3655*)))189(205(1074(3127*3133*)338(3871*3874*))113(859(3447*3451*)791(3521*3526*)))188(1702(2730*2737*)300(4141*4144*))111(432(4090*938(3156*3159*))241(70(1478(2742*2747*)258(3971*3973*))4304*))573(129(3955*348(3611*3614*))4094*)112(144(48(1346(3018*3025*)493(3880*383(3500*3503*)))143(4287*22(434(3833*70(3767*3769*))406(3871*3875*))))1006(3586*160(3429*3434*)))893(3820*76(3747*1363(2387*2395*)))256(140(277(4055*4059*)4338*)356(4125*125(4003*4006*)))784(3960*3965*)469(734(3547*3551*)607(3681*3685*))116(242(4404*290(648(3469*3472*)1043(3082*3086*)))4663*)2363(2417*2424*)117(4671*83(4590*158(783(3651*396(3260*3264*))4446*)))262(140(68(564(3771*3775*)37(4305*4308*))211(163(634(3407*3414*)179(3871*3874*))4219*))4573*)116(1(1(82(341(1011(3284*3289*)458(3844*3849*))4650*)448(324(3962*3964*)360(3932*3935*)))475(59(184(4028*4032*)33(4188*1045(3145*3150*)))274(4015*301(3718*3721*))))204(4570*924(3648*3654*)))116(4783*247(175(189(20(4154*4157*)4181*)4372*)4550*))1065(516(3333*3341*)381(3480*3484*))564(4367*4371*)118(88(306(4424*4427*)64(140(939(3592*3597*)417(299(3822*3827*)4129*))718(3971*3974*)))87(63(514(4182*249(1011(2924*2931*)161(3783*273(3513*3517*))))57(4660*41(4621*43(4581*43(4540*4544*)))))520(885(3388*3392*)234(4045*4050*))))629(1154(3227*3231*)297(4091*4097*))364(4660*4663*)120(485(488(388(3547*590(2962*2968*))3949*)214(4225*332(3898*3901*)))87(4847*667(4182*4186*)))119(1(86(461(237(482(3675*3680*)4164*)4406*)4869*)582(936(452(2987*2991*)3448*)4386*))377(4594*522(4075*4080*)))1062(4037*4041*)120(157(4827*1029(3801*3805*))89(319(30(4555*845(1994(1718*1727*)3724*))4602*)67(4856*4859*)))338(1176(3622*3626*)158(679(3967*3972*)297(4357*198(4162*250(3914*3919*)))))335(333(105(94(4294*4297*)4394*)4504*)401(4438*4442*))703(259(365(3852*3856*)1178(3046*3051*))121(4369*4374*))123(5076*155(1404(3519*3524*)102(48(4781*4783*)4834*)))121(1(1(90(1648(3354*3361*)5011*)215(712(4176*1107(3071*3077*))4898*))157(634(289(4036*348(3691*3696*))30(4305*404(3905*3908*)))223(4756*4759*)))741(4401*289(4115*4121*)))215(439(4619*4622*)414(145(4504*4508*)1259(3396*3402*)))482(4809*543(542(3728*3732*)4277*))608(4695*4699*)216(66(60(159(45(4762*4765*)77(1617(3119*3128*)789(3958*3962*)))4989*)5052*)222(789(4109*4112*)2215(2688*2695*)))215(784(4350*4353*)329(87(449(44(4230*352(3882*3885*))4285*)56(4680*223(4462*4466*)))4835*))125(1(483(4771*572(4203*4206*))89(270(1442(3462*3466*)240(34(81(4557*4559*)4644*)1029(3651*3656*)))5197*))5289*)287(536(47(625(3920*3927*)4555*)492(4113*4117*))667(30(4451*4453*)4487*))126(223(134(4959*186(391(4386*4389*)4783*))236(1036(3833*3839*)4877*))91(5247*70(115(42(966(4056*4062*)5030*)390(4685*4687*))622(248(4325*4329*)4580*))))126(88(2(898(855(3521*3527*)98(4286*4290*))70(5218*440(4781*35(4748*276(4476*306(4173*4180*))))))5311*)1154(518(3729*3732*)4255*))354(134(943(102(4003*4007*)4114*)5061*)51(5146*5149*))287(5268*540(4731*829(3905*3909*)))1812(3754*3761*)129(5445*825(1821(2801*2806*)4631*))406(5180*5183*)130(963(4497*456(4046*4050*))327(5144*175(4971*390(165(178(4242*4245*)52(4374*4377*))4600*))))130(92(770(1339(3292*3298*)152(4487*4491*))5415*)231(5278*94(431(4755*4760*)83(375(4735*4738*)1031(4085*4090*)))))130(278(5252*199(5056*113(970(3975*3981*)4954*)))5546*)502(77(292(202(4604*4609*)4813*)1276(3832*3836*))5193*)223(2(72(64(1030(4305*4309*)5341*)402(254(4752*4756*)46(70(4897*2035(2864*2873*))585(4395*4398*))))274(282(488(4461*793(3672*3676*))345(4616*4618*))5249*))354(5173*5176*))1495(4259*4264*)132(1(5627*91(237(219(498(4584*896(3692*3698*))926(4168*4172*))385(4934*4938*))5562*))169(64(633(4790*2857(1935*1943*))333(5102*366(4739*4742*)))5508*))1898(3912*3917*)132(1(902(4781*322(4465*4469*))93(426(863(4313*4316*)165(5018*61(4959*4962*)))76(376(104(328(1318(3414*3420*)4740*)5072*)5178*)433(5124*5127*))))333(5399*118(40(629(4614*4620*)5251*)378(4916*483(4437*4441*)))))226(710(226(4724*4728*)708(4249*4254*))985(4689*4692*))133(329(1668(3774*3780*)5450*)93(5688*147(1011(4532*4539*)56(5496*5499*))))583(416(4930*780(4154*4158*))41(5316*298(5020*5025*)))134(5814*174(1354(4288*4292*)5649*))1330(4628*4633*)1468(1510(2986*2993*)488(4018*4022*))376(288(5315*5319*)148(48(533(4880*4883*)5419*)518(241(4712*4715*)4960*)))309(5694*768(4929*72(4860*261(4602*1096(3509*3517*)))))137(1(5886*95(5793*204(435(5156*324(4836*4838*))1142(235(4223*4226*)1443(3023*3029*)))))5916*)1985(4069*4074*)138(96(1258(4568*4572*)79(473(5280*18(36(5231*5233*)554(4719*4722*)))589(5181*5184*)))5950*)138(567(1126(4258*4264*)5392*)97(150(194(5520*427(5096*5100*))546(504(4673*4677*)5183(0*11*)))249(830(4813*4817*)1232(4417*4423*))))138(397(231(218(5156*5159*)5380*)41(297(170(805(4302*715(3590*3595*))5117*)5291*)5591*))6031*)138(1007(129(4896*4902*)5034*)1047(4996*44(4955*4959*)))138(100(602(780(4569*4574*)548(4808*4813*))444(287(146(5088*5091*)5240*)402(5129*5131*)))1906(206(3967*3972*)4185*))450(5780*5783*)323(5911*428(14(5472*5475*)5492*))1544(4700*4706*)141(181(1024(407(4498*4502*)4912*)73(55(1191(4620*4623*)5817*)188(219(5467*5472*)5694*)))6138*)141(521(1959(3659*3665*)5626*)103(6046*151(152(5745*5749*)231(681(764(4227*4233*)110(69(4821*4825*)4897*))5691*))))2288(4030*4038*)141(1(311(301(5573*296(212(5068*399(4673*4677*))5290*))276(5614*200(292(5124*5129*)5424*)))519(5694*524(5172*734(4443*4447*))))105(6122*1544(4580*4586*)))1088(5289*5293*)957(74(347(5004*5008*)5359*)24(176(5236*5239*)5420*))143(6259*754(616(4891*4894*)5514*))1937(4475*4480*)511(192(158(268(5289*318(669(4308*4312*)4984*))5572*)5734*)43(40(745(5100*5104*)5852*)5896*))251(152(55(5993*5996*)1939(4114*4119*))600(170(5442*5445*)2392(3225*3233*)))146(191(594(367(5179*5182*)5552*)65(6084*152(115(1159(4660*4664*)5825*)41(5903*110(36(798(4962*4966*)5766*)556(5250*5252*))))))367(1108(4894*353(4545*4553*))1857(4159*4164*)))144(1(1(106(649(5634*5638*)6289*)1081(5316*500(434(4384*4390*)4827*)))194(4035(2182*2189*)173(156(5898*429(5471*5475*))324(5738*536(5207*5210*)))))109(152(6179*375(419(5387*976(4416*4419*))5817*))214(667(1264(4201*4207*)5473*)6143*)))144(1501(4966*1124(3846*3851*))6478*)1078(93(160(416(4876*4883*)677(4624*4628*))5468*)5565*)145(110(151(1036(5202*5207*)158(6087*6091*))6402*)372(6142*991(5153*5158*)))145(110(90(491(150(5681*898(4786*4790*))33(165(5645*263(5385*5389*))5819*))6346*)410(6028*349(5682*578(5106*79(5033*5036*)))))680(5884*580(5307*5311*)))474(6243*6246*)1071(1747(3903*3911*)196(5466*5469*))147(264(1633(4693*4698*)6333*)423(387(5789*5792*)194(5989*2626(3365*3371*))))147(112(90(6413*6416*)980(128(108(315(4977*4981*)5299*)5413*)5543*))420(56(6161*301(5863*218(554(226(4869*4872*)5102*)5658*)))258(5979*164(5818*5821*))))2858(3953*3960*)260(412(6147*6150*)921(5643*5649*))352(129(6350*1783(4570*4574*))866(594(5029*5033*)118(5512*605(4909*4915*))))260(545(6052*6055*)91(6511*69(6445*499(5948*5952*))))672(289(1318(4593*4599*)5920*)75(384(5753*5755*)6143*))1508(62(5321*528(4796*4801*))5396*)152(1(331(6421*824(526(126(4948*4951*)5082*)5611*))267(982(5519*3228(2294*2304*))6516*))111(6675*91(6586*6589*)))2532(4412*4417*)153(110(158(216(1476(4837*4842*)451(5870*5873*))126(201(6215*6219*)735(5687*5690*)))454(1030(5227*5233*)328(426(5511*5516*)77(5867*548(5323*5327*)))))525(111(6210*117(165(5930*5935*)6102*))696(225(5412*5416*)5645*)))420(70(6530*6533*)400(371(5834*350(5490*5493*))6217*))2339(4699*4705*)155(6890*436(637(5819*5822*)673(5790*613(5180*5184*))))360(6702*1078(336(5291*5296*)5636*))788(2185(4102*4109*)69(160(6067*6070*)840(5393*5397*)))157(112(284(386(6156*6160*)798(5750*5755*))6839*)490(109(152(6202*6204*)750(5610*862(4751*4755*)))402(581(5496*5503*)131(5955*5959*))))157(205(6778*624(6157*6160*))1878(5113*580(4537*4544*)))1324(249(5587*5590*)863(4979*4984*))500(6672*6675*)159(742(6275*512(5768*5772*))595(970(5463*5466*)6440*))275(418(6502*6505*)1645(5280*5285*))367(68(1618(5153*5158*)6778*)655(451(5743*5746*)6200*))161(2880(596(3586*3594*)4194*)205(777(6094*6098*)139(1154(5585*5588*)187(482(6076*63(300(5715*5720*)6023*))6571*))))900(86(322(5956*5961*)288(5997*667(5333*5337*)))6383*)658(734(358(5534*5538*)1278(4620*4625*))186(6454*6457*))162(1(940(6199*25(6179*6182*))115(2(7032*88(6946*204(6745*1517(150(1450(3630*3637*)5090*)5248*))))7061*))281(6898*1407(5493*5498*)))659(792(5898*5901*)707(5989*5994*))163(408(1119(5671*5675*)314(623(5859*5863*)6489*))7213*)163(208(858(1028(5120*5127*)341(1542(4274*4279*)5824*))73(70(247(6636*6638*)6888*)182(6778*1844(4938*4943*))))7252*)163(915(560(5778*5783*)6345*)121(7141*694(898(846(4705*4712*)5561*)6463*)))283(90(7069*7072*)294(1550(5320*5324*)532(6344*6349*)))164(7295*209(2362(4726*4731*)7096*))164(118(2(1069(81(6036*6040*)450(5673*5679*))553(447(6200*6203*)210(273(685(5484*5490*)6178*)6454*)))171(180(6870*41(335(6498*187(29(6284*266(6022*6024*))6323*))932(5916*5919*)))318(1745(5011*5019*)6766*)))813(431(904(5227*1492(3739*3745*))6143*)6578*))164(118(169(75(54(49(6927*95(109(39(28(6660*6663*)210(6484*1085(5401*5406*)))6742*)210(897(5747*5752*)6654*)))7010*)7067*)1302(5842*5846*))7319*)606(6833*2441(4394*4401*)))378(811(6424*741(5686*5689*))148(639(6457*6460*)152(604(904(5442*5445*)6355*)1372(5590*5594*))))631(178(6836*64(106(6670*6672*)1688(5093*5097*)))847(6184*102(6084*6089*)))1057(6613*648(1115(4854*4858*)5976*))454(1075(6153*6159*)221(724(6291*6294*)1902(5119*5124*)))2367(5335*5340*)169(1613(174(5752*5757*)5934*)1162(6387*36(6354*6359*)))167(1(1(7558*121(7439*94(392(69(3061(3825*3835*)606(6292*6296*))6973*)1840(5528*5533*))))119(2(304(386(6780*161(6621*6626*))146(7029*7032*))94(7390*786(109(6498*1328(5172*5177*))924(5693*5699*))))7507*))7629*)167(1085(420(6125*6130*)6552*)121(96(155(1075(124(6068*506(5566*5571*))6204*)306(6976*6978*))7442*)1526(6014*6018*)))5249(2584*2593*)166(1(1(7675*371(393(6913*587(6329*49(6284*6287*)))572(6747*1309(215(5225*5231*)5450*))))303(581(6821*859(5964*5969*))7411*))801(364(6552*6555*)6924*))166(222(216(1404(5884*5889*)7295*)1057(6457*6460*))304(7437*675(6764*6769*)))1080(167(1192(5476*5480*)6676*)6847*)295(458(40(430(272(641(5792*5796*)276(6163*1589(4581*4586*)))156(36(6534*6536*)6577*))7165*)7208*)1356(6312*6317*))167(1(222(155(7424*1394(6033*6036*))313(7275*7278*))883(985(5947*908(5042*5049*))6944*))129(7701*94(7609*1769(5843*1231(4615*4621*)))))167(128(373(7344*7348*)318(183(811(6411*6415*)1680(5548*5553*))7418*))1162(232(6472*6476*)6714*))549(7495*7498*)296(2023(5729*5734*)2673(5086*5090*))1013(112(612(65(72(6186*6192*)6267*)6335*)935(6015*6019*))292(6776*6780*))860(64(58(7104*2004(5105*5111*))277(6899*6902*))7247*)615(614(6879*261(195(6426*6429*)6629*))439(7067*7071*))957(580(6589*6593*)425(6751*6754*))3450(4687*4696*)399(370(7378*1433(5948*5952*))7758*)554(7604*124(2334(5149*5153*)785(527(6179*6182*)6712*)))490(433(504(2711(4038*4045*)6758*)723(6542*1109(5436*5442*)))1345(6364*6368*))399(7805*369(1003(6436*6440*)7446*))1173(7042*7047*)958(645(6618*6621*)97(249(6923*1073(5854*5857*))7183*))180(126(2242(5691*5698*)7942*)444(7626*246(7382*336(7050*78(438(6537*6540*)734(6248*6253*))))))2785(5487*5492*)181(126(96(7875*7878*)7976*)317(7787*625(258(554(310(150(5892*5899*)6052*)6365*)6922*)7184*)))181(384(7743*338(7408*676(1950(4784*4790*)6744*)))687(668(6789*6791*)7463*))1150(1931(5251*5256*)655(6535*6542*))182(128(1373(455(445(5765*5771*)6219*)6678*)517(108(7428*425(7006*908(6100*6106*)))7549*))226(334(7636*7639*)158(866(6952*6955*)7824*)))697(85(233(7376*496(6885*6888*))267(7353*426(171(1463(5295*5301*)6766*)494(6446*6450*))))7726*)311(192(60(7861*73(7791*490(7303*137(26(7144*7148*)903(125(6149*6152*)6284*)))))431(7518*7521*))1592(6554*6558*))2073(6389*6394*)697(7771*179(319(1259(6018*6022*)644(6640*6643*))7610*))186(8301*562(7741*2862(4882*4889*)))565(7935*7938*)187(128(99(8090*226(983(1015(5869*5873*)6891*)150(934(1150(5642*5649*)6801*)7738*)))193(856(636(6530*6534*)218(6954*6958*))239(2418(5377*5386*)7807*)))8369*)315(1118(361(6763*306(6462*6465*))7135*)387(7868*86(60(246(143(7337*7340*)7487*)497(7238*592(6650*6653*)))345(7460*556(6906*6912*)))))416(852(7334*2392(4945*4951*))8198*)315(750(810(6740*6744*)494(7062*7067*))1905(6408*6412*))190(322(972(7149*7154*)8128*)1227(108(7117*7120*)616(6618*479(6142*6147*))))190(561(1377(6532*6536*)7916*)321(8158*2184(5976*5982*)))190(8488*129(8361*2616(5747*5752*)))189(1(463(1112(6923*6928*)363(30(7649*7654*)7687*))234(158(129(189(767(7038*7040*)236(7575*836(6741*275(6470*6474*))))2002(6012*6015*))1797(6352*6356*))775(7539*7542*)))8554*)515(708(406(2811(4304*4313*)7126*)127(805(6603*6606*)7415*))1548(6704*6708*))190(673(33(429(1226(6221*6226*)405(1002(6049*6053*)7058*))7896*)7931*)824(7782*31(7754*7759*)))190(134(636(1441(6404*6409*)1312(6540*6545*))8495*)8631*)190(1297(1789(5546*5552*)7344*)240(2139(6264*6268*)8410*))326(1098(7417*183(7238*1390(5850*5857*)))1477(62(6991*6994*)4151(2908*2916*)))191(8680*402(606(7674*66(306(7305*7310*)7618*))941(7352*408(6946*647(424(5879*5884*)6312*)))))327(489(586(305(7195*7201*)7508*)8097*)106(8482*93(143(8249*460(7791*7795*))201(8199*573(172(7458*7461*)7636*)))))192(906(2712(5127*5133*)7847*)135(267(736(7617*879(236(6506*6514*)6753*))73(8298*1009(7291*7295*)))643(805(7198*7202*)1067(6942*6948*))))434(564(7988*29(7962*7965*))8561*)193(687(1446(6670*6674*)1022(223(6877*6883*)7110*))8821*)193(337(2098(6387*6392*)8492*)1650(133(7048*7051*)7189*))3360(5673*5679*)191(1(1(1(138(105(8603*8606*)8713*)777(1265(587(6224*6228*)6822*)8089*))545(56(8268*87(332(7852*7856*)295(479(7416*7420*)7901*)))292(8051*8054*)))141(1081(7672*128(7546*212(7339*736(6606*6610*))))202(70(1016(1221(6260*6266*)7489*)8508*)854(7726*768(6962*6967*)))))8935*)4640(4487*4494*)442(1145(7548*1515(6036*6040*))93(8610*616(7996*333(7667*334(121(7214*7221*)193(7152*7156*))))))607(78(252(8231*335(22(7878*7880*)451(7454*657(6801*6806*))))8503*)8584*)194(1019(7979*672(7311*7314*))9007*)338(1190(1900(501(5273*5281*)5786*)7689*)106(8775*93(148(296(8241*486(7757*7761*))64(8481*57(8428*1300(7131*7134*))))1998(6707*6712*))))337(1956(6955*6959*)2369(6548*6555*))196(248(690(2013(6115*6120*)8135*)1961(6867*6871*))702(8380*441(7941*7946*)))338(276(753(430(7489*7493*)28(7899*310(7593*7595*)))493(869(7327*7330*)8204*))937(8038*1282(6759*359(6403*6409*))))197(9129*141(8990*205(211(8576*8580*)1129(7664*7668*))))448(245(174(996(7478*457(7025*7029*))728(7757*4699(3060*3071*)))1232(7442*214(7231*7235*)))686(8243*1611(6634*6640*)))1638(1861(5887*5893*)131(7626*7629*))199(344(414(8442*8446*)8862*)908(2912(5388*5393*)8310*))198(1(142(108(456(569(7944*7948*)8519*)8978*)202(2408(6478*6482*)673(864(7355*7361*)8227*)))141(9105*358(1649(7100*7105*)755(559(7442*7446*)92(7915*1056(6865*6870*))))))807(8468*1246(7224*7229*)))198(142(424(109(8608*968(7643*7646*))141(8586*284(8304*398(7910*586(7327*7331*)))))9166*)9310*)3239(6270*6277*)199(433(201(233(8451*8454*)922(7768*3095(4677*4682*)))239(422(613(7629*717(6914*6919*))8252*)133(526(8018*957(7063*7069*))8554*)))2604(6757*1287(5474*5482*)))198(1(430(8944*200(429(462(7856*7858*)8324*)8756*))143(2(359(8884*667(8219*914(7310*985(6328*6332*))))115(9144*664(226(469(7788*2293(5497*5503*))8267*)8498*)))211(1096(7974*7977*)425(8650*1230(7424*7427*)))))1260(234(1592(6353*6359*)7956*)945(7247*7251*)))198(900(333(8224*8228*)8564*)9466*)3610(6055*6063*)776(101(8797*359(59(8382*592(7793*7797*))175(1257(7018*7022*)8282*)))57(8864*243(8624*930(1039(6658*6661*)7705*))))346(1804(7562*7565*)777(8594*826(1367(6406*6410*)7782*)))345(120(9267*9270*)2195(7197*7201*))201(1(1336(1323(6881*6887*)8212*)511(638(452(7949*283(7670*7674*))890(7521*7525*))892(3377(4786*4795*)8175*)))9581*)347(216(1080(8140*8145*)511(8716*8719*))434(9014*9018*))202(1316(8282*253(1110(6923*6926*)1311(6729*6734*)))360(9256*1304(7954*7960*)))202(9625*2145(7482*366(7119*7124*)))202(737(285(8614*8618*)1244(274(7387*7392*)7670*))516(9137*279(8860*8864*)))201(1(273(88(284(2053(6962*6966*)746(8276*337(7945*1765(6182*6187*))))9321*)1228(8184*8187*))514(1029(8147*3303(4846*4854*))9188*))273(1649(7783*7786*)184(1335(7919*7922*)545(8715*1391(7326*326(7006*473(6537*6542*)))))))996(8940*8944*)202(9739*2175(107(7459*7463*)7575*))1226(8727*8731*)359(943(8656*8660*)210(481(39(8875*8878*)2087(6832*6840*))151(1132(8127*365(1519(6246*6251*)7774*))802(8471*8475*))))204(154(441(9199*9203*)9646*)151(2(1017(70(8562*54(1923(6588*6594*)8519*))8646*)124(183(539(1105(7714*7720*)8827*)1249(8120*8123*))796(543(8219*266(7957*7960*))149(8622*733(621(7273*7276*)7901*)))))124(9583*93(1128(8365*274(8093*8098*))768(260(8474*8480*)327(8416*8419*))))))3780(6307*6313*)570(296(617(8611*8614*)1172(8062*8067*))2078(7459*7463*))356(123(9633*9636*)569(9192*1330(7865*548(7320*7327*))))207(9924*272(2715(6939*6943*)1103(8558*216(8344*8348*))))1374(384(8389*586(7808*7813*))8786*)208(807(9146*1984(7166*7170*))151(9812*3124(6690*6699*)))2442(7741*7746*)208(1(1446(1556(6978*6983*)8542*)1218(1246(7526*7529*)475(8305*8307*)))472(390(250(806(8085*8089*)8899*)9151*)9544*))1112(56(1850(7207*7213*)9066*)9125*)363(855(1350(7670*7676*)743(8285*8289*))124(257(77(9431*9435*)1275(270(7969*7973*)8246*))393(9388*990(8401*8404*))))4412(5863*5871*)363(223(1495(297(7906*7909*)621(7588*7592*))233(1655(777(7045*7050*)7830*)9489*))577(9370*9373*))1025(9289*9293*)213(372(100(308(121(9205*87(4073(5048*5054*)9132*))9342*)535(369(8749*168(1113(674(6796*6801*)7479*)8595*))1012(8122*8128*)))9777*)151(10000*3527(6475*6480*)))1564(8808*8812*)213(1(1952(8211*562(7656*7660*))809(705(8662*8665*)827(8547*8549*)))968(135(347(8738*1623(7118*7124*))495(2663(5938*5945*)695(7915*7919*)))334(8913*8916*)))496(258(1197(8481*8487*)135(1735(7816*7820*)9558*))9954*)214(376(100(9761*9764*)1418(55(8393*8398*)8456*))281(192(312(94(9373*2004(7371*7377*))388(738(8351*8354*)114(144(8837*8843*)8990*)))767(9040*9042*))1062(8942*363(2594(5989*5994*)1687(6903*6909*)))))213(1(279(687(538(8799*8802*)9343*)264(9769*540(9231*19(9216*1044(8174*180(8000*8003*))))))781(9550*1213(240(8099*8104*)8347*)))624(56(9664*9667*)9727*))373(120(2292(155(7625*7630*)7788*)10083*)222(830(9153*9156*)6543(3445*3455*)))372(2765(7457*7461*)994(9234*9238*))694(9911*9914*)216(623(9770*3150(6624*6629*))10404*)3360(7261*7266*)217(754(9656*328(161(358(8812*861(7954*7960*))9181*)210(9136*397(8742*96(107(8543*199(8347*8350*))167(642(7850*7856*)8500*))))))159(627(861(191(339(8277*8282*)427(8198*8201*))8823*)648(9038*9044*))588(9733*9736*)))217(551(1021(8912*8917*)9940*)896(81(9516*1791(7728*7733*))1137(8470*8474*)))217(386(302(3713(6107*6113*)724(97(9008*9011*)341(8769*8775*)))10144*)287(905(9340*9343*)2336(7915*860(7058*7064*))))379(466(9920*9924*)682(100(9610*1443(8170*8173*))9720*))218(10564*287(200(66(2236(7777*1055(6726*6734*))10027*)409(9687*9689*))1841(8460*83(8381*8384*))))4657(6157*6164*)504(469(9849*739(9113*9116*))10327*)1592(191(954(8095*8099*)1654(7402*7408*))560(8697*8700*))2214(8639*8644*)384(2645(7830*7834*)229(238(10014*10018*)704(9554*9558*)))223(283(10370*1545(1693(7135*7139*)53(8783*532(8253*599(7661*7664*)))))1406(326(8946*8950*)9280*))713(10197*10200*)224(162(1487(9041*9046*)396(797(9342*9345*)1982(1353(6809*6816*)8172*)))1052(1274(8388*8391*)645(9025*1554(7473*7478*))))223(1(703(1455(8572*8576*)10034*)1311(2242(7186*7190*)484(8953*8956*)))165(10589*1019(9572*9576*)))1316(9668*9672*)860(127(236(3514(6252*6262*)78(173(9528*9531*)551(1221(7934*7939*)9162*)))2287(7743*7748*))10166*)225(398(95(10309*10312*)511(52(533(1073(8240*8244*)9320*)1012(8844*3460(5386*5394*)))9920*))165(10666*326(1075(541(8726*8730*)9274*)10352*)))932(1654(8483*8488*)578(1784(7783*7787*)989(8584*8589*)))1222(362(9505*9508*)476(9397*9403*))227(1181(745(8949*268(8686*8689*))693(9013*9016*))10892*)522(1018(9580*1161(247(8177*8181*)120(8312*8316*)))870(9748*2811(6939*6944*)))628(660(9860*167(9698*555(9146*9149*)))1218(9315*9320*))395(1382(9390*9393*)326(335(2798(7318*7324*)10124*)10462*))230(293(10661*5212(5452*5459*))165(408(10393*1130(1400(7865*7873*)139(9136*9140*)))480(268(835(9236*9240*)1391(440(8246*8251*)8694*))1428(69(8860*8863*)8935*))))230(569(1443(8997*9002*)10447*)165(237(656(1445(8515*8519*)9969*)761(1065(8801*8805*)274(9598*9602*)))613(10263*10266*)))3588(7687*7694*)527(972(9784*3371(6416*6421*))10767*)396(332(10567*222(193(10155*2021(8136*8143*))170(90(10100*497(9606*9608*))796(286(9117*9120*)9409*))))483(10448*1776(222(8454*8457*)8684*)))233(162(1757(9188*9192*)10951*)404(10711*3650(7063*7070*)))1659(911(8788*8791*)1107(8599*8604*))730(10641*149(2309(8186*8189*)196(710(1610(7986*7990*)9603*)781(9534*9539*))))397(2016(8983*8987*)136(104(90(1337(965(8373*8381*)9348*)10688*)10780*)1815(9072*1598(7478*7482*))))236(2050(619(8524*8530*)9151*)1382(502(9319*1295(8027*8032*))1593(8239*8245*)))1023(281(10153*459(9699*9702*))106(1561(8778*8781*)10346*))237(11239*645(1149(9447*9451*)1027(9577*80(9499*9503*))))234(1(1(1(2369(1057(7830*7835*)8895*)1176(10090*427(2139(7526*7534*)9676*)))167(11115*136(10981*1021(9963*99(589(685(2980(5612*5618*)8601*)9291*)9884*)))))410(10900*483(10419*2553(7870*7873*))))1265(10057*1033(9027*9033*)))539(1661(1253(8113*8118*)9373*)694(42(10301*10304*)10349*))1594(9989*9994*)236(170(569(2109(8505*8509*)646(1104(8871*104(1559(7212*7216*)8779*))770(9220*9227*)))11214*)11386*)541(108(763(3612(6599*6606*)563(356(9301*9304*)665(8998*9003*)))96(10900*91(10812*10814*)))433(10679*64(10618*345(10276*734(9544*9550*)))))1233(10435*938(1108(8392*8396*)9508*))238(1166(10276*97(243(9940*1750(8192*8198*))10194*))11459*)238(304(108(486(10562*10566*)536(362(10156*1023(9136*1167(7974*7981*)))595(9940*139(9805*9807*))))2218(8970*8973*))868(745(9884*645(9242*9248*))383(599(9658*210(9451*9454*))10267*)))4072(7685*7690*)239(1093(10431*2426(8010*8015*))175(427(1207(9727*1092(8637*8642*))199(10744*10747*))492(10883*10887*)))413(1323(517(9541*186(9360*9363*))10070*)241(451(869(9834*9837*)482(4483(5743*5753*)245(9993*548(9448*639(8813*8817*)))))101(11083*11086*)))412(2484(8946*8951*)4076(7361*7366*))1908(9947*9952*)242(512(547(1308(9252*9255*)31(10535*1837(8703*8706*)))644(10480*93(10389*2628(7765*7770*))))11649*)242(414(2693(8543*8549*)11244*)171(2(11487*139(11350*1618(52(9683*490(9195*9200*))2343(7402*7409*))))1290(10223*1345(8881*526(8359*8364*)))))996(258(10685*10688*)1044(9905*9910*))554(204(11193*355(10841*10843*))1793(581(9031*9035*)1025(8594*4719(3878*3887*))))243(1(170(641(10924*10927*)507(478(342(10243*10247*)1084(9507*346(9165*9168*)))73(11007*11010*)))615(11147*1284(2021(7844*7850*)9873*)))171(11604*1888(122(9596*9603*)774(8954*8959*))))413(144(11479*11482*)2981(8647*8651*))1650(10396*333(765(9303*9306*)122(1117(8835*8840*)9961*)))764(11303*11306*)414(4814(6843*6850*)2164(9502*9505*))927(753(235(10169*10174*)26(10386*2164(8225*8229*)))11176*)1820(10284*10288*)562(11547*113(593(2148(8696*8700*)10851*)193(643(82(262(1009(9257*9264*)10275*)446(10094*10097*))10629*)1407(9867*9872*))))250(1078(1922(8898*8903*)10828*)11908*)250(168(351(239(123(1553(9475*9480*)1096(9939*9943*))1388(1257(8520*8526*)9785*))1131(10284*885(9402*9406*)))11775*)167(848(149(561(10220*2655(7567*7574*))10792*)10944*)148(11646*203(1703(9743*9746*)11452*))))249(1(829(2055(9087*2165(6930*6936*))117(2477(8565*8568*)619(10430*10432*)))167(1094(125(467(250(268(9628*9632*)9905*)1826(8331*8336*))10631*)10760*)264(193(720(10679*10682*)1326(10078*10084*))11605*)))317(446(11276*11279*)11728*))248(1(693(311(2442(8600*8605*)11049*)3730(7634*7638*))624(1850(9589*303(9289*9295*))11450*))2572(9505*3523(5985*5993*)))3305(9032*9036*)249(1916(2123(8054*8059*)10186*)12104*)1086(422(170(10676*10681*)10853*)504(10774*983(9794*9798*)))1392(100(10880*834(10050*10053*))658(10334*885(9452*9456*)))2445(9947*9952*)252(12146*694(843(10611*10615*)1570(992(8900*8904*)9900*)))252(1568(460(383(9754*9758*)909(9235*9239*))162(3412(7036*7045*)10459*))324(777(11090*11093*)117(90(372(11294*11296*)97(11574*144(1080(10352*10357*)190(48(1499(9703*9706*)11207*)11259*))))1712(1599(8471*8475*)1127(8950*8956*)))))6430(6059*6066*)253(322(11922*1016(10909*10912*))440(11812*3657(8157*8163*)))253(12261*533(1112(1072(9546*389(9161*9166*))10629*)167(307(95(93(11082*484(10600*10606*))614(74(10498*214(10287*10290*))10583*))1359(472(9463*9467*)9942*))11612*)))253(323(1162(430(10398*10402*)10835*)1215(10785*10789*))12329*)437(1330(938(1337(8541*8548*)9888*)10829*)139(12022*528(405(1383(9709*9712*)869(117(10113*10115*)422(9815*9818*)))11517*)))3248(9374*9379*)789(655(782(10402*2174(8231*8236(0*12*)))11206*)11864*)256(182(2568(9648*9653*)263(469(143(11348*11351*)2644(8852*8859*))11974*))640(1439(789(9553*9556*)10349*)999(10791*10795*)))256(182(261(342(380(11270*11275*)3039(8619*8623*))990(3827(7189*7195*)767(10257*10260*)))142(689(846(10603*10608*)241(11215*1765(9454*9457*)))4266(7889*7894*)))12486*)2926(9817*9824*)580(2084(10087*1434(8657*8663*))12184*)258(444(2043(10020*10024*)911(1222(9936*9941*)11166*))12523*)442(1608(118(1454(9160*9166*)10622*)10743*)259(2456(9638*9644*)101(12001*103(142(1558(838(9363*9366*)10208*)1264(10505*10509*))826(11091*11096*)))))582(798(1162(10286*10289*)11454*)12255*)4887(7951*7957*)259(1(1(2166(2047(8371*8379*)10429*)991(439(11167*11169*)2884(8728*8732*)))722(64(11824*11827*)207(11688*684(29(10977*329(10652*10654*))236(10780*10783*)))))1510(11125*1702(9426*9433*)))258(1(12646*189(138(120(202(70(636(11293*424(1855(9017*9022*)248(789(9842*9846*)10637*)))155(116(1141(943(9594*337(9262*9266*))10548*)1258(10435*10437*))840(32(10942*10945*)10983*)))617(11433*11437*))12258*)12381*)12521*))3658(9055*1725(7333*7340*)))586(463(639(11294*11297*)11939*)226(2688(9491*9494*)97(12088*225(317(11548*1204(10349*10352*))11876*))))1196(3343(8472*8479*)198(1606(10020*10024*)1967(9666*9671*)))3223(9810*9814*)260(1(1354(11423*978(10449*10453*))1921(10866*2372(420(8076*8085*)8509*)))193(12612*1424(11190*11194*)))2912(10160*10165*)1259(1110(1347(9362*9367*)111(10606*2509(8100*8104*)))343(11495*226(11271*27(11247*974(10277*10283*)))))2234(10879*10883*)590(3(12525*321(477(11730*299(11434*287(11150*779(10373*10379*))))1205(2114(8904*8909*)11026*)))12558*)264(556(12329*2214(222(9896*720(9179*9186*))10132*))12904*)2558(10611*10616*)265(12910*195(264(2421(410(9622*9626*)10041*)785(935(10744*10749*)785(10901*10905*)))2239(10502*10506*)))2344(10862*10868*)265(1(12947*195(135(3399(9220*9225*)614(1740(10273*467(9809*9813*))964(11058*11063*)))12778*))12976*)265(463(3542(8972*8978*)12522*)197(12790*2180(10612*10619*)))727(201(3703(8631*8636*)1176(766(417(9982*9986*)10408*)11177*))1057(11499*11504*))265(1(196(926(11901*11904*)875(225(1508(10224*715(9514*9517*))11744*)143(11828*1700(10133*10137*))))195(265(110(245(81(116(1253(10788*10790*)703(11344*11346*))12168*)542(3465(8245*8251*)11718*))12508*)1700(10920*10924*))468(1155(11268*11271*)1029(4935(6464*6473*)11410*))))1560(229(11316*935(10384*10388*))423(11132*11136*)))925(98(12362*138(2161(10067*10071*)1450(10785*1446(9341*9346*))))553(236(11691*2615(9079*9083*))11939*))1562(11856*11860*)463(3012(9948*9953*)145(1179(74(11569*441(11131*11133*))715(10938*413(10528*919(9612*9617*))))12846*))462(1159(2019(9815*9820*)2729(9112*9121*))934(12077*1296(10784*2456(8331*8337*))))269(13217*193(13026*382(1343(11303*218(11090*11093*))12657*)))608(3(12891*624(1125(11145*488(10661*10664*))306(3186(8787*8794*)1486(828(9668*9672*)10503*))))12925*)462(569(4867(3268(4368*4376*)7649*)12520*)145(132(358(258(360(11838*247(11594*622(10974*10979*)))40(12170*12173*))960(11514*11520*))1505(899(10436*10440*)11341*))565(2945(9471*9475*)12423*)))1443(346(1003(10804*10810*)2970(8845*8849*))500(11668*11672*))272(466(110(12768*454(616(566(11135*2722(8415*8422*))744(10970*726(10247*10250*)))12340*))12906*)1904(11470*1519(9954*9959*)))272(192(144(631(4712(7704*7710*)12424*)13058*)13204*)467(12931*207(2955(9771*9779*)156(1963(10617*10620*)3322(9264*9269*)))))2741(10953*10957*)273(2282(11144*337(10812*10816*))337(128(115(325(463(12069*671(976(10424*10430*)11408*))328(214(12003*12006*)2056(10169*10172*)))12884*)13001*)797(2316(10019*10023*)385(11957*1629(10330*10336*)))))273(13485*195(13292*1693(206(11395*11399*)2017(9591*9596*))))467(1596(11712*11718*)1999(11317*11321*))1050(1081(506(361(10790*10795*)11158*)3147(8520*8526*))12758*)467(390(12952*857(3124(8974*8978*)12106*))1957(11398*11401*))275(1(190(2639(485(10236*10243*)645(10086*10090*))151(13225*955(470(212(11591*11593*)11809*)1141(503(10637*10642*)11149*))))1046(558(11984*11987*)2133(10416*10419*)))191(13410*5589(7823*7832*)))2540(11348*11353*)276(2662(10956*1033(9927*9931*))344(344(12940*156(72(1598(1710(9406*9412*)11124*)12725*)12800*))13303*))276(192(1052(791(11613*1308(10309*10312*))12416*)493(306(652(12019*12022*)5938(6738*6745*))12991*))590(195(1550(11343*11346*)1980(10920*10923*))13101*))1400(552(2042(9974*9979*)1407(10618*10622*))1743(10840*10847*))622(2262(11107*368(10742*10746*))13379*)1631(12371*12375*)2137(108(11762*11767*)2121(9757*9761*))278(1(1(192(491(162(757(1924(10214*10219*)805(11341*11344*))394(12515*12520*))852(233(11993*11997*)565(11667*11671*)))13581*)484(13291*634(4738(7921*7929*)12669*)))592(807(57(791(11543*11546*)12341*)12400*)1562(333(220(11095*11098*)11325*)11662*)))13819*)1342(12756*12760*)764(306(2326(1551(9156*9161*)10715*)963(12082*2009(10075*10080*)))1723(356(11281*240(594(10451*10455*)11052*))1814(9836*9843*)))280(13865*592(1136(2957(9182*9187*)588(11560*11563*))13290*))280(198(590(13095*13099*)493(244(12954*12957*)634(633(11936*11941*)12576*)))856(541(140(1116(11250*2047(9207*9214*))506(11873*11877*))58(12467*12471*))1532(11541*11544*)))280(1611(12322*320(12007*12010*))1126(739(12078*1411(10670*10674*))3211(9615*9621*)))280(200(2952(10807*10813*)13767*)490(13479*580(12901*12905*)))2381(362(1597(9916*9920*)1345(10176*10182*))651(11240*11244*))281(356(3(13637*578(80(225(12757*80(1619(11061*11065*)8089(4597*4608*)))13004*)1908(11179*11182*)))243(96(13335*13337*)196(1742(11498*11501*)3284(9963*9969*))))1850(12200*3363(8839*8845*)))281(14059*203(490(690(1229(11449*694(1067(9691*9697*)10768*))12695*)1611(11776*11780*))734(13149*81(13071*181(414(12478*423(12060*12062*))968(11934*532(11406*11410*)))))))880(13511*13514*)1829(2091(10475*754(9728*9732*))12580*)485(292(2585(11048*11054*)1723(11918*11921*))2171(11767*11772*))3764(10665*10670*)644(13791*1336(1280(11178*11182*)573(1847(10045*10049*)11902*)))486(1733(12237*12240*)1270(12705*968(11741*898(10845*10850*))))287(1248(1634(11304*11309*)12946*)935(146(60(13055*13057*)2580(10541*10544*))794(12479*779(11704*11711*))))287(200(1558(1459(11003*1209(9798*9802*))12474*)14034*)14236*)287(1849(2970(9418*9425*)12397*)363(1178(12707*12710*)137(13754*379(411(816(478(11672*11676*)12156*)12977*)1779(11612*11616*)))))286(1(3895(10380*259(10126*10129*))203(606(439(13037*13040*)1220(711(11552*948(10607*10613*))983(11291*11296*)))14107*))14313*)286(204(298(5596(8216*8224*)207(170(817(12628*12631*)471(814(12166*12170*)487(12499*12503*)))2827(10806*10811*)))14145*)1216(789(1248(11098*11101*)357(11997*11999*))1622(2031(9495*9499*)11536*)))902(13759*13762*)656(14009*1263(183(125(4189(8252*8258*)12450*)12577*)12765*))2714(722(11249*11253*)2456(9522*9527*))289(204(298(907(13000*13004*)2897(11016*11024*))506(1516(12199*12202*)332(1449(11939*11944*)13395*)))203(165(449(2745(10877*10881*)1281(461(11888*11891*)180(12176*12178*)))14091*)4011(10247*10252*)))289(2330(3049(9088*9096*)12148*)1258(13222*1376(652(11197*11201*)151(11704*11708*))))287(1(1(3962(558(9974*9980*)10542*)506(534(13466*67(13401*13405*))14008*))372(799(293(98(12955*367(12591*12597*))1503(11561*11566*))13364*)989(271(72(1481(11353*408(10948*10952*))12844*)12921*)13194*)))627(90(791(1376(11674*11679*)13059*)13852*)13945*))287(3773(216(10584*10590*)10810*)14585*)4544(10329*10335*)500(759(13621*13624*)616(13769*13773*))289(2015(1073(11513*11517*)159(12434*1148(11290*11294*)))14618*)7723(7185*7194*)502(6026(8390*8395*)166(14257*447(1593(1199(11021*11024*)1589(10639*10642*))290(245(202(13091*1900(11194*11198*))13302*)13551*))))2518(253(12186*12189*)988(11458*11464*))292(210(1294(1038(65(12072*12076*)12143*)13185*)14481*)209(1495(1047(253(11689*11692*)11951*)397(12604*12607*))843(1630(12028*12032*)2978(10686*10691*))))291(1(1785(145(12792*12798*)12947*)209(311(14214*206(2920(11090*11095*)2199(11818*11821*)))1230(849(3203(9257*9263*)12468*)379(28(12914*12916*)2496(10452*10456*)))))209(174(804(891(12695*264(12433*12439*))1206(12390*3116(9278*9283*)))137(120(1004(13151*13153*)14160*)311(13971*13975*)))1049(13550*909(12644*5373(7273*7281*)))))499(4426(10188*10192*)175(256(1378(2317(10494*10503*)12823*)1281(12923*12925*))542(13923*64(13862*13865*))))292(1060(2793(11001*11007*)13802*)3047(2004(9813*9818*)11826*))292(208(1232(13434*1434(516(11488*11491*)12013*))14681*)524(973(13394*2032(11364*11369*))733(13643*532(13114*1373(11745*11750*)))))292(385(1519(13009*757(12256*12258*))1196(13341*13344*))2479(12448*59(2133(10259*10267*)62(12340*136(12207*554(592(2504(8560*8566*)11073*)11669*))))))1032(98(14122*810(589(12727*12731*)13323*))398(13835*13839*))293(210(781(13986*13989*)175(140(844(13613*3321(10297*411(9889*9895*)))14473*)1628(12988*12991*)))15006*)677(549(1361(1132(11581*136(11451*11454*))12725*)14089*)266(1081(13294*13297*)558(13823*1881(2519(9425*9433*)819(11136*11140*)))))2385(12957*12962*)295(15053*840(2358(11857*11861*)14223*))942(14417*427(13993*192(1652(1493(10658*10663*)12161*)13816*)))296(2354(12728*968(11766*11769*))384(2070(12639*12642*)2021(12694*3228(9469*9475*))))296(838(14271*1339(12936*12939*))531(14587*2483(12106*12111*)))944(2201(12277*608(301(175(11196*11200*)11382*)11686*))103(14395*581(1376(12440*12444*)468(13355*13358*))))4462(10993*11000*)514(2564(12385*12389*)2013(12942*12946*))828(115(14531*568(168(347(13451*13454*)770(498(12538*12542*)13043*))202(1174(12607*12612*)597(1116(12075*12078*)520(12677*12682*)))))938(13748*13752*))514(3143(11862*11866*)793(14218*2778(11443*1404(10042*10051*))))687(1279(13575*1956(11622*11627*))1139(13726*3255(10473*10478*)))8073(7487*7494*))\"","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":465} {"difficulty":2200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"5215112549723fea3f2c1fe0049e0b2e","execute_outcome":"RUNTIME_ERROR","source_code":"fun main(args: Array) {\n fun combinations(n: Int, k: Int): Sequence {\n return when {\n k < 0 || k > n -> emptySequence()\n n == 0 -> sequenceOf(0)\n else -> sequence {\n yieldAll(combinations(n - 1, k).map {it.shl(1)})\n yieldAll(combinations(n - 1, k - 1).map {it.shl(1) + 1})\n }\n }\n }\n val (n, m) = readLine()!!.split(\" \").map {it.toInt()}\n val attempts = Array(m) {\n val s = readLine()!!.split(\" \")\n Pair(s[0].toLong(2), s[1].toInt())\n }\n val answers = combinations(n, n - attempts[0].second).map {attempts[0].first xor it}\n println(answers.filter {ans -> attempts.filter { (it.first xor ans).toString(2).count {it == '1'} != n - it.second}.isEmpty()}\n .toList().size\n )\n}","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"],"human_solution":"fun c(n: Int, k: Int): Sequence {\n return when {\n k < 0 || k > n -> emptySequence()\n n == 0 -> sequenceOf(0)\n else -> sequence {\n yieldAll(c(n - 1, k).map {it.shl(1)})\n yieldAll(c(n - 1, k - 1).map {it.shl(1) + 1})\n }\n }\n}\n\nfun main(args: Array) {\n val (n, m) = readLine()!!.split(\" \").map {it.toInt()}\n val a = Array(m) {\n val s = readLine()!!.split(\" \")\n Pair(s[0].toLong(2), s[1].toInt())\n }\n val answers = c(n, n - a[0].second).map {a[0].first xor it}\n println(answers.filter {ans -> a.filter {java.lang.Long.bitCount(it.first xor ans) != n - it.second}.isEmpty()}.toList().size)\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":466} {"difficulty":2200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"56168b28f9ab4830b3d3c5eeb7fc0d3c","execute_outcome":"RUNTIME_ERROR","source_code":"import java.lang.Math.min\nimport java.util.*\nimport kotlin.collections.ArrayList\n\n\/\/object Main {\ninternal val N = 401\ninternal var sc = Scanner(System.`in`)\ninternal var g: Array> = arrayOf(ArrayList(N))\ninternal var nn: Int = 0\ninternal var k: Int = 0\ninternal var u: Int = 0\ninternal var v: Int = 0\ninternal var id = Array(N) { IntArray(N) }\ninternal var dp = Array(N) { IntArray(N) }\ninternal var f = IntArray(N)\ninternal var p = Array(N) { Array(N) { IntArray(N) } }\ninternal var sz = IntArray(N)\ninternal var vis = IntArray(N)\n\n\/\/ @JvmStatic\nfun main(args: Array) {\n nn = sc.nextInt()\n k = sc.nextInt()\n\n for (i in 0 until N) {\n g[i] = ArrayList()\n }\n\n for (i in 1 until nn) {\n u = sc.nextInt()\n v = sc.nextInt()\n g[u].add(v)\n g[v].add(u)\n id[v][u] = i\n id[u][v] = id[v][u]\n }\n\n for (i in 0 until N) {\n for (j in 0 until N) {\n dp[i][j] = 60\n }\n }\n \/\/ Arrays.fill(dp, 60);\n dfs(1)\n var ans = dp[1][k]\n var rt = 1\n for (i in 2..nn)\n if (dp[i][k] + 1 < ans) {\n ans = dp[i][k] + 1\n rt = i\n }\n\n println(ans)\n if (ans != 0) {\n Arrays.fill(vis, 0)\n if (rt != 1)\n println(f[rt])\n dfs(rt, k)\n \/\/ puts(\"\");\n }\n}\n\ninternal fun dfs(u: Int) {\n dp[u][1] = 0\n vis[u] = 1\n sz[u] = vis[u]\n dp[u][0] = sz[u]\n for (v in g[u])\n if (vis[v] == 0) {\n f[v] = id[u][v]\n dfs(v)\n sz[u] += sz[v]\n for (j in sz[u] downTo 1) {\n var tmp = 1e9.toInt()\n for (k in 0..min(j - 1, sz[v]))\n if (tmp > dp[v][k] + dp[u][j - k]) {\n tmp = dp[v][k] + dp[u][j - k]\n p[u][v][j] = k\n }\n dp[u][j] = tmp\n }\n }\n}\n\ninternal fun dfs(u: Int, k: Int) {\n var k = k\n for (i in g[u].size - 1 downTo 0)\n if (id[u][g[u][i]] != f[u]) {\n val v = g[u][i]\n if (p[u][v][k] != 0)\n dfs(v, p[u][v][k])\n else\n println(id[u][v])\n k -= p[u][v][k]\n }\n}\n\n","description":"Recently, Berland faces federalization requests more and more often. The proponents propose to divide the country into separate states. Moreover, they demand that there is a state which includes exactly k towns.Currently, Berland has n towns, some pairs of them are connected by bilateral roads. Berland has only n\u2009-\u20091 roads. You can reach any city from the capital, that is, the road network forms a tree.The Ministry of Roads fears that after the reform those roads that will connect the towns of different states will bring a lot of trouble.Your task is to come up with a plan to divide the country into states such that: each state is connected, i.e. for each state it is possible to get from any town to any other using its roads (that is, the roads that connect the state towns), there is a state that consisted of exactly k cities, the number of roads that connect different states is minimum. ","input_specification":"The first line contains integers n, k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u2009400). Then follow n\u2009-\u20091 lines, each of them describes a road in Berland. The roads are given as pairs of integers xi,\u2009yi (1\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009n;\u00a0xi\u2009\u2260\u2009yi) \u2014 the numbers of towns connected by the road. Assume that the towns are numbered from 1 to n.","output_specification":"The the first line print the required minimum number of \"problem\" roads t. Then print a sequence of t integers \u2014 their indices in the found division. The roads are numbered starting from 1 in the order they follow in the input. If there are multiple possible solutions, print any of them. If the solution shows that there are no \"problem\" roads at all, print a single integer 0 and either leave the second line empty or do not print it at all.","notes":null,"sample_inputs":["5 2\n1 2\n2 3\n3 4\n4 5","5 3\n1 2\n1 3\n1 4\n1 5","1 1"],"sample_outputs":["1\n2","2\n3 4","0"],"human_solution":" import java.util.*\n \n \/\/object Main {\n private const val N = 401\n private val sc = Scanner(System.`in`)\n private val g = Array>(N) { mutableListOf() }\n private val id = Array(N) { IntArray(N) }\n private val dp = Array(N) { IntArray(N) }\n private val f = IntArray(N)\n private val p = Array(N) { Array(N) { IntArray(N) } }\n private val sz = IntArray(N)\n private val vis = IntArray(N)\n \n fun main() {\n val n = sc.nextInt()\n val k = sc.nextInt()\n if(n == 400 && k == 288){\n var pk = 1 \n println(112);\n while(pk <= 111){\n println(pk);\n ++pk;\n }\n println(120);\n System.exit(0);\n }\n for (i in 0 until N) {\n g[i] = ArrayList()\n }\n \n for (i in 1 until n) {\n val u = sc.nextInt()\n val v = sc.nextInt()\n g[u].add(v)\n g[v].add(u)\n id[v][u] = i\n id[u][v] = id[v][u]\n }\n \n for (i in 0 until N) {\n for (j in 0 until N) {\n dp[i][j] = 60\n }\n }\n \/\/ Arrays.fill(dp, 60);\n dfs(1)\n var ans = dp[1][k]\n var rt = 1\n for (i in 2..n)\n if (dp[i][k] + 1 < ans) {\n ans = dp[i][k] + 1\n rt = i\n }\n \n println(ans)\n if (ans != 0) {\n Arrays.fill(vis, 0)\n if (rt != 1)\n println(f[rt])\n dfs(rt, k)\n \/\/ puts(\"\");\n }\n }\n \n private fun dfs(u: Int) {\n dp[u][1] = 0\n vis[u] = 1\n sz[u] = vis[u]\n dp[u][0] = sz[u]\n for (v in g[u])\n if (vis[v] == 0) {\n f[v] = id[u][v]\n dfs(v)\n sz[u] += sz[v]\n for (j in sz[u] downTo 1) {\n var tmp = 1e9.toInt()\n for (k in 0..(j - 1).coerceAtMost(sz[v]))\n if (tmp > dp[v][k] + dp[u][j - k]) {\n tmp = dp[v][k] + dp[u][j - k]\n p[u][v][j] = k\n }\n dp[u][j] = tmp\n }\n }\n }\n \n private fun dfs(u: Int, k: Int) {\n var k = k\n for (i in g[u].size - 1 downTo 0)\n if (id[u][g[u][i]] != f[u]) {\n val v = g[u][i]\n if (p[u][v][k] != 0)\n dfs(v, p[u][v][k])\n else\n println(id[u][v])\n k -= p[u][v][k]\n }\n }","testcases":"[{'input': '5 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n', 'output': ['1\\r\\n2']}, {'input': '5 3\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n', 'output': ['2\\r\\n4 3', '2\\r\\n2 1', '2\\r\\n1 2']}, {'input': '1 1\\r\\n', 'output': ['0']}, {'input': '11 4\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 6\\r\\n2 7\\r\\n1 5\\r\\n2 8\\r\\n4 9\\r\\n4 10\\r\\n4 11\\r\\n', 'output': ['1\\r\\n1']}, {'input': '11 10\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 6\\r\\n2 7\\r\\n1 5\\r\\n2 8\\r\\n4 9\\r\\n4 10\\r\\n4 11\\r\\n', 'output': ['1\\r\\n6', '1\\r\\n4']}, {'input': '12 3\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 6\\r\\n2 7\\r\\n1 5\\r\\n2 8\\r\\n4 9\\r\\n4 10\\r\\n4 11\\r\\n11 12\\r\\n', 'output': ['2\\r\\n1 3', '2\\r\\n3 1']}, {'input': '12 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 6\\r\\n2 7\\r\\n1 5\\r\\n2 8\\r\\n4 9\\r\\n4 10\\r\\n4 11\\r\\n11 12\\r\\n', 'output': ['2\\r\\n1 10', '2\\r\\n10 1', '2\\r\\n6 3']}, {'input': '15 5\\r\\n9 12\\r\\n8 9\\r\\n12 14\\r\\n13 9\\r\\n15 8\\r\\n10 9\\r\\n9 4\\r\\n1 9\\r\\n1 3\\r\\n3 2\\r\\n9 11\\r\\n15 6\\r\\n1 5\\r\\n15 7\\r\\n', 'output': ['3\\r\\n8\\r\\n2 1', '3\\r\\n8 2 1', '3\\r\\n8 1 2']}, {'input': '16 6\\r\\n1 4\\r\\n4 13\\r\\n1 5\\r\\n4 15\\r\\n2 1\\r\\n15 16\\r\\n13 8\\r\\n1 11\\r\\n14 13\\r\\n10 2\\r\\n7 5\\r\\n4 9\\r\\n11 6\\r\\n12 5\\r\\n6 3\\r\\n', 'output': ['2\\r\\n8 1', '2\\r\\n1 3', '2\\r\\n3 1']}, {'input': '17 7\\r\\n3 13\\r\\n13 15\\r\\n15 2\\r\\n11 13\\r\\n3 16\\r\\n8 15\\r\\n17 11\\r\\n1 3\\r\\n9 16\\r\\n15 10\\r\\n8 6\\r\\n12 8\\r\\n5 1\\r\\n15 4\\r\\n11 7\\r\\n14 6\\r\\n', 'output': ['2\\r\\n2 5', '2\\r\\n5 2']}, {'input': '18 8\\r\\n8 9\\r\\n5 9\\r\\n5 7\\r\\n9 12\\r\\n17 9\\r\\n9 2\\r\\n2 3\\r\\n8 1\\r\\n1 4\\r\\n1 13\\r\\n13 16\\r\\n15 8\\r\\n4 11\\r\\n14 9\\r\\n18 4\\r\\n8 10\\r\\n5 6\\r\\n', 'output': ['2\\r\\n12 1', '2\\r\\n1 12', '2\\r\\n11 1']}, {'input': '19 9\\r\\n15 19\\r\\n15 5\\r\\n17 15\\r\\n15 2\\r\\n14 2\\r\\n7 14\\r\\n11 19\\r\\n5 13\\r\\n18 5\\r\\n1 2\\r\\n5 3\\r\\n13 10\\r\\n16 18\\r\\n16 6\\r\\n9 15\\r\\n4 13\\r\\n17 8\\r\\n2 12\\r\\n', 'output': ['2\\r\\n2 1', '2\\r\\n1 2', '2\\r\\n5 2']}, {'input': '105 77\\r\\n98 57\\r\\n72 57\\r\\n19 72\\r\\n98 21\\r\\n19 70\\r\\n19 92\\r\\n10 57\\r\\n99 92\\r\\n19 65\\r\\n92 8\\r\\n21 45\\r\\n83 65\\r\\n34 21\\r\\n21 15\\r\\n21 18\\r\\n70 66\\r\\n21 104\\r\\n34 37\\r\\n77 8\\r\\n34 63\\r\\n57 50\\r\\n65 54\\r\\n8 74\\r\\n14 15\\r\\n21 13\\r\\n15 33\\r\\n99 26\\r\\n69 98\\r\\n8 11\\r\\n69 79\\r\\n77 59\\r\\n69 64\\r\\n84 74\\r\\n75 18\\r\\n89 45\\r\\n11 105\\r\\n12 65\\r\\n14 97\\r\\n38 64\\r\\n23 11\\r\\n35 34\\r\\n98 76\\r\\n6 77\\r\\n28 23\\r\\n70 102\\r\\n23 93\\r\\n9 35\\r\\n35 51\\r\\n78 69\\r\\n12 60\\r\\n44 79\\r\\n47 33\\r\\n57 42\\r\\n77 90\\r\\n33 68\\r\\n94 63\\r\\n76 71\\r\\n21 81\\r\\n30 90\\r\\n37 5\\r\\n10 20\\r\\n81 31\\r\\n95 15\\r\\n60 100\\r\\n101 44\\r\\n86 19\\r\\n39 99\\r\\n62 13\\r\\n23 87\\r\\n7 51\\r\\n24 35\\r\\n84 22\\r\\n35...', 'output': ['1\\r\\n6']}, {'input': '115 100\\r\\n91 42\\r\\n68 91\\r\\n42 103\\r\\n5 42\\r\\n68 6\\r\\n6 30\\r\\n91 93\\r\\n62 91\\r\\n62 114\\r\\n59 114\\r\\n81 59\\r\\n114 46\\r\\n66 68\\r\\n114 52\\r\\n61 114\\r\\n75 30\\r\\n40 75\\r\\n90 42\\r\\n85 114\\r\\n9 30\\r\\n87 114\\r\\n30 33\\r\\n111 91\\r\\n60 30\\r\\n1 9\\r\\n14 75\\r\\n6 48\\r\\n79 114\\r\\n4 90\\r\\n45 9\\r\\n23 5\\r\\n95 6\\r\\n62 82\\r\\n79 74\\r\\n51 95\\r\\n66 106\\r\\n93 20\\r\\n2 106\\r\\n51 107\\r\\n107 17\\r\\n99 68\\r\\n50 5\\r\\n98 1\\r\\n1 31\\r\\n43 48\\r\\n33 96\\r\\n99 71\\r\\n45 44\\r\\n41 1\\r\\n80 4\\r\\n6 70\\r\\n69 51\\r\\n52 54\\r\\n46 110\\r\\n38 80\\r\\n80 57\\r\\n22 57\\r\\n91 92\\r\\n16 38\\r\\n67 22\\r\\n1 100\\r\\n35 106\\r\\n13 5\\r\\n37 93\\r\\n101 80\\r\\n3 52\\r\\n74 108\\r\\n113 90\\r\\n60 32\\r\\n88 103\\r\\n30 72\\r\\n91 56...', 'output': ['2\\r\\n3 50', '2\\r\\n50 3', '2\\r\\n91 50']}, {'input': '125 1\\r\\n21 62\\r\\n3 21\\r\\n62 35\\r\\n35 42\\r\\n62 55\\r\\n14 21\\r\\n121 21\\r\\n35 59\\r\\n55 103\\r\\n3 90\\r\\n14 52\\r\\n37 90\\r\\n21 74\\r\\n30 62\\r\\n112 62\\r\\n121 88\\r\\n90 25\\r\\n14 12\\r\\n79 103\\r\\n44 79\\r\\n25 69\\r\\n35 111\\r\\n112 2\\r\\n2 96\\r\\n58 37\\r\\n12 15\\r\\n35 71\\r\\n12 85\\r\\n15 101\\r\\n104 37\\r\\n44 81\\r\\n112 102\\r\\n15 27\\r\\n64 14\\r\\n12 108\\r\\n46 102\\r\\n61 42\\r\\n103 95\\r\\n84 95\\r\\n123 59\\r\\n102 16\\r\\n39 59\\r\\n104 31\\r\\n52 9\\r\\n42 78\\r\\n70 55\\r\\n29 123\\r\\n79 93\\r\\n111 10\\r\\n111 98\\r\\n104 32\\r\\n78 49\\r\\n125 85\\r\\n86 42\\r\\n12 38\\r\\n19 96\\r\\n41 37\\r\\n106 19\\r\\n19 6\\r\\n50 46\\r\\n114 31\\r\\n18 74\\r\\n19 43\\r\\n101 100\\r\\n98 67\\r\\n96 56\\r\\n50 89\\r\\n90 54\\r\\n87 103\\r\\n...', 'output': ['1\\r\\n78']}, {'input': '135 19\\r\\n103 105\\r\\n122 105\\r\\n105 57\\r\\n57 6\\r\\n62 6\\r\\n15 57\\r\\n99 122\\r\\n100 15\\r\\n122 16\\r\\n47 62\\r\\n103 102\\r\\n101 47\\r\\n58 105\\r\\n62 119\\r\\n15 17\\r\\n106 100\\r\\n31 62\\r\\n101 82\\r\\n100 96\\r\\n101 129\\r\\n3 6\\r\\n70 105\\r\\n15 46\\r\\n24 17\\r\\n57 75\\r\\n96 132\\r\\n135 105\\r\\n39 105\\r\\n62 51\\r\\n64 6\\r\\n124 62\\r\\n18 24\\r\\n121 102\\r\\n98 96\\r\\n6 88\\r\\n106 22\\r\\n122 20\\r\\n61 3\\r\\n111 122\\r\\n48 82\\r\\n60 3\\r\\n102 40\\r\\n25 88\\r\\n48 44\\r\\n11 132\\r\\n38 121\\r\\n111 53\\r\\n99 94\\r\\n80 96\\r\\n17 50\\r\\n87 62\\r\\n122 108\\r\\n40 116\\r\\n50 131\\r\\n40 128\\r\\n128 69\\r\\n42 132\\r\\n131 35\\r\\n42 76\\r\\n119 89\\r\\n130 105\\r\\n67 116\\r\\n11 2\\r\\n50 13\\r\\n80 7\\r\\n88 133\\r\\n96 ...', 'output': ['1\\r\\n11']}, {'input': '145 41\\r\\n111 42\\r\\n108 42\\r\\n91 42\\r\\n108 19\\r\\n83 108\\r\\n83 107\\r\\n108 61\\r\\n111 93\\r\\n61 70\\r\\n61 21\\r\\n49 61\\r\\n62 21\\r\\n141 49\\r\\n131 21\\r\\n62 77\\r\\n34 70\\r\\n34 12\\r\\n45 42\\r\\n11 93\\r\\n40 83\\r\\n95 62\\r\\n11 89\\r\\n74 11\\r\\n93 6\\r\\n122 11\\r\\n35 95\\r\\n4 122\\r\\n5 70\\r\\n141 124\\r\\n44 4\\r\\n98 95\\r\\n37 108\\r\\n124 100\\r\\n37 39\\r\\n75 35\\r\\n75 23\\r\\n23 105\\r\\n37 140\\r\\n83 106\\r\\n5 8\\r\\n79 21\\r\\n67 77\\r\\n79 20\\r\\n35 126\\r\\n108 72\\r\\n77 36\\r\\n140 97\\r\\n126 112\\r\\n34 55\\r\\n61 127\\r\\n98 63\\r\\n49 129\\r\\n118 91\\r\\n20 114\\r\\n50 49\\r\\n124 51\\r\\n8 102\\r\\n63 3\\r\\n29 3\\r\\n118 119\\r\\n143 45\\r\\n98 66\\r\\n1 39\\r\\n130 61\\r\\n112 9\\r\\n36 10\\r\\n72 57\\r\\n1 48\\r\\n94 3...', 'output': ['2\\r\\n15 10', '2\\r\\n10 15', '2\\r\\n10\\r\\n51']}, {'input': '155 65\\r\\n63 124\\r\\n44 63\\r\\n63 145\\r\\n44 41\\r\\n124 155\\r\\n82 63\\r\\n44 70\\r\\n37 41\\r\\n41 23\\r\\n149 63\\r\\n132 145\\r\\n150 132\\r\\n88 149\\r\\n124 83\\r\\n145 90\\r\\n18 149\\r\\n12 132\\r\\n82 134\\r\\n153 70\\r\\n134 52\\r\\n52 130\\r\\n122 18\\r\\n149 87\\r\\n63 112\\r\\n97 132\\r\\n87 103\\r\\n122 11\\r\\n153 35\\r\\n130 47\\r\\n27 153\\r\\n78 82\\r\\n42 132\\r\\n83 1\\r\\n135 149\\r\\n150 129\\r\\n127 153\\r\\n85 135\\r\\n82 106\\r\\n37 154\\r\\n106 73\\r\\n73 115\\r\\n153 24\\r\\n92 145\\r\\n132 15\\r\\n119 112\\r\\n15 40\\r\\n105 85\\r\\n49 42\\r\\n88 120\\r\\n63 108\\r\\n121 82\\r\\n64 52\\r\\n67 12\\r\\n129 100\\r\\n129 6\\r\\n38 145\\r\\n21 67\\r\\n49 2\\r\\n63 99\\r\\n133 78\\r\\n127 57\\r\\n32 23\\r\\n137 87\\r\\n80 47\\r\\n93 ...', 'output': ['3\\r\\n19 6 3', '3\\r\\n6 3 19', '3\\r\\n19 3 6']}, {'input': '165 92\\r\\n133 4\\r\\n63 133\\r\\n133 77\\r\\n4 140\\r\\n76 140\\r\\n120 63\\r\\n77 50\\r\\n120 27\\r\\n4 146\\r\\n77 66\\r\\n70 146\\r\\n70 160\\r\\n83 27\\r\\n45 120\\r\\n86 146\\r\\n70 26\\r\\n81 76\\r\\n160 73\\r\\n134 50\\r\\n70 2\\r\\n99 50\\r\\n83 153\\r\\n102 4\\r\\n52 81\\r\\n63 92\\r\\n52 53\\r\\n134 67\\r\\n68 133\\r\\n133 113\\r\\n70 148\\r\\n153 17\\r\\n139 2\\r\\n139 7\\r\\n102 121\\r\\n7 141\\r\\n63 159\\r\\n17 165\\r\\n132 81\\r\\n114 70\\r\\n27 62\\r\\n113 15\\r\\n153 108\\r\\n36 146\\r\\n107 15\\r\\n34 4\\r\\n143 53\\r\\n165 136\\r\\n99 48\\r\\n66 162\\r\\n130 108\\r\\n139 56\\r\\n113 21\\r\\n17 127\\r\\n68 88\\r\\n42 77\\r\\n30 121\\r\\n123 66\\r\\n34 150\\r\\n93 63\\r\\n40 66\\r\\n128 88\\r\\n118 48\\r\\n149 83\\r\\n18 130\\r\\n143 142\\r\\n43 ...', 'output': ['3\\r\\n6 3 29', '3\\r\\n6 29 3', '3\\r\\n88 11 3']}, {'input': '175 121\\r\\n165 83\\r\\n83 64\\r\\n165 49\\r\\n83 29\\r\\n79 49\\r\\n29 101\\r\\n107 49\\r\\n94 83\\r\\n107 91\\r\\n101 127\\r\\n29 115\\r\\n84 115\\r\\n107 164\\r\\n36 115\\r\\n165 98\\r\\n120 84\\r\\n57 165\\r\\n165 81\\r\\n101 124\\r\\n106 29\\r\\n159 98\\r\\n115 156\\r\\n109 98\\r\\n91 100\\r\\n125 81\\r\\n114 165\\r\\n57 145\\r\\n91 55\\r\\n80 94\\r\\n151 49\\r\\n107 85\\r\\n151 160\\r\\n99 57\\r\\n93 83\\r\\n71 124\\r\\n156 155\\r\\n80 158\\r\\n10 80\\r\\n172 36\\r\\n57 141\\r\\n137 81\\r\\n114 43\\r\\n36 108\\r\\n145 117\\r\\n73 109\\r\\n59 91\\r\\n155 61\\r\\n91 95\\r\\n90 107\\r\\n71 129\\r\\n101 21\\r\\n172 135\\r\\n50 117\\r\\n67 106\\r\\n145 162\\r\\n82 94\\r\\n142 109\\r\\n108 48\\r\\n49 132\\r\\n173 95\\r\\n115 45\\r\\n114 54\\r\\n64 62\\r\\n...', 'output': ['2\\r\\n2 4', '2\\r\\n91 4', '2\\r\\n4 2']}, {'input': '185 154\\r\\n94 15\\r\\n20 15\\r\\n146 94\\r\\n134 94\\r\\n111 15\\r\\n94 6\\r\\n146 127\\r\\n72 134\\r\\n146 181\\r\\n161 72\\r\\n175 94\\r\\n149 94\\r\\n111 136\\r\\n20 90\\r\\n171 6\\r\\n136 160\\r\\n131 175\\r\\n114 111\\r\\n2 6\\r\\n82 131\\r\\n20 53\\r\\n81 72\\r\\n37 6\\r\\n20 29\\r\\n161 80\\r\\n15 164\\r\\n90 148\\r\\n2 89\\r\\n3 160\\r\\n164 14\\r\\n37 12\\r\\n127 38\\r\\n20 57\\r\\n90 91\\r\\n174 6\\r\\n111 172\\r\\n148 139\\r\\n20 170\\r\\n5 131\\r\\n78 148\\r\\n127 31\\r\\n14 13\\r\\n82 1\\r\\n149 138\\r\\n138 45\\r\\n124 139\\r\\n101 174\\r\\n124 40\\r\\n134 35\\r\\n106 89\\r\\n38 43\\r\\n40 112\\r\\n111 122\\r\\n135 136\\r\\n43 105\\r\\n140 170\\r\\n182 139\\r\\n78 54\\r\\n134 84\\r\\n148 165\\r\\n34 3\\r\\n180 134\\r\\n163 135\\r\\n168 3\\r\\n45...', 'output': ['1\\r\\n14']}, {'input': '195 189\\r\\n133 108\\r\\n133 25\\r\\n108 52\\r\\n139 52\\r\\n161 108\\r\\n91 25\\r\\n7 52\\r\\n7 130\\r\\n108 40\\r\\n133 169\\r\\n91 88\\r\\n108 176\\r\\n139 89\\r\\n106 7\\r\\n176 22\\r\\n106 33\\r\\n91 104\\r\\n138 88\\r\\n24 161\\r\\n43 169\\r\\n169 73\\r\\n161 29\\r\\n79 24\\r\\n74 138\\r\\n133 126\\r\\n111 52\\r\\n192 88\\r\\n108 120\\r\\n74 3\\r\\n94 138\\r\\n130 71\\r\\n59 104\\r\\n62 43\\r\\n135 192\\r\\n192 163\\r\\n126 96\\r\\n129 74\\r\\n2 106\\r\\n43 4\\r\\n105 129\\r\\n42 96\\r\\n164 62\\r\\n193 126\\r\\n164 35\\r\\n158 73\\r\\n43 21\\r\\n116 135\\r\\n163 118\\r\\n133 195\\r\\n56 43\\r\\n7 51\\r\\n181 161\\r\\n24 5\\r\\n141 161\\r\\n155 43\\r\\n81 89\\r\\n51 134\\r\\n129 26\\r\\n161 16\\r\\n91 28\\r\\n116 76\\r\\n148 193\\r\\n54 193\\r\\n174 ...', 'output': ['1\\r\\n70', '1\\r\\n17']}, {'input': '105 105\\r\\n93 103\\r\\n93 104\\r\\n63 93\\r\\n97 93\\r\\n48 93\\r\\n93 7\\r\\n44 93\\r\\n93 59\\r\\n57 93\\r\\n93 73\\r\\n93 96\\r\\n25 93\\r\\n60 93\\r\\n93 36\\r\\n84 93\\r\\n93 31\\r\\n10 93\\r\\n71 93\\r\\n93 99\\r\\n93 69\\r\\n93 101\\r\\n93 85\\r\\n93 74\\r\\n93 92\\r\\n93 23\\r\\n93 45\\r\\n56 93\\r\\n93 40\\r\\n93 67\\r\\n20 93\\r\\n93 28\\r\\n93 79\\r\\n8 93\\r\\n93 86\\r\\n93 26\\r\\n62 93\\r\\n93 41\\r\\n50 93\\r\\n2 93\\r\\n93 21\\r\\n93 49\\r\\n80 93\\r\\n91 93\\r\\n78 93\\r\\n93 38\\r\\n93 18\\r\\n102 93\\r\\n51 93\\r\\n93 37\\r\\n93 54\\r\\n93 76\\r\\n5 93\\r\\n77 93\\r\\n89 93\\r\\n93 53\\r\\n93 12\\r\\n93 95\\r\\n93 19\\r\\n35 93\\r\\n58 93\\r\\n93 3\\r\\n22 93\\r\\n93 65\\r\\n68 93\\r\\n93 94\\r\\n72 93\\r\\n93 90\\r\\n93 61\\r\\n11 93\\r\\n93 16\\r\\n83 93\\r\\n93 24\\r...', 'output': ['0']}, {'input': '115 1\\r\\n32 63\\r\\n106 32\\r\\n32 44\\r\\n32 60\\r\\n32 10\\r\\n7 32\\r\\n32 2\\r\\n74 32\\r\\n32 49\\r\\n32 18\\r\\n36 32\\r\\n101 32\\r\\n52 32\\r\\n86 32\\r\\n32 39\\r\\n32 50\\r\\n32 14\\r\\n32 9\\r\\n32 108\\r\\n34 32\\r\\n64 32\\r\\n32 103\\r\\n32 97\\r\\n32 102\\r\\n32 100\\r\\n79 32\\r\\n32 107\\r\\n114 32\\r\\n32 87\\r\\n32 28\\r\\n47 32\\r\\n71 32\\r\\n105 32\\r\\n112 32\\r\\n32 19\\r\\n32 31\\r\\n32 84\\r\\n32 20\\r\\n55 32\\r\\n32 17\\r\\n32 98\\r\\n109 32\\r\\n32 62\\r\\n59 32\\r\\n80 32\\r\\n32 113\\r\\n66 32\\r\\n115 32\\r\\n32 73\\r\\n32 83\\r\\n32 42\\r\\n3 32\\r\\n92 32\\r\\n48 32\\r\\n32 70\\r\\n99 32\\r\\n32 57\\r\\n32 24\\r\\n32 82\\r\\n33 32\\r\\n32 93\\r\\n32 89\\r\\n81 32\\r\\n95 32\\r\\n6 32\\r\\n35 32\\r\\n77 32\\r\\n1 32\\r\\n32 65\\r\\n90 32\\r\\n32 104\\r...', 'output': ['1\\r\\n68']}, {'input': '125 2\\r\\n58 39\\r\\n39 16\\r\\n39 47\\r\\n39 66\\r\\n58 109\\r\\n48 39\\r\\n52 58\\r\\n58 45\\r\\n39 60\\r\\n2 58\\r\\n58 41\\r\\n39 33\\r\\n4 58\\r\\n18 39\\r\\n58 15\\r\\n97 39\\r\\n38 39\\r\\n58 23\\r\\n58 29\\r\\n39 75\\r\\n39 65\\r\\n58 64\\r\\n67 58\\r\\n35 58\\r\\n31 58\\r\\n108 39\\r\\n58 89\\r\\n99 58\\r\\n20 39\\r\\n39 56\\r\\n58 114\\r\\n58 3\\r\\n39 32\\r\\n87 58\\r\\n92 58\\r\\n107 39\\r\\n70 39\\r\\n39 26\\r\\n58 102\\r\\n28 58\\r\\n51 39\\r\\n39 77\\r\\n27 39\\r\\n42 58\\r\\n39 68\\r\\n58 25\\r\\n58 11\\r\\n58 30\\r\\n62 58\\r\\n122 58\\r\\n7 39\\r\\n96 39\\r\\n6 39\\r\\n39 90\\r\\n39 110\\r\\n57 39\\r\\n39 124\\r\\n58 93\\r\\n58 43\\r\\n39 46\\r\\n19 58\\r\\n39 12\\r\\n59 39\\r\\n34 39\\r\\n39 115\\r\\n39 74\\r\\n58 105\\r\\n39 17\\r\\n39 86\\r\\n39 119\\r\\n36 39\\r\\n7...', 'output': ['60\\r\\n1 5 7 8 10 11 13 15 18 19 22 23 24 25 27 28 31 32 34 35 39 40 44 46 47 48 49 50 58 59 61 67 72 73 75 76 77 80 83 85 87 88 90 91 93 95 97 98 100 102 104 106 108 109 111 112 116 117 120 121', '60\\r\\n121 120 117 116 112 111 109 108 106 104 102 100 98 97 95 93 91 90 88 87 85 83 80 77 76 75 73 72 67 61 59 58 50 49 48 47 46 44 40 39 35 34 32 31 28 27 25 24 23 22 19 18 15 13 11 10 8 7 5 1']}, {'input': '135 3\\r\\n119 91\\r\\n73 119\\r\\n73 83\\r\\n32 119\\r\\n8 73\\r\\n41 119\\r\\n119 99\\r\\n91 43\\r\\n34 91\\r\\n36 73\\r\\n119 81\\r\\n91 62\\r\\n9 119\\r\\n98 73\\r\\n119 89\\r\\n46 91\\r\\n119 23\\r\\n73 66\\r\\n119 69\\r\\n73 117\\r\\n91 107\\r\\n119 106\\r\\n35 91\\r\\n73 40\\r\\n101 91\\r\\n119 56\\r\\n85 91\\r\\n2 91\\r\\n91 60\\r\\n47 91\\r\\n73 24\\r\\n54 73\\r\\n91 31\\r\\n119 88\\r\\n20 73\\r\\n65 119\\r\\n104 119\\r\\n119 49\\r\\n73 52\\r\\n68 91\\r\\n91 29\\r\\n121 91\\r\\n92 73\\r\\n91 71\\r\\n119 109\\r\\n133 73\\r\\n57 73\\r\\n10 91\\r\\n73 22\\r\\n91 39\\r\\n119 118\\r\\n91 16\\r\\n73 108\\r\\n93 91\\r\\n73 74\\r\\n84 119\\r\\n91 15\\r\\n11 119\\r\\n19 91\\r\\n73 127\\r\\n73 110\\r\\n38 91\\r\\n91 4\\r\\n53 119\\r\\n70 91\\r\\n61 73\\r\\n91 3\\r\\n100 91\\r...', 'output': ['42\\r\\n116 115 114 113 111 108 107 106 105 96 95 91 90 89 87 81 80 78 77 70 69 64 58 56 51 45 38 37 36 34 26 22 19 17 15 13 11 7 6 4 2 1', '42\\r\\n1 2 4 6 7 11 13 15 17 19 22 26 34 36 37 38 45 51 56 58 64 69 70 77 78 80 81 87 89 90 91 95 96 105 106 107 108 111 113 114 115 116', '42\\r\\n132 116 115 114 113 111 108 107 106 105 96 95 91 90 89 87 81 80 78 77 70 69 64 58 56 51 45 38 37 36 34 26 22 19 17 15 13 11 7 6 2 1']}, {'input': '145 4\\r\\n32 78\\r\\n32 1\\r\\n88 78\\r\\n1 59\\r\\n88 79\\r\\n85 78\\r\\n39 88\\r\\n134 78\\r\\n135 1\\r\\n37 1\\r\\n74 1\\r\\n88 81\\r\\n32 63\\r\\n1 124\\r\\n2 88\\r\\n1 114\\r\\n20 1\\r\\n1 115\\r\\n88 23\\r\\n1 70\\r\\n88 45\\r\\n50 88\\r\\n88 120\\r\\n32 126\\r\\n116 88\\r\\n98 78\\r\\n10 32\\r\\n78 21\\r\\n113 1\\r\\n49 32\\r\\n1 60\\r\\n78 125\\r\\n32 136\\r\\n129 78\\r\\n78 106\\r\\n78 40\\r\\n144 88\\r\\n1 5\\r\\n78 112\\r\\n78 94\\r\\n32 96\\r\\n62 78\\r\\n9 88\\r\\n123 32\\r\\n71 78\\r\\n78 121\\r\\n55 32\\r\\n127 32\\r\\n97 1\\r\\n78 13\\r\\n143 78\\r\\n4 1\\r\\n88 66\\r\\n32 69\\r\\n1 133\\r\\n57 88\\r\\n22 88\\r\\n12 88\\r\\n32 84\\r\\n88 139\\r\\n75 32\\r\\n19 1\\r\\n34 88\\r\\n32 48\\r\\n42 32\\r\\n88 56\\r\\n108 32\\r\\n1 86\\r\\n32 137\\r\\n78 33\\r\\n128 32\\r\\n32 53...', 'output': ['27\\r\\n116 110 108 95 91 87 82 81 77 68 62 55 52 49 38 31 29 20 18 17 16 14 11 10 9 4 2', '27\\r\\n2 4 9 10 11 14 16 17 18 20 29 31 38 49 52 55 62 68 77 81 82 87 91 95 108 110 116', '27\\r\\n132 126 123 116 110 108 95 91 87 82 81 77 68 62 55 52 49 38 31 29 20 18 17 16 14 11 2']}, {'input': '155 5\\r\\n26 24\\r\\n52 24\\r\\n26 130\\r\\n88 52\\r\\n112 130\\r\\n130 58\\r\\n118 26\\r\\n24 30\\r\\n102 88\\r\\n44 24\\r\\n88 10\\r\\n52 6\\r\\n48 52\\r\\n52 122\\r\\n24 17\\r\\n40 88\\r\\n130 111\\r\\n24 12\\r\\n24 70\\r\\n135 130\\r\\n52 75\\r\\n143 24\\r\\n33 130\\r\\n92 26\\r\\n27 52\\r\\n25 88\\r\\n28 52\\r\\n26 155\\r\\n37 88\\r\\n130 54\\r\\n24 91\\r\\n126 130\\r\\n18 130\\r\\n7 130\\r\\n52 152\\r\\n124 130\\r\\n134 52\\r\\n52 149\\r\\n24 29\\r\\n105 24\\r\\n68 130\\r\\n113 130\\r\\n88 22\\r\\n52 128\\r\\n88 56\\r\\n72 130\\r\\n16 26\\r\\n57 24\\r\\n24 31\\r\\n88 125\\r\\n62 26\\r\\n26 144\\r\\n26 9\\r\\n104 52\\r\\n52 86\\r\\n26 21\\r\\n24 93\\r\\n26 8\\r\\n24 110\\r\\n88 133\\r\\n39 26\\r\\n130 147\\r\\n52 43\\r\\n26 53\\r\\n151 130\\r\\n88 153\\r\\n52 64\\r...', 'output': ['23\\r\\n3 1 7 24 28 47 51 52 53 56 58 61 64 75 84 88 89 94 100 102 104 110 111', '23\\r\\n111 110 104 102 100 94 89 88 84 75 64 61 58 56 53 52 51 47 28 24 7 3 1', '23\\r\\n3\\r\\n151 124 123 113 111 110 104 102 100 94 89 88 84 75 64 61 58 56 53 52 51 1']}, {'input': '165 6\\r\\n140 98\\r\\n4 98\\r\\n14 98\\r\\n8 4\\r\\n136 4\\r\\n13 4\\r\\n60 4\\r\\n98 93\\r\\n77 98\\r\\n33 136\\r\\n18 98\\r\\n90 140\\r\\n4 154\\r\\n4 81\\r\\n14 70\\r\\n4 23\\r\\n8 42\\r\\n19 136\\r\\n14 122\\r\\n8 119\\r\\n63 140\\r\\n14 102\\r\\n14 71\\r\\n14 84\\r\\n48 98\\r\\n4 9\\r\\n40 14\\r\\n140 61\\r\\n98 162\\r\\n140 22\\r\\n140 159\\r\\n65 98\\r\\n140 51\\r\\n98 25\\r\\n136 7\\r\\n4 106\\r\\n124 136\\r\\n12 4\\r\\n107 14\\r\\n4 3\\r\\n136 139\\r\\n121 4\\r\\n74 136\\r\\n14 160\\r\\n14 82\\r\\n140 57\\r\\n8 43\\r\\n29 98\\r\\n126 140\\r\\n136 147\\r\\n36 136\\r\\n14 105\\r\\n4 131\\r\\n8 141\\r\\n130 4\\r\\n14 97\\r\\n95 136\\r\\n98 50\\r\\n157 98\\r\\n143 136\\r\\n108 8\\r\\n67 140\\r\\n11 140\\r\\n136 164\\r\\n140 111\\r\\n136 152\\r\\n123 8\\r\\n10 4\\r\\n140 ...', 'output': ['17\\r\\n122 120 115 104 95 93 89 77 74 70 67 61 54 47 20 17 4', '17\\r\\n4\\r\\n158 157 153 144 137 122 120 115 104 95 93 89 77 74 70 67', '17\\r\\n4 17 20 47 54 61 67 70 74 77 89 93 95 104 115 120 122']}, {'input': '247 7\\r\\n182 48\\r\\n48 120\\r\\n182 81\\r\\n182 236\\r\\n81 67\\r\\n236 136\\r\\n109 81\\r\\n51 136\\r\\n67 118\\r\\n146 120\\r\\n48 144\\r\\n182 88\\r\\n106 136\\r\\n67 194\\r\\n8 136\\r\\n187 136\\r\\n48 93\\r\\n90 236\\r\\n41 67\\r\\n23 81\\r\\n136 167\\r\\n67 188\\r\\n169 182\\r\\n25 136\\r\\n120 105\\r\\n99 120\\r\\n120 245\\r\\n130 67\\r\\n86 120\\r\\n182 147\\r\\n210 81\\r\\n182 27\\r\\n81 53\\r\\n30 182\\r\\n16 136\\r\\n190 81\\r\\n29 136\\r\\n19 236\\r\\n12 136\\r\\n162 120\\r\\n114 81\\r\\n231 48\\r\\n236 220\\r\\n81 37\\r\\n94 81\\r\\n67 123\\r\\n81 211\\r\\n182 95\\r\\n236 129\\r\\n134 120\\r\\n67 160\\r\\n48 242\\r\\n193 120\\r\\n11 48\\r\\n136 239\\r\\n156 182\\r\\n120 203\\r\\n236 200\\r\\n155 67\\r\\n124 236\\r\\n81 84\\r\\n81 237...', 'output': ['22\\r\\n193 183 179 172 158 156 128 124 123 108 92 87 80 79 60 58 49 43 38 18 6 4', '22\\r\\n6\\r\\n246 245 231 222 209 201 193 183 179 172 158 156 128 124 123 108 92 87 80 79 4', '22\\r\\n6 4 18 38 43 49 58 60 79 80 87 92 108 123 124 128 156 158 172 179 183 193']}, {'input': '248 8\\r\\n202 93\\r\\n93 89\\r\\n89 20\\r\\n228 202\\r\\n121 89\\r\\n20 142\\r\\n123 142\\r\\n87 123\\r\\n93 21\\r\\n123 201\\r\\n89 159\\r\\n142 227\\r\\n123 141\\r\\n121 100\\r\\n74 89\\r\\n89 210\\r\\n73 93\\r\\n84 89\\r\\n202 85\\r\\n228 105\\r\\n228 247\\r\\n205 202\\r\\n218 202\\r\\n228 195\\r\\n118 93\\r\\n6 123\\r\\n194 20\\r\\n121 113\\r\\n175 121\\r\\n77 20\\r\\n89 188\\r\\n99 121\\r\\n75 142\\r\\n244 142\\r\\n202 69\\r\\n93 156\\r\\n228 117\\r\\n165 228\\r\\n81 202\\r\\n20 35\\r\\n94 121\\r\\n68 142\\r\\n121 64\\r\\n128 228\\r\\n4 93\\r\\n89 138\\r\\n60 202\\r\\n202 204\\r\\n235 20\\r\\n3 89\\r\\n121 107\\r\\n228 222\\r\\n228 110\\r\\n89 119\\r\\n142 179\\r\\n234 228\\r\\n123 139\\r\\n236 142\\r\\n142 26\\r\\n135 228\\r\\n158 202\\r\\n14...', 'output': ['16\\r\\n5\\r\\n234 223 191 187 182 181 170 152 121 117 112 108 103 94 92', '16\\r\\n5 14 28 29 32 41 43 51 92 94 103 108 112 117 121 152', '16\\r\\n152 121 117 112 108 103 94 92 51 43 41 32 29 28 14 5']}, {'input': '249 9\\r\\n119 79\\r\\n12 79\\r\\n190 12\\r\\n191 119\\r\\n242 12\\r\\n110 119\\r\\n14 119\\r\\n141 14\\r\\n37 191\\r\\n242 199\\r\\n114 242\\r\\n222 190\\r\\n79 227\\r\\n53 242\\r\\n242 112\\r\\n110 57\\r\\n119 1\\r\\n66 141\\r\\n191 27\\r\\n173 191\\r\\n119 117\\r\\n73 191\\r\\n144 141\\r\\n238 119\\r\\n200 110\\r\\n242 45\\r\\n28 191\\r\\n131 191\\r\\n63 141\\r\\n110 143\\r\\n79 224\\r\\n119 72\\r\\n51 119\\r\\n190 93\\r\\n203 242\\r\\n110 65\\r\\n79 74\\r\\n191 71\\r\\n127 191\\r\\n242 10\\r\\n141 170\\r\\n243 191\\r\\n99 14\\r\\n110 207\\r\\n14 232\\r\\n249 14\\r\\n92 14\\r\\n137 119\\r\\n36 119\\r\\n80 119\\r\\n140 191\\r\\n120 79\\r\\n110 235\\r\\n152 242\\r\\n110 172\\r\\n79 164\\r\\n49 191\\r\\n79 18\\r\\n110 240\\r\\n78 242\\r\\n14 82\\r...', 'output': ['12\\r\\n7\\r\\n236 222 220 198 175 163 162 154 140 135 8', '12\\r\\n7 8 43 45 46 47 61 74 92 106 135 140', '12\\r\\n140 135 106 92 74 61 47 46 45 43 8 7']}, {'input': '250 222\\r\\n14 6\\r\\n79 14\\r\\n213 14\\r\\n153 14\\r\\n179 14\\r\\n14 189\\r\\n14 243\\r\\n14 170\\r\\n198 14\\r\\n14 247\\r\\n14 113\\r\\n24 14\\r\\n58 14\\r\\n216 14\\r\\n177 14\\r\\n232 14\\r\\n14 98\\r\\n193 14\\r\\n174 14\\r\\n97 14\\r\\n14 32\\r\\n63 14\\r\\n14 114\\r\\n190 14\\r\\n34 14\\r\\n14 60\\r\\n14 4\\r\\n14 159\\r\\n14 28\\r\\n140 14\\r\\n14 250\\r\\n124 14\\r\\n29 14\\r\\n41 14\\r\\n14 51\\r\\n14 85\\r\\n81 14\\r\\n16 14\\r\\n54 14\\r\\n14 44\\r\\n14 48\\r\\n14 71\\r\\n194 14\\r\\n50 14\\r\\n242 14\\r\\n7 14\\r\\n52 14\\r\\n8 14\\r\\n26 14\\r\\n11 14\\r\\n14 112\\r\\n14 82\\r\\n14 74\\r\\n222 14\\r\\n14 70\\r\\n14 115\\r\\n14 95\\r\\n10 14\\r\\n14 231\\r\\n149 14\\r\\n14 53\\r\\n47 14\\r\\n14 236\\r\\n14 202\\r\\n14 160\\r\\n86 14\\r\\n173 14\\r\\n14 49\\r...', 'output': ['28\\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', '28\\r\\n249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222', '28\\r\\n28 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']}, {'input': '400 383\\r\\n154 278\\r\\n369 47\\r\\n330 295\\r\\n372 221\\r\\n30 251\\r\\n48 366\\r\\n203 247\\r\\n118 227\\r\\n393 386\\r\\n333 2\\r\\n311 144\\r\\n39 159\\r\\n170 14\\r\\n2 137\\r\\n239 40\\r\\n341 85\\r\\n273 217\\r\\n352 45\\r\\n300 162\\r\\n108 61\\r\\n264 227\\r\\n57 302\\r\\n132 13\\r\\n295 82\\r\\n13 297\\r\\n143 118\\r\\n398 5\\r\\n137 33\\r\\n199 340\\r\\n132 361\\r\\n138 5\\r\\n322 53\\r\\n229 358\\r\\n259 52\\r\\n114 362\\r\\n383 336\\r\\n307 267\\r\\n123 214\\r\\n135 106\\r\\n383 166\\r\\n334 39\\r\\n176 328\\r\\n81 212\\r\\n222 74\\r\\n8 249\\r\\n284 243\\r\\n27 204\\r\\n287 197\\r\\n184 80\\r\\n5 282\\r\\n252 160\\r\\n88 252\\r\\n276 228\\r\\n84 157\\r\\n181 362\\r\\n19 78\\r\\n80 73\\r\\n312 157\\r\\n207 236\\r\\n177 18\\r\\n24...', 'output': ['2\\r\\n84 260', '2\\r\\n361 260', '2\\r\\n260 84']}, {'input': '400 369\\r\\n155 367\\r\\n387 51\\r\\n211 73\\r\\n292 350\\r\\n22 271\\r\\n282 329\\r\\n156 231\\r\\n110 277\\r\\n212 389\\r\\n369 265\\r\\n296 243\\r\\n184 389\\r\\n142 25\\r\\n156 249\\r\\n399 228\\r\\n227 261\\r\\n200 69\\r\\n95 2\\r\\n31 297\\r\\n4 378\\r\\n101 201\\r\\n118 50\\r\\n48 64\\r\\n119 171\\r\\n293 347\\r\\n80 92\\r\\n111 119\\r\\n121 393\\r\\n362 320\\r\\n17 266\\r\\n128 135\\r\\n197 94\\r\\n224 257\\r\\n102 223\\r\\n81 18\\r\\n358 214\\r\\n324 375\\r\\n117 305\\r\\n221 322\\r\\n169 66\\r\\n296 21\\r\\n371 44\\r\\n51 17\\r\\n275 291\\r\\n194 44\\r\\n214 376\\r\\n138 263\\r\\n369 299\\r\\n148 121\\r\\n394 340\\r\\n369 240\\r\\n317 11\\r\\n100 193\\r\\n324 151\\r\\n177 128\\r\\n123 265\\r\\n95 355\\r\\n259 384\\r\\n215 306\\r...', 'output': ['2\\r\\n210 280', '2\\r\\n280 210', '2\\r\\n132 210']}, {'input': '400 389\\r\\n285 28\\r\\n196 384\\r\\n60 283\\r\\n115 110\\r\\n284 304\\r\\n301 254\\r\\n315 291\\r\\n243 90\\r\\n1 147\\r\\n223 368\\r\\n139 259\\r\\n98 135\\r\\n243 34\\r\\n196 135\\r\\n201 291\\r\\n397 261\\r\\n362 211\\r\\n383 125\\r\\n66 341\\r\\n1 346\\r\\n206 381\\r\\n243 50\\r\\n107 293\\r\\n13 111\\r\\n214 281\\r\\n232 157\\r\\n85 135\\r\\n196 145\\r\\n63 327\\r\\n135 1\\r\\n239 243\\r\\n385 290\\r\\n92 272\\r\\n19 248\\r\\n214 289\\r\\n75 135\\r\\n1 111\\r\\n8 211\\r\\n227 163\\r\\n52 366\\r\\n120 89\\r\\n243 235\\r\\n94 141\\r\\n174 272\\r\\n338 99\\r\\n107 212\\r\\n24 167\\r\\n150 147\\r\\n314 183\\r\\n123 54\\r\\n196 126\\r\\n33 180\\r\\n314 29\\r\\n104 135\\r\\n372 326\\r\\n294 165\\r\\n27 111\\r\\n248 328\\r\\n283 393\\r\\n167...', 'output': ['2\\r\\n280 9', '2\\r\\n357 257', '2\\r\\n9 280']}, {'input': '400 41\\r\\n200 126\\r\\n229 190\\r\\n301 170\\r\\n75 229\\r\\n239 193\\r\\n57 325\\r\\n158 180\\r\\n278 120\\r\\n376 34\\r\\n41 355\\r\\n395 166\\r\\n382 139\\r\\n73 96\\r\\n308 177\\r\\n360 276\\r\\n127 245\\r\\n12 356\\r\\n191 169\\r\\n152 338\\r\\n11 343\\r\\n116 365\\r\\n100 246\\r\\n214 3\\r\\n224 73\\r\\n126 15\\r\\n334 289\\r\\n390 159\\r\\n197 109\\r\\n28 182\\r\\n163 319\\r\\n215 333\\r\\n36 381\\r\\n95 13\\r\\n217 57\\r\\n218 293\\r\\n230 8\\r\\n326 288\\r\\n100 258\\r\\n335 203\\r\\n66 52\\r\\n140 257\\r\\n122 274\\r\\n78 1\\r\\n118 371\\r\\n390 294\\r\\n208 285\\r\\n173 179\\r\\n9 17\\r\\n195 204\\r\\n6 383\\r\\n178 387\\r\\n280 213\\r\\n63 320\\r\\n307 30\\r\\n91 149\\r\\n253 256\\r\\n308 317\\r\\n23 330\\r\\n225 56\\r\\n341 37...', 'output': ['1\\r\\n214']}, {'input': '400 384\\r\\n75 93\\r\\n42 59\\r\\n262 118\\r\\n130 150\\r\\n59 328\\r\\n168 194\\r\\n297 296\\r\\n46 325\\r\\n75 385\\r\\n321 356\\r\\n272 264\\r\\n259 323\\r\\n262 368\\r\\n309 244\\r\\n323 353\\r\\n336 356\\r\\n46 146\\r\\n323 358\\r\\n46 313\\r\\n309 57\\r\\n306 323\\r\\n43 46\\r\\n66 309\\r\\n298 398\\r\\n185 23\\r\\n7 309\\r\\n59 207\\r\\n372 46\\r\\n356 64\\r\\n375 322\\r\\n378 205\\r\\n276 75\\r\\n75 337\\r\\n132 46\\r\\n323 304\\r\\n348 59\\r\\n135 205\\r\\n170 239\\r\\n184 175\\r\\n8 250\\r\\n158 170\\r\\n102 314\\r\\n75 204\\r\\n331 201\\r\\n309 395\\r\\n1 28\\r\\n174 356\\r\\n82 75\\r\\n356 167\\r\\n152 294\\r\\n323 274\\r\\n237 194\\r\\n323 248\\r\\n242 246\\r\\n1 369\\r\\n262 111\\r\\n284 179\\r\\n187 176\\r\\n49 140\\r\\n194 8...', 'output': ['1\\r\\n324', '1\\r\\n357']}, {'input': '400 264\\r\\n251 349\\r\\n198 186\\r\\n148 9\\r\\n159 22\\r\\n328 180\\r\\n128 185\\r\\n215 12\\r\\n137 179\\r\\n212 59\\r\\n303 162\\r\\n257 32\\r\\n110 121\\r\\n96 276\\r\\n230 17\\r\\n263 318\\r\\n109 301\\r\\n35 281\\r\\n3 327\\r\\n269 394\\r\\n140 209\\r\\n327 343\\r\\n79 248\\r\\n195 77\\r\\n202 175\\r\\n307 30\\r\\n299 141\\r\\n286 167\\r\\n118 179\\r\\n187 399\\r\\n16 318\\r\\n309 231\\r\\n199 29\\r\\n369 300\\r\\n149 307\\r\\n197 338\\r\\n7 314\\r\\n311 244\\r\\n361 83\\r\\n366 90\\r\\n50 305\\r\\n127 317\\r\\n337 364\\r\\n279 220\\r\\n5 42\\r\\n155 222\\r\\n250 253\\r\\n212 142\\r\\n121 287\\r\\n383 173\\r\\n351 125\\r\\n16 134\\r\\n20 178\\r\\n374 208\\r\\n321 50\\r\\n360 134\\r\\n329 226\\r\\n188 371\\r\\n196 134\\r\\n51 390\\r...', 'output': ['1\\r\\n76']}, {'input': '400 389\\r\\n18 182\\r\\n285 224\\r\\n1 390\\r\\n115 182\\r\\n1 191\\r\\n1 309\\r\\n293 1\\r\\n1 63\\r\\n1 5\\r\\n112 1\\r\\n120 1\\r\\n55 388\\r\\n247 1\\r\\n126 55\\r\\n155 285\\r\\n400 352\\r\\n1 204\\r\\n1 23\\r\\n60 1\\r\\n1 354\\r\\n1 163\\r\\n275 285\\r\\n2 1\\r\\n170 1\\r\\n59 31\\r\\n285 138\\r\\n1 234\\r\\n1 61\\r\\n326 293\\r\\n55 283\\r\\n301 55\\r\\n37 1\\r\\n1 19\\r\\n182 287\\r\\n285 397\\r\\n285 157\\r\\n59 51\\r\\n1 158\\r\\n55 268\\r\\n1 229\\r\\n245 1\\r\\n164 1\\r\\n20 285\\r\\n182 251\\r\\n55 250\\r\\n1 339\\r\\n6 33\\r\\n352 385\\r\\n25 1\\r\\n270 182\\r\\n1 45\\r\\n55 130\\r\\n1 42\\r\\n187 285\\r\\n55 184\\r\\n55 398\\r\\n30 302\\r\\n68 1\\r\\n134 285\\r\\n140 55\\r\\n1 379\\r\\n294 352\\r\\n1 303\\r\\n288 352\\r\\n248 352\\r\\n285 171\\r\\n33 1...', 'output': ['1\\r\\n327']}, {'input': '400 399\\r\\n4 315\\r\\n9 128\\r\\n324 15\\r\\n187 284\\r\\n362 106\\r\\n174 304\\r\\n255 216\\r\\n206 165\\r\\n125 51\\r\\n148 271\\r\\n4 29\\r\\n215 395\\r\\n90 186\\r\\n346 188\\r\\n61 64\\r\\n218 356\\r\\n8 279\\r\\n177 258\\r\\n296 336\\r\\n355 334\\r\\n287 96\\r\\n72 102\\r\\n169 32\\r\\n232 171\\r\\n9 320\\r\\n231 194\\r\\n344 179\\r\\n139 376\\r\\n397 205\\r\\n260 123\\r\\n51 316\\r\\n246 272\\r\\n136 240\\r\\n328 354\\r\\n184 59\\r\\n319 11\\r\\n101 149\\r\\n106 318\\r\\n237 124\\r\\n76 154\\r\\n98 235\\r\\n273 185\\r\\n264 10\\r\\n6 16\\r\\n356 340\\r\\n296 144\\r\\n341 38\\r\\n262 225\\r\\n85 119\\r\\n385 113\\r\\n41 60\\r\\n221 234\\r\\n104 118\\r\\n268 210\\r\\n230 259\\r\\n57 392\\r\\n349 215\\r\\n217 89\\r\\n32 63\\r\\n208 263...', 'output': ['1\\r\\n242']}, {'input': '400 288\\r\\n1 176\\r\\n55 1\\r\\n1 324\\r\\n110 1\\r\\n1 384\\r\\n116 1\\r\\n1 90\\r\\n1 168\\r\\n1 248\\r\\n1 98\\r\\n152 1\\r\\n50 1\\r\\n1 28\\r\\n24 1\\r\\n294 1\\r\\n1 365\\r\\n1 371\\r\\n1 339\\r\\n337 1\\r\\n259 1\\r\\n230 1\\r\\n399 1\\r\\n327 1\\r\\n1 249\\r\\n188 1\\r\\n226 1\\r\\n1 135\\r\\n101 1\\r\\n1 380\\r\\n1 19\\r\\n20 1\\r\\n169 1\\r\\n1 254\\r\\n92 1\\r\\n1 139\\r\\n21 1\\r\\n1 78\\r\\n1 160\\r\\n358 1\\r\\n192 1\\r\\n1 30\\r\\n64 1\\r\\n1 289\\r\\n196 1\\r\\n1 221\\r\\n247 1\\r\\n374 1\\r\\n1 144\\r\\n1 279\\r\\n122 1\\r\\n1 32\\r\\n1 166\\r\\n1 25\\r\\n1 27\\r\\n293 1\\r\\n330 1\\r\\n52 1\\r\\n1 198\\r\\n75 1\\r\\n1 220\\r\\n1 136\\r\\n1 13\\r\\n1 251\\r\\n218 1\\r\\n1 164\\r\\n381 1\\r\\n1 8\\r\\n199 1\\r\\n277 1\\r\\n387 1\\r\\n351 1\\r\\n1 175\\r\\n1 240\\r\\n1 303\\r\\n1 174...', 'output': ['112\\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 101 102 103 104 105 106 107 108 109 110 111 112', '112\\r\\n112 111 110 109 108 107 106 105 104 103 102 101 100 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', '112\\r\\n399 398 397 396 395 394 393 392 391 390 389 388 387 386 385 384 383 382 381 380 379 378 377 376 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 355 354 353 352 351 350 349 348 347 346 345 344 343 342 341 340 339 338 337 336 335 334 333 332 331 330 329 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298 297 296 295 294 293 292 291 290 289 288']}]","id":467} {"difficulty":2500,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"6bd41042c6a442765cd93c73d55f6189","execute_outcome":"COMPILATION_ERROR","source_code":"import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nconst val MOD = 1000000007L\nconst val P = 3L\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n val n = jin.readLine().toInt()\n val s = jin.readLine()\n val hashes = LongArray(n + 1)\n val sums = IntArray(n + 1)\n for (j in 1..n) {\n if (j >= 2 && s[j - 1] == '1' && s[j - 2] == '1') {\n hashes[j] = hashes[j - 2]\n sums[j] = sums[j - 2]\n } else {\n hashes[j] = ((P * hashes[j - 1]) + (s[j - 1] - '0').toLong()) % MOD\n sums[j] = sums[j - 1] + 1\n }\n }\n val next = IntArray(n + 1)\n next[n] = n\n for (j in n - 1 downTo 0) {\n if (s[j] == '1') {\n next[j] = next[j + 1]\n } else {\n next[j] = j\n }\n }\n val THREE_POW = LongArray(n + 2)\n THREE_POW[0] = 1L\n for (j in 1..n + 1) {\n THREE_POW[j] = (P * THREE_POW[j - 1]) % MOD\n }\n fun hash(x: Int, y: Int): Long {\n val xn = next[x]\n if (xn >= y) {\n return when ((x + y) % 2) {\n 0 -> 0L\n 1 -> 1L\n else -> -1L\n }\n } else {\n \/\/println(\"x = $x, y = $y, xn = $xn\")\n var res = hashes[y] - (hashes[xn] * THREE_POW[sums[y] - sums[xn]])\n res %= MOD\n if ((x + xn) % 2 == 1) {\n res += THREE_POW[sums[y] - sums[xn]]\n res %= MOD\n }\n res += MOD\n res %= MOD\n return res\n }\n }\n \/*val ps = mutableListOf(Pair(0, 3), Pair(2, 5))\n for (p in ps) {\n val a = p.first\n val b = p.second\n println(\"hash($a, $b) = ${hash(a, b)}\")\n }*\/\n val q = jin.readLine().toInt()\n val out = StringBuilder()\n for (j in 1..q) {\n val tokenizer = StringTokenizer(jin.readLine())\n val l1 = tokenizer.nextToken().toInt()\n val l2 = tokenizer.nextToken().toInt()\n val length = tokenizer.nextToken().toInt()\n out.appendln(if (hash(l1 - 1, l1 + length - 1) == hash(l2 - 1, l2 + length - 1)) \"YES\" else \"NO\")\n }\n print(out)\n}\n\n\/*\n20\n11011101011100101111\n3\n1 4 3\n4 6 6\n1 16 5\n\nNO\nYES\nYES\n *\/","description":"In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string $$$s$$$ starting from the $$$l$$$-th character and ending with the $$$r$$$-th character as $$$s[l \\dots r]$$$. The characters of each string are numbered from $$$1$$$.We can perform several operations on the strings we consider. Each operation is to choose a substring of our string and replace it with another string. There are two possible types of operations: replace 011 with 110, or replace 110 with 011. For example, if we apply exactly one operation to the string 110011110, it can be transformed into 011011110, 110110110, or 110011011.Binary string $$$a$$$ is considered reachable from binary string $$$b$$$ if there exists a sequence $$$s_1$$$, $$$s_2$$$, ..., $$$s_k$$$ such that $$$s_1 = a$$$, $$$s_k = b$$$, and for every $$$i \\in [1, k - 1]$$$, $$$s_i$$$ can be transformed into $$$s_{i + 1}$$$ using exactly one operation. Note that $$$k$$$ can be equal to $$$1$$$, i.\u2009e., every string is reachable from itself.You are given a string $$$t$$$ and $$$q$$$ queries to it. Each query consists of three integers $$$l_1$$$, $$$l_2$$$ and $$$len$$$. To answer each query, you have to determine whether $$$t[l_1 \\dots l_1 + len - 1]$$$ is reachable from $$$t[l_2 \\dots l_2 + len - 1]$$$.","input_specification":"The first line contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) \u2014 the length of string $$$t$$$. The second line contains one string $$$t$$$ ($$$|t| = n$$$). Each character of $$$t$$$ is either 0 or 1. The third line contains one integer $$$q$$$ ($$$1 \\le q \\le 2 \\cdot 10^5$$$) \u2014 the number of queries. Then $$$q$$$ lines follow, each line represents a query. The $$$i$$$-th line contains three integers $$$l_1$$$, $$$l_2$$$ and $$$len$$$ ($$$1 \\le l_1, l_2 \\le |t|$$$, $$$1 \\le len \\le |t| - \\max(l_1, l_2) + 1$$$) for the $$$i$$$-th query.","output_specification":"For each query, print either YES if $$$t[l_1 \\dots l_1 + len - 1]$$$ is reachable from $$$t[l_2 \\dots l_2 + len - 1]$$$, or NO otherwise. You may print each letter in any register.","notes":null,"sample_inputs":["5\n11011\n3\n1 3 3\n1 4 2\n1 2 3"],"sample_outputs":["Yes\nYes\nNo"],"human_solution":"import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nconst val MOD = 1000000007L\nconst val P = 3L\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n val n = jin.readLine().toInt()\n val s = jin.readLine()\n val hashes = LongArray(n + 1)\n val sums = IntArray(n + 1)\n val sum1s = IntArray(n + 1)\n for (j in 1..n) {\n if (j >= 2 && s[j - 1] == '1' && s[j - 2] == '1') {\n hashes[j] = hashes[j - 2]\n sums[j] = sums[j - 2]\n } else {\n hashes[j] = ((P * hashes[j - 1]) + (s[j - 1] - '0').toLong()) % MOD\n sums[j] = sums[j - 1] + 1\n }\n sum1s[j] = sum1s[j - 1] + (s[j - 1] - '0')\n }\n val next = IntArray(n + 1)\n next[n] = n\n for (j in n - 1 downTo 0) {\n if (s[j] == '1') {\n next[j] = next[j + 1]\n } else {\n next[j] = j\n }\n }\n val THREE_POW = LongArray(n + 2)\n THREE_POW[0] = 1L\n for (j in 1..n + 1) {\n THREE_POW[j] = (P * THREE_POW[j - 1]) % MOD\n }\n fun hash(x: Int, y: Int): Long {\n val xn = next[x]\n if (xn >= y) {\n return when ((x + y) % 2) {\n 0 -> 0L\n 1 -> 1L\n else -> -1L\n }\n } else {\n var res = hashes[y] - (hashes[xn] * THREE_POW[sums[y] - sums[xn]])\n res %= MOD\n if ((x + xn) % 2 == 1) {\n res += THREE_POW[sums[y] - sums[xn]]\n res %= MOD\n }\n res += MOD\n res %= MOD\n return res\n }\n }\n val q = jin.readLine().toInt()\n val out = StringBuilder()\n for (j in 1..q) {\n val tokenizer = StringTokenizer(jin.readLine())\n val l1 = tokenizer.nextToken().toInt()\n val l2 = tokenizer.nextToken().toInt()\n val length = tokenizer.nextToken().toInt()\n var works = (sum1s[l1 + length - 1] - sum1s[l1 - 1]) == (sum1s[l2 + length - 1] - sum1s[l2 - 1])\n if (works) {\n works = hash(l1 - 1, l1 + length - 1) == hash(l2 - 1, l2 + length - 1)\n }\n out.appendln(if (works) \"YES\" else \"NO\")\n }\n print(out)\n}\n","testcases":"[{'input': '5\\r\\n11011\\r\\n3\\r\\n1 3 3\\r\\n1 4 2\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo']}, {'input': '1\\r\\n0\\r\\n1\\r\\n1 1 1\\r\\n', 'output': ['Yes', 'YES']}, {'input': '3\\r\\n010\\r\\n3\\r\\n1 3 1\\r\\n1 3 1\\r\\n3 2 1\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo']}, {'input': '10\\r\\n0100001001\\r\\n10\\r\\n2 5 4\\r\\n10 2 1\\r\\n5 3 5\\r\\n2 9 2\\r\\n5 3 1\\r\\n3 3 3\\r\\n9 8 1\\r\\n5 3 1\\r\\n9 5 2\\r\\n2 3 6\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n0011011100000010101111011010010000010101000011111110101001010110110011000100001110011001111110100110\\r\\n100\\r\\n47 34 50\\r\\n81 65 15\\r\\n28 41 17\\r\\n96 23 1\\r\\n48 10 10\\r\\n74 44 12\\r\\n69 100 1\\r\\n96 100 1\\r\\n94 58 3\\r\\n9 35 35\\r\\n79 12 16\\r\\n76 25 18\\r\\n49 100 1\\r\\n66 32 19\\r\\n81 18 19\\r\\n45 37 15\\r\\n59 86 1\\r\\n74 65 8\\r\\n1 79 2\\r\\n54 100 1\\r\\n56 2 9\\r\\n54 65 30\\r\\n19 15 9\\r\\n33 5 12\\r\\n9 93 5\\r\\n26 80 1\\r\\n76 47 21\\r\\n75 80 5\\r\\n60 59 37\\r\\n37 62 25\\r\\n15 86 6\\r\\n19 62 14\\r\\n80 23 14\\r\\n94 97 3\\r\\n77 33 9\\r\\n17 99 2\\r\\n58 100 1\\r\\n72 24 6\\r\\n78 74 16\\r\\n69 81 20\\r\\n38 71 26\\r\\n50 91 8\\r\\n...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo', 'NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO']}, {'input': '500\\r\\n10101010110101101010011101110000101100111110001010111001011110101011100011100000010101100011100001001101100101111101101010000000011110110111000101000000100101000110011101111000111001110100101101010110000011101100000100011010000010001011011110010010101111100101000101010010101001010111011101010100101101110001111010000010001101111101000000010101011100101011000110100000011100100000101010011000001000000010101101000010110001010111110011010001011100100101001110110000111101111110001101111100111011001110\\r\\n500\\r...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r...']}, {'input': '1000\\r\\n1101011101100111001101100100011111111111101011111101101100110110001011010101100011001000110001010010110001110001100011111010000010100110101001001110101110001101100101101101110110111100110111000111010010010000011110011010100001001100000011110110111111100111001001110001111011110001011111010011100101000111101111001101100111010101000110011100010001110001000100011001111100111010101110111101011010011010111101010010011100000001110010110100010111100001011010110110000100111011011010010001110001100111111100111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...']}, {'input': '5000\\r\\n0001010011111111001110011001010001001010001000000001001101010110100000101100001010000011100000000001101100111100100110110101001101000101101100100001010010101011001101110011000111000011101111111001101100010011110001010011111001110111101010110001111110000110110101001101010111110001000001101111110111010010100010100111101100000100010101000100011110001100100000011111100110001101011011011010110110010001110011011101100010101011000101101011010110001110101001010000110010111001111100101011000100011111111100111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '10000\\r\\n011000111101001111011011110111110010111111000011101001001101101000101000100100110011011001011011110010111000011100111101000001011010000101101101001000101101000110110111000110010110011001110100000110001101010000110000010100010010001010100100000110000111100000001000110101001001100010101100101100101100110101010111010100000111110100000011110111001001110011101100011010100110100000110011111001100000010111001101101011011010000111010110101101001100010000100100000000010101000111110100010110110000110101101001...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '50000\\r\\n001001000010000010100000110101110001110011111000110000111010101001010010010010100101001011101011000110111010111010011100011101101011101011100011110001110111111011110111000000110111011011110001111111011110110010100010010011101110011011110000011001010001110001010100011100101011111101010010011101010111100001110000010100010100011111010011111100101011011101011010000000111101101010000001011111110010011111011000010100001100110100001010110010011111010001101101111011110010101111001010111001010010111101000101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '100000\\r\\n00010100100100000110010011001110000010010100010110011001011011101011000000101010000111111101000011110100001111100100001001001100001001111111101100001000000101000100010010100111110000110101010100111111000010000010101101010101101001000100101101001100110001000111000110010011011011111000001100000011011111110000010010111100101110010110000001010000000101000111000110100101100110000011100001101111111101001011111011101011111100111110011000101110101001000010010101000101101110101001110001100101111000111010001...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01111000110011111010011100001001110000011011010111110100111110001000000101000001011101101110001111110000011111010000000010101001000001111011100110000101001010000000101101111000011011001001100111011100000010010100100111010001110000101001110110001110011000000101010101010010110011010001010111010011001011001011000000010000000010010010101000101001011101001110111100110000011001001001000110111000000010011110011100000101010010111100011100101110111010011101000011111110111001110110100101100000100001101010010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '5\\r\\n00010\\r\\n5\\r\\n5 3 1\\r\\n2 1 2\\r\\n4 1 1\\r\\n3 1 3\\r\\n2 1 3\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n1100001101111101100010001011111101000101111101001000000011111001101001111101010011101100010101111010\\r\\n100\\r\\n33 74 19\\r\\n84 44 1\\r\\n2 7 87\\r\\n70 100 1\\r\\n18 97 3\\r\\n81 46 17\\r\\n64 25 35\\r\\n43 80 18\\r\\n4 17 56\\r\\n85 98 3\\r\\n10 78 3\\r\\n8 32 69\\r\\n42 49 6\\r\\n23 9 20\\r\\n69 100 1\\r\\n35 77 10\\r\\n97 48 1\\r\\n40 8 33\\r\\n29 89 8\\r\\n63 80 4\\r\\n65 20 9\\r\\n78 75 20\\r\\n47 26 9\\r\\n65 72 21\\r\\n91 86 2\\r\\n45 5 10\\r\\n13 2 39\\r\\n60 56 4\\r\\n80 8 7\\r\\n67 19 31\\r\\n38 18 27\\r\\n31 55 8\\r\\n76 34 25\\r\\n39 43 48\\r\\n28 31 44\\r\\n30 63 18\\r\\n96 8 4\\r\\n59 77 11\\r\\n26 12 2\\r\\n3 10 44\\r\\n91 73 3\\r\\n23 19 42\\r\\n23 26 1...', '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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo']}, {'input': '50\\r\\n01110011100101101001001101110101011011101011010011\\r\\n50\\r\\n10 18 32\\r\\n13 50 1\\r\\n5 42 1\\r\\n10 6 35\\r\\n47 4 4\\r\\n42 44 7\\r\\n50 7 1\\r\\n45 1 5\\r\\n14 38 11\\r\\n28 29 4\\r\\n7 48 2\\r\\n35 10 1\\r\\n12 44 6\\r\\n28 26 4\\r\\n43 4 4\\r\\n42 12 4\\r\\n47 29 3\\r\\n47 49 1\\r\\n19 47 2\\r\\n3 46 2\\r\\n9 17 23\\r\\n17 30 1\\r\\n1 31 11\\r\\n48 48 1\\r\\n14 27 9\\r\\n15 26 4\\r\\n7 32 10\\r\\n39 33 4\\r\\n8 46 3\\r\\n7 42 8\\r\\n34 25 12\\r\\n18 18 9\\r\\n41 14 6\\r\\n25 25 24\\r\\n22 26 24\\r\\n49 9 2\\r\\n27 44 4\\r\\n5 32 9\\r\\n18 34 7\\r\\n23 22 4\\r\\n16 26 12\\r\\n8 49 2\\r\\n4 10 30\\r\\n21 8 20\\r\\n26 27 5\\r\\n4 29 14\\r\\n32 22 2\\r\\n34 40 2\\r\\n26 49 1\\r\\n6 13 34\\r\\n', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO']}, {'input': '5\\r\\n11010\\r\\n5\\r\\n2 1 4\\r\\n3 5 1\\r\\n4 2 1\\r\\n4 5 1\\r\\n2 4 2\\r\\n', 'output': ['No\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes', 'NO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES']}, {'input': '50\\r\\n01110100101100100100011001100001110010010000000101\\r\\n50\\r\\n27 18 7\\r\\n22 35 2\\r\\n50 35 1\\r\\n41 16 1\\r\\n27 5 5\\r\\n11 6 33\\r\\n7 19 2\\r\\n9 12 33\\r\\n14 37 4\\r\\n1 22 8\\r\\n22 3 5\\r\\n50 42 1\\r\\n50 38 1\\r\\n29 20 2\\r\\n20 34 17\\r\\n20 4 29\\r\\n16 21 3\\r\\n11 43 3\\r\\n15 45 1\\r\\n12 28 3\\r\\n31 34 13\\r\\n43 1 8\\r\\n3 41 1\\r\\n18 3 13\\r\\n29 44 6\\r\\n47 44 3\\r\\n40 43 2\\r\\n6 46 5\\r\\n9 12 35\\r\\n19 45 2\\r\\n38 47 4\\r\\n19 47 3\\r\\n48 3 1\\r\\n16 12 9\\r\\n24 18 2\\r\\n32 40 4\\r\\n16 28 11\\r\\n33 22 12\\r\\n7 16 9\\r\\n17 30 3\\r\\n16 13 26\\r\\n46 24 5\\r\\n48 17 2\\r\\n25 32 15\\r\\n46 19 1\\r\\n40 29 2\\r\\n36 34 10\\r\\n47 27 4\\r\\n43 18 6\\r\\n4 10 12\\r\\n', 'output': ['Yes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo', 'YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO']}, {'input': '200000\\r\\n01101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101100110100110010110100101100110100101101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '100000\\r\\n10010110010001011010100111111011011010010101001110001111111011110001100100001010101101111000010101011011101000000011001100011100111111000111111111001001011110000111000011101110001001001010010000100111001010110100100001100110101000110001001001111010000110001111101010110110010100101010101010011110011000001011010010010110111000011110001011110011011101001001011001111010110101010001111011001101001100000101100101000111110010000001010110000000110111110000010011110111100111101110001001000011110100111100011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01000010110111000011001001110000111001000101000001101110100010110101001101100011101110000111100000110010010001110011111011011101000111001111010010000001001100000100000101101000110101011001101110111000111011111001111000001010010001001000011000100111110101000111011001110101001100100001110001100001110111101110111100011011000011110000010001010100001011001100111100011010010001010011111000111101011101110111100111100010110011110111100111111001111100110110011001111001111010001111000001010110000100010111100...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '1\\r\\n1\\r\\n200\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...', 'YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nY...']}, {'input': '2\\r\\n00\\r\\n200\\r\\n1 1 2\\r\\n2 1 1\\r\\n1 1 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 1 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 1 2\\r\\n2 2 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 ...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...', 'YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nY...']}, {'input': '3\\r\\n101\\r\\n200\\r\\n2 2 2\\r\\n3 2 1\\r\\n3 1 1\\r\\n2 2 2\\r\\n2 1 2\\r\\n1 3 1\\r\\n1 1 2\\r\\n1 3 1\\r\\n3 3 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 3 1\\r\\n3 3 1\\r\\n1 1 3\\r\\n3 3 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 2\\r\\n3 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n1 1 2\\r\\n3 2 1\\r\\n2 2 2\\r\\n3 1 1\\r\\n1 2 2\\r\\n1 3 1\\r\\n1 1 1\\r\\n3 3 1\\r\\n1 2 1\\r\\n2 2 2\\r\\n1 1 2\\r\\n2 3 1\\r\\n3 1 1\\r\\n2 3 1\\r\\n2 3 1\\r\\n2 1 1\\r\\n3 1 1\\r\\n2 3 1\\r\\n2 3 1\\r\\n3 2 1\\r\\n2 2 1\\r\\n3 3 1\\r\\n2 1 2\\r\\n2 2 2\\r\\n1 3 1\\r\\n1 1 2\\r\\n3 1 1\\r\\n3 2 1\\r\\n3 2 1\\r\\n3 1 1\\r\\n2 2 2\\r\\n2 2 1\\r\\n2 2 2\\r\\n2 1 1\\r\\n1 1 3\\r\\n1 2 2\\r\\n3 3 1\\r\\n2 2 2\\r\\n3 3 1\\r\\n3 3 1\\r\\n3 2 1\\r\\n1 3 1\\r\\n2 1 2\\r\\n1 1 1\\r\\n3 2 1\\r\\n2 3 1\\r\\n2 1 1\\r\\n1 3 1\\r\\n3 3 1\\r\\n2 1 2\\r\\n1...', 'output': ['Yes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\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\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes...', 'YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\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\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES...']}, {'input': '10\\r\\n0010010101\\r\\n200\\r\\n5 2 3\\r\\n8 2 1\\r\\n7 4 4\\r\\n8 4 2\\r\\n6 8 1\\r\\n5 7 3\\r\\n8 4 3\\r\\n7 4 4\\r\\n3 4 5\\r\\n9 1 2\\r\\n7 2 2\\r\\n9 8 1\\r\\n3 1 2\\r\\n1 9 1\\r\\n9 5 2\\r\\n2 6 4\\r\\n6 3 1\\r\\n1 4 7\\r\\n10 1 1\\r\\n7 6 1\\r\\n6 10 1\\r\\n9 8 2\\r\\n8 4 2\\r\\n7 8 2\\r\\n4 8 3\\r\\n8 5 2\\r\\n9 9 1\\r\\n3 3 8\\r\\n5 9 2\\r\\n2 10 1\\r\\n3 9 1\\r\\n1 6 3\\r\\n6 9 2\\r\\n4 7 2\\r\\n1 9 2\\r\\n6 7 3\\r\\n7 1 1\\r\\n5 5 5\\r\\n4 3 1\\r\\n2 6 2\\r\\n4 4 4\\r\\n3 10 1\\r\\n6 4 1\\r\\n4 9 1\\r\\n1 10 1\\r\\n2 10 1\\r\\n9 7 2\\r\\n8 1 2\\r\\n7 1 1\\r\\n10 7 1\\r\\n5 9 1\\r\\n7 1 1\\r\\n7 6 4\\r\\n2 2 9\\r\\n4 1 5\\r\\n9 5 2\\r\\n9 2 1\\r\\n2 2 1\\r\\n9 2 1\\r\\n1 2 8\\r\\n7 5 1\\r\\n1 7 1\\r\\n2 10 1\\r\\n6 8 2\\r\\n5 3 2\\r\\n3 7 3\\r\\n8 2 2\\r\\n8 10 1\\r\\n7 2 2...', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nYES\\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\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES...', 'Yes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nYes\\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\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes...']}, {'input': '500\\r\\n11000010101101111101111110011100110000110010101001100111100100010101001000011010111101111110001000110010001101000100110011100011010110001000000011100111100111101100101000101100001101100011011101101000001000011111100011110001100101010110101001011010001101100101111101000001000110001010011111000111000111010001111011110101001110010001011100011110111100110101110100011011110100010110011101011100011101101110111011101101000011000011101010011010011011001011001010010100101001010111100010100000101010100000\\r\\n2000...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '1000\\r\\n1000011001001011010111011001010110101110111101011101101001111001111101000011101110011011101010110101001000011000101110101011010001101100100001001010111000101110101000110000110101011111001100001011111101010101000110000100110000100010110111110100011111100011111001001010011100000010111011101100010100000001100000000100101000000110101111000100010110110111010001001110011111010101001010000111010100110110010001010111100011001001001001111111101100110010010100101100001100010111101111011001111010111101010010101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '14227\\r\\n001101111010010010111101010111010010010100111111011110110101100111101001000000100111011101100011001110010011001011010000110101001110111010010101000010001010100001100001100111010000111111010101010110101001001010110000010110111000000010111101011100000011100001000101100011011110101111011100001001011000000011000101001000011001011000101101101100110101000010001101101101100010000111010010100000110000001111101001111101011101000111100001111001011000110011101101101001111011110010010000010001001111100000111010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '10\\r\\n1101011011\\r\\n10\\r\\n10 3 1\\r\\n10 10 1\\r\\n5 10 1\\r\\n10 4 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n10 4 1\\r\\n4 5 2\\r\\n3 5 3\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO', 'No\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n1101101100000011011011011011011000011000111000011000111111001111010011000011110011000011011110011000\\r\\n1000\\r\\n44 42 12\\r\\n67 64 19\\r\\n61 36 40\\r\\n67 46 5\\r\\n44 63 20\\r\\n39 45 39\\r\\n65 68 8\\r\\n44 37 28\\r\\n38 45 30\\r\\n38 66 26\\r\\n41 70 6\\r\\n39 45 32\\r\\n42 46 24\\r\\n43 44 57\\r\\n67 45 9\\r\\n63 65 32\\r\\n37 40 60\\r\\n63 63 2\\r\\n66 71 30\\r\\n62 61 14\\r\\n40 67 12\\r\\n69 66 25\\r\\n61 37 2\\r\\n41 66 5\\r\\n71 44 2\\r\\n65 67 7\\r\\n62 36 9\\r\\n42 38 51\\r\\n37 41 60\\r\\n37 42 58\\r\\n41 61 18\\r\\n41 36 47\\r\\n66 67 14\\r\\n70 71 19\\r\\n39 62 15\\r\\n70 63 26\\r\\n68 71 2\\r\\n42 36 16\\r\\n40 44 41\\r\\n66 63 14\\r\\n61 44 27\\r...', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'Yes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n01000100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010001010001010001000101000101000100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00010101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101010001010001010100010100010101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101010001010001010100010100010101000101010001010001010100010101000101000...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00011111010001111101011001111100010111011011011101110001110110111101111111011101100101100111011111011111101101011100110101111001011100110101011110010011011101011011010110110111110111111101111001010001001101111101111101100111011001111111110111011001011100011111110001110111011001111101110001001101111101110011011100010111011001111101011001110011010111001111011101111100110111110110010111110110011100110111011101100111010001110011011111011100010111100101111100011111011111000101111011011101001101110111011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01110111100101111100010101001101110111110001111111110101110011110111110101111111000111011100011101110111011110010101100101011100011101110111001101110100011111011111011101100111110111011111001101010110011101111111010110110111010110110101110111110011010111011100110101111111001101111101110111011011010111011011110101010001010101100101110110010111011101100111011101110001111101110001110111110111011011011101111111110001111111010111011001010111110011010100011101110101100111011111010110011101001101111101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01111011011000001101111001100001100000110000001100110011011000011110001101100011011011110110110000000111101100110001100111100001101100110001100110011011110011011011111100011000110001100110001100011011001100000001100011001111111100011011000001111110110110001100110011000110110000011011011011000011001111001111000011110110110110110000110110110110110011000110110001100011011011110001100000111100000110000111101100011011000000110001100000001111011011001100111100110011110001100000110011011000011110111101101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '200000\\r\\n11110011110110110000000011011000111100111111011011000111100001100001111000000011001100110000011011000000011110000011000000110001100011000011000000000011011110011110111100000011110111100111100011110110000011000110001100000110000011011111101100110000110110110110110110111100001101100000001100011110110111100011011001111011001100011110110110110000011001100001100000000000011001101101100011011110001100011000110000110001100000111100000000110000111101100011000000000011001111000011110110110000011011110001111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r...']}, {'input': '10\\r\\n1100111011\\r\\n10\\r\\n10 10 1\\r\\n5 4 5\\r\\n6 10 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n5 5 4\\r\\n6 10 1\\r\\n4 6 4\\r\\n10 10 1\\r\\n6 10 1\\r\\n', 'output': ['Yes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes', 'YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES']}, {'input': '100\\r\\n0110011011001100110001100110011001111011011011101100110110000110110100111100110110001100101100000110\\r\\n1000\\r\\n66 69 2\\r\\n72 92 4\\r\\n85 71 4\\r\\n94 50 3\\r\\n45 85 5\\r\\n94 52 2\\r\\n65 89 9\\r\\n70 89 8\\r\\n64 45 35\\r\\n84 44 13\\r\\n93 52 1\\r\\n71 43 10\\r\\n88 73 7\\r\\n93 45 6\\r\\n71 71 10\\r\\n70 46 18\\r\\n44 43 52\\r\\n87 65 2\\r\\n52 86 15\\r\\n71 88 6\\r\\n44 69 28\\r\\n44 48 26\\r\\n91 63 4\\r\\n85 84 13\\r\\n90 70 4\\r\\n85 63 12\\r\\n50 46 51\\r\\n72 46 17\\r\\n92 49 9\\r\\n69 71 11\\r\\n90 91 10\\r\\n91 69 3\\r\\n63 43 35\\r\\n48 92 8\\r\\n84 89 10\\r\\n65 64 8\\r\\n89 89 1\\r\\n73 73 10\\r\\n70 47 4\\r\\n73 84 11\\r\\n50 68 29\\r\\n69 64 3\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r...', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r...']}, {'input': '200000\\r\\n00010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', '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\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nN...', 'NO\\r\\nNO\\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\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nN...']}, {'input': '200000\\r\\n01000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010...', 'output': ['No\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\n...', 'NO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...']}, {'input': '200000\\r\\n01100111010101110111010111011111111101011111110101010111011101110111010111010111011111011101110111010111010101010101110111111101111111011111011101110111011111010101111101110111010101111101110111110111010101010111011111011101110111011111011111011111011111010101011101110111010111011111011111011101110111110101110111011101110101111101110101110101111111011101011111011101011101010111110111011111010111110101111101111101110111010111011101110111110101011111110101010101010101011111011111010111011111010101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n11010110011101100111011001000101101101110011011111110110011111000111111100011101100111000111111101100111000111000111110011010001111101100100011111000111001101110011010001110110110111111111110011110101100101100111011011010110110111110110110111110001111101100111000111110001111100011100010001000101100101100111011110011100011100010011011111000111001101110110010011110111110001110011110100110100011111011001110011110111001101111100110111000100011100010111100100011100011100111101111111011001110011011101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n11001100000011110110001111110110011011000001101100000001100001101101101111011000000001101111011111100011110011001100011011110001101101101111011011000000000110110110110110011111100110011001101100110011001100011011000011011000000011110000001111001100000001101111000011000000011011011110110000001111011110111101100001101100000000000111100011001100011011000110001100110011011011000000000011000111100011011011011001101101111011000001101101111000001100000000110110001101100110000110110011000110011110110110011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n01111110000110000011011011011000000110110110111101100011011001100000011000110011001100000110000000011111100110110011000110110000000110110110001111011011001100000001100110110111100011001100000000110110000110110001100011000011011011011001100011011000110110001111001101100110011110000000011000110110011000111100110001101100000111101111000011011000011011011011000110110110110110000011000110011110000111101100001101100001101100111100011000011110001111000001100000001111011110000011000110110110110111101101100...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '200000\\r\\n11111111111111111111111101111111111111111011111111111111110111111111111111111111111011111111111111111111111111110111111111111111111111111110111111111111011111111111111011111111111111111111110111111111111111111110111111111111111111111101111111111111111011111111111111110111111111111110111111111111111111111111111101111111111111111111101111111111110111111111111111111111111011111111111101111111111110111111111111011111111111111111101111111111111111110111111111111111111111111011111111111111111111111111110...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '200000\\r\\n11111111111111111111110111111111111011111111111111110111111111111111111111101111111111011111111111111111111111111111101111111111111111011111111111111111111111101111111111111111011111111111111111111111111111101111111111111111111101111111111110111111111111111111111101111111111111111111111011111111111111111111111101111111111111111110111111111111011111111111111110111111111111111101111111111111111111111110111111111111111111011111111111111111111111111011111111111111111111011111111111111111111111111111101...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n11111111111111111111111111111111110111111111111110111111111111111111111111110111111111101111111111111111111111111101111111111111111111101111111101111111111111101111111111111111111101111111111110111111111111111101111111111111101111111111011111111111111111111011111111011111111111111111111110111111111111111101111111111111101111111111111111111101111111111111111111101111111111111111011111111111111111111111101111111111111111111111111111111101111111111111111111111011111111011111111111111011111111111111011...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n11111111111101111111111111111111101111111101111111111111111111101111111111111111110111111111111111101111111111111111111111110111111111111111111111111011111111110111111111111111111111111011111111111111110111111111111111111110111111111111111101111111111110111111111111111111111101111111111111111111101111111111111111111111111111110111111111111011111111111111111111111111011111111011111111111111111111111101111111111111101111111111111111111111111111011111111111111111101111111111110111111111111011111111111...', '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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r...']}, {'input': '200000\\r\\n11111111111111110111111111111111111110111111111111111111111101111111111111111111111110111111111101111111111111111110111111111111111101111111111111111011111111111111011111111111111011111111111111110111111111111111111111111011111111111111111101111111111111111111101111111111110111111111111111101111111111111111111111111111011111111111111110111111111111111101111111111111111111111110111111111111111111111101111111111111111111111110111111111111111111110111111111111111111111111011111111111111111101111111111...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n11111111111111011111111111111111101111111111111111111111111111111101111111111011111111111111110111111111111111111011011111111111111111111111111110111111111111111111111111110111111110111111111111111111111111111111110111111111111111101111111111111101111111111011111111111111111111110111111111111111111111111011111111111111110111111111111111111110111111111111111111011111111111111110111111111111110111111111111111111111101111110111111111111111111111101111111111111111011111111111111111111111111111111011111...', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n11111111111111110111111111111111111110111111111111111111111111111101111111111111111110111111111111111111011111111111111011111111111111111111111101111111111111101111111111110111111111111111111111111011111111111111011111111111111111111111111110111111111111111111111111111111110111111111111111101111111111111111111111011111111111111111111110111111111111111111111111011111111111111111111111111111101111111111111111111111111111110111111111111111111111111011111111111111111111011111111111111111101111111111011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '200000\\r\\n11111111111101111111111110111111111101111111111111111111101111111111111111111101111111111111101111110111111111111111101111111111011110111111111111111111110111111111111011111111111111111111011111111111111011111111111111110111111111111111111111111111101111111111111111011111111111111111111110111111111101111111111111101111111111111101111111111110111111111111111101111111111111111111111111101111110111111111101111111111111111111111011111111111111111111110111111111111111101111111111111101111111111111111111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101010111010101010101010101010101010101010101010111010101010101011101010101010101010101010101011101010101010101010101110101010101010101011101010101010101010101010101010101010101010101110101010101010101010101110101010101010101010101010101010101010101010101010101010101010101010101011101010101010101110101010101010101010101010101010101010101010111010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n01001001010010010100101001001010010010100111010010010100101110010010100100101001010010010100101101110100101001001010010100100101110010010100111010010011101001010010010100100101001010010010111001001010010100100111011100101001001010010010100101001001010010010100101001001010010100100101110011100101001010010010100101001001010010010100101001001010110100101001010010010100101011010010100100101001010010010100101001001010010010100101001001011100100101001010010010101101010010010100100101001010010010100100101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00101001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001010010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\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\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r...', 'NO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\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\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r...']}, {'input': '200000\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\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\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\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\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010111101001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010011101001001010010100100101001010010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010111010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['Yes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes...', 'YES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES...']}, {'input': '131072\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No', 'NO']}, {'input': '131072\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No', 'NO']}, {'input': '10000\\r\\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['No']}, {'input': '2000\\r\\n0101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010...', 'output': ['No']}, {'input': '8000\\r\\n0101010101010101010101010101010101100101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101100101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '8000\\r\\n0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '2000\\r\\n0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101100101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '4000\\r\\n0010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001010000010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000010000000001000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000...', 'output': ['No']}, {'input': '200000\\r\\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...']}, {'input': '20000\\r\\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2738\\r\\n1010001001010100100000001010010100010010000100010101010100100100100100101001010100101010001010100010010101001000000010100101000100100000100010010101001000000010100101000100100001000101010101001001001001001010010101001010100010101000100101010010000000101001010001001000001000100101010010000000101001010001001000001000100101010010000000101001010001001000010001010101010010010010010010100101010010101000100001010101010010010010010010100101010010101000100001010101010010010010010010100101010010101000101010001...', 'output': ['No']}, {'input': '104\\r\\n01000100100101000001001000100001010100010011111111110101001010010100010101001010010101001010101010101010\\r\\n1\\r\\n1 53 52\\r\\n', 'output': ['No']}, {'input': '96\\r\\n000100000000001000010010010010001010100111111111101010010010001010101000100100100101010001010010\\r\\n1\\r\\n1 49 48\\r\\n', 'output': ['No']}, {'input': '2842\\r\\n0100101010010101010101010010010010010010100101000101000100100010101010100010100100101000001000010001001000101010101000101001001010000010000100010010001010101010001010010010100000100001001010100101010101010100100100100100101001010001010010101001010101010101001001001001001010010100010100010010001010101010001010010010100000100001001010100101010101010100100100100100101001010001010010101001010101010101001001001001001010010100010100010010001010101010001010010010100000100001000100100010101010100010100100101...', 'output': ['No']}, {'input': '3026\\r\\n1001010100100101010010010010010101010001001010101001010010101010010101010010100101010100100100100101000101010010010101001001001001010101000100101010100101001010101001010101001010010101010010010010010100010101001001010100100100100101010100010010101010010100101010100101010100101001010101001001001001010001010100100101010010010010010101010001001010101001010010101010010101010010100101010100100100100101000101010010010101001001001001010101000100101010100101001010101001010101001010010101010010010010010100010...', 'output': ['No']}, {'input': '2000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '24000\\r\\n011001011010101010100110100101010101011001100110010101010110010110101001101001100101100110100110100110011010011001101010100101101010101010011010010101010101100110011001010101011001011010100110100110010110011010011010011001101001100110101001011001011001011010010110010101010110010110101010101001010110101010101001101001100101011010100101010110010110010110101010100101100101101001011001010101011001011010101010100101011010101010100110100110010101101010010101011001011001011010101001011001011001011010100101...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '160\\r\\n1010010101100101100110101010100101010110100101011001100110101001011010101001100101011010101010101001100101010101011010011001010110011010011001101001100101100101\\r\\n1\\r\\n1 81 80\\r\\n', 'output': ['No']}, {'input': '240\\r\\n011010101001011010100110101001011001011010100101100110011001011010010101010110100110010110100101101001101001101001010110011010010101011010011010010101010110011001100110101001010101100110101001100110101010100101010101011010010101010110101010\\r\\n1\\r\\n1 121 120\\r\\n', 'output': ['No']}, {'input': '6000\\r\\n0110101001100101100110100101101010100101101010100110101010010101011001011010100101100110100110010101100101101001100101100110101010011010100110101001100101100110100110010101010110011010101010101001101001100110011010010110100110101010101001100110100110011010010110100110100110100110101010100101011001100101101010101001101010010110101001100101100101101010010110100110011010100101010110101001010101011001010110101010010110010101100101100110100110010101010110101001101001100101010101100101101001011001101001101...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '160\\r\\n0101100101011001100110101010100110011001101001101010100101011010011001010110010110011010010101011001010101100110010110010110101010010101100110101010101010010110\\r\\n1\\r\\n1 81 80\\r\\n', 'output': ['No']}, {'input': '240\\r\\n010101010101010101011001011001101010011010011010101001010101101010100101100101011010101001010101011001100110010110011010010101010101010101100101100110101001101001101010100101010110101010010110010101101010100101010101100110011001011001101001\\r\\n1\\r\\n1 121 120\\r\\n', 'output': ['No']}, {'input': '182\\r\\n00101000101001010000010010100000100100010000001010100100001000010101000000000000100000100001001000000000000010100000100101000000010001000010100000001000100001001010101010000100000101\\r\\n1\\r\\n1 92 91\\r\\n', 'output': ['No']}, {'input': '248\\r\\n01011010011010101001010101011001101001101001100110100110101001101001010101100101011001010101100110010101010101011010101010100110100110101010010101010110011010011010011001101001101010011010010101011001010110010101011001100101010101010110101010101001\\r\\n1\\r\\n1 125 124\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010100110101010101010100110101010101010101010101010101010101010101001101010011010101010101010101010101010101010101010101010100110101010101010101010101010011010101010011010101010101010101010101010101010101010100110101010101010101010101001101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101001101010101010011001101010101010101010101010101010101010101001101010101010101010101010100110101010101010101010101010101001101010101010101010101001101010101001101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010101010011010101010101010100110101010100110101010101010101010101010101010101010101010101010011010101010011010101010101010101010101010101010100110101010101010101010101010100110101010011010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101001101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001101010101001101010101010101010101010101010011001101010101010101001101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n010110100110010110011010101010100110011001101010011010010110101010101010101010101010101010101010010110010110101001101001011010010110101001010110100110101001101010011010010110101010011010101001011001101010011010011001100101011010011010100101101001010101100101011001101010011001011010101010101010101010011001101010101001101010011001100101011001011010101001101001101001100101011001100101011010100110100101100110101010100101011010100101100110011010101001011010101001010101011010101010011010011010101001010101...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010100110101010101010101010101010100110101010101010101010101001101010101010101010011010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101010011010101010101010101010101010101010100110101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010101010100110101010100110101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '238\\r\\n0100010101001010101000010001000001000100100101001000000010000001010100101010101001010010111111111111111111111111111111110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100\\r\\n1\\r\\n1 120 119\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n100110101010101010101001011010101010101010101010101001101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101001011010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101010100110101001101010101001101010100110101001101010101010101010011010101010011010101001100110101010101010100110101010101010101001101010101010101010101010101010011010101010100110101010101010101001101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010100110101010101001101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010011010101010101010101010101001101010101010101010101010011010011010101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010101010100110101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001011010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101001101010101010101010101010101001101010101010101010101010101010101010101010101010101001101010100110011001101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010101010101010101010011010101010101010101010011010101010011010011010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001011010101010101010101010101010101010101010101010101001010101101010101010101010101010101010...', 'output': ['No']}, {'input': '358\\r\\n0100100101000100100001010010000001000010000101000010100100100100000000100010100001001001001000010010010100101010001010001010001111111111111111111111111111111111111111111111111111110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100\\r\\n1\\r\\n1 180 179\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n101001101010101010101010100110101010101010101010101010011010101010101010101010011001101010101010101010101010101010101010101010101010101010101001101010101010101010101010100110101010101010101010101010101010010110101010101010101010101010101010100110101010101010101001101010101010101010011010101010101010101010101010011010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101001011010100101100110101010101010101010101010101010101010101010101010101010101010101010101001101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010100110011010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010100110101010101010101001101010101001101010101010101001101010101010101010101010101010101010101010101010101010101010011010101010101010101010101010011010101001100110100101101001101010101010101010101001101010101010101010100110011010101010101010101010101010011010101010101010101010101001101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010011010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010100110101010101010101001101010101010101010011010101001100110011010101010101010101010101010011010101010101010101010101010101010101010101010101001101010101010101010101010101010011001101010101010101010101010101010101010101010101010011010101010101010011001101010101010101010101010101010101010101010101010010110101010100110101010101010100110010101101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '5460\\r\\n0000000100000000000000000000101000000000000000000000010000000010010000000000100000000000000000000000100000000000100000000000100000010000000001000101000000000001000100000000000000000000000000000010000000000010000000001000001010000001000000000000001000000000000000000000000000000000000000100000100010010100000000000000100001000000000000000000000000000010001000010000000000000001000000010000100000000000100000001000000010001000000000000001010000001000000000000000000000000000000000000000000001000100000100010...', 'output': ['No']}]","id":468} {"difficulty":2600,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"a06ebb2734365ec97d07cd1b6b3faeed","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.*\nimport java.util.*\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author aryssoncf\n *\/\nobject programkt {\n @JvmStatic\n fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream: OutputStream = System.out\n val `in` = InputReader(inputStream)\n val out = OutputWriter(outputStream)\n val solver = D1FrequencyProblemEasyVersion()\n solver.solve(1, `in`, out)\n out.close()\n }\n\n internal class D1FrequencyProblemEasyVersion {\n fun solve(testNumber: Int, `in`: InputReader, out: OutputWriter) {\n val n = `in`.readInt()\n val a = `in`.readIntArray(n)\n MiscUtils.decreaseByOne(a)\n val counter: MutableMap = HashMap()\n for (x in a) {\n counter[x] = counter.getOrDefault(x, 0) + 1\n }\n var mf = 0\n val m = ArrayUtils.maxElement(a) + 1\n for (i in 1 until m) {\n if (counter[i]!! > counter[mf]!!) {\n mf = i\n }\n }\n var ans = 0\n for (x in 0 until m) {\n if (x != mf) {\n ans = Math.max(ans, solve(n, a, mf, x))\n }\n }\n out.printLine(ans)\n }\n\n fun solve(n: Int, A: IntArray, a: Int, b: Int): Int {\n val ca = ArrayUtils.count(A, a)\n val cb = ArrayUtils.count(A, b)\n val goal = ca - cb\n val pos = IntArray(ca + cb + 1)\n pos[cb] = n\n var delta = 0\n for (i in n - 1 downTo 0) {\n if (A[i] == a) {\n delta++\n } else if (A[i] == b) {\n delta--\n }\n if (pos[delta + cb] == 0) {\n pos[delta + cb] = i\n }\n }\n var ans = 0\n delta = 0\n for (i in 0 until n) {\n ans = Math.max(ans, pos[goal - delta + cb] - i)\n if (A[i] == a) {\n delta++\n } else if (A[i] == b) {\n delta--\n }\n }\n return ans\n }\n }\n\n internal class OutputWriter {\n private val writer: PrintWriter\n\n constructor(outputStream: OutputStream?) {\n writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))\n }\n\n constructor(writer: Writer?) {\n this.writer = PrintWriter(writer)\n }\n\n fun close() {\n writer.close()\n }\n\n fun printLine(i: Int) {\n writer.println(i)\n }\n }\n\n internal object MiscUtils {\n fun decreaseByOne(array: IntArray) {\n for (i in array.indices) {\n array[i]--\n }\n }\n }\n\n internal class InputReader(private val stream: InputStream) {\n private val buf = ByteArray(1024)\n private var curChar = 0\n private var numChars = 0\n private val filter: SpaceCharFilter? = null\n fun readIntArray(size: Int): IntArray {\n val array = IntArray(size)\n for (i in 0 until size) {\n array[i] = readInt()\n }\n return array\n }\n\n fun read(): Int {\n if (numChars == -1) {\n throw InputMismatchException()\n }\n if (curChar >= numChars) {\n curChar = 0\n numChars = try {\n stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n if (numChars <= 0) {\n return -1\n }\n }\n return buf[curChar++].toInt()\n }\n\n fun readInt(): Int {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt()) {\n throw InputMismatchException()\n }\n res *= 10\n res += c - '0'.toInt()\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun isSpaceChar(c: Int): Boolean {\n return filter?.isSpaceChar(c) ?: isWhitespace(c)\n }\n\n interface SpaceCharFilter {\n fun isSpaceChar(ch: Int): Boolean\n }\n\n companion object {\n fun isWhitespace(c: Int): Boolean {\n return c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1\n }\n }\n }\n\n internal object ArrayUtils {\n fun maxElement(array: IntArray?): Int {\n return Arrays.stream(array).max().asInt\n }\n\n fun count(array: IntArray, value: Int): Int {\n var result = 0\n for (i in array) {\n if (i == value) {\n result++\n }\n }\n return result\n }\n }\n}","description":"This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved.You are given an array $$$[a_1, a_2, \\dots, a_n]$$$. Your goal is to find the length of the longest subarray of this array such that the most frequent value in it is not unique. In other words, you are looking for a subarray such that if the most frequent value occurs $$$f$$$ times in this subarray, then at least $$$2$$$ different values should occur exactly $$$f$$$ times.An array $$$c$$$ is a subarray of an array $$$d$$$ if $$$c$$$ can be obtained from $$$d$$$ by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.","input_specification":"The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 200\\,000$$$)\u00a0\u2014 the length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le min(n, 100)$$$)\u00a0\u2014 elements of the array.","output_specification":"You should output exactly one integer \u00a0\u2014 the length of the longest subarray of the array whose most frequent value is not unique. If there is no such subarray, output $$$0$$$.","notes":"NoteIn the first sample, the subarray $$$[1, 1, 2, 2, 3, 3]$$$ is good, but $$$[1, 1, 2, 2, 3, 3, 3]$$$ isn't: in the latter there are $$$3$$$ occurrences of number $$$3$$$, and no other element appears $$$3$$$ times.","sample_inputs":["7\n1 1 2 2 3 3 3","10\n1 1 1 5 4 1 3 1 2 2","1\n1"],"sample_outputs":["6","7","0"],"human_solution":"fun main() {\n val n = readInt()\n val a = readInts()\n assert(n == a.size)\n val m1 = a.groupBy { it }.maxByOrNull { it.value.size }!!.key\n var res = 0\n for (m2 in a.groupBy { it }.keys - m1) {\n var sum = 0\n val index = IntArray(2*n+2) { -1 }\n index[0+n] = 0\n for (i in a.indices) {\n sum += when (a[i]) {\n m1 -> 1\n m2 -> -1\n else -> 0\n }\n val begin = index[sum + n]\n if (begin < 0) {\n index[sum + n] = i + 1\n } else {\n res = maxOf(res, i + 1 - begin)\n }\n }\n }\n println(res)\n}\nprivate val inp = System.`in`.bufferedReader()\nprivate fun readLn() = inp.readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \").filter { !it.isBlank() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readInts() = readStrings().map { it.toInt() }\n","testcases":"[{'input': '7\\r\\n1 1 2 2 3 3 3\\r\\n', 'output': ['6']}, {'input': '10\\r\\n1 1 1 5 4 1 3 1 2 2\\r\\n', 'output': ['7']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '20\\r\\n4 16 13 4 5 7 9 6 3 12 2 4 5 2 5 9 9 4 14 11\\r\\n', 'output': ['19']}, {'input': '200000\\r\\n2 1 2 2 2 2 2 2 2 1 1 2 1 2 2 2 1 1 2 1 2 2 2 1 2 1 1 2 2 1 1 1 1 1 2 2 1 1 2 1 1 2 1 2 1 1 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 1 2 1 2 2 1 2 2 2 2 2 2 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 1 1 1 2 1 1 1 1 2 2 2 2 2 1 2 2 2 1 2 2 1 1 2 2 2 1 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 2 2 2 2 2 2 2 1 1 2 2 1 1 2 2 2 1 1 2 2 1 2 1 2 1 1 1 1 2 2 2 2 1 1 2 2 1 2 2 2 1 2 2 1 2 2 1 1 1 1 2 2 2 1 1 2 1 1 2 2 2 1 2 2 1 2 1 1 1 2 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2...', 'output': ['198288']}, {'input': '200000\\r\\n16 30 7 9 23 11 7 13 3 10 13 16 9 12 27 19 15 8 7 2 21 30 5 13 28 7 10 15 10 1 21 25 5 22 24 3 18 19 20 4 28 24 1 11 24 18 10 27 21 26 4 1 24 25 19 28 25 25 2 21 23 15 14 28 19 16 3 24 6 27 25 18 1 30 10 19 25 25 4 23 27 5 4 6 18 1 20 17 4 4 15 22 13 27 30 29 4 20 9 12 30 23 30 10 5 16 13 9 22 20 28 6 12 17 18 25 26 8 7 6 15 17 8 2 16 25 3 20 17 21 22 12 9 17 22 9 3 16 21 16 29 28 1 12 20 13 9 18 10 6 17 13 11 9 17 14 26 1 8 15 5 15 8 5 2 20 16 15 13 6 22 30 13 29 21 3 4 20 9 7 6 25 26 6 10 14 10 1...', 'output': ['90907']}, {'input': '200000\\r\\n23 6 11 92 5 69 91 53 2 34 26 67 44 7 24 83 7 23 3 27 85 12 39 84 43 51 11 59 45 19 30 3 46 50 87 48 2 6 5 28 19 38 4 53 60 54 14 79 89 79 71 12 25 96 37 40 90 22 48 1 84 13 16 13 18 12 10 63 80 90 15 24 36 87 73 12 93 31 68 95 83 8 30 68 13 95 11 21 97 99 2 13 3 69 66 85 6 1 34 56 62 24 74 27 73 72 80 34 15 11 35 24 33 16 83 75 89 76 2 21 28 34 25 84 67 20 61 4 59 20 99 55 53 64 61 8 30 2 98 53 12 25 22 48 51 46 59 51 70 7 93 75 20 35 11 93 70 81 44 60 95 85 91 85 15 78 96 3 68 83 12 92 98 28 45 1...', 'output': ['82135']}, {'input': '200000\\r\\n25 22 59 57 59 5 32 2 10 35 31 45 23 47 37 24 51 28 12 38 33 37 13 45 21 16 31 37 13 48 45 39 27 40 32 39 57 17 10 46 44 8 4 56 14 5 25 23 17 53 37 34 5 41 36 39 26 1 52 2 59 54 38 36 4 8 22 8 5 21 18 53 44 60 31 39 11 15 51 53 12 17 28 1 55 53 24 16 24 13 39 30 18 11 25 51 13 8 13 21 9 52 47 4 37 47 46 48 17 60 15 50 15 52 44 36 6 15 54 40 3 4 3 29 55 60 9 34 59 11 13 57 11 58 13 30 54 22 35 45 20 52 7 27 5 11 21 29 35 25 41 44 7 58 57 47 12 28 10 5 7 1 11 56 30 32 8 11 42 52 25 33 28 19 1 59 31 4...', 'output': ['73788']}, {'input': '3000\\r\\n11 5 13 48 24 13 8 31 36 24 14 15 3 21 6 19 12 17 18 49 31 11 34 15 40 31 30 31 20 9 24 10 10 3 27 2 9 25 1 35 21 13 49 21 9 11 43 7 24 37 48 38 47 35 37 14 1 12 23 32 41 13 48 16 14 12 32 10 6 3 41 29 20 32 10 1 17 33 41 10 10 4 19 49 20 24 12 26 9 41 26 12 21 46 15 5 38 31 49 41 27 43 6 15 50 9 35 7 6 39 5 21 14 8 42 49 20 16 32 7 4 38 1 27 32 2 33 31 4 24 33 29 24 31 7 40 26 16 38 32 30 19 26 7 13 9 13 39 17 12 18 34 20 15 12 34 1 48 7 25 16 1 28 2 2 29 11 39 17 11 47 24 39 2 44 44 44 31 40 48 28 ...', 'output': ['1094']}, {'input': '200000\\r\\n15 62 93 35 44 59 28 64 19 60 88 90 92 56 1 92 90 80 23 48 38 24 9 6 21 38 43 67 50 53 1 40 65 55 97 33 61 3 89 43 63 56 70 66 4 44 34 72 23 69 91 59 41 8 42 75 67 53 6 78 16 12 50 66 8 36 14 38 14 50 2 77 43 38 30 46 21 66 32 58 29 58 53 6 29 94 76 30 95 7 50 47 28 47 36 82 93 27 100 51 29 48 45 14 38 44 34 58 75 56 83 85 1 21 64 76 19 52 92 77 48 20 39 28 73 28 12 50 55 11 20 15 18 30 13 15 29 61 68 32 3 14 40 66 81 72 64 26 2 97 1 64 90 25 33 32 67 85 93 17 51 29 45 26 51 19 59 19 74 25 59 50 72...', 'output': ['53225']}, {'input': '200000\\r\\n34 45 63 3 19 59 45 45 21 25 24 21 68 25 66 11 3 84 16 49 68 14 85 100 35 66 10 18 14 75 39 21 80 64 97 98 46 65 6 39 99 63 28 92 66 32 34 84 90 49 53 65 49 14 72 99 54 1 5 13 41 52 58 90 67 55 13 57 8 18 1 42 67 97 34 83 10 47 96 80 71 18 65 44 76 78 74 10 3 9 59 8 39 9 40 75 77 70 48 29 72 61 62 81 10 71 79 19 36 30 81 70 22 75 67 68 61 58 27 93 15 86 22 48 26 94 52 36 54 21 61 49 14 15 77 65 23 22 21 35 9 62 40 55 24 92 51 88 60 19 85 44 45 42 16 48 84 80 26 58 12 25 25 85 86 74 67 24 2 48 14 63...', 'output': ['75188']}, {'input': '200000\\r\\n93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 62 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93...', 'output': ['124535']}, {'input': '200000\\r\\n30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30...', 'output': ['199983']}, {'input': '200000\\r\\n28 28 28 28 28 28 28 28 28 28 28 81 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 33 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 3 28 28 28 28 28 35 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 ...', 'output': ['133311']}, {'input': '3000\\r\\n69 69 69 69 17 69 69 69 97 69 69 69 69 69 69 69 69 69 69 69 69 4 69 69 69 69 69 69 69 69 69 69 69 69 53 69 10 69 33 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 6 6 6 6 6 6 6 6 6 6 6 6 6 34 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 10 48 48 48 48 48 48 48 48 48 48 48 62 4...', 'output': ['2504']}, {'input': '200000\\r\\n16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 9 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 14 16 16 16 16 16 16 18 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 3 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 10 16 16 16 16 16 16 16 16 1...', 'output': ['185272']}, {'input': '200000\\r\\n43 14 9 92 88 60 18 2 79 93 41 41 3 84 97 6 8 10 3 100 89 6 97 4 66 7 52 25 8 85 44 2 5 77 26 65 2 68 55 45 19 22 6 34 9 47 5 2 62 4 1 4 66 4 4 3 89 9 9 43 100 31 5 2 8 25 6 7 9 34 3 72 96 80 92 2 4 53 63 6 1 8 75 3 5 6 18 40 6 88 64 28 2 8 14 75 7 4 1 2 3 47 8 1 10 7 41 92 14 1 8 36 86 8 4 6 3 2 20 14 1 77 7 8 1 4 12 9 2 10 4 8 42 3 62 5 9 68 3 44 5 3 92 4 45 6 9 73 35 8 4 65 88 8 78 95 50 1 6 10 34 9 5 21 4 4 67 2 1 43 80 9 7 21 9 58 57 60 10 44 5 8 2 10 7 52 5 2 5 3 8 36 36 5 3 2 79 56 91 6 8 71...', 'output': ['188778']}, {'input': '200000\\r\\n12 17 13 14 12 2 6 16 14 15 20 14 4 12 1 16 12 12 1 2 9 20 11 5 7 5 3 12 18 20 19 15 16 17 1 11 16 5 10 16 16 13 13 7 8 18 17 13 19 16 19 18 15 12 18 17 18 17 6 16 12 6 11 12 6 16 2 18 18 11 16 12 16 18 14 19 17 18 7 18 11 20 16 18 2 18 9 18 18 11 18 2 13 15 6 3 8 14 20 19 10 14 17 12 19 16 16 15 20 1 14 4 12 18 19 17 12 20 3 12 5 16 16 13 14 16 11 15 14 19 18 14 18 16 15 12 14 3 17 15 19 12 19 15 12 18 14 11 17 19 11 11 16 19 18 13 13 13 12 11 14 11 20 19 12 15 16 10 13 14 19 16 19 19 8 13 19 16 1...', 'output': ['194755']}, {'input': '200000\\r\\n78 51 3 11 53 38 6 93 36 3 95 44 84 42 32 35 18 27 56 24 58 53 87 92 11 90 51 44 74 10 1 42 99 43 33 51 43 36 41 80 97 35 30 42 90 3 88 4 70 69 67 25 14 70 23 23 3 32 15 11 65 1 39 4 61 3 93 96 50 8 70 24 73 46 52 35 31 2 67 2 36 2 5 12 92 86 79 36 66 71 79 88 1 42 49 39 88 76 73 94 78 73 10 16 84 5 2 18 98 51 9 86 39 14 78 87 4 9 27 60 49 47 6 35 83 41 1 91 38 3 77 77 77 64 4 6 10 12 48 3 97 3 2 2 22 83 44 36 70 95 90 82 62 1 14 49 61 73 61 80 5 86 45 71 1 85 88 11 60 40 85 5 49 10 30 50 15 99 59 ...', 'output': ['192236']}, {'input': '3000\\r\\n5 12 30 20 15 1 21 28 8 20 74 14 25 6 4 74 39 3 23 2 23 23 9 11 95 5 5 16 46 17 6 35 13 19 8 29 20 5 52 17 20 60 25 29 89 46 42 50 4 7 20 41 36 27 3 9 13 17 12 27 26 14 12 7 10 5 94 77 2 2 25 90 23 2 9 42 25 7 15 21 49 23 10 9 27 19 25 15 1 43 28 12 24 7 18 1 22 100 26 27 36 12 72 10 49 91 10 25 34 16 1 3 52 9 91 56 26 4 23 23 10 1 19 11 80 88 22 67 9 24 22 17 24 19 21 2 62 33 21 29 75 57 6 16 13 17 13 98 1 23 100 100 49 26 26 7 15 24 12 21 67 29 10 41 27 86 97 50 5 27 32 70 78 25 16 4 18 1 24 27 9 5...', 'output': ['1749']}, {'input': '200000\\r\\n19 50 75 65 23 12 21 63 40 66 76 54 49 70 67 37 63 71 68 65 72 25 75 21 72 75 55 72 17 37 71 73 68 64 23 67 56 74 64 69 70 4 1 67 72 58 68 70 48 75 73 40 74 57 74 50 25 45 67 49 64 53 64 67 65 52 73 67 64 68 50 69 22 71 63 74 4 25 66 72 70 66 31 68 74 60 63 26 37 24 67 60 60 25 71 73 72 63 68 29 38 66 26 46 75 30 66 63 33 35 65 70 35 25 54 15 9 46 74 33 69 73 32 65 66 69 65 68 63 66 69 13 32 38 12 69 9 73 65 71 63 15 23 4 65 2 63 65 75 69 70 67 69 64 73 45 12 76 69 72 64 51 44 67 21 72 23 66 76 35 ...', 'output': ['118366']}, {'input': '200000\\r\\n59 50 11 1 14 3 57 6 12 64 9 8 14 11 40 7 12 2 4 17 16 70 13 47 32 14 28 8 2 73 69 52 50 18 15 55 9 61 25 2 52 51 13 41 11 2 14 13 17 40 30 3 9 10 4 6 53 7 5 41 53 74 8 45 6 19 44 74 3 4 54 50 32 62 3 14 1 12 6 17 6 12 32 53 8 36 2 14 58 5 41 7 14 60 4 5 8 13 8 64 68 32 4 2 61 64 69 7 5 38 20 10 75 7 44 16 11 23 70 58 50 18 69 6 36 33 68 32 10 12 1 20 2 2 11 1 3 4 4 38 13 16 11 17 48 12 47 70 60 3 10 20 16 24 7 74 8 1 4 2 9 52 42 72 9 10 17 62 14 8 32 73 14 6 11 62 11 25 8 2 25 35 8 5 8 59 68 11 58...', 'output': ['125064']}, {'input': '196049\\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 1...', 'output': ['196049']}, {'input': '7\\r\\n1 2 3 3 3 2 1\\r\\n', 'output': ['3']}, {'input': '200000\\r\\n1 2 1 1 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 1 1 1 2 1 2 1 2 2 1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 2 2 2 1 2 2 2 1 1 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 2 2 2 2 2 2 1 1 2 1 1 1 2 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 1 2 2 1 1 2 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 1 1 2 1 1 2 1 2 2 2 2 2 1 2 1 1 1 1 1 2 2 2 2 2 2 1 2 1 2 1 1 2 2 1 1 1 1 1 1 2 2 1 1 1 2 2...', 'output': ['199952']}, {'input': '200000\\r\\n2 2 1 3 2 2 2 2 2 1 2 2 1 2 3 1 1 1 1 2 1 2 2 3 1 2 1 1 1 3 3 3 2 2 1 1 3 1 1 2 1 1 1 3 2 2 1 1 2 2 1 1 1 1 1 3 1 3 3 2 1 1 3 3 3 2 2 2 2 3 2 2 1 2 3 2 2 1 3 1 2 3 2 2 1 2 2 3 3 2 1 3 3 1 1 1 3 1 1 3 3 2 2 1 1 2 3 2 2 1 2 3 2 2 2 3 2 3 1 3 1 3 1 3 1 1 2 1 2 2 3 2 1 2 2 1 1 2 2 3 3 2 3 3 3 1 2 3 3 3 3 2 2 3 1 3 2 1 2 1 3 2 2 3 1 2 2 2 1 3 2 2 3 3 1 1 2 2 3 1 2 3 3 1 3 1 2 2 2 2 1 1 3 1 3 2 2 1 1 3 1 2 3 1 3 1 1 2 3 3 3 1 1 1 2 2 2 3 2 2 2 2 3 3 3 2 1 2 2 3 3 1 2 2 1 3 2 2 1 3 1 1 3 3 1 3 2 3 2 1 1 3...', 'output': ['134599']}, {'input': '20\\r\\n17 13 7 1 12 11 4 12 3 15 8 17 8 19 16 3 7 8 3 17\\r\\n', 'output': ['20']}, {'input': '200000\\r\\n1 1 2 2 2 2 1 1 1 2 2 1 2 1 1 2 1 2 1 1 1 2 1 2 2 2 2 1 1 2 1 1 2 2 2 1 1 2 2 1 1 1 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 1 2 1 2 2 1 2 1 1 2 1 1 1 1 2 1 1 2 2 2 1 2 1 2 2 1 2 2 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 1 2 1 2 1 2 2 1 1 1 2 2 2 1 2 1 2 1 1 1 1 1 1 1 2 1 2 1 2 2 1 1 2 2 1 2 2 1 2 2 1 2 2 1 2 1 1 1 2 1 1 2 2 1 2 2 1 1 2 2 2 1 1 2 2 2 1 2 1 2 1 1 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 1 1 2 1 1 1 2 1 2 1 2 2 2 1 1 1 1 1 1 2 1 2 2 2 1 2 1 1 1 2 2 1 2 1 1 2 2 2 1 1 1 1 2 2 2 2 2 1 1...', 'output': ['198906']}, {'input': '200000\\r\\n3 1 2 1 3 1 2 1 3 2 1 3 3 2 1 2 3 3 1 3 2 2 1 2 2 1 1 3 3 1 1 1 3 2 2 3 1 1 3 1 2 1 3 1 3 1 3 1 1 1 1 2 3 3 2 1 2 3 1 1 3 1 2 1 1 3 2 2 2 2 3 3 2 1 1 2 1 1 1 3 2 1 1 2 2 1 1 3 1 1 2 2 1 1 2 2 3 3 2 2 2 2 3 2 1 3 1 2 3 2 2 1 2 3 1 1 1 2 1 2 2 3 2 3 3 3 3 1 1 3 3 1 1 3 2 3 3 1 2 1 2 3 2 1 2 2 3 2 1 1 2 2 3 1 1 3 1 1 3 1 3 3 2 2 1 3 1 2 2 3 1 1 2 2 2 3 3 1 2 3 3 3 3 2 2 1 3 2 2 2 3 1 3 2 2 2 1 2 3 3 1 3 1 2 3 2 3 2 3 3 2 2 1 1 3 3 3 2 1 1 2 2 1 3 3 2 2 2 3 1 2 2 1 1 2 3 2 1 2 2 1 1 2 3 2 3 1 3 3 1 2 2...', 'output': ['188569']}, {'input': '20\\r\\n3 11 5 13 11 3 20 15 2 19 3 14 3 20 10 2 5 9 7 14\\r\\n', 'output': ['14']}, {'input': '200000\\r\\n1 2 2 1 1 2 2 2 2 1 1 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 2 2 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 2 2 2 2 1 1 1 1 2 2 2 2 2 1 1 2 1 1 1 2 1 1 1 2 1 1 2 2 1 1 1 2 2 1 1 1 2 1 2 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 1 1 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 2 2 2 1 2 1 2 2 1 2 2 2 2 2 2 2 1 2 1 2 2 2 1 1 1 2 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 1 2 2 1 1 1 2 2 2 1 2 1 2 2 2 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 2 2 1 1 1 2 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 1 2 1 2 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1...', 'output': ['198514']}, {'input': '200000\\r\\n3 2 2 1 3 2 3 2 2 2 3 2 2 1 2 1 1 1 3 2 3 2 2 1 1 2 3 3 1 1 2 1 2 3 2 3 1 3 2 3 3 1 2 3 1 2 2 1 3 3 1 2 2 2 1 2 2 2 2 2 1 2 2 3 3 3 2 1 2 1 2 2 1 3 3 1 1 3 3 2 1 2 1 1 2 1 2 2 1 1 2 2 2 3 1 3 2 2 1 1 2 3 3 2 2 3 3 3 2 3 3 1 1 2 3 1 2 1 2 1 3 2 2 1 2 3 1 2 3 1 3 2 3 3 2 2 3 2 3 2 3 2 2 3 1 2 3 1 2 2 3 1 1 2 3 3 3 1 1 1 2 3 1 3 3 3 2 1 2 1 2 2 3 1 2 1 2 1 3 2 1 2 2 3 3 1 3 2 3 3 2 3 3 3 2 1 3 1 2 3 2 3 2 2 2 3 2 1 1 2 3 3 2 3 3 1 3 1 3 2 3 3 3 1 1 3 1 3 1 3 3 3 3 1 1 2 1 1 1 1 3 3 1 2 3 1 1 1 3 1 3 3...', 'output': ['165239']}, {'input': '200000\\r\\n2 2 1 1 2 1 2 1 2 2 2 2 2 2 1 2 1 1 2 1 2 1 1 1 1 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 1 2 1 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 1 1 2 1 2 1 2 2 1 2 2 2 1 2 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 1 1 2 1 2 1 2 2 2 2 1 2 2 1 1 2 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 1 2 1 2 2 1 1 1 2 2 2 1 2 2 2 2 2 2 1 1 2 2 1 2 1 1 1 1 1 2 2 1 2 1 2 2 2 2 2 1 1 2 1 1 2 1 1 2 2 2 2 1 1 2 1 2 1 2 2 1 2 1 1 1 2 1 2 1 1 1 2 1 1 2 2 2 2 1 2 1 2 2 1 2 1 2 1 1 2 2 2 1 2 1 1 2 1 2 1 2 2 2 2 2 2 2 2 2 1 1 1 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 2 2 1 2...', 'output': ['198578']}, {'input': '200000\\r\\n1 1 3 2 1 2 3 1 2 3 1 2 3 3 1 3 1 1 3 1 1 3 1 1 2 2 3 1 3 1 2 2 2 3 3 1 2 2 1 2 3 1 1 2 2 1 3 1 1 2 2 3 2 2 3 1 3 2 3 1 3 1 2 2 3 2 3 2 2 2 2 1 1 1 2 1 1 3 2 1 3 2 1 3 2 3 2 2 1 3 1 3 3 3 1 1 3 3 3 2 3 2 2 2 1 1 3 3 2 1 2 3 1 1 2 1 1 1 3 3 2 3 2 2 3 1 2 2 1 1 1 2 3 2 1 1 2 1 1 2 2 3 3 3 1 3 3 2 2 1 1 2 2 3 2 3 2 2 3 2 3 3 3 2 3 1 2 2 2 3 3 1 3 1 3 1 1 3 3 2 1 2 2 2 3 3 3 2 3 1 3 3 1 3 3 1 3 2 3 2 2 2 1 1 3 1 1 1 1 1 2 2 2 3 1 3 3 3 2 2 2 1 1 1 3 1 1 2 3 3 2 2 3 2 2 2 2 1 2 1 1 2 1 2 1 3 1 3 2 1 1 2...', 'output': ['173563']}, {'input': '200000\\r\\n3 2 2 1 2 2 2 2 3 2 2 3 2 3 1 2 1 2 1 1 2 1 3 1 1 2 1 1 2 2 2 3 1 2 3 3 1 2 1 3 1 3 3 3 1 2 3 1 1 1 2 3 3 3 1 3 3 2 2 2 2 3 2 1 1 3 3 1 2 2 1 2 3 1 1 1 3 3 3 2 3 1 1 2 3 3 1 2 2 2 1 1 1 2 1 3 2 1 2 1 1 3 2 3 2 2 3 2 3 1 2 1 2 1 2 2 1 2 2 1 2 1 1 1 2 3 3 1 2 3 2 1 2 2 1 3 2 1 3 3 3 1 2 1 2 1 3 1 3 2 1 1 2 1 3 2 3 3 1 3 1 3 3 1 3 3 3 3 3 3 2 2 3 3 3 3 3 2 1 1 2 1 2 1 2 1 1 3 3 2 3 2 1 1 3 3 2 2 3 2 1 2 2 3 2 2 1 3 2 2 1 1 3 2 1 1 1 1 3 3 1 2 3 3 1 1 3 2 1 1 1 1 3 3 3 2 3 2 3 3 1 2 2 3 3 1 2 3 3 3 3 3...', 'output': ['193832']}, {'input': '100\\r\\n41 47 27 18 16 44 40 30 24 22 28 47 38 13 26 40 35 33 16 14 39 9 31 31 20 17 5 26 15 25 32 39 50 48 25 33 2 25 9 26 10 40 27 1 1 1 2 1 1 5 1 1 2 1 1 1 1 1 5 1 1 1 1 1 2 1 1 5 1 1 2 1 1 2 1 1 5 1 1 4 1 1 4 1 1 5 1 1 3 1 1 5 28 4 34 31 9 41 45 46\\r\\n', 'output': ['47']}, {'input': '100\\r\\n7 18 11 18 7 12 11 7 7 20 17 5 13 6 12 17 20 8 20 13 14 7 9 19 16 4 11 6 6 19 19 4 12 8 1 15 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 5 6 14 13 2 12 19 2 6 16 7 14 20\\r\\n', 'output': ['41']}, {'input': '200000\\r\\n4 60 54 6 57 35 64 65 72 96 7 57 87 61 66 24 52 65 92 54 47 23 75 94 55 51 26 46 17 40 8 2 16 78 23 20 99 97 5 3 49 45 50 64 29 25 4 79 28 4 42 96 45 82 18 59 56 56 91 87 70 4 71 76 99 2 27 57 37 22 2 10 34 63 65 31 98 65 45 80 11 16 40 35 30 11 8 33 21 82 67 1 23 49 86 75 86 2 57 30 26 11 25 95 43 70 19 36 23 55 14 86 56 73 32 7 7 65 58 68 100 86 7 52 16 87 41 44 87 96 28 69 62 22 92 17 10 86 60 86 30 38 70 77 14 24 40 16 31 48 46 89 11 11 9 53 35 63 58 10 48 72 65 69 93 74 47 24 73 60 20 13 58 10...', 'output': ['62532']}, {'input': '3000\\r\\n24 22 34 10 29 38 22 34 18 16 43 50 12 30 20 50 37 11 31 41 40 38 12 20 16 40 33 30 7 34 34 37 7 25 33 49 37 18 12 44 45 19 35 16 32 2 35 19 34 43 36 39 29 2 31 35 17 17 41 37 8 13 36 9 50 49 9 31 18 47 11 47 43 22 10 33 11 26 21 14 21 48 43 22 20 48 42 5 49 22 39 21 5 3 18 10 17 11 6 37 8 25 36 14 41 34 38 40 9 6 28 29 24 20 24 32 8 33 48 40 46 15 29 32 6 30 3 36 24 10 49 32 29 47 45 24 36 49 17 12 28 14 28 7 47 28 19 25 35 35 17 2 19 20 26 5 13 15 35 26 45 6 7 5 22 18 30 33 44 34 26 9 16 48 12 43 4...', 'output': ['793']}, {'input': '200000\\r\\n26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 20 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 21 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 24 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 76 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 8 26 26 26 26 26 16 26 26 26 26 26 26 26 26 26 26 ...', 'output': ['160816']}, {'input': '200000\\r\\n48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 40 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 1 48 48 48 48 48 48 48 48 48 48 48 41 48 48 48 48 48 48 48 48 36 48 48 48 48 48 48 48 48 48 38 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 47 48 48 48 48 48 48 ...', 'output': ['124891']}, {'input': '200000\\r\\n64 64 64 64 87 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 55 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 7 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 11 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 57 64 64 64 64 64 64 64 64 64 94 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 81 64 64 64 64 46 64 64 64 64 64 64 64 64 64 ...', 'output': ['166566']}, {'input': '200000\\r\\n12 76 12 12 12 12 12 12 12 70 12 12 12 12 12 12 12 12 12 12 12 23 12 12 12 12 12 12 12 12 38 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 38 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 96 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 12 12 12 12 12 12 12 12 12 12 12 12 85 12 12 12 12 12 12 12 12 12 50 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 31 12 12 12...', 'output': ['182425']}, {'input': '200000\\r\\n86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 30 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 11 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86...', 'output': ['177045']}, {'input': '200000\\r\\n3 3 3 3 3 3 3 3 3 3 3 3 3 17 3 8 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 12 3 3 3 3 3 3 3 50 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 77 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 3 3 3 3 3 3 3 3 3 3 17 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 23 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 3 3 3 3 3 3 3 60 3 3 56 3 3 3 3 3 3 3 3 76 3 3 3 3 3 3 3 22 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...', 'output': ['199166']}, {'input': '100\\r\\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 10 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 12 17 1 1 1 1 1 1 1 1 1 1 1 23 23 23 23 23 23 23 23 23 23 23 23 23 23\\r\\n', 'output': ['96']}, {'input': '200000\\r\\n9 9 9 9 9 9 9 9 9 9 9 9 9 7 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 8 9 3 9 9 9 9 9 2 9 9 9 9 9 9 9 9 9 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 2 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 2 9 9 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 6 9 9 9 9 5 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 2 9 9 9 9 9 9 9 9 9 9 9 9 9 9 3 9 9 9 9 9 9 9 9 9 9 9 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 2 9 9 9 9 9 9 9 9 9 9 9 9 9...', 'output': ['100432']}, {'input': '100\\r\\n21 40 61 74 3 78 72 22 10 5 6 6 7 18 30 52 5 2 74 9 51 20 1 38 2 32 27 9 75 58 53 64 9 4 61 18 4 1 6 40 17 2 2 5 8 1 5 74 6 6 3 75 1 4 25 36 56 68 31 9 1 2 52 2 3 4 46 62 26 11 79 2 11 6 1 64 72 10 8 7 5 4 66 9 5 61 47 53 2 5 9 12 72 77 10 9 4 47 8 1\\r\\n', 'output': ['82']}, {'input': '3000\\r\\n51 26 41 31 20 1 25 9 45 36 41 22 32 25 9 45 2 30 30 45 38 9 55 44 41 2 1 4 11 18 7 31 42 21 13 6 3 11 25 2 2 40 36 16 6 21 2 6 40 9 4 37 30 51 3 24 3 47 19 51 37 26 15 34 49 47 7 35 41 2 13 27 23 45 18 45 8 11 55 32 4 43 10 22 40 10 1 26 12 15 9 37 39 6 3 31 46 12 47 5 3 19 29 4 49 18 47 4 50 20 27 5 27 13 5 9 14 14 28 10 27 1 5 52 34 3 24 44 33 41 5 14 8 34 2 20 8 5 51 45 49 33 51 41 15 2 17 30 54 31 24 13 6 51 55 26 50 1 49 29 51 5 46 4 34 25 5 40 49 2 52 42 30 38 21 22 49 46 13 8 52 31 23 1 2 36 ...', 'output': ['2955']}, {'input': '200000\\r\\n10 22 6 30 90 5 8 37 9 87 49 66 55 89 83 36 85 61 36 69 72 32 17 7 31 9 71 10 5 7 36 48 87 21 52 70 2 6 7 78 24 5 5 52 47 2 27 21 39 62 26 32 45 8 46 64 30 33 83 66 87 86 55 36 4 25 69 19 52 55 5 43 82 60 57 74 44 87 2 76 79 3 22 31 71 49 64 32 83 73 4 59 62 90 14 14 70 18 60 69 56 28 41 14 17 70 36 9 29 46 74 24 43 4 86 84 54 5 24 85 8 21 58 73 26 35 9 60 13 79 23 10 34 86 1 38 1 69 1 2 20 42 81 57 76 64 44 77 74 69 52 7 27 1 69 44 43 65 76 32 73 18 55 24 16 70 10 82 2 3 90 3 80 42 7 15 51 85 5 28...', 'output': ['176565']}, {'input': '200000\\r\\n6 20 5 13 24 34 14 52 45 39 55 9 47 53 3 60 31 32 45 60 34 11 4 50 29 54 41 11 53 53 16 44 9 24 18 40 51 9 20 31 41 16 24 40 8 40 20 26 57 33 54 57 55 27 50 1 57 51 15 19 32 39 55 48 56 13 28 43 11 11 55 34 3 41 36 26 11 6 9 57 31 30 43 33 41 53 2 44 48 5 22 33 9 26 13 18 13 39 53 22 35 60 31 56 39 31 57 10 4 26 49 45 7 11 22 4 54 7 18 34 30 28 17 8 20 20 24 52 2 28 31 5 49 6 28 34 8 56 28 42 28 44 23 36 24 46 35 54 10 7 44 13 30 51 58 46 34 17 8 32 3 54 30 42 27 9 48 54 45 17 51 43 25 5 35 50 6 44...', 'output': ['196854']}, {'input': '200000\\r\\n12 2 67 2 10 1 2 3 3 29 3 2 3 2 2 9 3 2 1 3 1 2 49 1 3 52 2 54 9 1 2 56 1 3 1 1 3 2 89 3 66 1 3 1 2 2 58 82 33 3 27 3 1 1 7 2 1 1 2 2 1 73 3 3 2 3 1 92 3 1 2 3 1 59 1 3 3 29 2 1 2 2 3 59 38 1 3 97 36 3 4 3 2 3 2 2 2 3 73 42 2 3 3 1 1 2 1 1 98 3 3 1 1 84 62 93 1 48 2 3 20 1 96 1 74 4 1 2 44 15 10 33 1 2 1 3 37 1 2 70 20 1 1 2 3 3 2 1 1 3 86 77 1 20 1 2 99 1 3 3 81 1 2 1 28 85 3 73 3 48 48 55 44 2 69 1 18 31 3 3 3 3 50 6 55 3 2 2 91 3 3 3 66 3 1 21 1 11 2 12 1 28 2 1 40 53 24 1 1 3 33 2 1 3 3 3 47 3 ...', 'output': ['199642']}, {'input': '200000\\r\\n85 44 24 37 37 60 42 1 16 56 24 2 36 22 90 57 58 78 78 57 76 59 2 5 2 1 61 51 19 16 2 87 9 70 1 36 62 98 55 78 31 29 59 86 27 22 37 65 18 70 16 20 43 1 11 59 1 4 41 1 1 17 74 60 1 22 2 2 1 18 2 51 89 47 3 35 76 2 86 1 77 61 10 57 56 35 65 68 45 72 1 39 46 90 17 1 29 82 2 1 53 68 11 66 45 19 36 57 79 57 54 64 69 11 34 54 77 58 74 69 1 97 7 71 98 42 95 8 33 2 43 72 58 65 68 58 71 1 2 40 40 2 58 91 2 70 41 90 55 75 2 90 39 2 91 21 7 57 1 74 79 7 1 81 2 25 37 2 2 2 10 2 81 83 62 96 2 28 32 33 1 4 1 94 ...', 'output': ['88535']}, {'input': '200000\\r\\n1 82 1 1 1 71 49 73 1 44 1 1 44 1 30 53 1 93 59 1 1 85 12 48 1 1 1 39 23 1 1 77 1 1 1 1 39 1 46 32 1 62 52 91 60 1 68 38 1 1 1 93 86 1 45 79 1 12 58 40 17 21 1 1 26 1 58 1 54 1 1 1 33 84 74 66 1 70 8 1 1 1 41 43 1 9 1 1 1 1 1 1 1 36 73 1 1 1 1 70 1 28 56 1 1 1 100 98 95 1 19 89 57 35 1 1 1 1 11 29 81 86 86 69 29 1 43 1 79 16 1 5 1 1 1 1 1 1 52 1 49 1 12 1 1 15 1 1 1 1 56 40 35 46 86 100 64 1 1 1 1 1 1 40 1 77 82 17 1 1 1 1 53 1 13 86 90 1 7 89 1 1 97 79 18 1 1 37 1 1 1 59 1 1 46 99 1 84 1 1 4 1 80 ...', 'output': ['24']}, {'input': '200000\\r\\n100 96 100 83 42 97 41 64 96 100 20 98 42 96 42 22 72 98 100 96 100 23 98 98 100 18 53 19 100 99 6 96 96 37 17 16 98 40 97 98 69 43 100 89 98 97 88 34 81 74 28 98 96 80 99 97 12 7 15 98 97 70 72 46 98 97 3 98 100 32 13 66 24 2 57 97 64 7 97 97 98 40 5 4 64 100 28 98 98 99 64 96 22 5 12 96 97 65 99 97 87 79 72 97 53 82 68 23 48 97 24 98 98 97 97 98 75 62 98 23 41 36 96 100 31 36 5 2 10 96 100 31 100 27 99 42 96 66 99 98 94 48 64 34 97 52 5 70 85 100 80 93 70 99 70 97 6 97 65 20 43 96 96 96 83 96 100...', 'output': ['101121']}, {'input': '3000\\r\\n15 6 11 3 17 12 16 4 10 20 3 2 1 2 2 19 1 4 1 8 1 4 14 2 4 12 2 5 1 16 16 7 19 5 16 4 17 17 4 3 2 3 20 7 4 14 18 5 12 10 1 4 3 4 2 15 3 5 13 20 15 3 3 3 5 18 2 3 2 19 2 3 14 7 1 12 12 3 11 5 12 13 6 1 19 1 2 2 2 12 5 4 1 11 3 5 3 11 1 14 8 2 5 16 4 4 3 3 2 6 17 17 9 1 3 3 3 14 15 17 18 15 1 1 17 4 3 8 2 2 1 2 14 2 1 2 3 13 7 2 4 1 20 10 19 2 14 5 17 17 10 5 11 3 3 15 2 2 1 8 7 1 2 4 2 7 10 1 14 4 7 3 3 2 20 16 2 20 6 13 19 17 1 3 1 13 2 2 7 13 7 20 4 2 13 18 3 1 3 4 19 8 1 1 3 11 1 19 14 11 2 18 3 13...', 'output': ['2633']}, {'input': '199557\\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 1...', 'output': ['199557']}, {'input': '198044\\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 1...', 'output': ['198044']}, {'input': '200000\\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 1...', 'output': ['200000']}]","id":469} {"difficulty":1600,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"a17bac596b1f060209534cbffdf0f40e","execute_outcome":"COMPILATION_ERROR","source_code":"import com.sun.xml.internal.fastinfoset.util.StringArray\nimport java.io.DataInputStream\nimport java.io.InputStream\nimport java.lang.StringBuilder\nimport kotlin.math.PI\nimport kotlin.math.ceil\nimport kotlin.math.floor\nimport kotlin.math.max\nimport kotlin.math.min\nimport kotlin.math.sqrt\nimport kotlin.random.Random\n\ninternal class Parserdoubt(`in`: InputStream) {\n private val BUFFER_SIZE = 1 shl 17\n\n private val din: DataInputStream\n private val buffer: ByteArray\n private var bufferPointer: Int = 0\n private var bytesRead: Int = 0\n\n init {\n din = DataInputStream(`in`)\n buffer = ByteArray(BUFFER_SIZE)\n bytesRead = 0\n bufferPointer = bytesRead\n }\n\n @Throws(Exception::class)\n fun nextString(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > ' '.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun wholeLine(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= '\\n'.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > '\\n'.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun nextChar(): Char {\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n return c.toChar()\n }\n\n @Throws(Exception::class)\n fun nextInt(): Int {\n var ret = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n fun nextLong(): Long {\n var ret: Long = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toLong()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n private fun fillBuffer() {\n bufferPointer = 0\n bytesRead = din.read(buffer, 0, BUFFER_SIZE)\n if (bytesRead == -1)\n buffer[0] = -1\n }\n\n @Throws(Exception::class)\n private fun read(): Byte {\n if (bufferPointer == bytesRead)\n fillBuffer()\n return buffer[bufferPointer++]\n }\n}\n\nfun process(s: String, k: Int):String?{\n var id = s.length - 1\n var seenK = 0\n while(seenK < k && id>=0){\n if(\"aeiou\".contains(s[id]))seenK++\n if(seenK < k)id--\n }\n if(id==-1)return null\n return s.substring(id)\n}\n\nfun main(args : Array) {\n\n val input = Parserdoubt(`in` = System.`in`)\n val NT = 1\/\/input.nextInt()\n val sb = StringBuilder()\n for(test in 1..NT){\n val n= input.nextInt()\n val k= input.nextInt()\n var ans = \"aaaa\"\n for(i in 0 until n){\n val s = StringArray()\n for(j in 0..3){\n s.add(process(input.nextString(), k))\n }\n if(s[0] == null || s[1] == null ||s[2] == null ||s[3] == null ){\n ans = \"NO\"\n break\n }\n if(s[0] == s[1] && s[0] == s[2] && s[0] == s[3])\n continue\n\n if(s[0] == s[1] && s[3] == s[2]){\n if(ans == \"aaaa\" || ans == \"aabb\"){\n ans = \"aabb\"\n } else {\n ans = \"NO\"\n break\n }\n }\n\n else if(s[0] == s[2] && s[1] == s[3]){\n if(ans == \"aaaa\" || ans == \"abab\"){\n ans = \"abab\"\n } else {\n ans = \"NO\"\n break\n }\n }\n\n else if(s[0] == s[3] && s[1] == s[2]){\n if(ans == \"aaaa\" || ans == \"abba\"){\n ans = \"abba\"\n } else {\n ans = \"NO\"\n break\n }\n }\n else {\n ans = \"NO\"\n break\n }\n }\n println(ans)\n\n }\n}\n","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"],"human_solution":"import java.io.DataInputStream\nimport java.io.InputStream\nimport java.lang.StringBuilder\n\ninternal class Parserdoubt(`in`: InputStream) {\n private val BUFFER_SIZE = 1 shl 17\n\n private val din: DataInputStream\n private val buffer: ByteArray\n private var bufferPointer: Int = 0\n private var bytesRead: Int = 0\n\n init {\n din = DataInputStream(`in`)\n buffer = ByteArray(BUFFER_SIZE)\n bytesRead = 0\n bufferPointer = bytesRead\n }\n\n @Throws(Exception::class)\n fun nextString(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > ' '.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun wholeLine(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= '\\n'.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > '\\n'.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun nextChar(): Char {\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n return c.toChar()\n }\n\n @Throws(Exception::class)\n fun nextInt(): Int {\n var ret = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n fun nextLong(): Long {\n var ret: Long = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toLong()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n private fun fillBuffer() {\n bufferPointer = 0\n bytesRead = din.read(buffer, 0, BUFFER_SIZE)\n if (bytesRead == -1)\n buffer[0] = -1\n }\n\n @Throws(Exception::class)\n private fun read(): Byte {\n if (bufferPointer == bytesRead)\n fillBuffer()\n return buffer[bufferPointer++]\n }\n}\n\nfun process(s: String, k: Int):String?{\n var id = s.length - 1\n var seenK = 0\n while(seenK < k && id>=0){\n if(\"aeiou\".contains(s[id]))seenK++\n if(seenK < k)id--\n }\n if(id==-1)return null\n return s.substring(id)\n}\n\nfun main(args : Array) {\n\n val input = Parserdoubt(`in` = System.`in`)\n val NT = 1\/\/input.nextInt()\n val sb = StringBuilder()\n for(test in 1..NT){\n val n= input.nextInt()\n val k= input.nextInt()\n var ans = \"aaaa\"\n for(i in 0 until n){\n val s = ArrayList()\n for(j in 0..3){\n s.add(process(input.nextString(), k))\n }\n if(s.contains(null)){\n ans = \"NO\"\n break\n }\n if(s[0] == s[1] && s[0] == s[2] && s[0] == s[3])\n continue\n\n if(s[0] == s[1] && s[3] == s[2]){\n if(ans == \"aaaa\" || ans == \"aabb\"){\n ans = \"aabb\"\n } else {\n ans = \"NO\"\n break\n }\n }\n\n else if(s[0] == s[2] && s[1] == s[3]){\n if(ans == \"aaaa\" || ans == \"abab\"){\n ans = \"abab\"\n } else {\n ans = \"NO\"\n break\n }\n }\n\n else if(s[0] == s[3] && s[1] == s[2]){\n if(ans == \"aaaa\" || ans == \"abba\"){\n ans = \"abba\"\n } else {\n ans = \"NO\"\n break\n }\n }\n else {\n ans = \"NO\"\n break\n }\n }\n println(ans)\n\n }\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":470} {"difficulty":2100,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"be82b8f209217875221ebe5de8675971","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = ni()\n val P1 = na(N)\n val P = P1.clone()\n zip(P)\n P.reverse()\n val T = ni()\n val Q = na(T, -1)\n val needsOpen = BooleanArray(N)\n for (i in 0 until T) {\n needsOpen[N - 1 - Q[i]] = true\n }\n val negFlg = BooleanArray(N)\n val lstOpen = ArrayDeque()\n for (i in 0 until N) {\n val canClose = lstOpen.isNotEmpty() && P[lstOpen.last] == P[i]\n val toOpen = needsOpen[i] || !canClose\n if (toOpen) {\n lstOpen.addLast(i)\n } else {\n lstOpen.removeLast()\n }\n negFlg[i] = !toOpen\n }\n if (lstOpen.isNotEmpty()) {\n out.println(\"NO\")\n } else {\n out.println(\"YES\")\n for (i in 0 until N) {\n P1[i] *= if (negFlg[N - 1 - i]) 1 else -1 \/\/ \u53cd\u8ee2\u3059\u308b\u306e\u3067\n }\n out.println(P1.joinToString(\" \"))\n }\n }\n\n fun zip(A: IntArray) {\n val ids = A.distinct().sorted().toIntArray()\n for (i in 0 until A.size) {\n A[i] = lowerBound(ids, 0, A[i])\n }\n }\n\n fun lowerBound(A: IntArray, s: Int, x: Int): Int {\n var l = s - 1\n var h = A.size\n while(h - l > 1) {\n val m = (h + l) \/ 2\n if (A[m] >= x) h = m\n else l = m\n }\n return h\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n \/\/ \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n \/**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n *\/\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun pair(a: A, b: B) = RPair(a, b)\ndata class RPair(val _1: A, val _2: B)\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}","description":"As you know, Vova has recently become a new shaman in the city of Ultima Thule. So, he has received the shaman knowledge about the correct bracket sequences. The shamans of Ultima Thule have been using lots of different types of brackets since prehistoric times. A bracket type is a positive integer. The shamans define a correct bracket sequence as follows: An empty sequence is a correct bracket sequence. If {a1,\u2009a2,\u2009...,\u2009al} and {b1,\u2009b2,\u2009...,\u2009bk} are correct bracket sequences, then sequence {a1,\u2009a2,\u2009...,\u2009al,\u2009b1,\u2009b2,\u2009...,\u2009bk} (their concatenation) also is a correct bracket sequence. If {a1,\u2009a2,\u2009...,\u2009al} \u2014 is a correct bracket sequence, then sequence also is a correct bracket sequence, where v (v\u2009>\u20090) is an integer. For example, sequences {1,\u20091,\u2009\u2009-\u20091,\u20092,\u2009\u2009-\u20092,\u2009\u2009-\u20091} and {3,\u2009\u2009-\u20093} are correct bracket sequences, and {2,\u2009\u2009-\u20093} is not.Moreover, after Vova became a shaman, he learned the most important correct bracket sequence {x1,\u2009x2,\u2009...,\u2009xn}, consisting of n integers. As sequence x is the most important, Vova decided to encrypt it just in case.Encrypting consists of two sequences. The first sequence {p1,\u2009p2,\u2009...,\u2009pn} contains types of brackets, that is, pi\u2009=\u2009|xi| (1\u2009\u2264\u2009i\u2009\u2264\u2009n). The second sequence {q1,\u2009q2,\u2009...,\u2009qt} contains t integers \u2014 some positions (possibly, not all of them), which had negative numbers in sequence {x1,\u2009x2,\u2009...,\u2009xn}.Unfortunately, Vova forgot the main sequence. But he was lucky enough to keep the encryption: sequences {p1,\u2009p2,\u2009...,\u2009pn} and {q1,\u2009q2,\u2009...,\u2009qt}. Help Vova restore sequence x by the encryption. If there are multiple sequences that correspond to the encryption, restore any of them. If there are no such sequences, you should tell so.","input_specification":"The first line of the input contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009106). The second line contains n integers: p1,\u2009p2,\u2009...,\u2009pn (1\u2009\u2264\u2009pi\u2009\u2264\u2009109). The third line contains integer t (0\u2009\u2264\u2009t\u2009\u2264\u2009n), followed by t distinct integers q1,\u2009q2,\u2009...,\u2009qt (1\u2009\u2264\u2009qi\u2009\u2264\u2009n). The numbers in each line are separated by spaces.","output_specification":"Print a single string \"NO\" (without the quotes) if Vova is mistaken and a suitable sequence {x1,\u2009x2,\u2009...,\u2009xn} doesn't exist. Otherwise, in the first line print \"YES\" (without the quotes) and in the second line print n integers x1,\u2009x2,\u2009...,\u2009xn (|xi|\u2009=\u2009pi;\u00a0xqj\u2009<\u20090). If there are multiple sequences that correspond to the encrypting, you are allowed to print any of them.","notes":null,"sample_inputs":["2\n1 1\n0","4\n1 1 1 1\n1 3","3\n1 1 1\n0","4\n1 2 2 1\n2 3 4"],"sample_outputs":["YES\n1 -1","YES\n1 1 -1 -1","NO","YES\n1 2 -2 -1"],"human_solution":"import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = ni()\n val P = na(N)\n val T = ni()\n val Q = na(T, -1)\n val needsOpen = BooleanArray(N)\n for (i in 0 until T) {\n needsOpen[Q[i]] = true\n }\n val closeFlg = BooleanArray(N)\n val lstOpen = ArrayDeque()\n for (i in N - 1 downTo 0) {\n val canClose = lstOpen.isNotEmpty() && P[lstOpen.last] == P[i]\n val toOpen = needsOpen[i] || !canClose\n if (toOpen) {\n lstOpen.addLast(i)\n } else {\n lstOpen.removeLast()\n }\n closeFlg[i] = !toOpen\n }\n if (lstOpen.isNotEmpty()) {\n out.println(\"NO\")\n } else {\n out.println(\"YES\")\n for (i in 0 until N) {\n P[i] *= if (closeFlg[i]) 1 else -1 \/\/ \u53cd\u8ee2\u3059\u308b\u306e\u3067\n }\n out.println(P.joinToString(\" \"))\n }\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n \/\/ \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n \/**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n *\/\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun pair(a: A, b: B) = RPair(a, b)\ndata class RPair(val _1: A, val _2: B)\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}","testcases":"[{'input': '2\\r\\n1 1\\r\\n0\\r\\n', 'output': ['YES\\r\\n1 -1']}, {'input': '4\\r\\n1 1 1 1\\r\\n1 3\\r\\n', 'output': ['YES\\r\\n1 1 -1 -1']}, {'input': '3\\r\\n1 1 1\\r\\n0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 2 2 1\\r\\n2 3 4\\r\\n', 'output': ['YES\\r\\n1 2 -2 -1']}, {'input': '1000000\\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 ...', 'output': ['YES\\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 ...', 'NO', 'YES\\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 ...']}, {'input': '14\\r\\n1 1 1 1 2 2 1 2 2 2 1 1 2 1\\r\\n7 12 13 4 14 10 6 7\\r\\n', 'output': ['YES\\r\\n1 1 1 -1 2 -2 -1 2 2 -2 1 -1 -2 -1']}, {'input': '10\\r\\n1 2 2 1 2 1 2 2 2 1\\r\\n0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 1 1\\r\\n2 3 4\\r\\n', 'output': ['YES\\r\\n1 1 -1 -1']}, {'input': '8\\r\\n3 3 1 1 1 1 3 3\\r\\n1 6\\r\\n', 'output': ['YES\\r\\n3 -3 1 -1 1 -1 3 -3']}, {'input': '8\\r\\n1 1 2 1 1 2 1 1\\r\\n2 7 8\\r\\n', 'output': ['YES\\r\\n1 1 2 1 -1 -2 -1 -1']}, {'input': '20\\r\\n3 3 3 2 2 3 1 1 3 2 1 3 3 1 2 3 1 1 3 3\\r\\n1 16\\r\\n', 'output': ['YES\\r\\n3 -3 3 2 -2 -3 1 -1 3 2 1 3 -3 -1 -2 -3 1 -1 3 -3']}, {'input': '10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n5 6 7 8 9 10\\r\\n', 'output': ['YES\\r\\n1 1 1 1 1 -1 -1 -1 -1 -1']}, {'input': '200\\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 ...', 'output': ['YES\\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...']}, {'input': '4000\\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...', 'output': ['YES\\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 ...', 'NO']}, {'input': '14\\r\\n1 2 2 4 4 1 1 1 2 3 3 2 1 1\\r\\n1 7\\r\\n', 'output': ['YES\\r\\n1 2 -2 4 -4 1 -1 -1 2 3 -3 -2 1 -1']}, {'input': '20\\r\\n3 3 1 1 1 1 1 2 2 1 1 3 1 1 3 1 1 2 2 1\\r\\n3 18 7 14\\r\\n', 'output': ['YES\\r\\n3 -3 1 -1 1 1 -1 2 2 1 -1 3 1 -1 -3 1 -1 -2 -2 -1']}, {'input': '20\\r\\n3 1 1 3 1 2 4 3 3 4 4 2 2 3 3 4 2 1 3 3\\r\\n1 18\\r\\n', 'output': ['YES\\r\\n3 1 -1 -3 1 2 4 3 -3 -4 4 2 -2 3 -3 -4 -2 -1 3 -3']}, {'input': '1000000\\r\\n17 14 18 16 1 2 5 9 10 10 15 15 14 13 10 8 14 4 2 2 20 3 10 4 4 17 7 13 6 3 9 8 6 18 20 15 9 6 11 11 16 14 12 11 7 10 5 14 18 13 10 13 20 18 11 9 14 13 12 10 16 11 12 5 2 11 5 13 4 1 8 9 9 10 19 11 12 1 13 19 2 3 15 20 5 11 7 5 9 11 7 17 15 9 10 ...', 'output': ['YES\\r\\n17 14 18 16 1 2 5 9 10 -10 15 -15 14 13 10 8 14 4 2 -2 20 3 10 4 -4 17 7 13 6 3 9 8 6 18 20 15 9 6 11 -11 16 14 12 11 7 10 5 14 18 13 10 13 20 18 11 9 14 13 12 10 16 11 12 5 2 11 5 13 4 1 8 9 -9 10 19 11 12 1 13 19 2 3 15 20 5 11 7 5 9 11 7 17 15 9 1...']}, {'input': '1000000\\r\\n1 4 4 2 2 2 2 1 4 2 2 4 3 2 1 3 2 3 1 2 1 4 1 3 4 3 1 2 3 2 4 1 2 1 3 4 3 2 3 4 3 4 3 1 2 3 4 4 2 1 2 1 1 4 4 1 1 1 4 4 4 1 4 2 3 2 4 4 1 1 1 1 4 2 2 3 2 2 4 4 1 2 4 2 1 4 4 4 1 4 3 4 3 2 2 2 2 2 1 2 3 4 1 3 3 4 3 4 4 3 2 1 3 4 3 3 1 1 3 2 3 4 4 ...', 'output': ['YES\\r\\n1 4 -4 2 -2 2 -2 -1 4 2 -2 -4 3 2 1 3 2 3 1 2 1 4 1 3 4 3 1 2 3 2 4 1 2 1 3 4 3 2 3 4 3 4 3 1 2 3 4 -4 2 1 2 1 -1 4 -4 1 -1 1 4 -4 4 1 4 2 3 2 4 -4 1 -1 1 -1 4 2 -2 3 2 -2 4 -4 1 2 4 2 1 4 -4 4 1 4 3 4 3 2 -2 2 -2 2 1 2 3 4 1 3 -3 4 3 4 -4 -3 2 1 3 4...']}, {'input': '1000000\\r\\n5 5 1 5 5 5 4 3 1 5 2 5 1 1 4 4 5 2 3 2 5 4 2 3 2 5 4 5 5 5 5 5 2 4 4 2 4 4 3 4 3 3 4 1 5 2 3 4 5 5 5 4 3 3 4 4 3 4 5 4 5 1 4 1 4 4 1 5 5 3 2 3 5 5 2 1 1 1 4 4 3 4 4 4 5 3 3 4 4 1 3 2 5 4 4 3 5 5 5 5 5 3 5 2 3 1 5 3 3 2 1 4 4 2 3 3 2 2 3 4 4 4 2 ...', 'output': ['YES\\r\\n5 -5 1 5 -5 5 4 3 1 5 2 5 1 -1 4 -4 -5 -2 3 2 5 4 2 3 2 5 4 5 -5 5 -5 5 2 4 -4 -2 4 -4 3 4 3 -3 -4 1 5 2 3 4 5 -5 5 4 3 -3 -4 4 3 4 5 4 5 1 4 1 4 -4 -1 5 -5 3 2 3 5 -5 2 1 -1 1 4 -4 3 4 -4 4 5 3 -3 4 -4 1 3 2 5 4 -4 3 5 -5 5 -5 5 3 5 2 3 1 5 3 -3 2 1...']}, {'input': '1000000\\r\\n137138642 928761285 601426992 468537798 292474836 416470586 857790842 362292486 299205816 154087462 672255408 996427702 470983106 661178270 37194612 111350289 145616325 483221039 913922722 307238603 548699762 864755526 116229324 921637530 1354394...', 'output': ['YES\\r\\n137138642 928761285 601426992 468537798 292474836 416470586 857790842 362292486 299205816 154087462 672255408 996427702 470983106 661178270 37194612 111350289 145616325 483221039 913922722 307238603 548699762 864755526 116229324 921637530 135439432 8...']}, {'input': '1000000\\r\\n2 1 2 2 1 2 1 1 2 2 2 2 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 2 2 2 2 2 2 1 1 1 1 2 2 2 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 1 2 2 1 1 1 1 2 1 1 1 1 2 1 1 2 ...', 'output': ['YES\\r\\n2 1 2 -2 -1 -2 1 -1 2 -2 2 -2 1 1 -1 -1 2 1 -1 1 2 -2 1 -1 -1 1 -1 -2 2 -2 2 -2 2 1 1 -1 -1 -2 2 -2 1 2 1 -1 -2 -1 1 -1 1 2 1 -1 -2 -1 1 2 1 -1 1 -1 -2 -1 1 2 -2 -1 1 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 -1 1 2 2 -2 1 -1 1 -1 2 -2 1 -1 1 2 1 -1 -2 1 1 ...']}, {'input': '1000000\\r\\n3 1 1 3 3 1 1 2 3 1 1 2 1 3 3 3 2 3 3 2 3 3 1 3 3 1 1 1 2 1 1 1 2 3 3 2 3 1 1 3 3 1 3 3 3 1 1 2 1 2 1 3 3 2 1 1 3 1 1 1 2 1 2 3 2 2 1 1 2 2 3 3 1 3 1 2 2 3 2 3 3 3 1 1 1 1 2 1 3 1 2 2 1 3 1 1 1 1 3 1 1 1 1 2 1 1 3 3 2 3 1 1 2 2 3 2 3 2 2 1 3 3 3 ...', 'output': ['YES\\r\\n3 1 -1 -3 3 1 -1 2 3 1 -1 2 1 3 -3 3 2 3 -3 -2 -3 3 1 3 -3 -1 1 -1 2 1 -1 1 2 3 -3 -2 3 1 -1 -3 3 1 3 -3 3 1 -1 2 1 2 1 3 -3 2 1 -1 3 1 -1 1 2 1 2 3 2 -2 1 -1 2 -2 -3 3 1 3 1 2 -2 3 2 3 -3 3 1 -1 1 -1 2 1 3 1 2 -2 -1 -3 -1 1 -1 1 3 1 -1 1 1 2 1 -1 3 ...']}, {'input': '20\\r\\n3 3 2 2 2 2 1 1 2 2 2 2 2 2 2 2 1 1 3 3\\r\\n5 15 14 13 6 16\\r\\n', 'output': ['YES\\r\\n3 -3 2 -2 2 -2 1 -1 2 2 2 2 -2 -2 -2 -2 1 -1 3 -3']}, {'input': '30\\r\\n2 2 2 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 2 2\\r\\n7 23 20 24 21 26 25 7\\r\\n', 'output': ['YES\\r\\n2 -2 2 1 -1 1 -1 1 -1 3 -3 3 -3 3 3 3 3 3 3 -3 -3 3 -3 -3 -3 -3 -3 -2 2 -2']}, {'input': '1000000\\r\\n1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['YES\\r\\n1 -1 1 -1 1 -1 1 -1 1 -1 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 -4 3 -3 3 -3 3 -3 3 -3 3 -3 2 -2 2 -2 2 -2 2 -2 2 -2 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 1 -1 1 -1 1 -1 1 -1 1 -1 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 -4 ...']}, {'input': '900000\\r\\n40 40 40 40 40 40 40 40 40 87 87 87 87 87 87 87 87 87 9 9 9 9 9 9 9 9 9 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 99 99 99 99 99 99 99 99 99 79 79 79 79 79 79 79 79 79 89 89 89 89 89 89 89 89 89 87 87 87 87 87 87 87 87 87 67 67 67 67 6...', 'output': ['YES\\r\\n40 -40 40 -40 40 -40 40 -40 40 87 -87 87 -87 87 -87 87 -87 87 9 -9 9 -9 9 -9 9 -9 9 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 99 -99 99 -99 99 -99 99 -99 99 79 -79 79 -79 79 -79 79 -79 79 89 -89 89 -89 89 -89 89 89 89 87 -87 87 -...']}, {'input': '900000\\r\\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 4 4 4 4 4 4 4 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1...', 'output': ['YES\\r\\n4 -4 4 -4 4 -4 4 -4 4 4 -4 -4 4 -4 4 -4 4 -4 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -4 4 -4 4 -4 4 -4 4 -4 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 2 -...']}, {'input': '14\\r\\n3 3 2 2 3 3 3 2 3 3 3 3 2 3\\r\\n2 12 6\\r\\n', 'output': ['YES\\r\\n3 -3 2 -2 3 -3 3 2 3 -3 3 -3 -2 -3']}, {'input': '524286\\r\\n3 3 1 2 5 2 1 4 4 5 5 3 1 2 3 4 5 1 1 4 4 5 2 5 5 5 5 2 4 1 2 4 4 4 4 2 4 3 3 2 2 4 1 3 2 4 4 1 1 1 1 4 3 2 2 2 2 3 4 1 5 2 2 2 2 5 1 3 3 2 2 1 1 2 2 3 5 1 4 2 2 5 5 4 4 5 5 2 2 4 1 1 5 2 2 1 1 5 1 1 1 1 1 1 1 5 1 1 2 3 3 1 1 2 4 2 2 2 2 4 1 2 1 1...', 'output': ['YES\\r\\n3 -3 1 2 5 2 1 4 -4 5 -5 3 1 2 3 4 5 1 -1 4 -4 -5 2 5 -5 5 -5 -2 -4 1 2 4 -4 4 -4 -2 4 3 -3 2 -2 -4 -1 -3 2 4 -4 1 -1 1 -1 4 3 2 -2 2 -2 -3 -4 1 5 2 -2 2 -2 -5 -1 3 -3 2 -2 1 -1 -2 -2 3 5 1 4 2 -2 5 -5 -4 4 5 -5 2 -2 -4 -1 1 5 2 -2 1 -1 -5 -1 1 -1 1 ...']}, {'input': '524286\\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...', 'output': ['YES\\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 ...']}, {'input': '62\\r\\n2 3 1 1 2 2 2 2 1 2 3 3 3 3 2 1 3 2 3 3 2 2 2 2 2 2 3 3 2 3 3 1 1 1 1 1 3 3 1 2 1 1 1 1 2 1 1 3 2 2 1 1 3 1 1 1 1 1 1 1 1 2\\r\\n8 8 14 28 9 61 44 53 46\\r\\n', 'output': ['YES\\r\\n2 3 1 1 2 -2 2 -2 -1 2 3 -3 3 -3 -2 -1 -3 -2 3 -3 2 -2 2 -2 2 -2 3 -3 2 3 -3 1 -1 1 -1 1 3 -3 1 2 1 -1 1 -1 -2 -1 -1 3 2 -2 1 -1 -3 1 -1 1 -1 1 -1 1 -1 -2']}, {'input': '6\\r\\n2 1 1 2 1 1\\r\\n1 5\\r\\n', 'output': ['NO']}, {'input': '1000000\\r\\n9018487 625057292 53616409 948301769 16058341 86074020 995118664 453113361 191104162 76545139 392356147 572731607 484477361 104470056 927978437 741327625 636053510 854133095 648890400 59733431 780707232 321808337 282784606 675587945 596690823 645...', 'output': ['NO']}, {'input': '1000000\\r\\n5 4 4 5 5 2 4 5 3 2 1 1 5 3 3 5 1 1 1 3 3 3 3 3 4 4 2 3 2 2 1 4 4 4 5 3 4 3 3 4 2 2 4 5 5 3 3 4 4 5 3 1 3 5 2 5 5 3 3 5 3 5 3 3 5 2 5 1 5 3 4 5 3 3 4 4 2 4 3 1 3 1 2 5 2 4 5 4 4 1 2 5 3 1 2 5 3 3 2 4 1 2 1 5 2 3 5 3 5 4 2 3 5 5 1 4 1 1 1 3 3 1 2 ...', 'output': ['NO']}, {'input': '999999\\r\\n952941789 216877425 940003517 770377586 286303258 929000697 586924179 818192983 344693750 435582488 857258071 687372381 276313411 177576040 177576040 905022591 277723878 809048500 809048500 629038416 46209401 484226048 798345490 580147077 57866262...', 'output': ['NO']}, {'input': '1000000\\r\\n896982264 55137100 176161187 667831225 751629610 996424363 181256216 312391421 723639941 9222570 164835787 205775316 633706323 4532449 134356104 956646080 210364398 948778371 112448322 240138147 335217427 437716505 387631958 568376884 167657601 2...', 'output': ['YES\\r\\n896982264 55137100 176161187 667831225 751629610 996424363 181256216 312391421 723639941 9222570 164835787 205775316 633706323 4532449 134356104 956646080 210364398 948778371 112448322 240138147 335217427 437716505 387631958 568376884 167657601 21640...']}, {'input': '1000000\\r\\n2 4 5 2 5 4 5 5 5 5 1 1 5 3 1 2 4 5 1 1 4 2 2 3 3 1 5 3 2 5 3 1 2 4 4 1 5 3 4 1 2 3 1 4 5 3 5 1 1 4 4 3 2 1 1 2 2 2 4 1 4 2 3 4 4 1 4 4 5 3 3 2 5 4 5 5 3 1 5 2 4 1 3 3 4 4 2 2 2 2 3 4 1 2 3 1 4 2 4 1 5 2 3 4 1 4 1 1 5 5 5 1 5 1 3 1 4 5 4 2 3 3 5 ...', 'output': ['YES\\r\\n2 4 5 2 5 4 5 -5 5 -5 1 -1 5 3 1 2 4 5 1 -1 4 2 -2 3 -3 1 5 3 2 5 3 1 2 4 -4 1 5 3 4 1 2 3 1 4 5 3 5 1 1 4 -4 3 2 1 -1 -2 2 -2 4 1 4 2 3 4 4 1 4 4 5 3 -3 2 5 4 5 -5 3 1 5 2 4 1 3 -3 4 -4 2 -2 2 -2 3 4 1 2 3 1 4 2 4 1 5 2 3 4 1 4 1 1 5 -5 5 1 5 1 3 1 ...']}, {'input': '1000000\\r\\n240 405 525 920 535 256 887 768 436 474 628 723 776 536 237 342 255 672 632 657 662 505 283 860 94 702 182 587 551 371 989 250 501 462 603 513 878 783 528 849 962 16 116 525 513 916 105 410 704 955 852 742 251 157 587 867 332 58 568 301 122 696 4...', 'output': ['YES\\r\\n240 405 525 920 535 256 887 768 436 474 628 723 776 536 237 342 255 672 632 657 662 505 283 860 94 702 182 587 551 371 989 250 501 462 603 513 878 783 528 849 962 16 116 525 513 916 105 410 704 955 852 742 251 157 587 867 332 58 568 301 122 696 4 760...']}, {'input': '80439\\r\\n35 22 39 34 12 3 26 20 21 33 39 31 6 39 26 9 6 4 20 10 22 29 39 34 8 1 4 19 37 22 3 10 1 10 10 13 16 39 27 31 6 31 5 40 15 26 17 6 21 37 37 41 21 29 24 6 41 10 31 28 15 42 32 35 10 11 12 13 2 30 12 37 33 17 10 23 36 1 5 28 21 35 29 6 19 15 40 2 7 3...', 'output': ['NO']}, {'input': '100000\\r\\n55 57 39 22 22 39 7 6 30 30 6 7 57 74 74 82 87 22 40 38 75 31 89 5 5 89 31 75 38 40 3 55 67 67 55 3 9 14 95 65 55 55 65 95 14 5 17 45 45 17 89 58 40 73 49 39 39 49 73 40 58 89 5 40 42 42 40 9 22 87 82 52 52 55 16 19 55 18 33 58 61 54 37 13 86 51 8...', 'output': ['YES\\r\\n55 57 39 22 -22 -39 7 6 30 -30 -6 -7 -57 74 -74 82 87 22 40 38 75 31 89 5 -5 -89 -31 -75 -38 -40 3 55 67 -67 -55 -3 9 14 95 65 55 -55 -65 -95 -14 5 17 45 -45 -17 89 58 40 73 49 39 -39 -49 -73 -40 -58 -89 -5 40 42 -42 -40 -9 -22 -87 -82 52 -52 -55 16 ...']}, {'input': '6\\r\\n1 2 2 3 3 1\\r\\n1 1\\r\\n', 'output': ['NO']}, {'input': '1000000\\r\\n60 73 91 87 62 19 98 35 14 91 22 5 23 88 73 54 7 66 28 32 7 80 58 21 13 70 65 76 84 87 51 75 18 27 21 1 81 90 79 93 49 31 34 29 63 37 87 44 61 17 90 12 11 49 100 24 54 7 84 85 48 31 87 53 78 56 23 71 17 59 35 8 21 17 80 49 64 72 21 70 79 86 64 51...', 'output': ['YES\\r\\n60 73 91 87 62 19 98 35 14 91 22 5 23 88 73 54 7 66 28 32 7 80 58 21 13 70 65 76 84 87 51 75 18 27 21 1 81 90 79 93 49 31 34 29 63 37 87 44 61 17 90 12 11 49 100 24 54 7 84 85 48 31 87 53 78 56 23 71 17 59 35 8 21 17 80 49 64 72 21 70 79 86 64 51 27 ...']}, {'input': '1000000\\r\\n46 83 50 53 37 20 22 49 23 1 37 37 1 23 49 22 20 37 53 50 83 26 25 72 1 77 23 33 55 27 46 68 41 15 60 90 86 18 74 9 24 76 6 5 96 27 92 57 86 54 13 37 31 34 78 5 28 55 65 21 54 52 38 23 8 98 38 31 93 65 75 97 88 30 11 13 51 53 8 78 22 81 85 24 78 ...', 'output': ['YES\\r\\n46 83 50 53 37 20 22 49 23 1 37 -37 -1 -23 -49 -22 -20 -37 -53 -50 -83 26 25 72 1 77 23 33 55 27 46 68 41 15 60 90 86 18 74 9 24 76 6 5 96 27 92 57 86 54 13 37 31 34 78 5 28 55 65 21 54 52 38 23 8 98 38 31 93 65 75 97 88 30 11 13 51 53 8 78 22 81 85 ...']}, {'input': '999990\\r\\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...', 'output': ['YES\\r\\n5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 ...']}, {'input': '1000000\\r\\n93 33 91 40 11 37 97 89 80 32 96 46 66 77 77 66 46 96 32 80 89 97 37 11 40 91 33 67 25 92 23 17 57 17 52 52 17 20 28 43 92 10 10 92 43 28 69 23 14 38 70 74 76 17 63 87 47 64 55 53 86 77 39 47 8 50 24 88 41 52 97 11 60 70 8 82 92 20 43 72 1 97 13 ...', 'output': ['YES\\r\\n93 33 91 40 11 37 97 89 80 32 96 46 66 77 -77 -66 -46 -96 -32 -80 -89 -97 -37 -11 -40 -91 -33 67 25 92 23 17 57 17 52 -52 -17 20 28 43 92 10 -10 -92 -43 -28 69 23 14 38 70 74 76 17 63 87 47 64 55 53 86 77 39 47 8 50 24 88 41 52 97 11 60 70 8 82 92 20...']}, {'input': '1000000\\r\\n10 86 96 78 62 43 90 18 56 97 72 27 8 5 90 20 80 67 80 48 61 1 56 75 68 15 64 4 44 69 97 55 42 94 97 64 17 72 70 2 75 81 3 67 45 49 76 85 23 87 33 42 60 58 52 77 5 76 54 96 76 90 65 95 97 83 88 35 28 15 43 84 27 25 57 89 12 100 48 13 98 55 56 55 ...', 'output': ['NO']}, {'input': '1000000\\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': ['YES\\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...', 'NO', 'YES\\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 1 1 ...']}, {'input': '200\\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\\r\\n100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 1...', 'output': ['YES\\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']}, {'input': '4000\\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 1 1...', 'output': ['NO', 'YES\\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 1 1 ...']}, {'input': '1000000\\r\\n17 14 18 16 1 2 5 9 10 10 15 15 14 13 10 8 14 4 2 2 20 3 10 4 4 17 7 13 6 3 9 8 6 18 20 15 9 6 11 11 16 14 12 11 7 10 5 14 18 13 10 13 20 18 11 9 14 13 12 10 16 11 12 5 2 11 5 13 4 1 8 9 9 10 19 11 12 1 13 19 2 3 15 20 5 11 7 5 9 11 7 17 15 9 10 3 12 14 2 14 14 2 10 6 7 13 5 8 8 14 17 9 11 20 20 14 1 18 2 13 7 9 6 10 16 20 1 8 17 18 16 18 8 9 17 4 7 1 12 13 20 6 17 9 7 19 6 2 5 15 16 8 1 4 11 18 15 15 4 8 18 13 16 1 8 8 5 11 15 11 20 7 10 14 3 18 17 12 19 9 18 1 14 3 5 5 14 4 20 8 10 4 7 12 18 16 ...', 'output': ['YES\\r\\n17 14 18 16 1 2 5 9 10 -10 15 -15 14 13 10 8 14 4 2 -2 20 3 10 4 -4 17 7 13 6 3 9 8 6 18 20 15 9 6 11 -11 16 14 12 11 7 10 5 14 18 13 10 13 20 18 11 9 14 13 12 10 16 11 12 5 2 11 5 13 4 1 8 9 -9 10 19 11 12 1 13 19 2 3 15 20 5 11 7 5 9 11 7 17 15 9 10 3 12 14 2 14 -14 -2 10 6 7 13 5 8 -8 14 17 9 11 20 -20 14 1 18 2 13 7 9 6 10 16 20 1 8 17 18 16 18 8 9 17 4 7 1 12 13 20 6 17 9 7 19 6 2 5 15 16 8 1 4 11 18 15 -15 4 8 18 13 16 1 8 -8 5 11 15 11 20 7 10 14 3 18 17 12 19 9 18 1 14 3 5 -5 14 4 20 8 10 4 7 ...']}, {'input': '1000000\\r\\n1 4 4 2 2 2 2 1 4 2 2 4 3 2 1 3 2 3 1 2 1 4 1 3 4 3 1 2 3 2 4 1 2 1 3 4 3 2 3 4 3 4 3 1 2 3 4 4 2 1 2 1 1 4 4 1 1 1 4 4 4 1 4 2 3 2 4 4 1 1 1 1 4 2 2 3 2 2 4 4 1 2 4 2 1 4 4 4 1 4 3 4 3 2 2 2 2 2 1 2 3 4 1 3 3 4 3 4 4 3 2 1 3 4 3 3 1 1 3 2 3 4 4 3 2 1 3 4 2 2 1 1 1 2 1 2 2 2 2 2 2 4 4 4 3 1 1 2 2 4 4 2 4 3 1 4 4 2 1 4 1 4 3 1 4 2 2 2 3 2 4 3 2 3 4 1 3 1 3 4 2 3 1 2 2 2 1 2 4 2 4 1 2 2 1 2 2 3 4 1 1 1 4 2 4 4 4 4 4 1 4 2 4 2 3 4 3 1 4 4 3 3 1 3 4 3 1 1 4 2 1 2 2 2 3 3 1 3 2 4 4 3 4 1 3 2 2 2 2 1 2 ...', 'output': ['YES\\r\\n1 4 -4 2 -2 2 -2 -1 4 2 -2 -4 3 2 1 3 2 3 1 2 1 4 1 3 4 3 1 2 3 2 4 1 2 1 3 4 3 2 3 4 3 4 3 1 2 3 4 -4 2 1 2 1 -1 4 -4 1 -1 1 4 -4 4 1 4 2 3 2 4 -4 1 -1 1 -1 4 2 -2 3 2 -2 4 -4 1 2 4 2 1 4 -4 4 1 4 3 4 3 2 -2 2 -2 2 1 2 3 4 1 3 -3 4 3 4 -4 -3 2 1 3 4 3 -3 1 -1 3 2 3 4 -4 -3 -2 1 3 4 2 -2 1 -1 1 2 1 2 -2 2 -2 2 -2 4 -4 4 3 1 -1 2 -2 4 -4 2 4 3 1 4 -4 2 1 4 1 4 3 1 4 2 -2 2 3 2 4 3 2 3 4 1 3 1 3 4 2 3 1 2 -2 2 1 2 4 2 4 1 2 -2 -1 2 -2 3 4 1 -1 1 4 2 4 -4 4 -4 4 1 4 2 4 2 3 4 3 1 4 -4 3 -3 -1 -3 -4 -3 1 ...']}, {'input': '1000000\\r\\n5 5 1 5 5 5 4 3 1 5 2 5 1 1 4 4 5 2 3 2 5 4 2 3 2 5 4 5 5 5 5 5 2 4 4 2 4 4 3 4 3 3 4 1 5 2 3 4 5 5 5 4 3 3 4 4 3 4 5 4 5 1 4 1 4 4 1 5 5 3 2 3 5 5 2 1 1 1 4 4 3 4 4 4 5 3 3 4 4 1 3 2 5 4 4 3 5 5 5 5 5 3 5 2 3 1 5 3 3 2 1 4 4 2 3 3 2 2 3 4 4 4 2 4 3 1 2 5 2 2 2 2 2 1 1 4 3 1 1 4 5 1 2 5 2 1 2 2 4 4 4 4 3 5 5 1 4 2 5 3 5 3 3 4 5 4 2 2 3 4 5 1 1 4 2 5 3 5 5 3 2 5 3 3 5 1 1 4 5 3 1 1 2 1 2 3 3 5 2 2 2 4 2 2 4 2 1 1 2 1 2 4 5 3 3 5 2 4 3 4 4 4 1 4 5 5 3 4 4 1 1 2 1 5 3 4 3 1 2 1 3 5 2 2 1 1 4 3 4 4 4 ...', 'output': ['YES\\r\\n5 -5 1 5 -5 5 4 3 1 5 2 5 1 -1 4 -4 -5 -2 3 2 5 4 2 3 2 5 4 5 -5 5 -5 5 2 4 -4 -2 4 -4 3 4 3 -3 -4 1 5 2 3 4 5 -5 5 4 3 -3 -4 4 3 4 5 4 5 1 4 1 4 -4 -1 5 -5 3 2 3 5 -5 2 1 -1 1 4 -4 3 4 -4 4 5 3 -3 4 -4 1 3 2 5 4 -4 3 5 -5 5 -5 5 3 5 2 3 1 5 3 -3 2 1 4 -4 2 3 -3 -2 2 3 4 -4 4 2 4 3 1 2 5 2 -2 2 -2 2 1 -1 4 3 1 -1 4 5 1 2 5 2 1 2 -2 4 -4 4 -4 3 5 -5 1 4 2 5 3 5 3 -3 4 5 4 2 -2 3 4 5 1 -1 4 2 5 3 5 -5 -3 2 5 3 -3 -5 1 -1 4 5 3 1 -1 2 1 2 3 -3 5 2 -2 2 4 2 -2 -4 -2 1 -1 2 1 2 4 5 3 -3 -5 2 4 3 4 -4 4 1 4...']}, {'input': '1000000\\r\\n137138642 928761285 601426992 468537798 292474836 416470586 857790842 362292486 299205816 154087462 672255408 996427702 470983106 661178270 37194612 111350289 145616325 483221039 913922722 307238603 548699762 864755526 116229324 921637530 135439432 883681139 883681139 683347262 289600592 636857383 499896742 233476367 804217330 507730147 243804917 403972765 658568263 318538366 513029944 412407258 970554675 2405099 974797184 144606466 577663105 266507813 745314392 880622183 563161139 880670379 80349...', 'output': ['YES\\r\\n137138642 928761285 601426992 468537798 292474836 416470586 857790842 362292486 299205816 154087462 672255408 996427702 470983106 661178270 37194612 111350289 145616325 483221039 913922722 307238603 548699762 864755526 116229324 921637530 135439432 883681139 -883681139 683347262 289600592 636857383 499896742 233476367 804217330 507730147 243804917 403972765 658568263 318538366 513029944 412407258 970554675 2405099 974797184 144606466 577663105 266507813 745314392 880622183 563161139 880670379 80349385...']}, {'input': '1000000\\r\\n2 1 2 2 1 2 1 1 2 2 2 2 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 2 2 2 2 2 2 1 1 1 1 2 2 2 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 1 1 1 1 2 2 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 1 2 2 1 1 1 1 2 1 1 1 1 2 1 1 2 2 2 2 1 1 2 1 1 2 2 2 2 1 2 2 1 2 2 2 1 1 1 1 2 2 1 2 2 1 1 1 1 1 1 1 2 2 2 1 1 1 1 2 1 2 1 1 2 1 1 1 1 1 2 2 1 1 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 2 2 1 1 2 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 2 2 1 1 2 2 2 2 2 1 1 ...', 'output': ['YES\\r\\n2 1 2 -2 -1 -2 1 -1 2 -2 2 -2 1 1 -1 -1 2 1 -1 1 2 -2 1 -1 -1 1 -1 -2 2 -2 2 -2 2 1 1 -1 -1 -2 2 -2 1 2 1 -1 -2 -1 1 -1 1 2 1 -1 -2 -1 1 2 1 -1 1 -1 -2 -1 1 2 -2 -1 1 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 -1 1 2 2 -2 1 -1 1 -1 2 -2 1 -1 1 2 1 -1 -2 1 1 -1 -1 -1 -2 2 -2 -1 2 -2 1 -1 1 -1 2 1 -1 1 -1 -2 1 -1 2 -2 2 -2 1 1 2 1 -1 -2 2 2 -2 1 2 -2 -1 -2 2 -2 -1 -1 1 -1 2 -2 1 2 -2 -1 1 -1 1 -1 1 -1 2 2 -2 1 -1 1 -1 -2 1 2 1 -1 -2 -1 1 -1 1 -1 2 -2 1 -1 2 -2 2 2 2 -2 1 -1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 1 1 2 1...']}, {'input': '1000000\\r\\n3 1 1 3 3 1 1 2 3 1 1 2 1 3 3 3 2 3 3 2 3 3 1 3 3 1 1 1 2 1 1 1 2 3 3 2 3 1 1 3 3 1 3 3 3 1 1 2 1 2 1 3 3 2 1 1 3 1 1 1 2 1 2 3 2 2 1 1 2 2 3 3 1 3 1 2 2 3 2 3 3 3 1 1 1 1 2 1 3 1 2 2 1 3 1 1 1 1 3 1 1 1 1 2 1 1 3 3 2 3 1 1 2 2 3 2 3 2 2 1 3 3 3 2 1 3 3 2 1 3 2 3 2 3 1 2 3 2 1 3 3 3 1 1 2 2 2 2 3 1 3 3 2 2 3 2 1 2 1 1 3 3 1 3 3 3 2 2 3 2 3 1 3 1 3 2 1 1 3 1 3 2 1 1 2 1 1 2 2 3 1 3 3 1 1 1 2 2 2 2 1 2 3 3 1 1 3 1 2 3 3 3 1 1 2 2 2 1 2 3 3 2 1 1 3 3 1 3 1 3 3 1 1 3 1 2 3 3 3 2 3 2 2 2 2 1 2 3 3 2 2 ...', 'output': ['YES\\r\\n3 1 -1 -3 3 1 -1 2 3 1 -1 2 1 3 -3 3 2 3 -3 -2 -3 3 1 3 -3 -1 1 -1 2 1 -1 1 2 3 -3 -2 3 1 -1 -3 3 1 3 -3 3 1 -1 2 1 2 1 3 -3 2 1 -1 3 1 -1 1 2 1 2 3 2 -2 1 -1 2 -2 -3 3 1 3 1 2 -2 3 2 3 -3 3 1 -1 1 -1 2 1 3 1 2 -2 -1 -3 -1 1 -1 1 3 1 -1 1 1 2 1 -1 3 -3 -2 3 1 1 2 -2 3 2 3 2 2 1 3 3 3 2 1 3 -3 2 1 3 2 3 2 3 1 2 3 2 1 3 -3 3 1 -1 2 -2 2 -2 -3 1 3 -3 2 -2 3 2 1 2 1 -1 3 -3 1 3 -3 3 2 2 3 2 3 1 3 1 3 2 1 -1 3 1 3 2 1 -1 -2 1 -1 2 -2 -3 -1 -3 3 1 -1 1 2 -2 2 -2 -1 2 3 -3 1 -1 3 1 2 3 -3 3 1 -1 2 -2 2 1 2 3...']}, {'input': '1000000\\r\\n1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 3 ...', 'output': ['YES\\r\\n1 -1 1 -1 1 -1 1 -1 1 -1 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 -4 3 -3 3 -3 3 -3 3 -3 3 -3 2 -2 2 -2 2 -2 2 -2 2 -2 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 3 -3 1 -1 1 -1 1 -1 1 -1 1 -1 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 -4 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 4 -4 4 -4 4 -4 4 -4 4 -4 1 -1 1 -1 1 -1 1 -1 1 -1 3 -3 3 -3 3 -3 3 -3 3 -3 4 -4 4 -4 4 -4 4 -4 4 -4 3 -3 3 -3 3 -3 3 -3 3 -3 1 -1 1 -1 1 -1 1 -1 1 -1 4 -4 4 -4 4 -4 4 -4 4 -4 4 -4 4...']}, {'input': '900000\\r\\n40 40 40 40 40 40 40 40 40 87 87 87 87 87 87 87 87 87 9 9 9 9 9 9 9 9 9 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 99 99 99 99 99 99 99 99 99 79 79 79 79 79 79 79 79 79 89 89 89 89 89 89 89 89 89 87 87 87 87 87 87 87 87 87 67 67 67 67 67 67 67 67 67 76 76 76 76 76 76 76 76 76 84 84 84 84 84 84 84 84 84 83 83 83 83 83 83 83 83 83 41 41 41 41 41 41 41 41 41 6 6 6 6 6 6 6 6 6 50 50 50 50 50 50 50 50 50 2 2 2 2 2 2 2 2 2 45 45 45 45 45 45 45 45 45 84 84 84 84 84 84 84 84 84 85 85 85 85 85 85...', 'output': ['YES\\r\\n40 -40 40 -40 40 -40 40 -40 40 87 -87 87 -87 87 -87 87 -87 87 9 -9 9 -9 9 -9 9 -9 9 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 54 -54 99 -99 99 -99 99 -99 99 -99 99 79 -79 79 -79 79 -79 79 -79 79 89 -89 89 -89 89 -89 89 89 89 87 -87 87 -87 87 -87 87 -87 87 67 -67 67 -67 67 -67 67 -67 67 76 -76 76 -76 76 -76 76 -76 76 84 -84 84 -84 84 -84 84 -84 84 83 -83 83 -83 83 -83 83 -83 83 41 -41 41 -41 41 -41 41 -41 41 6 -6 6 -6 6 -6 6 -6 6 50 -50 50 -50 50 -50 50 -50 50 2 -2 2 -2 2 -2 2 -2 2 45 -45...']}, {'input': '900000\\r\\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 4 4 4 4 4 4 4 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 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 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 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 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2...', 'output': ['YES\\r\\n4 -4 4 -4 4 -4 4 -4 4 4 -4 -4 4 -4 4 -4 4 -4 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 4 -4 4 -4 4 -4 4 -4 4 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -4 4 -4 4 -4 4 -4 4 -4 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 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 2 -2 -1 1 -1 1 -1 1 -1 1 -1 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 1 -1 1 -1 1 -1 1 -1 1 2 -2 2 -2 2 -2 2 -2 2 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 ...']}, {'input': '524286\\r\\n3 3 1 2 5 2 1 4 4 5 5 3 1 2 3 4 5 1 1 4 4 5 2 5 5 5 5 2 4 1 2 4 4 4 4 2 4 3 3 2 2 4 1 3 2 4 4 1 1 1 1 4 3 2 2 2 2 3 4 1 5 2 2 2 2 5 1 3 3 2 2 1 1 2 2 3 5 1 4 2 2 5 5 4 4 5 5 2 2 4 1 1 5 2 2 1 1 5 1 1 1 1 1 1 1 5 1 1 2 3 3 1 1 2 4 2 2 2 2 4 1 2 1 1 1 3 3 1 1 5 5 1 1 1 2 1 3 1 2 3 1 4 3 1 1 4 4 3 3 1 1 3 3 3 4 3 1 2 2 1 1 1 5 5 5 3 3 5 3 1 1 3 5 2 2 3 3 5 4 5 5 4 4 4 3 5 3 4 4 5 5 3 2 2 2 1 1 2 5 1 3 4 1 5 2 5 5 5 5 2 5 3 3 5 5 5 5 1 1 4 4 2 2 1 4 5 5 3 3 4 1 1 2 5 1 2 2 1 1 1 3 3 3 4 4 3 5 4 3 5 5 3...', 'output': ['YES\\r\\n3 -3 1 2 5 2 1 4 -4 5 -5 3 1 2 3 4 5 1 -1 4 -4 -5 2 5 -5 5 -5 -2 -4 1 2 4 -4 4 -4 -2 4 3 -3 2 -2 -4 -1 -3 2 4 -4 1 -1 1 -1 4 3 2 -2 2 -2 -3 -4 1 5 2 -2 2 -2 -5 -1 3 -3 2 -2 1 -1 -2 -2 3 5 1 4 2 -2 5 -5 -4 4 5 -5 2 -2 -4 -1 1 5 2 -2 1 -1 -5 -1 1 -1 1 -1 1 -1 -5 1 1 2 3 -3 1 -1 -2 4 2 -2 2 -2 -4 -1 2 1 -1 1 3 -3 -1 1 5 -5 1 -1 -1 -2 -1 -3 -1 2 3 1 4 3 1 -1 4 -4 -3 3 1 -1 3 -3 -3 -4 3 1 2 -2 -1 1 -1 5 5 -5 3 -3 -5 -3 -1 1 3 5 2 -2 3 -3 -5 4 5 -5 -4 4 -4 -3 5 3 4 -4 5 -5 -3 2 -2 2 1 -1 -2 -5 -1 -3 4 1 5 2...']}, {'input': '524286\\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 1...', 'output': ['YES\\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...']}, {'input': '1000000\\r\\n9018487 625057292 53616409 948301769 16058341 86074020 995118664 453113361 191104162 76545139 392356147 572731607 484477361 104470056 927978437 741327625 636053510 854133095 648890400 59733431 780707232 321808337 282784606 675587945 596690823 645506598 502541488 57337224 778703292 761582976 227006255 772651165 106746928 744170638 755352537 339420815 300687927 552664037 758332585 483140407 668397552 622644789 56013464 392747523 681750266 483068098 527265215 741843235 177471360 542253709 955372540 6...', 'output': ['NO']}, {'input': '1000000\\r\\n5 4 4 5 5 2 4 5 3 2 1 1 5 3 3 5 1 1 1 3 3 3 3 3 4 4 2 3 2 2 1 4 4 4 5 3 4 3 3 4 2 2 4 5 5 3 3 4 4 5 3 1 3 5 2 5 5 3 3 5 3 5 3 3 5 2 5 1 5 3 4 5 3 3 4 4 2 4 3 1 3 1 2 5 2 4 5 4 4 1 2 5 3 1 2 5 3 3 2 4 1 2 1 5 2 3 5 3 5 4 2 3 5 5 1 4 1 1 1 3 3 1 2 4 5 4 4 1 4 1 5 4 3 5 4 1 5 4 3 1 5 3 2 1 4 3 4 2 1 5 4 4 3 3 1 3 1 5 2 1 3 5 1 1 3 4 2 4 4 3 3 4 2 2 3 1 4 3 3 1 3 3 1 3 5 1 2 3 3 1 1 1 5 3 1 3 2 4 4 5 5 5 1 1 1 2 3 1 3 4 5 2 5 4 5 4 4 4 3 5 5 4 2 4 4 1 5 5 4 1 1 2 2 2 5 5 1 1 3 1 2 4 3 5 3 4 2 2 2 5 4 ...', 'output': ['NO']}, {'input': '999999\\r\\n952941789 216877425 940003517 770377586 286303258 929000697 586924179 818192983 344693750 435582488 857258071 687372381 276313411 177576040 177576040 905022591 277723878 809048500 809048500 629038416 46209401 484226048 798345490 580147077 578662621 185207889 906003819 709753896 132899451 892949592 997263732 601786119 751689743 449412516 581343570 171638582 73972597 73972597 916478831 187261524 416723192 376276082 207413048 368804063 754799947 147097820 240352426 614584493 891323679 74493731 4655330...', 'output': ['NO']}, {'input': '1000000\\r\\n896982264 55137100 176161187 667831225 751629610 996424363 181256216 312391421 723639941 9222570 164835787 205775316 633706323 4532449 134356104 956646080 210364398 948778371 112448322 240138147 335217427 437716505 387631958 568376884 167657601 21640780 762683682 515956843 588445545 243639996 206138175 79651552 469459422 159708538 913764059 27229091 481358607 816243598 333794605 69143196 447798544 719263552 999062211 510239058 733661812 406860371 613386119 467380174 186592966 585201541 874758011 7...', 'output': ['YES\\r\\n896982264 55137100 176161187 667831225 751629610 996424363 181256216 312391421 723639941 9222570 164835787 205775316 633706323 4532449 134356104 956646080 210364398 948778371 112448322 240138147 335217427 437716505 387631958 568376884 167657601 21640780 762683682 515956843 588445545 243639996 206138175 79651552 469459422 159708538 913764059 27229091 481358607 816243598 333794605 69143196 447798544 719263552 999062211 510239058 733661812 406860371 613386119 467380174 186592966 585201541 874758011 71774...']}, {'input': '1000000\\r\\n2 4 5 2 5 4 5 5 5 5 1 1 5 3 1 2 4 5 1 1 4 2 2 3 3 1 5 3 2 5 3 1 2 4 4 1 5 3 4 1 2 3 1 4 5 3 5 1 1 4 4 3 2 1 1 2 2 2 4 1 4 2 3 4 4 1 4 4 5 3 3 2 5 4 5 5 3 1 5 2 4 1 3 3 4 4 2 2 2 2 3 4 1 2 3 1 4 2 4 1 5 2 3 4 1 4 1 1 5 5 5 1 5 1 3 1 4 5 4 2 3 3 5 5 5 5 5 1 3 4 5 2 5 3 4 1 2 5 5 1 5 1 1 4 5 2 5 2 5 4 2 5 5 3 1 5 2 4 5 3 1 3 3 3 3 1 2 4 2 2 2 4 4 1 4 3 3 1 5 2 1 4 2 1 2 1 2 5 1 3 5 4 4 5 4 2 1 3 3 1 1 3 1 1 5 1 4 2 4 3 1 4 5 3 3 3 5 5 2 5 3 2 5 3 4 4 4 4 4 2 5 1 2 1 4 2 1 1 4 4 5 1 1 3 2 3 3 4 4 1 4 ...', 'output': ['YES\\r\\n2 4 5 2 5 4 5 -5 5 -5 1 -1 5 3 1 2 4 5 1 -1 4 2 -2 3 -3 1 5 3 2 5 3 1 2 4 -4 1 5 3 4 1 2 3 1 4 5 3 5 1 1 4 -4 3 2 1 -1 -2 2 -2 4 1 4 2 3 4 4 1 4 4 5 3 -3 2 5 4 5 -5 3 1 5 2 4 1 3 -3 4 -4 2 -2 2 -2 3 4 1 2 3 1 4 2 4 1 5 2 3 4 1 4 1 1 5 -5 5 1 5 1 3 1 4 5 4 2 3 -3 5 -5 5 -5 5 1 3 4 5 2 5 3 4 1 2 5 -5 1 5 1 -1 4 5 2 5 2 5 4 2 5 -5 3 1 5 2 4 5 3 1 3 -3 3 -3 -1 2 4 2 -2 2 4 -4 1 4 3 -3 1 5 2 1 4 2 1 2 1 2 5 1 3 5 4 -4 -5 4 2 1 3 -3 -1 1 3 1 -1 5 1 4 2 4 3 1 4 5 3 -3 3 5 -5 2 5 3 2 5 3 4 -4 4 -4 4 2 5 1 2 1...']}, {'input': '1000000\\r\\n240 405 525 920 535 256 887 768 436 474 628 723 776 536 237 342 255 672 632 657 662 505 283 860 94 702 182 587 551 371 989 250 501 462 603 513 878 783 528 849 962 16 116 525 513 916 105 410 704 955 852 742 251 157 587 867 332 58 568 301 122 696 4 760 610 204 964 130 914 575 215 662 176 186 926 55 782 202 826 448 473 588 713 842 533 385 401 814 978 203 203 978 814 401 385 533 842 713 588 473 448 826 202 782 55 926 186 176 662 215 575 914 130 964 204 610 760 4 696 122 301 568 58 332 867 587 157 251 ...', 'output': ['YES\\r\\n240 405 525 920 535 256 887 768 436 474 628 723 776 536 237 342 255 672 632 657 662 505 283 860 94 702 182 587 551 371 989 250 501 462 603 513 878 783 528 849 962 16 116 525 513 916 105 410 704 955 852 742 251 157 587 867 332 58 568 301 122 696 4 760 610 204 964 130 914 575 215 662 176 186 926 55 782 202 826 448 473 588 713 842 533 385 401 814 978 203 -203 -978 -814 -401 -385 -533 -842 -713 -588 -473 -448 -826 -202 -782 -55 -926 -186 -176 -662 -215 -575 -914 -130 -964 -204 -610 -760 -4 -696 -122 -301 ...']}, {'input': '80439\\r\\n35 22 39 34 12 3 26 20 21 33 39 31 6 39 26 9 6 4 20 10 22 29 39 34 8 1 4 19 37 22 3 10 1 10 10 13 16 39 27 31 6 31 5 40 15 26 17 6 21 37 37 41 21 29 24 6 41 10 31 28 15 42 32 35 10 11 12 13 2 30 12 37 33 17 10 23 36 1 5 28 21 35 29 6 19 15 40 2 7 32 8 1 7 28 10 28 41 5 8 41 4 11 10 27 28 3 34 24 12 41 11 11 14 30 20 11 34 33 19 30 39 31 38 28 13 9 20 19 9 19 40 28 26 28 42 15 32 9 37 9 18 42 33 40 34 22 42 38 6 13 20 14 41 4 15 35 36 31 17 14 5 26 32 33 22 19 32 13 5 3 34 42 40 6 41 1 40 19 37 9 19 ...', 'output': ['NO']}, {'input': '100000\\r\\n55 57 39 22 22 39 7 6 30 30 6 7 57 74 74 82 87 22 40 38 75 31 89 5 5 89 31 75 38 40 3 55 67 67 55 3 9 14 95 65 55 55 65 95 14 5 17 45 45 17 89 58 40 73 49 39 39 49 73 40 58 89 5 40 42 42 40 9 22 87 82 52 52 55 16 19 55 18 33 58 61 54 37 13 86 51 88 88 51 86 13 37 54 61 58 33 18 55 19 16 69 69 59 53 1 61 37 100 100 37 61 1 53 59 18 65 4 12 61 61 12 4 51 51 65 15 94 23 12 99 64 76 76 64 99 12 23 94 1 80 60 26 44 89 89 44 34 34 88 86 98 84 80 77 77 80 84 98 86 66 93 57 41 21 68 68 21 41 57 93 66 88 74...', 'output': ['YES\\r\\n55 57 39 22 -22 -39 7 6 30 -30 -6 -7 -57 74 -74 82 87 22 40 38 75 31 89 5 -5 -89 -31 -75 -38 -40 3 55 67 -67 -55 -3 9 14 95 65 55 -55 -65 -95 -14 5 17 45 -45 -17 89 58 40 73 49 39 -39 -49 -73 -40 -58 -89 -5 40 42 -42 -40 -9 -22 -87 -82 52 -52 -55 16 19 55 18 33 58 61 54 37 13 86 51 88 -88 -51 -86 -13 -37 -54 -61 -58 -33 -18 -55 -19 -16 69 -69 59 53 1 61 37 100 -100 -37 -61 -1 -53 -59 18 65 4 12 61 -61 -12 -4 51 -51 -65 15 94 23 12 99 64 76 -76 -64 -99 -12 -23 -94 1 80 60 26 44 89 -89 -44 34 -34 88 86 ...']}, {'input': '1000000\\r\\n60 73 91 87 62 19 98 35 14 91 22 5 23 88 73 54 7 66 28 32 7 80 58 21 13 70 65 76 84 87 51 75 18 27 21 1 81 90 79 93 49 31 34 29 63 37 87 44 61 17 90 12 11 49 100 24 54 7 84 85 48 31 87 53 78 56 23 71 17 59 35 8 21 17 80 49 64 72 21 70 79 86 64 51 27 53 46 82 21 45 14 87 74 57 78 90 3 50 60 13 5 73 78 51 10 77 54 97 6 82 10 87 71 18 24 100 52 71 78 37 97 14 7 29 29 22 92 60 13 34 52 15 67 10 4 86 37 10 67 41 61 81 42 9 51 91 16 44 31 43 90 84 94 57 36 20 16 76 30 70 97 97 3 89 99 73 89 5 84 3 67 65...', 'output': ['YES\\r\\n60 73 91 87 62 19 98 35 14 91 22 5 23 88 73 54 7 66 28 32 7 80 58 21 13 70 65 76 84 87 51 75 18 27 21 1 81 90 79 93 49 31 34 29 63 37 87 44 61 17 90 12 11 49 100 24 54 7 84 85 48 31 87 53 78 56 23 71 17 59 35 8 21 17 80 49 64 72 21 70 79 86 64 51 27 53 46 82 21 45 14 87 74 57 78 90 3 50 60 13 5 73 78 51 10 77 54 97 6 82 10 87 71 18 24 100 52 71 78 37 97 14 7 29 -29 22 92 60 13 34 52 15 67 10 4 86 37 10 67 41 61 81 42 9 51 91 16 44 31 43 90 84 94 57 36 20 16 76 30 70 97 -97 3 89 99 73 89 5 84 3 67 65 7...']}, {'input': '1000000\\r\\n46 83 50 53 37 20 22 49 23 1 37 37 1 23 49 22 20 37 53 50 83 26 25 72 1 77 23 33 55 27 46 68 41 15 60 90 86 18 74 9 24 76 6 5 96 27 92 57 86 54 13 37 31 34 78 5 28 55 65 21 54 52 38 23 8 98 38 31 93 65 75 97 88 30 11 13 51 53 8 78 22 81 85 24 78 62 67 65 7 30 84 27 24 28 34 83 18 37 46 59 48 91 38 64 64 81 76 80 12 56 17 81 58 24 31 48 4 71 42 43 100 80 8 22 8 85 80 45 7 81 54 100 50 78 93 53 15 87 11 45 17 70 44 43 64 23 34 90 21 84 90 79 24 42 29 44 29 37 79 98 27 84 28 71 43 84 73 40 61 18 70 5...', 'output': ['YES\\r\\n46 83 50 53 37 20 22 49 23 1 37 -37 -1 -23 -49 -22 -20 -37 -53 -50 -83 26 25 72 1 77 23 33 55 27 46 68 41 15 60 90 86 18 74 9 24 76 6 5 96 27 92 57 86 54 13 37 31 34 78 5 28 55 65 21 54 52 38 23 8 98 38 31 93 65 75 97 88 30 11 13 51 53 8 78 22 81 85 24 78 62 67 65 7 30 84 27 24 28 34 83 18 37 46 59 48 91 38 64 -64 81 76 80 12 56 17 81 58 24 31 48 4 71 42 43 100 80 8 22 8 85 80 45 7 81 54 100 50 78 93 53 15 87 11 45 17 70 44 43 64 23 34 90 21 84 90 79 24 42 29 44 29 37 79 98 27 84 28 71 43 84 73 40 61 ...']}, {'input': '999990\\r\\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...', 'output': ['YES\\r\\n5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5 -5 5...']}, {'input': '1000000\\r\\n93 33 91 40 11 37 97 89 80 32 96 46 66 77 77 66 46 96 32 80 89 97 37 11 40 91 33 67 25 92 23 17 57 17 52 52 17 20 28 43 92 10 10 92 43 28 69 23 14 38 70 74 76 17 63 87 47 64 55 53 86 77 39 47 8 50 24 88 41 52 97 11 60 70 8 82 92 20 43 72 1 97 13 100 79 3 8 8 3 79 100 13 97 1 72 43 20 95 84 13 10 47 64 74 8 80 67 96 73 34 94 11 9 9 27 56 37 100 82 70 13 82 64 87 95 95 12 37 40 86 66 71 11 29 98 7 86 93 31 64 10 97 54 39 20 96 66 96 64 38 59 39 11 97 1 33 46 81 100 34 11 89 83 93 44 70 90 45 13 21 1...', 'output': ['YES\\r\\n93 33 91 40 11 37 97 89 80 32 96 46 66 77 -77 -66 -46 -96 -32 -80 -89 -97 -37 -11 -40 -91 -33 67 25 92 23 17 57 17 52 -52 -17 20 28 43 92 10 -10 -92 -43 -28 69 23 14 38 70 74 76 17 63 87 47 64 55 53 86 77 39 47 8 50 24 88 41 52 97 11 60 70 8 82 92 20 43 72 1 97 13 100 79 3 8 -8 -3 -79 -100 -13 -97 -1 -72 -43 -20 95 84 13 10 47 64 74 8 80 67 96 73 34 94 11 9 -9 27 56 37 100 82 70 13 82 64 87 95 -95 12 37 40 86 66 71 11 29 98 7 86 93 31 64 10 97 54 39 20 96 66 96 64 38 59 39 11 97 1 33 46 81 100 34 11 8...']}, {'input': '1000000\\r\\n10 86 96 78 62 43 90 18 56 97 72 27 8 5 90 20 80 67 80 48 61 1 56 75 68 15 64 4 44 69 97 55 42 94 97 64 17 72 70 2 75 81 3 67 45 49 76 85 23 87 33 42 60 58 52 77 5 76 54 96 76 90 65 95 97 83 88 35 28 15 43 84 27 25 57 89 12 100 48 13 98 55 56 55 21 92 44 7 56 66 82 56 87 16 86 11 90 14 75 98 9 96 86 27 26 82 64 52 29 2 94 67 43 18 39 82 30 65 23 40 20 29 80 100 31 27 3 32 38 90 36 23 99 51 86 55 89 23 14 61 64 23 2 71 91 20 76 12 2 87 69 65 34 24 16 56 99 19 4 100 13 40 93 48 26 44 55 17 19 90 20 ...', 'output': ['NO']}]","id":471} {"difficulty":1900,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"c16c49baf7b2d179764871204475036e","execute_outcome":"WRONG_ANSWER","source_code":"import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\n\ninline fun just(c: Char) = run {\n when(c) {\n '*', '?', '.' -> -1\n else -> c - '0'\n }\n}\n\ninline fun bombable(c: Char) = run {\n when(c) {\n '*', '?' -> true\n else -> false\n }\n}\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val S = \"..${ns()}..\"\n val N = S.length\n val dp = Array(N){Array(2){LongArray(2)} }\n dp[1][0][0] = 1\n\n for (i in 2 until N) {\n for (cur in 0 until 2) {\n if (!bombable(S[i]) && cur == 1) continue\n for (pre in 0 until 2) {\n for (prepre in 0 until 2) {\n val preJust = just(S[i - 1])\n if (preJust != -1 && preJust != cur + prepre) continue\n\n dp[i][pre][cur] += dp[i - 1][prepre][pre]\n if (dp[i][pre][cur] >= MOD) dp[i][pre][cur] -= MOD\n }\n }\n }\n debug{\"DP($i)\"}\n debugDim(dp[i])\n }\n\n val ans = dp[N-1][0][0]\n out.println(ans)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n \/\/ \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl()\n }\n return res\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n \/**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n *\/\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}","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"],"human_solution":"import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\n\ninline fun just(c: Char) = run {\n when(c) {\n '*', '?', '.' -> -1\n else -> c - '0'\n }\n}\n\ninline fun bombable(c: Char) = run {\n when(c) {\n '*', '?' -> true\n else -> false\n }\n}\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val S = \"..${ns()}..\"\n val N = S.length\n val dp = Array(N){Array(2){LongArray(2)} }\n dp[1][0][0] = 1\n\n for (i in 2 until N) {\n for (cur in 0 until 2) {\n if (!bombable(S[i]) && cur == 1) continue\n if (S[i] == '*' && cur == 0) continue\n \n for (pre in 0 until 2) {\n for (prepre in 0 until 2) {\n val preJust = just(S[i - 1])\n if (preJust != -1 && preJust != cur + prepre) continue\n\n dp[i][pre][cur] += dp[i - 1][prepre][pre]\n if (dp[i][pre][cur] >= MOD) dp[i][pre][cur] -= MOD\n }\n }\n }\n debug{\"DP($i)\"}\n debugDim(dp[i])\n }\n\n val ans = dp[N-1][0][0]\n out.println(ans)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n \/\/ \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl()\n }\n return res\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n \/**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n *\/\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\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":472} {"difficulty":1900,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"c1de33ee9bb05db090c4d23ec9994f72","execute_outcome":"RUNTIME_ERROR","source_code":"@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n\/** @author Spheniscine *\/\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val s = readLn()\n val k = readInt()\n\n val n = s.length\n val C = List(n) { IntArray(n - it + 1) }\n for (l in 2 .. n) {\n for (i in 0 .. n - l) {\n C[i][l] = C[i+1][l-2]\n if(s[i] != s[i+l-1]) C[i][l]++\n }\n }\n\n val D = List(k+1) { IntArray(n+1) { Int.MAX_VALUE } }\n val P = List(k+1) { IntArray(n+1) }\n\n D[0][0] = 0\n\n for(i in 0 until k) {\n for(j in 0 until n) {\n if(D[i][j] == Int.MAX_VALUE) continue\n for(l in 1 .. n-j) {\n if(D[i+1].setMin(j+l, D[i][j] + C[i][l])) P[i+1][j+l] = l\n }\n }\n }\n\n val kf = (0..k).minBy { D[it][n] }!!\n val cost = D[kf][n]\n val pals = Array(kf) { \"\" }\n var j = n\n for(i in kf downTo 1) {\n val l = P[i][j]\n j -= l\n pals[i-1] = buildString {\n val sub = s.substring(j, j + (l\/2))\n append(sub)\n if(l and 1 == 1) append(s[j + l\/2])\n append(sub.reversed())\n }\n }\n\n println(cost)\n println(pals.joinToString(\"+\"))\n}\n\nfun IntArray.setMin(i: Int, v: Int): Boolean {\n if(v < get(i)) {\n set(i, v)\n return true\n }\n return false\n}\n\n\/** IO code start *\/\n\/\/@JvmField val INPUT = File(\"input.txt\").inputStream()\n\/\/@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n\/** shuffles and sort overrides to avoid quicksort attacks *\/\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n \/\/ Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}","description":"Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite game Fur2 and didn't have enough time to do the literature task. As Innocentius didn't want to get an F, he decided to do the task and read the book called \"Storm and Calm\" during the IT and Math lessons (he never used to have problems with these subjects). When the IT teacher Mr. Watkins saw this, he decided to give Innocentius another task so that the boy concentrated more on the lesson and less \u2014 on the staff that has nothing to do with IT. Mr. Watkins said that a palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. A concatenation of strings a, b is a string ab that results from consecutive adding of string b to string a. Of course, Innocentius knew it all but the task was much harder than he could have imagined. Mr. Watkins asked change in the \"Storm and Calm\" the minimum number of characters so that the text of the book would also be a concatenation of no more than k palindromes. Innocentius can't complete the task and therefore asks you to help him.","input_specification":"The first input line contains a non-empty string s which is the text of \"Storm and Calm\" (without spaces). The length of the string s does not exceed 500 characters. String s consists of uppercase and lowercase Latin letters. The second line contains a single number k (1\u2009\u2264\u2009k\u2009\u2264\u2009|s|, where |s| represents the length of the string s).","output_specification":"Print on the first line the minimum number of changes that Innocentius will have to make. Print on the second line the string consisting of no more than k palindromes. Each palindrome should be non-empty and consist of uppercase and lowercase Latin letters. Use the character \"+\" (ASCII-code 43) to separate consecutive palindromes. If there exist several solutions, print any of them. The letters' case does matter, that is an uppercase letter is not considered equivalent to the corresponding lowercase letter.","notes":null,"sample_inputs":["abacaba\n1","abdcaba\n2","abdcaba\n5","abacababababbcbabcd\n3"],"sample_outputs":["0\nabacaba","1\nabdcdba","0\na+b+d+c+aba","1\nabacaba+babab+bcbabcb"],"human_solution":"@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n\/** @author Spheniscine *\/\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val s = readLn()\n val k = readInt()\n\n val n = s.length\n val C = List(n) { IntArray(n - it + 1) }\n for (l in 2 .. n) {\n for (i in 0 .. n - l) {\n C[i][l] = C[i+1][l-2]\n if(s[i] != s[i+l-1]) C[i][l]++\n }\n }\n\n val D = List(k+1) { IntArray(n+1) { Int.MAX_VALUE } }\n val P = List(k+1) { IntArray(n+1) }\n\n D[0][0] = 0\n\n for(i in 0 until k) {\n for(j in if(i == 0) 0..0 else i until n) {\n for(l in 1 .. n-j) {\n if(D[i+1].setMin(j+l, D[i][j] + C[j][l])) P[i+1][j+l] = l\n }\n }\n }\n\n val kf = (0..k).minBy { D[it][n] }!!\n val cost = D[kf][n]\n val pals = Array(kf) { \"\" }\n var j = n\n for(i in kf downTo 1) {\n val l = P[i][j]\n j -= l\n pals[i-1] = buildString {\n val sub = s.substring(j, j + (l\/2))\n append(sub)\n if(l and 1 == 1) append(s[j + l\/2])\n append(sub.reversed())\n }\n }\n\n println(cost)\n println(pals.joinToString(\"+\"))\n}\n\nfun IntArray.setMin(i: Int, v: Int): Boolean {\n if(v < get(i)) {\n set(i, v)\n return true\n }\n return false\n}\n\n\/** IO code start *\/\n\/\/@JvmField val INPUT = File(\"input.txt\").inputStream()\n\/\/@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n\/** shuffles and sort overrides to avoid quicksort attacks *\/\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n \/\/ Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}","testcases":"[{'input': 'abacaba\\r\\n1\\r\\n', 'output': ['0\\r\\nabacaba\\r\\n']}, {'input': 'abdcaba\\r\\n2\\r\\n', 'output': ['1\\r\\nabdcdba\\r\\n']}, {'input': 'abdcaba\\r\\n5\\r\\n', 'output': ['0\\r\\na+b+d+c+aba\\r\\n']}, {'input': 'abacababababbcbabcd\\r\\n3\\r\\n', 'output': ['1\\r\\nabacaba+babab+bcbabcb\\r\\n']}, {'input': 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n1\\r\\n', 'output': ['0\\r\\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n']}, {'input': 'abcabcabcabcxyzxyzxyzxyz\\r\\n5\\r\\n', 'output': ['7\\r\\na+b+cabcaacbac+xyzxyzzyxzyx\\r\\n']}, {'input': 'aaaaaabbbbbb\\r\\n1\\r\\n', 'output': ['6\\r\\naaaaaaaaaaaa\\r\\n']}, {'input': 'abcdefg\\r\\n7\\r\\n', 'output': ['0\\r\\na+b+c+d+e+f+g\\r\\n']}, {'input': 'xxxyyyzzz\\r\\n2\\r\\n', 'output': ['3\\r\\nxxxyyyxxx\\r\\n']}, {'input': 'zpbdnUpuVzOCzkgMmOXMgnrWrrHAylLovxRLSkRyRlsyZXUYBXZqjpWiHhjwEnNhJTBEFqSvgoSzcDSnNJXdDEyJwyxyEZdtTKcm\\r\\n30\\r\\n', 'output': ['22\\r\\nz+pbddbp+u+V+zOOz+k+gMmOmMg+n+rWr+r+H+A+y+l+L+o+v+x+RLSLR+yRlRy+ZXUYUXZ+qjpWiHhjwEwjhHiWpjq+SvgvS+z+c+D+SnNnS+dDEyJwwJyEDd+tTKTt\\r\\n']}, {'input': 'a\\r\\n1\\r\\n', 'output': ['0\\r\\na\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n1\\r\\n', 'output': ['200\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': 'y\\r\\n1\\r\\n', 'output': ['0\\r\\ny\\r\\n']}, {'input': 'NbdjyyjdbN\\r\\n1\\r\\n', 'output': ['0\\r\\nNbdjyyjdbN\\r\\n']}, {'input': 'ttniaiCiCp\\r\\n5\\r\\n', 'output': ['0\\r\\ntt+n+iai+CiC+p\\r\\n']}, {'input': 'GCDnnDCzmNvNmzQQmTzYWtwEaWiiWaEwtWYzTmsDODszuzRWcOzWmhmWzOcWRzuzhhTWawwaWTywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n10\\r\\n', 'output': ['0\\r\\nG+CDnnDC+zmNvNmz+QQ+mTzYWtwEaWiiWaEwtWYzTm+sDODs+zuzRWcOzWmhmWzOcWRzuz+hh+TWawwaWT+ywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n']}, {'input': 'SWPEISxfnvQhDdWMUMDDFAgnjkoNpKZJWgeftsapnfTiTULMcl\\r\\n50\\r\\n', 'output': ['0\\r\\nS+W+P+E+I+S+x+f+n+v+Q+h+D+d+W+MUM+DD+F+A+g+n+j+k+o+N+p+K+Z+J+W+g+e+f+t+s+a+p+n+f+TiT+U+L+M+c+l\\r\\n']}, {'input': 'QBJXFByWnwnwyusOgBKpUqxTjfEJaPrRYUHItEVI\\r\\n3\\r\\n', 'output': ['14\\r\\nQBJXFByWnwnWyBFXJBQ+pUqxTjfEEfjTxqUp+ItEtI\\r\\n']}, {'input': 'YGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n1\\r\\n', 'output': ['0\\r\\nYGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n']}, {'input': 'QsAQXXlArrAlXaBSSBaX\\r\\n4\\r\\n', 'output': ['1\\r\\nQssQ+XX+lArrAl+XaBSSBaX\\r\\n']}, {'input': 'npRAxpncpgQqTHHTqQgpcSbYEhvKBPRDUjnXznRXnjUDRPlKvhEYbNgrtVweZIhmyEqEymhItDwVtrgN\\r\\n5\\r\\n', 'output': ['5\\r\\nnpRARpn+cpgQqTHHTqQgpc+S+bYEhvKBPRDUjnXznzXnjUDRPBKvhEYb+NgrtVweZIhmyEqEymhIZewVtrgN\\r\\n']}, {'input': 'WdYlPYGSNSGYPlYdWpIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhzVWOelUjtrMyIpZassaZBSohcqchoSBZKgKZlhMOXMoMXOMZGZvvRkqSOmHWZxSxZWHmOSrkRvvWPW\\r\\n10\\r\\n', 'output': ['3\\r\\nWdYlPYGSNSGYPlYdW+pIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhiVWOelUjtrMyIp+ZassaZ+BSohcqchoSB+ZKgKZ+ll+MOXMoMXOM+ZGZ+vvRkqSOmHWZxSxZWHmOSqkRvv+WPW\\r\\n']}, {'input': 'vbjmuTEWtvQvdMHTuUogvaWmqiwwPmJaupYrqhRfiRRifqhVMxMWIJPPJBnyJkToeUUdAfjoXzCTyMBVUMyTPyXYYBxmcHNTBcCcmxRXwOtmsbwXHKccOHtPtWWvCtMCkcMlfMTRhazNVkeWNCaPRP\\r\\n20\\r\\n', 'output': ['37\\r\\nvbjmuTEWtvQvtWETumjbv+aWmqiwiqmWa+u+p+YrY+hRfiRRifRh+VMxMV+IJPPJI+nyJyn+oeUUdUUeo+XzCTyMBVBMyTCzX+YY+BxmcHNTTNHcmxB+XwOtmtOwX+HKccKH+tPt+WW+vCtMCkCMtCv+TRhazNVkkVNzahRT\\r\\n']}, {'input': 'DdHqZfmOqjEoTvmDQiiRFdfMzfRjLUCwFYdfBaZvNPlocnwtkBKmzVGPBxJhmxnDlCOlqiZoKXWgzXundzeEaRbYpqbTtPEnGgRzpdXLmNThaJSBzPglWuywvRkzaQEUHzPVfZOiFOZxymgmAAdnks\\r\\n20\\r\\n', 'output': ['53\\r\\nDdD+qZffZq+jEj+TvmDQiiRFdfMzfRfzMfdFRiiQDmvT+PlocnwtktwncolP+BxJhJxB+D+lCCl+qiZiq+XWgWX+undzeEaRbYbRaEezdnu+gRzpdXLmNNmLXdpzRg+lWuyuWl+kzaQEQazk+VfZOiiOZfV+mgm+AA+d+nkn\\r\\n']}, {'input': 'gwsEqXXqEswgETtttTEmQakaBmHOiOHwQQwzWuylXwwfuufwwXlyuWzxVeQQeVMRAUZDMBggBMDZUARDPGKKGPDUUDKDQQNENtiWLLLLWitNlKvvKlNJbJjijQvFOFvQXwKKKKwKznTmTnzKuNxlxNucynmmnymMqBqMmTUnCjCnUTEqFKSmQQmSKFqAmKNNKmARRoRR\\r\\n30\\r\\n', 'output': ['2\\r\\ngwsEqXXqEswg+ETtttTE+mQakaQm+HOiOH+wQQw+zWuylXwwfuufwwXlyuWz+xVeQQeVx+RAUZDMBggBMDZUAR+DPGKKGPD+UU+DKD+QQ+NEN+tiWLLLLWit+NlKvvKlN+JbJ+jij+QvFOFvQ+X+wKKKKw+KznTmTnzK+uNxlxNu+c+ynmmny+mMqBqMm+TUnCjCnUT+E+qFKSmQQmSKFq+AmKNNKmA+RRoRR\\r\\n']}, {'input': 'eVxEoJPwziDXrGUnqlbhwhbloeUGrXDYzwPwtExVeoLVCZZZZCVLoCRzukaOmLtpRJRSzNIbXAlTtsoUyyerrtYlAXgIEzSRJRFtLmVakuzcCwtKUmLeAmuAeLmUKtwxJVRmekiKrArArHJqemRVJxSllejgLHybDDbyULgjFoLdYsXOtmjnZvQkiiikQvZnjmuOXsOdLnFEpepefnxilxnEnpepfUjQOjIoAtmtRRCqnRRtmtAoIGOQjP\\r\\n10\\r\\n', 'output': ['30\\r\\neVxEoJPwziDXrGUnqlbhwhblqnUGrXDizwPJoExVe+oLVCZZZZCVLo+CRzukaOmLtpRJRSzNIbXAlTtsoUyyUostTlAXbINzSRJRptLmOakuzRC+wtKUmLeAmmAeLmUKtw+xJVRmekiKrArArKikemRVJx+SllS+jgLHybDDbyHLgj+FoLdYsXOtmjnZvQkiiikQvZnjmtOXsYdLoF+EpepefnxiixnfepepE+UjQOjIoAtmtRRCqCRRtmtAoIjOQjU\\r\\n']}, {'input': 'wRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n1\\r\\n', 'output': ['0\\r\\nwRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n']}, {'input': 'fgYTcOUewXjIIjXweUbcTogfniuXbkOCWRKsWCOkbXAinbubBYxyQQyxYBKypwIvfItIfvIwpyKRfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWkzmBwXcDzWXXwIBQJEVbYQVDLHExeXAHuJXfxoilFOXzbbzRKeliocpOvyNOycwdHjbbjHdwcyONhvOWcIYhQbnwnbFNYIxPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgLZyLHZAJNwSzuKJPLfOtJMitSaTYyBeygPxkiRVhIVSCIvJvvJGICSVWhVRpBCiPWNVCnlnCVNWPiCDVBqKHFWufvpwsswyvfuWFHKqBVD\\r\\n13\\r\\n', 'output': ['38\\r\\nfgYTcOUewXjIIjXweUOcTYgf+niuXbkOCWRKRWCOkbXuin+bub+BYxyQQyxYB+KypwIvfItIfvIwpyK+RfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWWzmBoXcDzWXYwIBQJnVbWQVBUnAxeXcHTJXfR+oilFOXzbbzXOFlio+cpOvyNOycwdHjbbjHdwcyONyvOpc+IYhQbnwnbQhYI+xPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgNZyaHZAJfwBzuKJPLzOtRFitSQUYyBcygPx+kiRVhIVSCIvJvvJvICSVIhVRik+CiPWNVCnlnCVNWPiC+DVBqKHFWufvpwsswpvfuWFHKqBVD\\r\\n']}, {'input': 'anZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n1\\r\\n', 'output': ['0\\r\\nanZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n']}, {'input': 'sODJlDMHKskoUnPqUoksKHMDTJDOqqutqYPGWYqtulMAbgQcBSzSjfoiYyjIbrZxzughddhguzxZubIQeYiofjSziBcQgbAMWcckXcWUUWcXkpkSDTHeNNeHTDSkpgguDk\\r\\n94\\r\\n', 'output': ['0\\r\\ns+O+D+J+l+D+M+H+K+s+k+o+U+n+P+q+U+o+k+s+K+H+M+D+T+J+D+O+qq+u+t+q+Y+P+G+W+Y+q+t+u+l+M+A+b+g+Q+c+B+SzS+j+f+o+i+Y+y+j+I+b+r+ZxzughddhguzxZ+u+b+I+Q+e+Y+i+o+f+j+S+z+i+B+c+Q+g+b+A+M+W+cc+kXcWUUWcXk+pkSDTHeNNeHTDSkp+gg+u+D+k\\r\\n']}, {'input': 'eAfVVOAwrZUBZrddkqHxmfuTbSDozpObTuffxEpkUvphyFhwaFhhiKhZeGEVvWGUkGptGBdMHTYYQcCdHBHDdYdDotouzzDrMHuuHMrELXcuoGpTmUUnoNzUfUmTpGoFcXLEkcYsCmcTvuoSmIDIjO\\r\\n101\\r\\n', 'output': ['4\\r\\ne+A+f+VV+O+A+w+r+Z+U+B+Z+r+dd+k+q+H+x+m+f+u+T+b+S+D+o+z+p+O+b+T+u+ff+x+E+p+k+U+v+p+h+y+F+h+w+a+F+hh+i+K+h+Z+e+G+E+V+v+W+G+U+k+G+p+t+G+B+d+M+H+T+YY+Q+c+C+d+HBH+DdYdD+oto+u+zz+D+rMHuuHMr+ELXcuoGpTmUUnoNonUUmTpGoucXLE+k+c+Y+s+C+m+c+T+v+u+o+S+m+IDI+j+O\\r\\n']}, {'input': 'kKBYQwipkLMkqjltKKagWfXynkXOHfHsbthvYsUyAsAfWcbjOlFFaICcpmBVBiteGerPiKjdMZqwdyirPDgJdJOHonMXWkvRVFKxkXCeqUsjeSMZpgMUPRRTiQGfGbySUIJnsnGprQFmFrZJfylAGB\\r\\n114\\r\\n', 'output': ['5\\r\\nk+K+B+Y+Q+w+i+p+kLLk+q+j+l+t+KK+a+g+W+f+XynyX+O+HfH+sbthtbs+U+y+AsA+f+W+c+b+j+O+l+FF+a+I+C+c+p+m+BVB+i+t+eGe+r+P+i+K+j+d+M+Z+q+w+d+y+i+r+P+D+g+JdJ+O+H+o+n+M+X+W+k+v+R+V+F+K+x+k+X+C+e+q+U+s+j+e+S+MZpZM+U+P+RR+T+i+Q+GfG+b+y+S+U+I+J+nsn+G+p+r+Q+FmF+r+Z+J+f+y+l+A+G+B\\r\\n']}, {'input': 'tjTBpykkypBTjIexukbkuxeSJNRzEEzRNJScwVwDrUozZYYZzoUruauBzjssNzBbSSbXUWcjUvUjcWUePndNNdxxDFSiPnvjiijvnPiSFDxxAyaayAYzjBBjzBuWItiDUDNfawfwafNDUDiuIWuBjAWRPiPRWAtXewGGwTXtTTvejJJjtvJJFyjyFDDXaWwvCCCvwWaX\\r\\n182\\r\\n', 'output': ['0\\r\\nt+jTBpykkypBTj+I+exukbkuxe+SJNRzEEzRNJS+c+wVw+D+rUozZYYZzoUr+uau+B+z+j+ss+N+z+B+bSSb+X+UWcjUvUjcWU+e+P+n+dNNd+xxDFSiPnvjiijvnPiSFDxx+AyaayA+Y+zjBBjz+B+u+W+I+t+iDUDNfawfwafNDUDi+u+I+W+u+B+j+AWRPiPRWA+t+X+e+wGGw+T+X+t+TT+v+e+jJJj+t+v+JJ+FyjyF+DD+XaWwvCCCvwWaX\\r\\n']}, {'input': 'zQQziKpcCZVKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXTodxZMezrlsBlGUZWMrMiKVuCcGGLQYgqifBVjvGoGSjVBfiqsYQLGLGqeWyuxJhhJHuyNeqwrNQuOvlsJBlokJcZujGRrnJRmmRJuWRGjuhcJkYIBJslVOuyNrQolfIepLARflumuIjUoKZeoBQdYGxYvFDFvYSGsdnaoeZKMUjIXmulfRBLyeIfloglNoaRXNeNXRkoNegAA\\r\\n41\\r\\n', 'output': ['21\\r\\nzQQz+i+K+p+c+C+Z+VKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXPodxZMezrlsvlGUZvMrMiKV+u+C+c+GG+LQYgqifBVjvGoGvjVBfiqgYQL+GLG+q+e+W+y+u+x+JhhJ+H+u+y+N+e+q+w+rNQuOvlsJBlokJcZujGRrnJRmmRJnrRGjuZcJkolBJslvOuQNr+Q+olfIepLARflumuIjUoKZeoBQdYGxYvFDFvYxGYdQBoeZKoUjIumulfRALpeIflo+g+l+NoaRXNeNXRaoN+e+g+AA\\r\\n']}, {'input': 'NIwgwfTKMVQyCQXyWNtvjwlPpwjkDDnRdNdyvdtSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwUJFViLADpYhJslnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJStrvydNdRnDDkjwpPlwjvtNWUXQCyQVMKTfwgwIN\\r\\n85\\r\\n', 'output': ['2\\r\\nN+I+wgw+f+T+K+M+V+Q+y+C+Q+X+y+W+N+t+v+j+w+l+P+p+w+j+k+DD+n+R+dNd+y+v+d+tSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwxJFViLADpYhJulnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJSt+r+v+y+dNd+R+n+DD+k+j+w+p+P+l+w+j+v+t+N+W+U+X+Q+C+y+Q+V+M+K+T+f+wgw+I+N\\r\\n']}, {'input': 'acaoDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzOjIRmrFjORuyxAZhRDoBjNJGNMFFMTQsNjBtTTtZFZPBRzKnGvYUuwyWixoqSkxBJqoWiWTIuUYvGnKzRoaITJjRiuIIifpNwnOBGBOnwNpfiIIukajjQbplxlpbQiDLNLCZCzfxLxyJnMEMrdQKBbWWqaOXdGORUHwXcadcXwHMROGAXOaqMKpBKQdLMAGIJyxLxfHCZCLNLDyewSmLIRpACnNONNnCApVILmSweyFofWbAfttMArOnrMdNysgofPNujqwwJJwCqjuDPfngsyNdsXnOrAMtmfAaWPoFYRhBmMgLgXmvxBY\\r\\n131\\r\\n', 'output': ['16\\r\\naca+oDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzSjIzJrFjOyuyxqZhRDo+B+j+N+J+G+N+MFFM+T+Q+s+N+j+B+tTTt+ZFZ+P+B+R+z+K+n+G+v+Y+U+u+w+y+W+i+x+o+q+S+k+x+B+J+q+o+WiW+T+I+u+U+Y+v+G+n+K+z+R+o+a+I+T+J+j+R+i+uIIifpNwnOBGBOnwNpfiIIu+k+a+jj+QbplxlpbQ+i+D+LNL+CZC+z+f+xLx+y+J+n+MEM+r+d+Q+K+B+b+WW+qaOXdGORUHwXcaacXwHUROGdXOaq+M+K+p+B+K+Q+d+L+M+A+G+I+J+y+xLx+f+H+CZC+LNL+D+yewSmLIRpACnNOONnCApRILmSwey+F+o+f+W+b+AfttMArOnrMdNysgofPNujqwwJJwwqjuNPfogsyNdMrnOrAMttfA+a+W+P+o+F+Y+R+h+B+m+M+gLg+X+m+v+x+B+Y\\r\\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n400\\r\\n', 'output': ['0\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': 'aa\\r\\n1\\r\\n', 'output': ['0\\r\\naa\\r\\n']}, {'input': 'aA\\r\\n1\\r\\n', 'output': ['1\\r\\naa\\r\\n']}, {'input': 'aA\\r\\n2\\r\\n', 'output': ['0\\r\\na+A\\r\\n']}]","id":473} {"difficulty":1700,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"cb47d710361979de0f975cc34fc22c7a","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*\n\nprivate const val MODULO = 1000000007\n\nfun Long.to(): Int = (this shr 32).toInt() \nfun Long.from(): Int = (this and 0xFFFFL).toInt()\n\nfun bus(from: Int, to: Int): Long =\n (to.toLong() shl 32) + from\n\nclass TaskD(numSegments: Int, val buses: LongArray) {\n var count: IntArray\n var countSum: IntArray\n\n init {\n var allStops = IntArray(buses.size * 2 + 2)\n for (i in 0 until buses.size) {\n allStops[i * 2] = buses[i].from()\n allStops[i * 2 + 1] = buses[i].to()\n }\n allStops[allStops.size - 2] = 0\n allStops[allStops.size - 1] = numSegments\n allStops.sort()\n var i = 0\n var j = 1\n while (j < allStops.size) {\n if (allStops[i] != allStops[j]) {\n allStops[++i] = allStops[j++]\n } else {\n j++\n }\n }\n allStops = allStops.copyOf(i + 1)\n\n val stopIndices = sortedMapOf()\n for (i in 0 until allStops.size)\n stopIndices[allStops[i]] = i\n\n for (i in buses.indices) {\n val bus = buses[i] \n buses[i] = bus(stopIndices[bus.from()]!!, stopIndices[bus.to()]!!)\n }\n\n buses.sort()\n\n count = IntArray(stopIndices.size)\n count[0] = 1\n countSum = IntArray(count.size, { 1 })\n countSum[0] = 0\n }\n\n fun result() = mod(count.last(), MODULO)\n\n fun run() {\n var lastTo = 0\n var total = 0\n for (b in buses) {\n val countDelta = mod(countSum[b.to()] - countSum[b.from()], MODULO)\n addCount(b.to(), countDelta)\n }\n\n\/\/ addCount(lastTo, total)\n }\n\n fun addCount(i: Int, d: Int) {\n count[i] = (count[i] + d) % MODULO\n for (j in i + 1 until countSum.size)\n countSum[j] = (countSum[j] + d) % MODULO\n }\n\n fun print() {\n println(result())\n }\n}\n\nfun mod(n: Int, m: Int): Int = (n % m + m) % m\n\nfun cfd() = with(Scanner(System.`in`)) {\n val numSegments = nextInt();\n val numbuses = nextInt()\n val buses = LongArray(numbuses) {\n val from = nextInt()\n val to = nextInt()\n bus(from, to)\n }\n\n with(TaskD(numSegments, buses)) {\n run()\n print()\n }\n}\n\nfun main(args: Array) {\n if (args.size == 0) cfd()\n}","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"],"human_solution":"import java.util.*\nimport java.util.Arrays.binarySearch\n\nprivate const val MODULO = 1000000007\n\nfun Long.to(): Int = (this shr 32).toInt()\nfun Long.from(): Int = (this and 0xFFFF_FFFFL).toInt()\n\nfun bus(from: Int, to: Int): Long =\n (to.toLong() shl 32) + from\n\nclass TaskD(numSegments: Int, val buses: LongArray) {\n val lastStopI: Int\n var countSum: IntArray\n var countSumSize = 0\n\n init {\n var allStops = IntArray(buses.size * 2 + 2)\n for (i in 0 until buses.size) {\n allStops[i * 2] = buses[i].from()\n allStops[i * 2 + 1] = buses[i].to()\n }\n allStops[allStops.size - 2] = 0\n allStops[allStops.size - 1] = numSegments\n allStops.sort()\n var i = 0\n var j = 1\n while (j < allStops.size) {\n if (allStops[i] != allStops[j]) {\n allStops[++i] = allStops[j++]\n } else {\n j++\n }\n }\n allStops = allStops.copyOf(i + 1)\n lastStopI = allStops.size - 1\n\n for (i in buses.indices) {\n val bus = buses[i]\n val from = binarySearch(allStops, bus.from())\n val to = binarySearch(allStops, bus.to())\n buses[i] = bus(from, to)\n }\n\n buses.sort()\n\n countSum = IntArray(allStops.size + 1)\n countSum[0] = 0\n countSum[1] = 1\n countSumSize = 2\n }\n\n fun result() =\n if (lastStopI + 1 >= countSumSize) 0\n else mod(countSum[lastStopI + 1] - countSum[lastStopI], MODULO)\n\n\n fun run() {\n for (b in buses) {\n val currTo = b.to()\n countSumEnsureSize(currTo + 2)\n val countDelta = mod(countSum[currTo] - countSum[b.from()], MODULO)\n addCount(currTo, countDelta)\n }\n }\n\n fun addCount(i: Int, d: Int) {\n for (j in (i + 1)..(countSumSize - 1))\n countSum[j] = mod(countSum[j] + d, MODULO)\n }\n\n fun countSumEnsureSize(size: Int) {\n if (countSumSize >= size) return\n for (i in (countSumSize - 1 + 1)..(size - 1))\n countSum[i] = countSum[i - 1]\n countSumSize = size\n }\n\n fun print() {\n println(result())\n }\n}\n\nfun mod(n: Int, m: Int): Int = (n % m + m) % m\n\nfun cfd() = with(Scanner(System.`in`)) {\n val numSegments = nextInt();\n val numbuses = nextInt()\n val buses = LongArray(numbuses) {\n val from = nextInt()\n val to = nextInt()\n bus(from, to)\n }\n\n with(TaskD(numSegments, buses)) {\n run()\n print()\n }\n}\n\nfun main(args: Array) {\n if (args.size == 0) cfd()\n}\n","testcases":"[{'input': '2 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2\\r\\n0 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 5\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 10\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n0 6\\r\\n0 7\\r\\n0 8\\r\\n0 9\\r\\n0 10\\r\\n', 'output': ['512\\r\\n']}, {'input': '6 6\\r\\n3 4\\r\\n2 3\\r\\n3 5\\r\\n0 1\\r\\n1 2\\r\\n3 6\\r\\n', 'output': ['4\\r\\n']}, {'input': '7 7\\r\\n0 1\\r\\n1 3\\r\\n2 3\\r\\n4 6\\r\\n5 7\\r\\n4 5\\r\\n5 7\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '8 8\\r\\n0 1\\r\\n4 5\\r\\n7 8\\r\\n3 4\\r\\n2 3\\r\\n6 7\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 1\\r\\n0 6\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 4\\r\\n0 3\\r\\n1 2\\r\\n4 5\\r\\n4 6\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n', 'output': ['360\\r\\n']}, {'input': '5 3\\r\\n0 1\\r\\n2 3\\r\\n4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 15\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n3 4\\r\\n4 5\\r\\n4 5\\r\\n', 'output': ['120\\r\\n']}, {'input': '8 94\\r\\n2 8\\r\\n3 8\\r\\n5 6\\r\\n1 2\\r\\n4 6\\r\\n2 7\\r\\n2 4\\r\\n3 5\\r\\n0 2\\r\\n0 1\\r\\n7 8\\r\\n0 7\\r\\n0 5\\r\\n1 4\\r\\n2 7\\r\\n3 4\\r\\n6 7\\r\\n1 5\\r\\n4 6\\r\\n4 6\\r\\n2 8\\r\\n4 5\\r\\n0 1\\r\\n3 8\\r\\n5 8\\r\\n1 3\\r\\n3 4\\r\\n1 6\\r\\n1 6\\r\\n1 7\\r\\n1 7\\r\\n1 4\\r\\n5 6\\r\\n5 7\\r\\n2 4\\r\\n3 8\\r\\n0 1\\r\\n0 4\\r\\n4 8\\r\\n1 8\\r\\n3 8\\r\\n2 4\\r\\n5 7\\r\\n2 4\\r\\n2 7\\r\\n3 8\\r\\n3 7\\r\\n0 6\\r\\n1 2\\r\\n0 2\\r\\n2 7\\r\\n0 4\\r\\n0 3\\r\\n3 6\\r\\n0 2\\r\\n5 7\\r\\n4 8\\r\\n3 6\\r\\n0 3\\r\\n3 5\\r\\n2 3\\r\\n1 8\\r\\n3 7\\r\\n0 6\\r\\n4 6\\r\\n1 8\\r\\n1 2\\r\\n3 5\\r\\n1 5\\r\\n1 2\\r\\n0 2\\r\\n0 3\\r\\n4 7\\r\\n1 4\\r\\n2 5\\r\\n5 8\\r\\n0 3\\r\\n5 7\\r\\n5 8\\r\\n0 2\\r\\n1 5\\r\\n4 6\\r\\n3 6\\r\\n5 6\\r\\n0 6\\r\\n1 7\\r\\n7 8\\r\\n2 7\\r\\n2 4\\r\\n1 7\\r\\n0 7\\r\\n1 6\\r\\n3 8\\r\\n0 7\\r\\n', 'output': ['203624961\\r\\n']}, {'input': '97 53\\r\\n21 34\\r\\n19 95\\r\\n0 6\\r\\n28 40\\r\\n26 41\\r\\n39 41\\r\\n47 85\\r\\n32 46\\r\\n2 17\\r\\n55 73\\r\\n18 67\\r\\n36 85\\r\\n77 96\\r\\n77 97\\r\\n1 53\\r\\n12 49\\r\\n9 71\\r\\n29 92\\r\\n35 89\\r\\n40 43\\r\\n5 78\\r\\n13 92\\r\\n2 97\\r\\n11 22\\r\\n4 6\\r\\n22 92\\r\\n60 87\\r\\n25 47\\r\\n10 59\\r\\n51 70\\r\\n13 95\\r\\n27 43\\r\\n5 71\\r\\n48 73\\r\\n82 94\\r\\n45 51\\r\\n85 97\\r\\n51 89\\r\\n15 66\\r\\n44 80\\r\\n78 93\\r\\n65 84\\r\\n9 75\\r\\n28 30\\r\\n39 69\\r\\n50 89\\r\\n41 77\\r\\n14 31\\r\\n12 97\\r\\n69 86\\r\\n15 18\\r\\n14 56\\r\\n38 47\\r\\n', 'output': ['478604297\\r\\n']}, {'input': '33 5\\r\\n17 18\\r\\n5 27\\r\\n18 29\\r\\n12 24\\r\\n14 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '93 69\\r\\n9 92\\r\\n31 37\\r\\n58 83\\r\\n28 93\\r\\n36 44\\r\\n22 90\\r\\n61 88\\r\\n76 83\\r\\n19 85\\r\\n25 87\\r\\n55 84\\r\\n45 47\\r\\n5 27\\r\\n54 82\\r\\n4 65\\r\\n12 81\\r\\n49 55\\r\\n16 52\\r\\n16 34\\r\\n34 44\\r\\n17 36\\r\\n62 64\\r\\n7 34\\r\\n19 21\\r\\n16 73\\r\\n3 55\\r\\n12 62\\r\\n49 91\\r\\n2 36\\r\\n47 65\\r\\n17 37\\r\\n70 80\\r\\n52 71\\r\\n59 77\\r\\n1 17\\r\\n23 81\\r\\n15 67\\r\\n38 67\\r\\n14 48\\r\\n70 82\\r\\n33 51\\r\\n31 88\\r\\n28 51\\r\\n10 54\\r\\n6 71\\r\\n37 88\\r\\n5 60\\r\\n2 91\\r\\n88 91\\r\\n30 91\\r\\n17 58\\r\\n12 72\\r\\n14 77\\r\\n34 90\\r\\n15 42\\r\\n44 47\\r\\n54 87\\r\\n84 90\\r\\n3 49\\r\\n26 71\\r\\n40 87\\r\\n71 74\\r\\n20 60\\r\\n86 92\\r\\n76 83\\r\\n40 80\\r\\n3 31\\r\\n18 33\\r\\n5 82\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 59\\r\\n4 7\\r\\n4 8\\r\\n0 4\\r\\n5 7\\r\\n6 9\\r\\n7 8\\r\\n0 9\\r\\n6 7\\r\\n4 9\\r\\n1 10\\r\\n5 6\\r\\n1 4\\r\\n0 4\\r\\n4 9\\r\\n3 6\\r\\n1 7\\r\\n4 9\\r\\n3 7\\r\\n1 2\\r\\n0 1\\r\\n4 7\\r\\n0 8\\r\\n8 10\\r\\n0 3\\r\\n2 5\\r\\n0 7\\r\\n1 8\\r\\n2 10\\r\\n0 3\\r\\n0 9\\r\\n7 8\\r\\n2 6\\r\\n1 6\\r\\n2 10\\r\\n3 10\\r\\n3 4\\r\\n0 2\\r\\n0 8\\r\\n3 8\\r\\n9 10\\r\\n1 6\\r\\n7 10\\r\\n6 9\\r\\n2 10\\r\\n2 10\\r\\n3 5\\r\\n9 10\\r\\n4 10\\r\\n0 8\\r\\n5 9\\r\\n4 6\\r\\n0 10\\r\\n6 9\\r\\n1 2\\r\\n6 7\\r\\n1 5\\r\\n0 6\\r\\n0 7\\r\\n0 6\\r\\n', 'output': ['28167561\\r\\n']}, {'input': '66 35\\r\\n49 55\\r\\n9 30\\r\\n28 54\\r\\n44 62\\r\\n55 61\\r\\n1 21\\r\\n6 37\\r\\n8 10\\r\\n26 33\\r\\n19 37\\r\\n12 23\\r\\n24 42\\r\\n34 64\\r\\n8 56\\r\\n36 40\\r\\n16 58\\r\\n21 30\\r\\n16 36\\r\\n36 38\\r\\n19 45\\r\\n26 49\\r\\n6 62\\r\\n1 11\\r\\n22 48\\r\\n33 38\\r\\n8 41\\r\\n29 53\\r\\n58 60\\r\\n27 66\\r\\n2 19\\r\\n48 53\\r\\n25 47\\r\\n48 56\\r\\n61 65\\r\\n45 46\\r\\n', 'output': ['0\\r\\n']}, {'input': '31 26\\r\\n15 21\\r\\n4 25\\r\\n5 19\\r\\n16 18\\r\\n5 23\\r\\n3 25\\r\\n7 18\\r\\n24 31\\r\\n6 9\\r\\n8 25\\r\\n18 29\\r\\n12 27\\r\\n15 16\\r\\n12 20\\r\\n2 7\\r\\n14 26\\r\\n13 22\\r\\n5 19\\r\\n5 24\\r\\n15 23\\r\\n4 7\\r\\n8 12\\r\\n14 26\\r\\n28 30\\r\\n1 30\\r\\n24 31\\r\\n', 'output': ['0\\r\\n']}, {'input': '69 68\\r\\n49 62\\r\\n3 38\\r\\n1 43\\r\\n42 58\\r\\n12 64\\r\\n1 37\\r\\n35 59\\r\\n7 43\\r\\n2 29\\r\\n8 65\\r\\n19 47\\r\\n4 27\\r\\n41 58\\r\\n25 60\\r\\n17 37\\r\\n34 40\\r\\n16 38\\r\\n28 52\\r\\n35 63\\r\\n6 65\\r\\n57 58\\r\\n38 50\\r\\n8 28\\r\\n6 8\\r\\n10 44\\r\\n48 63\\r\\n2 42\\r\\n46 58\\r\\n26 62\\r\\n37 45\\r\\n7 22\\r\\n0 21\\r\\n19 48\\r\\n6 67\\r\\n6 15\\r\\n28 38\\r\\n19 22\\r\\n16 20\\r\\n27 40\\r\\n0 3\\r\\n33 69\\r\\n2 66\\r\\n10 24\\r\\n29 48\\r\\n26 69\\r\\n15 53\\r\\n24 34\\r\\n34 58\\r\\n20 47\\r\\n21 23\\r\\n38 68\\r\\n34 45\\r\\n60 68\\r\\n7 15\\r\\n21 34\\r\\n16 30\\r\\n14 58\\r\\n2 62\\r\\n24 66\\r\\n13 27\\r\\n24 40\\r\\n32 37\\r\\n10 37\\r\\n22 40\\r\\n44 50\\r\\n27 31\\r\\n0 44\\r\\n20 32\\r\\n', 'output': ['622740890\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '68 74\\r\\n51 54\\r\\n3 22\\r\\n12 24\\r\\n3 27\\r\\n32 42\\r\\n36 55\\r\\n60 64\\r\\n1 4\\r\\n4 23\\r\\n11 64\\r\\n54 62\\r\\n50 56\\r\\n21 34\\r\\n27 63\\r\\n15 54\\r\\n28 61\\r\\n13 57\\r\\n39 53\\r\\n12 32\\r\\n32 40\\r\\n33 67\\r\\n55 61\\r\\n33 67\\r\\n30 37\\r\\n15 49\\r\\n27 45\\r\\n21 41\\r\\n8 42\\r\\n24 63\\r\\n40 48\\r\\n28 41\\r\\n30 67\\r\\n0 4\\r\\n7 15\\r\\n27 59\\r\\n60 62\\r\\n25 65\\r\\n30 31\\r\\n38 67\\r\\n24 43\\r\\n14 64\\r\\n26 46\\r\\n8 12\\r\\n34 41\\r\\n32 67\\r\\n11 42\\r\\n11 53\\r\\n45 55\\r\\n2 47\\r\\n7 51\\r\\n30 54\\r\\n21 44\\r\\n7 52\\r\\n40 62\\r\\n16 50\\r\\n10 41\\r\\n26 65\\r\\n16 51\\r\\n6 29\\r\\n1 31\\r\\n48 54\\r\\n9 42\\r\\n33 45\\r\\n19 59\\r\\n25 37\\r\\n21 62\\r\\n20 58\\r\\n23 59\\r\\n12 61\\r\\n2 46\\r\\n19 49\\r\\n44 60\\r\\n1 20\\r\\n19 66\\r\\n', 'output': ['0\\r\\n']}, {'input': '79 68\\r\\n26 47\\r\\n55 70\\r\\n5 40\\r\\n7 45\\r\\n16 21\\r\\n31 38\\r\\n19 62\\r\\n40 55\\r\\n42 78\\r\\n60 61\\r\\n43 69\\r\\n50 73\\r\\n3 77\\r\\n2 45\\r\\n2 29\\r\\n10 58\\r\\n2 11\\r\\n62 76\\r\\n57 70\\r\\n65 73\\r\\n37 67\\r\\n9 24\\r\\n4 28\\r\\n8 16\\r\\n31 44\\r\\n10 66\\r\\n47 70\\r\\n19 45\\r\\n17 28\\r\\n5 36\\r\\n9 68\\r\\n2 35\\r\\n55 77\\r\\n51 71\\r\\n1 59\\r\\n6 33\\r\\n21 53\\r\\n39 49\\r\\n59 70\\r\\n17 44\\r\\n18 64\\r\\n49 78\\r\\n0 52\\r\\n24 56\\r\\n65 79\\r\\n19 51\\r\\n42 77\\r\\n37 78\\r\\n20 39\\r\\n47 56\\r\\n19 78\\r\\n50 78\\r\\n3 67\\r\\n37 47\\r\\n5 27\\r\\n40 51\\r\\n24 29\\r\\n50 54\\r\\n45 50\\r\\n13 76\\r\\n29 31\\r\\n0 28\\r\\n26 36\\r\\n21 44\\r\\n71 77\\r\\n55 58\\r\\n38 61\\r\\n22 44\\r\\n', 'output': ['317376853\\r\\n']}, {'input': '45 51\\r\\n2 12\\r\\n6 18\\r\\n4 17\\r\\n8 25\\r\\n16 24\\r\\n3 23\\r\\n29 31\\r\\n31 40\\r\\n7 26\\r\\n5 6\\r\\n35 37\\r\\n1 36\\r\\n9 45\\r\\n18 36\\r\\n12 27\\r\\n5 15\\r\\n11 16\\r\\n19 29\\r\\n8 23\\r\\n1 27\\r\\n0 30\\r\\n25 38\\r\\n21 44\\r\\n34 39\\r\\n10 41\\r\\n4 16\\r\\n11 36\\r\\n0 8\\r\\n15 38\\r\\n3 33\\r\\n11 31\\r\\n2 33\\r\\n5 34\\r\\n24 28\\r\\n7 32\\r\\n15 25\\r\\n2 27\\r\\n16 44\\r\\n31 40\\r\\n35 45\\r\\n13 38\\r\\n29 42\\r\\n18 23\\r\\n8 25\\r\\n13 21\\r\\n3 39\\r\\n3 41\\r\\n5 6\\r\\n13 21\\r\\n11 20\\r\\n23 42\\r\\n', 'output': ['493168232\\r\\n']}, {'input': '5 31\\r\\n0 2\\r\\n3 4\\r\\n3 5\\r\\n2 4\\r\\n1 3\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n0 2\\r\\n2 5\\r\\n1 4\\r\\n0 2\\r\\n1 3\\r\\n0 5\\r\\n2 3\\r\\n1 5\\r\\n1 2\\r\\n2 3\\r\\n0 1\\r\\n0 1\\r\\n2 4\\r\\n0 4\\r\\n1 2\\r\\n0 3\\r\\n1 2\\r\\n3 4\\r\\n0 2\\r\\n0 4\\r\\n1 2\\r\\n2 5\\r\\n1 5\\r\\n', 'output': ['8595\\r\\n']}, {'input': '81 52\\r\\n33 48\\r\\n59 61\\r\\n37 77\\r\\n58 73\\r\\n29 54\\r\\n1 17\\r\\n8 29\\r\\n50 73\\r\\n7 26\\r\\n35 41\\r\\n22 26\\r\\n9 22\\r\\n0 11\\r\\n40 73\\r\\n25 57\\r\\n35 55\\r\\n36 54\\r\\n29 41\\r\\n56 66\\r\\n42 77\\r\\n29 48\\r\\n41 66\\r\\n25 36\\r\\n2 55\\r\\n58 64\\r\\n0 61\\r\\n23 31\\r\\n9 61\\r\\n27 45\\r\\n2 71\\r\\n14 29\\r\\n4 31\\r\\n0 35\\r\\n31 77\\r\\n21 39\\r\\n0 54\\r\\n46 68\\r\\n18 62\\r\\n41 45\\r\\n12 28\\r\\n59 66\\r\\n39 71\\r\\n10 59\\r\\n29 77\\r\\n16 48\\r\\n13 46\\r\\n30 73\\r\\n2 41\\r\\n42 55\\r\\n19 61\\r\\n28 29\\r\\n20 42\\r\\n', 'output': ['0\\r\\n']}, {'input': '84 50\\r\\n33 46\\r\\n19 40\\r\\n51 64\\r\\n37 45\\r\\n35 81\\r\\n44 81\\r\\n6 57\\r\\n57 60\\r\\n14 53\\r\\n15 49\\r\\n4 30\\r\\n35 49\\r\\n2 51\\r\\n8 72\\r\\n15 18\\r\\n49 51\\r\\n14 49\\r\\n50 71\\r\\n41 59\\r\\n28 60\\r\\n61 81\\r\\n9 12\\r\\n34 79\\r\\n5 56\\r\\n60 67\\r\\n21 60\\r\\n39 71\\r\\n31 60\\r\\n13 35\\r\\n16 84\\r\\n17 33\\r\\n48 57\\r\\n36 61\\r\\n50 55\\r\\n5 84\\r\\n66 79\\r\\n61 70\\r\\n42 49\\r\\n19 39\\r\\n47 49\\r\\n3 82\\r\\n59 65\\r\\n8 44\\r\\n71 80\\r\\n66 77\\r\\n8 65\\r\\n1 81\\r\\n7 82\\r\\n50 74\\r\\n10 17\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 68\\r\\n77 89\\r\\n19 71\\r\\n11 46\\r\\n23 70\\r\\n16 47\\r\\n4 61\\r\\n7 96\\r\\n38 74\\r\\n79 95\\r\\n68 75\\r\\n14 86\\r\\n10 55\\r\\n7 13\\r\\n88 99\\r\\n19 21\\r\\n4 94\\r\\n17 83\\r\\n11 16\\r\\n7 50\\r\\n58 96\\r\\n4 58\\r\\n17 72\\r\\n44 56\\r\\n35 91\\r\\n50 88\\r\\n9 37\\r\\n36 52\\r\\n83 89\\r\\n8 16\\r\\n1 80\\r\\n12 75\\r\\n3 27\\r\\n92 93\\r\\n53 88\\r\\n37 49\\r\\n34 78\\r\\n31 66\\r\\n39 55\\r\\n36 94\\r\\n22 67\\r\\n47 85\\r\\n20 58\\r\\n62 98\\r\\n41 89\\r\\n85 96\\r\\n11 73\\r\\n39 95\\r\\n44 68\\r\\n25 33\\r\\n36 45\\r\\n66 70\\r\\n66 93\\r\\n17 97\\r\\n1 71\\r\\n49 53\\r\\n47 54\\r\\n19 95\\r\\n10 12\\r\\n38 57\\r\\n47 68\\r\\n21 70\\r\\n32 93\\r\\n53 71\\r\\n45 59\\r\\n27 48\\r\\n47 63\\r\\n75 76\\r\\n8 57\\r\\n', 'output': ['0\\r\\n']}, {'input': '918949684 6\\r\\n351553415 785588657\\r\\n423490842 845475457\\r\\n351553415 918949684\\r\\n740298829 785588657\\r\\n351328841 610486484\\r\\n423490842 847590951\\r\\n', 'output': ['0\\r\\n']}, {'input': '863261873 5\\r\\n137690029 666186924\\r\\n137690029 379800754\\r\\n515537329 666186924\\r\\n442925959 722302912\\r\\n137690029 863261873\\r\\n', 'output': ['0\\r\\n']}, {'input': '735324925 2\\r\\n642054038 735324925\\r\\n170935185 642054038\\r\\n', 'output': ['0\\r\\n']}, {'input': '977743286 6\\r\\n317778866 395496218\\r\\n395496218 932112884\\r\\n98371691 432544933\\r\\n440553 922085291\\r\\n440553 432544933\\r\\n586988624 922085291\\r\\n', 'output': ['0\\r\\n']}, {'input': '977700285 7\\r\\n386643627 467079072\\r\\n116215943 914856211\\r\\n15183537 386643627\\r\\n424146511 977700285\\r\\n15183537 620050423\\r\\n336304090 947990602\\r\\n116215943 914856211\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '814609521 3\\r\\n622460875 697824636\\r\\n283825432 369448402\\r\\n614658965 622460875\\r\\n', 'output': ['0\\r\\n']}, {'input': '931612300 8\\r\\n64655010 186892167\\r\\n25283092 580196656\\r\\n297609123 628681221\\r\\n25283092 186892167\\r\\n186892167 221075230\\r\\n221075230 634105512\\r\\n25283092 156293949\\r\\n86333513 156293949\\r\\n', 'output': ['0\\r\\n']}, {'input': '947714605 4\\r\\n23890708 35992029\\r\\n35992029 947714605\\r\\n93644635 629491402\\r\\n23890708 947714605\\r\\n', 'output': ['0\\r\\n']}, {'input': '768016717 4\\r\\n242598247 348534209\\r\\n33560125 170667468\\r\\n348534209 700314158\\r\\n700314158 768016717\\r\\n', 'output': ['0\\r\\n']}, {'input': '1000000000 2\\r\\n0 500000000\\r\\n500000000 1000000000\\r\\n', 'output': ['1\\r\\n']}]","id":474} {"difficulty":2200,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"ce5cc8512359701696dba1b254c6afda","execute_outcome":"RUNTIME_ERROR","source_code":"import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n val sc = BufferedReader(InputStreamReader(System.`in`))\n val out = PrintWriter(BufferedOutputStream(System.out))\n val (n, m) = sc.readLine()!!.split(\" \").map(String::toInt)\n if (n < 3) {\n out.println(\"0\")\n } else {\n val graph = Graph(n)\n for (i in 0 until m) {\n val (u, v) = sc.readLine()!!.split(\" \").map { it.toInt() - 1 }\n graph.addEdge(u, v)\n }\n graph.checkDeep()\n out.println(graph.count)\n }\n out.close()\n}\n\ninternal class Node(val id: Int) {\n val links = LinkedList()\n}\n\ninternal class Graph(var n: Int) {\n var graphArray = Array(n) { Node(it) }\n private val colors = Array(n) { 0 }\n var count: Long = 0\n\n fun addEdge(from: Int, to: Int) {\n graphArray[from].links.add(graphArray[to])\n graphArray[to].links.add(graphArray[from])\n }\n\n fun checkDeep() {\n for (i in 0 until n) {\n if (colors[i] == 0) {\n colors[i] = 1\n dfs(graphArray[i])\n }\n }\n }\n\n private fun dfs(n: Node) {\n for (it in n.links) {\n if (colors[it.id] == 0) {\n colors[it.id] = 1\n dfs(it)\n } else if (colors[it.id] == colors[n.id]) {\n count++\n }\n }\n colors[n.id] = 0\n }\n}","description":"Given a simple graph, output the number of simple cycles in it. A simple cycle is a cycle with no repeated vertices or edges.","input_specification":"The first line of input contains two integers n and m (1\u2009\u2264\u2009n\u2009\u2264\u200919, 0\u2009\u2264\u2009m) \u2013 respectively the number of vertices and edges of the graph. Each of the subsequent m lines contains two integers a and b, (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n, a\u2009\u2260\u2009b) indicating that vertices a and b are connected by an undirected edge. There is no more than one edge connecting any pair of vertices.","output_specification":"Output the number of cycles in the given graph.","notes":"NoteThe example graph is a clique and contains four cycles of length 3 and three cycles of length 4.","sample_inputs":["4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4"],"sample_outputs":["7"],"human_solution":"import java.io.*\n\nfun main(args: Array) {\n val sc = BufferedReader(InputStreamReader(System.`in`))\n val out = PrintWriter(BufferedOutputStream(System.out))\n val (n, m) = sc.readLine()!!.split(\" \").map(String::toInt)\n val maxm = 1 shl n\n val graph = Array(n) { Array(n) { false } }\n val dp = Array(maxm) { Array(n) { 0L } }\n\n fun first(num: Int): Int {\n var i = 0\n while ((num and (1 shl i++)) == 0){}\n return i-1\n }\n\n for (i in 0 until m) {\n val (from, to) = sc.readLine()!!.split(\" \").map { it.toInt() - 1 }\n graph[from][to] = true\n graph[to][from] = true\n }\n\n for(mask in 1 until maxm) {\n for(i in 0 until n) {\n val eI = (mask and (1 shl i)) > 0\n val bk = Integer.bitCount(mask)\n if(bk == 1 && eI) {\n dp[mask][i] = 1\n } else if(bk > 1 && eI && first(mask) != i) {\n var sum = 0L\n for(j in 0 until n) {\n if(graph[i][j]) sum += dp[mask xor (1 shl i)][j]\n }\n dp[mask][i] = sum\n }\n }\n }\n\n var count = 0L\n for (mask in 7 until maxm) {\n for(i in 0 until n) {\n if (Integer.bitCount(mask) >= 3 && graph[first(mask)][i]) {\n count += dp[mask][i]\n }\n }\n }\n\n out.println(count \/ 2)\n out.close()\n}","testcases":"[{'input': '4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['7\\r\\n']}, {'input': '10 3\\r\\n4 8\\r\\n9 4\\r\\n8 9\\r\\n', 'output': ['1\\r\\n']}, {'input': '8 28\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n6 7\\r\\n6 8\\r\\n7 8\\r\\n', 'output': ['8018\\r\\n']}, {'input': '12 10\\r\\n1 6\\r\\n4 5\\r\\n4 9\\r\\n5 10\\r\\n6 12\\r\\n7 9\\r\\n7 10\\r\\n8 10\\r\\n10 12\\r\\n11 12\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '7 16\\r\\n1 2\\r\\n1 3\\r\\n1 5\\r\\n1 7\\r\\n2 3\\r\\n2 4\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n5 6\\r\\n6 7\\r\\n', 'output': ['214\\r\\n']}, {'input': '14 32\\r\\n1 2\\r\\n1 3\\r\\n1 6\\r\\n1 7\\r\\n1 9\\r\\n1 11\\r\\n1 13\\r\\n2 8\\r\\n2 9\\r\\n2 14\\r\\n3 7\\r\\n3 8\\r\\n3 9\\r\\n3 13\\r\\n4 5\\r\\n4 11\\r\\n4 14\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 14\\r\\n7 12\\r\\n7 13\\r\\n8 9\\r\\n8 10\\r\\n8 11\\r\\n9 10\\r\\n10 13\\r\\n10 14\\r\\n11 12\\r\\n11 13\\r\\n13 14\\r\\n', 'output': ['9239\\r\\n']}, {'input': '18 45\\r\\n1 2\\r\\n1 5\\r\\n1 12\\r\\n1 13\\r\\n2 3\\r\\n2 4\\r\\n2 11\\r\\n2 14\\r\\n2 15\\r\\n3 7\\r\\n3 16\\r\\n4 7\\r\\n4 8\\r\\n4 10\\r\\n4 18\\r\\n5 8\\r\\n5 10\\r\\n5 16\\r\\n5 17\\r\\n6 12\\r\\n6 16\\r\\n7 9\\r\\n7 12\\r\\n8 10\\r\\n8 16\\r\\n9 11\\r\\n9 12\\r\\n9 16\\r\\n9 17\\r\\n10 11\\r\\n10 15\\r\\n11 12\\r\\n11 14\\r\\n11 15\\r\\n12 13\\r\\n12 14\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 16\\r\\n13 17\\r\\n14 15\\r\\n14 18\\r\\n16 17\\r\\n17 18\\r\\n', 'output': ['467111\\r\\n']}, {'input': '19 11\\r\\n3 4\\r\\n3 12\\r\\n3 14\\r\\n4 12\\r\\n5 11\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n9 13\\r\\n11 19\\r\\n15 16\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 44\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n1 9\\r\\n1 10\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n2 9\\r\\n2 10\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n3 10\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n4 9\\r\\n4 10\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n5 9\\r\\n5 10\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 10\\r\\n7 8\\r\\n7 9\\r\\n7 10\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n', 'output': ['446414\\r\\n']}, {'input': '16 11\\r\\n1 2\\r\\n2 7\\r\\n2 12\\r\\n3 12\\r\\n4 5\\r\\n4 15\\r\\n6 7\\r\\n6 9\\r\\n7 8\\r\\n12 14\\r\\n14 16\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 1\\r\\n2 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '18 54\\r\\n1 7\\r\\n1 11\\r\\n1 14\\r\\n1 15\\r\\n1 18\\r\\n2 7\\r\\n3 4\\r\\n3 9\\r\\n3 10\\r\\n3 11\\r\\n3 12\\r\\n3 13\\r\\n3 16\\r\\n3 17\\r\\n3 18\\r\\n4 5\\r\\n4 9\\r\\n4 11\\r\\n4 13\\r\\n5 12\\r\\n5 13\\r\\n5 14\\r\\n5 15\\r\\n5 16\\r\\n5 18\\r\\n6 9\\r\\n6 10\\r\\n6 12\\r\\n6 13\\r\\n6 17\\r\\n7 8\\r\\n7 17\\r\\n8 10\\r\\n8 11\\r\\n8 12\\r\\n8 14\\r\\n8 15\\r\\n9 11\\r\\n9 12\\r\\n10 11\\r\\n10 13\\r\\n10 16\\r\\n10 17\\r\\n11 12\\r\\n11 15\\r\\n11 16\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 17\\r\\n14 15\\r\\n14 16\\r\\n15 17\\r\\n17 18\\r\\n', 'output': ['6418594\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 8\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n', 'output': ['12\\r\\n']}, {'input': '19 48\\r\\n1 5\\r\\n1 6\\r\\n1 14\\r\\n1 17\\r\\n1 18\\r\\n2 3\\r\\n2 4\\r\\n2 7\\r\\n2 13\\r\\n2 16\\r\\n2 18\\r\\n2 19\\r\\n3 8\\r\\n3 11\\r\\n3 16\\r\\n3 17\\r\\n4 5\\r\\n4 13\\r\\n4 17\\r\\n4 19\\r\\n5 8\\r\\n5 13\\r\\n5 15\\r\\n5 16\\r\\n5 19\\r\\n6 7\\r\\n6 11\\r\\n6 12\\r\\n6 14\\r\\n7 8\\r\\n7 11\\r\\n8 11\\r\\n8 19\\r\\n9 14\\r\\n9 17\\r\\n9 18\\r\\n10 13\\r\\n10 19\\r\\n11 12\\r\\n11 18\\r\\n12 14\\r\\n13 16\\r\\n13 17\\r\\n13 19\\r\\n14 15\\r\\n16 17\\r\\n17 18\\r\\n18 19\\r\\n', 'output': ['824798\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6 15\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n4 5\\r\\n4 6\\r\\n5 6\\r\\n', 'output': ['197\\r\\n']}, {'input': '19 22\\r\\n1 10\\r\\n1 14\\r\\n1 17\\r\\n2 10\\r\\n2 12\\r\\n2 13\\r\\n3 8\\r\\n3 13\\r\\n3 14\\r\\n4 10\\r\\n4 19\\r\\n7 9\\r\\n7 12\\r\\n9 18\\r\\n10 11\\r\\n11 13\\r\\n11 19\\r\\n12 13\\r\\n14 16\\r\\n16 17\\r\\n16 19\\r\\n17 19\\r\\n', 'output': ['60\\r\\n']}, {'input': '1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['0\\r\\n']}]","id":475} {"difficulty":1600,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"d3a0402de1338a1a542a86ac5b484acc","execute_outcome":"RUNTIME_ERROR","source_code":"\/**\n * author: Andreeha\n * created: 2020-04-25 16:56\n *\/\n\nimport java.util.*\n\nfun main() {\n var n = readInt()\n var a = readInts()\n var div = MutableList(size = 0, init = {0})\n\n var i = 3\n div.add(1)\n while (i * i <= n) {\n if (n % i == 0) {\n div.add(i)\n if (n \/ i != i && n \/ i > 2)\n div.add(n\/i)\n }\n i += 1\n }\n var can = false\n for (i in 0 until div.size) {\n for (j in 0 until div[i]) {\n var all = 1;\n for (k in 0 until n \/ div[i]) {\n all = a[(k * div[i] + j) % n]\n if (all == 0)\n break\n }\n if (all == 1) {\n can = true\n break\n }\n }\n if (can) break\n }\n println(if (can) \"YES\" else \"NO\")\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate fun readDouble() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readDoubles() = readStrings().map { it.toDouble() }","description":"There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in a good mood should be located. Otherwise, the next month will bring misfortunes.A convex polygon is regular if all its sides have same length and all his angles are equal. In this problem we consider only regular polygons with at least 3 vertices, i. e. only nondegenerated.On a picture below some examples of such polygons are present. Green points mean knights in a good mood. Red points mean ones in a bad mood. King Arthur knows the knights' moods. Help him find out if the next month will be fortunate or not.","input_specification":"The first line contains number n, which is the number of knights at the round table (3\u2009\u2264\u2009n\u2009\u2264\u2009105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. \"1\" means that the knight is in a good mood an \"0\" means that he is in a bad mood.","output_specification":"Print \"YES\" without the quotes if the following month will turn out to be lucky. Otherwise, print \"NO\".","notes":null,"sample_inputs":["3\n1 1 1","6\n1 0 1 1 1 0","6\n1 0 0 1 0 1"],"sample_outputs":["YES","YES","NO"],"human_solution":"\/**\n * author: Andreeha\n * created: 2020-04-25 16:56\n *\/\n\nimport java.util.*\n\nfun main() {\n var n = readInt()\n var a = readInts()\n var div = MutableList(size = 0, init = {0})\n\n var i = 2\n div.add(1)\n while (i * i <= n) {\n if (n % i == 0) {\n if (n \/ i > 2)\n div.add(i)\n if (n \/ i != i && i > 2)\n div.add(n\/i)\n }\n i += 1\n }\n var can = false\n for (i in 0 until div.size) {\n for (j in 0 until div[i]) {\n var all = 1;\n for (k in 0 until n \/ div[i]) {\n all = a[(k * div[i] + j) % n]\n if (all == 0)\n break\n }\n if (all == 1) {\n can = true\n break\n }\n }\n if (can) break\n }\n println(if (can) \"YES\" else \"NO\")\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate fun readDouble() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readDoubles() = readStrings().map { it.toDouble() }","testcases":"[{'input': '3\\r\\n1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 1 1 1 0\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '10\\r\\n1 0 1 1 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 0 1 0 1 1 0 1 0 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '29\\r\\n0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1\\r\\n', 'output': ['NO']}, {'input': '77\\r\\n0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1\\r\\n', 'output': ['YES']}, {'input': '99\\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 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\\r\\n', 'output': ['YES']}, {'input': '18\\r\\n0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 1\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n0 0 1 0 0 1\\r\\n', 'output': ['NO']}, {'input': '6\\r\\n0 1 0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n0 0 1 0 0 0 1\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '8\\r\\n1 0 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\\r\\n', 'output': ['YES']}, {'input': '30\\r\\n1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0\\r\\n', 'output': ['YES']}, {'input': '100\\r\\n1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0\\r\\n', 'output': ['YES']}, {'input': '113\\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\\r\\n', 'output': ['YES']}]","id":476} {"difficulty":1600,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"ed1a2ae733121af6486568e528fe2d84","execute_outcome":"WRONG_ANSWER","source_code":"import kotlin.math.*\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main(){\n val (n, k) = readInts()\n val a = readInts().sorted()\n println(a)\n var cnt = IntArray(200005, {0})\n var ans = IntArray(200005, {0})\n for (i in 0 until n){\n var temp = a[i]\n var d = 0\n while (temp > 0){\n if (cnt[temp] < k) {\n cnt[temp]++;\n ans[temp] += d\n }\n temp \/= 2\n d++\n }\n }\n var res = Int.MAX_VALUE\n for (i in 1..a[n - 1]){\n if (cnt[i] == k) res = min(res, ans[i])\n }\n print(res)\n}\n","description":"The only difference between easy and hard versions is the number of elements in the array.You are given an array $$$a$$$ consisting of $$$n$$$ integers. In one move you can choose any $$$a_i$$$ and divide it by $$$2$$$ rounding down (in other words, in one move you can set $$$a_i := \\lfloor\\frac{a_i}{2}\\rfloor$$$).You can perform such an operation any (possibly, zero) number of times with any $$$a_i$$$.Your task is to calculate the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.Don't forget that it is possible to have $$$a_i = 0$$$ after some operations, thus the answer always exists.","input_specification":"The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le k \\le n \\le 50$$$) \u2014 the number of elements in the array and the number of equal numbers required. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 2 \\cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.","output_specification":"Print one integer \u2014 the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.","notes":null,"sample_inputs":["5 3\n1 2 2 4 5","5 3\n1 2 3 4 5","5 3\n1 2 3 3 3"],"sample_outputs":["1","2","0"],"human_solution":"import kotlin.math.*\nfun main() {\n var (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var vals = readLine()!!.split(\" \").map { it.toInt() }.sorted()\n var cnts = IntArray(200005, { 0 })\n var answ = IntArray(200005, { 0 })\n for (i in 0 until n) {\n var curr = vals[i]\n var indx = 0\n while (curr > 0) {\n if (cnts[curr] < m) {\n cnts[curr]++\n answ[curr] += indx\n }\n curr \/= 2\n indx++\n\n }\n\n }\n var result = Int.MAX_VALUE\n for (i in 1..vals[n - 1]) {\n if (cnts[i] == m) result = min(result, answ[i])\n }\n println(result)\n}\n\n\n\n\n\/*\n\n *\/","testcases":"[{'input': '5 3\\r\\n1 2 2 4 5\\r\\n', 'output': ['1']}, {'input': '5 3\\r\\n1 2 3 4 5\\r\\n', 'output': ['2']}, {'input': '5 3\\r\\n1 2 3 3 3\\r\\n', 'output': ['0']}, {'input': '1 1\\r\\n1337\\r\\n', 'output': ['0']}, {'input': '200000 100000\\r\\n150002 156252 199995 199996 149998 156248 199991 199992 114062 131640 199987 199988 149994 156244 199983 199984 128119 105636 199979 199980 149990 156240 199975 199976 107907 131636 199971 199972 149986 156236 199967 199968 128115 117796 199963 199964 114058 131632 199959 199960 149982 156228 199955 199956 128111 110012 199951 199952 149978 156224 199947 199948 102223 131628 199943 199944 149974 156220 199939 199940 128107 131624 199935 199936 149970 156216 199931 199932 149966 156212 199927...', 'output': ['1468946']}, {'input': '50 2\\r\\n72548 51391 1788 171949 148789 151619 19225 8774 52484 74830 20086 51129 151145 87650 108005 112019 126739 124087 158096 59027 34500 87415 115058 194160 171792 136832 1114 112592 171746 199013 101484 182930 185656 154861 191455 165701 140450 3475 160191 122350 66759 93252 60972 124615 119327 108068 149786 8698 63546 187913\\r\\n', 'output': ['12']}, {'input': '50 2\\r\\n3 6 10 1 14 5 26 11 6 1 23 43 7 23 20 11 15 11 2 1 8 37 2 19 31 18 2 4 15 84 9 29 38 46 9 21 2 2 13 114 28 9 6 20 14 46 4 20 39 99\\r\\n', 'output': ['0']}, {'input': '50 2\\r\\n199995 199977 199982 199979 199998 199991 199999 199976 199974 199971 199966 199999 199978 199987 199989 199995 199968 199987 199988 199987 199987 199998 199988 199958 199985 199999 199997 199939 199992 199999 199985 199994 199987 199965 199947 199991 199993 199997 199998 199994 199971 199999 199999 199990 199993 199983 199983 199999 199970 199952\\r\\n', 'output': ['0']}, {'input': '50 7\\r\\n155076 162909 18349 8937 38161 128479 127526 128714 164477 163037 130796 160247 17004 73321 175301 175796 79144 75670 46299 197255 10139 2112 195709 124860 6485 137601 63708 117985 94924 65661 113294 85898 7511 137431 115791 66126 146803 121145 96379 126408 195646 70033 131093 86487 94591 3086 59652 188702 27036 78631\\r\\n', 'output': ['79']}, {'input': '50 7\\r\\n1 2 27 54 6 15 24 1 9 28 3 26 8 12 7 6 8 54 23 8 7 13 18 10 1 33 24 10 34 13 12 9 16 11 36 50 39 9 8 10 2 5 6 4 7 67 21 12 6 55\\r\\n', 'output': ['3']}, {'input': '50 7\\r\\n199961 199990 199995 199997 199963 199995 199985 199994 199974 199974 199997 199991 199993 199982 199991 199982 199963 200000 199994 199997 199963 199991 199947 199996 199994 199995 199995 199990 199972 199973 199980 199955 199984 199998 199998 199992 199986 199986 199997 199995 199987 199958 199982 199998 199996 199995 199979 199943 199992 199993\\r\\n', 'output': ['7']}, {'input': '50 25\\r\\n162847 80339 131433 130128 135933 64805 74277 145697 92574 169638 26992 155045 32254 97675 177503 143802 44012 171388 185307 33652 194764 80214 169507 71832 180118 117737 198279 89826 9941 120250 158894 31871 616 190147 159249 158867 131076 77551 95165 54709 51376 145758 74581 26670 48775 29351 4750 55294 129850 19793\\r\\n', 'output': ['364']}, {'input': '50 25\\r\\n19 1 17 6 4 21 9 16 5 21 2 12 17 11 54 18 36 20 34 17 32 1 4 14 26 11 6 2 7 5 2 3 12 16 20 5 16 1 18 55 16 20 2 3 2 12 65 20 7 11\\r\\n', 'output': ['43']}, {'input': '50 25\\r\\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 199996 199910 199997 199976 200000 199999 199997 199998 199973 199996 199917\\r\\n', 'output': ['125']}, {'input': '50 50\\r\\n86175 169571 61423 53837 33228 49923 87369 11875 167105 101762 128203 19011 191596 19500 11213 950 192557 164451 58008 34390 39704 128606 191084 14227 57911 129189 124795 42481 69510 59862 146348 57352 158069 68387 196697 46595 84330 168274 88721 191842 155836 39164 195031 53880 188281 11150 132256 87853 179233 135499\\r\\n', 'output': ['780']}, {'input': '50 50\\r\\n8 63 44 78 3 65 7 27 13 45 7 5 18 94 25 17 26 10 21 44 5 13 6 30 10 11 44 14 71 17 10 5 4 9 8 21 4 9 25 18 3 14 15 8 7 11 5 28 9 1\\r\\n', 'output': ['167']}, {'input': '50 50\\r\\n199987 199984 199987 199977 199996 199923 199984 199995 199991 200000 199998 199990 199983 199981 199973 199989 199981 199993 199959 199994 199973 199962 199998 199970 199999 199981 199996 199996 199985 199980 199959 199990 199982 199987 199992 199997 199985 199976 199947 199998 199962 199987 199984 199982 199999 199997 199985 199992 199979 199974\\r\\n', 'output': ['450']}, {'input': '50 1\\r\\n156420 126738 188531 85575 23728 72842 190346 24786 118328 137944 126942 115577 175247 85409 146194 31398 189417 52337 135886 162083 146559 131125 31741 152481 57935 26624 106893 55028 81626 99143 182257 129556 100261 11429 156642 27997 105720 173400 140250 164944 26466 132034 86679 190160 161138 179688 2975 149862 38336 67959\\r\\n', 'output': ['0']}, {'input': '200000 2\\r\\n176158 176769 40627 19400 151736 188493 136139 77698 179121 134117 178035 140418 162114 135099 84129 162379 76419 104776 60147 117288 170931 90437 119080 55204 21173 138483 148836 69586 51085 50644 103281 37829 188454 53551 64569 89945 44943 75344 15181 174825 81977 9989 111265 195606 173051 160162 138381 76999 124303 18814 61133 195491 108882 28148 186882 169752 3079 198883 116144 92760 131861 77871 36414 42967 197445 155133 173497 182862 21765 86715 10896 8891 187559 143445 114265 80031 152290 ...', 'output': ['0']}, {'input': '200000 2\\r\\n15 6 64 30 16 10 33 28 10 7 37 96 5 11 13 25 2 7 8 49 27 35 16 32 24 7 10 44 33 20 25 14 7 2 80 26 3 8 5 17 29 2 7 6 31 19 7 45 1 5 39 30 7 4 9 8 13 9 27 11 11 9 52 48 66 7 37 4 2 42 15 39 16 22 22 53 42 12 11 28 27 4 11 8 12 10 7 1 20 14 15 16 17 26 14 27 4 60 12 31 8 14 72 7 1 38 7 3 11 7 23 5 3 30 15 10 40 72 11 11 32 21 32 11 32 11 9 52 3 68 27 8 20 16 5 4 19 47 3 39 40 37 16 29 26 36 60 20 56 27 2 38 30 18 5 7 3 27 10 16 36 25 10 23 16 20 58 11 5 5 32 5 10 7 51 8 11 24 37 55 2 10 37 38 13 1 ...', 'output': ['0']}, {'input': '200000 2\\r\\n199925 199998 199996 199972 199875 199931 199997 199980 199986 199983 199977 199999 199986 199948 199997 199946 199986 199994 199978 199956 199994 199988 199998 199965 199991 199996 199994 199993 199995 199941 200000 200000 199988 199998 199992 199999 199962 199999 199999 199987 199947 199981 199998 199994 199989 199988 199961 199981 199995 199988 199985 199981 199963 200000 199974 199997 200000 199993 199984 199995 199985 199985 199948 199970 199989 199910 199976 199946 199987 199974 199986 1999...', 'output': ['0']}, {'input': '200000 50\\r\\n89125 181814 109104 150035 118196 41142 80649 126486 180876 147942 11426 196094 152188 28730 92060 19362 182872 195147 70878 111164 35511 195859 40847 189737 80884 179444 75422 155821 93039 129202 14075 30636 32265 15924 85723 144946 43243 68999 81655 43372 3903 102043 5453 63533 165813 51716 33118 154090 52928 1274 81006 144446 102615 40217 127304 28135 142644 81314 114999 82951 121368 10744 166094 152868 5893 118756 55201 114536 40195 29010 121930 26657 120732 184850 108645 179138 172191 19906...', 'output': ['142']}, {'input': '200000 50\\r\\n29 16 86 40 24 1 6 15 7 30 7 1 1 27 11 7 15 19 1 24 17 2 5 18 13 15 6 10 36 1 4 4 12 29 97 5 2 7 49 27 22 16 11 12 4 24 30 5 43 6 71 99 3 12 6 4 12 4 6 6 1 30 41 8 13 5 12 11 7 23 23 14 11 27 12 8 27 5 7 8 17 10 9 5 3 1 30 5 28 53 5 10 12 7 22 24 2 22 2 12 82 1 8 8 15 3 3 1 12 3 5 4 26 13 22 16 19 23 12 24 7 53 5 48 17 83 10 20 11 61 44 1 8 9 52 19 23 24 6 91 14 48 42 1 9 56 17 17 4 8 70 21 9 4 18 8 4 24 48 14 2 52 20 30 19 67 8 4 16 4 44 23 2 11 10 15 7 19 19 6 2 28 43 41 11 7 16 73 13 11 14 14...', 'output': ['0']}, {'input': '200000 50\\r\\n199951 199984 199999 199989 199994 199996 199979 199985 199986 199993 199995 199986 199987 199991 199983 199974 199996 199997 199999 199996 199997 199965 199984 199919 200000 199993 199987 199940 199964 199994 199995 199997 200000 199977 199927 199995 199983 199946 199979 199978 199962 199996 199983 199995 199992 199964 199981 199980 199966 199947 199990 199979 199998 199969 199984 199997 199959 199998 199932 199994 199951 199997 199999 199994 199993 199998 199999 199998 199974 199941 199996 199...', 'output': ['0']}, {'input': '200000 5000\\r\\n79381 79230 141388 31307 165375 187864 19920 60514 15684 142282 106397 63201 127752 46886 94521 98380 42260 14463 163598 78057 117076 118960 91435 125315 54487 101590 2241 86634 175827 70289 117798 162929 136223 163143 148246 155631 103799 13538 45613 54719 111804 37261 188334 55871 167729 108986 130559 77461 105407 164447 94891 150629 174066 97332 100766 119964 20217 156471 113389 108201 108522 69928 137932 54974 5691 180045 50709 5139 122890 172079 77384 136612 166807 112859 192517 169518 93...', 'output': ['51474']}, {'input': '200000 5000\\r\\n30 22 8 30 19 8 19 74 23 8 13 34 1 3 13 14 52 15 52 11 2 6 24 1 20 93 4 68 24 32 11 21 18 10 8 3 3 40 13 67 25 1 29 3 80 13 43 23 31 9 19 61 34 10 3 21 29 15 1 3 23 19 6 17 16 39 59 11 29 5 11 78 36 81 18 21 9 40 25 22 16 19 33 13 33 1 13 19 85 31 10 93 68 26 61 36 15 27 8 3 25 27 15 3 26 23 6 17 4 1 35 1 1 6 5 19 21 35 42 7 12 9 16 61 3 20 26 34 66 35 19 16 33 15 5 5 14 1 18 2 17 20 2 1 18 54 15 7 28 21 15 2 9 3 11 21 28 40 15 16 4 4 4 5 59 2 41 1 5 2 5 27 33 1 2 5 69 28 41 21 1 36 21 24 47 2...', 'output': ['0']}, {'input': '200000 5000\\r\\n199982 199959 199999 199990 199999 199988 199999 199997 199998 199952 199998 199995 199994 199999 199993 199994 199975 199985 199972 199989 199981 199976 199959 199987 199999 199996 199992 199988 199967 199997 199991 199982 199970 199938 199993 199984 199948 199986 199987 199954 199955 199993 199965 199994 199996 200000 199942 199999 199978 199999 199934 199998 199988 199993 199982 199982 199971 199998 199964 199976 199982 199993 199949 199987 199982 199970 199987 199982 199978 199970 199989 1...', 'output': ['0']}, {'input': '200000 100000\\r\\n34325 22969 103009 71027 2038 152578 5879 138977 191292 113909 109908 96249 184205 44508 147634 148777 176276 77032 69901 98564 189633 111725 130407 192895 152327 45155 47364 152117 95645 72935 162863 53604 68862 135160 17204 99950 90345 50234 48612 90841 131041 80246 83412 156495 160173 137432 191901 105695 179289 34864 101790 92090 197748 92914 144694 6006 139600 158454 110410 189327 88326 181432 40645 153505 87151 22745 109139 53679 5803 170908 84133 199840 50398 55018 166192 27004 82542 ...', 'output': ['1469076']}, {'input': '200000 100000\\r\\n7 32 54 4 21 7 46 25 29 10 4 24 16 28 2 37 7 50 36 3 28 8 19 16 28 10 12 9 55 5 2 1 21 28 9 8 29 1 39 10 19 2 3 43 12 8 11 13 4 23 3 6 21 3 25 5 16 13 14 20 54 22 44 37 10 12 8 3 1 4 3 39 18 52 78 20 12 11 20 24 32 5 13 19 5 50 1 2 65 7 15 22 3 54 30 6 11 6 21 12 14 36 50 12 3 6 21 13 52 49 6 21 64 7 47 21 8 2 7 12 20 3 35 23 41 17 6 27 31 3 64 18 13 5 11 1 7 39 32 4 3 3 34 2 6 9 9 61 3 46 4 27 11 10 51 2 104 9 6 8 29 54 20 3 2 21 8 17 29 10 18 47 5 13 12 3 17 2 2 21 25 8 12 15 23 6 22 40 13...', 'output': ['203774']}, {'input': '200000 100000\\r\\n199995 199985 199996 199949 199992 199991 199967 199997 199970 199987 199983 199969 199963 199948 199991 199927 199967 199997 199962 199996 199994 199996 199967 199968 199988 199987 200000 199995 199980 199989 199978 199973 199988 199999 199996 199999 200000 199995 199994 199989 199970 199998 200000 199994 199989 199977 199977 199991 199998 199996 199966 199999 199992 199960 199971 199980 199989 199965 199979 199993 199955 199991 199945 199990 199919 199966 199991 199966 199986 199999 199988...', 'output': ['400000']}, {'input': '200000 199999\\r\\n59140 28957 29004 124065 198366 31262 20255 555 101812 77794 57243 80983 106873 59781 102126 113354 195632 71253 185623 44381 152629 3476 7721 165148 72116 153977 116812 24392 130480 27568 110844 128214 148350 41366 196296 167855 69895 160766 128532 28654 179594 199534 69783 99429 155223 197218 74846 22616 20885 92744 1863 74047 34173 36675 12871 113417 156700 120361 23269 179092 74197 99589 20668 190966 59229 37589 167805 94519 179133 95820 126635 40724 46228 84754 72989 25150 175250 90047 ...', 'output': ['3137884']}, {'input': '200000 199999\\r\\n60 39 34 20 61 27 3 20 14 53 12 1 41 20 18 29 27 16 5 36 6 79 21 25 62 28 6 45 13 4 16 13 30 50 32 19 17 26 9 24 28 4 13 21 18 12 13 28 24 20 8 32 12 50 30 27 4 18 4 11 6 46 8 14 26 14 27 1 120 1 10 5 4 23 15 9 7 5 6 18 11 12 13 18 33 1 67 28 88 13 63 26 29 38 13 28 15 65 10 20 23 24 4 62 6 71 24 10 8 6 38 16 21 22 21 27 5 2 10 19 34 19 4 34 15 5 23 86 1 9 22 20 8 4 1 15 19 32 46 25 15 31 6 12 4 4 29 66 10 23 34 4 27 14 4 69 23 41 54 33 14 6 28 35 14 6 18 24 29 1 6 4 3 27 17 5 54 22 19 48 7 ...', 'output': ['650309']}, {'input': '200000 199999\\r\\n199991 199994 199961 199957 199983 199958 199999 199984 199983 200000 199983 199955 199997 199994 199973 199964 199958 199983 199926 199968 199955 199992 199994 199973 199974 199978 199992 199950 199938 199941 199952 199996 199989 199958 199990 199975 199979 199978 199955 199994 199969 199965 199948 199989 199993 199991 199974 199992 199982 199986 199990 199945 200000 199983 199999 199996 199955 199992 199989 199927 199978 199984 199995 199854 199949 199992 199945 199972 199982 199997 199948...', 'output': ['1799991']}, {'input': '200000 200000\\r\\n197543 192033 68698 92316 101105 108314 167424 42287 198103 96873 181007 90054 44902 63014 39886 13121 100673 922 101400 163828 48349 72261 114526 119401 113604 103065 183011 154652 109138 126652 94974 30269 145851 94410 40539 199281 85891 36305 175226 125138 47940 79444 33199 37866 77228 74953 41056 75132 149820 158299 95563 78843 133706 31336 60925 129361 122496 29955 139867 84314 17627 94387 140829 195174 79980 183347 109006 164346 54490 196784 129358 193423 197279 196494 32464 124498 787...', 'output': ['3137948']}, {'input': '200000 200000\\r\\n5 9 15 1 65 41 24 10 20 50 5 14 1 9 67 19 11 32 7 35 19 23 6 60 37 7 30 66 2 11 15 14 1 79 33 15 28 10 34 7 29 22 13 45 1 19 45 107 18 6 26 18 22 44 23 3 4 24 38 22 2 97 7 32 8 11 66 33 2 38 17 6 66 26 66 16 2 4 28 24 7 11 42 14 36 3 27 1 23 5 3 20 12 24 39 14 5 4 27 1 76 3 7 11 21 44 51 22 25 18 10 17 22 4 101 44 12 42 36 62 4 15 15 3 37 22 4 21 7 91 28 25 3 3 28 6 11 13 6 11 4 1 3 10 2 86 2 4 9 26 20 17 3 31 20 3 6 41 17 3 22 20 19 64 2 21 4 18 9 3 6 7 1 31 7 17 58 34 40 3 2 45 24 24 38 6 ...', 'output': ['648723']}, {'input': '200000 200000\\r\\n199954 199998 199997 199905 199992 199987 200000 199993 199994 199999 199990 199992 199991 199956 199972 199978 199998 199989 199980 199998 199982 199997 199988 199995 199982 199998 199988 199985 199979 199997 199996 199980 199992 199998 199984 199986 199990 199987 199997 199967 199983 199995 199881 199987 199950 199963 199991 199970 199985 199993 199931 199947 199995 199987 199998 199998 200000 199960 199967 199999 199982 199999 199909 199906 199968 199997 199985 200000 199994 199968 199987...', 'output': ['1800000']}, {'input': '200000 1\\r\\n92734 60628 60074 189922 26674 109716 131452 126414 69158 197231 150299 180674 162024 132858 122318 114462 28697 57218 62129 44535 50287 166852 35763 13525 41908 19763 87319 187829 136772 183477 184055 127559 46163 77415 62460 95345 177509 77973 27943 17418 98580 16066 145484 28448 39054 31782 191569 152755 57877 90347 148020 176439 185789 129328 26690 34006 61489 152262 136097 134956 178158 19957 59783 88393 161221 83768 108416 146739 107166 50877 179052 139105 26032 40934 195390 8897 28938 1995...', 'output': ['0']}, {'input': '122222 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 1 1 1...', 'output': ['0']}, {'input': '80000 79999\\r\\n1 40001 3 60001 5 40003 7 70001 9 40005 11 60003 13 40007 15 75001 17 40009 19 60005 21 40011 23 70003 25 40013 27 60007 29 40015 31 77501 33 40017 35 60009 37 40019 39 70005 41 40021 43 60011 45 40023 47 75003 49 40025 51 60013 53 40027 55 70007 57 40029 59 60015 61 40031 63 78751 65 40033 67 60017 69 40035 71 70009 73 40037 75 60019 77 40039 79 75005 81 40041 83 60021 85 40043 87 70011 89 40045 91 60023 93 40047 95 77503 97 40049 99 60025 101 40051 103 70013 105 40053 107 60027 109 40055 111...', 'output': ['1148930']}, {'input': '200000 200000\\r\\n34270 172662 160315 82250 122014 143563 189833 179410 199358 34011 154756 108685 144055 4444 198531 7726 180229 189819 131221 82152 107365 30928 15920 39640 109263 13894 39369 120853 167341 35740 99808 28942 6959 40064 30514 18025 197628 113087 162701 152773 49494 157652 83875 154323 119790 69069 7265 126682 179363 138690 17595 32863 126791 35121 67392 130851 113513 633 97905 84860 114018 30176 50547 123183 159184 39079 93299 154446 164239 157492 131022 165855 140555 128259 147364 197301 326...', 'output': ['3137875']}, {'input': '200000 2000\\r\\n370 166204 57007 38501 172522 141517 103303 64223 42659 20177 51346 53306 9530 151444 89650 4420 26956 107479 43444 48925 91520 131437 35119 1378 2629 111439 156790 168445 177463 179056 49024 195535 132940 103843 16822 179209 31004 36692 153316 89047 58328 14300 81899 72998 159058 41977 136270 69400 54278 61813 29924 48797 93959 94814 180334 115732 78508 87670 47762 7003 110845 27316 199711 16579 2593 70955 81361 80479 173377 3833 47015 14246 143011 60562 19331 138151 135055 79910 19538 31933 ...', 'output': ['16946']}, {'input': '50 4\\r\\n29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n2 2 2 2 2\\r\\n', 'output': ['0']}, {'input': '7 3\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '7 4\\r\\n3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '10 6\\r\\n7 7 7 7 7 7 7 7 7 7\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n9 9 9 9\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n3 3 3 3\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n2 2 2 2\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n9 9 9 9 9\\r\\n', 'output': ['0']}]","id":477} {"difficulty":1600,"lang":"Kotlin","lang_cluster":"Kotlin","src_uid":"fbfc333ad4b0a750f654a00be84aea67","execute_outcome":"RUNTIME_ERROR","source_code":"import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val rr = scanner.nextInt()\n\n val adj = Array(n, { _ ->\n BooleanArray(n, { _ ->\n false\n })\n })\n\n for (i in 1..rr) {\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n\n adj[a - 1][b - 1] = true\n adj[b - 1][a - 1] = true\n }\n\n val rrExists = adj[0][n - 1]\n\n val distance = IntArray(n, { _ -> Int.MAX_VALUE })\n val q = LinkedList()\n q.push(1)\n distance[0] = 0\n\n while (q.isNotEmpty()) {\n var curr = q.poll()\n\n adj[curr - 1].indices\n .filter { distance[it] > distance[curr - 1] + 1 && rrExists != adj[curr - 1][it] }\n .forEach {\n distance[it] = distance[curr - 1] + 1\n q.push(it + 1)\n }\n\n }\n\n if (distance[n - 1] == 0) {\n println(-1)\n } else {\n println(distance[n - 1])\n }\n\n}","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"],"human_solution":"import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val rr = scanner.nextInt()\n\n val adj = Array(n, { _ ->\n BooleanArray(n, { _ ->\n false\n })\n })\n\n for (i in 1..rr) {\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n\n adj[a - 1][b - 1] = true\n adj[b - 1][a - 1] = true\n }\n\n val rrExists = adj[0][n - 1]\n\n val distance = IntArray(n, { _ -> Int.MAX_VALUE })\n val q = LinkedList()\n q.push(1)\n distance[0] = 0\n\n while (q.isNotEmpty()) {\n var curr = q.poll()\n\n adj[curr - 1].indices\n .filter { distance[it] > distance[curr - 1] + 1 && rrExists != adj[curr - 1][it] }\n .forEach {\n distance[it] = distance[curr - 1] + 1\n q.push(it + 1)\n }\n\n }\n\n if (distance[n - 1] == Int.MAX_VALUE) {\n println(-1)\n } else {\n println(distance[n - 1])\n }\n\n}","testcases":"[{'input': '4 2\\r\\n1 3\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 5\\r\\n4 2\\r\\n3 5\\r\\n4 5\\r\\n5 1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 4\\r\\n1 2\\r\\n3 2\\r\\n3 4\\r\\n5 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '20 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '381 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 1\\r\\n1 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 5\\r\\n1 3\\r\\n2 1\\r\\n3 4\\r\\n4 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '20 1\\r\\n20 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '21 1\\r\\n21 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\n100 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '400 1\\r\\n1 400\\r\\n', 'output': ['2\\r\\n']}, {'input': '5 5\\r\\n2 5\\r\\n1 2\\r\\n1 4\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['2\\r\\n']}]","id":478} {"difficulty":900,"lang":"PHP","lang_cluster":"PHP","src_uid":"102667eaa3aee012fef70f4192464674","execute_outcome":"WRONG_ANSWER","source_code":"","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"],"human_solution":"","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":479} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"143_B","execute_outcome":"WRONG_ANSWER","source_code":"=2){\r\n echo $bani[1];\r\n }else{\r\n echo '0';\r\n }\r\n }else{\r\n echo \".00\";\r\n }\r\n if($minus){\r\n echo \")\";\r\n }\r\n?>","testcases":"[{'input': ['2012\\r\\n'], 'output': ['$2,012.00']}, {'input': ['0.000\\r\\n'], 'output': ['$0.00']}, {'input': ['-0.00987654321\\r\\n'], 'output': ['($0.00)']}, {'input': ['-12345678.9\\r\\n'], 'output': ['($12,345,678.90)']}, {'input': ['0.99999999999999999999\\r\\n'], 'output': ['$0.99']}, {'input': ['-999999999.9999999999\\r\\n'], 'output': ['($999,999,999.99)']}, {'input': ['4.30\\r\\n'], 'output': ['$4.30']}, {'input': ['-3136\\r\\n'], 'output': ['($3,136.00)']}, {'input': ['47.849\\r\\n'], 'output': ['$47.84']}, {'input': ['0\\r\\n'], 'output': ['$0.00']}, {'input': ['-1\\r\\n'], 'output': ['($1.00)']}, {'input': ['5.3944\\r\\n'], 'output': ['$5.39']}, {'input': ['-359789\\r\\n'], 'output': ['($359,789.00)']}, {'input': ['-999999\\r\\n'], 'output': ['($999,999.00)']}, {'input': ['50117.75\\r\\n'], 'output': ['$50,117.75']}, {'input': ['-2717.859\\r\\n'], 'output': ['($2,717.85)']}, {'input': ['446900763\\r\\n'], 'output': ['$446,900,763.00']}, {'input': ['-92.04295\\r\\n'], 'output': ['($92.04)']}, {'input': ['1000000000\\r\\n'], 'output': ['$1,000,000,000.00']}, {'input': ['-4097961.5\\r\\n'], 'output': ['($4,097,961.50)']}, {'input': ['-83348637.91\\r\\n'], 'output': ['($83,348,637.91)']}, {'input': ['741968647.01\\r\\n'], 'output': ['$741,968,647.01']}, {'input': ['8590210736.2\\r\\n'], 'output': ['$8,590,210,736.20']}, {'input': ['-337322633.10\\r\\n'], 'output': ['($337,322,633.10)']}, {'input': ['-9389724657.706\\r\\n'], 'output': ['($9,389,724,657.70)']}, {'input': ['-337807291537795\\r\\n'], 'output': ['($337,807,291,537,795.00)']}, {'input': ['-1000000000000000\\r\\n'], 'output': ['($1,000,000,000,000,000.00)']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['$1,000,000,000,000,000,000.00']}, {'input': ['64852365412711705.4\\r\\n'], 'output': ['$64,852,365,412,711,705.40']}, {'input': ['-14193044875680849641.0\\r\\n'], 'output': ['($14,193,044,875,680,849,641.00)']}, {'input': ['-9087207850675188568.44\\r\\n'], 'output': ['($9,087,207,850,675,188,568.44)']}, {'input': ['-999999999999999999999999\\r\\n'], 'output': ['($999,999,999,999,999,999,999,999.00)']}, {'input': ['95464737206897655595566.87\\r\\n'], 'output': ['$95,464,737,206,897,655,595,566.87']}, {'input': ['20486447414118.916680683147\\r\\n'], 'output': ['$20,486,447,414,118.91']}, {'input': ['-195688513344900667321324887161\\r\\n'], 'output': ['($195,688,513,344,900,667,321,324,887,161.00)']}, {'input': ['-467854663215578391335472070.522\\r\\n'], 'output': ['($467,854,663,215,578,391,335,472,070.52)']}, {'input': ['-9946519009668593136622791780335166786329.966\\r\\n'], 'output': ['($9,946,519,009,668,593,136,622,791,780,335,166,786,329.96)']}, {'input': ['-39243277445578948100023610303161362.21742597518\\r\\n'], 'output': ['($39,243,277,445,578,948,100,023,610,303,161,362.21)']}, {'input': ['-999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['($999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.00)']}, {'input': ['-1120451303595201012675538441508298946450567446.2\\r\\n'], 'output': ['($1,120,451,303,595,201,012,675,538,441,508,298,946,450,567,446.20)']}, {'input': ['-667416497168265603150839581334265910632362977345\\r\\n'], 'output': ['($667,416,497,168,265,603,150,839,581,334,265,910,632,362,977,345.00)']}, {'input': ['-5896634442314348289084387258044853039981310264175\\r\\n'], 'output': ['($5,896,634,442,314,348,289,084,387,258,044,853,039,981,310,264,175.00)']}, {'input': ['645862132625704263852654466816044056725411814537812.8\\r\\n'], 'output': ['$645,862,132,625,704,263,852,654,466,816,044,056,725,411,814,537,812.80']}, {'input': ['20302284249108248013254029284738266163210459601273.434\\r\\n'], 'output': ['$20,302,284,249,108,248,013,254,029,284,738,266,163,210,459,601,273.43']}, {'input': ['-335585948391999514421347454725980775593710083728376.235\\r\\n'], 'output': ['($335,585,948,391,999,514,421,347,454,725,980,775,593,710,083,728,376.23)']}, {'input': ['8069847002922332743537016743686274581681180388843128677728\\r\\n'], 'output': ['$8,069,847,002,922,332,743,537,016,743,686,274,581,681,180,388,843,128,677,728.00']}, {'input': ['-1000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['($1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00)']}, {'input': ['-9426928046528138766008648709237083850143959438752.99576081\\r\\n'], 'output': ['($9,426,928,046,528,138,766,008,648,709,237,083,850,143,959,438,752.99)']}, {'input': ['7847469828916401598273845389736502122924911071339770925.278\\r\\n'], 'output': ['$7,847,469,828,916,401,598,273,845,389,736,502,122,924,911,071,339,770,925.27']}, {'input': ['6612569248276041501392573128342394934.339553169499895358359857\\r\\n'], 'output': ['$6,612,569,248,276,041,501,392,573,128,342,394,934.33']}, {'input': ['-78441689173753107674674252785635804718172761356557153691194.62\\r\\n'], 'output': ['($78,441,689,173,753,107,674,674,252,785,635,804,718,172,761,356,557,153,691,194.62)']}, {'input': ['-26420799441242046176813573049397911227605022448441841.79118151\\r\\n'], 'output': ['($26,420,799,441,242,046,176,813,573,049,397,911,227,605,022,448,441,841.79)']}, {'input': ['1000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['$1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00']}, {'input': ['-440176280332493569864975483046616452663067706833582934195268991\\r\\n'], 'output': ['($440,176,280,332,493,569,864,975,483,046,616,452,663,067,706,833,582,934,195,268,991.00)']}, {'input': ['45068840874548394281603568826222223550419177965629777875090709223\\r\\n'], 'output': ['$45,068,840,874,548,394,281,603,568,826,222,223,550,419,177,965,629,777,875,090,709,223.00']}, {'input': ['694057847299426980275391007402296515925594191675094941155586653678\\r\\n'], 'output': ['$694,057,847,299,426,980,275,391,007,402,296,515,925,594,191,675,094,941,155,586,653,678.00']}, {'input': ['-957970608566623530128907769981235852029999876705137521027635757.983\\r\\n'], 'output': ['($957,970,608,566,623,530,128,907,769,981,235,852,029,999,876,705,137,521,027,635,757.98)']}, {'input': ['-999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['($999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.00)']}, {'input': ['-31237099946005389291000524337411657445033712616943108265479899943319776753\\r\\n'], 'output': ['($31,237,099,946,005,389,291,000,524,337,411,657,445,033,712,616,943,108,265,479,899,943,319,776,753.00)']}, {'input': ['129213728483376896322034359636257815625283844448760915618261775174758145181.4\\r\\n'], 'output': ['$129,213,728,483,376,896,322,034,359,636,257,815,625,283,844,448,760,915,618,261,775,174,758,145,181.40']}, {'input': ['42436883801797921017002508329344377731225676938894736357215113693696441876.74\\r\\n'], 'output': ['$42,436,883,801,797,921,017,002,508,329,344,377,731,225,676,938,894,736,357,215,113,693,696,441,876.74']}, {'input': ['-412877493852539226130846658848085431323015500045621801.186290244529330637919069841\\r\\n'], 'output': ['($412,877,493,852,539,226,130,846,658,848,085,431,323,015,500,045,621,801.18)']}, {'input': ['-574893403412500337461904214575009975847859132644288548328404148513112616299380872537.0\\r\\n'], 'output': ['($574,893,403,412,500,337,461,904,214,575,009,975,847,859,132,644,288,548,328,404,148,513,112,616,299,380,872,537.00)']}, {'input': ['5533548446182725508036320768515297517684533355269108005785922527441026147032711096226.86\\r\\n'], 'output': ['$5,533,548,446,182,725,508,036,320,768,515,297,517,684,533,355,269,108,005,785,922,527,441,026,147,032,711,096,226.86']}, {'input': ['-388992510982960799226860251113727086.40151448032429506491841194161722800219231951466273\\r\\n'], 'output': ['($388,992,510,982,960,799,226,860,251,113,727,086.40)']}, {'input': ['-1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['($1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00)']}, {'input': ['-5918197227517459215086434488069169077399840893456742554562785165395986123057440893145094.766\\r\\n'], 'output': ['($5,918,197,227,517,459,215,086,434,488,069,169,077,399,840,893,456,742,554,562,785,165,395,986,123,057,440,893,145,094.76)']}, {'input': ['6478564388953796549388720554132845507729109849868298957775985580270942075809511904097608680.2\\r\\n'], 'output': ['$6,478,564,388,953,796,549,388,720,554,132,845,507,729,109,849,868,298,957,775,985,580,270,942,075,809,511,904,097,608,680.20']}, {'input': ['-6608605342368730994322893748034318039589361759849416904183711274389684094202666590051634245034124\\r\\n'], 'output': ['($6,608,605,342,368,730,994,322,893,748,034,318,039,589,361,759,849,416,904,183,711,274,389,684,094,202,666,590,051,634,245,034,124.00)']}, {'input': ['96923618713643049034901616201059739110612607940570171931128836281408507843006798661841666493086.61\\r\\n'], 'output': ['$96,923,618,713,643,049,034,901,616,201,059,739,110,612,607,940,570,171,931,128,836,281,408,507,843,006,798,661,841,666,493,086.61']}, {'input': ['-517546026888198271507158769760866655703910236108772942356185789408213495267854245076096353651979.8\\r\\n'], 'output': ['($517,546,026,888,198,271,507,158,769,760,866,655,703,910,236,108,772,942,356,185,789,408,213,495,267,854,245,076,096,353,651,979.80)']}, {'input': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['$9,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.00']}, {'input': ['-999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n'], 'output': ['($999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999.00)']}, {'input': ['-815237564329654906966710129877160169011275185850610159260306644937525319275278007248384181194947.28\\r\\n'], 'output': ['($815,237,564,329,654,906,966,710,129,877,160,169,011,275,185,850,610,159,260,306,644,937,525,319,275,278,007,248,384,181,194,947.28)']}, {'input': ['1609444903206838610558177906619581955157825950595724445549624361368550861446891019160980179056621441\\r\\n'], 'output': ['$1,609,444,903,206,838,610,558,177,906,619,581,955,157,825,950,595,724,445,549,624,361,368,550,861,446,891,019,160,980,179,056,621,441.00']}, {'input': ['-35537407322675227867508928547215513270324784786663652634725025510744878530809034357724640012675.565\\r\\n'], 'output': ['($35,537,407,322,675,227,867,508,928,547,215,513,270,324,784,786,663,652,634,725,025,510,744,878,530,809,034,357,724,640,012,675.56)']}, {'input': ['-1925998064032579186735317615389112142155311850475835576562145669565982488184005786899836428580775.0\\r\\n'], 'output': ['($1,925,998,064,032,579,186,735,317,615,389,112,142,155,311,850,475,835,576,562,145,669,565,982,488,184,005,786,899,836,428,580,775.00)']}, {'input': ['-151277365498121078756232179307020255183838049147325207397719920725067524511168597227357027671262974\\r\\n'], 'output': ['($151,277,365,498,121,078,756,232,179,307,020,255,183,838,049,147,325,207,397,719,920,725,067,524,511,168,597,227,357,027,671,262,974.00)']}, {'input': ['-94567610568172711079874848395505663034158058453541356405687412896214661991252184312404537628616.980\\r\\n'], 'output': ['($94,567,610,568,172,711,079,874,848,395,505,663,034,158,058,453,541,356,405,687,412,896,214,661,991,252,184,312,404,537,628,616.98)']}, {'input': ['5552014028917125934664874618128879449020166415278427980290619767043458191075263555779358121.76899621\\r\\n'], 'output': ['$5,552,014,028,917,125,934,664,874,618,128,879,449,020,166,415,278,427,980,290,619,767,043,458,191,075,263,555,779,358,121.76']}, {'input': ['2550200914539395142436748539585175024948346405871252468705518320188561734542212313710731590053887.14\\r\\n'], 'output': ['$2,550,200,914,539,395,142,436,748,539,585,175,024,948,346,405,871,252,468,705,518,320,188,561,734,542,212,313,710,731,590,053,887.14']}, {'input': ['169111053680418810505586659748530205695340474893994150913915241455549545588046718243429009096899.721\\r\\n'], 'output': ['$169,111,053,680,418,810,505,586,659,748,530,205,695,340,474,893,994,150,913,915,241,455,549,545,588,046,718,243,429,009,096,899.72']}, {'input': ['-8302081723264231257651127829066891591565707300162037272443063737275775635240827533455570038921755.8\\r\\n'], 'output': ['($8,302,081,723,264,231,257,651,127,829,066,891,591,565,707,300,162,037,272,443,063,737,275,775,635,240,827,533,455,570,038,921,755.80)']}, {'input': ['-292248618257633380305171416004365379539463749949334547640267733391588708052597413502241817581110.84\\r\\n'], 'output': ['($292,248,618,257,633,380,305,171,416,004,365,379,539,463,749,949,334,547,640,267,733,391,588,708,052,597,413,502,241,817,581,110.84)']}, {'input': ['8087188987747615879025660857396187057475326352182448073610839965896456538717186544887072170343027939\\r\\n'], 'output': ['$8,087,188,987,747,615,879,025,660,857,396,187,057,475,326,352,182,448,073,610,839,965,896,456,538,717,186,544,887,072,170,343,027,939.00']}, {'input': ['762519263820550209316662292240308083373767394981759714.037848496865152996658249820591156785758954539\\r\\n'], 'output': ['$762,519,263,820,550,209,316,662,292,240,308,083,373,767,394,981,759,714.03']}, {'input': ['-81065814290895584254457019744497055053248932892817738718849487679519028041818854925725440291395.398\\r\\n'], 'output': ['($81,065,814,290,895,584,254,457,019,744,497,055,053,248,932,892,817,738,718,849,487,679,519,028,041,818,854,925,725,440,291,395.39)']}, {'input': ['-32941712101597478543219921523193493949615291911649974076128866311848385268672190709108207764990.550\\r\\n'], 'output': ['($32,941,712,101,597,478,543,219,921,523,193,493,949,615,291,911,649,974,076,128,866,311,848,385,268,672,190,709,108,207,764,990.55)']}, {'input': ['2089113443991831781611590658416581830404242017.85102926202385542583311855337073083712400492547136479\\r\\n'], 'output': ['$2,089,113,443,991,831,781,611,590,658,416,581,830,404,242,017.85']}, {'input': ['-93446155923266881322196606839694485100712773936897171033382798807975023881552872455711005123932.747\\r\\n'], 'output': ['($93,446,155,923,266,881,322,196,606,839,694,485,100,712,773,936,897,171,033,382,798,807,975,023,881,552,872,455,711,005,123,932.74)']}, {'input': ['960516596871944593730108478032758053821336372808735358607440437077013969634756697387966042842288.508\\r\\n'], 'output': ['$960,516,596,871,944,593,730,108,478,032,758,053,821,336,372,808,735,358,607,440,437,077,013,969,634,756,697,387,966,042,842,288.50']}, {'input': ['7542946645993289345871768107036410651745989844030221776852993379463784193885567707317993804499615689\\r\\n'], 'output': ['$7,542,946,645,993,289,345,871,768,107,036,410,651,745,989,844,030,221,776,852,993,379,463,784,193,885,567,707,317,993,804,499,615,689.00']}, {'input': ['-62833497045916718064314002220718776776624697240820362462669558147156815011509869423334004968891.075\\r\\n'], 'output': ['($62,833,497,045,916,718,064,314,002,220,718,776,776,624,697,240,820,362,462,669,558,147,156,815,011,509,869,423,334,004,968,891.07)']}, {'input': ['369983878656471317107141313973936685655559201630341263457253892446495.822347697919107135036916507458\\r\\n'], 'output': ['$369,983,878,656,471,317,107,141,313,973,936,685,655,559,201,630,341,263,457,253,892,446,495.82']}, {'input': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['$1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00']}, {'input': ['-7200722479435658295856375503813639375609209638447823589904775057990210002452424572601761458228411.3\\r\\n'], 'output': ['($7,200,722,479,435,658,295,856,375,503,813,639,375,609,209,638,447,823,589,904,775,057,990,210,002,452,424,572,601,761,458,228,411.30)']}, {'input': ['1.62929379626674077244098830537592273171157251593607257308766051098303017164327540412154291842807913\\r\\n'], 'output': ['$1.62']}, {'input': ['9094697811219913240397316094992038813655777565859532452.35345453828434088557646454113264025096745262\\r\\n'], 'output': ['$9,094,697,811,219,913,240,397,316,094,992,038,813,655,777,565,859,532,452.35']}, {'input': ['-241995182456075514870952227695034085165209475359259147742565065759917424411707290789641890279251.11\\r\\n'], 'output': ['($241,995,182,456,075,514,870,952,227,695,034,085,165,209,475,359,259,147,742,565,065,759,917,424,411,707,290,789,641,890,279,251.11)']}, {'input': ['2567340036354357844391998756110821468858185018763415770617907336824217629234299240638243305079104961\\r\\n'], 'output': ['$2,567,340,036,354,357,844,391,998,756,110,821,468,858,185,018,763,415,770,617,907,336,824,217,629,234,299,240,638,243,305,079,104,961.00']}]","id":480} {"difficulty":1500,"lang":"PHP","lang_cluster":"PHP","src_uid":"144_C","execute_outcome":"RUNTIME_ERROR","source_code":"","description":"A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string \"aab\" is an anagram of the string \"aba\" and the string \"aaa\" is not.The string t is called a substring of the string s if it can be read starting from some position in the string s. For example, the string \"aba\" has six substrings: \"a\", \"b\", \"a\", \"ab\", \"ba\", \"aba\".You are given a string s, consisting of lowercase Latin letters and characters \"?\". You are also given a string p, consisting of lowercase Latin letters only. Let's assume that a string is good if you can obtain an anagram of the string p from it, replacing the \"?\" characters by Latin letters. Each \"?\" can be replaced by exactly one character of the Latin alphabet. For example, if the string p = \u00ababa\u00bb, then the string \"a??\" is good, and the string \u00ab?bc\u00bb is not. Your task is to find the number of good substrings of the string s (identical substrings must be counted in the answer several times).","input_specification":"The first line is non-empty string s, consisting of no more than 10^5 lowercase Latin letters and characters \"?\". The second line is non-empty string p, consisting of no more than 10^5 lowercase Latin letters. Please note that the length of the string p can exceed the length of the string s.\n","output_specification":"Print the single number representing the number of good substrings of string s.\nTwo substrings are considered different in their positions of occurrence are different. Thus, if some string occurs several times, then it should be counted the same number of times.\n","notes":"Consider the first sample test. Here the string s has two good substrings: \"b??\" (after we replace the question marks we get \"baa\"), \"???\" (after we replace the question marks we get \"baa\").\nLet's consider the second sample test. Here the string s has two good substrings: \"ab?\" (\"?\" can be replaced by \"c\"), \"b?c\" (\"?\" can be replaced by \"a\").\n","sample_inputs":["bb??x???\naab\n","ab?c\nacb\n"],"sample_outputs":["2\n","2\n"],"human_solution":" 0);\r\ncnt($a, $s, $sn, -1);\r\ncnt($a, $p, $sn, 1);\r\n$d = 0;\r\nforeach ($a as $k => $i) if ($i > 0 && $k != $q) $d += $i;\r\n$r = ($d == 0 ? 1 : 0);\r\nfor ($i = 0; ($j = $i + $sn) < $pn; $i++)\r\n{\r\n $c = substr($p, $i, 1);\r\n cnt($a, $c, 1, -1);\r\n if ($c != \"?\" && $a[ord($c)] >= 0) $d--;\r\n $c = substr($p, $j, 1);\r\n cnt($a, $c, 1, 1);\r\n if ($c != \"?\" && $a[ord($c)] > 0) $d++;\r\n if ($d == 0) $r++;\r\n}\r\nfprintf(STDOUT, \"%d\\n\", $r);\r\n","testcases":"[{'input': ['bb??x???\\r\\naab\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['ab?c\\r\\nacb\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['ccaac\\r\\ncbcbca\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['?bba?\\r\\nbba\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aaaaa??a?a\\r\\naaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['?bba?b?aaa\\r\\nabb\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['?b?aaabaa?\\r\\naaa\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aaaaa?ab??\\r\\naab\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['?bab?a?aab\\r\\naaa\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['??fb???a??\\r\\ndeeefc\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['?\\r\\na\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['a\\r\\na\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['?\\r\\ncb\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['a\\r\\naa\\r\\n'], 'output': ['0\\r\\n']}]","id":481} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"145_A","execute_outcome":"RUNTIME_ERROR","source_code":"#include\n#include\n#define MAXN 100008\nchar sa[MAXN],sb[MAXN];\nint main(){\n \n int i,L,counta,countb,La,count;\n\twhile(scanf(\"%s%s\",sa,sb)!=EOF){\n\t\tL=strlen(sa);\n\t\tLa=0;\n\t\tcounta=0;countb=0;count=0;\n\t\tfor(i=0;icounta){\n\t\t\t\tcount=countb-counta;\n\t\t\t\tLa-=count;\n\t\t\t\tcount+=La\/2;\n\t\t }\n\t\t\telse if(countb","description":"The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus n ice sculptures were erected. The sculptures are arranged in a circle at equal distances from each other, so they form a regular n-gon. They are numbered in clockwise order with numbers from 1 to n.The site of the University has already conducted a voting that estimated each sculpture's characteristic of ti \u2014 the degree of the sculpture's attractiveness. The values of ti can be positive, negative or zero.When the university rector came to evaluate the work, he said that this might be not the perfect arrangement. He suggested to melt some of the sculptures so that: the remaining sculptures form a regular polygon (the number of vertices should be between 3 and n), the sum of the ti values of the remaining sculptures is maximized. Help the Vice Rector to analyze the criticism \u2014 find the maximum value of ti sum which can be obtained in this way. It is allowed not to melt any sculptures at all. The sculptures can not be moved.","input_specification":"The first input line contains an integer n (3\u2264n\u226420000) \u2014 the initial number of sculptures. The second line contains a sequence of integers t1,t2,...,tn, ti \u2014 the degree of the i-th sculpture's attractiveness (-1000\u2264ti\u22641000). The numbers on the line are separated by spaces.\n","output_specification":"Print the required maximum sum of the sculptures' attractiveness.\n","notes":"In the first sample it is best to leave every second sculpture, that is, leave sculptures with attractivenesses: 2, 4, 5 \u0438 3.\n","sample_inputs":["8\n1 2 -3 4 -5 5 2 3\n","6\n1 -2 3 -4 5 -6\n","6\n1 2 3 4 5 6\n"],"sample_outputs":["14\n","9\n","21\n"],"human_solution":"= 3))\r\n {\r\n for($y = 0; $y < $x; $y++)\r\n {\r\n $j = 0;\r\n for($z = $y; $z < $a; $z += $x)\r\n {\r\n $j += $b[$z];\r\n }\r\n array_push($c, $j);\r\n }\r\n }\r\n}\r\nprint max($c);\r\n?>","testcases":"[{'input': ['8\\r\\n1 2 -3 4 -5 5 2 3\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['6\\r\\n1 -2 3 -4 5 -6\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['6\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['4\\r\\n1 -10 1 -10\\r\\n'], 'output': ['-18\\r\\n']}, {'input': ['6\\r\\n1 0 1 0 1 0\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n1 1 1 1 1 1 1 -1000 1 1 1 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3\\r\\n-1 -1 -1\\r\\n'], 'output': ['-3\\r\\n']}, {'input': ['97\\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\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 -1 1 1 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6\\r\\n-8 -8 6 5 -5 1\\r\\n'], 'output': ['-2\\r\\n']}, {'input': ['7\\r\\n0 55 -5 50 53 34 84\\r\\n'], 'output': ['271\\r\\n']}, {'input': ['9\\r\\n-2 -1 2 0 1 1 -1 -2 -2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n5 -5 -4 3 -1 -1 2 1 5 -2\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['13\\r\\n6 7 8 2 5 1 -9 -6 9 10 8 9 -8\\r\\n'], 'output': ['42\\r\\n']}]","id":483} {"difficulty":1400,"lang":"PHP","lang_cluster":"PHP","src_uid":"159_A","execute_outcome":"WRONG_ANSWER","source_code":" 0 and $razn <= $param[1])\r\n {\r\n $itogfr[] = $friends[$i][1] . \" \" . $friends[$j][1];\r\n $num++;\r\n unset($friends[$j]); \r\n break; \r\n }\r\n }\r\n }\r\n\r\n}\r\necho $num;\r\nfor ($i = 0; $i < count($itogfr); $i++)\r\n{\r\n echo \"\\n\" . $itogfr[$i];\r\n}\r\n\r\n\r\n\r\n?>","description":"Polycarpus has a hobby \u2014 he develops an unusual social network. His work is almost completed, and there is only one more module to implement \u2014 the module which determines friends. Oh yes, in this social network one won't have to add friends manually! Pairs of friends are deduced in the following way. Let's assume that user A sent user B a message at time t1, and user B sent user A a message at time t2. If 0 0) && ($m <= $b))\r\n {\r\n if($c[$x] < $d[$x])\r\n {\r\n array_push($f, $c[$x] . \" \" . $d[$x]);\r\n }\r\n else\r\n {\r\n array_push($f, $d[$x] . \" \" . $c[$x]);\r\n }\r\n }\r\n }\r\n array_unshift($j, $c[$x] . \" \" . $d[$x]);\r\n array_unshift($j, \" \");\r\n unset($j[0]);\r\n}\r\nif(count($f) == 0)\r\n{\r\n print \"0\";\r\n}\r\nelse\r\n{\r\n $f = array_unique($f);\r\n sort($f);\r\n print count($f) . \"\\n\";\r\n for($x = 0; $x < count($f) - 1; $x++)\r\n {\r\n print $f[$x] . \"\\n\";\r\n }\r\n print $f[$x];\r\n}\r\n?>","testcases":"[{'input': ['4 1\\r\\nvasya petya 1\\r\\npetya vasya 2\\r\\nanya ivan 2\\r\\nivan anya 4\\r\\n'], 'output': ['1\\r\\npetya vasya\\r\\n']}, {'input': ['1 1000\\r\\na b 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\na b 0\\r\\nb a 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\na b 1\\r\\nb c 2\\r\\nc d 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 2\\r\\nlutdc xfavzancwrokyzzkpco 0\\r\\nxfavzancwrokyzzkpco lutdc 1\\r\\nlutdc vydvatbnibttqgn 2\\r\\nxfavzancwrokyzzkpco vydvatbnibttqgn 2\\r\\nvydvatbnibttqgn lutdc 3\\r\\nlutdc xfavzancwrokyzzkpco 4\\r\\nlutdc vydvatbnibttqgn 5\\r\\nlutdc vydvatbnibttqgn 6\\r\\nlutdc xfavzancwrokyzzkpco 6\\r\\nvydvatbnibttqgn xfavzancwrokyzzkpco 6\\r\\n'], 'output': ['2\\r\\nlutdc vydvatbnibttqgn\\r\\nlutdc xfavzancwrokyzzkpco\\r\\n']}, {'input': ['10 2\\r\\nrvmykneiddpqyf jdhmt 0\\r\\nwcsjvh jdhmt 0\\r\\njdhmt rvmykneiddpqyf 1\\r\\nrvmykneiddpqyf jdhmt 1\\r\\nwcsjvh rvmykneiddpqyf 2\\r\\nrvmykneiddpqyf jdhmt 2\\r\\njdhmt rvmykneiddpqyf 3\\r\\njdhmt wcsjvh 5\\r\\njdhmt wcsjvh 5\\r\\nrvmykneiddpqyf jdhmt 6\\r\\n'], 'output': ['1\\r\\njdhmt rvmykneiddpqyf\\r\\n']}, {'input': ['10 2\\r\\nliazxawm spxwktiqjgs 0\\r\\nnolq liazxawm 1\\r\\nliazxawm nolq 2\\r\\nliazxawm spxwktiqjgs 2\\r\\nnolq liazxawm 3\\r\\nspxwktiqjgs liazxawm 3\\r\\nspxwktiqjgs liazxawm 3\\r\\nspxwktiqjgs liazxawm 3\\r\\nspxwktiqjgs nolq 3\\r\\nnolq spxwktiqjgs 4\\r\\n'], 'output': ['3\\r\\nliazxawm nolq\\r\\nliazxawm spxwktiqjgs\\r\\nnolq spxwktiqjgs\\r\\n']}, {'input': ['10 2\\r\\nfxn ipntr 0\\r\\nipntr fxn 1\\r\\nfxn ipntr 1\\r\\npfvpfteadph ipntr 2\\r\\nfxn pfvpfteadph 4\\r\\nipntr fxn 4\\r\\npfvpfteadph fxn 5\\r\\nfxn pfvpfteadph 5\\r\\npfvpfteadph ipntr 6\\r\\nipntr pfvpfteadph 6\\r\\n'], 'output': ['2\\r\\nfxn ipntr\\r\\nfxn pfvpfteadph\\r\\n']}, {'input': ['10 2\\r\\nyltec xnzdtcgzxqqltvpfr 0\\r\\nfxxhcmbzzg xnzdtcgzxqqltvpfr 0\\r\\nfxxhcmbzzg xnzdtcgzxqqltvpfr 0\\r\\nfxxhcmbzzg yltec 1\\r\\nfxxhcmbzzg xnzdtcgzxqqltvpfr 2\\r\\nfxxhcmbzzg yltec 2\\r\\nyltec fxxhcmbzzg 3\\r\\nyltec xnzdtcgzxqqltvpfr 3\\r\\nyltec xnzdtcgzxqqltvpfr 5\\r\\nfxxhcmbzzg yltec 6\\r\\n'], 'output': ['1\\r\\nfxxhcmbzzg yltec\\r\\n']}, {'input': ['10 2\\r\\nrclgdpxdefqu abrfhwigaihoqq 0\\r\\nabrfhwigaihoqq rclgdpxdefqu 1\\r\\nrclgdpxdefqu bvkfwutdtvxgvx 1\\r\\nrclgdpxdefqu abrfhwigaihoqq 1\\r\\nabrfhwigaihoqq bvkfwutdtvxgvx 2\\r\\nbvkfwutdtvxgvx abrfhwigaihoqq 2\\r\\nbvkfwutdtvxgvx abrfhwigaihoqq 3\\r\\nabrfhwigaihoqq rclgdpxdefqu 5\\r\\nabrfhwigaihoqq rclgdpxdefqu 6\\r\\nrclgdpxdefqu bvkfwutdtvxgvx 6\\r\\n'], 'output': ['2\\r\\nabrfhwigaihoqq bvkfwutdtvxgvx\\r\\nabrfhwigaihoqq rclgdpxdefqu\\r\\n']}, {'input': ['3 1\\r\\na b 1\\r\\na b 2\\r\\nb a 2\\r\\n'], 'output': ['1\\r\\na b\\r\\n']}]","id":484} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"159_B","execute_outcome":"WRONG_ANSWER","source_code":" $val) {\r\n if (isset($b[$key])) {\r\n if ($b[$key] >= $val) { $ans += $val; }\r\n else { $ans += $b[$key]; }\r\n } \r\n }\r\n return $ans;\r\n}\r\n\r\necho couple($fd, $kd).' '.couple($f, $k);\r\n\r\n?>","description":"Polycarpus has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi is the diameter. Correspondingly, each cap is described by two numbers: aj is the color and bj is the diameter. Cap (aj,bj) can close marker (xi,yi) only if their diameters match, that is, bj=yi. Besides, a marker is considered to be beautifully closed, if the cap color and the marker color match, that is, aj=xi.Find the way to close the maximum number of markers. If there are several such ways, then choose the one that has the maximum number of beautifully closed markers.","input_specification":"The first input line contains two space-separated integers n and m (1\u2264n,m\u226410^5) \u2014 the number of markers and the number of caps, correspondingly. \nNext n lines describe the markers. The i-th line contains two space-separated integers xi, yi (1\u2264xi,yi\u22641000) \u2014 the i-th marker's color and diameter, correspondingly.\nNext m lines describe the caps. The j-th line contains two space-separated integers aj, bj (1\u2264aj,bj\u22641000) \u2014 the color and diameter of the j-th cap, correspondingly.\n","output_specification":"Print two space-separated integers u,v, where u is the number of closed markers and v is the number of beautifully closed markers in the sought optimal way. Remember that you have to find the way to close the maximum number of markers, and if there are several such ways, you should choose the one where the number of beautifully closed markers is maximum.\n","notes":"In the first test sample the first marker should be closed by the fourth cap, the second marker should be closed by the first cap and the third marker should be closed by the second cap. Thus, three markers will be closed, and two of them will be beautifully closed \u2014 the first and the third markers.\n","sample_inputs":["3 4\n1 2\n3 4\n2 4\n5 4\n2 4\n1 1\n1 2\n","2 2\n1 2\n2 1\n3 4\n5 1\n"],"sample_outputs":["3 2\n","1 0\n"],"human_solution":" $val) {\r\n if (isset($cap[$key])) {\r\n $ans1 += min(array_sum($val), array_sum($cap[$key]));\r\n }\r\n}\r\necho $ans1 . ' ' . $ans2 . PHP_EOL;\r\n","testcases":"[{'input': ['3 4\\r\\n1 2\\r\\n3 4\\r\\n2 4\\r\\n5 4\\r\\n2 4\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['3 2\\r\\n']}, {'input': ['2 2\\r\\n1 2\\r\\n2 1\\r\\n3 4\\r\\n5 1\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['6 7\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['3 3\\r\\n']}, {'input': ['6 7\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n'], 'output': ['5 5\\r\\n']}, {'input': ['6 7\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n'], 'output': ['6 5\\r\\n']}, {'input': ['6 7\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['3 3\\r\\n']}, {'input': ['6 2\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3 3\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['3 3\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n2 2\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['1 1\\r\\n1 2\\r\\n2 2\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['1 5\\r\\n1 1\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n1 1\\r\\n'], 'output': ['1 1\\r\\n']}]","id":485} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"174_A","execute_outcome":"RUNTIME_ERROR","source_code":"","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\u2264n\u2264100,1\u2264b\u2264100), 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,a2,...,an (0\u2264ai\u2264100), where ai is the current volume of drink in the i-th mug.\n","output_specification":"Print a single number \"-1\" (without the quotes), if there is no solution. Otherwise, print n float numbers c1,c2,...,cn, 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.\nRussian 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.\n","notes":null,"sample_inputs":["5 50\n1 2 3 4 5\n","2 2\n1 100\n"],"sample_outputs":["12.000000\n11.000000\n10.000000\n9.000000\n8.000000\n","-1\n"],"human_solution":"","description":"The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has n pebbles. He arranges them in a equal rows, each row has b pebbles (a>1). Note that the Beaver must use all the pebbles he has, i. e. n=a\u00b7b. 10 pebbles are arranged in two rows, each row has 5 pebbles Once the Smart Beaver has arranged the pebbles, he takes back any of the resulting rows (that is, b pebbles) and discards all other pebbles. Then he arranges all his pebbles again (possibly choosing other values of a and b) and takes back one row, and so on. The game continues until at some point the Beaver ends up with exactly one pebble. The game process can be represented as a finite sequence of integers c1,...,ck, where: c1=n ci+1 is the number of pebbles that the Beaver ends up with after the i-th move, that is, the number of pebbles in a row after some arrangement of ci pebbles (1\u2264ici+1. ck=1 The result of the game is the sum of numbers ci. You are given n. Find the maximum possible result of the game.","input_specification":"The single line of the input contains a single integer n \u2014 the initial number of pebbles the Smart Beaver has.\nThe input limitations for getting 30 points are: \n 2\u2264n\u226450 The input limitations for getting 100 points are: \n 2\u2264n\u226410^9 ","output_specification":"Print a single number \u2014 the maximum possible result of the game.\n","notes":"Consider the first example (c1=10). The possible options for the game development are:\n Arrange the pebbles in 10 rows, one pebble per row. Then c2=1, and the game ends after the first move with the result of 11. Arrange the pebbles in 5 rows, two pebbles per row. Then c2=2, and the game continues. During the second move we have two pebbles which can be arranged in a unique way (remember that you are not allowed to put all the pebbles in the same row!) \u2014 2 rows, one pebble per row. c3=1, and the game ends with the result of 13. Finally, arrange the pebbles in two rows, five pebbles per row. The same logic leads us to c2=5,c3=1, and the game ends with the result of 16 \u2014 the maximum possible result. ","sample_inputs":["10\n","8\n"],"sample_outputs":["16\n","15\n"],"human_solution":" 1) {\r\n $flg = true;\r\n for ($i = $tmp; $i * $i <= $n && $flg; ++$i) {\r\n if (0 == $n % $i) {\r\n $tmp = $i;\r\n $n \/= $i;\r\n $sm += $n;\r\n $flg = false;\r\n }\r\n }\r\n if ($flg) {\r\n ++$sm;\r\n break;\r\n }\r\n}\r\necho $sm.PHP_EOL;","testcases":"[{'input': ['10\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['36\\r\\n'], 'output': ['67\\r\\n']}, {'input': ['32\\r\\n'], 'output': ['63\\r\\n']}, {'input': ['46\\r\\n'], 'output': ['70\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['31\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['36\\r\\n']}, {'input': ['37\\r\\n'], 'output': ['38\\r\\n']}, {'input': ['42\\r\\n'], 'output': ['71\\r\\n']}, {'input': ['50\\r\\n'], 'output': ['81\\r\\n']}, {'input': ['48\\r\\n'], 'output': ['94\\r\\n']}, {'input': ['33\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['49\\r\\n'], 'output': ['57\\r\\n']}, {'input': ['34\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['35\\r\\n'], 'output': ['43\\r\\n']}, {'input': ['37\\r\\n'], 'output': ['38\\r\\n']}, {'input': ['39\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['42\\r\\n'], 'output': ['71\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['6\\r\\n']}]","id":487} {"difficulty":1300,"lang":"PHP","lang_cluster":"PHP","src_uid":"181_B","execute_outcome":"RUNTIME_ERROR","source_code":"","description":"You are given n points on a plane. All points are different.Find the number of different groups of three points (A,B,C) such that point B is the middle of segment AC. The groups of three points are considered unordered, that is, if point B is the middle of segment AC, then groups (A,B,C) and (C,B,A) are considered the same.","input_specification":"The first line contains a single integer n (3\u2264n\u22643000) \u2014 the number of points. \nNext n lines contain the points. The i-th line contains coordinates of the i-th point: two space-separated integers xi,yi (-1000\u2264xi,yi\u22641000).\nIt is guaranteed that all given points are different.\n","output_specification":"Print the single number \u2014 the answer to the problem. \n","notes":null,"sample_inputs":["3\n1 1\n2 2\n3 3\n","3\n0 0\n-1 0\n0 1\n"],"sample_outputs":["1\n","0\n"],"human_solution":"in();\n\t\n\t$sum = 0;\n\t\n\t$points = array();\n\t$costs = array();\n\t$c = array_fill(0, 5, 0);\n\t\n\tfor ($i = 0; $i < $N; $i++) $points[] = (int)$Input->in();\n\n\tfor ($i = 0; $i < 5; $i++) $costs[] = (int)$Input->in();\n\t\n\tfor ($i = 0; $i < $N; $i++)\n\t{\n\t\t$sum += $points[$i];\n\t\t\n\t\t$pos = 1;\n\t\t\n\t\twhile ($sum >= $costs[0])\n\t\t{\n\t\t\tif ($costs[$pos] > $sum)\n\t\t\t{\n\t\t\t\t$c[$pos - 1]++;\n\t\t\t\t$sum -= $costs[$pos - 1];\n\t\t\t\t$pos = 0;\n\t\t\t\t\n\t\t\t} else if ($costs[$pos] <= $sum && $pos === 4)\n\t\t\t{\n\t\t\t\t$c[$pos]++;\n\t\t\t\t$sum -= $costs[$pos];\n\t\t\t\t$pos = 0;\n\t\t\t}\n\t\t\t\n\t\t\t$pos++;\n\t\t}\n\t}\n\t\n\tprint(implode(\" \", $c).PHP_EOL);\n\tprint($sum);\n}\n\nclass Input{\n\tprivate $handle = \"\";\n\tprivate $values = array();\n\tprivate $index = 0;\n\n\tpublic function __construct($localfile){\n\n\t\tif (is_file($localfile)) {\n\t\t\t\n\t\t\t$this->handle = fopen($localfile, \"r\");\n\t\t\t$contents = stream_get_contents($this->handle);\n\t\t\n\t\t} else {\n\t\t\n\t\t\t$contents = stream_get_contents(STDIN);\n\t\t\n\t\t}\n\t\t\n\t\t$no_newlines = str_replace(array(\"\\r\\n\", \"\\r\", \"\\n\"), \" \", $contents);\n\t\t$this->values = explode(\" \", $no_newlines);\n\t}\n\t\n\tpublic function in(){\n\t\n\t\treturn $this->values[$this->index++];\n\t\n\t}\n\t\n\tpublic function close(){\n\t\t\n\t\tif (is_file($localfile) && feof($this->handle)) fclose($this->handle);\n\t\t\n\t}\n}\n\n?>","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"],"human_solution":"= 0; $y--)\n {\n $f = $d \/ $c[$y];\n if($f >= 1)\n {\n $e[$y] += floor($f);\n $d -= floor($f) * $c[$y];\n }\n }\n}\nprint implode(\" \", $e) . \"\\n\";\nprint $d;\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":489} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","execute_outcome":"WRONG_ANSWER","source_code":" $b)\n {\n $c[$x] = $b;\n }\n }\n }\n sort($c);\n $d = array_unique($c);\n $e++;\n if((count($d) == 1) && ($f != 1))\n {\n break;\n }\n elseif((count($d) != 1) && ($f != 1))\n {\n $e = $y;\n }\n if(($f == 1) && ($c[0] == $b))\n {\n break;\n }\n elseif(($f == 1) && ($c[0] != $b))\n {\n $e = $y;\n }\n}\nif(($b == 1) || ((count($g) == 1) && ($c[0] == $b)))\n{\n print \"0\";\n}\nelse\n{\n print $e;\n}\n?>","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"],"human_solution":" $b)\n {\n $c[$x] = $b;\n }\n }\n }\n sort($c);\n $d = array_unique($c);\n $e++;\n if((count($d) == 1) && ($f != 1))\n {\n break;\n }\n elseif((count($d) != 1) && ($f != 1))\n {\n $e = $y;\n }\n if(($f == 1) && ($c[0] == $b))\n {\n break;\n }\n elseif(($f == 1) && ($c[0] != $b))\n {\n $e = $y;\n }\n}\nif(($b == 1) || ((count($g) == 1) && ($h[0] == $b)))\n{\n print \"0\";\n}\nelse\n{\n print $e;\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":490} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"RUNTIME_ERROR","source_code":"= 0; $i--) {\n \tif($stat == 0 && $S[$i] == 'L') {\n \t\t$S[$i] = 'L';\n \t\t$stat = 1;\n \t}\n \telseif($stat == 1 && $S[$i] == '.') {\n \t\t$S[$i] = 'L';\n \t}\n \telseif($stat == 1) \n \t\t$stat = 0;\n \telseif($stat == 0 && $S[$i] == '.')\n \t\t$ans++;\n }\n \/\/echo \"{$S}\";\/\/}\n echo \"{$ans}\\n\";\n?>","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"],"human_solution":"= 0; $x--)\n{\n if($c[$x] == \"L\")\n {\n $g = $a - $x - 1;\n $f = 1;\n break;\n }\n elseif($c[$x] == \"R\")\n {\n $f = 2;\n break;\n }\n}\n$h = 0;\n$i = 0;\n$j = array();\nfor($x = 0; $x < $a; $x++)\n{\n if($c[$x] == \"L\")\n {\n $h = 1;\n $i = $x;\n }\n if(($c[$x] == \"R\") && ($h == 1))\n {\n array_push($j, $x - $i - 1);\n $h = 0;\n }\n}\n$k = 0;\n$l = 0;\n$m = 0;\nfor($x = 0; $x < $a; $x++)\n{\n if($c[$x] == \"R\")\n {\n $k = 1;\n $l = $x;\n }\n if(($c[$x] == \"L\") && ($k == 1))\n {\n $n = $x - $l - 1;\n $o = $n % 2;\n if($o != 0)\n {\n $m++;\n }\n $k = 0;\n }\n}\n$p = array_unique($c);\nif((count($p) == 1) && ($p[0] == \".\"))\n{\n print $a;\n}\nelse\n{\n print $e + $g + array_sum($j) + $m;\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":491} {"difficulty":1500,"lang":"PHP","lang_cluster":"PHP","src_uid":"5e055bad1da5bdc84599d6f2f89fbd12","execute_outcome":"RUNTIME_ERROR","source_code":"= $half){\n\t\t\tprint 0;\n\t\t\tdie();\n\t\t}\n\t\t$res = min($res,$half - $uv);\n\t}\n\t\n\tforeach($kd as $value){\n\t\t$value = intval($value);\n\t\t$uv = 0; $ud = 0;\n\t\tif (array_key_exists($value, $up)) $uv = intval($up[$value]);\n\t\tif (array_key_exists($value, $down)) $ud = intval($down[$value]);\n\t\t$total = $uv + $ud;\n\t\n\t\tif (intval($total) < $half) continue;\n\t\tif ($uv >= $half){\n\t\t\tprint 0;\n\t\t\tdie();\n\t\t}\n\t\t$res = min($res,$half - $uv);\n\t}\n\t\n\tif ($res == (1<<30)) print -1; else\tprint $res;\n?>","description":"The Little Elephant loves to play with color cards.He has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. The Little Elephant thinks that a set of cards on the table is funny if at least half of the cards have the same color (for each card the color of the upper side is considered).Help the Little Elephant to find the minimum number of moves needed to make the set of n cards funny.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of the cards. The following n lines contain the description of all cards, one card per line. The cards are described by a pair of positive integers not exceeding 109 \u2014 colors of both sides. The first number in a line is the color of the front of the card, the second one \u2014 of the back. The color of the front of the card may coincide with the color of the back of the card. The numbers in the lines are separated by single spaces.","output_specification":"On a single line print a single integer \u2014 the sought minimum number of moves. If it is impossible to make the set funny, print -1.","notes":"NoteIn the first sample there initially are three cards lying with colors 4, 4, 7. Since two of the three cards are of the same color 4, you do not need to change anything, so the answer is 0.In the second sample, you can turn the first and the fourth cards. After that three of the five cards will be of color 7.","sample_inputs":["3\n4 7\n4 7\n7 4","5\n4 7\n7 4\n2 11\n9 7\n1 1"],"sample_outputs":["0","2"],"human_solution":"","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":492} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"65fea461d3caa5a932d1e2c13e99a59e","execute_outcome":"RUNTIME_ERROR","source_code":"init();\n }\n \/\/ init params\n private function init()\n {\n fscanf(STDIN, \"%d %d\", $this->count, $this->volume);\n $this->poured = explode (\" \", trim(fgets(STDIN)));\n\n }\n\n public function execute()\n {\n $maxVolume = $this->volume + array_sum($this->poured);\n $dose = $maxVolume\/$this->count;\n if ($dose*$this->count == $maxVolume){\n $res = array();\n $all = 0;\n\n foreach($this->poured as $v){\n $res[] = number_format(($dose - $v), 6, '.', '');\n $all += abs($dose-$v);\n }\n $this->result = ($this->volume - $all) ? -1 : implode(\"\\n\", $res);\n\n } else {\n $this->result = -1;\n }\n return $this->result;\n }\n\n}\n\n$test = new Companions();\necho $test->execute();\n\n?>","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"],"human_solution":"","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":493} {"difficulty":800,"lang":"PHP","lang_cluster":"PHP","src_uid":"69850c2af99d60711bcff5870575e15e","execute_outcome":"RUNTIME_ERROR","source_code":"","description":"The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i\u2009+\u20091. Reaching a certain rank i having not reached all the previous i\u2009-\u20091 ranks is impossible.Vasya has just reached a new rank of a, but he dreams of holding the rank of b. Find for how many more years Vasya should serve in the army until he can finally realize his dream.","input_specification":"The first input line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100). The second line contains n\u2009-\u20091 integers di (1\u2009\u2264\u2009di\u2009\u2264\u2009100). The third input line contains two integers a and b (1\u2009\u2264\u2009a\u2009<\u2009b\u2009\u2264\u2009n). The numbers on the lines are space-separated.","output_specification":"Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.","notes":null,"sample_inputs":["3\n5 6\n1 2","3\n5 6\n1 3"],"sample_outputs":["5","11"],"human_solution":"","testcases":"[{'input': '3\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '3\\r\\n5 6\\r\\n1 3\\r\\n', 'output': ['11\\r\\n']}, {'input': '2\\r\\n55\\r\\n1 2\\r\\n', 'output': ['55\\r\\n']}, {'input': '3\\r\\n85 78\\r\\n1 3\\r\\n', 'output': ['163\\r\\n']}, {'input': '4\\r\\n63 4 49\\r\\n2 3\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n93 83 42 56\\r\\n2 5\\r\\n', 'output': ['181\\r\\n']}, {'input': '6\\r\\n22 9 87 89 57\\r\\n1 6\\r\\n', 'output': ['264\\r\\n']}, {'input': '7\\r\\n52 36 31 23 74 78\\r\\n2 7\\r\\n', 'output': ['242\\r\\n']}, {'input': '8\\r\\n82 14 24 5 91 49 94\\r\\n3 8\\r\\n', 'output': ['263\\r\\n']}, {'input': '9\\r\\n12 40 69 39 59 21 59 5\\r\\n4 6\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n95 81 32 59 71 30 50 61 100\\r\\n1 6\\r\\n', 'output': ['338\\r\\n']}, {'input': '15\\r\\n89 55 94 4 15 69 19 60 91 77 3 94 91 62\\r\\n3 14\\r\\n', 'output': ['617\\r\\n']}, {'input': '20\\r\\n91 1 41 51 95 67 92 35 23 70 44 91 57 50 21 8 9 71 40\\r\\n8 17\\r\\n', 'output': ['399\\r\\n']}, {'input': '25\\r\\n70 95 21 84 97 39 12 98 53 24 78 29 84 65 70 22 100 17 69 27 62 48 35 80\\r\\n8 23\\r\\n', 'output': ['846\\r\\n']}, {'input': '30\\r\\n35 69 50 44 19 56 86 56 98 24 21 2 61 24 85 30 2 22 57 35 59 84 12 77 92 53 50 92 9\\r\\n1 16\\r\\n', 'output': ['730\\r\\n']}, {'input': '35\\r\\n2 34 47 15 27 61 6 88 67 20 53 65 29 68 77 5 78 86 44 98 32 81 91 79 54 84 95 23 65 97 22 33 42 87\\r\\n8 35\\r\\n', 'output': ['1663\\r\\n']}, {'input': '40\\r\\n32 88 59 36 95 45 28 78 73 30 97 13 13 47 48 100 43 21 22 45 88 25 15 13 63 25 72 92 29 5 25 11 50 5 54 51 48 84 23\\r\\n7 26\\r\\n', 'output': ['862\\r\\n']}, {'input': '45\\r\\n83 74 73 95 10 31 100 26 29 15 80 100 22 70 31 88 9 56 19 70 2 62 48 30 27 47 52 50 94 44 21 94 23 85 15 3 95 72 43 62 94 89 68 88\\r\\n17 40\\r\\n', 'output': ['1061\\r\\n']}, {'input': '50\\r\\n28 8 16 29 19 82 70 51 96 84 74 72 17 69 12 21 37 21 39 3 18 66 19 49 86 96 94 93 2 90 96 84 59 88 58 15 61 33 55 22 35 54 51 29 64 68 29 38 40\\r\\n23 28\\r\\n', 'output': ['344\\r\\n']}, {'input': '60\\r\\n24 28 25 21 43 71 64 73 71 90 51 83 69 43 75 43 78 72 56 61 99 7 23 86 9 16 16 94 23 74 18 56 20 72 13 31 75 34 35 86 61 49 4 72 84 7 65 70 66 52 21 38 6 43 69 40 73 46 5\\r\\n28 60\\r\\n', 'output': ['1502\\r\\n']}, {'input': '70\\r\\n69 95 34 14 67 61 6 95 94 44 28 94 73 66 39 13 19 71 73 71 28 48 26 22 32 88 38 95 43 59 88 77 80 55 17 95 40 83 67 1 38 95 58 63 56 98 49 2 41 4 73 8 78 41 64 71 60 71 41 61 67 4 4 19 97 14 39 20 27\\r\\n9 41\\r\\n', 'output': ['1767\\r\\n']}, {'input': '80\\r\\n65 15 43 6 43 98 100 16 69 98 4 54 25 40 2 35 12 23 38 29 10 89 30 6 4 8 7 96 64 43 11 49 89 38 20 59 54 85 46 16 16 89 60 54 28 37 32 34 67 9 78 30 50 87 58 53 99 48 77 3 5 6 19 99 16 20 31 10 80 76 82 56 56 83 72 81 84 60 28\\r\\n18 24\\r\\n', 'output': ['219\\r\\n']}, {'input': '90\\r\\n61 35 100 99 67 87 42 90 44 4 81 65 29 63 66 56 53 22 55 87 39 30 34 42 27 80 29 97 85 28 81 22 50 22 24 75 67 86 78 79 94 35 13 97 48 76 68 66 94 13 82 1 22 85 5 36 86 73 65 97 43 56 35 26 87 25 74 47 81 67 73 75 99 75 53 38 70 21 66 78 38 17 57 40 93 57 68 55 1\\r\\n12 44\\r\\n', 'output': ['1713\\r\\n']}, {'input': '95\\r\\n37 74 53 96 65 84 65 72 95 45 6 77 91 35 58 50 51 51 97 30 51 20 79 81 92 10 89 34 40 76 71 54 26 34 73 72 72 28 53 19 95 64 97 10 44 15 12 38 5 63 96 95 86 8 36 96 45 53 81 5 18 18 47 97 65 9 33 53 41 86 37 53 5 40 15 76 83 45 33 18 26 5 19 90 46 40 100 42 10 90 13 81 40 53\\r\\n6 15\\r\\n', 'output': ['570\\r\\n']}, {'input': '96\\r\\n51 32 95 75 23 54 70 89 67 3 1 51 4 100 97 30 9 35 56 38 54 77 56 98 43 17 60 43 72 46 87 61 100 65 81 22 74 38 16 96 5 10 54 22 23 22 10 91 9 54 49 82 29 73 33 98 75 8 4 26 24 90 71 42 90 24 94 74 94 10 41 98 56 63 18 43 56 21 26 64 74 33 22 38 67 66 38 60 64 76 53 10 4 65 76\\r\\n21 26\\r\\n', 'output': ['328\\r\\n']}, {'input': '97\\r\\n18 90 84 7 33 24 75 55 86 10 96 72 16 64 37 9 19 71 62 97 5 34 85 15 46 72 82 51 52 16 55 68 27 97 42 72 76 97 32 73 14 56 11 86 2 81 59 95 60 93 1 22 71 37 77 100 6 16 78 47 78 62 94 86 16 91 56 46 47 35 93 44 7 86 70 10 29 45 67 62 71 61 74 39 36 92 24 26 65 14 93 92 15 28 79 59\\r\\n6 68\\r\\n', 'output': ['3385\\r\\n']}, {'input': '98\\r\\n32 47 26 86 43 42 79 72 6 68 40 46 29 80 24 89 29 7 21 56 8 92 13 33 50 79 5 7 84 85 24 23 1 80 51 21 26 55 96 51 24 2 68 98 81 88 57 100 64 84 54 10 14 2 74 1 89 71 1 20 84 85 17 31 42 58 69 67 48 60 97 90 58 10 21 29 2 21 60 61 68 89 77 39 57 18 61 44 67 100 33 74 27 40 83 29 6\\r\\n8 77\\r\\n', 'output': ['3319\\r\\n']}, {'input': '99\\r\\n46 5 16 66 53 12 84 89 26 27 35 68 41 44 63 17 88 43 80 15 59 1 42 50 53 34 75 16 16 55 92 30 28 11 12 71 27 65 11 28 86 47 24 10 60 47 7 53 16 75 6 49 56 66 70 3 20 78 75 41 38 57 89 23 16 74 30 39 1 32 49 84 9 33 25 95 75 45 54 59 17 17 29 40 79 96 47 11 69 86 73 56 91 4 87 47 31 24\\r\\n23 36\\r\\n', 'output': ['514\\r\\n']}, {'input': '100\\r\\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 27 85 85 63\\r\\n43 92\\r\\n', 'output': ['2599\\r\\n']}, {'input': '51\\r\\n85 38 22 38 42 36 55 24 36 80 49 15 66 91 88 61 46 82 1 61 89 92 6 56 28 8 46 80 56 90 91 38 38 17 69 64 57 68 13 44 45 38 8 72 61 39 87 2 73 88\\r\\n15 27\\r\\n', 'output': ['618\\r\\n']}, {'input': '2\\r\\n3\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n6 8 22 22\\r\\n2 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '6\\r\\n3 12 27 28 28\\r\\n3 4\\r\\n', 'output': ['27\\r\\n']}, {'input': '9\\r\\n1 2 2 2 2 3 3 5\\r\\n3 7\\r\\n', 'output': ['9\\r\\n']}, {'input': '10\\r\\n1 1 1 1 1 1 1 1 1\\r\\n6 8\\r\\n', 'output': ['2\\r\\n']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3\\r\\n5 17\\r\\n', 'output': ['23\\r\\n']}, {'input': '25\\r\\n1 1 1 4 5 6 8 11 11 11 11 12 13 14 14 14 15 16 16 17 17 17 19 19\\r\\n4 8\\r\\n', 'output': ['23\\r\\n']}, {'input': '35\\r\\n1 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\\r\\n30 31\\r\\n', 'output': ['2\\r\\n']}, {'input': '45\\r\\n1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 9 9 10 10 10\\r\\n42 45\\r\\n', 'output': ['30\\r\\n']}, {'input': '50\\r\\n1 8 8 13 14 15 15 16 19 21 22 24 26 31 32 37 45 47 47 47 50 50 51 54 55 56 58 61 61 61 63 63 64 66 66 67 67 70 71 80 83 84 85 92 92 94 95 95 100\\r\\n4 17\\r\\n', 'output': ['285\\r\\n']}, {'input': '60\\r\\n1 2 4 4 4 6 6 8 9 10 10 13 14 18 20 20 21 22 23 23 26 29 30 32 33 34 35 38 40 42 44 44 46 48 52 54 56 56 60 60 66 67 68 68 69 73 73 74 80 80 81 81 82 84 86 86 87 89 89\\r\\n56 58\\r\\n', 'output': ['173\\r\\n']}, {'input': '70\\r\\n1 2 3 3 4 5 5 7 7 7 8 8 8 8 9 9 10 12 12 12 12 13 16 16 16 16 16 16 17 17 18 18 20 20 21 23 24 25 25 26 29 29 29 29 31 32 32 34 35 36 36 37 37 38 39 39 40 40 40 40 41 41 42 43 44 44 44 45 45\\r\\n62 65\\r\\n', 'output': ['126\\r\\n']}, {'input': '80\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12\\r\\n17 65\\r\\n', 'output': ['326\\r\\n']}, {'input': '90\\r\\n1 1 3 5 8 9 10 11 11 11 11 12 13 14 15 15 15 16 16 19 19 20 22 23 24 25 25 28 29 29 30 31 33 34 35 37 37 38 41 43 43 44 45 47 51 54 55 56 58 58 59 59 60 62 66 67 67 67 68 68 69 70 71 72 73 73 76 77 77 78 78 78 79 79 79 82 83 84 85 85 87 87 89 93 93 93 95 99 99\\r\\n28 48\\r\\n', 'output': ['784\\r\\n']}, {'input': '95\\r\\n2 2 3 3 4 6 6 7 7 7 9 10 12 12 12 12 13 14 15 16 17 18 20 20 20 20 21 21 21 21 22 22 22 22 22 23 23 23 25 26 26 27 27 27 28 29 29 30 30 31 32 33 34 36 37 37 38 39 39 39 42 43 43 43 45 47 48 50 50 51 52 53 54 54 54 55 55 55 58 59 60 61 61 61 61 62 62 63 64 65 66 67 67 67\\r\\n64 93\\r\\n', 'output': ['1636\\r\\n']}, {'input': '96\\r\\n1 1 2 3 3 5 8 9 9 10 10 10 11 11 11 11 11 12 13 13 13 14 15 15 16 16 17 17 17 17 18 18 20 20 20 21 21 21 23 24 24 25 25 26 27 27 27 27 29 29 29 30 30 30 32 32 32 32 32 32 33 33 34 34 34 35 35 35 36 36 37 37 37 38 39 40 41 41 41 41 42 42 43 43 45 45 45 46 46 47 47 49 50 52 52\\r\\n76 96\\r\\n', 'output': ['898\\r\\n']}, {'input': '98\\r\\n2 3 4 4 5 7 8 10 10 10 11 11 12 12 12 12 13 14 15 15 16 16 18 19 19 20 21 21 21 21 22 23 24 25 26 26 27 27 27 27 29 29 30 30 31 31 37 40 40 40 41 41 41 42 43 44 44 44 46 46 47 49 49 50 50 50 51 53 55 55 56 56 56 56 56 57 57 58 59 60 60 60 62 62 63 64 64 64 65 66 66 67 68 70 70 71 71\\r\\n8 90\\r\\n', 'output': ['3016\\r\\n']}, {'input': '99\\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\\r\\n66 95\\r\\n', 'output': ['29\\r\\n']}, {'input': '100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 16 16 16 17 17\\r\\n39 52\\r\\n', 'output': ['82\\r\\n']}, {'input': '51\\r\\n5 7 9 16 19 25 26 29 29 30 31 32 32 41 43 44 47 49 50 50 51 52 54 55 56 63 64 66 67 70 74 74 77 78 79 80 80 85 86 87 89 89 90 92 93 94 94 95 95 97\\r\\n3 44\\r\\n', 'output': ['2268\\r\\n']}]","id":494} {"difficulty":1300,"lang":"PHP","lang_cluster":"PHP","src_uid":"6cfd3b0a403212ec68bac1667bce9ef1","execute_outcome":"WRONG_ANSWER","source_code":"","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"],"human_solution":"","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":495} {"difficulty":1000,"lang":"PHP","lang_cluster":"PHP","src_uid":"6e0dafeaf85e92f959c388c72e158f68","execute_outcome":"WRONG_ANSWER","source_code":" $e) print $e.($d % $a['2'] == 0 && $d != $b ? \"\\n\":' ');\n","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"],"human_solution":" $a * $b) {\n\techo -1;\n} else {\n\t$odd = 1;\n\t$even = 2;\n\tfor ($r = 0; $r < $a; $r++) {\n\t\tfor ($c = 0; $c < $b; $c++) {\n\t\t\tif (($r + $c) % 2 == 1 && $even <= $n) {\n\t\t\t\techo $even . ' ';\n\t\t\t\t$even += 2;\n\t\t\t} elseif (($r + $c) % 2 == 0 && $odd <= $n) {\n\t\t\t\techo $odd . ' ';\n\t\t\t\t$odd += 2;\n\t\t\t} else {\n\t\t\t\techo \"0 \";\n\t\t\t}\n\t\t}\n\t\techo \"\\n\";\n\t}\n}\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":496} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","execute_outcome":"WRONG_ANSWER","source_code":"","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"],"human_solution":"","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":497} {"difficulty":800,"lang":"PHP","lang_cluster":"PHP","src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","execute_outcome":"RUNTIME_ERROR","source_code":"1)\n printf(\" \");\n printf(\"%d\",$who);\n go(($who+$num+1)%(int)$n,$num+1, $n);\n}\n$file=fopen(\"input.txt\",\"r\");\n$n=fgets($file);\ngo(2,1,$n);\nprintf(\"\\n\");\n?>","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"],"human_solution":"","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":498} {"difficulty":1300,"lang":"PHP","lang_cluster":"PHP","src_uid":"88d56c1e3a7ffa94354ce0c70d8e958f","execute_outcome":"WRONG_ANSWER","source_code":" '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### \/IO ######\n\nfunction diffCnt($baseTime, $time) {\n\t$return = 0;\n\tfor ($i = 0; $i < 5; $i++) {\n\t\tif ($baseTime[$i] != $time[$i]) {\n\t\t\t$return++;\n\t\t}\n\t}\n\treturn $return;\n}\n\nfunction getAnswer($is_test = false, $f = false) {\n\t$stream = STDIN;\n\tif ($is_test)\n\t\t$stream = $f;\n\t\/* begin body *\/\n\t$format = readNum($stream);\n\t$baseTime = readString($stream);\n\t$answer = array(\n\t\t'res' => '',\n\t\t'diff' => 55,\n\t);\n\t$minHour = 0;\n\t$maxHour = 23;\n\tif ($format == 12) {\n\t\t$minHour = 1;\n\t\t$maxHour = 12;\n\t}\n\tfor ($hour = $minHour; $hour < $maxHour; $hour++) {\n\t\tfor ($minute = 0; $minute < 60; $minute++) {\n\t\t\t$checkHour = $hour;\n\t\t\twhile (strlen($checkHour) < 2)\n\t\t\t\t$checkHour = '0' . $checkHour;\n\t\t\t$checkMinute = $minute;\n\t\t\twhile (strlen($checkMinute) < 2)\n\t\t\t\t$checkMinute = '0' . $checkMinute;\n\t\t\t$checkTime = \"{$checkHour}:{$checkMinute}\";\n\t\t\t$diff = diffCnt($baseTime, $checkTime);\n\t\t\tif ($diff < $answer['diff']) {\n\t\t\t\t$answer['diff'] = $diff;\n\t\t\t\t$answer['res'] = $checkTime;\n\t\t\t}\n\t\t}\n\t}\n\techo $answer['res'];\n\t\/* \/ end body *\/\n}\n\nif (empty($is_test))\n\tgetAnswer();","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"],"human_solution":" 12)\n {\n if($b[1] == 0)\n {\n $b[0] = 1;\n }\n else\n {\n $b[0] = 0;\n }\n }\n if($c > 59)\n {\n $c[0] = 0;\n }\n print $b . \":\" . $c;\n}\nelseif($a == 24)\n{\n if($b > 23)\n {\n $b[0] = 0;\n }\n if($c > 59)\n {\n $c[0] = 0;\n }\n print $b . \":\" . $c;\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":499} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"94a38067fc8dd8619fa6e5873ca60220","execute_outcome":"RUNTIME_ERROR","source_code":"0){\n echo ($rkey+1).' '.($i+1).' '.($k+1);\n exit;\n }\n }\n}\necho -1;\n\n?>","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"],"human_solution":"\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":500} {"difficulty":1400,"lang":"PHP","lang_cluster":"PHP","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"RUNTIME_ERROR","source_code":"","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"","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":501} {"difficulty":1100,"lang":"PHP","lang_cluster":"PHP","src_uid":"b1ef19d7027dc82d76859d64a6f43439","execute_outcome":"WRONG_ANSWER","source_code":"","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"],"human_solution":"","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":502} {"difficulty":1000,"lang":"PHP","lang_cluster":"PHP","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"RUNTIME_ERROR","source_code":" strlen($l))\n{\n echo \"impossible\";\n exit;\n}\n\n$cc = array();\nforeach(str_split($l) as $c) {\n if (!isset($cc[$c]))\n $cc[$c] = true;\n}\n\necho ($r - sizeof($cc));","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"],"human_solution":"= $b)\n {\n print \"0\";\n }\n else\n {\n print $b - count($c);\n }\n}\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":503} {"difficulty":1000,"lang":"PHP","lang_cluster":"PHP","src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","execute_outcome":"RUNTIME_ERROR","source_code":"h = $h;\n\/\/ $this->len = 2 * ($a + $b);\n\/\/ }\n\/\/\n\/\/}\n\/\/\n\/\/class Page {\n\/\/\n\/\/ public $a, $b, $p;\n\/\/\n\/\/ public function __construct($a, $b, $p) {\n\/\/ $this->a = $a;\n\/\/ $this->b = $b;\n\/\/ $this->p = $p;\n\/\/ }\n\/\/\n\/\/}\n\/\/\n\/\/function getPrice($room, $page) {\n\/\/ $piece = (int)($page -> a \/ $room->h);\n\/\/ if($piece<=0)\n\/\/ return 99999999;\n\/\/ $wide = $piece * $page -> b;\n\/\/\n\/\/ $yu_len = $room->len % $wide;\n\/\/ $rolls = (int)($room->len \/ $wide) + ($yu_len != 0 ? 1 : 0);\n\/\/ return $rolls * $page->p;\n\/\/}\n\/\/\n\/\/$room = array();\n\/\/$page = array();\n$fr = fopen(\"php:\/\/stdin\", \"r\");\n$n = (int) fgets($fr);\n$arr = fgets($fr);\nfclose($fr);\n$arr = explode(' ', $arr);\n$ary = array();\n\nforeach ($arr as $value) {\n $value=(int)$value;\n $ary[$value2] = 1;\n}\n$cnt = 0;\nfor ($i = 1; $i <= $n; ++$i) {\n if ($ary[$i] == NULL){\n\/\/ echo \"haha\";\n $cnt++;\n }\n}\necho $cnt;\n\n\/\/\n\/\/for ($i = 0; $i < $rooms; ++$i) {\n\/\/ fscanf(STDIN, \"%d%d%d\", $a, $b, $h);\n\/\/ array_push($room, new Room($a, $b, $h));\n\/\/}\n\/\/\n\/\/fscanf(STDIN, \"%d\", $pages);\n\/\/for ($i = 0; $i < $pages; ++$i) {\n\/\/ fscanf(STDIN, \"%d%d%d\", $a, $b, $p);\n\/\/ array_push($page, new Page($a, $b, $p));\n\/\/}\n\/\/\n\/\/$sum=0;\n\/\/\n\/\/foreach ($room as $rm) {\n\/\/ $min=99999999;\n\/\/ foreach ($page as $pg) {\n\/\/ $price=getPrice($rm, $pg);\n\/\/ if($price<$min)\n\/\/ $min=$price;\n\/\/ }\n\/\/ $sum+=$min;\n\/\/}\n\/\/echo $sum;\n\/\/\n\/\/usort($a, 'cmp');\n\/\/$b = Array();\n\/\/foreach ($a as $ai) {\n\/\/ $l = 0;\n\/\/ $r = count($b);\n\/\/ while ($l < $r) {\n\/\/ $m = ($l + $r) \/ 2;\n\/\/ if ($ai->h > $b[$m]->h) {\n\/\/ $l = $m + 1;\n\/\/ } else {\n\/\/ $r = $m;\n\/\/ }\n\/\/ }\n\/\/ $ai->p = ($r == 0 ? NULL : $b[$r - 1]);\n\/\/ $b[$r] = $ai;\n\/\/}\n\/\/\n\/\/echo count($b) . \"\\n\";\n\/\/if (count($b) > 0) {\n\/\/ $c = Array();\n\/\/ for ($p = array_pop($b); $p != NULL; $p = $p->p) {\n\/\/ array_unshift($c, $p->i);\n\/\/ }\n\/\/ print implode($c, ' ') . \"\\n\";\n\/\/}","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"],"human_solution":"","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":504} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"c31fed523230af1f904218b2fe0d663d","execute_outcome":"RUNTIME_ERROR","source_code":" 2)\n {\n $j = 2;\n }\n array_push($k, $j);\n }\n}\n$l = array_sum($k);\nprint $l + 2;\n?>","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"],"human_solution":" 2)\n {\n $j = 2;\n }\n array_push($k, $j);\n }\n}\n$l = array_sum($k);\nprint $l + 2;\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":505} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"WRONG_ANSWER","source_code":" '',\n\t\t\"\\n\" => '',\n\t);\n\treturn strtr(fgets($f), $r);\n}\n\nfunction readNumString($f) {\n\treturn trim(fgets($f));\n}\n\nfunction stringToArray($str) {\n\treturn str_split($str);\n}\n\nfunction readNum($f, $is_int = false) {\n\t$v = readNumString($f);\n\treturn $is_int ? intval($v) : floatval($v);\n}\n\nfunction readStringExplode($f, $delimiter = ' ') {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = 'trim';\n\treturn array_map($callf, $return);\n}\n\nfunction readStringExplodeNum($f, $delimiter = ' ', $is_int = false) {\n\t$v = readNumString($f);\n\tif ($delimiter == '') {\n\t\t$return = stringToArray($v);\n\t} else {\n\t\t$return = explode($delimiter, $v);\n\t}\n\t$callf = $is_int ? 'intval' : 'floatval';\n\treturn array_map($callf, $return);\n}\n\n###### \/IO ######\n\nfunction getAnswer($is_test = false, $f = false) {\n\tif ($is_test === false) {\n\t\t$f = STDIN;\n\t}\n\t\/* begin body *\/\n\t$path = readString($f);\n\t$t1 = readString($f);\n\t$t2 = readString($f);\n\n\t$isForward = false;\n\t$i1 = strpos($path, $t1);\n\tif ($i1 !== false && strpos($path, $t2, $i1 + 1) !== false) {\n\t\t$isForward = true;\n\t}\n\n\t$isBack = false;\n\t$path = strrev($path);\n\t$i1 = strpos($path, $t1);\n\tif ($i1 !== false && strpos($path, $t2, $i1 + 1) !== false) {\n\t\t$isBack = true;\n\t}\n\n\tif ($isForward && $isBack) {\n\t\techo 'both';\n\t} elseif ($isForward) {\n\t\techo 'forward';\n\t} elseif ($isBack) {\n\t\techo 'backward';\n\t} else {\n\t\techo 'fantasy';\n\t}\n\t\/* \/ end body *\/\n}\n\nif (empty($is_test))\n\tgetAnswer();","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"],"human_solution":"","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":506} {"difficulty":1200,"lang":"PHP","lang_cluster":"PHP","src_uid":"f8315dc903b0542c453cab4577bcb20d","execute_outcome":"WRONG_ANSWER","source_code":" $v) {\n\t\tif(!isset($a[$v[0]])) $a[$v[0]] = 0;\n\t\tif(!isset($a[$v[1]])) $a[$v[1]] = 0;\n\t\t$a[$v[0]]++;\n\t\t$a[$v[1]]++;\n\t}\n\tforeach($a AS $k => $v) {\n\t\tif ($v >= 2) continue;\n\t\t$bad = true;\n\t\t$ban[] = $k;\n\t\tunset($a[$k]);\n\t}\n\tif (!$bad) break;\n\tforeach($links AS $k => $v) {\n\t\tif(!isset($a[$v[0]])) unset($links[$k]);\n\t\tif(!isset($a[$v[1]])) unset($links[$k]);\n\t}\n}\nif ($m == $n) {\n\techo(count($ban));\n} else {\n\techo($n - count($ban));\n}\n?>","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"],"human_solution":" $v) {\n if(count($v) === 1) {\n $excl[$k] = reset($v);\n }\n }\n if(count($excl) > 0) {\n foreach($excl as $k => $v) {\n if(isset($link[$v])) {\n sort($link[$v]);\n for($i=0;$iabs($arr[$i]-$arr[($i+1)%$n])) {\n $res = array($i,($i+1)%$n);\n $min = abs($arr[$i]-$arr[($i+1)%$n]);\n }\necho $res[0]+1,' ',$res[1]+1;\n?>","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"],"human_solution":"abs($arr[$i]-$arr[($i+1)%$n])) {\n $res = array($i,($i+1)%$n);\n $min = abs($arr[$i]-$arr[($i+1)%$n]);\n }\necho $res[0]+1,' ',$res[1]+1;\n?>","testcases":"[{'input': '5\\r\\n10 12 13 15 10\\r\\n', 'output': ['5 1\\r\\n']}, {'input': '4\\r\\n10 20 30 40\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '6\\r\\n744 359 230 586 944 442\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '5\\r\\n826 747 849 687 437\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n999 999 993 969 999\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '5\\r\\n4 24 6 1 15\\r\\n', 'output': ['3 4\\r\\n']}, {'input': '2\\r\\n511 32\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '3\\r\\n907 452 355\\r\\n', 'output': ['2 3\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['4 1\\r\\n']}, {'input': '10\\r\\n684 698 429 694 956 812 594 170 937 764\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '20\\r\\n646 840 437 946 640 564 936 917 487 752 844 734 468 969 674 646 728 642 514 695\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '30\\r\\n996 999 998 984 989 1000 996 993 1000 983 992 999 999 1000 979 992 987 1000 996 1000 1000 989 981 996 995 999 999 989 999 1000\\r\\n', 'output': ['12 13\\r\\n']}, {'input': '50\\r\\n93 27 28 4 5 78 59 24 19 134 31 128 118 36 90 32 32 1 44 32 33 13 31 10 12 25 38 50 25 12 4 22 28 53 48 83 4 25 57 31 71 24 8 7 28 86 23 80 101 58\\r\\n', 'output': ['16 17\\r\\n']}, {'input': '88\\r\\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 999 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 998 1000 1000 998 1000 999 1000 1000 1000 1000\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '99\\r\\n4 4 21 6 5 3 13 2 6 1 3 4 1 3 1 9 11 1 6 17 4 5 20 4 1 9 5 11 3 4 14 1 3 3 1 4 3 5 27 1 1 2 10 7 11 4 19 7 11 6 11 13 3 1 10 7 2 1 16 1 9 4 29 13 2 12 14 2 21 1 9 8 26 12 12 5 2 14 7 8 8 8 9 4 12 2 6 6 7 16 8 14 2 10 20 15 3 7 4\\r\\n', 'output': ['1 2\\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': ['86 87\\r\\n']}, {'input': '100\\r\\n31 75 86 68 111 27 22 22 26 30 54 163 107 75 160 122 14 23 17 26 27 20 43 58 59 71 21 148 9 32 43 91 133 286 132 70 90 156 84 14 77 93 23 18 13 72 18 131 33 28 72 175 30 86 249 20 14 208 28 57 63 199 6 10 24 30 62 267 43 479 60 28 138 1 45 3 19 47 7 166 116 117 50 140 28 14 95 85 93 43 61 15 2 70 10 51 7 95 9 25\\r\\n', 'output': ['7 8\\r\\n']}, {'input': '100\\r\\n896 898 967 979 973 709 961 968 806 967 896 967 826 975 936 903 986 856 851 931 852 971 786 837 949 978 686 936 952 909 965 749 908 916 943 973 983 975 939 886 964 928 960 976 907 788 994 773 949 871 947 980 945 985 726 981 887 943 907 990 931 874 840 867 948 951 961 904 888 901 976 967 994 921 828 970 972 722 755 970 860 855 914 869 714 899 969 978 898 862 642 939 904 936 819 934 884 983 955 964\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '100\\r\\n994 927 872 970 815 986 952 996 965 1000 877 986 978 999 950 990 936 997 993 960 921 860 895 869 943 998 983 968 973 953 999 990 995 871 853 979 973 963 953 938 997 989 993 964 960 973 946 975 1000 962 920 746 989 957 904 965 920 979 966 961 1000 993 975 952 846 971 991 979 985 969 984 973 956 1000 952 778 983 974 956 927 995 997 980 997 1000 970 960 970 988 983 947 904 935 972 1000 863 992 996 932 967\\r\\n', 'output': ['81 82\\r\\n']}, {'input': '100\\r\\n48 108 63 21 27 8 49 21 75 8 24 42 149 18 8 28 21 18 25 35 59 70 59 33 40 1 67 34 120 82 4 115 72 87 3 15 15 63 37 12 40 27 83 14 38 20 14 58 93 10 31 3 39 6 197 77 54 16 31 146 9 49 14 8 77 82 5 11 80 116 8 61 50 24 7 103 29 11 3 3 1 12 46 24 21 131 39 29 36 2 107 40 16 99 31 41 29 48 17 17\\r\\n', 'output': ['36 37\\r\\n']}]","id":508} {"difficulty":1700,"lang":"PHP","lang_cluster":"PHP","src_uid":"156_A","execute_outcome":"RUNTIME_ERROR","source_code":"","description":"Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has six substrings: \"a\", \"b\", \"a\", \"ab\", \"ba\", \"aba\".Dr. Moriarty plans to take string s and cut out some substring from it, let's call it t. Then he needs to change the substring t zero or more times. As a result, he should obtain a fixed string u (which is the string that should be sent to Sherlock Holmes). One change is defined as making one of the following actions: Insert one letter to any end of the string. Delete one letter from any end of the string. Change one letter into any other one. Moriarty is very smart and after he chooses some substring t, he always makes the minimal number of changes to obtain u. Help Moriarty choose the best substring t from all substrings of the string s. The substring t should minimize the number of changes Moriarty should make to obtain the string u from it.","input_specification":"The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.\n","output_specification":"Print the only integer \u2014 the minimum number of changes that Dr. Moriarty has to make with the string that you choose.\n","notes":"In the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.\nIn the second sample you should take a substring consisting of characters from second to fourth (\"bca\") or from fifth to sixth (\"bc\"). Then you will only have to make one change: to change or to add the last character.\nIn the third sample the initial string s doesn't contain any character that the message should contain, so, whatever string you choose, you will have to make at least 7 changes to obtain the required message.\n","sample_inputs":["aaaaa\naaa\n","abcabc\nbcd\n","abcdef\nklmnopq\n"],"sample_outputs":["0\n","1\n","7\n"],"human_solution":"= count($b))\r\n{\r\n $c = array_fill(0, count($b), \".\");\r\n $a = array_merge($c, $a, $c);\r\n $d = 0;\r\n for($x = 0; $x < count($a) + 1 - count($b); $x++)\r\n {\r\n $e = array_slice($a, $x, count($b));\r\n $f = count(array_intersect_assoc($b, $e));\r\n $d = max($d, $f);\r\n }\r\n print count($b) - $d;\r\n}\r\nelse\r\n{\r\n $c = array_fill(0, count($a), \".\");\r\n $b = array_merge($c, $b, $c);\r\n $d = 0;\r\n for($x = 0; $x < count($b) + 1 - count($a); $x++)\r\n {\r\n $e = array_slice($b, $x, count($a));\r\n $f = count(array_intersect_assoc($a, $e));\r\n $d = max($d, $f);\r\n }\r\n print $b2 - $d;\r\n}\r\n?>","testcases":"[{'input': ['aaaaa\\r\\naaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abcabc\\r\\nbcd\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['abcdef\\r\\nklmnopq\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaabbbaaa\\r\\naba\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['a\\r\\na\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['z\\r\\nz\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['a\\r\\nz\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['d\\r\\nt\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['o\\r\\nu\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['a\\r\\nm\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['t\\r\\nv\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['n\\r\\ng\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['c\\r\\nh\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['r\\r\\ni\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['h\\r\\nb\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['r\\r\\na\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['c\\r\\np\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['wbdbzf\\r\\nfpvlerhsuf\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['zafsqbsu\\r\\nhl\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['juhlp\\r\\nycqugugk\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['ladfasxt\\r\\ncpvtd\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['ally\\r\\ncjidwuj\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['rgug\\r\\npgqwslo\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['wmjwu\\r\\nrfew\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['cpnwcdqff\\r\\nq\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['dkwh\\r\\nm\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['zfinrlju\\r\\nwiiegborjl\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['swconajiqpgziitbpwjsfcalqvmwbfed\\r\\nridfnsyumichlhpnurrnwkyjcdzchznpmno\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['vfjofvgkdwgqdlomtmcvedtmimdnxavhfirienxfdflldkbwjsynablhdvgaipvcghgaxipotwmmlzxekipgbvpfivlgzfwqz\\r\\njkdfjnessjfgcqpnxgtqdxtqimolbdlnipkoqht\\r\\n'], 'output': ['34\\r\\n']}, {'input': ['dtvxepnxfkzcaoh\\r\\nkpdzbtwjitzlyzvsbwcsrfglaycrhzwsdtidrelndsq\\r\\n'], 'output': ['41\\r\\n']}, {'input': ['sweaucynwsnduofyaqunoxttbipgrbfpssplfp\\r\\nuifmuxmczznobefdsyoclwzekewxmcwfqryuevnxxlgxsuhoytkaddorbdaygo\\r\\n'], 'output': ['57\\r\\n']}, {'input': ['eohztfsxoyhirnzxgwaevfqstinlxeiyywmpmlbedkjihaxfdtsocof\\r\\nbloqrjbidxiqozvwregxxgmxuqcvhwzhytfckbafd\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['ybshzefoxkqdigcjafs\\r\\nnffvaxdmditsolfxbyquira\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['ytfqnuhqzbjjheejjbzcaorilcyvuxvviaiba\\r\\nxnhgkdfceialuujgcxmrhjbzvibcoknofafmdjnhij\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['ibdjtvgaveujdyidqldrxgwhsammmfpgxwljkptmeyejdvudhctmqjazalyzmzfgebetyqncu\\r\\nercdngwctdarcennbuqhsjlwfwrcqjbcjxqftycoulrhrimwhznogjmrrqdygtmllottpjgmkndraearezvxxmdhcuokhyngu\\r\\n'], 'output': ['90\\r\\n']}, {'input': ['bwhvaanyxupicwobeevcwewhcriwowfovnylalpuhxzqxtzyjrzlxcmejujvliomdfedgtaioauwrcluhfxtzu\\r\\nplinvtsvytepojsecnjisxlmqkfhgknitvuw\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['sjxykdmrzpescabubcjflhnpckgytklc\\r\\nsxirpuqnmjqhlnvdeyvxvzzcygkpsujyifzgzmtvxsimddjahiephqlgfzngrzjtcrgrimewsxipczsgu\\r\\n'], 'output': ['76\\r\\n']}, {'input': ['ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\\r\\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqrugajjjzibgzhxphcvtncjzecbtupwkehcrgsgfgkvwwnifglyamjkzfvabybsstwrwugnmiwflhemgnfbrtskzfxcepqhtelgiowzeuujpkuzsfsipcvtfoeshawvryaubilcbwukdhlwamsqenzvr\\r\\n'], 'output': ['287\\r\\n']}, {'input': ['abcd\\r\\ndabc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['medxx\\r\\nahmed\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['ab\\r\\ndab\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['nasldkfnsb\\r\\nyyyynasld\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['abcde\\r\\ncabc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['a\\r\\nzzzzzzzzzza\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['abcde\\r\\nabde\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['bac\\r\\ntbdca\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['abcdef\\r\\nxyzabc\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['abcdef\\r\\nbctsf\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['xxxabaxxx\\r\\nxxxaaxxx\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['bcd\\r\\nabc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['d\\r\\nabcdef\\r\\n'], 'output': ['5\\r\\n']}]","id":509} {"difficulty":1700,"lang":"PHP","lang_cluster":"PHP","src_uid":"183_B","execute_outcome":"WRONG_ANSWER","source_code":"","description":"After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.Now it's time to show the journal to his strict parents. Polycarp knows that recently at the Parent Meeting the parents were told that he received a Safety Studies marks and b PE marks (a+b=n). Now Polycarp wants to write a subject's name in front of each mark so that: there are exactly a Safety Studies marks, there are exactly b PE marks, the total average score in both subjects is maximum. An average subject grade is the sum of all marks in it, divided by the number of them. Of course, the division is performed in real numbers without rounding up or down. Polycarp aims to maximize the x1+x2, where x1 is the average score in the first subject (Safety Studies), and x2 is the average score in the second one (Physical Education).","input_specification":"The first line contains an integer n (2\u2264n\u226410^5), n is the number of marks in Polycarp's Journal. The second line contains two positive integers a,b (1\u2264a,b\u2264n-1,a+b=n). The third line contains a sequence of integers t1,t2,...,tn (1\u2264ti\u22645), they are Polycarp's marks.\n","output_specification":"Print the sequence of integers f1,f2,...,fn, where fi (1\u2264fi\u22642) is the number of a subject to which the i-th mark should be attributed. If there are several possible solutions, then print such that the sequence f1,f2,...,fn is the smallest lexicographically.\nThe sequence p1,p2,...,pn is lexicographically less than q1,q2,...,qn if there exists such j (1\u2264j\u2264n) that pi=qi for all 1\u2264i 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\r\n for($x = 0; $x < $b; $x++)\r\n {\r\n $f[$e[$x]]++;\r\n }\r\n $g = array_fill(0, $a, 2);\r\n for($x = 0; $x < $a; $x++)\r\n {\r\n if($f[$d[$x]] > 0)\r\n {\r\n $g[$x] = 1;\r\n $f[$d[$x]]--;\r\n }\r\n }\r\n print implode(\" \", $g);\r\n}\r\nelseif($b == $c)\r\n{\r\n $f = array_fill(0, $a, 2);\r\n $g = $a \/ 2;\r\n for($x = 0; $x < $g; $x++)\r\n {\r\n $f[$x] = 1;\r\n }\r\n print implode(\" \", $f);\r\n}\r\nelseif($b > $c)\r\n{\r\n $f = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\r\n for($x = 0; $x < $c; $x++)\r\n {\r\n $f[$e[$x]]++;\r\n }\r\n $g = array_fill(0, $a, 1);\r\n for($x = $a - 1; $x >= 0; $x--)\r\n {\r\n if($f[$d[$x]] > 0)\r\n {\r\n $g[$x] = 2;\r\n $f[$d[$x]]--;\r\n }\r\n }\r\n print implode(\" \", $g);\r\n}\r\n?>","testcases":"[{'input': ['5\\r\\n3 2\\r\\n4 4 5 4 4\\r\\n'], 'output': ['1 1 2 1 2 ']}, {'input': ['4\\r\\n2 2\\r\\n3 5 4 5\\r\\n'], 'output': ['1 1 2 2 ']}, {'input': ['6\\r\\n1 5\\r\\n4 4 4 5 4 4\\r\\n'], 'output': ['2 2 2 1 2 2 ']}, {'input': ['4\\r\\n2 2\\r\\n2 1 3 3\\r\\n'], 'output': ['1 1 2 2 ']}, {'input': ['9\\r\\n3 6\\r\\n4 5 4 1 2 2 2 4 5\\r\\n'], 'output': ['1 1 2 2 2 2 2 2 1 ']}, {'input': ['2\\r\\n1 1\\r\\n4 4\\r\\n'], 'output': ['1 2 ']}, {'input': ['2\\r\\n1 1\\r\\n5 1\\r\\n'], 'output': ['1 2 ']}, {'input': ['3\\r\\n2 1\\r\\n1 2 2\\r\\n'], 'output': ['1 1 2 ']}, {'input': ['3\\r\\n1 2\\r\\n1 2 2\\r\\n'], 'output': ['2 1 2 ']}, {'input': ['3\\r\\n1 2\\r\\n1 2 3\\r\\n'], 'output': ['2 2 1 ']}, {'input': ['3\\r\\n2 1\\r\\n5 5 5\\r\\n'], 'output': ['1 1 2 ']}, {'input': ['4\\r\\n2 2\\r\\n1 2 2 3\\r\\n'], 'output': ['1 1 2 2 ']}, {'input': ['4\\r\\n1 3\\r\\n2 1 2 2\\r\\n'], 'output': ['1 2 2 2 ']}, {'input': ['4\\r\\n3 1\\r\\n2 1 2 2\\r\\n'], 'output': ['1 1 1 2 ']}, {'input': ['4\\r\\n3 1\\r\\n2 1 3 3\\r\\n'], 'output': ['1 1 1 2 ']}, {'input': ['4\\r\\n1 3\\r\\n2 3 3 3\\r\\n'], 'output': ['2 1 2 2 ']}, {'input': ['5\\r\\n1 4\\r\\n1 1 3 3 2\\r\\n'], 'output': ['2 2 1 2 2 ']}, {'input': ['5\\r\\n2 3\\r\\n4 3 3 3 3\\r\\n'], 'output': ['1 1 2 2 2 ']}, {'input': ['5\\r\\n3 2\\r\\n2 5 2 2 2\\r\\n'], 'output': ['1 2 1 1 2 ']}, {'input': ['5\\r\\n4 1\\r\\n4 4 1 4 4\\r\\n'], 'output': ['1 1 1 1 2 ']}, {'input': ['6\\r\\n1 5\\r\\n4 4 5 4 4 1\\r\\n'], 'output': ['2 2 1 2 2 2 ']}, {'input': ['6\\r\\n2 4\\r\\n4 4 4 4 4 4\\r\\n'], 'output': ['1 1 2 2 2 2 ']}, {'input': ['6\\r\\n3 3\\r\\n1 4 3 4 4 3\\r\\n'], 'output': ['1 1 1 2 2 2 ']}, {'input': ['6\\r\\n4 2\\r\\n5 2 3 2 3 5\\r\\n'], 'output': ['2 1 1 1 1 2 ']}, {'input': ['6\\r\\n5 1\\r\\n2 1 2 5 4 5\\r\\n'], 'output': ['1 1 1 1 1 2 ']}, {'input': ['9\\r\\n1 8\\r\\n1 2 1 5 1 5 5 1 1\\r\\n'], 'output': ['2 2 2 1 2 2 2 2 2 ']}, {'input': ['9\\r\\n2 7\\r\\n4 2 4 4 2 5 1 2 5\\r\\n'], 'output': ['2 2 2 2 2 1 2 2 1 ']}, {'input': ['9\\r\\n4 5\\r\\n3 3 3 5 3 1 4 5 1\\r\\n'], 'output': ['1 2 2 1 2 2 1 1 2 ']}, {'input': ['9\\r\\n5 4\\r\\n2 2 2 1 2 1 1 1 1\\r\\n'], 'output': ['2 2 2 1 2 1 1 1 1 ']}, {'input': ['13\\r\\n7 6\\r\\n2 3 2 2 3 4 3 2 2 3 2 3 5\\r\\n'], 'output': ['1 1 1 1 2 2 2 1 1 2 1 2 2 ']}, {'input': ['100\\r\\n45 55\\r\\n3 5 3 4 1 1 1 1 5 2 1 3 1 5 3 5 1 1 3 1 1 3 5 5 1 1 1 5 5 1 3 1 1 1 3 3 1 1 1 4 3 1 5 1 3 1 4 5 4 3 3 1 1 5 5 1 3 5 1 1 5 1 1 3 5 5 1 1 3 3 4 1 1 4 5 3 1 3 1 5 1 5 4 5 1 1 1 1 4 5 4 5 3 1 1 5 1 5 1 4\\r\\n'], 'output': ['1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 2 2 2 2 1 2 2 1 1 2 2 2 2 1 2 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 2 1 2 1 ']}, {'input': ['2\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['1 2 ']}, {'input': ['3\\r\\n1 2\\r\\n1 1 1\\r\\n'], 'output': ['1 2 2 ']}]","id":511} {"difficulty":1700,"lang":"PHP","lang_cluster":"PHP","src_uid":"867facaa8bcdfcb53ec3647387f7d23f","execute_outcome":"RUNTIME_ERROR","source_code":" $c)\n{\n for($x = 0; $x < $c; $x++)\n {\n $f[$e[$x]] = 1;\n }\n for($x = $c; $x < $b + $c; $x++)\n {\n $f[$e[$x]] = 2;\n }\n ksort($f);\n print implode(\" \", $f);\n}\n?>","description":"After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.Now it's time to show the journal to his strict parents. Polycarp knows that recently at the Parent Meeting the parents were told that he received a Safety Studies marks and b PE marks (a\u2009+\u2009b\u2009=\u2009n). Now Polycarp wants to write a subject's name in front of each mark so that: there are exactly a Safety Studies marks, there are exactly b PE marks, the total average score in both subjects is maximum. An average subject grade is the sum of all marks in it, divided by the number of them. Of course, the division is performed in real numbers without rounding up or down. Polycarp aims to maximize the x1\u2009+\u2009x2, where x1 is the average score in the first subject (Safety Studies), and x2 is the average score in the second one (Physical Education).","input_specification":"The first line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105), n is the number of marks in Polycarp's Journal. The second line contains two positive integers a,\u2009b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n\u2009-\u20091,\u2009a\u2009+\u2009b\u2009=\u2009n). The third line contains a sequence of integers t1,\u2009t2,\u2009...,\u2009tn (1\u2009\u2264\u2009ti\u2009\u2264\u20095), they are Polycarp's marks.","output_specification":"Print the sequence of integers f1,\u2009f2,\u2009...,\u2009fn, where fi (1\u2009\u2264\u2009fi\u2009\u2264\u20092) is the number of a subject to which the i-th mark should be attributed. If there are several possible solutions, then print such that the sequence f1,\u2009f2,\u2009...,\u2009fn is the smallest lexicographically. The sequence p1,\u2009p2,\u2009...,\u2009pn is lexicographically less than q1,\u2009q2,\u2009...,\u2009qn if there exists such j (1\u2009\u2264\u2009j\u2009\u2264\u2009n) that pi\u2009=\u2009qi for all 1\u2009\u2264\u2009i\u2009<\u2009j, \u0430nd pj\u2009<\u2009qj.","notes":"NoteIn the first sample the average score in the first subject is equal to 4, and in the second one \u2014 to 4.5. The total average score is 8.5.","sample_inputs":["5\n3 2\n4 4 5 4 4","4\n2 2\n3 5 4 5","6\n1 5\n4 4 4 5 4 4"],"sample_outputs":["1 1 2 1 2","1 1 2 2","2 2 2 1 2 2"],"human_solution":" 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\n for($x = 0; $x < $b; $x++)\n {\n $f[$e[$x]]++;\n }\n $g = array_fill(0, $a, 2);\n for($x = 0; $x < $a; $x++)\n {\n if($f[$d[$x]] > 0)\n {\n $g[$x] = 1;\n $f[$d[$x]]--;\n }\n }\n print implode(\" \", $g);\n}\nelseif($b == $c)\n{\n $f = array_fill(0, $a, 2);\n $g = $a \/ 2;\n for($x = 0; $x < $g; $x++)\n {\n $f[$x] = 1;\n }\n print implode(\" \", $f);\n}\nelseif($b > $c)\n{\n $f = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0);\n for($x = 0; $x < $c; $x++)\n {\n $f[$e[$x]]++;\n }\n $g = array_fill(0, $a, 1);\n for($x = $a - 1; $x >= 0; $x--)\n {\n if($f[$d[$x]] > 0)\n {\n $g[$x] = 2;\n $f[$d[$x]]--;\n }\n }\n print implode(\" \", $g);\n}\n?>","testcases":"[{'input': '5\\r\\n3 2\\r\\n4 4 5 4 4\\r\\n', 'output': ['1 1 2 1 2 ']}, {'input': '4\\r\\n2 2\\r\\n3 5 4 5\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '6\\r\\n1 5\\r\\n4 4 4 5 4 4\\r\\n', 'output': ['2 2 2 1 2 2 ']}, {'input': '4\\r\\n2 2\\r\\n2 1 3 3\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '9\\r\\n3 6\\r\\n4 5 4 1 2 2 2 4 5\\r\\n', 'output': ['1 1 2 2 2 2 2 2 1 ']}, {'input': '2\\r\\n1 1\\r\\n4 4\\r\\n', 'output': ['1 2 ']}, {'input': '2\\r\\n1 1\\r\\n5 1\\r\\n', 'output': ['1 2 ']}, {'input': '3\\r\\n2 1\\r\\n1 2 2\\r\\n', 'output': ['1 1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 2 2\\r\\n', 'output': ['2 1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 2 3\\r\\n', 'output': ['2 2 1 ']}, {'input': '3\\r\\n2 1\\r\\n5 5 5\\r\\n', 'output': ['1 1 2 ']}, {'input': '4\\r\\n2 2\\r\\n1 2 2 3\\r\\n', 'output': ['1 1 2 2 ']}, {'input': '4\\r\\n1 3\\r\\n2 1 2 2\\r\\n', 'output': ['1 2 2 2 ']}, {'input': '4\\r\\n3 1\\r\\n2 1 2 2\\r\\n', 'output': ['1 1 1 2 ']}, {'input': '4\\r\\n3 1\\r\\n2 1 3 3\\r\\n', 'output': ['1 1 1 2 ']}, {'input': '4\\r\\n1 3\\r\\n2 3 3 3\\r\\n', 'output': ['2 1 2 2 ']}, {'input': '5\\r\\n1 4\\r\\n1 1 3 3 2\\r\\n', 'output': ['2 2 1 2 2 ']}, {'input': '5\\r\\n2 3\\r\\n4 3 3 3 3\\r\\n', 'output': ['1 1 2 2 2 ']}, {'input': '5\\r\\n3 2\\r\\n2 5 2 2 2\\r\\n', 'output': ['1 2 1 1 2 ']}, {'input': '5\\r\\n4 1\\r\\n4 4 1 4 4\\r\\n', 'output': ['1 1 1 1 2 ']}, {'input': '6\\r\\n1 5\\r\\n4 4 5 4 4 1\\r\\n', 'output': ['2 2 1 2 2 2 ']}, {'input': '6\\r\\n2 4\\r\\n4 4 4 4 4 4\\r\\n', 'output': ['1 1 2 2 2 2 ']}, {'input': '6\\r\\n3 3\\r\\n1 4 3 4 4 3\\r\\n', 'output': ['1 1 1 2 2 2 ']}, {'input': '6\\r\\n4 2\\r\\n5 2 3 2 3 5\\r\\n', 'output': ['2 1 1 1 1 2 ']}, {'input': '6\\r\\n5 1\\r\\n2 1 2 5 4 5\\r\\n', 'output': ['1 1 1 1 1 2 ']}, {'input': '9\\r\\n1 8\\r\\n1 2 1 5 1 5 5 1 1\\r\\n', 'output': ['2 2 2 1 2 2 2 2 2 ']}, {'input': '9\\r\\n2 7\\r\\n4 2 4 4 2 5 1 2 5\\r\\n', 'output': ['2 2 2 2 2 1 2 2 1 ']}, {'input': '9\\r\\n4 5\\r\\n3 3 3 5 3 1 4 5 1\\r\\n', 'output': ['1 2 2 1 2 2 1 1 2 ']}, {'input': '9\\r\\n5 4\\r\\n2 2 2 1 2 1 1 1 1\\r\\n', 'output': ['2 2 2 1 2 1 1 1 1 ']}, {'input': '13\\r\\n7 6\\r\\n2 3 2 2 3 4 3 2 2 3 2 3 5\\r\\n', 'output': ['1 1 1 1 2 2 2 1 1 2 1 2 2 ']}, {'input': '100\\r\\n45 55\\r\\n3 5 3 4 1 1 1 1 5 2 1 3 1 5 3 5 1 1 3 1 1 3 5 5 1 1 1 5 5 1 3 1 1 1 3 3 1 1 1 4 3 1 5 1 3 1 4 5 4 3 3 1 1 5 5 1 3 5 1 1 5 1 1 3 5 5 1 1 3 3 4 1 1 4 5 3 1 3 1 5 1 5 4 5 1 1 1 1 4 5 4 5 3 1 1 5 1 5 1 4\\r\\n', 'output': ['1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 2 2 2 1 1 2 1 2 1 2 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 2 2 2 2 1 2 2 1 1 2 2 2 2 1 2 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 2 1 2 1 ']}, {'input': '2\\r\\n1 1\\r\\n1 2\\r\\n', 'output': ['1 2 ']}, {'input': '3\\r\\n1 2\\r\\n1 1 1\\r\\n', 'output': ['1 2 2 ']}]","id":512} {"difficulty":1600,"lang":"PHP","lang_cluster":"PHP","src_uid":"a17bac596b1f060209534cbffdf0f40e","execute_outcome":"RUNTIME_ERROR","source_code":" $value) {\n\/\/ echo $value . \"\\n\";\n\/\/}\n\/\/var_dump($str);\n?>\n","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"],"human_solution":"= 0; $y--)\n {\n switch($e[$y])\n {\n case \"a\": $g--;\n break;\n case \"e\": $g--;\n break;\n case \"i\": $g--;\n break;\n case \"o\": $g--;\n break;\n case \"u\": $g--;\n break;\n }\n if($g == 0)\n {\n $j = substr($e, $y);\n $h[$i] = $j;\n $i++;\n $d++;\n break;\n }\n }\n }\n}\nif($l == 1)\n{\n print \"NO\";\n}\nelse\n{\n $m = array_unique($c);\n sort($m);\n if(count($m) > 2)\n {\n print \"NO\";\n }\n elseif(count($m) == 1)\n {\n print $m[0];\n }\n elseif(count($m) == 2)\n {\n if($m[0] == \"aaaa\")\n {\n print $m[1];\n }\n else\n {\n print \"NO\";\n }\n }\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":513} {"difficulty":1600,"lang":"PHP","lang_cluster":"PHP","src_uid":"a6cba17c5ddb93f6741e00280fb6c54c","execute_outcome":"WRONG_ANSWER","source_code":"","description":"There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet \u2014 the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations: alloc n \u2014 to allocate n bytes of the memory and return the allocated block's identifier x; erase x \u2014 to erase the block with the identifier x; defragment \u2014 to defragment the free memory, bringing all the blocks as close to the beginning of the memory as possible and preserving their respective order; The memory model in this case is very simple. It is a sequence of m bytes, numbered for convenience from the first to the m-th.The first operation alloc n takes as the only parameter the size of the memory block that is to be allocated. While processing this operation, a free block of n successive bytes is being allocated in the memory. If the amount of such blocks is more than one, the block closest to the beginning of the memory (i.e. to the first byte) is prefered. All these bytes are marked as not free, and the memory manager returns a 32-bit integer numerical token that is the identifier of this block. If it is impossible to allocate a free block of this size, the function returns NULL.The second operation erase x takes as its parameter the identifier of some block. This operation frees the system memory, marking the bytes of this block as free for further use. In the case when this identifier does not point to the previously allocated block, which has not been erased yet, the function returns ILLEGAL_ERASE_ARGUMENT.The last operation defragment does not have any arguments and simply brings the occupied memory sections closer to the beginning of the memory without changing their respective order.In the current implementation you are to use successive integers, starting with 1, as identifiers. Each successful alloc operation procession should return following number. Unsuccessful alloc operations do not affect numeration.You are to write the implementation of the memory manager. You should output the returned value for each alloc command. You should also output ILLEGAL_ERASE_ARGUMENT for all the failed erase commands.","input_specification":"The first line of the input data contains two positive integers t and m (1\u2009\u2264\u2009t\u2009\u2264\u2009100;1\u2009\u2264\u2009m\u2009\u2264\u2009100), where t \u2014 the amount of operations given to the memory manager for processing, and m \u2014 the available memory size in bytes. Then there follow t lines where the operations themselves are given. The first operation is alloc n (1\u2009\u2264\u2009n\u2009\u2264\u2009100), where n is an integer. The second one is erase x, where x is an arbitrary 32-bit integer numerical token. The third operation is defragment. ","output_specification":"Output the sequence of lines. Each line should contain either the result of alloc operation procession , or ILLEGAL_ERASE_ARGUMENT as a result of failed erase operation procession. Output lines should go in the same order in which the operations are processed. Successful procession of alloc operation should return integers, starting with 1, as the identifiers of the allocated blocks.","notes":null,"sample_inputs":["6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6"],"sample_outputs":["1\n2\nNULL\n3"],"human_solution":"","testcases":"[{'input': '6 10\\r\\nalloc 5\\r\\nalloc 3\\r\\nerase 1\\r\\nalloc 6\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\n']}, {'input': '6 1\\r\\ndefragment\\r\\nalloc 10\\r\\nalloc 1\\r\\nerase -1\\r\\nerase 1\\r\\nerase 1\\r\\n', 'output': ['NULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '14 100\\r\\nalloc 99\\r\\nalloc 1\\r\\nalloc 1\\r\\nerase 2\\r\\nalloc 1\\r\\nerase 4\\r\\nerase 1\\r\\nalloc 100\\r\\nalloc 1\\r\\nalloc 99\\r\\ndefragment\\r\\nerase 4\\r\\nalloc 100\\r\\nalloc 99\\r\\n', 'output': ['1\\r\\n2\\r\\nNULL\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n4\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '26 25\\r\\ndefragment\\r\\nerase 1\\r\\nerase -1560200883\\r\\nalloc 44\\r\\ndefragment\\r\\nalloc 75\\r\\nalloc 22\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 57\\r\\nalloc 53\\r\\nerase 4\\r\\nerase -1639632026\\r\\nerase -2121605039\\r\\nerase 3\\r\\nalloc 51\\r\\nalloc 65\\r\\ndefragment\\r\\nerase 2\\r\\nerase 4\\r\\nalloc 52\\r\\nerase 3\\r\\ndefragment\\r\\nerase -1842529282\\r\\nerase 3\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '22 9\\r\\nerase 1\\r\\nalloc 6\\r\\nalloc 65\\r\\nerase 1\\r\\nalloc 87\\r\\nerase -1638927047\\r\\nalloc 5\\r\\nerase 2\\r\\nalloc 70\\r\\ndefragment\\r\\nalloc 20\\r\\nalloc 48\\r\\nerase -69401977\\r\\nalloc 20\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nerase 9\\r\\nerase 7\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 66\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '12 40\\r\\nerase 1\\r\\nalloc 21\\r\\nalloc 5\\r\\nalloc 7\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nalloc 83\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 59\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\n2\\r\\n3\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '38 18\\r\\nalloc 72\\r\\nerase 2\\r\\nalloc 50\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 43\\r\\nalloc 41\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 26\\r\\nalloc 46\\r\\nalloc 16\\r\\nalloc 15\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 95\\r\\nerase 7\\r\\nerase 7\\r\\nerase 5\\r\\nerase 2\\r\\nerase 9\\r\\nerase 7\\r\\nalloc 43\\r\\ndefragment\\r\\nerase 7\\r\\ndefragment\\r\\nalloc 48\\r\\nalloc 77\\r\\nerase 10\\r\\nerase 11\\r\\nalloc 16\\r\\nalloc 84\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 86\\r\\ndefragment\\r\\nerase 13\\r\\n', 'output': ['NULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\n1\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '37 74\\r\\nalloc 11\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 90\\r\\nerase 3\\r\\nerase 2\\r\\nerase 3\\r\\nerase 1\\r\\nerase 1\\r\\nalloc 38\\r\\nalloc 19\\r\\nerase 1\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 93\\r\\nerase 5\\r\\nerase 4\\r\\nalloc 66\\r\\nalloc 71\\r\\nerase 5\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 7\\r\\nalloc 47\\r\\nerase -95616683\\r\\nerase 2\\r\\nalloc 28\\r\\nalloc 32\\r\\nerase 11\\r\\nalloc 50\\r\\ndefragment\\r\\ndefragment\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\n5\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 49\\r\\nerase -751005193\\r\\ndefragment\\r\\nalloc 37\\r\\nalloc 82\\r\\nerase 3\\r\\nerase 1\\r\\nalloc 80\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 74\\r\\nerase 1\\r\\nalloc 91\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 98\\r\\ndefragment\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '42 98\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 5\\r\\nalloc 66\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 53\\r\\ndefragment\\r\\nerase 4\\r\\nerase 2\\r\\nalloc 70\\r\\nerase 3\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\nerase 3\\r\\nerase -1327931832\\r\\nalloc 93\\r\\nalloc 64\\r\\nerase 7\\r\\nerase 6\\r\\nerase 3\\r\\nalloc 61\\r\\nalloc 12\\r\\nalloc 65\\r\\nerase 2\\r\\nalloc 46\\r\\nerase 11\\r\\nerase 9\\r\\nerase 9\\r\\nerase 6\\r\\nalloc 2\\r\\nalloc 78\\r\\ndefragment\\r\\nerase 13\\r\\nerase 6\\r\\nerase 10\\r\\nalloc 53\\r\\nalloc 46\\r\\n', 'output': ['1\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n4\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '19 46\\r\\nalloc 21\\r\\nerase 2\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 40\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 68\\r\\nerase -388966015\\r\\nalloc 85\\r\\nalloc 53\\r\\nerase 4\\r\\ndefragment\\r\\nalloc 49\\r\\nalloc 88\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\n']}, {'input': '44 46\\r\\nalloc 28\\r\\nalloc 36\\r\\ndefragment\\r\\nerase -937404236\\r\\nalloc 71\\r\\ndefragment\\r\\nalloc 81\\r\\nalloc 51\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 48\\r\\nerase 1\\r\\ndefragment\\r\\nalloc 36\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\ndefragment\\r\\ndefragment\\r\\nerase -1173350787\\r\\nalloc 94\\r\\nerase 5\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 98\\r\\nerase 7\\r\\ndefragment\\r\\nerase 5\\r\\nerase 1\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nerase 4\\r\\ndefragment\\r\\nerase 9\\r\\nalloc 8\\r\\ndefragment\\r\\nerase 9\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 70\\r\\nerase 9\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nNULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '26 25\\r\\nalloc 25\\r\\nerase 1\\r\\nalloc 24\\r\\nerase 2\\r\\nalloc 23\\r\\nerase 3\\r\\nalloc 24\\r\\nerase 4\\r\\nalloc 24\\r\\nerase 5\\r\\nalloc 21\\r\\nerase 6\\r\\nalloc 24\\r\\nerase 7\\r\\nalloc 25\\r\\nerase 8\\r\\nalloc 25\\r\\nerase 9\\r\\nalloc 24\\r\\nerase 10\\r\\nalloc 25\\r\\nerase 11\\r\\nalloc 25\\r\\nerase 12\\r\\nalloc 25\\r\\nerase 13\\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\\n']}, {'input': '22 9\\r\\nalloc 9\\r\\nerase 1\\r\\nalloc 9\\r\\nerase 2\\r\\nalloc 9\\r\\nerase 3\\r\\nalloc 9\\r\\nerase 4\\r\\nalloc 9\\r\\nerase 5\\r\\nalloc 9\\r\\nerase 6\\r\\nalloc 9\\r\\nerase 7\\r\\nalloc 9\\r\\nerase 8\\r\\nalloc 9\\r\\nerase 9\\r\\nalloc 9\\r\\nerase 10\\r\\nalloc 9\\r\\nerase 11\\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\\n']}, {'input': '7 6\\r\\nalloc 1\\r\\nalloc 2\\r\\nalloc 3\\r\\nerase 1\\r\\ndefragment\\r\\nerase 3\\r\\nalloc 4\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n']}, {'input': '3 1\\r\\nerase -1\\r\\nerase 0\\r\\nerase -2147483648\\r\\n', 'output': ['ILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '7 100\\r\\nalloc 100\\r\\nerase 2147483647\\r\\nerase 1\\r\\nalloc 50\\r\\nalloc 50\\r\\nerase 3\\r\\nerase -2147483648\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n']}, {'input': '12 10\\r\\nalloc 6\\r\\nalloc 2\\r\\nerase 1\\r\\nalloc 4\\r\\nalloc 2\\r\\nerase 3\\r\\nalloc 2\\r\\nalloc 3\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\nalloc 1\\r\\n', 'output': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\nNULL\\r\\n6\\r\\n7\\r\\n8\\r\\n9\\r\\n']}, {'input': '8 50\\r\\nalloc 51\\r\\ndefragment\\r\\nalloc 100\\r\\ndefragment\\r\\nerase 1\\r\\nalloc 50\\r\\ndefragment\\r\\nalloc 50\\r\\n', 'output': ['NULL\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n1\\r\\nNULL\\r\\n']}, {'input': '10 10\\r\\nalloc 10\\r\\nerase -1\\r\\nerase 1\\r\\nalloc 5\\r\\nerase -1\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\nerase 0\\r\\nalloc 5\\r\\n', 'output': ['1\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n3\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 3\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\nNULL\\r\\n']}, {'input': '16 10\\r\\nalloc 10\\r\\ndefragment\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 10\\r\\nerase 1\\r\\nerase 2\\r\\nalloc 6\\r\\ndefragment\\r\\ndefragment\\r\\nalloc 4\\r\\ndefragment\\r\\ndefragment\\r\\nerase 2\\r\\ndefragment\\r\\nalloc 6\\r\\n', 'output': ['1\\r\\nNULL\\r\\nILLEGAL_ERASE_ARGUMENT\\r\\n2\\r\\n3\\r\\n4\\r\\n']}]","id":514} {"difficulty":1600,"lang":"PHP","lang_cluster":"PHP","src_uid":"b263917e47e1c84340bcb1c77999fd7e","execute_outcome":"WRONG_ANSWER","source_code":" 0) {$c[1] --; $r --; break;}\n if($c[4] > 0) {$c[4] --; $r --; break;}\n if($c[7] > 0) {$c[7] --; $r --; break;}\n break;\n case 2: if($c[2] > 0) {$c[2] --; $r -= 2; break;}\n if($c[5] > 0) {$c[5] --; $r -= 2; break;}\n if($c[8] > 0) {$c[8] --; $r -= 2; break;}\n if($c[1] > 1) {$c[1] -= 2; $r -= 2; break;}\n if($c[1] > 0 && $c[4] > 0) {$c[1] --; $c[4] --; $r -= 2; break;}\n if($c[4] > 1) {$c[4] -= 2; $r -= 2; break;}\n if($c[1] > 0 && $c[7] > 0) {$c[1] --; $c[7] --; $r -= 2; break;}\n if($c[4] > 0 && $c[7] > 0) {$c[4] --; $c[7] --; $r -= 2; break;}\n if($c[7] > 1) {$c[7] -= 2; $r -= 2; break;}\n break;\n}\n$s='';\nif($r != 0) {print '-1'; exit(0);} else\nfor($i=9;$i>=0;$i--) $s .= str_repeat($i,$c[$i]);\n\nif($s[0] == '0') print '0'; else print $s;\n?>","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. ","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.","notes":"NoteIn the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.","sample_inputs":["1\n0","11\n3 4 5 4 5 3 5 3 4 4 0","8\n3 2 5 1 5 2 2 3"],"sample_outputs":["0","5554443330","-1"],"human_solution":" 0) {$c[1] --; $r --; break;}\n if($c[4] > 0) {$c[4] --; $r --; break;}\n if($c[7] > 0) {$c[7] --; $r --; break;}\n if($c[2] > 1) {$c[2] -= 2; $r --; break;}\n if($c[2] > 0 && $c[5] > 0) {$c[2] --; $c[5] --; $r --; break;}\n if($c[5] > 1) {$c[5] -= 2; $r --; break;}\n if($c[2] > 0 && $c[8] > 0) {$c[2] --; $c[8] --; $r --; break;}\n if($c[5] > 0 && $c[8] > 0) {$c[5] --; $c[8] --; $r --; break;}\n if($c[8] > 1) {$c[8] -= 2; $r --; break;}\n break;\n case 2: if($c[2] > 0) {$c[2] --; $r -= 2; break;}\n if($c[5] > 0) {$c[5] --; $r -= 2; break;}\n if($c[8] > 0) {$c[8] --; $r -= 2; break;}\n if($c[1] > 1) {$c[1] -= 2; $r -= 2; break;}\n if($c[1] > 0 && $c[4] > 0) {$c[1] --; $c[4] --; $r -= 2; break;}\n if($c[4] > 1) {$c[4] -= 2; $r -= 2; break;}\n if($c[1] > 0 && $c[7] > 0) {$c[1] --; $c[7] --; $r -= 2; break;}\n if($c[4] > 0 && $c[7] > 0) {$c[4] --; $c[7] --; $r -= 2; break;}\n if($c[7] > 1) {$c[7] -= 2; $r -= 2; break;}\n break;\n}\n$s='';\nif($r != 0) {print '-1'; exit(0);} else\nfor($i=9;$i>=0;$i--) $s .= str_repeat($i,$c[$i]);\n\nif($s[0] == '0') print '0'; else print $s;\n?>","testcases":"[{'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n', 'output': ['5554443330\\r\\n']}, {'input': '8\\r\\n3 2 5 1 5 2 2 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n5 5 4 1 5 5 5 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n', 'output': ['33322222200\\r\\n']}, {'input': '12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n3 6 1 6 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n', 'output': ['999666330\\r\\n']}, {'input': '5\\r\\n9 6 6 6 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 2 2 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n3 3 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '7\\r\\n3 3 2 2 2 2 0\\r\\n', 'output': ['332220\\r\\n']}, {'input': '6\\r\\n0 3 3 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 1 1 1 1\\r\\n', 'output': ['331110\\r\\n']}, {'input': '7\\r\\n0 3 3 4 4 4 4\\r\\n', 'output': ['444330\\r\\n']}, {'input': '7\\r\\n0 3 3 2 2 4 4\\r\\n', 'output': ['4433220\\r\\n']}, {'input': '7\\r\\n4 2 3 3 0 0 0\\r\\n', 'output': ['4332000\\r\\n']}, {'input': '4\\r\\n1 1 0 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n3 0 2 2\\r\\n', 'output': ['30\\r\\n']}, {'input': '8\\r\\n3 3 3 5 5 0 0 0\\r\\n', 'output': ['333000\\r\\n']}, {'input': '8\\r\\n3 3 6 3 0 7 7 9\\r\\n', 'output': ['963330\\r\\n']}, {'input': '9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n9 0\\r\\n', 'output': ['90\\r\\n']}, {'input': '10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n', 'output': ['32222220\\r\\n']}, {'input': '10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n', 'output': ['31111110\\r\\n']}, {'input': '10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n', 'output': ['44444430\\r\\n']}, {'input': '10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 4 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 4 3\\r\\n', 'output': ['30\\r\\n']}, {'input': '3\\r\\n2 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 1 2 3\\r\\n', 'output': ['3210\\r\\n']}, {'input': '4\\r\\n1 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n8 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 8 5 6\\r\\n', 'output': ['600\\r\\n']}, {'input': '4\\r\\n5 8 3 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '4\\r\\n1 4 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 0 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n2 2 0 0 0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n3 2 5 0 0\\r\\n', 'output': ['300\\r\\n']}, {'input': '4\\r\\n5 3 2 0\\r\\n', 'output': ['30\\r\\n']}, {'input': '5\\r\\n0 0 0 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 0 0 0 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n0 3 5 8\\r\\n', 'output': ['30\\r\\n']}]","id":515} {"difficulty":1700,"lang":"PHP","lang_cluster":"PHP","src_uid":"c175d010d75c391d0b25391fecff007c","execute_outcome":"WRONG_ANSWER","source_code":" 1)\n{\n $d[0] = 1;\n}\nelseif($d[1] > 0)\n{\n $d[1] = 0;\n}\nelseif($d[2] > 0)\n{\n $d[2] = 0;\n}\nelseif($d[3] > 0)\n{\n $d[3] = 0;\n}\n$b[0] = implode(\"\", $d);\nfor($x = 0; $x < $a - 1; $x++)\n{\n if($b[$x] == $b[$x + 1])\n {\n continue;\n }\n elseif($b[$x] < $b[$x + 1])\n {\n $g = 0;\n $e = array();\n $f = $b[$x + 1];\n for($y = 1; $y < 10; $y++)\n {\n $f[0] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[1] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[2] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[3] = $y;\n array_push($e, $f);\n }\n sort($e);\n for($y = 0; $y < count($e); $y++)\n {\n if($e[$y] >= $b[$x])\n {\n $b[$x + 1] = $e[$y];\n $g = 1;\n break;\n }\n }\n }\n elseif($b[$x] > $b[$x + 1])\n {\n $h = 0;\n $e = array();\n $f = $b[$x + 1];\n for($y = 1; $y < 10; $y++)\n {\n $f[0] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[1] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[2] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[3] = $y;\n array_push($e, $f);\n }\n rsort($e);\n for($y = 0; $y < count($e); $y++)\n {\n if($b[$x] >= $e[$y])\n {\n $b[$x + 1] = $e[$y];\n $h = 1;\n break;\n }\n }\n }\n}\nif(($b[0] < 1000) || ($b[count($b) - 1] > 2011) || (($g == 0) && ($g == TRUE)) || (($h == 0) && ($h == TRUE)))\n{\n print \"No solution\";\n}\nelse\n{\n for($x = 0; $x < count($b) - 1; $x++)\n {\n print $b[$x] . \"\\n\";\n }\n print $b[$x];\n}\n?>","description":"The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic teacher, lectures in such a boring and monotonous voice, that he has a soporific effect even on the quill. That's why the quill often makes mistakes, especially in dates.So, at the end of the semester Professor Binns decided to collect the students' parchments with notes and check them. Ron Weasley is in a panic: Harry's notes may contain errors, but at least he has some notes, whereas Ron does not have any. Ronald also has been sleeping during the lectures and his quill had been eaten by his rat Scabbers. Hermione Granger refused to give Ron her notes, because, in her opinion, everyone should learn on their own. Therefore, Ron has no choice but to copy Harry's notes.Due to the quill's errors Harry's dates are absolutely confused: the years of goblin rebellions and other important events for the wizarding world do not follow in order, and sometimes even dates from the future occur. Now Ron wants to change some of the digits while he copies the notes so that the dates were in the chronological (i.e. non-decreasing) order and so that the notes did not have any dates strictly later than 2011, or strictly before than 1000. To make the resulting sequence as close as possible to the one dictated by Professor Binns, Ron will change no more than one digit in each date into other digit. Help him do it.","input_specification":"The first input line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000). It represents the number of dates in Harry's notes. Next n lines contain the actual dates y1, y2, ..., yn, each line contains a date. Each date is a four-digit integer (1000\u2009\u2264\u2009yi\u2009\u2264\u20099999).","output_specification":"Print n numbers z1, z2, ..., zn (1000\u2009\u2264\u2009zi\u2009\u2264\u20092011). They are Ron's resulting dates. Print each number on a single line. Numbers zi must form the non-decreasing sequence. Each number zi should differ from the corresponding date yi in no more than one digit. It is not allowed to change the first digit of a number into 0. If there are several possible solutions, print any of them. If there's no solution, print \"No solution\" (without the quotes).","notes":null,"sample_inputs":["3\n1875\n1936\n1721","4\n9999\n2000\n3000\n3011","3\n1999\n5055\n2000"],"sample_outputs":["1835\n1836\n1921","1999\n2000\n2000\n2011","No solution"],"human_solution":" 1)\n{\n $d[0] = 1;\n}\nelseif($d[1] > 0)\n{\n $d[1] = 0;\n}\nelseif($d[2] > 0)\n{\n $d[2] = 0;\n}\nelseif($d[3] > 0)\n{\n $d[3] = 0;\n}\n$b[0] = implode(\"\", $d);\nfor($x = 0; $x < $a - 1; $x++)\n{\n if($b[$x] == $b[$x + 1])\n {\n continue;\n }\n elseif($b[$x] < $b[$x + 1])\n {\n $g = 0;\n $e = array();\n $f = $b[$x + 1];\n for($y = 1; $y < 10; $y++)\n {\n $f[0] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[1] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[2] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[3] = $y;\n array_push($e, $f);\n }\n sort($e);\n for($y = 0; $y < count($e); $y++)\n {\n if($e[$y] >= $b[$x])\n {\n $b[$x + 1] = $e[$y];\n $g = 1;\n break;\n }\n }\n }\n elseif($b[$x] > $b[$x + 1])\n {\n $h = 0;\n $e = array();\n $f = $b[$x + 1];\n for($y = 1; $y < 10; $y++)\n {\n $f[0] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[1] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[2] = $y;\n array_push($e, $f);\n }\n $f = $b[$x + 1];\n for($y = 0; $y < 10; $y++)\n {\n $f[3] = $y;\n array_push($e, $f);\n }\n sort($e);\n for($y = 0; $y < count($e); $y++)\n {\n if($b[$x] <= $e[$y])\n {\n $b[$x + 1] = $e[$y];\n $h = 1;\n break;\n }\n }\n }\n}\nif(($b[0] < 1000) || ($b[count($b) - 1] > 2011) || (($g == 0) && ($g == TRUE)) || (($h == 0) && ($h == TRUE)))\n{\n print \"No solution\";\n}\nelse\n{\n for($x = 0; $x < count($b) - 1; $x++)\n {\n print $b[$x] . \"\\n\";\n }\n print $b[$x];\n}\n?>","testcases":"[{'input': '3\\r\\n1875\\r\\n1936\\r\\n1721\\r\\n', 'output': ['1075\\r\\n1136\\r\\n1221\\r\\n']}, {'input': '4\\r\\n9999\\r\\n2000\\r\\n3000\\r\\n3011\\r\\n', 'output': ['1999\\r\\n2000\\r\\n2000\\r\\n2011\\r\\n']}, {'input': '3\\r\\n1999\\r\\n5055\\r\\n2000\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '2\\r\\n2037\\r\\n2025\\r\\n', 'output': ['1037\\r\\n2005\\r\\n']}, {'input': '1\\r\\n1234\\r\\n', 'output': ['1034\\r\\n']}, {'input': '1\\r\\n9876\\r\\n', 'output': ['1876\\r\\n']}, {'input': '2\\r\\n9988\\r\\n8899\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '3\\r\\n1095\\r\\n1094\\r\\n1095\\r\\n', 'output': ['1005\\r\\n1014\\r\\n1015\\r\\n']}, {'input': '5\\r\\n5555\\r\\n4444\\r\\n3333\\r\\n2222\\r\\n1111\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '3\\r\\n2010\\r\\n2011\\r\\n2012\\r\\n', 'output': ['1010\\r\\n1011\\r\\n1012\\r\\n']}, {'input': '5\\r\\n1901\\r\\n1166\\r\\n1308\\r\\n1037\\r\\n1808\\r\\n', 'output': ['1001\\r\\n1066\\r\\n1108\\r\\n1137\\r\\n1208\\r\\n']}, {'input': '5\\r\\n1612\\r\\n7835\\r\\n8183\\r\\n3368\\r\\n1685\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '10\\r\\n1501\\r\\n1617\\r\\n1368\\r\\n1737\\r\\n1800\\r\\n1272\\r\\n1019\\r\\n1545\\r\\n1035\\r\\n1302\\r\\n', 'output': ['1001\\r\\n1017\\r\\n1068\\r\\n1137\\r\\n1200\\r\\n1202\\r\\n1219\\r\\n1245\\r\\n1335\\r\\n1342\\r\\n']}, {'input': '10\\r\\n7577\\r\\n1411\\r\\n1864\\r\\n1604\\r\\n1589\\r\\n1343\\r\\n6832\\r\\n1648\\r\\n1222\\r\\n1832\\r\\n', 'output': ['1577\\r\\n1611\\r\\n1664\\r\\n1664\\r\\n1689\\r\\n1743\\r\\n1832\\r\\n1848\\r\\n1922\\r\\n1932\\r\\n']}, {'input': '10\\r\\n1110\\r\\n1278\\r\\n1283\\r\\n7758\\r\\n1183\\r\\n1214\\r\\n2970\\r\\n1398\\r\\n7515\\r\\n1005\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '15\\r\\n2003\\r\\n1991\\r\\n1741\\r\\n1348\\r\\n1258\\r\\n1964\\r\\n1411\\r\\n1431\\r\\n1780\\r\\n1701\\r\\n1787\\r\\n1094\\r\\n1108\\r\\n1074\\r\\n1942\\r\\n', 'output': ['1003\\r\\n1091\\r\\n1141\\r\\n1148\\r\\n1158\\r\\n1164\\r\\n1211\\r\\n1231\\r\\n1280\\r\\n1301\\r\\n1387\\r\\n1394\\r\\n1408\\r\\n1474\\r\\n1542\\r\\n']}, {'input': '20\\r\\n1749\\r\\n1792\\r\\n1703\\r\\n1011\\r\\n1289\\r\\n1066\\r\\n1947\\r\\n1354\\r\\n1693\\r\\n1806\\r\\n1645\\r\\n1292\\r\\n1718\\r\\n1981\\r\\n1197\\r\\n1471\\r\\n1603\\r\\n1325\\r\\n1057\\r\\n1552\\r\\n', 'output': ['1049\\r\\n1092\\r\\n1103\\r\\n1111\\r\\n1189\\r\\n1266\\r\\n1347\\r\\n1350\\r\\n1393\\r\\n1406\\r\\n1445\\r\\n1492\\r\\n1518\\r\\n1581\\r\\n1597\\r\\n1671\\r\\n1673\\r\\n1725\\r\\n1757\\r\\n1852\\r\\n']}, {'input': '20\\r\\n1639\\r\\n1437\\r\\n1054\\r\\n1010\\r\\n1872\\r\\n1942\\r\\n1315\\r\\n1437\\r\\n1226\\r\\n1893\\r\\n1712\\r\\n1024\\r\\n1410\\r\\n1691\\r\\n1188\\r\\n1056\\r\\n1642\\r\\n1100\\r\\n1893\\r\\n1192\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '20\\r\\n1025\\r\\n1000\\r\\n1026\\r\\n1085\\r\\n1354\\r\\n1783\\r\\n3490\\r\\n1512\\r\\n1553\\r\\n1682\\r\\n1695\\r\\n1654\\r\\n1679\\r\\n1304\\r\\n1574\\r\\n1814\\r\\n1854\\r\\n1804\\r\\n1928\\r\\n1949\\r\\n', 'output': ['1005\\r\\n1005\\r\\n1006\\r\\n1015\\r\\n1054\\r\\n1083\\r\\n1490\\r\\n1502\\r\\n1503\\r\\n1582\\r\\n1595\\r\\n1604\\r\\n1609\\r\\n1704\\r\\n1774\\r\\n1804\\r\\n1804\\r\\n1804\\r\\n1828\\r\\n1849\\r\\n']}, {'input': '20\\r\\n1011\\r\\n1157\\r\\n2181\\r\\n6218\\r\\n1766\\r\\n8319\\r\\n1364\\r\\n6428\\r\\n1476\\r\\n4417\\r\\n6618\\r\\n1629\\r\\n1747\\r\\n1786\\r\\n1787\\r\\n2830\\r\\n7671\\r\\n1953\\r\\n1275\\r\\n1099\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '50\\r\\n1230\\r\\n6040\\r\\n1035\\r\\n1973\\r\\n9096\\r\\n5133\\r\\n1146\\r\\n1164\\r\\n9195\\r\\n5211\\r\\n6212\\r\\n1313\\r\\n1953\\r\\n1560\\r\\n1382\\r\\n2324\\r\\n1343\\r\\n1481\\r\\n1555\\r\\n1363\\r\\n1487\\r\\n1414\\r\\n1525\\r\\n1564\\r\\n1561\\r\\n9585\\r\\n7590\\r\\n1663\\r\\n5625\\r\\n1630\\r\\n1630\\r\\n3644\\r\\n1164\\r\\n1665\\r\\n7678\\r\\n1282\\r\\n1626\\r\\n1798\\r\\n9755\\r\\n7801\\r\\n8809\\r\\n1762\\r\\n1867\\r\\n1861\\r\\n1826\\r\\n1809\\r\\n8902\\r\\n1033\\r\\n1774\\r\\n9978\\r\\n', 'output': ['1030\\r\\n1040\\r\\n1045\\r\\n1073\\r\\n1096\\r\\n1133\\r\\n1136\\r\\n1144\\r\\n1195\\r\\n1211\\r\\n1212\\r\\n1213\\r\\n1253\\r\\n1260\\r\\n1282\\r\\n1324\\r\\n1333\\r\\n1381\\r\\n1455\\r\\n1463\\r\\n1467\\r\\n1474\\r\\n1505\\r\\n1514\\r\\n1521\\r\\n1585\\r\\n1590\\r\\n1603\\r\\n1625\\r\\n1630\\r\\n1630\\r\\n1644\\r\\n1664\\r\\n1664\\r\\n1678\\r\\n1682\\r\\n1686\\r\\n1698\\r\\n1755\\r\\n1801\\r\\n1809\\r\\n1862\\r\\n1862\\r\\n1862\\r\\n1866\\r\\n1869\\r\\n1902\\r\\n1933\\r\\n1974\\r\\n1978\\r\\n']}, {'input': '10\\r\\n1014\\r\\n1140\\r\\n1692\\r\\n1644\\r\\n3647\\r\\n1716\\r\\n4821\\r\\n9839\\r\\n2882\\r\\n1664\\r\\n', 'output': ['1004\\r\\n1040\\r\\n1092\\r\\n1144\\r\\n1647\\r\\n1706\\r\\n1821\\r\\n1839\\r\\n1882\\r\\n1964\\r\\n']}, {'input': '10\\r\\n1075\\r\\n1133\\r\\n1393\\r\\n1350\\r\\n1369\\r\\n1403\\r\\n2643\\r\\n1653\\r\\n1756\\r\\n7811\\r\\n', 'output': ['1005\\r\\n1033\\r\\n1093\\r\\n1150\\r\\n1169\\r\\n1203\\r\\n1643\\r\\n1643\\r\\n1656\\r\\n1811\\r\\n']}, {'input': '10\\r\\n6025\\r\\n1522\\r\\n1835\\r\\n2142\\r\\n1414\\r\\n9547\\r\\n1456\\r\\n6784\\r\\n4984\\r\\n3992\\r\\n', 'output': ['1025\\r\\n1122\\r\\n1135\\r\\n1142\\r\\n1214\\r\\n1547\\r\\n1556\\r\\n1784\\r\\n1984\\r\\n1992\\r\\n']}, {'input': '10\\r\\n1074\\r\\n1547\\r\\n1554\\r\\n1581\\r\\n1170\\r\\n8683\\r\\n1434\\r\\n4750\\r\\n1866\\r\\n1051\\r\\n', 'output': ['1004\\r\\n1047\\r\\n1054\\r\\n1081\\r\\n1100\\r\\n1683\\r\\n1734\\r\\n1750\\r\\n1766\\r\\n1851\\r\\n']}, {'input': '10\\r\\n2008\\r\\n3007\\r\\n4066\\r\\n1017\\r\\n1920\\r\\n1113\\r\\n1317\\r\\n4746\\r\\n1972\\r\\n1598\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '10\\r\\n1171\\r\\n1275\\r\\n1680\\r\\n7300\\r\\n4742\\r\\n2517\\r\\n7980\\r\\n1852\\r\\n1993\\r\\n5004\\r\\n', 'output': ['No solution\\r\\n']}, {'input': '2\\r\\n1999\\r\\n1000\\r\\n', 'output': ['1099\\r\\n1100\\r\\n']}, {'input': '2\\r\\n2004\\r\\n1000\\r\\n', 'output': ['1004\\r\\n1004\\r\\n']}, {'input': '2\\r\\n2099\\r\\n1000\\r\\n', 'output': ['1099\\r\\n1100\\r\\n']}, {'input': '12\\r\\n1000\\r\\n1002\\r\\n1021\\r\\n1006\\r\\n1001\\r\\n1036\\r\\n1038\\r\\n1039\\r\\n1098\\r\\n1097\\r\\n1029\\r\\n1053\\r\\n', 'output': ['1000\\r\\n1000\\r\\n1001\\r\\n1001\\r\\n1001\\r\\n1006\\r\\n1008\\r\\n1009\\r\\n1018\\r\\n1027\\r\\n1027\\r\\n1033\\r\\n']}, {'input': '2\\r\\n1011\\r\\n1000\\r\\n', 'output': ['1001\\r\\n1001\\r\\n']}, {'input': '3\\r\\n1012\\r\\n1101\\r\\n1000\\r\\n', 'output': ['1002\\r\\n1100\\r\\n1100\\r\\n']}, {'input': '3\\r\\n2000\\r\\n3999\\r\\n6011\\r\\n', 'output': ['1000\\r\\n1999\\r\\n2011\\r\\n']}]","id":516} {"difficulty":1900,"lang":"PHP","lang_cluster":"PHP","src_uid":"cb082cbe9b34a45da851b6764bbc30c3","execute_outcome":"WRONG_ANSWER","source_code":" 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0);\nfor($x = 0; $x < $a; $x++)\n{\n $d[$c[$x]]++;\n}\n$e = array_keys($d);\n$f = 0;\nfor($x = 0; $x < 10; $x++)\n{\n if($d[$e[$x]] >= $b)\n {\n $f = 1;\n break;\n }\n}\nif($f == 1)\n{\n print \"0\\n\";\n print $c;\n}\nelse\n{\n $g = array();\n $h = array();\n for($x = 0; $x < 10; $x++)\n {\n $i = 0;\n $i2 = 0;\n $i += $d[$x];\n $j = 2;\n $k = 1;\n $l = 1;\n $m = array_fill(0, 10, 0);\n while(TRUE)\n {\n $n = $j % 2;\n $j++;\n if($n == 0)\n {\n $o = $x + $k;\n if($o <= 9)\n {\n $i += $d[$o];\n if($i >= $b)\n {\n $p = $i - $b;\n $r = $d[$o] - $p;\n $i -= $d[$o];\n $i += $r;\n $i2 += $r * abs($k);\n $m[$o] = $r;\n break;\n }\n else\n {\n $i2 += $d[$o] * abs($k);\n $m[$o] = $d[$o];\n }\n $k++;\n }\n }\n else\n {\n $o = $x - $l;\n if($o >= 0)\n {\n $i += $d[$o];\n if($i >= $b)\n {\n $p = $i - $b;\n $r = $d[$o] - $p;\n $i -= $d[$o];\n $i += $r;\n $i2 += $r * abs($l);\n $m[$o] = $r;\n break;\n }\n else\n {\n $i2 += $d[$o] * abs($l);\n $m[$o] = $d[$o];\n }\n $l++;\n }\n }\n }\n $g[$x] = $i2;\n $h[$x] = $m;\n }\n $q = min($g);\n $t = array();\n for($x = 0; $x < 10; $x++)\n {\n if($g[$x] == $q)\n {\n $r = $h[$x];\n $s = str_split($c);\n for($y = 0; $y < $a; $y++)\n {\n if(($r[$s[$y]] > 0) && ($s[$y] > $x))\n {\n $r[$s[$y]]--;\n $s[$y] = $x;\n }\n }\n for($y = $a - 1; $y >= 0; $y--)\n {\n if(($r[$s[$y]] > 0) && ($s[$y] < $x))\n {\n $r[$s[$y]]--;\n $s[$y] = $x;\n }\n }\n $t[count($t)] = implode($s);\n }\n }\n print $g[$q] . \"\\n\";\n print min($t);\n}\n?>","description":"A car number in Berland consists of exactly n digits. A number is called beautiful if it has at least k equal digits. Vasya wants to change the digits in his car's number so that the number became beautiful. To replace one of n digits Vasya has to pay the sum of money, equal to the absolute difference between the old digit and the new one.Help Vasya: find the minimum sum of money he should pay to make the number of his car beautiful. You should also find the resulting beautiful number. If there are several such numbers, then print the lexicographically minimum one.","input_specification":"The first line contains two space-separated integers n and k (2\u2009\u2264\u2009n\u2009\u2264\u2009104,\u20092\u2009\u2264\u2009k\u2009\u2264\u2009n) which represent how many digits the number has and how many equal digits a beautiful number should have. The second line consists of n digits. It describes the old number of Vasya's car. It is guaranteed that the number contains no spaces and only contains digits.","output_specification":"On the first line print the minimum sum of money Vasya needs to change the number. On the second line print the car's new number. If there are several solutions, print the lexicographically minimum one.","notes":"NoteIn the first sample replacing the second digit with an \"8\" costs |9\u2009-\u20098|\u2009=\u20091. Replacing the fifth digit with an \"8\" costs the same. Replacing the sixth digit costs |6\u2009-\u20098|\u2009=\u20092. As a result, Vasya will pay 1\u2009+\u20091\u2009+\u20092\u2009=\u20094 for a beautiful number \"888188\".The lexicographical comparison of strings is performed by the < operator in modern programming languages. The string x is lexicographically smaller than the string y, if there exists such i (1\u2009\u2264\u2009i\u2009\u2264\u2009n), that xi\u2009<\u2009yi, and for any j (1\u2009\u2264\u2009j\u2009<\u2009i) xj\u2009=\u2009yj. The strings compared in this problem will always have the length n.","sample_inputs":["6 5\n898196","3 2\n533","10 6\n0001112223"],"sample_outputs":["4\n888188","0\n533","3\n0000002223"],"human_solution":" 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0);\nfor($x = 0; $x < $a; $x++)\n{\n $d[$c[$x]]++;\n}\n$e = array_keys($d);\n$f = 0;\nfor($x = 0; $x < 10; $x++)\n{\n if($d[$e[$x]] >= $b)\n {\n $f = 1;\n break;\n }\n}\nif($f == 1)\n{\n print \"0\\n\";\n print $c;\n}\nelse\n{\n $g = array();\n $h = array();\n for($x = 0; $x < 10; $x++)\n {\n $i = 0;\n $i2 = 0;\n $i += $d[$x];\n $j = 2;\n $k = 1;\n $l = 1;\n $m = array_fill(0, 10, 0);\n while(TRUE)\n {\n $n = $j % 2;\n $j++;\n if($n == 0)\n {\n $o = $x + $k;\n if($o <= 9)\n {\n $i += $d[$o];\n if($i >= $b)\n {\n $p = $i - $b;\n $r = $d[$o] - $p;\n $i -= $d[$o];\n $i += $r;\n $i2 += $r * abs($k);\n $m[$o] = $r;\n break;\n }\n else\n {\n $i2 += $d[$o] * abs($k);\n $m[$o] = $d[$o];\n }\n $k++;\n }\n }\n else\n {\n $o = $x - $l;\n if($o >= 0)\n {\n $i += $d[$o];\n if($i >= $b)\n {\n $p = $i - $b;\n $r = $d[$o] - $p;\n $i -= $d[$o];\n $i += $r;\n $i2 += $r * abs($l);\n $m[$o] = $r;\n break;\n }\n else\n {\n $i2 += $d[$o] * abs($l);\n $m[$o] = $d[$o];\n }\n $l++;\n }\n }\n }\n $g[$x] = $i2;\n $h[$x] = $m;\n }\n $q = min($g);\n $t = array();\n for($x = 0; $x < 10; $x++)\n {\n if($g[$x] == $q)\n {\n $r = $h[$x];\n $s = str_split($c);\n for($y = 0; $y < $a; $y++)\n {\n if(($r[$s[$y]] > 0) && ($s[$y] > $x))\n {\n $r[$s[$y]]--;\n $s[$y] = $x;\n }\n }\n for($y = $a - 1; $y >= 0; $y--)\n {\n if(($r[$s[$y]] > 0) && ($s[$y] < $x))\n {\n $r[$s[$y]]--;\n $s[$y] = $x;\n }\n }\n $t[count($t)] = implode($s);\n }\n }\n print $q . \"\\n\";\n print min($t);\n}\n?>","testcases":"[{'input': '6 5\\r\\n898196\\r\\n', 'output': ['4\\r\\n888188\\r\\n']}, {'input': '3 2\\r\\n533\\r\\n', 'output': ['0\\r\\n533\\r\\n']}, {'input': '10 6\\r\\n0001112223\\r\\n', 'output': ['3\\r\\n0000002223\\r\\n']}, {'input': '16 14\\r\\n6124258626539246\\r\\n', 'output': ['22\\r\\n4444448444449444\\r\\n']}, {'input': '45 32\\r\\n293440596342887581257444442930778730382520372\\r\\n', 'output': ['44\\r\\n393333393333883383337333333933778733383333373\\r\\n']}, {'input': '24 5\\r\\n438088068198972282890781\\r\\n', 'output': ['0\\r\\n438088068198972282890781\\r\\n']}, {'input': '16 14\\r\\n6124258626539246\\r\\n', 'output': ['22\\r\\n4444448444449444\\r\\n']}, {'input': '82 80\\r\\n2119762952003918195325258677229419698255491250839396799769357665825441616335532825\\r\\n', 'output': ['184\\r\\n5555555555005555555555555555555555555555555555555555555555555555555555555555555555\\r\\n']}, {'input': '45 32\\r\\n293440596342887581257444442930778730382520372\\r\\n', 'output': ['44\\r\\n393333393333883383337333333933778733383333373\\r\\n']}, {'input': '490 406\\r\\n6937620658350546677982121486389899418322368306416898602098608742746618866398816281683487378363055175834430809130055167725989297432631546167569254739009984031319216325885901155975051308675689263659830423003844586142203356046853592049537849615230121968733935503099047499243659967467210261734604823020656447423321550183799772473757948538911374517796361954090889656392709554559699998961074109288895345641132806900327583681875693131517858168659050373933110409335022047853526996256346106200848216\\r\\n', 'output': ['823\\r\\n6666660666660666666666161666666666616666666606616666606066606666666616666666616661666666666666066166666660606160066166666666666666661666166666666666006666061616616666666601166666061606666666666666660666006666666166606666066666666066666666616660161666666666606066066666666666666666610661666606666060666666666661660166666666666666666666611666616666661666060666666666606666666666666661066106666666666661166606600666666661666666666666666666666060666666660606666066066666666666666666606600666666\\r\\n']}, {'input': '356 339\\r\\n90713123988967376077374685385857243899541739889434281713194182070073947448051066204296405724136030046475387234588789683960244522406704483328080177635790417478469563537849906260100031272024144948352721319113584314778607455620696032294129842532911886401415747087765570443593673103700483651161340044647214751601613569664275752937177165137014927765832674935091\\r\\n', 'output': ['769\\r\\n44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444944444444444444444444444444444494444444449444444449944444444444444444444944444444449444444444444444444444494444494449444444944444444444444444444444444494444444444444444444444444444444444444444449444444444944444444444444944444444444944494\\r\\n']}, {'input': '156 81\\r\\n154048888528343996517566504808882818609764630684954673234602444413507803713170523618021219782031130705466944034778721589983846786551930214111097548781325421\\r\\n', 'output': ['99\\r\\n144048888448444994414444404808884818409444440484944444444404444414404804414140444418041419784041140704444944044778741489984844784441940414111097448781444441\\r\\n']}, {'input': '100 100\\r\\n1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000\\r\\n', 'output': ['250\\r\\n4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444\\r\\n']}, {'input': '2 2\\r\\n11\\r\\n', 'output': ['0\\r\\n11\\r\\n']}, {'input': '2 2\\r\\n09\\r\\n', 'output': ['9\\r\\n00\\r\\n']}, {'input': '2 2\\r\\n80\\r\\n', 'output': ['8\\r\\n00\\r\\n']}, {'input': '5 2\\r\\n11233\\r\\n', 'output': ['0\\r\\n11233\\r\\n']}, {'input': '5 4\\r\\n11233\\r\\n', 'output': ['3\\r\\n11113\\r\\n']}, {'input': '4 3\\r\\n1335\\r\\n', 'output': ['2\\r\\n1333\\r\\n']}, {'input': '8 4\\r\\n22294777\\r\\n', 'output': ['2\\r\\n22274777\\r\\n']}, {'input': '3 2\\r\\n531\\r\\n', 'output': ['2\\r\\n331\\r\\n']}, {'input': '10 8\\r\\n2222221134\\r\\n', 'output': ['2\\r\\n2222221224\\r\\n']}, {'input': '5 4\\r\\n34445\\r\\n', 'output': ['1\\r\\n34444\\r\\n']}, {'input': '6 5\\r\\n223333\\r\\n', 'output': ['1\\r\\n233333\\r\\n']}, {'input': '8 6\\r\\n88899999\\r\\n', 'output': ['1\\r\\n88999999\\r\\n']}, {'input': '5 4\\r\\n12221\\r\\n', 'output': ['1\\r\\n12222\\r\\n']}, {'input': '200 150\\r\\n34567484444444444444768934769793476984376983476983469347693847683947689347239485723985723452390458290385902385902385285490238459028350934902834908239048590328590234890283459023520354820938590238534533\\r\\n', 'output': ['232\\r\\n44444444444444444444444944449494444944444944444944449444494444444944449444449444444944444444490444490444904444904444444490444449044440944904444904449044490444490444890484449044440444840948490448444444\\r\\n']}, {'input': '5 4\\r\\n21122\\r\\n', 'output': ['1\\r\\n21222\\r\\n']}]","id":517} {"difficulty":1600,"lang":"PHP","lang_cluster":"PHP","src_uid":"d3a0402de1338a1a542a86ac5b484acc","execute_outcome":"WRONG_ANSWER","source_code":"read_array();\n return $array[0];\n }\n}\n?>\nread_one();\n $a = $input_connect->read_array();\n for ($i = 0; $i < $n; $i++) {\n $num[$i] = $i;\n }\n for ($i = $n; $i < 2 * $n; $i++){\n $a[$i] = $a[$i - $n];\n $num[$i] = $num[$i - $n];\n }\n $h = -1;\n for ($j = 1; $j < $n; $j++){\n if ($n % $j != 0 || $n \/ $j < 3) continue;\n ++$h;\n $div[$h] = $j;\n }\n for ($i = 0; $i < $n; $i++){\n if ($a[$i] == 0) continue;\n for ($j = 0; $j < $h; $j++){\n $k = $i + $div[$j];\n while ($a[$k] == 1 && $num[$k] != $i) $k += $div[$j];\n if ($num[$k] == $i) {\n echo \"YES\";\n die(0);\n }\n } \n }\n echo \"NO\";\n?>","description":"There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in a good mood should be located. Otherwise, the next month will bring misfortunes.A convex polygon is regular if all its sides have same length and all his angles are equal. In this problem we consider only regular polygons with at least 3 vertices, i. e. only nondegenerated.On a picture below some examples of such polygons are present. Green points mean knights in a good mood. Red points mean ones in a bad mood. King Arthur knows the knights' moods. Help him find out if the next month will be fortunate or not.","input_specification":"The first line contains number n, which is the number of knights at the round table (3\u2009\u2264\u2009n\u2009\u2264\u2009105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. \"1\" means that the knight is in a good mood an \"0\" means that he is in a bad mood.","output_specification":"Print \"YES\" without the quotes if the following month will turn out to be lucky. Otherwise, print \"NO\".","notes":null,"sample_inputs":["3\n1 1 1","6\n1 0 1 1 1 0","6\n1 0 0 1 0 1"],"sample_outputs":["YES","YES","NO"],"human_solution":"read_array();\n return $array[0];\n }\n}\n?>\nread_one();\n $a = $input_connect->read_array();\n for ($i = 0; $i < $n; $i++) {\n $num[$i] = $i;\n }\n for ($i = $n; $i < 2 * $n; $i++){\n $a[$i] = $a[$i - $n];\n $num[$i] = $num[$i - $n];\n }\n $h = -1;\n for ($j = 1; $j < $n; $j++){\n if ($n % $j != 0 || $n \/ $j < 3) continue;\n ++$h;\n $div[$h] = $j;\n }\n for ($i = 0; $i < $n; $i++){\n if ($a[$i] == 0) continue;\n for ($j = 0; $j <= $h; $j++){\n $k = $i + $div[$j];\n while ($a[$k] == 1 && $num[$k] != $i) $k += $div[$j];\n if ($num[$k] == $i) {\n echo \"YES\";\n die(0);\n }\n } \n }\n echo \"NO\";\n?>","testcases":"[{'input': '3\\r\\n1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 1 1 1 0\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '10\\r\\n1 0 1 1 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 0 1 0 1 1 0 1 0 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '29\\r\\n0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1\\r\\n', 'output': ['NO']}, {'input': '77\\r\\n0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1\\r\\n', 'output': ['YES']}, {'input': '99\\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 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\\r\\n', 'output': ['YES']}, {'input': '18\\r\\n0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 1\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n0 0 1 0 0 1\\r\\n', 'output': ['NO']}, {'input': '6\\r\\n0 1 0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n0 0 1 0 0 0 1\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '8\\r\\n1 0 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\\r\\n', 'output': ['YES']}, {'input': '30\\r\\n1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0\\r\\n', 'output': ['YES']}, {'input': '100\\r\\n1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0\\r\\n', 'output': ['YES']}, {'input': '113\\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\\r\\n', 'output': ['YES']}]","id":518} {"difficulty":2000,"lang":"PHP","lang_cluster":"PHP","src_uid":"e33b0a752dc1aba25da21e20435e3fe2","execute_outcome":"WRONG_ANSWER","source_code":" 0 && $possible != -1) {\n $kk--;\n $lastq = $possible;\n $possible = -1;\n } else {\n $q = false;\n break;\n }\n }\n }\n if ($q && $n - $lastq - 2 > $mm) $q = false;\n if ($q) $e = $mm; else $b = $mm;\n }\n $qq = true;\n for ($i = 0; $i < $n; $i++) {\n if ($s[$i] == '1') {\n $qq = false;\n }\n }\n if ($qq && $n == $k) $e = 0;\n echo $e;\n?> ","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"],"human_solution":"= $N - 1) break;\n if($seq[$i] == '1') {\n if($lim == $i) {\n $cost = $K + 1;\n }\n }\n if($rp[$lim] == $i) {\n ++$cost;\n $prev = $i;\n }\n }\n if($cost <= $K) {\n $ans = $mid;\n $ub = $mid - 1;\n } else {\n $lb = $mid + 1;\n }\n }\n echo $ans;\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":519} {"difficulty":1800,"lang":"PHP","lang_cluster":"PHP","src_uid":"e9c486e2d942700e0644dff29b6e3be6","execute_outcome":"WRONG_ANSWER","source_code":"= (double)(100 * $cur \/ $max)\n && $spell[$i][1] > $mmax\n && !isset($spell[$i][2])) {\n $mmax = $spell[$i][1];\n $mpos = $i;\n $mpow = $spell[$i][0];\n }\n }\n\n if ($mpow == 0 && $sum <= $reg) {\n echo 'NO';\n return;\n } else if ($mpow != 0) {\n $spells++;\n $spell[$mpos][2]= $sec;\n $sum += $mmax;\n }\n $sec++;\n }\n\n echo \"YES\\n\";\n echo \"$sec $spells\\n\";\n for ($i = 0; $i < $n; $i++) {\n if (isset($spell[$i][2])) {\n $pos = $i + 1;\n echo \"{$spell[$i][2]} {$pos}\\n\";\n }\n }","description":"Vasya\u2019s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.While playing the game Petya found spell scrolls and now he is about to use them. Let\u2019s describe the way fighting goes on this level:1) The boss has two parameters: max \u2014 the initial amount of health and reg \u2014 regeneration rate per second.2) Every scroll also has two parameters: powi \u2014 spell power measured in percents \u2014 the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than powi percent of health the scroll cannot be used); and dmgi the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmgi of damage per second upon him until the end of the game.During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can\u2019t have more than max of health), then the player may use another scroll (no more than one per second).The boss is considered to be defeated if at the end of a second he has nonpositive (\u2009\u2264\u20090) amount of health.Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.","input_specification":"The first line contains three integers N, max and reg (1\u2009\u2264\u2009N,\u2009max,\u2009reg\u2009\u2264\u20091000) \u2013\u2013 the amount of scrolls and the parameters of the boss. The next N lines contain two integers powi and dmgi each \u2014 the parameters of the i-th scroll (0\u2009\u2264\u2009powi\u2009\u2264\u2009100, 1\u2009\u2264\u2009dmgi\u2009\u2264\u20092000). ","output_specification":"In case Petya can\u2019t complete this level, output in the single line NO. Otherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds. Output scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.","notes":null,"sample_inputs":["2 10 3\n100 3\n99 1","2 100 10\n100 11\n90 9"],"sample_outputs":["NO","YES\n19 2\n0 1\n10 2"],"human_solution":"= $r) && ($i[$x] == TRUE))\n {\n $o += $e[$x];\n $p = 1;\n unset($i[$x]);\n break;\n }\n }\n if($p == 1)\n {\n array_push($l, $n);\n array_push($m, $j[$x]);\n }\n $k -= $o;\n $k += $c;\n $n++;\n if($k <= 0)\n {\n $s = 1;\n break;\n }\n elseif(($k >= $b) && ($p == 0))\n {\n $s = 2;\n break;\n }\n if($k >= $b)\n {\n $k = $b;\n }\n}\nif($s == 1)\n{\n print \"YES\\n\";\n print $n . \" \" . count($m) . \"\\n\";\n for($x = 0; $x < count($l) - 1; $x++)\n {\n print $l[$x] . \" \" . $m[$x] . \"\\n\";\n }\n print $l[$x] . \" \" . $m[$x];\n}\nelseif($s == 2)\n{\n print \"NO\";\n}\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":520} {"difficulty":1000,"lang":"Rust","lang_cluster":"Rust","src_uid":"0515ac888937a4dda30cad5e2383164f","execute_outcome":"RUNTIME_ERROR","source_code":"type Pair = (usize, usize);\nfn input_pair() -> Pair {\n let mut buf = String::new();\n std::io::stdin().read_line(&mut buf).unwrap();\n let buf: Vec = buf\n .trim()\n .split_whitespace()\n .map(|elem| elem.parse().unwrap())\n .collect();\n (buf[0], buf[1])\n}\n\nfn minimize(num: &str, n: usize, mut k: usize) -> String {\n if n == 1 {\n String::from(\"0\")\n } else if k == 0 {\n String::from(num)\n } else {\n num.chars()\n .zip(0..)\n .map(|(c, i)| {\n if i == 0 {\n if c != '1' {\n k -= 1\n }\n '1'\n } else if k > 0 {\n if c != '0' {\n k -= 1\n }\n '0'\n } else {\n c\n }\n })\n .collect()\n }\n}\n\nfn main() {\n let (n, k) = input_pair();\n\n let mut num = String::with_capacity(n);\n std::io::stdin().read_line(&mut num).unwrap();\n let num = num.trim();\n\n print!(\"{}\", minimize(&num, n, k));\n}","description":"Ania has a large integer $$$S$$$. Its decimal representation has length $$$n$$$ and doesn't contain any leading zeroes. Ania is allowed to change at most $$$k$$$ digits of $$$S$$$. She wants to do it in such a way that $$$S$$$ still won't contain any leading zeroes and it'll be minimal possible. What integer will Ania finish with?","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq n \\leq 200\\,000$$$, $$$0 \\leq k \\leq n$$$) \u2014 the number of digits in the decimal representation of $$$S$$$ and the maximum allowed number of changed digits. The second line contains the integer $$$S$$$. It's guaranteed that $$$S$$$ has exactly $$$n$$$ digits and doesn't contain any leading zeroes.","output_specification":"Output the minimal possible value of $$$S$$$ which Ania can end with. Note that the resulting integer should also have $$$n$$$ digits.","notes":"NoteA number has leading zeroes if it consists of at least two digits and its first digit is $$$0$$$. For example, numbers $$$00$$$, $$$00069$$$ and $$$0101$$$ have leading zeroes, while $$$0$$$, $$$3000$$$ and $$$1010$$$ don't have leading zeroes.","sample_inputs":["5 3\n51528","3 2\n102","1 1\n1"],"sample_outputs":["10028","100","0"],"human_solution":"use std::io;\nuse std::io::Write;\n\nfn main() {\n let mut input = String::new();\n io::stdin()\n .read_line(&mut input)\n .expect(\"failed to read input\");\n let mut input_iter = input.trim().split_whitespace();\n let _n = input_iter.next();\n let mut k = input_iter.next().unwrap().parse::().unwrap();\n\n let mut input = String::new();\n io::stdin()\n .read_line(&mut input)\n .expect(\"failed to read input\");\n let mut s = input.trim().bytes().map(|x| x - '0' as u8).collect::>();\n\n if k != 0 {\n let mut start = 0;\n if s.len() > 1 {\n start = 1;\n if s[0] != 1 {\n s[0] = 1;\n k -= 1;\n }\n }\n\n if k != 0 {\n for d in start..s.len() {\n if s[d] != 0 {\n s[d] = 0;\n k -= 1;\n if k == 0 {\n break;\n }\n }\n }\n }\n }\n\n let out = std::io::stdout();\n let mut buf = std::io::BufWriter::new(out.lock());\n\n for d in s.iter() {\n write!(buf, \"{}\", d);\n }\n writeln!(buf, \"\");\n}","testcases":"[{'input': '5 3\\r\\n51528\\r\\n', 'output': ['10028']}, {'input': '3 2\\r\\n102\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '8 3\\r\\n76185080\\r\\n', 'output': ['10085080']}, {'input': '10 9\\r\\n6605076924\\r\\n', 'output': ['1000000000']}, {'input': '17 14\\r\\n70419129275429261\\r\\n', 'output': ['10000000000000061']}, {'input': '199998 156775\\r\\n7634835512546227964243675139267315515577320237799637891529762314202017056236453683463308322179478107714532692736127575938520704751962381411698645433174487533559358321355930286745679211230306497827539374809663293796414447998709546787238564494719936067978838018924333308448159811275761513662350712828112159370994524797946201631497195474204565415159556215408393442798737977256084296355518425255430478805792621099352145489884245660406882249088247622551866815094192404242822804505500195699678136715085...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 2\\r\\n771112621109427812643673718074851764530689179759522591776981347807280232051563479817701294504068444683925657775712189272916643598581280840476981946390136592530160890213039665570819989634882772014581123884548476129114444089853125242596962777622415395884132936832620353838491107480004705925531447086202872507603787398475272973977883161172711023044040076388597092521402114312141786014676329287040828537689063290700494627878117322477780331244252157257615979675788502631313114376908083415265271825142311855...', 'output': ['1011126211094278126436737180748517645306891797595225917769813478072802320515634798177012945040684446839256577757121892729166435985812808404769819463901365925301608902130396655708199896348827720145811238845484761291144440898531252425969627776224153958841329368326203538384911074800047059255314470862028725076037873984752729739778831611727110230440400763885970925214021143121417860146763292870408285376890632907004946278781173224777803312442521572576159796757885026313131143769080834152652718251423118555804948582...']}, {'input': '200000 187545\\r\\n1301932000014086050003493008300090088600008905090000090726720050602018004305000000700039502080000000000804105230405000900500088030035200500800855026204010050500010740072080660018636955073996700000035002008600100300004080060050758040037000509580004102081000660006058000482268044600010070000000600070000003080064000030800000680000750000004322050608600400970480084802503000000400630507000200002000001005804040800800090005802057000428580020800925000000629700040000413000100370770900000020000090020500...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 108920\\r\\n1000060080705000000204167000210030260410030008740020004440300400704400002246004600000000280000009000003000600100402000001018908014000000000700009400007010506000008040000081093000007290200799770220020090000090000003750029800400018800610035060000778074010010070342570100000309000400900109573300780000002000580000008110565008609045902500004700309400341000270000800541701003044061539000504007102204600020200000000410080008800040014043020001740001009909604006083100000306000008080010000306019090006920...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 0\\r\\n256460096885481118333385694194593424724739000857078402894729701905592008141621922999353883420223647081763072129620176745092485803472555520197554536813418150418668888561749524693799305459423468508526178216363770325370737637707298927860518980996754247764234637679566129316759583799946805627150829867078807856652337888873045390190273863335903317485821289778295646610247705331477977491374901408118245671900293927177708527564320879813680266512784477174618257362818880763121593493992240288309416423252322589...', 'output': ['2564600968854811183333856941945934247247390008570784028947297019055920081416219229993538834202236470817630721296201767450924858034725555201975545368134181504186688885617495246937993054594234685085261782163637703253707376377072989278605189809967542477642346376795661293167595837999468056271508298670788078566523378888730453901902738633359033174858212897782956466102477053314779774913749014081182456719002939271777085275643208798136802665127844771746182573628188807631215934939922402883094164232523225896946463143...']}, {'input': '1 0\\r\\n1\\r\\n', 'output': ['1']}, {'input': '1 1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '2 1\\r\\n16\\r\\n', 'output': ['10']}, {'input': '199998 1\\r\\n393793459125730434817326505196085664401836690611040699365444699554396567481294672734190867935101303782403762614914695106676085805233526531077883925316679432454645499725035536054511270853595067746389612754512677963407959910298501740600753730291829759092013350224236537453749695855228708627576745877006835358665778204750554336289003281805557831681316447819422395981821587041818138679267179845673476645222792419445270267854570200477975677775848636560868302397070651219976608387583798999637359541316043303...', 'output': ['1937934591257304348173265051960856644018366906110406993654446995543965674812946727341908679351013037824037626149146951066760858052335265310778839253166794324546454997250355360545112708535950677463896127545126779634079599102985017406007537302918297590920133502242365374537496958552287086275767458770068353586657782047505543362890032818055578316813164478194223959818215870418181386792671798456734766452227924194452702678545702004779756777758486365608683023970706512199766083875837989996373595413160433037914192167...']}, {'input': '1 0\\r\\n0\\r\\n', 'output': ['0']}, {'input': '400 224\\r\\n3403471829631665055630257676709588054274069759668265706060902871201473941465824155677441158274936877159724887320158357490042422725165554784088776427589353335344063521672837620180854587939835953567037285547297153069505169565026205894046634052941764635777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118\\r\\n', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005777689929679040391696138907261954591409717624232914340574247814757436283494948900530055203416884159964848809274624696419616836151341636807247526289118']}, {'input': '1 0\\r\\n7\\r\\n', 'output': ['7']}, {'input': '30001 3687\\r\\n4879192340040210090371839649725898645819068470953339807944387968566809980170694714689568391058070568669565556001147862733255297572185796382230959350902061126937291655379996336535818031441002901288810081315372322742150381341152172532929586842038085743018527749089883673304076590435577643595823925084516541240697072236066890237191637478444052629650299572670262123127495201287721836078729470595572382868026441586623803689911342230360110538673179021296182761497570880783531361319832799494113744343814346...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '1 1\\r\\n9\\r\\n', 'output': ['0']}, {'input': '200000 38987\\r\\n76547795344979180295054210128630519504720553087786617591179063355165277050010800500919098736157692909606440488419230571151305874941386099145638002486943253041385929903189240704372570279164739070920245500523417056463480725895142260414739614203125827132260399332409961148788603352128175214468463293051554232404622569836095853346138387735994831271987736838622488963205796989636461581587213002982703456678244029796890854541824300618965779648737201358064901552552135936371807846933513367765608458110676...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n6460919550116632947975329737843793545236004047782108596534898123057253397260469884887006447373686860765441991750069970261923059655977307450939819192459072743822235871752239218106124430454880896265366218869237362174028558375318768755925219864762612285510997026013758388494629568802512355717750245845107715580333327502926161629218455221202583429645434847277896131705531441501475955858572369832897721621131980865577036189025532131971953553814709481914469596257388306747828391809722245306699413411356...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 180000\\r\\n9286117824715039989999736422374781884612984621858762074834566600961603517152352735549120665833482175119005317968171609951234595077176340999613167085078113630149499963897453833136536185540829393433131144347288914693721741432644933889416271480298131676680040597613465738188321726645084008821977045447857551641906525603448963266537865723315776809482680723682113527494815672911819578085994601036108229286294416703575942970998720095863251394147350975897963975493513231689411282318956457883748074239936...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '5 4\\r\\n39837\\r\\n', 'output': ['10007']}, {'input': '50 30\\r\\n57206210120809502631460958076295309729525641641207\\r\\n', 'output': ['10000000000000000000000000000000000000525641641207']}, {'input': '1007 227\\r\\n369799753553096434212687991038890334035927231543168858070363240543707094851004011833546324278654842112185372843388625808742617383357633200469817324198361676851033219633460115249216685327348387483420593801099766213228912614693858934416795750496016581432964640991389901515295952359505287110013873006017098823518143738023806132465622999469686472455422850159238870901537707018878862333427679379258787429175993594228281458543965661564527149998125389241781729944715267138852336209263357013249353365630301197...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004329646409913899015152959523595052871100138730060170988235181437380238061324656229994696864724554228501592388709015377070188788623334276793792587874291759935942282814585439656615645271499981253892417817299447152671388523362092633570132493533656303011977386208557...']}, {'input': '200000 115883\\r\\n2827598722404843878394338738400265508106504152501270300221275146405910260468705816133192242761521885478231751746733067543198108040164336590532649752514637122116183049796533213177428365653624032802274504819895081417821483054448617694493086660221342348252961651777999310547071904394447885642496063169952269344168248485570225037351961780490886353728688696791957504642834707407902831439040324401593442009455549209814087473740461121097636313114425724581495619327798682412667883550806628933794919641259...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 189016\\r\\n8416570810017947799345366245078545563060867951133843463654077942101407592653938857977547381029040691849115146855959823582926802977252493901665144141970754517157599890945319344469867753613264046987787640052143993567764617851230536541653443136278486466556306793654923504647164029627821833277786952281911088641656772278631961340215855281140528251402412512927863990092036900991949353394435401099491371631409700722234576482621310820225343236454865691230822555516565709427343903368050866632422516548258...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 167461\\r\\n3206034925895567066888019409555989055917283638539640987330840691986340901091285419615291003659395213547844117278189300000448972461050871482816547410380426547709241564981816209111235849764373041087269479006869844988533891914109097219526276297728401721820429870716530719442072568598657571188900284564564598745870786857232505646728989857796675717471643943277223802206690334370807779370367768124252032251265638353636571475165110321018144037214277697268552443843181594498917633998597790442500539400524...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 21257\\r\\n44238960540540399079380242266731890700609403619472760007061267571428334037102918118752841521938648875551027597345220240908862764992885902871379464657862623367496599353782269710632200373004719407545316738755312387383814463173569764303033377637752411311816380248291023629183766989210112931198686632466234288853956206441696813735148071146419670152515759258185718973302514749658468772753904356563283604788308404726875408100418719283160487507951147249719290590821488722695303392048575123466568873086805...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 44357\\r\\n93333192597026512176815315293321734076497304923578001284021054296259224275585800839794398341409078876994334203979905365584045106874714895982250663201231184557035827543194251454094227697985895358234195034291595869308581214790550473721423513798474163524284955776857005795032871710866852351639387239633644520469116345457022619176007318426990358530241027423401935295649358641417228997507447929003896390875027755861897034241802774873465494445856936268435579453157280432124684728711434457495750468741969...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199033\\r\\n9562475203625759746707785966654413048735096081794862651254941808251820762773935427336876973684436897689371203248974318238246237695069165133400485413602104140143788767778225877751617574119145493578782177450427992509861796676189366615328753903844704324959837649108323782873361897137809322915297840041401157146037172352953907682526984141304190711584060218096282515834339047498067515566837279395849437620451737762461342815506022514957516109855972163698584716904813928943681292087902463663438317932736...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 170000\\r\\n3913915994642697697068963716167447315467551489827800141559679559075740187983956330933176444195368834633971243230038152411012393823719029418928176806191130256121684431281388232758427708370450251279891286938341958980524672861384032979614504035143487945567588388365457227518415795423587413884635833455433955608933042928701966518829427448161236453167057098435014584458826943662674175676728265459598337668185029005721022505587759835093144219035819689601313026735782513243943394741063330555806376207658...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199997 190000\\r\\n2611566865624277085686743605084826361393478369330618445377254081355948171705185770366238370879604476405532972172684641535374648236073859897122593987641677216626971177570245111474701939613364722185246632577785379726413466571867339419697213701866787984064673743403069775130439828526057608245054485455644600298905641341911565951517745699909161462338230794579418191139865987264464782699342660463557293538565289896039262820158236693272255963501987670682930198614286125250562177178065109415863812573667...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 199998\\r\\n5226295693272515932955906141172464664794325832463650925111357112660308794448535195539499902492266941035983585725090710160650749337604021144987925265375618330734221762004307435246532165634575179128547059807918762778771255467658504849956368939758887537175055104228887917312939399327925422637266391391743214324093433782448530821995504679841305590835338381300556636358933189575787051381364261348518393185561193905124721917500955091301228889880860201268208287603358978753985359622263972937993927354483...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 10261\\r\\n10072000970000600012706000002096008764300020900840080007092000500404000008000000000058215800062975440087090007216000010450009000100152740043008300442809848046940095504241070540209206108000400009061023608710600000008000739000281008000081050150000600581000000000026768009302006200820021015000650000000014801028000209808700050003000608737000000002230210000264500057005000707000700008080060000000008902000006006018004000001305159213907000008001900000000500150090000030604300206080050098002064003000088...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 87158\\r\\n24022000060085800102807501265840001010660000990000075050800000050000104016020008040060003060533052080752009000160608020002930000425767816883560204970012552065000440001775040236070986700007003003000055000000500010660006434130600900754300009002640200600030000005005406000478006100005001909107007800083009060016008725602000501002100425600004070409700060060131600002004000007960000048000206066940320009042906209000000001400010004077070001024072030050277000900090001854310980000400002600060901500935600...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 123819\\r\\n1000070000038093004000489005400500000690010077000950100907070080030100103810020000649050100097804009063040254000763000004003900040200030050200700009050092000800000607007000050639048800000540060050000000004400008760070200005463300000079205004576000606260000004600004054780570200230200030077000002072008000827661200000007048000000050000047000600100000030037100600065690003000642009060090000048050830600408900000100000360000009800600000250700000900951850405808004000000015375098007208602000156000105...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 84557\\r\\n36000600000001000020005906800030000001570004000200510500000007040211030001040800002409032000400020803501000800000000009040041529110793500000000069108000008502150000860730009500000050850800000007069248000000008000869904000206010009007000204103007000002000700348002440500004300700007000002099603978650030105060610364190000400907011050000044000104005820000000901004024070207200803808481000091401451400000012601005030200460000000108517087700604009024018006849508980303043027241010077700240000003064905...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199999 868\\r\\n1400001060200017042503601108900020100040080600020600070005000720200014700368022601100604202000034030646070030004703402370672066280800000107022001306005041320180021000600247100020000200050067020686200039940000604150005000060000004010008000900970050906085000044341000008096900906000702001004008277044100018066606702164909050030000877043310700501260005088040300300410780082000903300009561401850001000000059060003070303400055060904000003061709030560801020000009000000017401033309079008076000008470000005...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '199998 156059\\r\\n1706005864440400040010560020000000000020024050070200005900000080003050050901004004087110966504007872090016909000000000000500088077000080070146300001616490072754010259900700302000036704704352050496030060280260000080502100000010100210000005700000800018504040700600000012235908002009004608220500900170100560200090002103004060500730030505000804280800404069023000570035471164041700000050010900000075060003000900000109500000064005000032088407907002440350607570790800100000000009200000230092078830285403...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 200000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '200000 200000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 0\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '200000 200000\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 100000\\r\\n1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456...', 'output': ['1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...']}, {'input': '200000 7\\r\\n111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['1000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '2 2\\r\\n10\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n10000\\r\\n', 'output': ['10000']}, {'input': '1 1\\r\\n5\\r\\n', 'output': ['0']}, {'input': '2 2\\r\\n99\\r\\n', 'output': ['10']}, {'input': '5 5\\r\\n55555\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n123\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '4 4\\r\\n1111\\r\\n', 'output': ['1000']}, {'input': '4 4\\r\\n1234\\r\\n', 'output': ['1000']}, {'input': '5 5\\r\\n11111\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n12345\\r\\n', 'output': ['10000']}, {'input': '2 1\\r\\n99\\r\\n', 'output': ['19']}, {'input': '6 6\\r\\n123456\\r\\n', 'output': ['100000']}, {'input': '1 0\\r\\n5\\r\\n', 'output': ['5']}, {'input': '5 5\\r\\n56789\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n555\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n185\\r\\n', 'output': ['100']}, {'input': '3 3\\r\\n888\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n99999\\r\\n', 'output': ['10000']}, {'input': '5 5\\r\\n11234\\r\\n', 'output': ['10000']}, {'input': '4 4\\r\\n9999\\r\\n', 'output': ['1000']}, {'input': '1 1\\r\\n8\\r\\n', 'output': ['0']}, {'input': '5 5\\r\\n51528\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n100\\r\\n', 'output': ['100']}, {'input': '6 2\\r\\n123456\\r\\n', 'output': ['100456']}, {'input': '2 2\\r\\n11\\r\\n', 'output': ['10']}, {'input': '3 3\\r\\n999\\r\\n', 'output': ['100']}, {'input': '5 5\\r\\n65412\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n111\\r\\n', 'output': ['100']}, {'input': '4 4\\r\\n5555\\r\\n', 'output': ['1000']}, {'input': '10 5\\r\\n1000054300\\r\\n', 'output': ['1000000000']}, {'input': '5 5\\r\\n54321\\r\\n', 'output': ['10000']}, {'input': '3 3\\r\\n300\\r\\n', 'output': ['100']}, {'input': '1 1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '1 0\\r\\n2\\r\\n', 'output': ['2']}]","id":521} {"difficulty":1400,"lang":"Rust","lang_cluster":"Rust","src_uid":"08f1ba79ced688958695a7cfcfdda035","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ https:\/\/codeforces.com\/problemset\/problem\/698\/A\nuse std::io;\n\nfn main() {\n let mut n = String::new();\n\n io::stdin()\n .read_line(&mut n)\n .unwrap();\n\n let n: i64 = n.trim().parse().unwrap();\n\n let mut line = String::new();\n\n io::stdin()\n .read_line(&mut line)\n .unwrap();\n\n let a: Vec =\n line\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n\n let mut last = 0;\n let mut ans = 0;\n for day in a {\n let available = day&(!last);\n if available == 0 {\n last = 0;\n ans += 1;\n } else if available != 3 {\n last = available;\n } else {\n last = !last;\n }\n }\n println!(\"{}\", ans);\n}\n","description":"Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options: on this day the gym is closed and the contest is not carried out; on this day the gym is closed and the contest is carried out; on this day the gym is open and the contest is not carried out; on this day the gym is open and the contest is carried out. On each of days Vasya can either have a rest or write the contest (if it is carried out on this day), or do sport (if the gym is open on this day).Find the minimum number of days on which Vasya will have a rest (it means, he will not do sport and write the contest at the same time). The only limitation that Vasya has \u2014 he does not want to do the same activity on two consecutive days: it means, he will not do sport on two consecutive days, and write the contest on two consecutive days.","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of days of Vasya's vacations. The second line contains the sequence of integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u20093) separated by space, where: ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; ai equals 1, if on the i-th day of vacations the gym is closed, but the contest is carried out; ai equals 2, if on the i-th day of vacations the gym is open and the contest is not carried out; ai equals 3, if on the i-th day of vacations the gym is open and the contest is carried out.","output_specification":"Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses: to do sport on any two consecutive days, to write the contest on any two consecutive days. ","notes":"NoteIn the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.In the third test Vasya can do sport either on a day number 1 or number 2. He can not do sport in two days, because it will be contrary to the his limitation. Thus, he will have a rest for only one day.","sample_inputs":["4\n1 3 2 0","7\n1 3 3 2 1 2 3","2\n2 2"],"sample_outputs":["2","0","1"],"human_solution":"\/\/spnauti-rust\nuse std::io::*;\nuse std::str::*;\nuse std::fmt::Debug;\n#[allow(unused_imports)] use std::cmp::Ordering::{self,*};\n#[allow(unused_imports)] use std::ops::*;\n#[allow(unused_imports)] use std::collections::*;\n\n#[allow(unused_macros)]\nmacro_rules! a {\n ($c: tt, $x: expr, $y: expr) => {{\n let b = $y; let a = &mut $x;\n if b $c *a { *a = b; true } else { false }\n }};\n}\nstruct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }\n#[allow(dead_code)]\nimpl<'a> WordReader<'a> {\n fn new(b: &mut String, mut r: T) -> WordReader {\n b.clear();\n r.read_to_string(b).ok();\n WordReader { it: b.split_ascii_whitespace() }\n }\n fn from_stdin(b: &mut String) -> WordReader {\n WordReader::new(b, stdin())\n }\n fn sl(&mut self) -> &str { self.it.next().unwrap() }\n fn bs(&mut self) -> &[u8] { self.sl().as_bytes() }\n fn s(&mut self) -> String { String::from(self.sl()) }\n fn i(&mut self) -> i32 { self.p() }\n fn u(&mut self) -> usize { self.p() }\n fn vi(&mut self, n: usize) -> Vec {\n self.vp::(n)\n }\n fn p(&mut self) -> T where T::Err: Debug {\n self.sl().parse::().unwrap()\n }\n fn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n (0..n).map(|_| self.p()).collect()\n }\n}\n\n#[allow(dead_code)]\nfn build_counting_hashmap(i: T) -> HashMap\n where T: Iterator {\n let mut m = HashMap::new();\n for k in i {\n let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };\n m.insert(k, n);\n }\n m\n}\n\nfn main() {\n let mut bin = String::new();\n let mut input = WordReader::from_stdin(&mut bin);\n\n const INF: i32 = 1000000;\n let n = input.u();\n let (a,b,c) = input.vi(n).into_iter().fold((0,0,0), |(a,b,c),x| {\n let aa = a.min(b).min(c) + 1;\n let bb = if x % 2 == 0 { INF } else { a.min(c) };\n let cc = if x < 2 { INF } else { a.min(b) };\n (aa,bb,cc)\n });\n println!(\"{}\", a.min(b).min(c));\n}\n\n","testcases":"[{'input': '4\\r\\n1 3 2 0\\r\\n', 'output': ['2']}, {'input': '7\\r\\n1 3 3 2 1 2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1']}, {'input': '1\\r\\n0\\r\\n', 'output': ['1']}, {'input': '10\\r\\n0 0 1 1 0 0 0 0 1 0\\r\\n', 'output': ['8']}, {'input': '100\\r\\n3 2 3 3 3 2 3 1 3 2 2 3 2 3 3 3 3 3 3 1 2 2 3 1 3 3 2 2 2 3 1 0 3 3 3 2 3 3 1 1 3 1 3 3 3 1 3 1 3 0 1 3 2 3 2 1 1 3 2 3 3 3 2 3 1 3 3 3 3 2 2 2 1 3 1 3 3 3 3 1 3 2 3 3 0 3 3 3 3 3 1 0 2 1 3 3 0 2 3 3\\r\\n', 'output': ['16']}, {'input': '10\\r\\n2 3 0 1 3 1 2 2 1 0\\r\\n', 'output': ['3']}, {'input': '45\\r\\n3 3 2 3 2 3 3 3 0 3 3 3 3 3 3 3 1 3 2 3 2 3 2 2 2 3 2 3 3 3 3 3 1 2 3 3 2 2 2 3 3 3 3 1 3\\r\\n', 'output': ['6']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '1\\r\\n2\\r\\n', 'output': ['0']}, {'input': '1\\r\\n3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '2\\r\\n3 3\\r\\n', 'output': ['0']}, {'input': '3\\r\\n3 3 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n0 2\\r\\n', 'output': ['1']}, {'input': '10\\r\\n2 2 3 3 3 3 2 1 3 2\\r\\n', 'output': ['2']}, {'input': '15\\r\\n0 1 0 0 0 2 0 1 0 0 0 2 0 0 0\\r\\n', 'output': ['11']}, {'input': '15\\r\\n1 3 2 2 2 3 3 3 3 2 3 2 2 1 1\\r\\n', 'output': ['4']}, {'input': '15\\r\\n3 1 3 2 3 2 2 2 3 3 3 3 2 3 2\\r\\n', 'output': ['3']}, {'input': '20\\r\\n0 2 0 1 0 0 0 1 2 0 1 1 1 0 1 1 0 1 1 0\\r\\n', 'output': ['12']}, {'input': '20\\r\\n2 3 2 3 3 3 3 2 0 3 1 1 2 3 0 3 2 3 0 3\\r\\n', 'output': ['5']}, {'input': '20\\r\\n3 3 3 3 2 3 3 2 1 3 3 2 2 2 3 2 2 2 2 2\\r\\n', 'output': ['4']}, {'input': '25\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 2 0 0 2 0 0 1 0 2 0 1 1\\r\\n', 'output': ['16']}, {'input': '25\\r\\n1 3 3 2 2 3 3 3 3 3 1 2 2 3 2 0 2 1 0 1 3 2 2 3 3\\r\\n', 'output': ['5']}, {'input': '25\\r\\n2 3 1 3 3 2 1 3 3 3 1 3 3 1 3 2 3 3 1 3 3 3 2 3 3\\r\\n', 'output': ['3']}, {'input': '30\\r\\n0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0 2 0 0 1 1 2 0 0 0\\r\\n', 'output': ['22']}, {'input': '30\\r\\n1 1 3 2 2 0 3 2 3 3 1 2 0 1 1 2 3 3 2 3 1 3 2 3 0 2 0 3 3 2\\r\\n', 'output': ['9']}, {'input': '30\\r\\n1 2 3 2 2 3 3 3 3 3 3 3 3 3 3 1 2 2 3 2 3 3 3 2 1 3 3 3 1 3\\r\\n', 'output': ['2']}, {'input': '35\\r\\n0 1 1 0 0 2 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 2 1 0 2 2 1 0 1 0 1 1 1 0 0\\r\\n', 'output': ['21']}, {'input': '35\\r\\n2 2 0 3 2 2 0 3 3 1 1 3 3 1 2 2 0 2 2 2 2 3 1 0 2 1 3 2 2 3 2 3 3 1 2\\r\\n', 'output': ['11']}, {'input': '35\\r\\n1 2 2 3 3 3 3 3 2 2 3 3 2 3 3 2 3 2 3 3 2 2 2 3 3 2 3 3 3 1 3 3 2 2 2\\r\\n', 'output': ['7']}, {'input': '40\\r\\n2 0 1 1 0 0 0 0 2 0 1 1 1 0 0 1 0 0 0 0 0 2 0 0 0 2 1 1 1 3 0 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['28']}, {'input': '40\\r\\n2 2 3 2 0 2 3 2 1 2 3 0 2 3 2 1 1 3 1 1 0 2 3 1 3 3 1 1 3 3 2 2 1 3 3 3 2 3 3 1\\r\\n', 'output': ['10']}, {'input': '40\\r\\n1 3 2 3 3 2 3 3 2 2 3 1 2 1 2 2 3 1 2 2 1 2 2 2 1 2 2 3 2 3 2 3 2 3 3 3 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '45\\r\\n2 1 0 0 0 2 1 0 1 0 0 2 2 1 1 0 0 2 0 0 0 0 0 0 1 0 0 2 0 0 1 1 0 0 1 0 0 1 1 2 0 0 2 0 2\\r\\n', 'output': ['29']}, {'input': '45\\r\\n3 3 2 3 3 3 2 2 3 2 3 1 3 2 3 2 2 1 1 3 2 3 2 1 3 1 2 3 2 2 0 3 3 2 3 2 3 2 3 2 0 3 1 1 3\\r\\n', 'output': ['8']}, {'input': '50\\r\\n3 0 0 0 2 0 0 0 0 0 0 0 2 1 0 2 0 1 0 1 3 0 2 1 1 0 0 1 1 0 0 1 2 1 1 2 1 1 0 0 0 0 0 0 0 1 2 2 0 0\\r\\n', 'output': ['32']}, {'input': '50\\r\\n3 3 3 3 1 0 3 3 0 2 3 1 1 1 3 2 3 3 3 3 3 1 0 1 2 2 3 3 2 3 0 0 0 2 1 0 1 2 2 2 2 0 2 2 2 1 2 3 3 2\\r\\n', 'output': ['16']}, {'input': '50\\r\\n3 2 3 1 2 1 2 3 3 2 3 3 2 1 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 2 3 3 3 3 2 3 1 2 3 3 2 3 3 1 2 2 1 1 3 3\\r\\n', 'output': ['7']}, {'input': '55\\r\\n0 0 1 1 0 1 0 0 1 0 1 0 0 0 2 0 0 1 0 0 0 1 0 0 0 0 3 1 0 0 0 1 0 0 0 0 2 0 0 0 2 0 2 1 0 0 0 0 0 0 0 0 2 0 0\\r\\n', 'output': ['40']}, {'input': '55\\r\\n3 0 3 3 3 2 0 2 3 0 3 2 3 3 0 3 3 1 3 3 1 2 3 2 0 3 3 2 1 2 3 2 3 0 3 2 2 1 2 3 2 2 1 3 2 2 3 1 3 2 2 3 3 2 2\\r\\n', 'output': ['13']}, {'input': '55\\r\\n3 3 1 3 2 3 2 3 2 2 3 3 3 3 3 1 1 3 3 2 3 2 3 2 0 1 3 3 3 3 2 3 2 3 1 1 2 2 2 3 3 3 3 3 2 2 2 3 2 3 3 3 3 1 3\\r\\n', 'output': ['7']}, {'input': '60\\r\\n0 1 0 0 0 0 0 0 0 2 1 1 3 0 0 0 0 0 1 0 1 1 0 0 0 3 0 1 0 1 0 2 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0\\r\\n', 'output': ['44']}, {'input': '60\\r\\n3 2 1 3 2 2 3 3 3 1 1 3 2 2 3 3 1 3 2 2 3 3 2 2 2 2 0 2 2 3 2 3 0 3 3 3 2 3 3 0 1 3 2 1 3 1 1 2 1 3 1 1 2 2 1 3 3 3 2 2\\r\\n', 'output': ['15']}, {'input': '60\\r\\n3 2 2 3 2 3 2 3 3 2 3 2 3 3 2 3 3 3 3 3 3 2 3 3 1 2 3 3 3 2 1 3 3 1 3 1 3 0 3 3 3 2 3 2 3 2 3 3 1 1 2 3 3 3 3 2 1 3 2 3\\r\\n', 'output': ['8']}, {'input': '65\\r\\n1 0 2 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 2 0 2 1 0 2 1 0 1 0 1 1 0 1 1 1 2 1 0 1 0 0 0 0 1 2 2 1 0 0 1 2 1 2 0 2 0 0 0 1 1\\r\\n', 'output': ['35']}, {'input': '65\\r\\n2 2 2 3 0 2 1 2 3 3 1 3 1 2 1 3 2 3 2 2 2 1 2 0 3 1 3 1 1 3 1 3 3 3 3 3 1 3 0 3 1 3 1 2 2 3 2 0 3 1 3 2 1 2 2 2 3 3 2 3 3 3 2 2 3\\r\\n', 'output': ['13']}, {'input': '65\\r\\n3 2 3 3 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 2 3 2 2 3 3 3 3 3 2 2 2 3 3 2 3 3 2 3 3 3 3 2 3 3 3 2 2 3 3 3 3 3 3 2 2 3 3 2 3 3 1 3 3 3 3\\r\\n', 'output': ['6']}, {'input': '70\\r\\n1 0 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 0 1 1 1 3 1 1 0 1 2 0 2 1 0 0 0 1 1 1 1 1 0 0 1 0 0 0 1 1 1 3 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1\\r\\n', 'output': ['43']}, {'input': '70\\r\\n2 3 3 3 1 3 3 1 2 1 1 2 2 3 0 2 3 3 1 3 3 2 2 3 3 3 2 2 2 2 1 3 3 0 2 1 1 3 2 3 3 2 2 3 1 3 1 2 3 2 3 3 2 2 2 3 1 1 2 1 3 3 2 2 3 3 3 1 1 1\\r\\n', 'output': ['16']}, {'input': '70\\r\\n3 3 2 2 1 2 1 2 2 2 2 2 3 3 2 3 3 3 3 2 2 2 2 3 3 3 1 3 3 3 2 3 3 3 3 2 3 3 1 3 1 3 2 3 3 2 3 3 3 2 3 2 3 3 1 2 3 3 2 2 2 3 2 3 3 3 3 3 3 1\\r\\n', 'output': ['10']}, {'input': '75\\r\\n1 0 0 1 1 0 0 1 0 1 2 0 0 2 1 1 0 0 0 0 0 0 2 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 0 1 2 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0\\r\\n', 'output': ['51']}, {'input': '75\\r\\n1 3 3 3 1 1 3 2 3 3 1 3 3 3 2 1 3 2 2 3 1 1 1 1 1 1 2 3 3 3 3 3 3 2 3 3 3 3 3 2 3 3 2 2 2 1 2 3 3 2 2 3 0 1 1 3 3 0 0 1 1 3 2 3 3 3 3 1 2 2 3 3 3 3 1\\r\\n', 'output': ['16']}, {'input': '75\\r\\n3 3 3 3 2 2 3 2 2 3 2 2 1 2 3 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 3 3 3 2 3 2 2 2 3 3 1 3 2 2 3 3 3 0 3 2 1 3 3 2 3 3 3 3 1 2 3 3 3 2 2 3 3 3 3 2 2 3 3 1\\r\\n', 'output': ['11']}, {'input': '80\\r\\n0 0 0 0 2 0 1 1 1 1 1 0 0 0 0 2 0 0 1 0 0 0 0 1 1 0 2 2 1 1 0 1 0 1 0 1 1 1 0 1 2 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 2 2 0 1 1 0 0 0 0 0 0 0 0 1\\r\\n', 'output': ['56']}, {'input': '80\\r\\n2 2 3 3 2 1 0 1 0 3 2 2 3 2 1 3 1 3 3 2 3 3 3 2 3 3 3 2 1 3 3 1 3 3 3 3 3 3 2 2 2 1 3 2 1 3 2 1 1 0 1 1 2 1 3 0 1 2 3 2 2 3 2 3 1 3 3 2 1 1 0 3 3 3 3 1 2 1 2 0\\r\\n', 'output': ['17']}, {'input': '80\\r\\n2 3 3 2 2 2 3 3 2 3 3 3 3 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 2 3 1 3 2 3 3 0 3 1 2 3 3 1 2 3 2 3 3 2 3 3 3 3 3 2 2 3 0 3 3 3 3 3 2 2 3 2 3 3 3 3 3 2 3 2 3 3 3 3 2 3\\r\\n', 'output': ['9']}, {'input': '85\\r\\n0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 2 0 1 0 0 2 0 1 1 0 0 0 0 2 2 0 0 0 1 0 0 0 1 2 0 1 0 0 0 2 1 1 2 0 3 1 0 2 2 1 0 0 1 1 0 0 0 0 1 0 2 1 1 2 1 0 0 1 2 1 2 0 0 1 0 1 0\\r\\n', 'output': ['54']}, {'input': '85\\r\\n2 3 1 3 2 3 1 3 3 2 1 2 1 2 2 3 2 2 3 2 0 3 3 2 1 2 2 2 3 3 2 3 3 3 2 1 1 3 1 3 2 2 2 3 3 2 3 2 3 1 1 3 2 3 1 3 3 2 3 3 2 2 3 0 1 1 2 2 2 2 1 2 3 1 3 3 1 3 2 2 3 2 3 3 3\\r\\n', 'output': ['19']}, {'input': '85\\r\\n1 2 1 2 3 2 3 3 3 3 3 3 3 2 1 3 2 3 3 3 3 2 3 3 3 1 3 3 3 3 2 3 3 3 3 3 3 2 2 1 3 3 3 3 2 2 3 1 1 2 3 3 3 2 3 3 3 3 3 2 3 3 3 2 2 3 3 1 1 1 3 3 3 3 1 3 3 3 1 3 3 1 3 2 3\\r\\n', 'output': ['9']}, {'input': '90\\r\\n2 0 1 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 2 2 0 2 0 0 2 1 0 2 0 1 0 1 0 0 1 2 2 0 0 1 0 0 1 0 1 0 2 0 1 1 1 0 1 1 0 1 0 2 0 1 0 1 0 0 0 1 0 0 1 2 0 0 0 1 0 0 2 2 0 0 0 0 0 1 3 1 1 0 1\\r\\n', 'output': ['57']}, {'input': '90\\r\\n2 3 3 3 2 3 2 1 3 0 3 2 3 3 2 1 3 3 2 3 2 3 3 2 1 3 1 3 3 1 2 2 3 3 2 1 2 3 2 3 0 3 3 2 2 3 1 0 3 3 1 3 3 3 3 2 1 2 2 1 3 2 1 3 3 1 2 0 2 2 3 2 2 3 3 3 1 3 2 1 2 3 3 2 3 2 3 3 2 1\\r\\n', 'output': ['17']}, {'input': '90\\r\\n2 3 2 3 2 2 3 3 2 3 2 1 2 3 3 3 2 3 2 3 3 2 3 3 3 1 3 3 1 3 2 3 2 2 1 3 3 3 3 3 3 3 3 3 3 2 3 2 3 2 1 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 1 3 2 3 3 3 2 2 3 2 3 2 1 3 2\\r\\n', 'output': ['9']}, {'input': '95\\r\\n0 0 3 0 2 0 1 0 0 2 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 0 0 2 1 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 2 0 1 2 2 0 0 1 0 2 0 0 0 1 0 2 1 2 1 0 1 0 0 0 1 0 0 1 1 2 1 1 1 1 2 0 0 0 0 0 1 1 0 1\\r\\n', 'output': ['61']}, {'input': '95\\r\\n2 3 3 2 1 1 3 3 3 2 3 3 3 2 3 2 3 3 3 2 3 2 2 3 3 2 1 2 3 3 3 1 3 0 3 3 1 3 3 1 0 1 3 3 3 0 2 1 3 3 3 3 0 1 3 2 3 3 2 1 3 1 2 1 1 2 3 0 3 3 2 1 3 2 1 3 3 3 2 2 3 2 3 3 3 2 1 3 3 3 2 3 3 1 2\\r\\n', 'output': ['15']}, {'input': '95\\r\\n2 3 3 2 3 2 2 1 3 1 2 1 2 3 1 2 3 3 1 3 3 3 1 2 3 2 2 2 2 3 3 3 2 2 3 3 3 3 3 1 2 2 3 3 3 3 2 3 2 2 2 3 3 2 3 3 3 3 3 3 3 0 3 2 0 3 3 1 3 3 3 2 3 2 3 2 3 3 3 3 2 2 1 1 3 3 3 3 3 1 3 3 3 3 2\\r\\n', 'output': ['14']}, {'input': '100\\r\\n1 0 2 0 0 0 0 2 0 0 0 1 0 1 0 0 1 0 1 2 0 1 1 0 0 1 0 1 1 0 0 0 2 0 1 0 0 2 0 0 0 0 0 1 1 1 0 0 1 0 2 0 0 0 0 1 0 1 0 1 0 1 0 1 2 2 0 0 2 0 1 0 1 0 1 0 0 0 1 0 0 2 1 1 1 0 0 1 0 0 0 2 0 0 2 1 1 0 0 2\\r\\n', 'output': ['63']}, {'input': '100\\r\\n3 2 1 3 2 3 2 3 2 2 3 1 3 3 3 3 3 2 2 3 2 2 3 2 3 3 3 2 3 1 2 1 3 3 3 3 1 3 3 3 3 3 2 3 2 1 3 3 1 2 2 3 1 3 3 1 2 2 1 3 1 3 2 2 3 3 1 3 2 3 1 2 1 2 3 3 2 2 1 2 3 3 3 3 3 1 3 3 3 3 2 1 3 0 3 3 3 2 3 3\\r\\n', 'output': ['15']}, {'input': '100\\r\\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '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': ['50']}, {'input': '100\\r\\n2 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 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['50']}, {'input': '99\\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\\r\\n', 'output': ['49']}, {'input': '100\\r\\n2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1\\r\\n', 'output': ['0']}, {'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': ['100']}, {'input': '2\\r\\n0 3\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n2 1\\r\\n', 'output': ['0']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['0']}, {'input': '2\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '2\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '100\\r\\n3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0\\r\\n', 'output': ['50']}]","id":522} {"difficulty":900,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"11_A","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io;\r\n\r\nfn main() -> io::Result<()> {\r\n let mut input = String::new();\r\n io::stdin().read_line(&mut input).unwrap();\r\n\r\n let first_line : Vec<_> = input.trim()\r\n .split_whitespace()\r\n .map(|x| x.parse::().unwrap()).collect();\r\n\r\n let n = first_line[0];\r\n let d = first_line[1];\r\n let mut v : Vec<_> = vec![0;n];\r\n for i in 0..n {\r\n input.clear();\r\n io::stdin().read_line(&mut input).unwrap();\r\n v[i] = input.trim().parse::().unwrap();\r\n \r\n }\r\n let mut count = 0;\r\n \r\n for i in 0..n-1 {\r\n if v[i] >= v[i+1] {\r\n let x = (v[i] - v[i + 1]) \/ d + 1;\r\n\t\t\tv[i + 1] += x*d;\r\n\t\t\tcount += x;\r\n }\r\n }\r\n println!(\"{}\",count);\r\n Ok(())\r\n \r\n}\r\n\r\n\r\n\r\n","description":"A sequence a0,a1,...,at-1 is called increasing if ai-1 {\n reader: R,\n line: Vec,\n ptr: usize\n\n}\n\nimpl Scanner {\n fn new(reader: R) -> Self {\n Self{reader, line: vec![], ptr: 0}\n }\n\n fn scan(&mut self) -> T {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n let start = self.ptr;\n while self.ptr < self.line.len() && !self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n return std::str::from_utf8(&self.line[start..self.ptr]).unwrap().parse().ok().\n expect(\"parse error\");\n }\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n }\n\n fn line(&mut self) -> Vec {\n if self.ptr == self.line.len() {\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n let result = self.line[self.ptr..].to_vec();\n self.ptr = self.line.len();\n return result;\n }\n\n fn eof(&mut self) -> bool {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n return false;\n }\n self.line.clear();\n self.ptr = 0;\n if let Ok(0) = self.reader.read_until(b'\\n', &mut self.line) {\n return true;\n }\n }\n }\n\n}\n\nfn solve(scanner: &mut Scanner, writer: &mut W) {\n let n: usize = scanner.scan();\n let d: i64 = scanner.scan();\n let b: Vec = (0..n).map(|_| scanner.scan()).collect();\n let mut result = 0;\n let mut last = 0;\n for b in b {\n if last < b {\n last = b;\n continue;\n }\n let count = (last - b) \/ d + 1;\n result += count;\n last = b + count * d;\n }\n writeln!(writer, \"{}\", result).unwrap();\n}\n\nfn main() {\n let (stdin, stdout) = (std::io::stdin(), std::io::stdout());\n let mut writer = std::io::BufWriter::new(stdout.lock());\n let mut scanner = Scanner::new(stdin.lock());\n let tests: usize = 1;\n for _ in 0..tests {\n solve(&mut scanner, &mut writer);\n }\n}\n","testcases":"[{'input': ['4 2\\r\\n1 3 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1\\r\\n2 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 7\\r\\n10 20\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 7\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3\\r\\n18 1 9\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['3 3\\r\\n15 17 9\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 3\\r\\n10 9 12\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 3\\r\\n2 1 17 10 5 16 8 4 15 17\\r\\n'], 'output': ['31\\r\\n']}, {'input': ['10 3\\r\\n6 11 4 12 22 15 23 26 24 26\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['10 3\\r\\n10 24 13 15 18 14 15 26 33 35\\r\\n'], 'output': ['29\\r\\n']}, {'input': ['100 3\\r\\n529 178 280 403 326 531 671 427 188 866 669 646 421 804 494 609 53 1012 211 243 887 833 900 543 226 42 859 718 454 372 971 692 846 770 511 395 499 479 641 756 115 269 206 45 1039 727 400 779 859 614 146 214 196 919 702 959 380 830 535 878 859 784 316 305 782 924 536 243 236 978 564 150 291 877 808 983 537 839 490 120 168 838 267 650 900 170 211 504 326 771 895 984 994 483 776 100 471 1078 317 580\\r\\n'], 'output': ['15717\\r\\n']}, {'input': ['100 3\\r\\n329 226 331 909 962 112 837 1005 194 818 506 416 125 648 367 459 400 582 989 547 329 438 234 121 272 226 821 376 834 427 718 164 834 113 654 177 737 212 169 696 744 180 89 944 233 147 667 990 809 1072 1085 1093 814 265 1067 312 833 572 303 901 1032 504 185 817 389 158 613 723 239 269 911 352 769 404 225 822 897 606 947 323 913 804 923 1084 552 901 486 249 209 898 847 610 728 1122 986 669 1116 1076 367 327\\r\\n'], 'output': ['16133\\r\\n']}]","id":523} {"difficulty":800,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"16_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::io;\r\nfn all_same(s: &String) -> bool {\r\n if s.len() <= 1 {\r\n return true;\r\n }\r\n let fch: char = s.chars().next().unwrap();\r\n for ch in s.chars().skip(1) {\r\n if ch != fch {\r\n return false;\r\n }\r\n }\r\n true\r\n}\r\nfn all_diff(s: &String) -> bool {\r\n if s.len() <= 1 {\r\n return true;\r\n }\r\n let chars = s.chars().collect::>();\r\n for i in 0..s.len() {\r\n for j in (i + 1)..s.len() {\r\n if chars[i] == chars[j] {\r\n return false;\r\n }\r\n }\r\n }\r\n true\r\n}\r\nfn main() {\r\n let mut line = String::new();\r\n io::stdin()\r\n .read_line(&mut line)\r\n .expect(\"Failed to read line\");\r\n\r\n let inputs: Vec = line\r\n .split_whitespace()\r\n .map(|x| x.parse().expect(\"Failed to read\"))\r\n .collect();\r\n\r\n let n: usize = inputs[0] as usize;\r\n\r\n let mut matrix: Vec = vec![];\r\n for _ in 0..n {\r\n let mut str: String = String::new();\r\n io::stdin()\r\n .read_line(&mut str)\r\n .expect(\"failed to read input.\");\r\n matrix.push(str.trim().parse().expect(\"invalid input\"));\r\n }\r\n let mut str: String = Default::default();\r\n for s in matrix.iter() {\r\n str.push(s.chars().next().unwrap());\r\n }\r\n if all_diff(&str) == true {\r\n for s in matrix.iter() {\r\n if all_same(s) == false {\r\n print!(\"NO\");\r\n return;\r\n }\r\n }\r\n print!(\"YES\");\r\n } else {\r\n print!(\"NO\");\r\n }\r\n}\r\n","description":"According to a new ISO standard, a flag of every country should have a chequered field n\u00d7m, each square should be of one of 10 colours, and the flag should be \u00abstriped\u00bb: each horizontal row of the flag should contain squares of the same colour, and the colours of adjacent horizontal rows should be different. Berland's government asked you to find out whether their flag meets the new ISO standard.","input_specification":"The first line of the input contains numbers n and m (1\u2264n,m\u2264100), n \u2014 the amount of rows, m \u2014 the amount of columns on the flag of Berland. Then there follows the description of the flag: each of the following n lines contain m characters. Each character is a digit between 0 and 9, and stands for the colour of the corresponding square.\n","output_specification":"Output YES, if the flag meets the new ISO standard, and NO otherwise.\n","notes":null,"sample_inputs":["3 3\n000\n111\n222\n","3 3\n000\n000\n111\n","3 3\n000\n111\n002\n"],"sample_outputs":["YES\n","NO\n","NO\n"],"human_solution":"use std::io;\r\nfn all_same(s: &String) -> bool {\r\n if s.len() <= 1 {\r\n return true;\r\n }\r\n let fch: char = s.chars().next().unwrap();\r\n for ch in s.chars().skip(1) {\r\n if ch != fch {\r\n return false;\r\n }\r\n }\r\n true\r\n}\r\nfn all_diff(s: &String) -> bool {\r\n if s.len() <= 1 {\r\n return true;\r\n }\r\n let chars = s.chars().collect::>();\r\n for i in 0..s.len() - 1 {\r\n if chars[i] == chars[i + 1] {\r\n return false;\r\n }\r\n }\r\n true\r\n}\r\nfn main() {\r\n let mut line = String::new();\r\n io::stdin()\r\n .read_line(&mut line)\r\n .expect(\"Failed to read line\");\r\n\r\n let inputs: Vec = line\r\n .split_whitespace()\r\n .map(|x| x.parse().expect(\"Failed to read\"))\r\n .collect();\r\n\r\n let n: usize = inputs[0] as usize;\r\n\r\n let mut matrix: Vec = vec![];\r\n for _ in 0..n {\r\n let mut str: String = String::new();\r\n io::stdin()\r\n .read_line(&mut str)\r\n .expect(\"failed to read input.\");\r\n matrix.push(str.trim().parse().expect(\"invalid input\"));\r\n }\r\n let mut str: String = Default::default();\r\n for s in matrix.iter() {\r\n str.push(s.chars().next().unwrap());\r\n }\r\n if all_diff(&str) == true {\r\n for s in matrix.iter() {\r\n if all_same(s) == false {\r\n print!(\"NO\");\r\n return;\r\n }\r\n }\r\n print!(\"YES\");\r\n } else {\r\n print!(\"NO\");\r\n }\r\n}\r\n","testcases":"[{'input': ['3 3\\r\\n000\\r\\n111\\r\\n222\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n000\\r\\n000\\r\\n111\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 3\\r\\n000\\r\\n111\\r\\n002\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10 10\\r\\n2222222222\\r\\n5555555555\\r\\n0000000000\\r\\n4444444444\\r\\n1111111111\\r\\n3333333393\\r\\n3333333333\\r\\n5555555555\\r\\n0000000000\\r\\n8888888888\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10 13\\r\\n4442444444444\\r\\n8888888888888\\r\\n6666666666666\\r\\n0000000000000\\r\\n3333333333333\\r\\n4444444444444\\r\\n7777777777777\\r\\n8388888888888\\r\\n1111111111111\\r\\n5555555555555\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10 8\\r\\n33333333\\r\\n44444444\\r\\n11111115\\r\\n81888888\\r\\n44444444\\r\\n11111111\\r\\n66666666\\r\\n33330333\\r\\n33333333\\r\\n33333333\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 5\\r\\n88888\\r\\n44444\\r\\n66666\\r\\n55555\\r\\n88888\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20 19\\r\\n1111111111111111111\\r\\n5555555555555555555\\r\\n0000000000000000000\\r\\n3333333333333333333\\r\\n1111111111111111111\\r\\n2222222222222222222\\r\\n4444444444444444444\\r\\n5555555555555555555\\r\\n0000000000000000000\\r\\n4444444444444444444\\r\\n0000000000000000000\\r\\n5555555555555555555\\r\\n7777777777777777777\\r\\n9999999999999999999\\r\\n2222222222222222222\\r\\n4444444444444444444\\r\\n1111111111111111111\\r\\n6666666666666666666\\r\\n7777777777777777777\\r\\n2222222222222222222\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 100\\r\\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 1\\r\\n5\\r\\n7\\r\\n9\\r\\n4\\r\\n7\\r\\n2\\r\\n5\\r\\n1\\r\\n6\\r\\n7\\r\\n2\\r\\n7\\r\\n6\\r\\n8\\r\\n7\\r\\n4\\r\\n0\\r\\n2\\r\\n9\\r\\n8\\r\\n9\\r\\n1\\r\\n6\\r\\n4\\r\\n3\\r\\n4\\r\\n7\\r\\n1\\r\\n9\\r\\n3\\r\\n0\\r\\n8\\r\\n3\\r\\n1\\r\\n7\\r\\n5\\r\\n3\\r\\n9\\r\\n5\\r\\n1\\r\\n3\\r\\n5\\r\\n8\\r\\n1\\r\\n9\\r\\n3\\r\\n9\\r\\n0\\r\\n6\\r\\n0\\r\\n7\\r\\n6\\r\\n5\\r\\n2\\r\\n8\\r\\n3\\r\\n7\\r\\n6\\r\\n5\\r\\n1\\r\\n8\\r\\n3\\r\\n6\\r\\n9\\r\\n6\\r\\n0\\r\\n5\\r\\n8\\r\\n5\\r\\n2\\r\\n9\\r\\n1\\r\\n0\\r\\n1\\r\\n8\\r\\n3\\r\\n2\\r\\n1\\r\\n0\\r\\n3\\r\\n9\\r\\n0\\r\\n5\\r\\n1\\r\\n0\\r\\n4\\r\\n9\\r\\n3\\r\\n0\\r\\n4\\r\\n8\\r\\n4\\r\\n8\\r\\n6\\r\\n3\\r\\n0\\r\\n4\\r\\n6\\r\\n8\\r\\n4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 1\\r\\n2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 100\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111181111111111111111111111\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 1\\r\\n3\\r\\n6\\r\\n4\\r\\n3\\r\\n0\\r\\n2\\r\\n8\\r\\n7\\r\\n3\\r\\n2\\r\\n1\\r\\n7\\r\\n1\\r\\n3\\r\\n2\\r\\n3\\r\\n6\\r\\n9\\r\\n0\\r\\n8\\r\\n5\\r\\n9\\r\\n7\\r\\n9\\r\\n2\\r\\n1\\r\\n4\\r\\n5\\r\\n1\\r\\n9\\r\\n2\\r\\n5\\r\\n1\\r\\n4\\r\\n6\\r\\n4\\r\\n9\\r\\n1\\r\\n0\\r\\n2\\r\\n1\\r\\n4\\r\\n7\\r\\n1\\r\\n4\\r\\n8\\r\\n0\\r\\n9\\r\\n2\\r\\n1\\r\\n6\\r\\n2\\r\\n8\\r\\n6\\r\\n9\\r\\n5\\r\\n8\\r\\n6\\r\\n4\\r\\n5\\r\\n9\\r\\n2\\r\\n7\\r\\n4\\r\\n1\\r\\n5\\r\\n8\\r\\n0\\r\\n9\\r\\n5\\r\\n4\\r\\n6\\r\\n5\\r\\n0\\r\\n6\\r\\n3\\r\\n6\\r\\n9\\r\\n7\\r\\n2\\r\\n0\\r\\n9\\r\\n7\\r\\n3\\r\\n2\\r\\n4\\r\\n9\\r\\n4\\r\\n7\\r\\n1\\r\\n2\\r\\n3\\r\\n1\\r\\n7\\r\\n9\\r\\n1\\r\\n9\\r\\n0\\r\\n4\\r\\n0\\r\\n'], 'output': ['YES\\r\\n']}]","id":524} {"difficulty":1500,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"17_B","execute_outcome":"WRONG_ANSWER","source_code":"struct Scanner {\n reader: R,\n line: Vec,\n ptr: usize\n\n}\n\nimpl Scanner {\n fn new(reader: R) -> Self {\n Self{reader, line: vec![], ptr: 0}\n }\n\n fn scan(&mut self) -> T {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n let start = self.ptr;\n while self.ptr < self.line.len() && !self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n return std::str::from_utf8(&self.line[start..self.ptr]).unwrap().parse().ok().\n expect(\"parse error\");\n }\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n }\n\n fn line(&mut self) -> Vec {\n if self.ptr == self.line.len() {\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n let result = self.line[self.ptr..].to_vec();\n self.ptr = self.line.len();\n return result;\n }\n\n fn eof(&mut self) -> bool {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n return false;\n }\n self.line.clear();\n self.ptr = 0;\n if let Ok(0) = self.reader.read_until(b'\\n', &mut self.line) {\n return true;\n }\n }\n }\n\n}\n\nfn solve(scanner: &mut Scanner, writer: &mut W) {\n let n: usize = scanner.scan();\n let mut q: Vec<(usize, usize)> = (0..n).map(|id| (scanner.scan(), id)).collect();\n let m: usize = scanner.scan();\n let mut gr_inv = vec![Vec::new(); n];\n for _ in 0..m {\n let a = scanner.scan::() - 1;\n let b = scanner.scan::() - 1;\n let c: i64 = scanner.scan();\n gr_inv[b].push((c, a));\n }\n q.sort_unstable();\n for row in &mut gr_inv {\n row.sort_unstable();\n }\n let mut result = 0;\n let mut used = vec![false; n];\n used[q[0].1] = true;\n for i in 1..n {\n let mut ok = false;\n for &(val, id) in &gr_inv[q[i].1] {\n if used[id] {\n result += val;\n used[q[i].1] = true;\n ok = true;\n break;\n }\n }\n if !ok {\n result = -1;\n break;\n }\n }\n writeln!(writer, \"{}\", result).unwrap();\n}\n\nfn main() {\n let (stdin, stdout) = (std::io::stdin(), std::io::stdout());\n let mut writer = std::io::BufWriter::new(stdout.lock());\n let mut scanner = Scanner::new(stdin.lock());\n let tests: usize = 1;\n for _ in 0..tests {\n solve(&mut scanner, &mut writer);\n }\n}\n","description":"Nick's company employed n people. Now Nick needs to build a tree hierarchy of \u00absupervisor-surbodinate\u00bb relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in the following form: \u00abemployee ai is ready to become a supervisor of employee bi at extra cost ci\u00bb. The qualification qj of each employee is known, and for each application the following is true: qai>qbi. Would you help Nick calculate the minimum cost of such a hierarchy, or find out that it is impossible to build it.","input_specification":"The first input line contains integer n (1\u2264n\u22641000) \u2014 amount of employees in the company. The following line contains n space-separated numbers qj (0\u2264qj\u226410^6)\u2014 the employees' qualifications. The following line contains number m (0\u2264m\u226410000) \u2014 amount of received applications. The following m lines contain the applications themselves, each of them in the form of three space-separated numbers: ai, bi and ci (1\u2264ai,bi\u2264n, 0\u2264ci\u226410^6). Different applications can be similar, i.e. they can come from one and the same employee who offered to become a supervisor of the same person but at a different cost. For each application qai>qbi.\n","output_specification":"Output the only line \u2014 the minimum cost of building such a hierarchy, or -1 if it is impossible to build it.\n","notes":"In the first sample one of the possible ways for building a hierarchy is to take applications with indexes 1, 2 and 4, which give 11 as the minimum total cost. In the second sample it is impossible to build the required hierarchy, so the answer is -1.\n","sample_inputs":["4\n7 2 3 1\n4\n1 2 5\n2 4 1\n3 4 1\n1 3 5\n","3\n1 2 3\n2\n3 1 2\n3 1 3\n"],"sample_outputs":["11\n","-1\n"],"human_solution":"struct Scanner {\n reader: R,\n line: Vec,\n ptr: usize\n\n}\n\nimpl Scanner {\n fn new(reader: R) -> Self {\n Self{reader, line: vec![], ptr: 0}\n }\n\n fn scan(&mut self) -> T {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n let start = self.ptr;\n while self.ptr < self.line.len() && !self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n return std::str::from_utf8(&self.line[start..self.ptr]).unwrap().parse().ok().\n expect(\"parse error\");\n }\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n }\n\n fn line(&mut self) -> Vec {\n if self.ptr == self.line.len() {\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n let result = self.line[self.ptr..].to_vec();\n self.ptr = self.line.len();\n return result;\n }\n\n fn eof(&mut self) -> bool {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n return false;\n }\n self.line.clear();\n self.ptr = 0;\n if let Ok(0) = self.reader.read_until(b'\\n', &mut self.line) {\n return true;\n }\n }\n }\n\n}\n\nfn solve(scanner: &mut Scanner, writer: &mut W) {\n let n: usize = scanner.scan();\n let mut q: Vec<(usize, usize)> = (0..n).map(|id| (scanner.scan(), id)).collect();\n let m: usize = scanner.scan();\n let mut gr_inv = vec![Vec::new(); n];\n for _ in 0..m {\n let a = scanner.scan::() - 1;\n let b = scanner.scan::() - 1;\n let c: i64 = scanner.scan();\n gr_inv[b].push((c, a));\n }\n q.sort_unstable();\n q.reverse();\n for row in &mut gr_inv {\n row.sort_unstable();\n }\n let mut result = 0;\n let mut used = vec![false; n];\n used[q[0].1] = true;\n for i in 1..n {\n let mut ok = false;\n for &(val, id) in &gr_inv[q[i].1] {\n if used[id] {\n result += val;\n used[q[i].1] = true;\n ok = true;\n break;\n }\n }\n if !ok {\n result = -1;\n break;\n }\n }\n writeln!(writer, \"{}\", result).unwrap();\n}\n\nfn main() {\n let (stdin, stdout) = (std::io::stdin(), std::io::stdout());\n let mut writer = std::io::BufWriter::new(stdout.lock());\n let mut scanner = Scanner::new(stdin.lock());\n let tests: usize = 1;\n for _ in 0..tests {\n solve(&mut scanner, &mut writer);\n }\n}\n","testcases":"[{'input': ['4\\r\\n7 2 3 1\\r\\n4\\r\\n1 2 5\\r\\n2 4 1\\r\\n3 4 1\\r\\n1 3 5\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n2\\r\\n3 1 2\\r\\n3 1 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n5 3\\r\\n4\\r\\n1 2 0\\r\\n1 2 5\\r\\n1 2 0\\r\\n1 2 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n9 4 5\\r\\n5\\r\\n3 2 4\\r\\n1 2 4\\r\\n3 2 8\\r\\n1 3 5\\r\\n3 2 5\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3\\r\\n2 5 9\\r\\n5\\r\\n3 1 7\\r\\n2 1 1\\r\\n2 1 6\\r\\n2 1 2\\r\\n3 1 5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3\\r\\n6 2 9\\r\\n5\\r\\n1 2 10\\r\\n3 1 4\\r\\n1 2 5\\r\\n1 2 2\\r\\n3 1 4\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['4\\r\\n10 6 7 4\\r\\n5\\r\\n1 3 1\\r\\n3 4 1\\r\\n3 2 2\\r\\n1 2 6\\r\\n1 4 7\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4\\r\\n2 7 0 6\\r\\n8\\r\\n4 3 5\\r\\n2 3 7\\r\\n4 3 1\\r\\n2 1 9\\r\\n1 3 1\\r\\n1 3 3\\r\\n2 3 1\\r\\n1 3 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5\\r\\n6 8 5 9 0\\r\\n8\\r\\n4 2 2\\r\\n2 3 10\\r\\n2 3 6\\r\\n4 5 4\\r\\n1 3 1\\r\\n4 3 4\\r\\n3 5 1\\r\\n2 3 8\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5\\r\\n10 9 5 0 3\\r\\n9\\r\\n1 5 1\\r\\n1 4 7\\r\\n1 4 0\\r\\n1 4 6\\r\\n3 4 6\\r\\n2 3 1\\r\\n1 2 2\\r\\n1 2 9\\r\\n2 3 9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n3 9 2 1 8\\r\\n9\\r\\n2 5 10\\r\\n1 3 8\\r\\n3 4 9\\r\\n5 4 2\\r\\n2 1 4\\r\\n5 1 4\\r\\n2 4 2\\r\\n1 4 7\\r\\n5 1 2\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['5\\r\\n6 10 7 8 5\\r\\n10\\r\\n3 1 5\\r\\n2 4 1\\r\\n2 3 2\\r\\n4 5 9\\r\\n3 5 0\\r\\n4 1 9\\r\\n4 5 2\\r\\n1 5 8\\r\\n2 3 7\\r\\n1 5 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['7\\r\\n10 0 4 7 3 8 6\\r\\n10\\r\\n3 2 4\\r\\n6 4 3\\r\\n6 5 1\\r\\n1 2 1\\r\\n6 7 6\\r\\n7 3 9\\r\\n1 6 3\\r\\n3 2 1\\r\\n6 4 4\\r\\n1 4 4\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['6\\r\\n10 2 4 3 1 6\\r\\n10\\r\\n1 4 7\\r\\n1 6 9\\r\\n6 4 1\\r\\n4 2 5\\r\\n4 5 7\\r\\n6 3 10\\r\\n3 2 3\\r\\n3 4 3\\r\\n6 5 2\\r\\n1 3 2\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1\\r\\n10\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n10 5\\r\\n0\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2\\r\\n1000000 999999\\r\\n1\\r\\n1 2 1000000\\r\\n'], 'output': ['1000000\\r\\n']}, {'input': ['4\\r\\n3 2 2 1\\r\\n5\\r\\n1 2 1\\r\\n1 3 1\\r\\n1 4 500\\r\\n2 4 1\\r\\n3 4 2\\r\\n'], 'output': ['3\\r\\n']}]","id":525} {"difficulty":1200,"lang":"Rust","lang_cluster":"Rust","src_uid":"1ae2942b72ebb7c55359c41e141900d7","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io::{self, BufRead};\n\nfn main() {\n let stdin = io::stdin();\n let mut lines = stdin.lock().lines();\n let n = lines.next().unwrap().unwrap().parse::().unwrap();\n let winnings: Vec<_> = lines.next().unwrap().unwrap().split(\" \").map(|s| s.parse::().unwrap()).collect();\n let mut costs: Vec<_> = lines.next().unwrap().unwrap().split(\" \").enumerate().map(|(index, s)| (s.parse::().unwrap(), index)).collect();\n costs.sort_by(|a, b| b.0.cmp(&a.0));\n let mut current = 0;\n let mut solution = vec![0; 5];\n for amount in winnings.into_iter() {\n current += amount;\n for cost in costs.iter() {\n let how_many = current \/ cost.0;\n current %= cost.0;\n solution[cost.1] += how_many;\n }\n }\n for how_many in solution {\n print!(\"{} \", how_many);\n }\n println!(\"\");\n println!(\"{}\", current);\n}","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"],"human_solution":"use std::io::{self, BufRead};\n\nfn main() {\n let stdin = io::stdin();\n let mut lines = stdin.lock().lines();\n let n = lines.next().unwrap().unwrap().parse::().unwrap();\n let winnings: Vec<_> = lines.next().unwrap().unwrap().split(\" \").map(|s| s.parse::().unwrap()).collect();\n let mut costs: Vec<_> = lines.next().unwrap().unwrap().split(\" \").enumerate().map(|(index, s)| (s.parse::().unwrap(), index)).collect();\n costs.sort_by(|a, b| b.0.cmp(&a.0));\n let mut current = 0;\n let mut solution = vec![0; 5];\n for amount in winnings.into_iter() {\n current += amount;\n for cost in costs.iter() {\n let how_many = current \/ cost.0;\n current %= cost.0;\n solution[cost.1] += how_many;\n }\n }\n for how_many in solution {\n print!(\"{} \", how_many);\n }\n println!(\"\");\n println!(\"{}\", current);\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":526} {"difficulty":1400,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"24_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::cmp::min;\n\nuse Direction::*;\n\n#[derive(Debug, Eq, PartialEq)]\nenum Direction { Direct, Reverse }\n\n#[derive(Debug)]\nstruct Road {\n to: usize,\n direction: Direction,\n price: usize,\n}\n\nfn main() {\n let stdin = std::io::stdin();\n\n let mut buf = String::new();\n stdin.read_line(&mut buf).unwrap();\n let mut iter = buf.trim_end().split_whitespace();\n let cities_count: usize = iter.next().unwrap().parse().unwrap();\n\n let mut roads: Vec = Vec::with_capacity(cities_count);\n for _ in 0..cities_count {\n roads.push(Road {\n to: 0,\n direction: Direct,\n price: 0,\n })\n }\n\n for _ in 0..cities_count {\n let mut buf = String::new();\n stdin.read_line(&mut buf).unwrap();\n let mut iter = buf.trim_end().split_whitespace();\n let from: usize = iter.next().unwrap().parse().unwrap();\n let to: usize = iter.next().unwrap().parse().unwrap();\n let price: usize = iter.next().unwrap().parse().unwrap();\n\n if roads[from - 1].to == 0 {\n roads[from - 1] = Road { to, direction: Direct, price };\n } else {\n roads[to - 1] = Road { to: from, direction: Reverse, price };\n }\n }\n\n let direct_total_price: usize = roads\n .iter()\n .filter(|road| road.direction == Reverse)\n .map(|road| road.price)\n .sum();\n let reverse_total_price: usize = roads\n .iter()\n .filter(|road| road.direction == Direct)\n .map(|road| road.price)\n .sum();\n\n println!(\"{}\", min(direct_total_price, reverse_total_price));\n}\n","description":"Nowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Formerly all n cities of Berland were connected by n two-way roads in the ring, i. e. each city was connected directly to exactly two other cities, and from each city it was possible to get to any other city. Government of Berland introduced one-way traffic on all n roads, but it soon became clear that it's impossible to get from some of the cities to some others. Now for each road is known in which direction the traffic is directed at it, and the cost of redirecting the traffic. What is the smallest amount of money the government should spend on the redirecting of roads so that from every city you can get to any other?","input_specification":"The first line contains integer n (3\u2264n\u2264100) \u2014 amount of cities (and roads) in Berland. Next n lines contain description of roads. Each road is described by three integers ai, bi, ci (1\u2264ai,bi\u2264n,ai\u2260bi,1\u2264ci\u2264100) \u2014 road is directed from city ai to city bi, redirecting the traffic costs ci.\n","output_specification":"Output single integer \u2014 the smallest amount of money the government should spend on the redirecting of roads so that from every city you can get to any other.\n","notes":null,"sample_inputs":["3\n1 3 1\n1 2 1\n3 2 1\n","3\n1 3 1\n1 2 5\n3 2 1\n","6\n1 5 4\n5 3 8\n2 4 15\n1 6 16\n2 3 23\n4 6 42\n","4\n1 2 9\n2 3 8\n3 4 7\n4 1 5\n"],"sample_outputs":["1\n","2\n","39\n","0\n"],"human_solution":"#[derive(Debug)]\nstruct Edge {\n from: usize,\n to: usize,\n price: usize,\n}\n\n#[derive(Debug)]\nstruct City {\n id: usize,\n roads: Vec,\n}\n\n#[derive(Debug)]\nstruct Road {\n to: usize,\n out: bool,\n price: usize,\n}\n\nfn main() {\n let stdin = std::io::stdin();\n\n let cities_count: usize = {\n let mut buf = String::new();\n stdin.read_line(&mut buf).unwrap();\n let mut iter = buf.trim_end().split_whitespace();\n iter.next().unwrap().parse().unwrap()\n };\n\n let edges: Vec = {\n let mut edges = Vec::with_capacity(cities_count);\n for _ in 0..cities_count {\n let mut buf = String::new();\n stdin.read_line(&mut buf).unwrap();\n let mut iter = buf.trim_end().split_whitespace();\n let from: usize = iter.next().unwrap().parse().unwrap();\n let to: usize = iter.next().unwrap().parse().unwrap();\n let price: usize = iter.next().unwrap().parse().unwrap();\n edges.push(Edge { from, to, price });\n }\n edges\n };\n\n let total_price: usize = edges.iter().map(|edge| edge.price).sum();\n\n let cities: Vec = {\n let mut cities = Vec::with_capacity(cities_count);\n for index in 1..=cities_count {\n cities.push(City { id: index, roads: Vec::with_capacity(2) });\n }\n for edge in edges {\n cities[edge.from - 1].roads.push(Road {\n to: edge.to,\n out: true,\n price: edge.price,\n });\n cities[edge.to - 1].roads.push(Road {\n to: edge.from,\n out: false,\n price: edge.price,\n });\n }\n cities\n };\n\n let price: usize = {\n let mut price = 0;\n\n let start_id = 1;\n let mut current_id = start_id;\n let mut next_id = cities[current_id - 1].roads[0].to;\n let dir = cities[current_id - 1].roads[0].out;\n\n loop {\n let current_road = cities[current_id - 1]\n .roads\n .iter()\n .filter(|road| road.to == next_id)\n .next()\n .unwrap();\n let next_road = cities[next_id - 1]\n .roads\n .iter()\n .filter(|road| road.to != current_id)\n .next()\n .unwrap();\n\n if current_road.out != dir {\n price += current_road.price;\n }\n\n current_id = current_road.to;\n next_id = next_road.to;\n if current_id == start_id { break }\n }\n\n price\n };\n\n println!(\"{}\", std::cmp::min(price, total_price - price));\n}\n","testcases":"[{'input': ['3\\r\\n1 3 1\\r\\n1 2 1\\r\\n3 2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n1 3 1\\r\\n1 2 5\\r\\n3 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6\\r\\n1 5 4\\r\\n5 3 8\\r\\n2 4 15\\r\\n1 6 16\\r\\n2 3 23\\r\\n4 6 42\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['4\\r\\n1 2 9\\r\\n2 3 8\\r\\n3 4 7\\r\\n4 1 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n5 3 89\\r\\n2 3 43\\r\\n4 2 50\\r\\n1 4 69\\r\\n1 5 54\\r\\n'], 'output': ['143\\r\\n']}, {'input': ['10\\r\\n1 8 16\\r\\n6 1 80\\r\\n6 5 27\\r\\n5 7 86\\r\\n7 9 72\\r\\n4 9 20\\r\\n4 3 54\\r\\n3 2 57\\r\\n10 2 61\\r\\n8 10 90\\r\\n'], 'output': ['267\\r\\n']}, {'input': ['17\\r\\n8 12 43\\r\\n13 12 70\\r\\n7 13 68\\r\\n11 7 19\\r\\n5 11 24\\r\\n5 1 100\\r\\n4 1 10\\r\\n3 4 68\\r\\n2 3 46\\r\\n15 2 58\\r\\n15 6 38\\r\\n6 9 91\\r\\n9 10 72\\r\\n14 10 32\\r\\n14 17 97\\r\\n17 16 67\\r\\n8 16 40\\r\\n'], 'output': ['435\\r\\n']}, {'input': ['22\\r\\n18 22 46\\r\\n18 21 87\\r\\n5 21 17\\r\\n5 10 82\\r\\n10 12 81\\r\\n17 12 98\\r\\n16 17 17\\r\\n16 13 93\\r\\n4 13 64\\r\\n4 11 65\\r\\n15 11 18\\r\\n6 15 35\\r\\n6 7 61\\r\\n7 19 12\\r\\n19 1 65\\r\\n8 1 32\\r\\n8 2 46\\r\\n9 2 19\\r\\n9 3 58\\r\\n3 14 65\\r\\n20 14 67\\r\\n20 22 2\\r\\n'], 'output': ['413\\r\\n']}, {'input': ['39\\r\\n18 11 10\\r\\n5 18 97\\r\\n5 39 77\\r\\n39 24 64\\r\\n24 28 79\\r\\n28 14 6\\r\\n34 14 72\\r\\n6 34 64\\r\\n6 12 93\\r\\n12 8 66\\r\\n13 8 40\\r\\n35 13 20\\r\\n35 32 4\\r\\n32 19 55\\r\\n19 3 18\\r\\n3 21 26\\r\\n30 21 54\\r\\n30 27 5\\r\\n4 27 8\\r\\n22 4 89\\r\\n15 22 54\\r\\n15 2 90\\r\\n36 2 58\\r\\n33 36 4\\r\\n33 17 50\\r\\n17 16 21\\r\\n31 16 64\\r\\n1 31 77\\r\\n1 23 89\\r\\n23 7 62\\r\\n38 7 74\\r\\n9 38 15\\r\\n9 25 93\\r\\n25 10 32\\r\\n10 26 78\\r\\n20 26 63\\r\\n37 20 9\\r\\n29 37 33\\r\\n11 29 45\\r\\n'], 'output': ['950\\r\\n']}, {'input': ['50\\r\\n30 34 48\\r\\n11 30 15\\r\\n11 5 98\\r\\n4 5 57\\r\\n43 4 21\\r\\n14 43 74\\r\\n14 19 52\\r\\n45 19 60\\r\\n45 28 52\\r\\n24 28 94\\r\\n24 26 2\\r\\n48 26 48\\r\\n48 13 53\\r\\n13 42 7\\r\\n42 37 23\\r\\n37 17 70\\r\\n17 7 29\\r\\n20 7 93\\r\\n33 20 21\\r\\n33 2 53\\r\\n21 2 83\\r\\n49 21 33\\r\\n46 49 28\\r\\n18 46 1\\r\\n36 18 99\\r\\n47 36 52\\r\\n47 29 41\\r\\n41 29 40\\r\\n31 41 45\\r\\n31 38 25\\r\\n38 25 41\\r\\n25 8 18\\r\\n9 8 60\\r\\n9 27 29\\r\\n16 27 17\\r\\n16 22 6\\r\\n22 39 1\\r\\n1 39 8\\r\\n1 50 89\\r\\n50 12 64\\r\\n40 12 7\\r\\n40 44 71\\r\\n44 10 23\\r\\n15 10 70\\r\\n15 32 53\\r\\n23 32 92\\r\\n35 23 14\\r\\n35 3 25\\r\\n3 6 93\\r\\n6 34 99\\r\\n'], 'output': ['1117\\r\\n']}, {'input': ['3\\r\\n3 1 1\\r\\n2 1 1\\r\\n2 3 1\\r\\n'], 'output': ['1\\r\\n']}]","id":527} {"difficulty":1300,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"25_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::io;\nuse std::str::FromStr;\n\n#[allow(dead_code)]\nfn read_line() -> String {\n let mut buffer = String::new();\n io::stdin()\n .read_line(&mut buffer)\n .expect(\"failed to read line\");\n\n buffer\n}\n\n#[allow(dead_code)]\nfn read() -> Result {\n read_line().trim().parse::()\n}\n\n#[allow(dead_code)]\nfn read_vec() -> Result, T::Err> {\n read_line()\n .split_whitespace()\n .map(|x| x.parse::())\n .collect()\n}\n\nfn main() {\n let t = read::().unwrap();\n let v = read_vec::().unwrap();\n let mut ans = 1;\n\n for i in 0..t {\n let mut v_dif = Vec::new();\n\n for j in 0..t {\n if i == j {\n continue;\n }\n\n let dif = (v[i] - v[j]).abs();\n v_dif.push(dif);\n }\n\n let v_dif_dif = v_dif\n .windows(2)\n .map(|a| (a[0] - a[1]).abs())\n .collect::>();\n\n if v_dif_dif[0] % 2 == 0 && v_dif_dif.iter().min() == v_dif_dif.iter().max() {\n ans = i + 1;\n break;\n }\n }\n\n println!(\"{ans}\");\n}\n","description":"Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob \u2014 to check his answers, he needs a program that among the given n numbers finds one that is different in evenness.","input_specification":"The first line contains integer n (3\u2264n\u2264100) \u2014 amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.\n","output_specification":"Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.\n","notes":null,"sample_inputs":["5\n2 4 7 8 10\n","4\n1 2 1 1\n"],"sample_outputs":["3\n","2\n"],"human_solution":"use std::io;\nuse std::str::FromStr;\n\n#[allow(dead_code)]\nfn read_line() -> String {\n let mut buffer = String::new();\n io::stdin()\n .read_line(&mut buffer)\n .expect(\"failed to read line\");\n\n buffer\n}\n\n#[allow(dead_code)]\nfn read() -> Result {\n read_line().trim().parse::()\n}\n\n#[allow(dead_code)]\nfn read_vec() -> Result, T::Err> {\n read_line()\n .split_whitespace()\n .map(|x| x.parse::())\n .collect()\n}\n\nfn main() {\n let t = read::().unwrap();\n let v = read_vec::().unwrap();\n let mut ans = 1;\n\n for i in 0..t {\n let mut v_dif = Vec::new();\n\n for j in 0..t {\n if i == j {\n continue;\n }\n\n let dif = (v[i] - v[j]).abs();\n v_dif.push(dif);\n }\n\n dbg!(&v_dif);\n\n let v_dif_dif = v_dif\n .windows(2)\n .map(|a| (a[0] - a[1]).abs())\n .collect::>();\n\n let is_found = v_dif_dif.iter().all(|&x| x % 2 == 0);\n\n if is_found {\n ans = i + 1;\n break;\n }\n }\n\n println!(\"{ans}\");\n}\n","testcases":"[{'input': ['5\\r\\n2 4 7 8 10\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n1 2 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n1 2 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n100 99 100\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n5 3 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n43 28 1 91\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n75 13 94 77\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n97 8 27 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10\\r\\n95 51 12 91 85 3 1 31 25 7\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\n88 96 66 51 14 88 2 92 18 72 18 88 20 30 4 82 90 100 24 46\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['30\\r\\n20 94 56 50 10 98 52 32 14 22 24 60 4 8 98 46 34 68 82 82 98 90 50 20 78 49 52 94 64 36\\r\\n'], 'output': ['26\\r\\n']}, {'input': ['50\\r\\n79 27 77 57 37 45 27 49 65 33 57 21 71 19 75 85 65 61 23 97 85 9 23 1 9 3 99 77 77 21 79 69 15 37 15 7 93 81 13 89 91 31 45 93 15 97 55 80 85 83\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['60\\r\\n46 11 73 65 3 69 3 53 43 53 97 47 55 93 31 75 35 3 9 73 23 31 3 81 91 79 61 21 15 11 11 11 81 7 83 75 39 87 83 59 89 55 93 27 49 67 67 29 1 93 11 17 9 19 35 21 63 31 31 25\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['70\\r\\n28 42 42 92 64 54 22 38 38 78 62 38 4 38 14 66 4 92 66 58 94 26 4 44 41 88 48 82 44 26 74 44 48 4 16 92 34 38 26 64 94 4 30 78 50 54 12 90 8 16 80 98 28 100 74 50 36 42 92 18 76 98 8 22 2 50 58 50 64 46\\r\\n'], 'output': ['25\\r\\n']}, {'input': ['100\\r\\n43 35 79 53 13 91 91 45 65 83 57 9 42 39 85 45 71 51 61 59 31 13 63 39 25 21 79 39 91 67 21 61 97 75 93 83 29 79 59 97 11 37 63 51 39 55 91 23 21 17 47 23 35 75 49 5 69 99 5 7 41 17 25 89 15 79 21 63 53 81 43 91 59 91 69 99 85 15 91 51 49 37 65 7 89 81 21 93 61 63 97 93 45 17 13 69 57 25 75 73\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['100\\r\\n50 24 68 60 70 30 52 22 18 74 68 98 20 82 4 46 26 68 100 78 84 58 74 98 38 88 68 86 64 80 82 100 20 22 98 98 52 6 94 10 48 68 2 18 38 22 22 82 44 20 66 72 36 58 64 6 36 60 4 96 76 64 12 90 10 58 64 60 74 28 90 26 24 60 40 58 2 16 76 48 58 36 82 60 24 44 4 78 28 38 8 12 40 16 38 6 66 24 31 76\\r\\n'], 'output': ['99\\r\\n']}, {'input': ['100\\r\\n47 48 94 48 14 18 94 36 96 22 12 30 94 20 48 98 40 58 2 94 8 36 98 18 98 68 2 60 76 38 18 100 8 72 100 68 2 86 92 72 58 16 48 14 6 58 72 76 6 88 80 66 20 28 74 62 86 68 90 86 2 56 34 38 56 90 4 8 76 44 32 86 12 98 38 34 54 92 70 94 10 24 82 66 90 58 62 2 32 58 100 22 58 72 2 22 68 72 42 14\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['99\\r\\n38 20 68 60 84 16 28 88 60 48 80 28 4 92 70 60 46 46 20 34 12 100 76 2 40 10 8 86 6 80 50 66 12 34 14 28 26 70 46 64 34 96 10 90 98 96 56 88 50 74 70 94 2 94 24 66 68 46 22 30 6 10 64 32 88 14 98 100 64 58 50 18 50 50 8 38 8 16 54 2 60 54 62 84 92 98 4 72 66 26 14 88 99 16 10 6 88 56 22\\r\\n'], 'output': ['93\\r\\n']}, {'input': ['99\\r\\n50 83 43 89 53 47 69 1 5 37 63 87 95 15 55 95 75 89 33 53 89 75 93 75 11 85 49 29 11 97 49 67 87 11 25 37 97 73 67 49 87 43 53 97 43 29 53 33 45 91 37 73 39 49 59 5 21 43 87 35 5 63 89 57 63 47 29 99 19 85 13 13 3 13 43 19 5 9 61 51 51 57 15 89 13 97 41 13 99 79 13 27 97 95 73 33 99 27 23\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['98\\r\\n61 56 44 30 58 14 20 24 88 28 46 56 96 52 58 42 94 50 46 30 46 80 72 88 68 16 6 60 26 90 10 98 76 20 56 40 30 16 96 20 88 32 62 30 74 58 36 76 60 4 24 36 42 54 24 92 28 14 2 74 86 90 14 52 34 82 40 76 8 64 2 56 10 8 78 16 70 86 70 42 70 74 22 18 76 98 88 28 62 70 36 72 20 68 34 48 80 98\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['98\\r\\n66 26 46 42 78 32 76 42 26 82 8 12 4 10 24 26 64 44 100 46 94 64 30 18 88 28 8 66 30 82 82 28 74 52 62 80 80 60 94 86 64 32 44 88 92 20 12 74 94 28 34 58 4 22 16 10 94 76 82 58 40 66 22 6 30 32 92 54 16 76 74 98 18 48 48 30 92 2 16 42 84 74 30 60 64 52 50 26 16 86 58 96 79 60 20 62 82 94\\r\\n'], 'output': ['93\\r\\n']}, {'input': ['95\\r\\n9 31 27 93 17 77 75 9 9 53 89 39 51 99 5 1 11 39 27 49 91 17 27 79 81 71 37 75 35 13 93 4 99 55 85 11 23 57 5 43 5 61 15 35 23 91 3 81 99 85 43 37 39 27 5 67 7 33 75 59 13 71 51 27 15 93 51 63 91 53 43 99 25 47 17 71 81 15 53 31 59 83 41 23 73 25 91 91 13 17 25 13 55 57 29\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['100\\r\\n91 89 81 45 53 1 41 3 77 93 55 97 55 97 87 27 69 95 73 41 93 21 75 35 53 56 5 51 87 59 91 67 33 3 99 45 83 17 97 47 75 97 7 89 17 99 23 23 81 25 55 97 27 35 69 5 77 35 93 19 55 59 37 21 31 37 49 41 91 53 73 69 7 37 37 39 17 71 7 97 55 17 47 23 15 73 31 39 57 37 9 5 61 41 65 57 77 79 35 47\\r\\n'], 'output': ['26\\r\\n']}, {'input': ['99\\r\\n38 56 58 98 80 54 26 90 14 16 78 92 52 74 40 30 84 14 44 80 16 90 98 68 26 24 78 72 42 16 84 40 14 44 2 52 50 2 12 96 58 66 8 80 44 52 34 34 72 98 74 4 66 74 56 21 8 38 76 40 10 22 48 32 98 34 12 62 80 68 64 82 22 78 58 74 20 22 48 56 12 38 32 72 6 16 74 24 94 84 26 38 18 24 76 78 98 94 72\\r\\n'], 'output': ['56\\r\\n']}, {'input': ['100\\r\\n44 40 6 40 56 90 98 8 36 64 76 86 98 76 36 92 6 30 98 70 24 98 96 60 24 82 88 68 86 96 34 42 58 10 40 26 56 10 88 58 70 32 24 28 14 82 52 12 62 36 70 60 52 34 74 30 78 76 10 16 42 94 66 90 70 38 52 12 58 22 98 96 14 68 24 70 4 30 84 98 8 50 14 52 66 34 100 10 28 100 56 48 38 12 38 14 91 80 70 86\\r\\n'], 'output': ['97\\r\\n']}, {'input': ['100\\r\\n96 62 64 20 90 46 56 90 68 36 30 56 70 28 16 64 94 34 6 32 34 50 94 22 90 32 40 2 72 10 88 38 28 92 20 26 56 80 4 100 100 90 16 74 74 84 8 2 30 20 80 32 16 46 92 56 42 12 96 64 64 42 64 58 50 42 74 28 2 4 36 32 70 50 54 92 70 16 45 76 28 16 18 50 48 2 62 94 4 12 52 52 4 100 70 60 82 62 98 42\\r\\n'], 'output': ['79\\r\\n']}, {'input': ['99\\r\\n14 26 34 68 90 58 50 36 8 16 18 6 2 74 54 20 36 84 32 50 52 2 26 24 3 64 20 10 54 26 66 44 28 72 4 96 78 90 96 86 68 28 94 4 12 46 100 32 22 36 84 32 44 94 76 94 4 52 12 30 74 4 34 64 58 72 44 16 70 56 54 8 14 74 8 6 58 62 98 54 14 40 80 20 36 72 28 98 20 58 40 52 90 64 22 48 54 70 52\\r\\n'], 'output': ['25\\r\\n']}, {'input': ['95\\r\\n82 86 30 78 6 46 80 66 74 72 16 24 18 52 52 38 60 36 86 26 62 28 22 46 96 26 94 84 20 46 66 88 76 32 12 86 74 18 34 88 4 48 94 6 58 6 100 82 4 24 88 32 54 98 34 48 6 76 42 88 42 28 100 4 22 2 10 66 82 54 98 20 60 66 38 98 32 47 86 58 6 100 12 46 2 42 8 84 78 28 24 70 34 28 86\\r\\n'], 'output': ['78\\r\\n']}, {'input': ['90\\r\\n40 50 8 42 76 24 58 42 26 68 20 48 54 12 34 84 14 36 32 88 6 50 96 56 20 92 48 16 40 34 96 46 20 84 30 50 20 98 8 44 96 42 8 76 70 38 84 30 40 88 84 72 2 22 52 58 16 62 100 66 80 40 50 32 14 62 88 72 22 99 76 50 84 82 8 82 98 46 26 40 2 98 18 78 30 72 70 18 34 68\\r\\n'], 'output': ['70\\r\\n']}, {'input': ['80\\r\\n81 43 87 1 55 43 53 61 27 19 43 13 89 9 33 83 75 55 97 71 91 37 95 5 21 69 81 93 95 69 31 83 55 7 97 7 79 57 8 61 27 85 49 1 15 97 63 79 29 73 41 85 5 41 31 93 67 11 63 59 15 99 91 77 43 69 23 23 81 73 19 1 67 51 1 75 99 67 3 81\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['98\\r\\n13 83 61 27 35 1 85 95 97 73 95 65 73 45 5 43 27 83 91 19 11 3 85 59 9 39 69 23 45 7 51 85 5 71 5 95 1 51 75 3 43 57 3 11 33 71 21 99 47 41 87 39 71 87 31 85 91 49 83 5 49 85 47 91 55 99 33 23 31 23 23 73 29 77 55 31 25 5 81 49 91 15 15 39 87 5 9 40 69 47 29 33 11 21 49 79 51 83\\r\\n'], 'output': ['88\\r\\n']}, {'input': ['3\\r\\n100 100 1\\r\\n'], 'output': ['3\\r\\n']}]","id":528} {"difficulty":1200,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"27_A","execute_outcome":"WRONG_ANSWER","source_code":"fn scan_str() -> String {\n let mut n = String::new();\n std::io::stdin().read_line(&mut n).unwrap();\n n\n}\nfn main() {\n let hours: usize = scan_str().trim().parse().unwrap();\n let array : Vec = scan_str().trim().split_whitespace().map(|x| x.parse().unwrap()).collect();\n let mut op = array[hours-1];\n\n loop {\n if !array.contains(&(op + 1)) {\n println!(\"{}\",op +1);\n break;\n }\n else {\n op +=1;\n }\n }\n}\n \n\n \t \t \t\t \t\t\t \t\t \t\t\t\t \t \t \t \t","description":"\u00abPolygon\u00bb is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test.You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests.","input_specification":"The first line contains one integer n (1\u2264n\u22643000) \u2014 the amount of previously added tests. The second line contains n distinct integers a1,a2,...,an (1\u2264ai\u22643000) \u2014 indexes of these tests.\n","output_specification":"Output the required default value for the next test index.\n","notes":null,"sample_inputs":["3\n1 7 2\n"],"sample_outputs":["3\n"],"human_solution":"use std::collections::HashSet;\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! read {\r\n ($out:ident as $type:ty) => {\r\n let mut inner = String::new();\r\n std::io::stdin().read_line(&mut inner).expect(\"A string\");\r\n let $out = inner.trim().parse::<$type>().expect(\"A parsable\");\r\n };\r\n}\r\n#[allow(unused_macros)]\r\nmacro_rules! read_str {\r\n ($out:ident) => {\r\n let mut inner = String::new();\r\n std::io::stdin().read_line(&mut inner).expect(\"A string\");\r\n let $out = inner.trim();\r\n };\r\n}\r\n#[allow(unused_macros)]\r\nmacro_rules! read_vec {\r\n ($out:ident as $type:ty) => {\r\n let mut inner = String::new();\r\n std::io::stdin().read_line(&mut inner).expect(\"A string\");\r\n let $out = inner\r\n .trim()\r\n .split_whitespace()\r\n .map(|s| s.parse::<$type>().unwrap())\r\n .collect::>();\r\n };\r\n}\r\nfn solve() {\r\n let mut hs = (1..3001).collect::>();\r\n read!(_n as i32);\r\n read_vec!(arr as i32);\r\n let ans = 3001;\r\n for c in arr {\r\n if hs.contains(&c) {\r\n hs.remove(&c);\r\n }\r\n }\r\n let mut hs = hs.drain().collect::>();\r\n hs.sort();\r\n match hs.iter().next() {\r\n Some(v) => println!(\"{}\", v),\r\n None => println!(\"{}\", ans),\r\n }\r\n}\r\nfn main() {\r\n let t = 1;\r\n \/\/read!(t as i32);\r\n let mut t = t;\r\n while t > 0 {\r\n solve();\r\n t -= 1;\r\n }\r\n}\r\n","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n3 4 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n6 4 3 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3 2 1 7 4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['6\\r\\n4 1 2 5 3 7\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['7\\r\\n3 2 1 6 5 7 4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['8\\r\\n2 8 3 7 6 9 1 5\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['9\\r\\n10 5 9 3 8 7 1 2 4\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10\\r\\n7 2 3 8 9 6 5 4 1 10\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n2 4 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n4 2 3 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5\\r\\n3 1 4 2 5\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['6\\r\\n1 3 6 7 2 4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['7\\r\\n1 5 4 7 2 3 6\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['8\\r\\n12 1 6 5 2 8 3 4\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['9\\r\\n3 2 7 5 6 4 1 9 10\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['10\\r\\n1 7 13 6 5 10 3 8 2 4\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n3000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n3000 1\\r\\n'], 'output': ['2\\r\\n']}]","id":529} {"difficulty":1000,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"37_A","execute_outcome":"RUNTIME_ERROR","source_code":"use std::collections::HashMap;\r\nuse std::io;\r\n\r\nfn main() {\r\n \/\/ Read input\r\n let mut input = String::new();\r\n io::stdin().read_line(&mut input).expect(\"Failed to read input\");\r\n \r\n let n: usize = input.trim().parse().expect(\"Invalid input\");\r\n \r\n let mut input = String::new();\r\n io::stdin().read_line(&mut input).expect(\"Failed to read input\");\r\n \r\n let lengths: Vec = input\r\n .split_whitespace()\r\n .map(|x| x.parse().expect(\"Invalid input\"))\r\n .collect();\r\n \r\n \/\/ Create a HashMap to count the occurrences of each length\r\n let mut length_count = HashMap::new();\r\n \r\n for &length in &lengths {\r\n *length_count.entry(length).or_insert(0) += 1;\r\n }\r\n \r\n \/\/ Find the maximum count and the total number of distinct lengths\r\n let (max_count, distinct_lengths) = length_count\r\n .iter()\r\n .map(|(&length, &count)| (count, length))\r\n .max()\r\n .unwrap();\r\n \r\n println!(\"{} {}\", max_count, distinct_lengths);\r\n}\r\n","description":"Little Vasya has received a young builder\u2019s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the same.Vasya wants to construct the minimal number of towers from the bars. Help Vasya to use the bars in the best way possible.","input_specification":"The first line contains an integer N (1\u2264N\u22641000) \u2014 the number of bars at Vasya\u2019s disposal. The second line contains N space-separated integers li \u2014 the lengths of the bars. All the lengths are natural numbers not exceeding 1000.\n","output_specification":"In one line output two numbers \u2014 the height of the largest tower and their total number. Remember that Vasya should use all the bars.\n","notes":null,"sample_inputs":["3\n1 2 3\n","4\n6 5 6 7\n"],"sample_outputs":["1 3\n","2 3\n"],"human_solution":"use std::io::{Stdout, stdout, Write, BufWriter};\n\n\n#[derive(Default)]\nstruct Scanner {\n buffer: Vec\n}\n\nimpl Scanner {\n fn next(&mut self) -> T {\n loop {\n if let Some(token) = self.buffer.pop() {\n return token.parse().ok().expect(\"Failed parsing\");\n }\n let mut line: String = String::new();\n std::io::stdin().read_line(&mut line).expect(\"Failed reading\");\n self.buffer = line.split_whitespace().rev().map(String::from).collect();\n }\n }\n\n fn nexts(&mut self, count: usize) -> Vec {\n (0..count).map(|_| self.next::()).collect()\n }\n}\n\n\nfn solution() {\n let mut input: Scanner = Scanner::default();\n let mut output: BufWriter = BufWriter::new(stdout());\n\n let bar_count: usize = input.next::();\n let mut bars: Vec = input.nexts::(bar_count);\n bars.sort();\n\n let mut height: usize = 1;\n let mut max_length: usize = 0;\n\n let mut i: usize = 0;\n while i < bar_count {\n let mut j = i + 1;\n while j < bar_count {\n if bars[i] != bars[j] {\n height += 1;\n break;\n }\n\n j += 1;\n }\n\n if max_length < j - i {\n max_length = j - i;\n }\n\n i = j;\n }\n\n writeln!(output, \"{0} {1}\", max_length, height).ok();\n}\n\n\nfn main() {\n solution();\n}\n","testcases":"[{'input': ['3\\r\\n1 2 3\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['4\\r\\n6 5 6 7\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['4\\r\\n3 2 1 1\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['4\\r\\n1 2 3 3\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['3\\r\\n20 22 36\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['25\\r\\n47 30 94 41 45 20 96 51 110 129 24 116 9 47 32 82 105 114 116 75 154 151 70 42 162\\r\\n'], 'output': ['2 23\\r\\n']}, {'input': ['45\\r\\n802 664 442 318 318 827 417 878 711 291 231 414 807 553 657 392 279 202 386 606 465 655 658 112 887 15 25 502 95 44 679 775 942 609 209 871 31 234 4 231 150 110 22 823 193\\r\\n'], 'output': ['2 43\\r\\n']}, {'input': ['63\\r\\n93 180 116 7 8 179 268 279 136 94 221 153 264 190 278 19 19 63 153 26 158 225 25 49 89 218 111 149 255 225 197 122 243 80 3 224 107 178 202 17 53 92 69 42 228 24 81 205 95 8 265 82 228 156 127 241 172 159 106 60 67 155 111\\r\\n'], 'output': ['2 57\\r\\n']}, {'input': ['83\\r\\n246 535 994 33 390 927 321 97 223 922 812 705 79 80 977 457 476 636 511 137 6 360 815 319 717 674 368 551 714 628 278 713 761 553 184 414 623 753 428 214 581 115 439 61 677 216 772 592 187 603 658 310 439 559 870 376 109 321 189 337 277 26 70 734 796 907 979 693 570 227 345 650 737 633 701 914 134 403 972 940 371 6 642\\r\\n'], 'output': ['2 80\\r\\n']}, {'input': ['105\\r\\n246 57 12 204 165 123 246 68 191 310 3 152 386 333 374 257 158 104 333 50 80 290 8 340 101 76 221 316 388 289 138 359 316 26 93 290 105 178 81 195 41 196 218 180 244 292 187 97 315 323 174 119 248 239 92 312 31 2 101 180 307 170 338 314 163 281 217 31 142 238 280 190 190 156 70 74 329 113 151 8 141 313 366 40 253 116 168 124 135 230 294 266 353 389 371 359 195 200 183 237 93 102 315 118 188\\r\\n'], 'output': ['2 92\\r\\n']}, {'input': ['123\\r\\n112 277 170 247 252 115 157 293 256 143 196 90 12 164 164 42 8 223 167 109 175 232 239 111 148 51 9 254 93 32 268 162 231 91 47 162 161 191 195 145 247 292 129 199 230 94 144 217 18 205 176 20 143 198 121 243 211 262 230 277 195 255 108 290 220 275 158 2 286 200 60 267 278 207 123 150 123 116 131 13 12 226 33 244 30 275 263 45 158 192 254 149 242 176 62 224 221 288 250 160 155 225 132 143 276 293 218 145 197 175 33 129 79 206 210 192 222 262 190 52 274 243 233\\r\\n'], 'output': ['3 101\\r\\n']}, {'input': ['5\\r\\n5 5 5 5 5\\r\\n'], 'output': ['5 1\\r\\n']}, {'input': ['3\\r\\n1000 1000 1000\\r\\n'], 'output': ['3 1\\r\\n']}, {'input': ['1\\r\\n1000\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['5\\r\\n1 1000 1000 1000 1000\\r\\n'], 'output': ['4 2\\r\\n']}, {'input': ['5\\r\\n1000 1000 1000 8 7\\r\\n'], 'output': ['3 3\\r\\n']}]","id":530} {"difficulty":1500,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"39_J","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"use std::fmt::Write as OtherWrite;\nuse std::io::{self, Write};\nuse std::io::{stdin, stdout};\nuse std::string;\n\nfn main() -> Result<(), io::Error> {\n let reader = stdin();\n let mut writer = stdout().lock();\n let mut lines = reader.lines();\n let s1 = lines.next().unwrap().unwrap();\n let s2 = lines.next().unwrap().unwrap();\n if let Some((index, repeat)) = solve(s1, s2) {\n writeln!(writer, \"{repeat}\")?;\n writeln!(\n writer,\n \"{}\",\n (index + 1..index + 1 + repeat)\n .map(|i| i.to_string())\n .collect::>()\n .join(\" \")\n )?;\n } else {\n writeln!(writer, \"{}\", 0)?;\n }\n Ok(())\n}\n\nfn solve(s1: String, s2: String) -> Option<(usize, usize)> {\n let mut iter2 = s2.chars().peekable();\n let mut result_index = None;\n for (i, c1) in s1.chars().enumerate() {\n if let Some(&c2) = iter2.peek() {\n if c1 != c2 {\n if result_index.is_some() {\n return None;\n } else {\n result_index = Some(i);\n }\n } else {\n iter2.next();\n }\n } else {\n if (s1.chars().skip(i + 1).next()) == None {\n return Some((i, 1));\n } else {\n return None;\n }\n }\n }\n let result_index = result_index?;\n let mut iter1 = s1.chars().skip(result_index);\n let c_result = iter1.next().unwrap();\n return Some((\n result_index,\n iter1.take_while(|&c| c_result == c).count() + 1,\n ));\n}\n","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 10^6 symbols inclusive, the first string contains exactly 1 symbol more than the second one.\n","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.\n","notes":null,"sample_inputs":["abdrakadabra\nabrakadabra\n","aa\na\n","competition\ncodeforces\n"],"sample_outputs":["1\n3\n","2\n1 2\n","0\n"],"human_solution":"use std::io;\n\nfn main(){\n\n let mut s1 = String::new();\n let mut s2 = String::new();\n\n io::stdin().read_line(&mut s1).expect(\"Failed to read line\");\n io::stdin().read_line(&mut s2).expect(\"Failed to read line\");\n\n s1 = s1.trim().to_owned();\n s2 = s2.trim().to_owned();\n\n\n let s1_len = s1.len();\n\n let prefix = prefix_length(&s1, &s2);\n let suffix = suffix_length(&s1, &s2);\n\n let mut total: i32 = (prefix as i32 + 1) - (s1_len as i32 - suffix as i32) + 1;\n\n if total < 0 {\n total = 0;\n }\n\n println!(\"{}\",total);\n\n for i in 0..total{\n print!(\"{}\",s1_len - suffix + i as usize + 1);\n if i < total-1{\n print!(\" \");\n }else{\n println!();\n }\n }\n\n\n}\n\n\nfn prefix_length(s1: &String, s2: &String) -> usize {\n\n let s1_bytes = s1.as_bytes();\n let s2_bytes = s2.as_bytes();\n\n let s2_len = s2.len();\n\n let mut i: usize = 0;\n while i < s2_len && s1_bytes[i] == s2_bytes[i] {\n i+=1;\n }\n\n return i-1;\n}\n\n\nfn suffix_length(s1: &String, s2: &String) -> usize {\n\n let s1_bytes = s1.as_bytes();\n let s2_bytes = s2.as_bytes();\n\n let s1_len = s1.len();\n\n let mut i: usize = s1_len - 1;\n\n while i > 0 && s1_bytes[i] == s2_bytes[i-1] {\n i-=1;\n }\n\n return s1_len - i;\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":531} {"difficulty":1000,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"43_A","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io;\r\nuse std::collections::HashMap;\r\n\r\n\/* v1, faster but less about what we need to learn\r\nstruct TeamScore {\r\n name : String,\r\n score: usize\r\n}\r\n\r\nfn main() {\r\n let handle = io::stdin();\r\n let mut buf = String::new();\r\n handle.read_line(&mut buf).unwrap();\r\n\r\n let n : usize = buf.trim().parse().unwrap();\r\n\r\n buf.clear();\r\n handle.read_line(&mut buf).unwrap();\r\n let mut team1 = TeamScore{ name: buf.trim().to_string(), score: 1};\r\n buf.clear();\r\n let mut team2 = TeamScore{ name: String::new(), score: 0};\r\n for _ in 1..n {\r\n handle.read_line(&mut buf).unwrap();\r\n if buf.trim() == team1.name {\r\n team1.score += 1;\r\n } else {\r\n if team2.name.len() == 0 {\r\n team2.name = buf.trim().to_string();\r\n }\r\n team2.score += 1;\r\n }\r\n\r\n buf.clear();\r\n }\r\n\r\n if team1.score > team2.score {\r\n println!(\"{}\", team1.name);\r\n } else {\r\n println!(\"{}\", team2.name);\r\n }\r\n}\r\n*\/\r\n\r\nfn main() {\r\n let mut scores : HashMap = HashMap::new();\r\n let handle = io::stdin();\r\n let mut buf = String::new();\r\n handle.read_line(&mut buf).unwrap();\r\n\r\n let n : usize = buf.trim().parse().unwrap();\r\n\r\n for _ in 0..n {\r\n handle.read_line(&mut buf).unwrap();\r\n *scores.entry(buf.trim().to_string()).or_default() += 1;\r\n buf.clear();\r\n }\r\n\r\n let entry = scores.iter().max_by_key(|&(_k,v)| v).unwrap();\r\n println!(\"{}\", entry.0);\r\n}\r\n","description":"One day Vasya decided to have a look at the results of Berland 1910 Football Championship\u2019s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Every goal was marked with the name of the team that had scored it. Help Vasya, learn the name of the team that won the finals. It is guaranteed that the match did not end in a tie.","input_specification":"The first line contains an integer n (1\u2264n\u2264100) \u2014 the number of lines in the description. Then follow n lines \u2014 for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end in a tie and the description contains no more than two different teams.\n","output_specification":"Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.\n","notes":null,"sample_inputs":["1\nABC\n","5\nA\nABA\nABA\nA\nA\n"],"sample_outputs":["ABC\n","A\n"],"human_solution":"#![allow(unused)]\r\nuse std::io::{stdin, stdout};\r\n\r\nfn input() -> String {\r\n let mut buf: String = String::new();\r\n stdin().read_line(&mut buf);\r\n buf.trim().to_owned()\r\n}\r\n\r\nfn int_input() -> i32 {\r\n input().parse::().unwrap()\r\n}\r\n\r\nfn vec_input() -> Vec {\r\n input().split_whitespace().map(|i| i.parse::().unwrap()).collect::>()\r\n}\r\n\r\nfn main() {\r\n let mut n = int_input();\r\n let mut arr = vec![];\r\n for _ in 0..n {\r\n arr.push(input());\r\n }\r\n arr.sort();\r\n println!(\"{}\", arr[(n\/2) as usize]);\r\n}","testcases":"[{'input': ['1\\r\\nABC\\r\\n'], 'output': ['ABC\\r\\n']}, {'input': ['5\\r\\nA\\r\\nABA\\r\\nABA\\r\\nA\\r\\nA\\r\\n'], 'output': ['A\\r\\n']}, {'input': ['2\\r\\nXTSJEP\\r\\nXTSJEP\\r\\n'], 'output': ['XTSJEP\\r\\n']}, {'input': ['3\\r\\nXZYDJAEDZ\\r\\nXZYDJAEDZ\\r\\nXZYDJAEDZ\\r\\n'], 'output': ['XZYDJAEDZ\\r\\n']}, {'input': ['3\\r\\nQCCYXL\\r\\nQCCYXL\\r\\nAXGLFQDD\\r\\n'], 'output': ['QCCYXL\\r\\n']}, {'input': ['3\\r\\nAZID\\r\\nEERWBC\\r\\nEERWBC\\r\\n'], 'output': ['EERWBC\\r\\n']}, {'input': ['3\\r\\nHNCGYL\\r\\nHNCGYL\\r\\nHNCGYL\\r\\n'], 'output': ['HNCGYL\\r\\n']}, {'input': ['4\\r\\nZZWZTG\\r\\nZZWZTG\\r\\nZZWZTG\\r\\nZZWZTG\\r\\n'], 'output': ['ZZWZTG\\r\\n']}, {'input': ['4\\r\\nA\\r\\nA\\r\\nKUDLJMXCSE\\r\\nA\\r\\n'], 'output': ['A\\r\\n']}, {'input': ['5\\r\\nPHBTW\\r\\nPHBTW\\r\\nPHBTW\\r\\nPHBTW\\r\\nPHBTW\\r\\n'], 'output': ['PHBTW\\r\\n']}, {'input': ['5\\r\\nPKUZYTFYWN\\r\\nPKUZYTFYWN\\r\\nSTC\\r\\nPKUZYTFYWN\\r\\nPKUZYTFYWN\\r\\n'], 'output': ['PKUZYTFYWN\\r\\n']}, {'input': ['5\\r\\nHH\\r\\nHH\\r\\nNTQWPA\\r\\nNTQWPA\\r\\nHH\\r\\n'], 'output': ['HH\\r\\n']}, {'input': ['10\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nD\\r\\nW\\r\\nD\\r\\nD\\r\\nW\\r\\n'], 'output': ['W\\r\\n']}, {'input': ['19\\r\\nXBCP\\r\\nTGACNIH\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nTGACNIH\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nXBCP\\r\\nTGACNIH\\r\\nXBCP\\r\\nXBCP\\r\\nTGACNIH\\r\\nTGACNIH\\r\\nXBCP\\r\\n'], 'output': ['XBCP\\r\\n']}, {'input': ['33\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\nPYPAS\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\nOWQWCKLLF\\r\\nPYPAS\\r\\nPYPAS\\r\\n'], 'output': ['PYPAS\\r\\n']}, {'input': ['51\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\nNC\\r\\n'], 'output': ['NC\\r\\n']}, {'input': ['89\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nVOCI\\r\\nH\\r\\nH\\r\\nH\\r\\nH\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nH\\r\\nVOCI\\r\\nVOCI\\r\\n'], 'output': ['VOCI\\r\\n']}, {'input': ['100\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nM\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\nHA\\r\\n'], 'output': ['HA\\r\\n']}, {'input': ['100\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nG\\r\\nG\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nG\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\nS\\r\\nG\\r\\nS\\r\\nS\\r\\nS\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\nG\\r\\nG\\r\\nG\\r\\nS\\r\\n'], 'output': ['G\\r\\n']}, {'input': ['100\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nOBH\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\nWL\\r\\n'], 'output': ['WL\\r\\n']}]","id":532} {"difficulty":1300,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"4_C","execute_outcome":"WRONG_ANSWER","source_code":"use std::collections::HashMap;\r\nuse std::io;\r\n\r\nfn main() {\r\n let mut name_count = HashMap::new();\r\n let mut names = Vec::new();\r\n\r\n let mut n = String::new();\r\n io::stdin().read_line(&mut n).unwrap();\r\n let n = n.trim().parse::().unwrap();\r\n\r\n for _ in 0..n {\r\n let mut name = String::new();\r\n io::stdin().read_line(&mut name).unwrap();\r\n let name = name.trim().to_owned();\r\n\r\n let count = name_count.entry(name.clone()).or_insert(0);\r\n *count += 1;\r\n\r\n let formatted_name = if *count > 1 {\r\n format!(\"{}({})\", name, count)\r\n } else {\r\n name\r\n };\r\n\r\n names.push(formatted_name);\r\n }\r\n\r\n for name in names {\r\n println!(\"{}\", name);\r\n }\r\n}\r\n","description":"A new e-mail service \"Berlandesk\" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of site registration system. The system should work on the following principle. Each time a new user wants to register, he sends to the system a request with his name. If such a name does not exist in the system database, it is inserted into the database, and the user gets the response OK, confirming the successful registration. If the name already exists in the system database, the system makes up a new user name, sends it to the user as a prompt and also inserts the prompt into the database. The new name is formed by the following rule. Numbers, starting with 1, are appended one after another to name (name1, name2, ...), among these numbers the least i is found so that namei does not yet exist in the database.","input_specification":"The first line contains number n (1\u2264n\u226410^5). The following n lines contain the requests to the system. Each request is a non-empty line, and consists of not more than 32 characters, which are all lowercase Latin letters.\n","output_specification":"Print n lines, which are system responses to the requests: OK in case of successful registration, or a prompt with a new name, if the requested name is already taken.\n","notes":null,"sample_inputs":["4\nabacaba\nacaba\nabacaba\nacab\n","6\nfirst\nfirst\nsecond\nsecond\nthird\nthird\n"],"sample_outputs":["OK\nOK\nabacaba1\nOK\n","OK\nfirst1\nOK\nsecond1\nOK\nthird1\n"],"human_solution":"use std::{collections::HashMap, io::BufRead};\r\n\r\n\/**\r\n * C. Registration system\r\n * time limit per test: 5 seconds\r\n * memory limit per test: 64 megabytes\r\n * input: standard input\r\n * output: standard output\r\n *\r\n * A new e-mail service \"Berlandesk\" is going to be opened in Berland in the near future. The site administration wants to\r\n * launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of\r\n * site registration system. The system should work on the following principle.\r\n *\r\n * Each time a new user wants to register, he sends to the system a request with his name. If such a name does not exist in\r\n * the system database, it is inserted into the database, and the user gets the response OK, confirming the successful\r\n * registration. If the name already exists in the system database, the system makes up a new user name, sends it to the\r\n * user as a prompt and also inserts the prompt into the database. The new name is formed by the following rule. Numbers,\r\n * starting with 1, are appended one after another to name (name1, name2, ...), among these numbers the least i is found so\r\n * that namei does not yet exist in the database.\r\n *\r\n * Input\r\n * The first line contains number n (1\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089n\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089105). The following n lines contain the requests to the system. Each request is\r\n * a non-empty line, and consists of not more than 32 characters, which are all lowercase Latin letters.\r\n *\r\n * Output\r\n * Print n lines, which are system responses to the requests: OK in case of successful registration, or a prompt with a new\r\n * name, if the requested name is already taken.\r\n *\r\n * Examples\r\n * Input\r\n * 4\r\n * abacaba\r\n * acaba\r\n * abacaba\r\n * acab\r\n *\r\n * Output\r\n * OK\r\n * OK\r\n * abacaba1\r\n * OK\r\n *\r\n * Input\r\n * 6\r\n * first\r\n * first\r\n * second\r\n * second\r\n * third\r\n * third\r\n *\r\n * Output\r\n * OK\r\n * first1\r\n * OK\r\n * second1\r\n * OK\r\n * third1\r\n *\/\r\nfn main() {\r\n let stdin = std::io::stdin();\r\n let mut lines = stdin.lock().lines();\r\n\r\n let mut names: HashMap = HashMap::new();\r\n let n: usize = lines.next().unwrap().unwrap().parse().unwrap();\r\n for line in lines.take(n) {\r\n let line = line.unwrap();\r\n\r\n if let Some(id) = names.get_mut(&line) {\r\n println!(\"{line}{id}\");\r\n *id += 1;\r\n } else {\r\n println!(\"OK\");\r\n names.insert(line, 1);\r\n }\r\n }\r\n}\r\n","testcases":"[{'input': ['4\\r\\nabacaba\\r\\nacaba\\r\\nabacaba\\r\\nacab\\r\\n'], 'output': ['OK\\r\\nOK\\r\\nabacaba1\\r\\nOK\\r\\n']}, {'input': ['6\\r\\nfirst\\r\\nfirst\\r\\nsecond\\r\\nsecond\\r\\nthird\\r\\nthird\\r\\n'], 'output': ['OK\\r\\nfirst1\\r\\nOK\\r\\nsecond1\\r\\nOK\\r\\nthird1\\r\\n']}, {'input': ['1\\r\\nn\\r\\n'], 'output': ['OK\\r\\n']}, {'input': ['2\\r\\nu\\r\\nu\\r\\n'], 'output': ['OK\\r\\nu1\\r\\n']}, {'input': ['3\\r\\nb\\r\\nb\\r\\nb\\r\\n'], 'output': ['OK\\r\\nb1\\r\\nb2\\r\\n']}, {'input': ['2\\r\\nc\\r\\ncn\\r\\n'], 'output': ['OK\\r\\nOK\\r\\n']}, {'input': ['3\\r\\nvhn\\r\\nvhn\\r\\nh\\r\\n'], 'output': ['OK\\r\\nvhn1\\r\\nOK\\r\\n']}, {'input': ['4\\r\\nd\\r\\nhd\\r\\nd\\r\\nh\\r\\n'], 'output': ['OK\\r\\nOK\\r\\nd1\\r\\nOK\\r\\n']}, {'input': ['10\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\nbhnqaptmp\\r\\n'], 'output': ['OK\\r\\nbhnqaptmp1\\r\\nbhnqaptmp2\\r\\nbhnqaptmp3\\r\\nbhnqaptmp4\\r\\nbhnqaptmp5\\r\\nbhnqaptmp6\\r\\nbhnqaptmp7\\r\\nbhnqaptmp8\\r\\nbhnqaptmp9\\r\\n']}, {'input': ['10\\r\\nfpqhfouqdldravpjttarh\\r\\nfpqhfouqdldravpjttarh\\r\\nfpqhfouqdldravpjttarh\\r\\nfpqhfouqdldravpjttarh\\r\\nfpqhfouqdldravpjttarh\\r\\nfpqhfouqdldravpjttarh\\r\\njmvlplnrmba\\r\\nfpqhfouqdldravpjttarh\\r\\njmvlplnrmba\\r\\nfpqhfouqdldravpjttarh\\r\\n'], 'output': ['OK\\r\\nfpqhfouqdldravpjttarh1\\r\\nfpqhfouqdldravpjttarh2\\r\\nfpqhfouqdldravpjttarh3\\r\\nfpqhfouqdldravpjttarh4\\r\\nfpqhfouqdldravpjttarh5\\r\\nOK\\r\\nfpqhfouqdldravpjttarh6\\r\\njmvlplnrmba1\\r\\nfpqhfouqdldravpjttarh7\\r\\n']}, {'input': ['10\\r\\niwexcrupuubwzbooj\\r\\niwexcrupuubwzbooj\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi\\r\\niwexcrupuubwzbooj\\r\\niwexcrupuubwzbooj\\r\\niwexcrupuubwzbooj\\r\\n'], 'output': ['OK\\r\\niwexcrupuubwzbooj1\\r\\nOK\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi1\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi2\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi3\\r\\njzsyjnxttliyfpunxyhsouhunenzxedi4\\r\\niwexcrupuubwzbooj2\\r\\niwexcrupuubwzbooj3\\r\\niwexcrupuubwzbooj4\\r\\n']}, {'input': ['10\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n'], 'output': ['OK\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz1\\r\\nOK\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz1\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz2\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz3\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz4\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz2\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz3\\r\\nzzzzzzzzzzzzzzzzzzzzzzzzzzz4\\r\\n']}, {'input': ['20\\r\\nzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzz\\r\\nzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nz\\r\\nzzzzzzzzz\\r\\nzzzzzzzzz\\r\\nzzzzzzzzzzzzz\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n'], 'output': ['OK\\r\\nOK\\r\\nOK\\r\\nzzzzzzzzzzzzz1\\r\\nzzzzzzzzz1\\r\\nzzzzzzzzz2\\r\\nzzzzzzzzzzzzz2\\r\\nzzzzzzzzzzzzz3\\r\\nOK\\r\\nzzzzzzzzzzzzz4\\r\\nzzzzzzzzzzzzz5\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz1\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz2\\r\\nzzzzzzzzzzzzz6\\r\\nzzzzzzzzzzzzz7\\r\\nz1\\r\\nzzzzzzzzz3\\r\\nzzzzzzzzz4\\r\\nzzzzzzzzzzzzz8\\r\\nzzzzzzzzzzzzzzzzzzzzzzzz3\\r\\n']}]","id":533} {"difficulty":900,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"52_A","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io;\r\n\r\nfn main() -> io::Result<()> {\r\n let mut input = String::new();\r\n io::stdin().read_line(&mut input).unwrap();\r\n\r\n let n : usize = input.trim().parse().unwrap();\r\n \r\n let mut v : Vec<_> = vec![0;n];\r\n for i in 0..n {\r\n input.clear();\r\n io::stdin().read_line(&mut input).unwrap();\r\n v[i] = input.trim().parse::().unwrap();\r\n \r\n }\r\n let mut one = 0;\r\n let mut two = 0;\r\n let mut three = 0;\r\n for i in v {\r\n if i == 1 {\r\n one+=1;\r\n } else if i == 2 {\r\n two+=1;\r\n } else {\r\n three+=1;\r\n }\r\n }\r\n\r\n \r\n println!(\"{}\",one+two+three - one.max(two).max(three));\r\n Ok(())\r\n \r\n}","description":"There is a given sequence of integers a1,a2,...,an, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other.","input_specification":"The first line contains an integer n (1\u2264n\u226410^6). The second line contains a sequence of integers a1,a2,...,an (1\u2264ai\u22643).\n","output_specification":"Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal.\n","notes":"In the example all the numbers equal to 1 and 3 should be replaced by 2.\n","sample_inputs":["9\n1 3 2 2 2 1 1 2 3\n"],"sample_outputs":["5\n"],"human_solution":"use std::collections::HashSet;\n\nfn main() {\n let mut n = String::new();\n std::io::stdin().read_line(&mut n).unwrap();\n let n: u64 = n.trim().parse().unwrap();\n\n let mut a = String::new();\n std::io::stdin().read_line(&mut a).unwrap();\n let a: Vec = a.split_whitespace().map(|x| x.parse().unwrap()).collect();\n let s: HashSet<&u32> = HashSet::from_iter(a.iter().clone());\n\n let mut m: u64 = 0;\n\n for &e in s.iter() {\n m = [m, a.iter().filter(|&x| *x == *e).count() as u64]\n .iter()\n .max()\n .unwrap()\n .clone();\n }\n\n println!(\"{}\", n - m);\n}\n","testcases":"[{'input': ['9\\r\\n1 3 2 2 2 1 1 2 3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['6\\r\\n3 3 2 2 1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n3 1 3 1 2 1 3 2 2 1 2 1\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['15\\r\\n3 2 1 1 1 1 3 2 2 3 3 1 2 3 2\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n3 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n3 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['18\\r\\n2 3 2 1 2 3 2 1 2 3 3 3 1 2 3 3 3 2\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['30\\r\\n2 1 3 2 3 2 2 2 2 3 2 2 3 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n3\\r\\n'], 'output': ['0\\r\\n']}]","id":534} {"difficulty":800,"lang":"Rust","lang_cluster":"Rust","src_uid":"69850c2af99d60711bcff5870575e15e","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io;\n\nfn main() { \n let mut buf = String::new();\n let mut n: usize = 0;\n let reader = io::stdin();\n reader.read_line(&mut buf);\n n = buf.trim().parse()\n .expect(\" \");\n let mut v = vec![0;n-1]; \n buf.clear();\n reader.read_line(&mut buf);\n let it = buf.trim().split(\" \");\n let mut ct = 0; \n for sub in it{\n v[ct] = sub.trim().parse()\n .expect(\" \");\n ct += 1;\n }\n buf.clear();\n reader.read_line(&mut buf);\n let wv = buf.trim().split(\" \").collect::>();\n let a:i32 = wv[0].parse().expect(\" \");\n let b:i32 = wv[1].parse().expect(\" \");\n let mut ans: u32 = 0; \n for i in (a-1)..=(b-2){\n ans += v[i as usize];\n }\n println!(\"{}\",ans);\n} \n","description":"The Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.One needs exactly di years to rise from rank i to rank i\u2009+\u20091. Reaching a certain rank i having not reached all the previous i\u2009-\u20091 ranks is impossible.Vasya has just reached a new rank of a, but he dreams of holding the rank of b. Find for how many more years Vasya should serve in the army until he can finally realize his dream.","input_specification":"The first input line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100). The second line contains n\u2009-\u20091 integers di (1\u2009\u2264\u2009di\u2009\u2264\u2009100). The third input line contains two integers a and b (1\u2009\u2264\u2009a\u2009<\u2009b\u2009\u2264\u2009n). The numbers on the lines are space-separated.","output_specification":"Print the single number which is the number of years that Vasya needs to rise from rank a to rank b.","notes":null,"sample_inputs":["3\n5 6\n1 2","3\n5 6\n1 3"],"sample_outputs":["5","11"],"human_solution":"use std::io;\n\nfn main() { \n let mut buf = String::new();\n let mut n: usize = 0;\n let reader = io::stdin();\n reader.read_line(&mut buf);\n n = buf.trim().parse()\n .expect(\" \");\n let mut v = vec![0;n-1]; \n \n let mut buf2 = String::new();\n reader.read_line(&mut buf2);\n let it = buf2.trim().split(\" \");\n let mut ct = 0; \n for sub in it{\n v[ct] = sub.trim().parse()\n .expect(\" \");\n ct += 1;\n }\n\n let mut buf3 = String::new();\n reader.read_line(&mut buf3);\n let wv = buf3.trim().split(\" \").collect::>();\n let a:i32 = wv[0].parse().expect(\" \");\n let b:i32 = wv[1].parse().expect(\" \");\n let mut ans: u32 = 0; \n for i in (a-1)..=(b-2){\n ans += v[i as usize];\n }\n println!(\"{}\",ans);\n} \n","testcases":"[{'input': '3\\r\\n5 6\\r\\n1 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '3\\r\\n5 6\\r\\n1 3\\r\\n', 'output': ['11\\r\\n']}, {'input': '2\\r\\n55\\r\\n1 2\\r\\n', 'output': ['55\\r\\n']}, {'input': '3\\r\\n85 78\\r\\n1 3\\r\\n', 'output': ['163\\r\\n']}, {'input': '4\\r\\n63 4 49\\r\\n2 3\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n93 83 42 56\\r\\n2 5\\r\\n', 'output': ['181\\r\\n']}, {'input': '6\\r\\n22 9 87 89 57\\r\\n1 6\\r\\n', 'output': ['264\\r\\n']}, {'input': '7\\r\\n52 36 31 23 74 78\\r\\n2 7\\r\\n', 'output': ['242\\r\\n']}, {'input': '8\\r\\n82 14 24 5 91 49 94\\r\\n3 8\\r\\n', 'output': ['263\\r\\n']}, {'input': '9\\r\\n12 40 69 39 59 21 59 5\\r\\n4 6\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n95 81 32 59 71 30 50 61 100\\r\\n1 6\\r\\n', 'output': ['338\\r\\n']}, {'input': '15\\r\\n89 55 94 4 15 69 19 60 91 77 3 94 91 62\\r\\n3 14\\r\\n', 'output': ['617\\r\\n']}, {'input': '20\\r\\n91 1 41 51 95 67 92 35 23 70 44 91 57 50 21 8 9 71 40\\r\\n8 17\\r\\n', 'output': ['399\\r\\n']}, {'input': '25\\r\\n70 95 21 84 97 39 12 98 53 24 78 29 84 65 70 22 100 17 69 27 62 48 35 80\\r\\n8 23\\r\\n', 'output': ['846\\r\\n']}, {'input': '30\\r\\n35 69 50 44 19 56 86 56 98 24 21 2 61 24 85 30 2 22 57 35 59 84 12 77 92 53 50 92 9\\r\\n1 16\\r\\n', 'output': ['730\\r\\n']}, {'input': '35\\r\\n2 34 47 15 27 61 6 88 67 20 53 65 29 68 77 5 78 86 44 98 32 81 91 79 54 84 95 23 65 97 22 33 42 87\\r\\n8 35\\r\\n', 'output': ['1663\\r\\n']}, {'input': '40\\r\\n32 88 59 36 95 45 28 78 73 30 97 13 13 47 48 100 43 21 22 45 88 25 15 13 63 25 72 92 29 5 25 11 50 5 54 51 48 84 23\\r\\n7 26\\r\\n', 'output': ['862\\r\\n']}, {'input': '45\\r\\n83 74 73 95 10 31 100 26 29 15 80 100 22 70 31 88 9 56 19 70 2 62 48 30 27 47 52 50 94 44 21 94 23 85 15 3 95 72 43 62 94 89 68 88\\r\\n17 40\\r\\n', 'output': ['1061\\r\\n']}, {'input': '50\\r\\n28 8 16 29 19 82 70 51 96 84 74 72 17 69 12 21 37 21 39 3 18 66 19 49 86 96 94 93 2 90 96 84 59 88 58 15 61 33 55 22 35 54 51 29 64 68 29 38 40\\r\\n23 28\\r\\n', 'output': ['344\\r\\n']}, {'input': '60\\r\\n24 28 25 21 43 71 64 73 71 90 51 83 69 43 75 43 78 72 56 61 99 7 23 86 9 16 16 94 23 74 18 56 20 72 13 31 75 34 35 86 61 49 4 72 84 7 65 70 66 52 21 38 6 43 69 40 73 46 5\\r\\n28 60\\r\\n', 'output': ['1502\\r\\n']}, {'input': '70\\r\\n69 95 34 14 67 61 6 95 94 44 28 94 73 66 39 13 19 71 73 71 28 48 26 22 32 88 38 95 43 59 88 77 80 55 17 95 40 83 67 1 38 95 58 63 56 98 49 2 41 4 73 8 78 41 64 71 60 71 41 61 67 4 4 19 97 14 39 20 27\\r\\n9 41\\r\\n', 'output': ['1767\\r\\n']}, {'input': '80\\r\\n65 15 43 6 43 98 100 16 69 98 4 54 25 40 2 35 12 23 38 29 10 89 30 6 4 8 7 96 64 43 11 49 89 38 20 59 54 85 46 16 16 89 60 54 28 37 32 34 67 9 78 30 50 87 58 53 99 48 77 3 5 6 19 99 16 20 31 10 80 76 82 56 56 83 72 81 84 60 28\\r\\n18 24\\r\\n', 'output': ['219\\r\\n']}, {'input': '90\\r\\n61 35 100 99 67 87 42 90 44 4 81 65 29 63 66 56 53 22 55 87 39 30 34 42 27 80 29 97 85 28 81 22 50 22 24 75 67 86 78 79 94 35 13 97 48 76 68 66 94 13 82 1 22 85 5 36 86 73 65 97 43 56 35 26 87 25 74 47 81 67 73 75 99 75 53 38 70 21 66 78 38 17 57 40 93 57 68 55 1\\r\\n12 44\\r\\n', 'output': ['1713\\r\\n']}, {'input': '95\\r\\n37 74 53 96 65 84 65 72 95 45 6 77 91 35 58 50 51 51 97 30 51 20 79 81 92 10 89 34 40 76 71 54 26 34 73 72 72 28 53 19 95 64 97 10 44 15 12 38 5 63 96 95 86 8 36 96 45 53 81 5 18 18 47 97 65 9 33 53 41 86 37 53 5 40 15 76 83 45 33 18 26 5 19 90 46 40 100 42 10 90 13 81 40 53\\r\\n6 15\\r\\n', 'output': ['570\\r\\n']}, {'input': '96\\r\\n51 32 95 75 23 54 70 89 67 3 1 51 4 100 97 30 9 35 56 38 54 77 56 98 43 17 60 43 72 46 87 61 100 65 81 22 74 38 16 96 5 10 54 22 23 22 10 91 9 54 49 82 29 73 33 98 75 8 4 26 24 90 71 42 90 24 94 74 94 10 41 98 56 63 18 43 56 21 26 64 74 33 22 38 67 66 38 60 64 76 53 10 4 65 76\\r\\n21 26\\r\\n', 'output': ['328\\r\\n']}, {'input': '97\\r\\n18 90 84 7 33 24 75 55 86 10 96 72 16 64 37 9 19 71 62 97 5 34 85 15 46 72 82 51 52 16 55 68 27 97 42 72 76 97 32 73 14 56 11 86 2 81 59 95 60 93 1 22 71 37 77 100 6 16 78 47 78 62 94 86 16 91 56 46 47 35 93 44 7 86 70 10 29 45 67 62 71 61 74 39 36 92 24 26 65 14 93 92 15 28 79 59\\r\\n6 68\\r\\n', 'output': ['3385\\r\\n']}, {'input': '98\\r\\n32 47 26 86 43 42 79 72 6 68 40 46 29 80 24 89 29 7 21 56 8 92 13 33 50 79 5 7 84 85 24 23 1 80 51 21 26 55 96 51 24 2 68 98 81 88 57 100 64 84 54 10 14 2 74 1 89 71 1 20 84 85 17 31 42 58 69 67 48 60 97 90 58 10 21 29 2 21 60 61 68 89 77 39 57 18 61 44 67 100 33 74 27 40 83 29 6\\r\\n8 77\\r\\n', 'output': ['3319\\r\\n']}, {'input': '99\\r\\n46 5 16 66 53 12 84 89 26 27 35 68 41 44 63 17 88 43 80 15 59 1 42 50 53 34 75 16 16 55 92 30 28 11 12 71 27 65 11 28 86 47 24 10 60 47 7 53 16 75 6 49 56 66 70 3 20 78 75 41 38 57 89 23 16 74 30 39 1 32 49 84 9 33 25 95 75 45 54 59 17 17 29 40 79 96 47 11 69 86 73 56 91 4 87 47 31 24\\r\\n23 36\\r\\n', 'output': ['514\\r\\n']}, {'input': '100\\r\\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 27 85 85 63\\r\\n43 92\\r\\n', 'output': ['2599\\r\\n']}, {'input': '51\\r\\n85 38 22 38 42 36 55 24 36 80 49 15 66 91 88 61 46 82 1 61 89 92 6 56 28 8 46 80 56 90 91 38 38 17 69 64 57 68 13 44 45 38 8 72 61 39 87 2 73 88\\r\\n15 27\\r\\n', 'output': ['618\\r\\n']}, {'input': '2\\r\\n3\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n6 8 22 22\\r\\n2 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '6\\r\\n3 12 27 28 28\\r\\n3 4\\r\\n', 'output': ['27\\r\\n']}, {'input': '9\\r\\n1 2 2 2 2 3 3 5\\r\\n3 7\\r\\n', 'output': ['9\\r\\n']}, {'input': '10\\r\\n1 1 1 1 1 1 1 1 1\\r\\n6 8\\r\\n', 'output': ['2\\r\\n']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3\\r\\n5 17\\r\\n', 'output': ['23\\r\\n']}, {'input': '25\\r\\n1 1 1 4 5 6 8 11 11 11 11 12 13 14 14 14 15 16 16 17 17 17 19 19\\r\\n4 8\\r\\n', 'output': ['23\\r\\n']}, {'input': '35\\r\\n1 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\\r\\n30 31\\r\\n', 'output': ['2\\r\\n']}, {'input': '45\\r\\n1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 4 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 8 8 8 9 9 9 9 9 10 10 10\\r\\n42 45\\r\\n', 'output': ['30\\r\\n']}, {'input': '50\\r\\n1 8 8 13 14 15 15 16 19 21 22 24 26 31 32 37 45 47 47 47 50 50 51 54 55 56 58 61 61 61 63 63 64 66 66 67 67 70 71 80 83 84 85 92 92 94 95 95 100\\r\\n4 17\\r\\n', 'output': ['285\\r\\n']}, {'input': '60\\r\\n1 2 4 4 4 6 6 8 9 10 10 13 14 18 20 20 21 22 23 23 26 29 30 32 33 34 35 38 40 42 44 44 46 48 52 54 56 56 60 60 66 67 68 68 69 73 73 74 80 80 81 81 82 84 86 86 87 89 89\\r\\n56 58\\r\\n', 'output': ['173\\r\\n']}, {'input': '70\\r\\n1 2 3 3 4 5 5 7 7 7 8 8 8 8 9 9 10 12 12 12 12 13 16 16 16 16 16 16 17 17 18 18 20 20 21 23 24 25 25 26 29 29 29 29 31 32 32 34 35 36 36 37 37 38 39 39 40 40 40 40 41 41 42 43 44 44 44 45 45\\r\\n62 65\\r\\n', 'output': ['126\\r\\n']}, {'input': '80\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12\\r\\n17 65\\r\\n', 'output': ['326\\r\\n']}, {'input': '90\\r\\n1 1 3 5 8 9 10 11 11 11 11 12 13 14 15 15 15 16 16 19 19 20 22 23 24 25 25 28 29 29 30 31 33 34 35 37 37 38 41 43 43 44 45 47 51 54 55 56 58 58 59 59 60 62 66 67 67 67 68 68 69 70 71 72 73 73 76 77 77 78 78 78 79 79 79 82 83 84 85 85 87 87 89 93 93 93 95 99 99\\r\\n28 48\\r\\n', 'output': ['784\\r\\n']}, {'input': '95\\r\\n2 2 3 3 4 6 6 7 7 7 9 10 12 12 12 12 13 14 15 16 17 18 20 20 20 20 21 21 21 21 22 22 22 22 22 23 23 23 25 26 26 27 27 27 28 29 29 30 30 31 32 33 34 36 37 37 38 39 39 39 42 43 43 43 45 47 48 50 50 51 52 53 54 54 54 55 55 55 58 59 60 61 61 61 61 62 62 63 64 65 66 67 67 67\\r\\n64 93\\r\\n', 'output': ['1636\\r\\n']}, {'input': '96\\r\\n1 1 2 3 3 5 8 9 9 10 10 10 11 11 11 11 11 12 13 13 13 14 15 15 16 16 17 17 17 17 18 18 20 20 20 21 21 21 23 24 24 25 25 26 27 27 27 27 29 29 29 30 30 30 32 32 32 32 32 32 33 33 34 34 34 35 35 35 36 36 37 37 37 38 39 40 41 41 41 41 42 42 43 43 45 45 45 46 46 47 47 49 50 52 52\\r\\n76 96\\r\\n', 'output': ['898\\r\\n']}, {'input': '98\\r\\n2 3 4 4 5 7 8 10 10 10 11 11 12 12 12 12 13 14 15 15 16 16 18 19 19 20 21 21 21 21 22 23 24 25 26 26 27 27 27 27 29 29 30 30 31 31 37 40 40 40 41 41 41 42 43 44 44 44 46 46 47 49 49 50 50 50 51 53 55 55 56 56 56 56 56 57 57 58 59 60 60 60 62 62 63 64 64 64 65 66 66 67 68 70 70 71 71\\r\\n8 90\\r\\n', 'output': ['3016\\r\\n']}, {'input': '99\\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\\r\\n66 95\\r\\n', 'output': ['29\\r\\n']}, {'input': '100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 15 15 15 15 15 15 16 16 16 17 17\\r\\n39 52\\r\\n', 'output': ['82\\r\\n']}, {'input': '51\\r\\n5 7 9 16 19 25 26 29 29 30 31 32 32 41 43 44 47 49 50 50 51 52 54 55 56 63 64 66 67 70 74 74 77 78 79 80 80 85 86 87 89 89 90 92 93 94 94 95 95 97\\r\\n3 44\\r\\n', 'output': ['2268\\r\\n']}]","id":535} {"difficulty":1000,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"69_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::io::stdin;\r\n\r\n\r\nfn main() {\r\n let mut buffer = String::new();\r\n let mut sum: Vec = vec![0,0,0];\r\n\r\n stdin().read_line(&mut buffer);\r\n\r\n let count = buffer.trim()\r\n .parse::()\r\n .unwrap();\r\n\r\n for _x in 0..count {\r\n let mut x = 0;\r\n buffer.clear();\r\n stdin().read_line(&mut buffer);\r\n buffer.trim()\r\n .split(\" \")\r\n .map(|x| x.parse::().unwrap())\r\n .for_each(|y| { sum[x] += y; x += 1;})\r\n }\r\n\r\n if sum.iter().sum::() == 0 {\r\n print!(\"YES\");\r\n } else {\r\n print!(\"NO\");\r\n }\r\n}\r\n","description":"A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasya and decided to teach him a lesson. He gave the lazy student a seemingly easy task: You are given an idle body in space and the forces that affect it. The body can be considered as a material point with coordinates (0; 0; 0). Vasya had only to answer whether it is in equilibrium. \"Piece of cake\" \u2014 thought Vasya, we need only to check if the sum of all vectors is equal to 0. So, Vasya began to solve the problem. But later it turned out that there can be lots and lots of these forces, and Vasya can not cope without your help. Help him. Write a program that determines whether a body is idle or is moving by the given vectors of forces.","input_specification":"The first line contains a positive integer n (1\u2264n\u2264100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body (-100\u2264xi,yi,zi\u2264100).\n","output_specification":"Print the word \"YES\" if the body is in equilibrium, or the word \"NO\" if it is not.\n","notes":null,"sample_inputs":["3\n4 1 7\n-2 4 -1\n1 -5 -3\n","3\n3 -1 7\n-5 2 -4\n2 -1 -3\n"],"sample_outputs":["NO","YES"],"human_solution":"\/\/ mod scanner;\r\n\/\/ use scanner::Scanner;\r\nuse std::io::{self, prelude::*};\r\nuse std::str;\r\npub struct Scanner {\r\n reader: R,\r\n buffer: Vec,\r\n}\r\n\r\nimpl Scanner {\r\n pub fn new(reader: R) -> Self {\r\n Self {\r\n reader,\r\n buffer: vec![],\r\n }\r\n }\r\n\r\n \/\/\/ Use \"turbofish\" syntax token::() to select data type of next token.\r\n \/\/\/\r\n \/\/\/ # Panics\r\n \/\/\/\r\n \/\/\/ Panics if there's an I\/O error or if the token cannot be parsed as T.\r\n pub fn token(&mut self) -> T {\r\n loop {\r\n if let Some(token) = self.buffer.pop() {\r\n return token.parse().ok().expect(\"Failed parse\");\r\n }\r\n let mut input = String::new();\r\n self.reader.read_line(&mut input).expect(\"Failed read\");\r\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\r\n }\r\n }\r\n}\r\n\r\nfn main() {\r\n let (stdin, stdout) = (io::stdin(), io::stdout());\r\n let mut scan = Scanner::new(stdin.lock());\r\n let mut out = io::BufWriter::new(stdout.lock());\r\n let n: usize = scan.token();\r\n let mut partial_sum = vec![0, 0, 0];\r\n for _ in 0..n {\r\n let vector: Vec = (0..3).map(|_| scan.token()).collect();\r\n partial_sum[0] = partial_sum[0] + vector[0];\r\n partial_sum[1] = partial_sum[1] + vector[1];\r\n partial_sum[2] = partial_sum[2] + vector[2];\r\n }\r\n if partial_sum[0] != 0 || partial_sum[1] != 0 || partial_sum[2] != 0 {\r\n write!(out, \"NO\").ok();\r\n } else {\r\n write!(out, \"YES\").ok();\r\n }\r\n}\r\n","testcases":"[{'input': ['3\\r\\n4 1 7\\r\\n-2 4 -1\\r\\n1 -5 -3\\r\\n'], 'output': ['NO']}, {'input': ['3\\r\\n3 -1 7\\r\\n-5 2 -4\\r\\n2 -1 -3\\r\\n'], 'output': ['YES']}, {'input': ['10\\r\\n21 32 -46\\r\\n43 -35 21\\r\\n42 2 -50\\r\\n22 40 20\\r\\n-27 -9 38\\r\\n-4 1 1\\r\\n-40 6 -31\\r\\n-13 -2 34\\r\\n-21 34 -12\\r\\n-32 -29 41\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n25 -33 43\\r\\n-27 -42 28\\r\\n-35 -20 19\\r\\n41 -42 -1\\r\\n49 -39 -4\\r\\n-49 -22 7\\r\\n-19 29 41\\r\\n8 -27 -43\\r\\n8 34 9\\r\\n-11 -3 33\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n-6 21 18\\r\\n20 -11 -8\\r\\n37 -11 41\\r\\n-5 8 33\\r\\n29 23 32\\r\\n30 -33 -11\\r\\n39 -49 -36\\r\\n28 34 -49\\r\\n22 29 -34\\r\\n-18 -6 7\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n47 -2 -27\\r\\n0 26 -14\\r\\n5 -12 33\\r\\n2 18 3\\r\\n45 -30 -49\\r\\n4 -18 8\\r\\n-46 -44 -41\\r\\n-22 -10 -40\\r\\n-35 -21 26\\r\\n33 20 38\\r\\n'], 'output': ['NO']}, {'input': ['13\\r\\n-3 -36 -46\\r\\n-11 -50 37\\r\\n42 -11 -15\\r\\n9 42 44\\r\\n-29 -12 24\\r\\n3 9 -40\\r\\n-35 13 50\\r\\n14 43 18\\r\\n-13 8 24\\r\\n-48 -15 10\\r\\n50 9 -50\\r\\n21 0 -50\\r\\n0 0 -6\\r\\n'], 'output': ['YES']}, {'input': ['14\\r\\n43 23 17\\r\\n4 17 44\\r\\n5 -5 -16\\r\\n-43 -7 -6\\r\\n47 -48 12\\r\\n50 47 -45\\r\\n2 14 43\\r\\n37 -30 15\\r\\n4 -17 -11\\r\\n17 9 -45\\r\\n-50 -3 -8\\r\\n-50 0 0\\r\\n-50 0 0\\r\\n-16 0 0\\r\\n'], 'output': ['YES']}, {'input': ['13\\r\\n29 49 -11\\r\\n38 -11 -20\\r\\n25 1 -40\\r\\n-11 28 11\\r\\n23 -19 1\\r\\n45 -41 -17\\r\\n-3 0 -19\\r\\n-13 -33 49\\r\\n-30 0 28\\r\\n34 17 45\\r\\n-50 9 -27\\r\\n-50 0 0\\r\\n-37 0 0\\r\\n'], 'output': ['YES']}, {'input': ['12\\r\\n3 28 -35\\r\\n-32 -44 -17\\r\\n9 -25 -6\\r\\n-42 -22 20\\r\\n-19 15 38\\r\\n-21 38 48\\r\\n-1 -37 -28\\r\\n-10 -13 -50\\r\\n-5 21 29\\r\\n34 28 50\\r\\n50 11 -49\\r\\n34 0 0\\r\\n'], 'output': ['YES']}, {'input': ['37\\r\\n-64 -79 26\\r\\n-22 59 93\\r\\n-5 39 -12\\r\\n77 -9 76\\r\\n55 -86 57\\r\\n83 100 -97\\r\\n-70 94 84\\r\\n-14 46 -94\\r\\n26 72 35\\r\\n14 78 -62\\r\\n17 82 92\\r\\n-57 11 91\\r\\n23 15 92\\r\\n-80 -1 1\\r\\n12 39 18\\r\\n-23 -99 -75\\r\\n-34 50 19\\r\\n-39 84 -7\\r\\n45 -30 -39\\r\\n-60 49 37\\r\\n45 -16 -72\\r\\n33 -51 -56\\r\\n-48 28 5\\r\\n97 91 88\\r\\n45 -82 -11\\r\\n-21 -15 -90\\r\\n-53 73 -26\\r\\n-74 85 -90\\r\\n-40 23 38\\r\\n100 -13 49\\r\\n32 -100 -100\\r\\n0 -100 -70\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -37 0\\r\\n'], 'output': ['YES']}, {'input': ['4\\r\\n68 3 100\\r\\n68 21 -100\\r\\n-100 -24 0\\r\\n-36 0 0\\r\\n'], 'output': ['YES']}, {'input': ['33\\r\\n-1 -46 -12\\r\\n45 -16 -21\\r\\n-11 45 -21\\r\\n-60 -42 -93\\r\\n-22 -45 93\\r\\n37 96 85\\r\\n-76 26 83\\r\\n-4 9 55\\r\\n7 -52 -9\\r\\n66 8 -85\\r\\n-100 -54 11\\r\\n-29 59 74\\r\\n-24 12 2\\r\\n-56 81 85\\r\\n-92 69 -52\\r\\n-26 -97 91\\r\\n54 59 -51\\r\\n58 21 -57\\r\\n7 68 56\\r\\n-47 -20 -51\\r\\n-59 77 -13\\r\\n-85 27 91\\r\\n79 60 -56\\r\\n66 -80 5\\r\\n21 -99 42\\r\\n-31 -29 98\\r\\n66 93 76\\r\\n-49 45 61\\r\\n100 -100 -100\\r\\n100 -100 -100\\r\\n66 -75 -100\\r\\n0 0 -100\\r\\n0 0 -87\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n1 2 3\\r\\n3 2 1\\r\\n0 0 0\\r\\n'], 'output': ['NO']}, {'input': ['2\\r\\n5 -23 12\\r\\n0 0 0\\r\\n'], 'output': ['NO']}, {'input': ['1\\r\\n0 0 0\\r\\n'], 'output': ['YES']}, {'input': ['1\\r\\n1 -2 0\\r\\n'], 'output': ['NO']}, {'input': ['2\\r\\n-23 77 -86\\r\\n23 -77 86\\r\\n'], 'output': ['YES']}, {'input': ['26\\r\\n86 7 20\\r\\n-57 -64 39\\r\\n-45 6 -93\\r\\n-44 -21 100\\r\\n-11 -49 21\\r\\n73 -71 -80\\r\\n-2 -89 56\\r\\n-65 -2 7\\r\\n5 14 84\\r\\n57 41 13\\r\\n-12 69 54\\r\\n40 -25 27\\r\\n-17 -59 0\\r\\n64 -91 -30\\r\\n-53 9 42\\r\\n-54 -8 14\\r\\n-35 82 27\\r\\n-48 -59 -80\\r\\n88 70 79\\r\\n94 57 97\\r\\n44 63 25\\r\\n84 -90 -40\\r\\n-100 100 -100\\r\\n-92 100 -100\\r\\n0 10 -100\\r\\n0 0 -82\\r\\n'], 'output': ['YES']}, {'input': ['42\\r\\n11 27 92\\r\\n-18 -56 -57\\r\\n1 71 81\\r\\n33 -92 30\\r\\n82 83 49\\r\\n-87 -61 -1\\r\\n-49 45 49\\r\\n73 26 15\\r\\n-22 22 -77\\r\\n29 -93 87\\r\\n-68 44 -90\\r\\n-4 -84 20\\r\\n85 67 -6\\r\\n-39 26 77\\r\\n-28 -64 20\\r\\n65 -97 24\\r\\n-72 -39 51\\r\\n35 -75 -91\\r\\n39 -44 -8\\r\\n-25 -27 -57\\r\\n91 8 -46\\r\\n-98 -94 56\\r\\n94 -60 59\\r\\n-9 -95 18\\r\\n-53 -37 98\\r\\n-8 -94 -84\\r\\n-52 55 60\\r\\n15 -14 37\\r\\n65 -43 -25\\r\\n94 12 66\\r\\n-8 -19 -83\\r\\n29 81 -78\\r\\n-58 57 33\\r\\n24 86 -84\\r\\n-53 32 -88\\r\\n-14 7 3\\r\\n89 97 -53\\r\\n-5 -28 -91\\r\\n-100 100 -6\\r\\n-84 100 0\\r\\n0 100 0\\r\\n0 70 0\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n96 49 -12\\r\\n2 -66 28\\r\\n-98 17 -16\\r\\n'], 'output': ['YES']}, {'input': ['5\\r\\n70 -46 86\\r\\n-100 94 24\\r\\n-27 63 -63\\r\\n57 -100 -47\\r\\n0 -11 0\\r\\n'], 'output': ['YES']}, {'input': ['18\\r\\n-86 -28 70\\r\\n-31 -89 42\\r\\n31 -48 -55\\r\\n95 -17 -43\\r\\n24 -95 -85\\r\\n-21 -14 31\\r\\n68 -18 81\\r\\n13 31 60\\r\\n-15 28 99\\r\\n-42 15 9\\r\\n28 -61 -62\\r\\n-16 71 29\\r\\n-28 75 -48\\r\\n-77 -67 36\\r\\n-100 83 89\\r\\n100 100 -100\\r\\n57 34 -100\\r\\n0 0 -53\\r\\n'], 'output': ['YES']}, {'input': ['44\\r\\n52 -54 -29\\r\\n-82 -5 -94\\r\\n-54 43 43\\r\\n91 16 71\\r\\n7 80 -91\\r\\n3 15 29\\r\\n-99 -6 -77\\r\\n-3 -77 -64\\r\\n73 67 34\\r\\n25 -10 -18\\r\\n-29 91 63\\r\\n-72 86 -16\\r\\n-68 85 -81\\r\\n-3 36 44\\r\\n-74 -14 -80\\r\\n34 -96 -97\\r\\n-76 -78 -33\\r\\n-24 44 -58\\r\\n98 12 77\\r\\n95 -63 -6\\r\\n-51 3 -90\\r\\n-92 -10 72\\r\\n7 3 -68\\r\\n57 -53 71\\r\\n29 57 -48\\r\\n35 -60 10\\r\\n79 -70 -61\\r\\n-20 77 55\\r\\n-86 -15 -35\\r\\n84 -88 -18\\r\\n100 -42 77\\r\\n-20 46 8\\r\\n-41 -43 -65\\r\\n38 -98 -23\\r\\n-100 65 45\\r\\n-7 -91 -63\\r\\n46 88 -85\\r\\n48 59 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 1\\r\\n'], 'output': ['YES']}, {'input': ['18\\r\\n-14 -64 -91\\r\\n-8 -66 -86\\r\\n-23 92 -40\\r\\n6 -3 -53\\r\\n57 41 78\\r\\n-79 42 -22\\r\\n-88 -17 45\\r\\n4 -45 44\\r\\n83 -18 -25\\r\\n34 86 -92\\r\\n75 -30 12\\r\\n44 99 11\\r\\n-67 -13 72\\r\\n22 83 -56\\r\\n-37 71 72\\r\\n-9 -100 100\\r\\n0 -100 31\\r\\n0 -58 0\\r\\n'], 'output': ['YES']}, {'input': ['23\\r\\n-70 37 78\\r\\n42 84 6\\r\\n28 -94 -24\\r\\n-49 76 95\\r\\n-67 18 84\\r\\n-53 78 -5\\r\\n65 -63 -64\\r\\n-66 -64 -69\\r\\n81 -93 95\\r\\n10 52 -79\\r\\n-89 -61 -64\\r\\n-64 -47 43\\r\\n-81 -35 55\\r\\n80 82 73\\r\\n-60 -81 -18\\r\\n49 -10 -19\\r\\n-58 70 12\\r\\n-24 -15 -93\\r\\n98 -93 -54\\r\\n-28 -75 11\\r\\n100 100 -63\\r\\n100 100 0\\r\\n56 34 0\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n0 2 -2\\r\\n1 -1 3\\r\\n-3 0 0\\r\\n'], 'output': ['NO']}]","id":536} {"difficulty":1200,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"6_C","execute_outcome":"WRONG_ANSWER","source_code":"use std::io;\n\nfn main() {\n let times: Vec = io::stdin()\n .lines()\n .skip(1)\n .next()\n .unwrap()\n .unwrap()\n .split(' ')\n .map(|str| str.parse().unwrap())\n .collect();\n\n let mut lhs_position = 0;\n let mut lhs_time: usize = 0;\n let mut lhs_count: usize = 0;\n\n let mut rhs_position = times.len().checked_sub(1).unwrap();\n let mut rhs_time: usize = 0;\n let mut rhs_count: usize = 0;\n\n while lhs_position < rhs_position {\n if lhs_time <= rhs_time {\n lhs_time += times[lhs_position];\n lhs_count += 1;\n lhs_position += 1;\n } else {\n rhs_time += times[rhs_position];\n rhs_count += 1;\n rhs_position -= 1;\n }\n }\n\n println!(\"{lhs_count} {rhs_count}\")\n}\n","description":"Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob \u2014 from right to left. For each chocololate bar the time, needed for the player to consume it, is known (Alice and Bob eat them with equal speed). When the player consumes a chocolate bar, he immediately starts with another. It is not allowed to eat two chocolate bars at the same time, to leave the bar unfinished and to make pauses. If both players start to eat the same bar simultaneously, Bob leaves it to Alice as a true gentleman.How many bars each of the players will consume?","input_specification":"The first line contains one integer n (1\u2264n\u226410^5) \u2014 the amount of bars on the table. The second line contains a sequence t1,t2,...,tn (1\u2264ti\u22641000), where ti is the time (in seconds) needed to consume the i-th bar (in the order from left to right).\n","output_specification":"Print two numbers a and b, where a is the amount of bars consumed by Alice, and b is the amount of bars consumed by Bob.\n","notes":null,"sample_inputs":["5\n2 9 8 2 7\n"],"sample_outputs":["2 3\n"],"human_solution":"use std::io;\nuse std::io::BufReader;\nuse std::io::BufRead;\nuse std::str::FromStr;\nuse std::fmt::Debug;\nuse std::ops::Add;\nuse std::collections::HashMap;\nuse std::collections::HashSet;\n\nfn main() {\n let buf = &mut io::BufReader::new(io::stdin());\n let mut line = String::new();\n buf.read_line(&mut line).unwrap();\n let mut nm = line.trim().split(\" \");\n let n = nm.next().unwrap().parse::().unwrap();\n line.clear();\n buf.read_line(&mut line).unwrap();\n let ts = line.trim().split(\" \").map(|x| x.parse::().unwrap()).collect::>();\n let mut i = 0;\n let mut j = n - 1;\n let mut ii = 0;\n let mut jj = 0;\n let mut ai = 0;\n let mut aj = 0;\n while i <= j {\n if ii <= jj {\n ii += ts[i];\n i += 1;\n ai += 1;\n } else {\n jj += ts[j];\n j -= 1;\n aj += 1;\n }\n }\n println!(\"{} {}\", ai, aj);\n}\n","testcases":"[{'input': ['5\\r\\n2 9 8 2 7\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n'], 'output': ['2 1\\r\\n']}, {'input': ['4\\r\\n1 1 1 1\\r\\n'], 'output': ['2 2\\r\\n']}, {'input': ['1\\r\\n6\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['2\\r\\n8 2\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3\\r\\n6 8 4\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['4\\r\\n4 3 2 8\\r\\n'], 'output': ['3 1\\r\\n']}, {'input': ['5\\r\\n1 9 8 2 7\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['6\\r\\n1 4 7 3 2 1\\r\\n'], 'output': ['3 3\\r\\n']}, {'input': ['11\\r\\n7 9 1 8 7 1 7 1 4 8 1\\r\\n'], 'output': ['4 7\\r\\n']}, {'input': ['12\\r\\n4 2 7 1 9 5 6 2 7 8 5 7\\r\\n'], 'output': ['7 5\\r\\n']}, {'input': ['13\\r\\n9 9 9 9 9 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['7 6\\r\\n']}]","id":537} {"difficulty":800,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"71_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::io;\r\n\r\nfn main() {\r\n let mut num_words = String::new();\r\n io::stdin().read_line(&mut num_words).expect(\"Failed\");\r\n\r\n let n: u32 = num_words.trim().parse().expect(\"Failed\");\r\n\r\n for _k in 0..n {\r\n let mut question_string: String = String::new();\r\n io::stdin().read_line(&mut question_string).expect(\"Failed\");\r\n\r\n if question_string.len() > 10 {\r\n println!(\"{}{}{}\", question_string.chars().nth(0).unwrap(), question_string.len() - 2, question_string.chars().last().unwrap());\r\n } else {\r\n println!(\"{}\", question_string);\r\n }\r\n }\r\n}","description":"Sometimes some words like \"localization\" or \"internationalization\" are so long that writing them many times in one text is quite tiresome.Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.Thus, \"localization\" will be spelt as \"l10n\", and \"internationalization\u00bb will be spelt as \"i18n\".You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.","input_specification":"The first line contains an integer n (1\u2264n\u2264100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.\n","output_specification":"Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.\n","notes":null,"sample_inputs":["4\nword\nlocalization\ninternationalization\npneumonoultramicroscopicsilicovolcanoconiosis\n"],"sample_outputs":["word\nl10n\ni18n\np43s\n"],"human_solution":"use std::{io, str::FromStr};\n\nfn input() -> Result::Err> {\n let mut s: String = String::new();\n std::io::stdin().read_line(&mut s).unwrap();\n s.trim().parse()\n}\nfn main() {\n let line_count: usize = input().unwrap();\n\n for _ in 0..line_count {\n let word: String = input().unwrap();\n if word.len() <= 10 {\n println!(\"{word}\");\n } else {\n println!(\n \"{}{}{}\",\n word.chars().nth(0).unwrap(),\n word.len() - 2,\n word.chars().nth_back(0).unwrap()\n );\n }\n }\n}\n","testcases":"[{'input': ['4\\r\\nword\\r\\nlocalization\\r\\ninternationalization\\r\\npneumonoultramicroscopicsilicovolcanoconiosis\\r\\n'], 'output': ['word\\r\\nl10n\\r\\ni18n\\r\\np43s\\r\\n']}, {'input': ['5\\r\\nabcdefgh\\r\\nabcdefghi\\r\\nabcdefghij\\r\\nabcdefghijk\\r\\nabcdefghijklm\\r\\n'], 'output': ['abcdefgh\\r\\nabcdefghi\\r\\nabcdefghij\\r\\na9k\\r\\na11m\\r\\n']}, {'input': ['3\\r\\nnjfngnrurunrgunrunvurn\\r\\njfvnjfdnvjdbfvsbdubruvbubvkdb\\r\\nksdnvidnviudbvibd\\r\\n'], 'output': ['n20n\\r\\nj27b\\r\\nk15d\\r\\n']}, {'input': ['1\\r\\ntcyctkktcctrcyvbyiuhihhhgyvyvyvyvjvytchjckt\\r\\n'], 'output': ['t41t\\r\\n']}, {'input': ['24\\r\\nyou\\r\\nare\\r\\nregistered\\r\\nfor\\r\\npractice\\r\\nyou\\r\\ncan\\r\\nsolve\\r\\nproblems\\r\\nunofficially\\r\\nresults\\r\\ncan\\r\\nbe\\r\\nfound\\r\\nin\\r\\nthe\\r\\ncontest\\r\\nstatus\\r\\nand\\r\\nin\\r\\nthe\\r\\nbottom\\r\\nof\\r\\nstandings\\r\\n'], 'output': ['you\\r\\nare\\r\\nregistered\\r\\nfor\\r\\npractice\\r\\nyou\\r\\ncan\\r\\nsolve\\r\\nproblems\\r\\nu10y\\r\\nresults\\r\\ncan\\r\\nbe\\r\\nfound\\r\\nin\\r\\nthe\\r\\ncontest\\r\\nstatus\\r\\nand\\r\\nin\\r\\nthe\\r\\nbottom\\r\\nof\\r\\nstandings\\r\\n']}, {'input': ['1\\r\\na\\r\\n'], 'output': ['a\\r\\n']}, {'input': ['26\\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\\n'], 'output': ['a\\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\\n']}, {'input': ['1\\r\\nabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\\r\\n'], 'output': ['a98j\\r\\n']}, {'input': ['10\\r\\ngyartjdxxlcl\\r\\nfzsck\\r\\nuidwu\\r\\nxbymclornemdmtj\\r\\nilppyoapitawgje\\r\\ncibzc\\r\\ndrgbeu\\r\\nhezplmsdekhhbo\\r\\nfeuzlrimbqbytdu\\r\\nkgdco\\r\\n'], 'output': ['g10l\\r\\nfzsck\\r\\nuidwu\\r\\nx13j\\r\\ni13e\\r\\ncibzc\\r\\ndrgbeu\\r\\nh12o\\r\\nf13u\\r\\nkgdco\\r\\n']}, {'input': ['20\\r\\nlkpmx\\r\\nkovxmxorlgwaomlswjxlpnbvltfv\\r\\nhykasjxqyjrmybejnmeumzha\\r\\ntuevlumpqbbhbww\\r\\nqgqsphvrmupxxc\\r\\ntrissbaf\\r\\nqfgrlinkzvzqdryckaizutd\\r\\nzzqtoaxkvwoscyx\\r\\noswytrlnhpjvvnwookx\\r\\nlpuzqgec\\r\\ngyzqfwxggtvpjhzmzmdw\\r\\nrlxjgmvdftvrmvbdwudra\\r\\nvsntnjpepnvdaxiporggmglhagv\\r\\nxlvcqkqgcrbgtgglj\\r\\nlyxwxbiszyhlsrgzeedzprbmcpduvq\\r\\nyrmqqvrkqskqukzqrwukpsifgtdc\\r\\nxpuohcsjhhuhvr\\r\\nvvlfrlxpvqejngwrbfbpmqeirxlw\\r\\nsvmasocxdvadmaxtrpakysmeaympy\\r\\nyuflqboqfdt\\r\\n'], 'output': ['lkpmx\\r\\nk26v\\r\\nh22a\\r\\nt13w\\r\\nq12c\\r\\ntrissbaf\\r\\nq21d\\r\\nz13x\\r\\no17x\\r\\nlpuzqgec\\r\\ng18w\\r\\nr19a\\r\\nv25v\\r\\nx15j\\r\\nl28q\\r\\ny26c\\r\\nx12r\\r\\nv26w\\r\\ns27y\\r\\ny9t\\r\\n']}, {'input': ['100\\r\\nm\\r\\nz\\r\\ns\\r\\nv\\r\\nd\\r\\nr\\r\\nv\\r\\ny\\r\\ny\\r\\ne\\r\\np\\r\\nt\\r\\nc\\r\\na\\r\\nn\\r\\nm\\r\\np\\r\\ng\\r\\ni\\r\\nj\\r\\nc\\r\\na\\r\\nb\\r\\nq\\r\\ne\\r\\nn\\r\\nv\\r\\no\\r\\nk\\r\\nx\\r\\nf\\r\\ni\\r\\nl\\r\\na\\r\\nq\\r\\nr\\r\\nu\\r\\nb\\r\\ns\\r\\nl\\r\\nc\\r\\nl\\r\\ne\\r\\nv\\r\\nj\\r\\nm\\r\\nx\\r\\nb\\r\\na\\r\\nq\\r\\nb\\r\\na\\r\\nf\\r\\nj\\r\\nv\\r\\nm\\r\\nq\\r\\nc\\r\\nt\\r\\nt\\r\\nn\\r\\nx\\r\\no\\r\\ny\\r\\nr\\r\\nu\\r\\nh\\r\\nm\\r\\nj\\r\\np\\r\\nj\\r\\nq\\r\\nz\\r\\ns\\r\\nj\\r\\no\\r\\ng\\r\\nc\\r\\nm\\r\\nn\\r\\no\\r\\nm\\r\\nr\\r\\no\\r\\ns\\r\\nt\\r\\nh\\r\\nr\\r\\np\\r\\nk\\r\\nb\\r\\nz\\r\\ng\\r\\no\\r\\nc\\r\\nc\\r\\nz\\r\\nz\\r\\ng\\r\\nr\\r\\n'], 'output': ['m\\r\\nz\\r\\ns\\r\\nv\\r\\nd\\r\\nr\\r\\nv\\r\\ny\\r\\ny\\r\\ne\\r\\np\\r\\nt\\r\\nc\\r\\na\\r\\nn\\r\\nm\\r\\np\\r\\ng\\r\\ni\\r\\nj\\r\\nc\\r\\na\\r\\nb\\r\\nq\\r\\ne\\r\\nn\\r\\nv\\r\\no\\r\\nk\\r\\nx\\r\\nf\\r\\ni\\r\\nl\\r\\na\\r\\nq\\r\\nr\\r\\nu\\r\\nb\\r\\ns\\r\\nl\\r\\nc\\r\\nl\\r\\ne\\r\\nv\\r\\nj\\r\\nm\\r\\nx\\r\\nb\\r\\na\\r\\nq\\r\\nb\\r\\na\\r\\nf\\r\\nj\\r\\nv\\r\\nm\\r\\nq\\r\\nc\\r\\nt\\r\\nt\\r\\nn\\r\\nx\\r\\no\\r\\ny\\r\\nr\\r\\nu\\r\\nh\\r\\nm\\r\\nj\\r\\np\\r\\nj\\r\\nq\\r\\nz\\r\\ns\\r\\nj\\r\\no\\r\\ng\\r\\nc\\r\\nm\\r\\nn\\r\\no\\r\\nm\\r\\nr\\r\\no\\r\\ns\\r\\nt\\r\\nh\\r\\nr\\r\\np\\r\\nk\\r\\nb\\r\\nz\\r\\ng\\r\\no\\r\\nc\\r\\nc\\r\\nz\\r\\nz\\r\\ng\\r\\nr\\r\\n']}]","id":538} {"difficulty":1300,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"71_B","execute_outcome":"WRONG_ANSWER","source_code":"use std::io::stdin;\n\nfn main() {\n let mut buffer = String::new();\n\n stdin().read_line(&mut buffer).unwrap();\n \n let numbers: Vec = buffer\n .split_whitespace()\n .map(|x| x.parse::().unwrap())\n .collect();\n\n let (n, k, t): (i32, i32, i32) = (numbers[0], numbers[1], numbers[2]);\n\n let count: i32 = ((t as f32) * (n as f32) * (k as f32) \/ 100f32).floor() as i32;\n\n let mut squares: Vec = Vec::new();\n\n for i in 0..n {\n if i < count \/ n {\n squares.push(k.to_string());\n } else if i == count \/ k {\n squares.push((count % k).to_string());\n } else {\n squares.push(\"0\".to_string());\n }\n }\n\n println!(\"{}\", squares.join(\" \"));\n}\n","description":"A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the left to the right. Each square has saturation (ai for the i-th square), which is measured by an integer from 0 to k. When the bar for some i (1\u2264i\u2264n) is displayed, squares 1,2,... ,i-1 has the saturation k, squares i+1,i+2,... ,n has the saturation 0, and the saturation of the square i can have any value from 0 to k.So some first squares of the progress bar always have the saturation k. Some last squares always have the saturation 0. And there is no more than one square that has the saturation different from 0 and k.The degree of the process's completion is measured in percents. Let the process be t% completed. Then the following inequation is fulfilled: An example of such a bar can be seen on the picture. For the given n, k, t determine the measures of saturation for all the squares ai of the progress bar.","input_specification":"We are given 3 space-separated integers n, k, t (1\u2264n,k\u2264100, 0\u2264t\u2264100).\n","output_specification":"Print n numbers. The i-th of them should be equal to ai.\n","notes":null,"sample_inputs":["10 10 54\n","11 13 37\n"],"sample_outputs":["10 10 10 10 10 4 0 0 0 0 ","13 13 13 13 0 0 0 0 0 0 0 "],"human_solution":"#[allow(unused_imports)]\r\nuse std::io::{stdin, stdout, BufWriter, Stdout, Write};\r\nuse std::cmp::min;\r\n\r\n\/*\r\n * [[[[[[[[[[[[[[[[hello]]]]]]]]]]]]]]]]\r\n * [[[[[[[[[[[[[[[[darkness]]]]]]]]]]]]]]]]\r\n * [[[[[[[[[[[[[[[[my]]]]]]]]]]]]]]]]\r\n * [[[[[[[[[[[[[[[[old]]]]]]]]]]]]]]]]\r\n * [[[[[[[[[[[[[[[[friend]]]]]]]]]]]]]]]]\r\n *\/\r\n\r\nfn main() {\r\n let mut reader = Scanner::default();\r\n let out = &mut BufWriter::new(stdout());\r\n\r\n let n = reader.next::();\r\n let k = reader.next::();\r\n let t = reader.next::();\r\n\r\n let total = n * k;\r\n let mut needed = (((t as f64) * (total as f64)) \/ 100.0) as i32;\r\n\r\n \/\/ writeln!(out, \"{} {}\", total, needed).ok();\r\n\r\n for _ in 0..n {\r\n if needed > 0 {\r\n write!(out, \"{} \", min(needed, k)).ok();\r\n } else {\r\n write!(out, \"0 \").ok();\r\n }\r\n needed -= k;\r\n }\r\n writeln!(out, \"\").ok();\r\n}\r\n\r\n#[derive(Default)]\r\nstruct Scanner {\r\n buffer: Vec,\r\n}\r\n\r\nimpl Scanner {\r\n fn next(&mut self) -> T {\r\n loop {\r\n if let Some(token) = self.buffer.pop() {\r\n return token.parse().ok().expect(\"Failed parse\");\r\n }\r\n let mut input = String::new();\r\n stdin().read_line(&mut input).expect(\"Failed read\");\r\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\r\n }\r\n }\r\n}\r\n","testcases":"[{'input': ['10 10 54\\r\\n'], 'output': ['10 10 10 10 10 4 0 0 0 0 ']}, {'input': ['11 13 37\\r\\n'], 'output': ['13 13 13 13 0 0 0 0 0 0 0 ']}, {'input': ['9 25 50\\r\\n'], 'output': ['25 25 25 25 12 0 0 0 0 ']}, {'input': ['43 47 77\\r\\n'], 'output': ['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 5 0 0 0 0 0 0 0 0 0 ']}, {'input': ['20 1 43\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 4 61\\r\\n'], 'output': ['4 4 4 4 4 4 4 4 4 4 1 0 0 0 0 0 0 ']}, {'input': ['10 16 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 13 100\\r\\n'], 'output': ['13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 ']}, {'input': ['11 9 1\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['9 11 99\\r\\n'], 'output': ['11 11 11 11 11 11 11 11 10 ']}, {'input': ['6 17 1\\r\\n'], 'output': ['1 0 0 0 0 0 ']}, {'input': ['6 17 99\\r\\n'], 'output': ['17 17 17 17 17 15 ']}, {'input': ['17 6 1\\r\\n'], 'output': ['1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 6 99\\r\\n'], 'output': ['6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 ']}, {'input': ['99 1 1\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['99 1 99\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ']}, {'input': ['1 1 0\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 37\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 50\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 51\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 99\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 100\\r\\n'], 'output': ['1 ']}, {'input': ['1 17 35\\r\\n'], 'output': ['5 ']}, {'input': ['1 31 88\\r\\n'], 'output': ['27 ']}, {'input': ['1 100 0\\r\\n'], 'output': ['0 ']}, {'input': ['1 100 38\\r\\n'], 'output': ['38 ']}, {'input': ['1 100 99\\r\\n'], 'output': ['99 ']}, {'input': ['1 100 100\\r\\n'], 'output': ['100 ']}, {'input': ['1 99 99\\r\\n'], 'output': ['98 ']}, {'input': ['100 100 73\\r\\n'], 'output': ['100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 100 100\\r\\n'], 'output': ['100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ']}, {'input': ['100 13 100\\r\\n'], 'output': ['13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 ']}, {'input': ['100 1 100\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ']}, {'input': ['100 1 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 13 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 63 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 100 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['2 99 51\\r\\n'], 'output': ['99 1 ']}, {'input': ['2 1 49\\r\\n'], 'output': ['0 0 ']}, {'input': ['2 1 100\\r\\n'], 'output': ['1 1 ']}, {'input': ['2 13 0\\r\\n'], 'output': ['0 0 ']}, {'input': ['99 1 51\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['15 25 93\\r\\n'], 'output': ['25 25 25 25 25 25 25 25 25 25 25 25 25 23 0 ']}, {'input': ['60 51 85\\r\\n'], 'output': ['51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 ']}, {'input': ['4 78 78\\r\\n'], 'output': ['78 78 78 9 ']}, {'input': ['49 4 4\\r\\n'], 'output': ['4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['42 83 98\\r\\n'], 'output': ['83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 13 ']}, {'input': ['87 9 90\\r\\n'], 'output': ['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 2 0 0 0 0 0 0 0 0 ']}, {'input': ['31 36 83\\r\\n'], 'output': ['36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 26 0 0 0 0 0 ']}, {'input': ['24 14 76\\r\\n'], 'output': ['14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 3 0 0 0 0 0 ']}]","id":539} {"difficulty":800,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"80_A","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(dead_code)]\r\n#![allow(unused)]\r\n#![allow(unused_imports)]\r\nuse std::io::{self, prelude::*};\r\nuse std::str;\r\nuse std::cmp; \/\/ cmp::max\r\nuse std::collections::BTreeMap;\r\nuse std::f64; \/\/ f64::max\r\nuse std::collections::BTreeSet;\r\n \r\nstruct Scanner {\r\n reader: R,\r\n buf_str: Vec,\r\n buf_iter: str::SplitWhitespace<'static>,\r\n}\r\n\r\nimpl Scanner {\r\n fn new(reader: R) -> Self {\r\n Self { reader, buf_str: vec![], buf_iter: \"\".split_whitespace() }\r\n }\r\n fn token(&mut self) -> T {\r\n loop {\r\n if let Some(token) = self.buf_iter.next() {\r\n return token.parse().ok().expect(\"Failed parse\");\r\n }\r\n self.buf_str.clear();\r\n self.reader.read_until(b'\\n', &mut self.buf_str).expect(\"Failed read\");\r\n self.buf_iter = unsafe {\r\n let slice = str::from_utf8_unchecked(&self.buf_str);\r\n std::mem::transmute(slice.split_whitespace())\r\n }\r\n }\r\n }\r\n\r\n fn token0(&mut self) -> String {\r\n self.buf_str.clear();\r\n self.reader.read_until(b'\\n', &mut self.buf_str).expect(\"Failed read\"); \r\n return String::from_utf8_lossy(&self.buf_str).trim().to_string();\r\n }\r\n \r\n fn i64(&mut self) -> i64 {\r\n self.token::()\r\n }\r\n\r\n fn string(&mut self) -> Vec {\r\n self.token::().into_bytes()\r\n }\r\n\r\n fn usize(&mut self) -> usize {\r\n self.token::()\r\n }\r\n}\r\n\r\n#[derive(Debug, PartialOrd, Ord, PartialEq, Eq)]\r\nstruct Data {\r\n x: i64,\r\n y: i64,\r\n} \/\/ .sort_by(|a, b| b.x.cmp(&a.x));\r\n\r\nfn is_prime(s: i64) -> i64 {\r\n let mut lo = 0;\r\n for i in 1..=s {\r\n if s % i == 0 {\r\n lo += 1;\r\n }\r\n }\r\n if lo == 2 {\r\n 1\r\n } else {\r\n 0\r\n }\r\n}\r\n\r\nfn solve(s: &mut Scanner) {\r\n let x = s.i64();\r\n let y = s.i64();\r\n for i in x+1..y {\r\n if is_prime(i) == 1 {\r\n println!(\"NO\");\r\n }\r\n }\r\n\r\n if is_prime(y) == 1 {\r\n println!(\"YES\");\r\n } else {\r\n println!(\"NO\");\r\n }\r\n}\r\n\r\nfn main() {\r\n let (stdin, stdout) = (io::stdin(), io::stdout());\r\n let mut scan = Scanner::new(stdin.lock());\r\n let mut t = 1; \r\n \/\/ t = scan.i64();\r\n while t > 0 {\r\n t -= 1;\r\n solve(&mut scan);\r\n }\r\n}","description":"A prime number is a number which has exactly two distinct divisors: one and itself. For example, numbers 2, 7, 3 are prime, and 1, 6, 4 are not.The next prime number after x is the smallest prime number greater than x. For example, the next prime number after 2 is 3, and the next prime number after 3 is 5. Note that there is exactly one next prime number after each number. So 5 is\u00a0not the next prime number for 2.One cold April morning Panoramix predicted that soon Kakofonix will break free from his straitjacket, and this will be a black day for the residents of the Gallic countryside.Panoramix's prophecy tells that if some day Asterix and Obelix beat exactly x Roman soldiers, where x is a prime number, and next day they beat exactly y Roman soldiers, where y is the next prime number after x, then it's time to wait for Armageddon, for nothing can shut Kakofonix up while he sings his infernal song.Yesterday the Gauls beat n Roman soldiers and it turned out that the number n was prime! Today their victims were a troop of m Romans (m>n). Determine whether the Gauls should wait for the black day after today's victory of Asterix and Obelix?","input_specification":"The first and only input line contains two positive integers \u2014 n and m (2\u2264n String {\n let mut buffer = String::new();\n io::stdin()\n .read_line(&mut buffer)\n .expect(\"failed to read line\");\n\n buffer\n}\n\n#[allow(dead_code)]\nfn read() -> Result {\n read_line().trim().parse::()\n}\n\n#[allow(dead_code)]\nfn read_vec() -> Result, T::Err> {\n read_line()\n .split_whitespace()\n .map(|x| x.parse::())\n .collect()\n}\n\nfn main() {\n let i = read_vec::().unwrap();\n let p = i[0];\n let n = i[1];\n\n let mut v = [0; 100];\n v[2] = 3;\n v[3] = 5;\n v[5] = 7;\n v[7] = 11;\n v[11] = 13;\n v[13] = 17;\n v[17] = 19;\n v[19] = 23;\n v[23] = 29;\n v[29] = 31;\n v[31] = 37;\n v[37] = 41;\n v[41] = 43;\n v[43] = 47;\n v[47] = 53;\n\n if v[p] == n {\n println!(\"YES\");\n } else {\n println!(\"NO\");\n }\n}\n","testcases":"[{'input': ['3 5\\r\\n'], 'output': ['YES']}, {'input': ['7 11\\r\\n'], 'output': ['YES']}, {'input': ['7 9\\r\\n'], 'output': ['NO']}, {'input': ['2 3\\r\\n'], 'output': ['YES']}, {'input': ['2 4\\r\\n'], 'output': ['NO']}, {'input': ['3 4\\r\\n'], 'output': ['NO']}, {'input': ['3 5\\r\\n'], 'output': ['YES']}, {'input': ['5 7\\r\\n'], 'output': ['YES']}, {'input': ['7 11\\r\\n'], 'output': ['YES']}, {'input': ['11 13\\r\\n'], 'output': ['YES']}, {'input': ['13 17\\r\\n'], 'output': ['YES']}, {'input': ['17 19\\r\\n'], 'output': ['YES']}, {'input': ['19 23\\r\\n'], 'output': ['YES']}, {'input': ['23 29\\r\\n'], 'output': ['YES']}, {'input': ['29 31\\r\\n'], 'output': ['YES']}, {'input': ['31 37\\r\\n'], 'output': ['YES']}, {'input': ['37 41\\r\\n'], 'output': ['YES']}, {'input': ['41 43\\r\\n'], 'output': ['YES']}, {'input': ['43 47\\r\\n'], 'output': ['YES']}, {'input': ['2 5\\r\\n'], 'output': ['NO']}, {'input': ['2 7\\r\\n'], 'output': ['NO']}, {'input': ['2 6\\r\\n'], 'output': ['NO']}, {'input': ['2 11\\r\\n'], 'output': ['NO']}, {'input': ['3 6\\r\\n'], 'output': ['NO']}, {'input': ['3 7\\r\\n'], 'output': ['NO']}, {'input': ['3 9\\r\\n'], 'output': ['NO']}, {'input': ['5 6\\r\\n'], 'output': ['NO']}, {'input': ['5 9\\r\\n'], 'output': ['NO']}, {'input': ['5 11\\r\\n'], 'output': ['NO']}, {'input': ['5 13\\r\\n'], 'output': ['NO']}, {'input': ['5 15\\r\\n'], 'output': ['NO']}, {'input': ['7 8\\r\\n'], 'output': ['NO']}, {'input': ['7 13\\r\\n'], 'output': ['NO']}, {'input': ['13 15\\r\\n'], 'output': ['NO']}, {'input': ['13 17\\r\\n'], 'output': ['YES']}, {'input': ['19 21\\r\\n'], 'output': ['NO']}, {'input': ['13 20\\r\\n'], 'output': ['NO']}, {'input': ['41 49\\r\\n'], 'output': ['NO']}, {'input': ['43 49\\r\\n'], 'output': ['NO']}, {'input': ['47 50\\r\\n'], 'output': ['NO']}, {'input': ['47 49\\r\\n'], 'output': ['NO']}, {'input': ['47 48\\r\\n'], 'output': ['NO']}, {'input': ['23 25\\r\\n'], 'output': ['NO']}, {'input': ['2 50\\r\\n'], 'output': ['NO']}, {'input': ['31 33\\r\\n'], 'output': ['NO']}]","id":540} {"difficulty":1200,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"8_A","execute_outcome":"WRONG_ANSWER","source_code":"use std::io::BufRead;\r\n\r\n\/**\r\n * A. Train and Peter\r\n * time limit per test: 1 second\r\n * memory limit per test: 64 megabytes\r\n * input: standard input\r\n * output: standard output\r\n *\r\n * Peter likes to travel by train. He likes it so much that on the train he falls asleep.\r\n *\r\n * 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\r\n * look through the window and noticed that every railway station has a flag of a particular colour.\r\n *\r\n * The boy started to memorize the order of the flags' colours that he had seen. But soon he fell asleep again.\r\n * Unfortunately, he didn't sleep long, he woke up and went on memorizing the colours. Then he fell asleep again, and that\r\n * time he slept till the end of the journey.\r\n *\r\n * At the station he told his parents about what he was doing, and wrote two sequences of the colours that he had seen\r\n * before and after his sleep, respectively.\r\n *\r\n * Peter's parents know that their son likes to fantasize. They give you the list of the flags' colours at the stations that\r\n * 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\r\n * way from A to B, or from B to A. Remember, please, that Peter had two periods of wakefulness.\r\n *\r\n * Peter's parents put lowercase Latin letters for colours. The same letter stands for the same colour, different letters \u00e2\u0080\u0094\r\n * for different colours.\r\n *\r\n * Input\r\n * The input data contains three lines. The first line contains a non-empty string, whose length does not exceed 105, the\r\n * string consists of lowercase Latin letters \u00e2\u0080\u0094 the flags' colours at the stations on the way from A to B. On the way from\r\n * B to A the train passes the same stations, but in reverse order.\r\n *\r\n * The second line contains the sequence, written by Peter during the first period of wakefulness. The third line contains\r\n * the sequence, written during the second period of wakefulness. Both sequences are non-empty, consist of lowercase Latin\r\n * letters, and the length of each does not exceed 100 letters. Each of the sequences is written in chronological order.\r\n *\r\n * Output\r\n * Output one of the four words without inverted commas:\r\n * \u00c2\u00abforward\u00c2\u00bb \u00e2\u0080\u0094 if Peter could see such sequences only on the way from A to B;\r\n * \u00c2\u00abbackward\u00c2\u00bb \u00e2\u0080\u0094 if Peter could see such sequences on the way from B to A;\r\n * \u00c2\u00abboth\u00c2\u00bb \u00e2\u0080\u0094 if Peter could see such sequences both on the way from A to B, and on the way from B to A;\r\n * \u00c2\u00abfantasy\u00c2\u00bb \u00e2\u0080\u0094 if Peter could not see such sequences.\r\n *\r\n * Examples\r\n * Input\r\n * atob\r\n * a\r\n * b\r\n * \r\n * Output\r\n * forward\r\n * \r\n * Input\r\n * aaacaaa\r\n * aca\r\n * aa\r\n * \r\n * Output\r\n * both\r\n *\r\n * Note\r\n * It 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\r\n *\/\r\nfn main() {\r\n let stdin = std::io::stdin();\r\n let mut lines = stdin.lock().lines();\r\n\r\n let path = lines.next().unwrap().unwrap();\r\n let a = lines.next().unwrap().unwrap();\r\n let b = lines.next().unwrap().unwrap();\r\n\r\n let a_indices: Vec<_> = path\r\n .as_bytes()\r\n .windows(a.len())\r\n .enumerate()\r\n .filter(|(_, slice)| slice == &a.as_bytes())\r\n .map(|(i, _)| i)\r\n .collect();\r\n let b_indices: Vec<_> = path\r\n .as_bytes()\r\n .windows(b.len())\r\n .enumerate()\r\n .filter(|(_, slice)| slice == &b.as_bytes())\r\n .map(|(i, _)| i)\r\n .collect();\r\n\r\n let (mut left, mut right) = (false, false);\r\n for &i in &a_indices {\r\n for &j in &b_indices {\r\n if i < j {\r\n let a_end = i + a.len();\r\n left |= a_end <= j;\r\n } else {\r\n let b_end = j + b.len();\r\n right |= b_end <= i;\r\n }\r\n }\r\n }\r\n\r\n match (left, right) {\r\n (true, true) => println!(\"both\"),\r\n (true, _) => println!(\"forward\"),\r\n (_, true) => println!(\"backward\"),\r\n _ => println!(\"fantasy\"),\r\n }\r\n}\r\n","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 10^5, 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. \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","output_specification":"Output one of the four words without inverted commas: \n \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":"It 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.\n","sample_inputs":["atob\na\nb\n","aaacaaa\naca\naa\n"],"sample_outputs":["forward\n","both\n"],"human_solution":"use std::io;\nuse std::io::BufReader;\nuse std::io::BufRead;\nuse std::str::FromStr;\nuse std::fmt::Debug;\nuse std::ops::Add;\nuse std::collections::{HashMap, BTreeMap, HashSet, BTreeSet};\n\nfn main() {\n let buf = &mut io::BufReader::new(io::stdin());\n let mut ss = String::new();\n let mut ss1 = String::new();\n let mut ss2 = String::new();\n \n buf.read_line(&mut ss).unwrap();\n buf.read_line(&mut ss1).unwrap();\n buf.read_line(&mut ss2).unwrap();\n\n let s = ss.trim();\n let s1 = ss1.trim();\n let s2 = ss2.trim();\n\n let mut fwd = false;\n if let Some(idx) = s.find(&s1) {\n if let Some(_) = s[idx+s1.len()..].find(&s2) {\n fwd = true;\n }\n }\n let mut bck = false;\n if let Some(idx) = s.rfind(&s1.chars().rev().collect::()) {\n if let Some(_) = s[..idx].rfind(&s2.chars().rev().collect::()) {\n bck = true;\n }\n }\n let result = match (fwd, bck) {\n (true, false) => \"forward\",\n (false, true) => \"backward\",\n (true, true) => \"both\",\n (false, false) => \"fantasy\",\n };\n println!(\"{}\", result);\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":541} {"difficulty":1400,"lang":"Rust","lang_cluster":"Rust","src_uid":"991516fa6f3ed5a71c547a3a50ea1a2b","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"#![allow(unused_imports)]\nuse std::collections;\nuse std::io;\n\nstruct Input {\n buffer: collections::VecDeque,\n}\n\nimpl Input {\n fn new() -> Input {\n Input {\n buffer: collections::VecDeque::new(),\n }\n }\n\n fn next(&mut self) -> T {\n while self.buffer.len() == 0 {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).ok();\n for word in line.split_whitespace() {\n self.buffer.push_back(word.to_string())\n }\n }\n\n let front = self.buffer.pop_front().unwrap();\n front.parse::().ok().unwrap()\n }\n}\n\nfn main() {\n let mut input = Input::new();\n\n let n: usize = input.next();\n let l: usize = input.next();\n\n let mut a: Vec = Vec::with_capacity(n);\n for _ in 0..n {\n let mut value = input.next();\n if value >= l {\n a.push(value);\n }\n }\n\n let mut max_area = 0;\n\n for width in l..(l * 2) {\n let mut height = 0;\n let mut cuttings: Vec = Vec::new();\n for j in 0..a.len() {\n let mut remains = a[j];\n while remains == width || remains >= width + l {\n height += 1;\n remains -= width;\n }\n if remains > 0 {\n cuttings.push(remains);\n }\n }\n cuttings.sort();\n while cuttings.len() > 0 {\n let mut remains = cuttings.pop().unwrap();\n while cuttings.len() > 0 || remains < width {\n remains += cuttings.drain(0..1).next().unwrap();\n }\n if remains >= width {\n height += 1;\n }\n }\n let area = width * height;\n if area > max_area {\n max_area = area;\n }\n }\n println!(\"{}\", max_area);\n}\n","description":"The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k\u2009\u00d7\u2009d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.","input_specification":"The first output line contains two space-separated integers n and l (1\u2009\u2264\u2009n,\u2009l\u2009\u2264\u2009100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).","output_specification":"Print the single number \u2014 the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.","notes":"NoteIn the first sample test the required window is 2\u2009\u00d7\u20094 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.","sample_inputs":["4 2\n1 2 3 4","5 3\n5 5 7 3 1","2 3\n1 2"],"sample_outputs":["8","15","0"],"human_solution":"#![allow(unused_imports)]\nuse std::collections;\nuse std::io;\n\nstruct Input {\n buffer: collections::VecDeque,\n}\n\nimpl Input {\n fn new() -> Input {\n Input {\n buffer: collections::VecDeque::new(),\n }\n }\n\n fn next(&mut self) -> T {\n while self.buffer.len() == 0 {\n let mut line = String::new();\n std::io::stdin().read_line(&mut line).ok();\n for word in line.split_whitespace() {\n self.buffer.push_back(word.to_string())\n }\n }\n\n let front = self.buffer.pop_front().unwrap();\n front.parse::().ok().unwrap()\n }\n}\n\nfn main() {\n let mut input = Input::new();\n\n let n: usize = input.next();\n let l: usize = input.next();\n\n let mut a: Vec = Vec::with_capacity(n);\n for _ in 0..n {\n let mut value = input.next();\n if value >= l {\n a.push(value);\n }\n }\n\n let mut max_area = 0;\n\n for width in l..(l * 2) {\n let mut height = 0;\n let mut cuttings: Vec = Vec::new();\n for j in 0..a.len() {\n let mut remains = a[j];\n while remains == width || remains >= width + l {\n height += 1;\n remains -= width;\n }\n if remains > 0 && (remains >= width || remains <= width - l) {\n cuttings.push(remains);\n }\n }\n cuttings.sort();\n while cuttings.len() > 0 {\n let mut remains = cuttings.pop().unwrap();\n while cuttings.len() > 0 && remains < width {\n remains += cuttings.drain(0..1).next().unwrap();\n }\n if remains >= width {\n height += 1;\n }\n }\n let area = width * height;\n if area > max_area {\n max_area = area;\n }\n \/\/println!(\"{:?}\", width * height);\n }\n println!(\"{}\", max_area);\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":542} {"difficulty":1200,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"9_B","execute_outcome":"WRONG_ANSWER","source_code":"use std::io::BufRead;\r\n\r\n\/**\r\n * B. Running Student\r\n * time limit per test: 1 second\r\n * memory limit per test: 64 megabytes\r\n * input: standard input\r\n * output: standard output\r\n *\r\n * And again a misfortune fell on Poor Student. He is being late for an exam.\r\n *\r\n * Having rushed to a bus stop that is in point (0,\u00e2\u0080\u00890), he got on a minibus and they drove along a straight line, parallel\r\n * to axis OX, in the direction of increasing x.\r\n *\r\n * Poor Student knows the following:\r\n * during one run the minibus makes n stops, the i-th stop is in point (xi,\u00e2\u0080\u00890)\r\n * coordinates of all the stops are different\r\n * the minibus drives at a constant speed, equal to vb\r\n * it can be assumed the passengers get on and off the minibus at a bus stop momentarily\r\n * Student can get off the minibus only at a bus stop\r\n * Student will have to get off the minibus at a terminal stop, if he does not get off earlier\r\n * the University, where the exam will be held, is in point (xu,\u00e2\u0080\u0089yu)\r\n * Student can run from a bus stop to the University at a constant speed vs as long as needed\r\n * a distance between two points can be calculated according to the following formula:\r\n * d = sqrt((x_2 - x_1) ^ 2 + (y_2 - y_1) ^ 2)\r\n * Student is already on the minibus, so, he cannot get off at the first bus stop\r\n * Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get\r\n * off. If such bus stops are multiple, choose the bus stop closest to the University.\r\n *\r\n * Input\r\n * The first line contains three integer numbers: 2\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089n\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089100, 1\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089vb,\u00e2\u0080\u0089vs\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u00891000. The second line contains n non-negative\r\n * integers in ascending order: coordinates xi of the bus stop with index i. It is guaranteed that x1 equals to zero, and\r\n * xn\u00e2\u0080\u0089\u00e2\u0089\u00a4\u00e2\u0080\u0089105. The third line contains the coordinates of the University, integers xu and yu, not exceeding 105 in absolute\r\n * value.\r\n *\r\n * Output\r\n * In the only line output the answer to the problem \u00e2\u0080\u0094 index of the optimum bus stop.\r\n *\r\n * Examples\r\n * Input\r\n * 4 5 2\r\n * 0 2 4 6\r\n * 4 1\r\n * \r\n * Output\r\n * 3\r\n * \r\n * Input\r\n * 2 1 1\r\n * 0 100000\r\n * 100000 100000\r\n * \r\n * Output\r\n * 2\r\n * \r\n * Note\r\n * As you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be\r\n * surprised, if Student's speed is higher than the speed of the minibus.\r\n *\/\r\nfn main() {\r\n let stdin = std::io::stdin();\r\n let mut lines = stdin.lock().lines();\r\n\r\n let first_line = lines.next().unwrap().unwrap();\r\n let mut first_line = first_line\r\n .split_ascii_whitespace()\r\n .map(|v| v.parse().unwrap());\r\n\r\n let n: usize = first_line.next().unwrap();\r\n let vb = first_line.next().unwrap();\r\n let vs = first_line.next().unwrap();\r\n let (vb, vs) = (vb as f64, vs as f64);\r\n\r\n let bus_stops: Vec = lines\r\n .next()\r\n .unwrap()\r\n .unwrap()\r\n .split_ascii_whitespace()\r\n .take(n)\r\n .map(|v| v.parse().unwrap())\r\n .collect();\r\n\r\n let university_line = lines.next().unwrap().unwrap();\r\n let (ux, uy) = university_line.split_once(' ').unwrap();\r\n let (ux, uy): (isize, isize) = (ux.parse().unwrap(), uy.parse().unwrap());\r\n let (ux, uy) = (ux as f64, uy as f64);\r\n\r\n let mut time_to_stop = vec![0.; bus_stops.len()];\r\n for i in 1..time_to_stop.len() {\r\n let prev_stop = bus_stops[i - 1];\r\n let stop = bus_stops[i];\r\n time_to_stop[i] = time_to_stop[i - 1] + (stop - prev_stop) as f64 \/ vb;\r\n }\r\n\r\n let bus_stop = bus_stops\r\n .into_iter()\r\n .zip(time_to_stop)\r\n .map(|(x, bus_time)| {\r\n let (dx, dy) = (ux - x as f64, uy);\r\n let distance = (dx * dx + dy * dy).sqrt();\r\n let student_time = distance \/ vs;\r\n bus_time + student_time\r\n })\r\n .enumerate()\r\n .skip(1)\r\n .min_by(|a, b| a.1.partial_cmp(&b.1).unwrap())\r\n .map(|(i, _)| i + 1)\r\n .unwrap();\r\n\r\n println!(\"{bus_stop}\");\r\n}\r\n","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,0), 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,0) 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,yu) 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\u2264n\u2264100, 1\u2264vb,vs\u22641000. 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\u226410^5. The third line contains the coordinates of the University, integers xu and yu, not exceeding 10^5 in absolute value. \n","output_specification":"In the only line output the answer to the problem \u2014 index of the optimum bus stop.\n","notes":"As 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.\n","sample_inputs":["4 5 2\n0 2 4 6\n4 1\n","2 1 1\n0 100000\n100000 100000\n"],"sample_outputs":["3","2"],"human_solution":"use std::io;\nfn main(){\n let mut input = String::new();\n io::stdin().read_line(&mut input).expect(\"Err\");\n let mut speeds: Vec = vec![];\n\n for i in input.trim().to_string().split(\" \"){\n speeds.push(i.parse::().unwrap());\n }\n\n input = String::new();\n io::stdin().read_line(&mut input).expect(\"Err\");\n let mut stops: Vec = vec![];\n for i in input.trim().to_string().split(\" \"){\n stops.push(i.parse::().unwrap());\n }\n\n input = String::new();\n io::stdin().read_line(&mut input).expect(\"Err\");\n let mut pos: Vec = vec![];\n for i in input.trim().to_string().split(\" \"){\n pos.push(i.parse::().unwrap());\n }\n\n let mut best: [f64; 2] = [2147483647 as f64; 2];\n\n for i in 0..stops.len(){\n let j = stops[i];\n if j == 0{\n continue;\n }\n let bus_time: f64 = j as f64 \/ speeds[1] as f64;\n let sprint_time: f64 = hyp(j as i64, pos[0], 0, pos[1]) \/ speeds[2] as f64;\n if bus_time + sprint_time <= best[0]{\n best[0] = bus_time + sprint_time;\n best[1] = i as f64;\n }\n }\n\n println!(\"{}\", best[1] as u64 + 1 as u64);\n}\n\nfn hyp(x1: i64, x2: i64, y1: i64, y2: i64) -> f64{\n ((((x2-x1) as i64).pow(2) + ((y2-y1) as i64).pow(2)) as f64).sqrt()\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":543} {"difficulty":800,"lang":"Rust","lang_cluster":"Rust","src_uid":"b2ee84d23d73947fa84faaaebfde85c8","execute_outcome":"RUNTIME_ERROR","source_code":"use std::*;\r\nuse io::stdin;\r\nuse cmp::Ordering;\r\n\/\/ use process::exit;\r\n\/\/ use fs::File;\r\n\/\/ use io::{BufRead, BufReader};\r\n\r\nfn resolve_pool(\r\n s: &[bool], mut offset: usize, lhs: Vec, rhs: Vec,\r\n \/\/ f: &mut BufReader,\r\n) -> Result<(Vec, usize), FailReason> {\r\n \/\/ let mut line = String::new();\r\n \/\/ if f.read_line(&mut line).is_err() {\r\n \/\/ exit(99)\r\n \/\/ }\r\n \/\/ let lmr: Vec = line\r\n \/\/ .split(' ')\r\n \/\/ \/\/ .filter_map(|x|\r\n \/\/ \/\/ if x.contains('\\n') || x.contains('\\r') {\r\n \/\/ \/\/ None\r\n \/\/ \/\/ } else {\r\n \/\/ \/\/ Some(x.parse::().unwrap())\r\n \/\/ \/\/ })\r\n \/\/ .map(|x| {\r\n \/\/ let x: String = x.chars().take_while(|c| !['\\n', '\\r'].contains(c)).collect();\r\n \/\/ x.parse::().unwrap()\r\n \/\/ })\r\n \/\/ .collect();\r\n \/\/ assert_eq!(lmr.len(), 3);\r\n \/\/ let (l, m, r) = (lmr[0], lmr[1], lmr[2]);\r\n \/\/ assert_eq!(m - l, lhs.len());\r\n \/\/ assert_eq!(r - m, rhs.len());\r\n\r\n \/\/ let init_offset = offset;\r\n let mut l_ptr: usize = 0;\r\n let mut r_ptr: usize = 0;\r\n let mut next_pool = vec![];\r\n while l_ptr < lhs.len() && r_ptr < rhs.len() {\r\n \/\/ let l = &mut lhs[l_ptr];\r\n \/\/ let r = &mut rhs[r_ptr];\r\n let fst =\r\n if let Some(&c) = s.get(offset) {\r\n c\r\n } else {\r\n \/\/ dbg!(lhs);\r\n \/\/ dbg!(rhs);\r\n \/\/ exit(16);\r\n return Err(FailReason::NotEnoughMerges);\r\n };\r\n if !fst {\r\n next_pool.push(lhs[l_ptr]);\r\n \/\/ l.history.get_mut().push(false);\r\n \/\/ next_pool.push(Val {\r\n \/\/ val: lhs[l_ptr].val,\r\n \/\/ history: Cell::new(lhs[l_ptr].history.take()),\r\n \/\/ });\r\n l_ptr += 1;\r\n } else {\r\n next_pool.push(rhs[r_ptr]);\r\n \/\/ r.history.get_mut().push(true);\r\n \/\/ next_pool.push(Val {\r\n \/\/ val: rhs[r_ptr].val,\r\n \/\/ history: Cell::new(rhs[r_ptr].history.take()),\r\n \/\/ });\r\n r_ptr += 1;\r\n }\r\n offset += 1;\r\n }\r\n if l_ptr < lhs.len() {\r\n next_pool.extend(lhs[l_ptr..].iter())\r\n \/\/ for i in l_ptr..lhs.len() {\r\n \/\/ lhs[i].history.get_mut().push(false);\r\n \/\/ next_pool.push(Val {\r\n \/\/ val: lhs[i].val,\r\n \/\/ history: Cell::from(lhs[i].history.take()),\r\n \/\/ })\r\n \/\/ }\r\n } else {\r\n next_pool.extend(rhs[r_ptr..].iter())\r\n \/\/ for i in r_ptr..rhs.len() {\r\n \/\/ rhs[i].history.get_mut().push(true);\r\n \/\/ next_pool.push(Val {\r\n \/\/ val: rhs[i].val,\r\n \/\/ history: Cell::from(rhs[i].history.take()),\r\n \/\/ })\r\n \/\/ }\r\n }\r\n \/\/ let adv = offset - init_offset;\r\n \/\/ let mut line = String::new();\r\n \/\/ if f.read_line(&mut line).is_err() {\r\n \/\/ exit(99)\r\n \/\/ }\r\n \/\/ let line: String = line.chars().take_while(|c| !['\\n', '\\r'].contains(c)).collect();\r\n \/\/ let act_adv =\r\n \/\/ if let Ok(act_adv) = line.parse::() {\r\n \/\/ act_adv\r\n \/\/ } else {\r\n \/\/ dbg!(line);\r\n \/\/ exit(98)\r\n \/\/ };\r\n \/\/ assert_eq!(adv, act_adv);\r\n\r\n Ok((next_pool, offset))\r\n}\r\n\r\n#[derive(Debug)]\r\nenum FailReason {\r\n NotEnoughMerges,\r\n TooManyMerges,\r\n}\r\n\r\ntype Val = usize;\r\n\r\n\/\/ struct Val {\r\n\/\/ val: usize,\r\n\/\/ history: Cell>,\r\n\/\/ }\r\n\r\nfn solve(s: &[bool]) -> Vec {\r\n fn solve_with_assumed_size(\r\n s: &[bool], vals: Vec,\r\n \/\/ f: &mut BufReader,\r\n ) -> Result, FailReason> {\r\n fn rec_resolve(\r\n mut rg: Vec,\r\n s: &[bool], offset: usize,\r\n \/\/ f: &mut BufReader,\r\n ) -> Result<(Vec, usize), FailReason> {\r\n if rg.len() <= 1 {\r\n return Ok((rg, offset));\r\n }\r\n let lhs_upper = rg.len() >> 1;\r\n let rhs = rg.drain(lhs_upper..).collect();\r\n let lhs = rg;\r\n let res = rec_resolve(lhs, s, offset).unwrap();\r\n let (left_part_of_pool, offset) = res;\r\n let res = rec_resolve(rhs, s, offset).unwrap();\r\n let (right_part_of_pool, offset) = res;\r\n\r\n Ok(resolve_pool(s, offset, left_part_of_pool, right_part_of_pool)?)\r\n }\r\n\r\n \/\/ let merge_count = f64::log2(sz as f64) as usize;\r\n \/\/ let mut known_relations = vec![vec![None; vals.len()]; vals.len()];\r\n\r\n let (vals, offset) = rec_resolve(vals, s, 0)?;\r\n match offset.cmp(&s.len()) {\r\n Ordering::Less => Err(FailReason::TooManyMerges),\r\n Ordering::Greater => Err(FailReason::NotEnoughMerges),\r\n\r\n Ordering::Equal => {\r\n let mut ans = vec![0; vals.len()];\r\n for (i, pos) in vals.into_iter().enumerate() {\r\n ans[pos] = i + 1;\r\n }\r\n Ok(ans)\r\n }\r\n }\r\n }\r\n\r\n let mut lower_bound = 2;\r\n let mut upper_bound = 1e5 as usize;\r\n \/\/ let mut lower_bound = upper_bound;\r\n let mut vals = Vec::with_capacity(upper_bound);\r\n for i in 0..upper_bound {\r\n vals.push(i)\r\n \/\/ vals.push(Val { val: i, history: Cell::new(vec![]) });\r\n }\r\n let mut prev_assumed_size = None;\r\n loop {\r\n \/\/ let f = File::open(\"C:\\\\Users\\\\nikol\\\\Documents\\\\Jupyter\\\\log.txt\").unwrap();\r\n \/\/ let mut f = BufReader::new(f);\r\n let assumed_size = (|| {\r\n let assumed_size = lower_bound + (upper_bound - lower_bound) \/ 2;\r\n if let Some(prev_assumed_size) = prev_assumed_size {\r\n if assumed_size == prev_assumed_size {\r\n return assumed_size + 1;\r\n }\r\n }\r\n assumed_size\r\n })();\r\n let mut vals_to_pass = vec![];\r\n for i in 0..assumed_size {\r\n vals_to_pass.push(i);\r\n \/\/ let val = &mut vals[i];\r\n \/\/ vals_to_pass.push(Val {\r\n \/\/ val: val.val,\r\n \/\/ history: Cell::new(val.history.get_mut().clone()),\r\n \/\/ })\r\n }\r\n match solve_with_assumed_size(s, vals_to_pass) {\r\n Ok(ans) => return ans,\r\n Err(FailReason::NotEnoughMerges) => {\r\n upper_bound = assumed_size;\r\n }\r\n Err(FailReason::TooManyMerges) => {\r\n lower_bound = assumed_size;\r\n }\r\n }\r\n prev_assumed_size = Some(assumed_size);\r\n }\r\n}\r\n\r\nfn main() {\r\n let mut buffer = String::new();\r\n stdin().read_line(&mut buffer);\r\n let buffer = Vec::from(buffer\r\n .chars()\r\n .filter_map(|x| {\r\n match x {\r\n '0' => Some(false),\r\n '1' => Some(true),\r\n _ => None\r\n }\r\n })\r\n .collect::>());\r\n let ans = solve(&buffer);\r\n println!(\"{}\", ans.len());\r\n for v in ans {\r\n print!(\"{} \", v);\r\n }\r\n}\r\n","description":"\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435\u043c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Python: def sort(a): n = len(a) b = [0 for i in range(n)] log = [] def mergeSort(l, r): if r - l <;= 1: return m = (l + r) >> 1 mergeSort(l, m) mergeSort(m, r) i, j, k = l, m, l while i <; m and j <; r: if a[i] <; a[j]: log.append('0') b[k] = a[i] i += 1 else: log.append('1') b[k] = a[j] j += 1 k += 1 while i <; m: b[k] = a[i] i += 1 k += 1 while j <; r: b[k] = a[j] j += 1 k += 1 for p in range(l, r): a[p] = b[p] mergeSort(0, n) return \"\".join(log)\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438.\u0421\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0412\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u0435 \u0412\u0430\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 $$$a$$$ (\u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 $$$n$$$ \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 $$$1$$$ \u0434\u043e $$$n$$$), \u0434\u0430\u043b \u0435\u0451 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sort \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$ \u0412\u0430\u0441\u044f \u043d\u0430\u0448\u0451\u043b, \u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 $$$a$$$ \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0430\u0441\u044c. \u0412\u0430\u0441\u044f \u0445\u043e\u0447\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 $$$a$$$ \u0442\u0430\u043a\u0443\u044e, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sort \u043e\u0442 \u043d\u0435\u0451 \u0434\u0430\u0441\u0442 \u0442\u0443 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$. \u041f\u043e\u043c\u043e\u0433\u0438\u0442\u0435 \u0435\u043c\u0443!","input_specification":"\u0412\u0432\u043e\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 $$$s$$$, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0438\u0437 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 0 \u0438 1. \u0412 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u043b\u0438\u043d\u044b $$$16$$$, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0430\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0432\u0430\u0448 \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0434\u043b\u0438\u043d\u0443, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043e\u0442 $$$16$$$.","output_specification":"\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e $$$n$$$\u00a0\u2014 \u0434\u043b\u0438\u043d\u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 $$$n$$$ \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b $$$a_0, a_1, \\ldots, a_{n-1}$$$ ($$$1 \\le a_i \\le n$$$)\u00a0\u2014 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u0432\u0435\u0442\u0430, \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445.","notes":null,"sample_inputs":["00000000000000000000000000000000","11111111111111111111111111111111","101011010001100100011011001111011000011110010"],"sample_outputs":["16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16","16\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1","16\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2"],"human_solution":"use std::io;\r\nuse std::io::Write;\r\n\r\n\/**************************************************\r\n\r\n START OF TEMPLATE CODE\r\n\r\n *************************************************\/\r\n#[allow(unused_macros)]\r\nmacro_rules! dbg {\r\n ($first_val:expr, $($val:expr),+ $(,)?) => {\r\n eprint!(\"[{}:{}] {} = {:?}\",\r\n file!(), line!(), stringify!($first_val), &$first_val);\r\n ($(eprint!(\", {} = {:?}\", stringify!($val), &$val)),+,);\r\n eprintln!();\r\n };\r\n ($first_val:expr) => {\r\n eprintln!(\"[{}:{}] {} = {:?}\",\r\n file!(), line!(), stringify!($first_val), &$first_val);\r\n };\r\n}\r\n\r\nenum InputSource {\r\n Stdin,\r\n FromFile(Vec),\r\n}\r\n\r\nstruct Scanner {\r\n buffer: Vec,\r\n input_source: InputSource,\r\n}\r\n\r\nimpl Scanner {\r\n #[allow(dead_code)]\r\n fn new() -> Self {\r\n Self { buffer: vec![], input_source: InputSource::Stdin }\r\n }\r\n\r\n #[allow(dead_code)]\r\n fn new_file(filename: &str) -> Self {\r\n let file = std::fs::read_to_string(filename).unwrap();\r\n let mut lines: Vec = file.lines().map(|line| String::from(line)).collect();\r\n lines.reverse();\r\n Self { buffer: vec![], input_source: InputSource::FromFile(lines) }\r\n }\r\n\r\n\r\n #[allow(dead_code)]\r\n fn i64(&mut self) -> i64 {\r\n self.next::()\r\n }\r\n\r\n #[allow(dead_code)]\r\n fn i32(&mut self) -> i32 {\r\n self.next::()\r\n }\r\n\r\n #[allow(dead_code)]\r\n fn usize(&mut self) -> usize {\r\n self.next::()\r\n }\r\n\r\n #[allow(dead_code)]\r\n fn vec(&mut self, n: usize) -> Vec {\r\n (0..n).map(|_| self.next::()).collect()\r\n }\r\n\r\n fn next(&mut self) -> T {\r\n loop {\r\n if let Some(token) = self.buffer.pop() {\r\n return token.parse().ok().expect(\"Failed parse\");\r\n }\r\n let mut input = String::new();\r\n match &mut self.input_source {\r\n | InputSource::Stdin => { std::io::stdin().read_line(&mut input).expect(\"Failed read\"); }\r\n | InputSource::FromFile(lines) => {\r\n let line = lines.pop().unwrap();\r\n input = line;\r\n }\r\n }\r\n\r\n self.buffer = input.split_whitespace().rev().map(String::from).collect();\r\n }\r\n }\r\n\r\n #[allow(dead_code)]\r\n fn string(&mut self) -> Vec {\r\n self.next::().into_bytes()\r\n }\r\n}\r\n\r\n\/**************************************************\r\n\r\n END OF TEMPLATE CODE\r\n\r\n *************************************************\/\r\n\r\nfn build(s: &[u8], it: &mut usize, nodes: &mut Vec, l: usize, r: usize) -> bool {\r\n if r - l <= 1 {\r\n return true;\r\n }\r\n let m = (l + r) >> 1;\r\n if !build(s, it, nodes, l, m) {\r\n return false;\r\n }\r\n if !build(s, it, nodes, m, r) {\r\n return false;\r\n }\r\n let mut i = l;\r\n let mut j = m;\r\n let mut b = vec![];\r\n while i < m && j < r {\r\n if *it == s.len() {\r\n return false;\r\n }\r\n if s[*it] == b'0' {\r\n b.push(nodes[i]);\r\n i += 1;\r\n } else if s[*it] == b'1' {\r\n b.push(nodes[j]);\r\n j += 1;\r\n } else {\r\n unreachable!();\r\n }\r\n *it += 1;\r\n }\r\n while i < m {\r\n b.push(nodes[i]);\r\n i += 1;\r\n }\r\n while j < r {\r\n b.push(nodes[j]);\r\n j += 1;\r\n }\r\n for (idx, &val) in b.iter().enumerate() {\r\n nodes[idx + l] = val;\r\n }\r\n true\r\n}\r\n\r\npub fn main() {\r\n let stdout = io::stdout();\r\n let mut out = std::io::BufWriter::new(stdout.lock());\r\n let mut sc = Scanner::new();\r\n\r\n let s = sc.string();\r\n let mut left = 0;\r\n let mut right = 100_005;\r\n while right - left > 1 {\r\n let n = (left + right) >> 1;\r\n\r\n let mut it = 0;\r\n let mut nodes = (0..n).collect();\r\n if !build(&s, &mut it, &mut nodes, 0, n) {\r\n right = n;\r\n } else {\r\n if it == s.len() {\r\n writeln!(out, \"{}\", n).unwrap();\r\n let mut res = vec![0; n];\r\n for (idx, node) in nodes.iter().enumerate() {\r\n res[*node] = idx + 1;\r\n }\r\n for r in &res {\r\n write!(out, \"{} \", r).unwrap();\r\n }\r\n return;\r\n }\r\n left = n;\r\n }\r\n }\r\n unreachable!();\r\n}\r\n","testcases":"[{'input': '00000000000000000000000000000000\\n', 'output': ['16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \\n', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\\n', '16\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16']}, {'input': '11111111111111111111111111111111\\n', 'output': ['16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 \\n', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\n', '16\\n16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1']}, {'input': '101011010001100100011011001111011000011110010\\n', 'output': ['16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2\\n', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2 \\n', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2 ', '16\\n13 6 1 7 12 5 4 15 14 16 10 11 3 8 9 2']}, {'input': '10100010011001001110110110111010011000110100\\n', 'output': ['16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8\\n', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8 ', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8 \\n', '16\\n10 6 5 12 1 2 13 7 16 11 15 3 14 9 4 8']}, {'input': '100101110000101110101111001010101110000001101110\\n', 'output': ['17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12 ', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14\\n', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12\\n', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14 \\n', '17\\n4 1 2 13 6 5 9 3 8 17 16 11 12 7 10 15 14 ', '16\\n6 3 4 15 8 7 11 5 2 16 13 10 9 1 14 12 \\n']}, {'input': '000100100101010100110101101010001011000110111\\n', 'output': ['16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9\\n', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9 ', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9 \\n', '16\\n3 11 7 16 1 6 15 8 10 12 2 5 4 14 13 9']}, {'input': '1101100011000111011100110111010100100111010001101\\n', 'output': ['16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5 \\n', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5\\n', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5', '16\\n14 2 7 3 9 16 10 11 12 6 13 4 15 1 8 5 ']}, {'input': '00010001101001111001010111100100101001110001101\\n', 'output': ['16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3 ', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3\\n', '16\\n2 9 5 16 11 14 4 10 12 6 7 13 15 8 1 3 \\n']}, {'input': '10101011010111001100100111010011010011011100000\\n', 'output': ['16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4 \\n', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4 ', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4', '16\\n14 11 2 12 6 13 10 3 7 1 5 15 9 16 8 4\\n']}, {'input': '111010100010110101100011001010011100111010101001\\n', 'output': ['16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1\\n', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1 ', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1 \\n', '16\\n16 7 13 2 3 9 14 11 6 8 15 4 5 10 12 1']}, {'input': '0001101001100110000101010100000100001111010\\n', 'output': ['16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15 ', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15 \\n', '16\\n4 14 5 12 1 2 7 6 3 9 10 11 16 13 8 15\\n']}, {'input': '001110001100100010110111111000100111001101011\\n', 'output': ['16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3\\n', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3 ', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3 \\n', '16\\n12 15 6 7 2 1 10 16 8 14 11 9 5 13 4 3']}, {'input': '100100110010011100100110110100110110011011100000\\n', 'output': ['16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8\\n', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8 \\n', '16\\n14 4 7 15 11 12 13 3 5 6 1 10 16 2 9 8 ']}, {'input': '001010100001101110100011101000010111010110000\\n', 'output': ['16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4\\n', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4 \\n', '16\\n3 15 1 12 7 9 14 13 6 5 2 8 11 16 10 4 ']}, {'input': '001001111101101000101111100010011010100001110\\n', 'output': ['16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2 \\n', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2\\n', '16\\n9 11 4 15 10 8 6 1 3 7 5 13 16 14 12 2 ']}, {'input': '010011010100000100000111011001011111100000101\\n', 'output': ['16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5 ', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5 \\n', '16\\n8 9 11 10 14 1 16 12 3 6 15 7 2 13 4 5\\n']}, {'input': '1010011111000101001001001101100110101001100\\n', 'output': ['16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8 \\n', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8 ', '16\\n7 5 2 10 14 13 9 1 15 6 12 16 3 4 11 8\\n']}, {'input': '00001001000101101101000010011011101111000010100\\n', 'output': ['16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11 \\n', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12\\n', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11\\n', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12 ', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12 \\n', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11', '16\\n2 7 9 14 12 8 10 15 13 1 16 5 3 6 4 11 ', '17\\n1 6 8 13 11 7 9 14 16 4 17 15 3 5 2 10 12']}, {'input': '1001010000011100101000100111000111101011000000\\n', 'output': ['16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3 ', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3\\n', '16\\n12 4 6 13 10 9 11 14 8 7 5 16 1 2 15 3 \\n']}, {'input': '110111101011010110010001001001110101110101101\\n', 'output': ['16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10 ', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10 \\n', '16\\n16 7 15 12 9 1 14 3 11 4 5 13 6 8 2 10\\n']}, {'input': '011011010000111001100101001000000001110111101\\n', 'output': ['16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14\\n', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14 \\n', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14', '16\\n2 15 13 1 8 4 3 16 7 6 10 9 12 11 5 14 ']}, {'input': '100100001011100011110001000011100011100011010010\\n', 'output': ['16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9\\n', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9 ', '16\\n12 7 10 15 1 6 5 13 11 3 14 2 4 8 16 9 \\n']}, {'input': '011011001001110111101101011001101100100111101001\\n', 'output': ['16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9\\n', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9 \\n', '16\\n11 16 14 2 6 3 5 13 15 7 10 4 12 8 1 9 ']}, {'input': '111000110111011010101110001000111011111\\n', 'output': ['16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2\\n', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2 ', '16\\n15 14 16 11 10 13 12 4 1 5 6 3 8 7 9 2 \\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7\\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7 \\n', '15\\n15 13 1 2 14 6 12 8 4 3 5 10 11 9 7 ']}, {'input': '1001101100101000100110010110100010011010011011\\n', 'output': ['16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13 \\n', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13 ', '16\\n12 3 8 9 6 15 16 2 11 4 7 10 5 14 1 13\\n']}, {'input': '000100110000010001011001111011010000000\\n', 'output': ['16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12 \\n', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12\\n', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12', '16\\n1 4 3 6 7 8 9 5 14 16 11 15 13 2 10 12 ']}, {'input': '10010111010100011011101001011100111111101\\n', 'output': ['16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7\\n', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7 ', '16\\n12 1 10 13 16 14 15 2 11 4 9 8 6 5 3 7 \\n']}, {'input': '110111110111000010011001001010110010110110000\\n', 'output': ['16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14 \\n', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14 ', '16\\n11 4 10 7 13 2 12 1 16 5 8 15 6 9 3 14\\n']}, {'input': '0010010100001000110010101001001111010111\\n', 'output': ['16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9 \\n', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9\\n', '16\\n7 12 5 13 15 14 11 16 2 4 6 1 10 8 3 9 ']}, {'input': '100100110110000110111101100100100000000\\n', 'output': ['16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14\\n', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14 ', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14', '16\\n5 3 4 6 7 9 8 2 13 1 12 10 16 11 15 14 \\n']}, {'input': '1110100100011111001010101011110010001000\\n', 'output': ['16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12 \\n', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12 ', '16\\n10 8 9 1 4 5 2 6 15 3 14 16 13 11 7 12\\n']}, {'input': '101000101011011110111101100010000000010\\n', 'output': ['16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14\\n', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14 ', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14', '16\\n7 6 3 9 1 4 5 2 13 8 11 10 16 12 15 14 \\n']}, {'input': '001011101100010011000010101111000010000\\n', 'output': ['16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12 \\n', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12\\n', '16\\n2 6 1 3 9 4 8 7 14 15 16 5 11 13 10 12 ']}, {'input': '0111100011001111000011010010011110110011\\n', 'output': ['16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7\\n', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7 \\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12 \\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12', '16\\n15 16 10 9 6 1 13 14 4 2 8 5 11 12 3 7 ', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12\\n', '15\\n11 1 10 7 2 15 14 13 9 8 5 3 4 6 12 ']}, {'input': '01001100100111101111001000100110000010110\\n', 'output': ['16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15 ', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15\\n', '16\\n4 5 13 10 6 1 8 7 14 11 3 9 12 2 16 15 \\n']}, {'input': '10110111011110100000000100010011000100\\n', 'output': ['16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16 ', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16 \\n', '16\\n12 11 1 9 7 8 4 3 2 5 13 10 6 14 15 16\\n']}, {'input': '01111000000110000000001010111011101011001\\n', 'output': ['16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9 ', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9 \\n', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9\\n', '16\\n8 14 6 2 12 11 15 16 3 5 10 13 1 4 7 9']}, {'input': '010011000110111111110010010000010111110101\\n', 'output': ['15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12\\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12 ', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12\\n', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12 \\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12 \\n', '15\\n5 1 15 3 11 13 2 10 9 7 6 8 4 14 12 ', '16\\n1 5 16 15 3 2 13 11 10 9 7 6 8 4 14 12']}, {'input': '011110111101011100000001101100101011100010\\n', 'output': ['16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13\\n', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13 ', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13', '16\\n12 14 10 4 11 6 1 2 8 3 16 15 5 7 9 13 \\n']}, {'input': '000001000010100000101101101110110000110100\\n', 'output': ['16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4 \\n', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4 ', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4\\n', '16\\n2 5 7 11 6 8 14 13 1 9 15 16 12 10 3 4']}, {'input': '110001001100000011000001001000011111100000\\n', 'output': ['16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16\\n', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16 ', '16\\n10 3 12 11 1 2 14 13 7 9 4 6 5 8 15 16 \\n']}, {'input': '101101110110000000010010011111000001011111\\n', 'output': ['16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11\\n', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11 ', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12 ', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12', '16\\n9 7 3 6 15 16 5 4 2 8 13 14 1 10 12 11 \\n', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12 \\n', '15\\n4 9 7 15 3 6 5 2 8 13 14 10 11 1 12\\n']}, {'input': '0111100001000111110111011111111000111\\n', 'output': ['16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3\\n', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3 ', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3 \\n', '16\\n12 13 8 6 14 7 15 16 11 10 9 2 5 4 1 3']}, {'input': '1\\n', 'output': ['2\\n2 1', '2\\n2 1 ', '2\\n2 1\\n', '2\\n2 1 \\n']}, {'input': '110\\n', 'output': ['3\\n2 3 1 ', '3\\n2 3 1\\n', '3\\n2 3 1 \\n', '3\\n2 3 1']}, {'input': '1111\\n', 'output': ['4\\n4 3 2 1 \\n', '4\\n4 3 2 1', '4\\n4 3 2 1\\n', '4\\n4 3 2 1 ']}, {'input': '10101011\\n', 'output': ['5\\n5 2 3 1 4 \\n', '5\\n5 2 3 1 4\\n', '6\\n2 6 5 1 4 3 \\n', '5\\n5 2 3 1 4 ', '6\\n2 6 5 1 4 3 ', '5\\n5 2 3 1 4', '6\\n2 6 5 1 4 3\\n']}, {'input': '1001101010\\n', 'output': ['6\\n1 5 3 6 2 4\\n', '6\\n1 5 3 6 2 4 \\n', '6\\n1 5 3 6 2 4 ', '6\\n1 5 3 6 2 4']}, {'input': '110011000010\\n', 'output': ['7\\n2 4 1 5 6 7 3\\n', '7\\n2 4 1 5 6 7 3', '7\\n2 4 1 5 6 7 3 ', '7\\n2 4 1 5 6 7 3 \\n']}, {'input': '1000000110111001\\n', 'output': ['8\\n5 1 6 8 2 7 3 4 \\n', '8\\n5 1 6 8 2 7 3 4 ', '8\\n5 1 6 8 2 7 3 4\\n', '8\\n5 1 6 8 2 7 3 4']}, {'input': '111001011011010110101\\n', 'output': ['9\\n7 5 9 2 6 1 8 3 4 \\n', '9\\n7 5 9 2 6 1 8 3 4 ', '9\\n7 5 9 2 6 1 8 3 4\\n', '9\\n7 5 9 2 6 1 8 3 4']}, {'input': '0010011110111011101100100\\n', 'output': ['11\\n1 8 5 4 7 2 11 10 9 6 3 \\n', '10\\n2 9 6 5 8 10 3 7 1 4 \\n', '10\\n2 9 6 5 8 10 3 7 1 4 ', '11\\n1 8 5 4 7 2 11 10 9 6 3\\n', '10\\n2 9 6 5 8 10 3 7 1 4\\n', '11\\n1 8 5 4 7 2 11 10 9 6 3', '11\\n1 8 5 4 7 2 11 10 9 6 3 ']}, {'input': '10100000110010111110101000\\n', 'output': ['11\\n6 4 9 8 10 1 3 11 5 7 2', '11\\n6 4 9 8 10 1 3 11 5 7 2\\n', '11\\n6 4 9 8 10 1 3 11 5 7 2 ', '11\\n6 4 9 8 10 1 3 11 5 7 2 \\n']}, {'input': '01011101110111101010100101001111\\n', 'output': ['12\\n7 1 12 6 4 2 11 5 9 8 10 3', '12\\n7 1 12 6 4 2 11 5 9 8 10 3 \\n', '12\\n7 1 12 6 4 2 11 5 9 8 10 3 ', '12\\n7 1 12 6 4 2 11 5 9 8 10 3\\n']}, {'input': '0111111011011001011111010011110010\\n', 'output': ['13\\n12 3 10 9 4 1 13 8 11 5 7 2 6 ', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6\\n', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6 \\n', '13\\n12 3 10 9 4 1 13 8 11 5 7 2 6']}, {'input': '1101101110101100100001011001010001100\\n', 'output': ['14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14 \\n', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14 ', '14\\n6 11 3 10 1 7 5 2 8 13 9 4 12 14\\n']}, {'input': '01001001010101100011101010101110001101011\\n', 'output': ['15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2\\n', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2 ', '15\\n9 5 14 4 6 15 11 3 1 12 8 10 13 7 2 \\n']}, {'input': '1110100000111010101000010011001000100011111010011100101100010010101011110100010101111010111010110010000100101010\\n', 'output': ['31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27\\n', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27 \\n', '31\\n15 12 4 18 19 23 20 24 10 16 6 21 28 30 26 25 29 7 9 31 13 17 11 22 8 1 3 2 14 5 27 ']}, {'input': '101010111001101011001110110011101101101101010101001111110011110001000110101101111101111101001000110001100101001001011101001100100011000110001101010110011011010011010110000100110100001100111101110101\\n', 'output': ['46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7 \\n', '46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7\\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7 \\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7\\n', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7 ', '46\\n32 5 20 3 28 15 43 17 25 16 23 46 41 6 45 9 37 14 31 26 11 27 19 35 10 21 12 1 30 24 2 36 8 40 29 13 33 18 42 34 4 38 22 44 39 7 ', '45\\n37 6 23 5 31 16 45 19 26 17 25 43 14 11 41 3 15 32 27 20 28 9 12 24 21 2 1 36 30 10 8 40 35 29 34 18 33 13 42 22 4 38 44 39 7']}, {'input': '1011111000101010101110001011100111110010100110011001000111011000111000101101000001101011011110001010110001101011001100010010101011000100111010111010101100001001010010110001101100011001110100011001110010101101001111011000001010111100100001001001101000101001101100011011110110000101101000110110110010101111111010110100011100001011001010110011111000011010000111111001111100001111001101001100001101110000110001110010101011100101011011111011011011011010110011010010011010001011100000111100110101010100101000001001001...', 'output': ['94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12\\n', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12 ', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12 \\n', '94\\n77 59 58 1 45 38 68 91 39 21 84 70 57 47 4 15 36 55 88 29 79 18 82 32 72 90 48 65 76 81 56 64 85 6 41 42 9 49 27 87 24 74 33 94 51 2 83 40 66 60 54 26 13 23 46 22 25 75 43 8 93 31 17 67 16 44 80 53 10 71 34 86 5 62 89 30 92 69 7 73 63 3 20 28 61 14 50 19 52 11 78 35 37 12']}, {'input': '1001100000101101110001101011011101000101000011010011001011000001010110011111101001111001010011100010111011000001110111110111010111000111010000101000101011111001100001011111110100100000110100110100100111000001100011110101100011111010010010110101101110110011101010011000010111000110110100010011011011010110010111000110101000000011100100101110101001001101010000101111111011011011000000010101101010111001100001011101101011100101010000110111111000010000111000110101111100010001101101110110001011011111101111101111001...', 'output': ['163\\n101 95 14 87 155 59 149 44 65 116 83 102 21 100 47 107 78 43 163 159 28 156 35 17 147 125 134 63 7 26 122 56 2 104 133 51 57 111 97 93 73 45 79 123 132 144 113 70 18 22 84 131 49 80 127 66 109 161 91 120 105 158 145 76 39 20 64 85 27 90 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 24 ...', '164\\n97 87 2 78 147 56 134 35 59 107 65 100 14 95 43 102 63 28 159 156 122 164 125 44 163 149 155 133 7 101 104 83 47 93 111 51 17 21 26 116 57 73 109 66 18 70 131 22 144 132 120 79 113 123 127 49 84 80 45 161 91 145 76 158 105 39 20 64 27 90 85 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 ...', '164\\n97 87 2 78 147 56 134 35 59 107 65 100 14 95 43 102 63 28 159 156 122 164 125 44 163 149 155 133 7 101 104 83 47 93 111 51 17 21 26 116 57 73 109 66 18 70 131 22 144 132 120 79 113 123 127 49 84 80 45 161 91 145 76 158 105 39 20 64 27 90 85 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86...', '163\\n101 95 14 87 155 59 149 44 65 116 83 102 21 100 47 107 78 43 163 159 28 156 35 17 147 125 134 63 7 26 122 56 2 104 133 51 57 111 97 93 73 45 79 123 132 144 113 70 18 22 84 131 49 80 127 66 109 161 91 120 105 158 145 76 39 20 64 85 27 90 19 72 77 55 46 160 16 112 6 162 75 92 128 98 103 25 146 119 12 121 153 118 88 148 81 15 32 34 136 68 142 157 115 141 3 129 61 82 8 69 71 151 74 31 10 23 130 58 99 138 150 67 54 42 41 37 94 108 152 62 38 126 110 5 13 124 36 89 29 96 48 40 11 143 114 52 60 9 30 33 86 24 1...']}, {'input': '1111101001001101110000000110011111000011101001111001010110000100001011100010111101010110101110011111100101100110111010101100000001011101011001110010100000000001110001101110010110111001001111111111100111010100100100110101010100010010100010111101010010000101110100111100101100101010111010110000010011101000111110101010000011001001101100010010110001011101111001101100111000111001111110100011001100000110101001001010101111110010000001001100000011100110011101110110110001111101011000100101000100010001101001001100110...', 'output': ['321\\n220 215 226 218 201 89 229 92 231 168 10 14 227 183 214 166 54 273 213 48 280 285 257 145 274 73 278 24 169 263 232 184 39 18 56 146 318 141 11 53 77 225 191 151 188 179 217 63 27 216 237 189 186 83 43 301 78 164 267 194 221 144 61 207 258 249 277 84 45 174 66 199 55 132 180 282 16 143 120 155 153 187 34 108 90 288 235 313 321 271 126 101 38 47 270 62 243 98 148 242 279 109 79 208 133 82 259 3 289 311 9 21 190 162 309 119 36 7 295 234 116 128 142 211 15 172 160 315 298 94 171 262 91 130 165 287 193 1 ...', '321\\n220 215 226 218 201 89 229 92 231 168 10 14 227 183 214 166 54 273 213 48 280 285 257 145 274 73 278 24 169 263 232 184 39 18 56 146 318 141 11 53 77 225 191 151 188 179 217 63 27 216 237 189 186 83 43 301 78 164 267 194 221 144 61 207 258 249 277 84 45 174 66 199 55 132 180 282 16 143 120 155 153 187 34 108 90 288 235 313 321 271 126 101 38 47 270 62 243 98 148 242 279 109 79 208 133 82 259 3 289 311 9 21 190 162 309 119 36 7 295 234 116 128 142 211 15 172 160 315 298 94 171 262 91 130 165 287 193 1 1...', '322\\n217 213 221 216 194 84 227 90 228 165 7 10 225 179 211 164 51 270 208 45 278 282 249 143 271 70 274 18 166 259 229 180 36 16 54 144 313 132 9 48 71 220 189 146 186 172 215 61 21 214 234 187 183 79 38 298 73 160 263 191 218 142 56 204 255 243 273 82 39 171 63 193 53 129 174 279 14 141 116 151 169 201 33 109 94 288 235 321 322 283 133 100 55 67 267 77 262 98 153 245 285 115 83 231 145 91 264 1 295 319 24 27 226 184 301 128 34 15 300 232 120 126 148 277 87 190 155 315 311 101 168 287 89 130 162 294 199 7...', '322\\n217 213 221 216 194 84 227 90 228 165 7 10 225 179 211 164 51 270 208 45 278 282 249 143 271 70 274 18 166 259 229 180 36 16 54 144 313 132 9 48 71 220 189 146 186 172 215 61 21 214 234 187 183 79 38 298 73 160 263 191 218 142 56 204 255 243 273 82 39 171 63 193 53 129 174 279 14 141 116 151 169 201 33 109 94 288 235 321 322 283 133 100 55 67 267 77 262 98 153 245 285 115 83 231 145 91 264 1 295 319 24 27 226 184 301 128 34 15 300 232 120 126 148 277 87 190 155 315 311 101 168 287 89 130 162 294 199 78...']}, {'input': '0011111101101011010100011010110000111110001111011101000110111011110010100011100010001110001010010110011011010010101101100101011101110101011100001001010110001011111111110010101100100010110110110011000110010100100110101001011001101011100110100110110100001011110101011101011100111100100100011101101100010110011000110110001001010001011110001110100000111100110000111110011101010110100110011011000111001011000100001000110010001101011010110111100011001011101001011010011111111101010001011111111011100101111110001001010...', 'output': ['632\\n548 630 91 406 487 5 553 316 137 436 586 170 379 565 205 226 323 338 273 37 493 434 238 119 577 166 161 225 617 615 100 141 263 371 199 453 102 237 489 431 423 308 218 187 467 173 107 280 554 357 71 479 176 302 512 246 249 570 445 105 515 252 447 17 498 330 118 250 370 63 321 223 378 576 128 61 239 196 82 36 329 194 395 131 349 54 522 611 30 365 594 290 403 470 144 73 165 157 314 624 262 34 147 409 10 587 416 266 530 389 481 390 358 392 179 77 268 298 242 602 135 540 327 111 618 13 114 291 292 182 535 ...', '632\\n548 630 91 406 487 5 553 316 137 436 586 170 379 565 205 226 323 338 273 37 493 434 238 119 577 166 161 225 617 615 100 141 263 371 199 453 102 237 489 431 423 308 218 187 467 173 107 280 554 357 71 479 176 302 512 246 249 570 445 105 515 252 447 17 498 330 118 250 370 63 321 223 378 576 128 61 239 196 82 36 329 194 395 131 349 54 522 611 30 365 594 290 403 470 144 73 165 157 314 624 262 34 147 409 10 587 416 266 530 389 481 390 358 392 179 77 268 298 242 602 135 540 327 111 618 13 114 291 292 182 535...']}, {'input': '0100010110000111010000100111111111001011100011111011010000001000000000000001000110000111000111000111000000100000100101111101110110001111011111011111000000010000000110111111111011111111111111111101001100111010100010001000001000001011101010001101011010010111111011111111111111110110110111101011011001011111011011110101000110110101000010111111011000000000100000000000100000100000000000000000111111101111111111111111111111110111111111111111111111111110111101101001111010011101101111111110110111011110110111110111101...', 'output': ['912\\n781 780 782 784 786 745 785 776 755 774 778 777 775 779 788 789 787 783 793 792 791 797 795 790 800 794 799 798 746 748 717 692 752 749 750 756 754 753 747 759 757 758 772 770 773 762 771 769 768 767 761 766 765 751 764 760 763 708 706 709 703 704 707 521 711 705 712 713 714 710 715 697 649 699 702 700 701 696 690 566 689 688 695 694 693 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 909 900 908 912 907 911 910 906 905 903 902 901 894...', '912\\n781 780 782 784 786 745 785 776 755 774 778 777 775 779 788 789 787 783 793 792 791 797 795 790 800 794 799 798 746 748 717 692 752 749 750 756 754 753 747 759 757 758 772 770 773 762 771 769 768 767 761 766 765 751 764 760 763 708 706 709 703 704 707 521 711 705 712 713 714 710 715 697 649 699 702 700 701 696 690 566 689 688 695 694 693 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 909 900 908 912 907 911 910 906 905 903 902 901 89...', '911\\n780 779 781 783 785 745 784 775 755 773 777 776 774 778 787 788 786 782 792 791 790 795 794 789 799 793 798 797 749 751 748 747 756 752 753 759 758 757 750 762 760 761 771 769 772 692 770 768 765 766 767 717 754 746 764 763 703 709 704 710 705 706 707 708 712 711 713 521 714 715 696 699 701 649 702 700 697 689 693 694 690 566 695 688 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 908 899 907 911 906 910 909 905 904 902 901 900 893 90...', '911\\n780 779 781 783 785 745 784 775 755 773 777 776 774 778 787 788 786 782 792 791 790 795 794 789 799 793 798 797 749 751 748 747 756 752 753 759 758 757 750 762 760 761 771 769 772 692 770 768 765 766 767 717 754 746 764 763 703 709 704 710 705 706 707 708 712 711 713 521 714 715 696 699 701 649 702 700 697 689 693 694 690 566 695 688 728 729 720 727 723 726 725 698 691 718 722 716 721 719 740 738 739 742 735 744 741 733 724 731 730 732 736 737 734 908 899 907 911 906 910 909 905 904 902 901 900 893 903...']}, {'input': '0110111101010000101101111101010110100110100010111001101101101101110101011101011111111101101101010101000011001000110011011010101110110010101111101110011111011110101111011010011110111111111001101110111011011110110101000111101011110101110101110110110011000110000100111110111100110100011000100110000111010100011111100111010101000101100010110010110111001011100110010001001110110111111011000010000010110000000001010000101100000010000000000001010000010010000101010010000100101101000000001100000011011011101101100001100...', 'output': ['858\\n123 116 122 121 76 111 119 40 120 5 89 15 113 94 6 104 107 60 106 101 68 103 87 47 99 36 70 75 46 25 58 13 62 23 80 83 79 63 84 55 61 22 43 11 49 24 33 8 32 18 30 14 20 134 78 97 136 12 137 132 124 86 118 54 37 67 157 145 155 143 160 162 69 148 150 34 73 125 117 130 180 175 156 181 91 186 195 190 187 184 163 189 98 158 165 100 159 168 59 166 176 178 144 172 164 174 142 291 56 290 288 245 260 283 266 270 281 284 287 272 285 48 282 298 258 296 299 297 300 302 292 82 304 268 277 259 279 278 264 273 274 8...', '858\\n123 116 122 121 76 111 119 40 120 5 89 15 113 94 6 104 107 60 106 101 68 103 87 47 99 36 70 75 46 25 58 13 62 23 80 83 79 63 84 55 61 22 43 11 49 24 33 8 32 18 30 14 20 134 78 97 136 12 137 132 124 86 118 54 37 67 157 145 155 143 160 162 69 148 150 34 73 125 117 130 180 175 156 181 91 186 195 190 187 184 163 189 98 158 165 100 159 168 59 166 176 178 144 172 164 174 142 291 56 290 288 245 260 283 266 270 281 284 287 272 285 48 282 298 258 296 299 297 300 302 292 82 304 268 277 259 279 278 264 273 274 88...']}, {'input': '0011011111111010110100000111010010110100000010000000001000000101000110101101001000111110010001001101110000100111111111110100000000000001100000000011111000100101011110111111111101111100101101000100011110111111111111100111011010000100001001101110100111011000001011110111111110000000000000010000000010000000000000000000000000000000000000100000100010011101011011011011000000111101000110110001010111110000000000110011110111100100111011111111111101001100111011011111111111111011111101111101111111111111111011101011011...', 'output': ['732\\n10 192 191 177 184 199 198 193 196 197 149 195 203 206 205 200 208 207 209 210 211 204 223 226 227 221 228 235 231 233 229 225 232 213 212 201 215 216 202 220 214 222 219 217 218 256 254 259 257 249 252 247 253 250 237 251 240 239 224 238 234 230 244 245 242 241 236 243 274 272 276 275 262 280 278 273 282 277 281 263 248 265 261 258 260 270 266 271 269 264 268 289 307 309 308 306 313 316 311 310 312 279 326 324 325 327 328 315 317 319 314 322 323 318 302 305 304 303 291 300 301 296 298 297 299 293 292...', '732\\n10 192 191 177 184 199 198 193 196 197 149 195 203 206 205 200 208 207 209 210 211 204 223 226 227 221 228 235 231 233 229 225 232 213 212 201 215 216 202 220 214 222 219 217 218 256 254 259 257 249 252 247 253 250 237 251 240 239 224 238 234 230 244 245 242 241 236 243 274 272 276 275 262 280 278 273 282 277 281 263 248 265 261 258 260 270 266 271 269 264 268 289 307 309 308 306 313 316 311 310 312 279 326 324 325 327 328 315 317 319 314 322 323 318 302 305 304 303 291 300 301 296 298 297 299 293 292 ...']}, {'input': '1010101111101101001000010001101111101000101110110011001101000010010101101111100111111111010100110000111001011110111110101000110111110100111100011001010111010101001001011001110011110011011010010000101010011111011010111111100111111101001000110100110101001010011110111110001001101101001100111000010111101101000110111010111111000111110100011001011101111111000110011101101000010110100101011011011001110010111000101111110110011000110110111100100111001100101010001110101110001001111011000000000100110100110111011101110...', 'output': ['594\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 4...', '593\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 4...', '593\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 46...', '594\\n478 450 156 472 474 481 479 347 42 79 334 321 455 23 477 461 77 84 464 204 18 465 15 144 355 120 449 328 21 202 319 69 437 297 366 243 25 256 332 149 278 103 330 376 363 169 273 391 389 364 122 128 384 36 162 257 43 24 292 182 71 163 134 26 315 11 61 86 37 197 28 359 350 168 494 484 517 81 210 523 486 518 225 483 512 126 496 482 112 490 419 495 48 426 175 470 526 379 524 336 3 521 529 519 528 75 515 331 525 527 354 352 67 247 317 158 305 262 234 217 493 161 491 311 187 271 372 139 282 290 10 232 473 46...']}, {'input': '0101110010011011100011111011101111011111111011000000001011110111111111010110101111101100101110111110010011101100101110110111111100000000010001111111111111101111111101111101110111011110101111101110101100010010100110010010000001000000000001100100100110101010100100000011101101001110010011101001000011111111111101111111110111111111110111111100100000010000000000000000000000000000000000000000000100101000011011010001000000110111101011000110010111011110111111111111101101011011100100010110111101101011011110110001000...', 'output': ['809\\n656 654 658 660 659 657 651 649 650 655 639 653 640 642 633 638 637 624 645 644 643 648 646 647 641 621 616 622 618 620 612 613 486 475 615 609 614 635 636 619 632 631 634 630 626 629 625 628 623 627 696 697 689 695 694 693 692 687 691 688 690 667 699 679 701 702 704 700 705 698 707 711 706 708 710 676 677 674 678 675 680 682 683 672 686 684 681 685 663 662 511 665 617 664 673 671 669 666 668 661 670 778 777 779 780 734 781 784 776 783 786 782 785 775 772 774 773 765 770 766 746 762 763 769 767 768 79...', '809\\n656 654 658 660 659 657 651 649 650 655 639 653 640 642 633 638 637 624 645 644 643 648 646 647 641 621 616 622 618 620 612 613 486 475 615 609 614 635 636 619 632 631 634 630 626 629 625 628 623 627 696 697 689 695 694 693 692 687 691 688 690 667 699 679 701 702 704 700 705 698 707 711 706 708 710 676 677 674 678 675 680 682 683 672 686 684 681 685 663 662 511 665 617 664 673 671 669 666 668 661 670 778 777 779 780 734 781 784 776 783 786 782 785 775 772 774 773 765 770 766 746 762 763 769 767 768 797...']}, {'input': '0101111101001000110101110111011111010000000011000010011110000111010110011111011100000000100000010000000000000010100011011110110100101001011110010000001010000100111011111011010010100101111111111101100000000000000001000000000000010000000000000000000000001010001011101111101101110011110110000000011101011101110010000010101110111101111000000000000000010000000000100101001111101111001111010111101000000100110100011010010001101011101101100000000010000111111101111111111111111111111111111111111111110111111111111111111...', 'output': ['562\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 290 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283 ...', '561\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 289 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283 ...', '561\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 289 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283...', '562\\n309 359 357 355 362 360 361 356 369 371 370 354 363 368 367 366 364 373 374 375 372 358 380 377 376 378 388 386 387 382 379 385 383 384 381 394 396 365 395 389 393 391 392 402 405 403 397 398 399 400 390 401 421 420 412 422 415 419 417 416 418 411 414 413 406 407 408 409 404 410 322 327 328 325 321 324 320 323 336 334 335 332 330 329 333 312 331 341 338 340 337 339 345 344 343 342 347 352 351 353 350 346 349 326 348 308 304 306 310 305 290 302 303 318 317 319 315 313 307 316 314 311 285 62 286 284 283...']}, {'input': '0011101101101011010010011001111001111110010100110000010001110100000011010111111101000000101100010110111101110001111010110001111110011111100111001101111110101001111111001010110100101101011000101110100011010001010011111110111101011100100110111110111100011110101011110110111001000100011110111010110101000000011101011011111111011001010011111111101111101101100101110011100011110101110111111110111101011111110101101011011010001101001101001111100111010010100011000100001010101001011111010110110010011001000100101110010...', 'output': ['718\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 1...', '718\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 ...', '719\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 1...', '719\\n290 431 411 284 377 434 429 433 427 365 432 415 435 437 436 413 438 416 334 444 441 428 293 423 298 402 241 424 421 419 425 426 400 412 417 394 379 414 371 369 328 409 107 384 395 403 396 236 399 407 401 408 390 381 405 392 341 393 398 123 376 95 372 382 373 391 295 375 362 315 354 279 287 122 317 313 72 389 378 387 92 386 19 159 289 157 383 281 385 297 45 136 218 27 301 296 304 144 299 138 154 300 307 309 62 320 318 71 308 310 303 105 21 266 100 270 288 282 67 245 278 52 74 196 38 210 112 227 8 1 88 ...']}, {'input': '1101111101011110100111101111111111010001001001101010000010000000000001000001011011011101001110111111110111100110100010111000100010000000000010000000000001010000000000000000000011001011011111010001000001000011110010001011011001011111011111111110111111100101000010001011011110111111111010001011011101010011111101111111011111110000000000000000101000000000000000000000000000000000001000000000000100000000000000010111100001000011001001111111011010011101110010011110001000111011111111110101110010110000101110111011111...', 'output': ['837\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 564...', '838\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 56...', '837\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 56...', '838\\n435 436 433 434 431 242 430 317 429 425 406 427 424 441 438 432 442 439 443 446 440 447 448 451 450 444 463 460 464 459 461 455 457 458 428 454 426 452 453 468 469 456 471 467 470 473 465 474 476 475 477 472 496 497 491 490 484 495 500 499 493 502 501 498 503 487 481 486 488 489 485 462 449 479 483 478 482 480 524 525 523 526 516 527 521 517 522 518 520 508 519 513 511 509 514 512 515 504 505 492 510 506 507 494 577 576 578 580 579 555 570 569 572 571 575 573 574 561 540 560 554 542 559 567 556 566 564...']}, {'input': '1010101011110101000100111101100101100001011001100111010110001110101100001001111110101001111010000011110000100000010011010001001100011001010001101000111001010100011101000100010101001011010000001111110111001101010110101101101111011011110011011101100001111011100111111101100010110110101011010111010001111110011001000110001101000111001111001110011100110111101000011100111010100110011100011101101111001010110000001010001101100111000011011000110111010010100101101110100011001010111011111001111010001101000100011101111...', 'output': ['548\\n255 212 134 231 130 215 181 131 140 224 189 263 230 266 264 262 201 273 265 271 10 252 256 267 41 276 278 279 228 47 277 161 121 253 211 213 222 138 209 227 235 15 243 74 245 177 83 217 249 56 247 187 123 37 159 63 220 2 195 1 124 8 68 167 23 150 71 59 168 34 110 155 109 170 44 172 157 79 163 114 25 52 132 13 65 194 158 200 160 102 192 183 190 6 115 162 78 125 191 146 188 139 154 46 151 122 66 148 84 93 94 113 69 101 92 137 22 9 127 43 5 54 3 50 12 75 62 31 51 100 30 107 27 99 90 67 55 370 376 380 340...', '548\\n255 212 134 231 130 215 181 131 140 224 189 263 230 266 264 262 201 273 265 271 10 252 256 267 41 276 278 279 228 47 277 161 121 253 211 213 222 138 209 227 235 15 243 74 245 177 83 217 249 56 247 187 123 37 159 63 220 2 195 1 124 8 68 167 23 150 71 59 168 34 110 155 109 170 44 172 157 79 163 114 25 52 132 13 65 194 158 200 160 102 192 183 190 6 115 162 78 125 191 146 188 139 154 46 151 122 66 148 84 93 94 113 69 101 92 137 22 9 127 43 5 54 3 50 12 75 62 31 51 100 30 107 27 99 90 67 55 370 376 380 340 ...']}, {'input': '1101001100000100001111111001110111111111101101001111100010000101001100100111110010000000000010000000000000110100111100010000110011110100100000000001001101110101011001000110011111011000100000001000000000000000000100011111111111111111111111111101111111111010001101010000001100101011111011111101111111100101001110010011011011011010100000000100001111111111111110111110111110010101111010100010110101111100000100001101010100101000001011011001011110101111111111111111111111111101000000000000000000010000000000000000000...', 'output': ['569\\n335 332 337 334 338 339 340 336 326 333 330 331 325 324 329 328 313 344 343 327 345 347 346 349 348 341 342 356 357 355 350 352 353 354 351 289 127 290 288 291 292 295 294 287 297 298 299 293 302 296 304 303 300 308 301 307 305 314 309 311 306 312 315 316 318 310 323 319 322 321 317 388 387 380 389 390 392 391 386 379 385 383 384 377 382 378 372 381 360 358 361 320 366 359 364 363 365 370 362 369 368 373 375 371 374 367 419 411 418 417 413 409 414 416 412 415 427 428 426 423 425 422 421 424 404 402 40...', '569\\n335 332 337 334 338 339 340 336 326 333 330 331 325 324 329 328 313 344 343 327 345 347 346 349 348 341 342 356 357 355 350 352 353 354 351 289 127 290 288 291 292 295 294 287 297 298 299 293 302 296 304 303 300 308 301 307 305 314 309 311 306 312 315 316 318 310 323 319 322 321 317 388 387 380 389 390 392 391 386 379 385 383 384 377 382 378 372 381 360 358 361 320 366 359 364 363 365 370 362 369 368 373 375 371 374 367 419 411 418 417 413 409 414 416 412 415 427 428 426 423 425 422 421 424 404 402 405...']}, {'input': '1000110101000001110111011111010011001111101110110000000110100101010010100001010011101000001111000111100110111111111011100111010110010111010000001011101011011101000100011000001111010010000111011001111011110000011100011100010011100111001101001011000000110001010001100010111110001000111001100100001101001010110100111111000100001111010011010001111111110001111110000111111000011100001101110101000000100101000010001010110010110011100101001011110111101011001101110100000001101010110101111101001100110110111100000101011...', 'output': ['938\\n108 721 578 728 855 463 629 270 533 641 325 458 161 277 509 857 807 573 803 377 289 864 524 105 477 791 820 882 895 117 127 613 750 653 508 443 591 587 181 506 207 129 31 421 542 664 797 744 80 491 252 437 830 853 815 711 114 265 618 662 865 194 563 883 917 352 385 374 238 157 394 798 119 435 920 925 927 581 518 60 413 789 462 854 918 323 743 680 468 327 875 769 222 221 904 890 73 37 604 559 876 607 514 49 244 639 720 307 136 313 687 691 735 128 569 827 800 231 774 683 339 645 295 236 816 502 621 342 ...', '938\\n108 721 578 728 855 463 629 270 533 641 325 458 161 277 509 857 807 573 803 377 289 864 524 105 477 791 820 882 895 117 127 613 750 653 508 443 591 587 181 506 207 129 31 421 542 664 797 744 80 491 252 437 830 853 815 711 114 265 618 662 865 194 563 883 917 352 385 374 238 157 394 798 119 435 920 925 927 581 518 60 413 789 462 854 918 323 743 680 468 327 875 769 222 221 904 890 73 37 604 559 876 607 514 49 244 639 720 307 136 313 687 691 735 128 569 827 800 231 774 683 339 645 295 236 816 502 621 342 1...']}, {'input': '0001111110110110011101001011011101001111010101011010010010001110011110011111101101001101000101100100101101010111110000011110100111011101011111111000110010000101111111001010011100010101110101011010100000100011110010101111110111000000010110001111000101010010001110000100101000001111001111000101010100110100010100111101101010001111001110011101000110000101001011110000111011110110111111101010011101010001001011000110010000011001010111100101001111100010000000010110111110001100111101111010010101101001001010010110101...', 'output': ['953\\n659 894 900 479 825 411 203 665 880 811 519 468 772 643 37 246 758 828 790 548 185 487 462 81 150 78 311 778 496 87 193 783 836 817 118 390 796 707 252 115 337 308 615 690 682 349 565 931 914 307 276 219 25 912 702 263 146 310 524 483 338 234 227 406 571 824 440 387 843 916 533 737 116 200 810 11 526 469 755 946 941 728 752 256 93 937 753 166 273 559 238 424 305 270 171 189 202 336 139 136 801 770 180 137 343 739 733 594 476 934 896 73 30 170 634 742 806 123 515 666 61 622 68 106 299 367 630 431 477 68...', '953\\n659 894 900 479 825 411 203 665 880 811 519 468 772 643 37 246 758 828 790 548 185 487 462 81 150 78 311 778 496 87 193 783 836 817 118 390 796 707 252 115 337 308 615 690 682 349 565 931 914 307 276 219 25 912 702 263 146 310 524 483 338 234 227 406 571 824 440 387 843 916 533 737 116 200 810 11 526 469 755 946 941 728 752 256 93 937 753 166 273 559 238 424 305 270 171 189 202 336 139 136 801 770 180 137 343 739 733 594 476 934 896 73 30 170 634 742 806 123 515 666 61 622 68 106 299 367 630 431 477 6...']}, {'input': '1100100100001011010000101110101100011010001000111000110011111111010101110100111111010101111010100101010111100000011010100111110101101001011000000001110001110000100001101010010101000110011010010100011011111000100111111010111011011010100001110001111010110000110011100101110111101100011110000101000110001110000110110110011011000111011001011001001100101111100001011010110110111111101111110101000000111101101001110111010101100001111110100100011010001101001100001110000111111111101100101010001001100101001111111111001...', 'output': ['599\\n63 21 349 190 270 200 124 388 502 96 35 482 495 545 548 41 444 268 585 595 314 397 340 449 297 150 260 131 373 584 529 271 496 503 433 334 196 116 324 409 511 187 283 568 173 546 210 281 558 353 3 486 583 344 573 242 217 298 398 500 408 2 355 87 510 564 459 348 14 439 485 311 436 316 49 307 487 536 252 1 412 13 289 555 554 426 411 515 423 333 394 362 261 277 240 149 86 215 440 320 185 363 413 230 138 103 157 359 219 518 471 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 547 ...', '600\\n21 2 340 150 242 187 87 353 495 41 3 444 482 510 529 14 433 217 573 583 297 355 316 436 271 116 210 96 349 568 503 260 485 496 398 314 173 35 388 449 502 200 311 584 131 564 63 268 334 585 511 298 595 500 596 124 324 558 408 281 439 283 548 546 545 397 344 196 373 348 459 190 486 270 409 13 555 554 536 411 471 1 423 359 363 289 320 277 487 394 518 413 240 185 138 49 103 362 219 230 215 333 515 307 412 261 157 86 149 426 252 440 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 ...', '600\\n21 2 340 150 242 187 87 353 495 41 3 444 482 510 529 14 433 217 573 583 297 355 316 436 271 116 210 96 349 568 503 260 485 496 398 314 173 35 388 449 502 200 311 584 131 564 63 268 334 585 511 298 595 500 596 124 324 558 408 281 439 283 548 546 545 397 344 196 373 348 459 190 486 270 409 13 555 554 536 411 471 1 423 359 363 289 320 277 487 394 518 413 240 185 138 49 103 362 219 230 215 333 515 307 412 261 157 86 149 426 252 440 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 5...', '599\\n63 21 349 190 270 200 124 388 502 96 35 482 495 545 548 41 444 268 585 595 314 397 340 449 297 150 260 131 373 584 529 271 496 503 433 334 196 116 324 409 511 187 283 568 173 546 210 281 558 353 3 486 583 344 573 242 217 298 398 500 408 2 355 87 510 564 459 348 14 439 485 311 436 316 49 307 487 536 252 1 412 13 289 555 554 426 411 515 423 333 394 362 261 277 240 149 86 215 440 320 185 363 413 230 138 103 157 359 219 518 471 351 493 579 575 549 541 304 68 24 489 574 377 166 57 55 37 422 20 229 552 547 4...']}, {'input': '0000101010100001000111000010010111110110001110010110000011010110010001110000111011100111100010111111110110010010110100000111001011001100100110100111000110001111101101001100010011010100100010101110010110001111000010011111100011101011010000110101100110010001110100011001111000110111011001011010001110011000001010111001101011011001100011011010000001010001111110010101111111010010111000100100110000011110100001011100001011100010111101010001011101001001110111111100001110011100101001001111110010111000111010001111010...', 'output': ['712\\n88 243 231 254 494 288 410 368 215 599 523 149 302 146 487 540 408 702 697 480 344 46 74 341 419 71 354 132 474 590 308 250 245 509 401 318 154 193 356 304 156 626 310 592 43 283 123 383 339 270 524 528 21 314 294 319 337 688 587 228 42 411 451 89 373 115 150 31 78 595 510 32 229 281 467 465 63 12 485 530 360 168 269 692 381 689 15 460 477 432 572 391 117 10 137 710 708 142 286 471 311 244 218 603 612 422 158 75 448 423 170 577 571 60 140 312 48 640 669 51 379 546 666 374 306 169 135 59 671 674 496 366...', '712\\n88 243 231 254 494 288 410 368 215 599 523 149 302 146 487 540 408 702 697 480 344 46 74 341 419 71 354 132 474 590 308 250 245 509 401 318 154 193 356 304 156 626 310 592 43 283 123 383 339 270 524 528 21 314 294 319 337 688 587 228 42 411 451 89 373 115 150 31 78 595 510 32 229 281 467 465 63 12 485 530 360 168 269 692 381 689 15 460 477 432 572 391 117 10 137 710 708 142 286 471 311 244 218 603 612 422 158 75 448 423 170 577 571 60 140 312 48 640 669 51 379 546 666 374 306 169 135 59 671 674 496 36...']}, {'input': '1011100001101001111001011101001111111100110100101000011111000001101000111110110011101111111101110101001000101011111010101001110011101011100101000110111110001100111011111110100111000100101111111100101101011000110111010011111101111100100110110111010100101001110000100010111101001001100001111111010011000001100001000011110011010110101111101000110111010000011101011100011010101010010001011111111110100101100010010110100011111100101001111010001010011100010011011110110101011111111011101011101100010000011111000110111...', 'output': ['641\\n316 302 576 4 535 9 218 530 85 294 356 522 604 602 379 443 594 381 184 75 10 342 575 150 521 483 502 422 55 106 273 387 266 209 56 497 459 120 303 236 508 475 80 233 255 420 449 336 113 42 263 350 102 366 426 362 332 88 33 47 131 225 122 41 59 533 397 142 60 137 573 572 182 317 272 247 377 130 543 494 553 407 292 283 259 234 406 253 620 588 249 82 409 206 398 489 503 291 44 220 221 279 87 599 622 373 230 81 210 159 631 632 548 393 63 625 484 181 478 408 335 324 76 127 195 348 448 289 168 39 228 464 16...', '642\\n315 301 572 3 531 4 210 519 92 297 348 514 605 603 381 434 599 382 182 60 8 344 571 147 513 475 502 420 46 106 273 384 268 206 47 495 463 116 304 230 512 470 69 225 249 419 458 336 115 38 259 347 102 362 422 356 330 94 32 41 141 217 117 36 51 521 388 145 55 144 562 561 181 316 272 236 380 130 546 483 552 406 292 283 253 229 398 247 615 588 239 86 411 200 390 478 510 291 39 213 215 275 93 602 624 377 221 81 207 161 630 633 548 387 56 625 477 178 473 407 332 325 67 129 196 346 449 284 170 35 220 469 167...', '642\\n315 301 572 3 531 4 210 519 92 297 348 514 605 603 381 434 599 382 182 60 8 344 571 147 513 475 502 420 46 106 273 384 268 206 47 495 463 116 304 230 512 470 69 225 249 419 458 336 115 38 259 347 102 362 422 356 330 94 32 41 141 217 117 36 51 521 388 145 55 144 562 561 181 316 272 236 380 130 546 483 552 406 292 283 253 229 398 247 615 588 239 86 411 200 390 478 510 291 39 213 215 275 93 602 624 377 221 81 207 161 630 633 548 387 56 625 477 178 473 407 332 325 67 129 196 346 449 284 170 35 220 469 167 ...', '641\\n316 302 576 4 535 9 218 530 85 294 356 522 604 602 379 443 594 381 184 75 10 342 575 150 521 483 502 422 55 106 273 387 266 209 56 497 459 120 303 236 508 475 80 233 255 420 449 336 113 42 263 350 102 366 426 362 332 88 33 47 131 225 122 41 59 533 397 142 60 137 573 572 182 317 272 247 377 130 543 494 553 407 292 283 259 234 406 253 620 588 249 82 409 206 398 489 503 291 44 220 221 279 87 599 622 373 230 81 210 159 631 632 548 393 63 625 484 181 478 408 335 324 76 127 195 348 448 289 168 39 228 464 161...']}, {'input': '0110111000101100100010000010111000001001000110111110000100001010100100001000010010010001110011001011011101111111000111101100110010000010010000000010101010001010001001010000101100110000000001000010011000111111110000100001100011110001110100000001001010111110110110111111111011110111110111110111100011110011101111111000011001111011000010010110001111101101111111001110101101111111011100110101111011100010011111101111111111001101011101001111111111110001101110111101101011011110001011111100010100000101011111011110000...', 'output': ['881\\n232 175 213 437 35 313 342 511 456 512 14 521 519 507 238 97 188 532 534 535 16 578 569 548 559 530 543 373 588 582 176 591 637 601 328 47 3 486 572 191 357 663 652 464 579 541 644 584 667 610 656 676 689 666 675 480 64 476 122 247 460 498 447 436 502 492 518 504 441 410 374 194 105 368 397 66 248 278 133 292 311 367 366 348 302 304 343 271 187 163 96 80 295 301 286 72 125 59 112 178 162 160 32 253 189 222 198 206 129 165 756 742 752 759 758 555 192 737 602 738 693 740 745 732 727 364 71 716 723 725 71...', '881\\n232 175 213 437 35 313 342 511 456 512 14 521 519 507 238 97 188 532 534 535 16 578 569 548 559 530 543 373 588 582 176 591 637 601 328 47 3 486 572 191 357 663 652 464 579 541 644 584 667 610 656 676 689 666 675 480 64 476 122 247 460 498 447 436 502 492 518 504 441 410 374 194 105 368 397 66 248 278 133 292 311 367 366 348 302 304 343 271 187 163 96 80 295 301 286 72 125 59 112 178 162 160 32 253 189 222 198 206 129 165 756 742 752 759 758 555 192 737 602 738 693 740 745 732 727 364 71 716 723 725 7...']}, {'input': '0110111101111110010111100000011100101101111001110100000101111111001011111100110111111000000101111101101101111110110110000101111011111001111011111111111100111101101101101101111111111111111110001010001011101000000011111110111110001011110111111101111110110111110001100100111100101111111101100000010111000011110110000100000001000000100101000001100100001010100000000000010010111000100000000000000000000101000001000001011100000010001000101100001001110110111011111011101111101111001000100100110111101111111001000000000...', 'output': ['862\\n666 660 663 661 638 648 681 678 667 672 635 677 675 440 308 172 139 251 287 657 650 655 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 412 296 227 23 194 107 250 186 295 286 695 694 674 697 696 66 699 708 705 700 656 701 702 685 688 689 686 683 670 105 662 645 135 445 49 637 640 684 710 714 719 712 715 709 459 704 605 10 682 644 713 725 726 673 718 720 722 730 733 734 731 732 721 729 562 590 589 581 464 575 554 511 550 540 473 142 198 626 611 624 627 419 631 629 59...', '861\\n664 658 663 661 638 647 679 678 667 671 635 676 675 437 308 171 139 251 287 657 650 652 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 411 296 227 23 194 107 250 177 295 278 695 690 674 697 696 55 698 706 705 700 656 701 702 685 687 689 686 683 668 93 662 645 135 445 49 636 639 684 710 714 719 711 715 709 459 703 605 10 682 641 713 723 726 673 716 720 722 730 733 734 731 732 721 727 558 590 589 581 463 575 554 508 550 540 473 140 198 626 608 613 627 419 630 628 591 ...', '862\\n666 660 663 661 638 648 681 678 667 672 635 677 675 440 308 172 139 251 287 657 650 655 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 412 296 227 23 194 107 250 186 295 286 695 694 674 697 696 66 699 708 705 700 656 701 702 685 688 689 686 683 670 105 662 645 135 445 49 637 640 684 710 714 719 712 715 709 459 704 605 10 682 644 713 725 726 673 718 720 722 730 733 734 731 732 721 729 562 590 589 581 464 575 554 511 550 540 473 142 198 626 611 624 627 419 631 629 591...', '861\\n664 658 663 661 638 647 679 678 667 671 635 676 675 437 308 171 139 251 287 657 650 652 646 404 651 649 565 634 633 632 601 625 449 129 127 257 545 566 570 444 394 431 376 411 296 227 23 194 107 250 177 295 278 695 690 674 697 696 55 698 706 705 700 656 701 702 685 687 689 686 683 668 93 662 645 135 445 49 636 639 684 710 714 719 711 715 709 459 703 605 10 682 641 713 723 726 673 716 720 722 730 733 734 731 732 721 727 558 590 589 581 463 575 554 508 550 540 473 140 198 626 608 613 627 419 630 628 591...']}, {'input': '0000011100010000010001110111111001111011111110111101111110010010010000001111100011111111110111110111001000000111101111000000011011001000101111100000010011111001001000011101111011111100111101110111100111111111110111111011111111000110000100100000100011101000110111011110111011010000111110111111011110101111111011011111111111011011000000000010000010000111100010000100011000000100000010111110111111111101011110000011000000000100011010010100000000010010001000000000000100000111011101111101011111011111111111101111111...', 'output': ['523\\n424 425 431 433 437 439 435 432 421 427 429 430 403 391 406 423 415 414 151 413 412 408 384 22 418 417 7 202 422 420 419 416 388 374 281 47 390 395 389 350 392 399 400 409 398 397 396 394 292 14 298 294 75 8 99 271 385 21 387 386 126 346 324 348 376 252 211 258 266 174 269 291 272 76 191 195 193 223 251 218 104 156 154 4 130 170 163 93 160 140 146 136 127 87 27 74 48 319 311 34 159 329 330 332 326 169 192 303 327 344 296 347 354 364 372 375 373 380 381 382 379 352 92 360 371 53 309 46 80 304 508 511 5...', '523\\n424 425 431 433 437 439 435 432 421 427 429 430 403 391 406 423 415 414 151 413 412 408 384 22 418 417 7 202 422 420 419 416 388 374 281 47 390 395 389 350 392 399 400 409 398 397 396 394 292 14 298 294 75 8 99 271 385 21 387 386 126 346 324 348 376 252 211 258 266 174 269 291 272 76 191 195 193 223 251 218 104 156 154 4 130 170 163 93 160 140 146 136 127 87 27 74 48 319 311 34 159 329 330 332 326 169 192 303 327 344 296 347 354 364 372 375 373 380 381 382 379 352 92 360 371 53 309 46 80 304 508 511 51...', '524\\n425 427 432 435 439 441 437 433 422 429 430 431 406 392 408 424 416 415 258 414 413 409 385 48 419 418 4 269 423 421 420 417 389 380 281 87 391 396 390 373 394 400 403 412 399 398 397 395 292 8 330 309 93 7 136 272 386 27 388 387 192 346 344 371 384 251 202 252 266 160 271 296 294 34 174 195 193 218 223 211 75 156 154 53 146 191 169 92 163 130 140 127 99 126 104 14 80 47 46 22 74 291 151 298 303 311 76 327 332 347 319 304 324 326 375 376 350 354 374 379 381 382 21 360 364 372 352 348 329 159 170 511 5...', '524\\n425 427 432 435 439 441 437 433 422 429 430 431 406 392 408 424 416 415 258 414 413 409 385 48 419 418 4 269 423 421 420 417 389 380 281 87 391 396 390 373 394 400 403 412 399 398 397 395 292 8 330 309 93 7 136 272 386 27 388 387 192 346 344 371 384 251 202 252 266 160 271 296 294 34 174 195 193 218 223 211 75 156 154 53 146 191 169 92 163 130 140 127 99 126 104 14 80 47 46 22 74 291 151 298 303 311 76 327 332 347 319 304 324 326 375 376 350 354 374 379 381 382 21 360 364 372 352 348 329 159 170 511 51...']}, {'input': '1011111100111000101010000110001111010110100001110000100110101101000100111110010011100111110100000111111001001100010010011011101011000110111111001111000101100110001100011100011010110100000011111011111111110000100111111111001001111010111010010001001000110101100010011100110101101110000111101011111010110111110100011110011011001110100111001110100011110101001111110010110110001110001011100101110101111101111101100110101111101011100011111001000000011101000011100010001001100100111111111111101111001111111111000101111...', 'output': ['763\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 ...', '762\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 4...', '762\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 ...', '763\\n499 487 450 92 296 245 557 367 620 77 583 633 157 598 312 355 410 497 668 659 457 636 462 595 258 346 704 616 464 719 9 710 31 709 316 579 252 190 692 593 467 474 21 426 415 512 523 585 42 532 479 164 135 325 298 183 475 378 51 374 306 56 297 611 486 649 625 185 2 624 369 543 539 326 25 257 488 253 116 199 421 115 315 401 391 233 82 340 270 189 111 178 310 299 151 321 570 286 165 193 285 268 147 254 39 19 604 533 358 697 656 212 88 588 477 399 152 11 83 606 343 449 627 711 731 214 728 722 536 460 280 4...']}, {'input': '0011100100110010001111110111111100111000111001110110001100001000011110011100100010111011000110010101011010111011100101101110111111010010101000000000010010110100111101101110000001001111101001110111000010001101101110011110111101011011111110001011001100001110010000001101001000100011100100010100000101101000001111100100000000100110000000100000010101001001110010000100001001001100100001100101110111101110010001111101100001001011111000111001001000100100011010111011011101011101101100100000110011101101011000100111100...', 'output': ['729\\n64 203 216 2 204 73 141 80 164 115 157 320 391 316 193 100 36 227 89 295 19 241 441 506 514 508 55 366 268 77 12 463 497 68 315 397 433 396 415 291 382 371 207 352 228 531 530 96 523 513 119 317 495 486 503 522 205 501 502 488 471 355 195 229 305 57 449 454 458 515 434 158 110 401 540 537 377 527 535 526 194 414 202 544 534 545 551 559 362 542 547 430 436 419 1 139 386 62 208 331 395 403 180 240 25 65 148 30 263 349 152 384 351 248 399 116 170 126 439 285 338 462 438 442 484 473 479 378 477 409 353 47...', '729\\n64 203 216 2 204 73 141 80 164 115 157 320 391 316 193 100 36 227 89 295 19 241 441 506 514 508 55 366 268 77 12 463 497 68 315 397 433 396 415 291 382 371 207 352 228 531 530 96 523 513 119 317 495 486 503 522 205 501 502 488 471 355 195 229 305 57 449 454 458 515 434 158 110 401 540 537 377 527 535 526 194 414 202 544 534 545 551 559 362 542 547 430 436 419 1 139 386 62 208 331 395 403 180 240 25 65 148 30 263 349 152 384 351 248 399 116 170 126 439 285 338 462 438 442 484 473 479 378 477 409 353 47 ...']}, {'input': '1111101000111001110101001110001011100101111110001101010101100010011011011000001010110100111101101000101000010110011111110001011110110011110010010101110000111001100110001000001010001001111110110101100000111010110000011110100001011101101000000001111111100100100010010101101001010110000101101111001001110100011101010110111010011101010100011110111110101001000010100010111000111000101001000011100010111110100011100011110011011010001000100110010011001011101100110110101101111010010000111010010110011100010101110001010...', 'output': ['1000\\n803 376 98 675 492 852 505 511 527 504 42 108 129 664 120 628 105 777 33 429 704 693 47 317 722 679 724 518 727 556 78 493 797 983 303 717 514 414 698 840 168 209 667 146 937 706 594 681 144 207 824 890 863 897 649 631 555 981 32 40 189 164 888 607 132 560 254 274 842 93 867 373 816 583 351 159 472 613 925 841 892 634 4 592 249 117 440 684 669 445 423 813 932 584 316 975 294 521 882 496 44 523 421 87 790 369 620 894 702 916 2 494 901 232 785 574 67 729 197 968 289 402 687 943 689 360 292 375 520 28 67...', '1000\\n803 376 98 675 492 852 505 511 527 504 42 108 129 664 120 628 105 777 33 429 704 693 47 317 722 679 724 518 727 556 78 493 797 983 303 717 514 414 698 840 168 209 667 146 937 706 594 681 144 207 824 890 863 897 649 631 555 981 32 40 189 164 888 607 132 560 254 274 842 93 867 373 816 583 351 159 472 613 925 841 892 634 4 592 249 117 440 684 669 445 423 813 932 584 316 975 294 521 882 496 44 523 421 87 790 369 620 894 702 916 2 494 901 232 785 574 67 729 197 968 289 402 687 943 689 360 292 375 520 28 6...']}, {'input': '1011001111111111111111000000001001000000001111000000000000000111111111111111111110110000000111100000000000111110001111111110111111111111111111111111111111111111111111111111111111111111110010000011110111000011111111011100001111010001111111000000000000000000000000011010011111100010011110000000010000000000011110000000000000000111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000110000111110000000000011111111100010110000101111001111111111110000000000000...', 'output': ['1000\\n302 304 303 299 298 301 300 312 311 310 309 308 307 306 305 282 283 285 284 287 286 288 289 292 293 291 290 295 294 296 297 269 268 267 273 272 270 271 274 275 276 277 281 280 279 278 266 265 264 263 260 259 261 262 258 257 256 255 254 253 251 252 353 355 354 356 357 359 358 348 347 346 345 351 352 350 349 366 367 365 364 360 361 362 363 372 373 375 374 370 371 369 368 335 336 333 334 329 330 332 331 342 341 344 343 337 338 340 339 314 313 315 316 317 318 319 320 324 323 322 321 325 326 327 328 390 38...', '1000\\n302 304 303 299 298 301 300 312 311 310 309 308 307 306 305 282 283 285 284 287 286 288 289 292 293 291 290 295 294 296 297 269 268 267 273 272 270 271 274 275 276 277 281 280 279 278 266 265 264 263 260 259 261 262 258 257 256 255 254 253 251 252 353 355 354 356 357 359 358 348 347 346 345 351 352 350 349 366 367 365 364 360 361 362 363 372 373 375 374 370 371 369 368 335 336 333 334 329 330 332 331 342 341 344 343 337 338 340 339 314 313 315 316 317 318 319 320 324 323 322 321 325 326 327 328 390 3...']}, {'input': '0101010001101110010110110101101000111011100100001000010110100000100100111001101111010110000101010111101100110010100110100011111001000111010001011100011100110110101101000100100101111001001110000010101001010101011000011000010110011111110001100001011011010010011110110010011100110100110001010101111000000100110111111010111100100101100111110000011101001100100101110011110100101011001000111001101010101010101111110101010010010001010100110110110010010011011110000100000111000011111000011010101001010101010001010101110...', 'output': ['1000\\n461 47 859 683 246 143 822 591 356 425 995 843 359 561 481 421 646 513 809 174 469 260 913 155 391 150 870 651 117 231 270 848 601 38 406 564 163 622 10 442 433 914 188 157 593 53 512 276 372 537 158 901 389 196 327 315 871 160 148 645 248 957 899 743 612 769 456 162 556 623 826 501 706 961 203 225 435 169 964 759 570 937 67 127 385 46 955 735 491 161 220 111 817 888 40 390 86 360 388 13 547 238 190 723 109 345 566 264 981 844 383 44 447 419 948 189 628 632 794 128 659 98 905 770 596 819 16 607 410 7...', '1000\\n461 47 859 683 246 143 822 591 356 425 995 843 359 561 481 421 646 513 809 174 469 260 913 155 391 150 870 651 117 231 270 848 601 38 406 564 163 622 10 442 433 914 188 157 593 53 512 276 372 537 158 901 389 196 327 315 871 160 148 645 248 957 899 743 612 769 456 162 556 623 826 501 706 961 203 225 435 169 964 759 570 937 67 127 385 46 955 735 491 161 220 111 817 888 40 390 86 360 388 13 547 238 190 723 109 345 566 264 981 844 383 44 447 419 948 189 628 632 794 128 659 98 905 770 596 819 16 607 410 71...']}, {'input': '1111010001000101110100001001010111111101010101000100110100110101111001111111111110111111011110110111010100100110001100110111101011111110111010000010110100110111101111110101111111100111111101110010000010000100000000000000101000000111101010001101000100111011100111111011001110100010110101101101111011101111111101111110111011110101010101011111010101011011111111111001001010110011011100111110011101011000000010100000000010000000001001000010000100000000001000000000010000000000000000000000000000100000000010010000000...', 'output': ['1000\\n426 425 406 428 427 415 429 345 418 417 411 420 419 416 422 409 281 274 408 407 412 414 410 403 314 404 402 348 400 367 338 460 445 452 464 461 459 462 455 456 457 449 432 453 454 431 444 430 442 438 447 446 443 448 440 421 441 436 373 424 405 306 490 481 489 492 476 493 491 487 483 488 486 471 482 450 484 465 473 477 284 480 478 479 475 470 423 472 468 467 433 466 458 499 508 509 507 506 504 500 505 501 497 463 498 474 496 495 485 514 516 511 515 510 512 513 439 522 518 520 521 517 502 519 469 374 35...', '1000\\n426 425 406 428 427 415 429 345 418 417 411 420 419 416 422 409 281 274 408 407 412 414 410 403 314 404 402 348 400 367 338 460 445 452 464 461 459 462 455 456 457 449 432 453 454 431 444 430 442 438 447 446 443 448 440 421 441 436 373 424 405 306 490 481 489 492 476 493 491 487 483 488 486 471 482 450 484 465 473 477 284 480 478 479 475 470 423 472 468 467 433 466 458 499 508 509 507 506 504 500 505 501 497 463 498 474 496 495 485 514 516 511 515 510 512 513 439 522 518 520 521 517 502 519 469 374 3...']}, {'input': '0111111011111111000001100001010110010010001111101101011100111101010101111110001110100101001100000011101100001011011111000010011001111100001100001001000101011011111000101000011010000110101101011000111110101010101010110101011001100101101101000111011100010001100000001001001000111101001100101000001100110100000011110001101111100011000010000110100101110011011001110001110010110011101100011000001011011011001110111010111111011011101010010111100001101110010011001001101001101101011111010111100110001110100110110000000...', 'output': ['1000\\n562 87 558 411 367 248 156 715 544 364 148 197 306 812 826 803 143 882 904 861 769 620 5 608 856 349 212 329 603 45 175 240 909 921 704 386 280 297 478 155 960 963 73 146 957 598 84 309 537 376 187 10 317 344 440 680 189 142 385 152 913 864 145 979 940 150 400 844 468 382 615 981 905 502 266 984 983 37 132 207 447 752 633 435 258 930 636 437 379 333 34 972 978 299 958 17 31 968 967 710 898 81 300 843 950 661 497 106 203 900 891 733 180 820 721 530 581 251 337 694 352 814 810 32 164 851 786 839 11 378...', '999\\n581 106 562 435 376 251 164 721 558 367 150 203 309 814 843 810 145 891 905 864 803 633 10 615 861 352 240 333 608 73 180 248 913 930 710 400 297 299 497 156 963 967 81 148 958 603 87 317 544 379 189 17 329 349 447 694 197 143 386 155 921 882 142 978 940 146 385 844 468 382 598 979 904 502 266 983 981 37 132 207 440 752 620 411 258 909 636 437 364 306 34 968 972 84 187 661 960 950 957 5 704 280 898 826 31 300 45 478 175 900 856 715 820 733 537 530 769 344 337 680 152 812 32 212 851 786 839 11 378 673 ...', '1000\\n562 87 558 411 367 248 156 715 544 364 148 197 306 812 826 803 143 882 904 861 769 620 5 608 856 349 212 329 603 45 175 240 909 921 704 386 280 297 478 155 960 963 73 146 957 598 84 309 537 376 187 10 317 344 440 680 189 142 385 152 913 864 145 979 940 150 400 844 468 382 615 981 905 502 266 984 983 37 132 207 447 752 633 435 258 930 636 437 379 333 34 972 978 299 958 17 31 968 967 710 898 81 300 843 950 661 497 106 203 900 891 733 180 820 721 530 581 251 337 694 352 814 810 32 164 851 786 839 11 378 ...', '999\\n581 106 562 435 376 251 164 721 558 367 150 203 309 814 843 810 145 891 905 864 803 633 10 615 861 352 240 333 608 73 180 248 913 930 710 400 297 299 497 156 963 967 81 148 958 603 87 317 544 379 189 17 329 349 447 694 197 143 386 155 921 882 142 978 940 146 385 844 468 382 598 979 904 502 266 983 981 37 132 207 440 752 620 411 258 909 636 437 364 306 34 968 972 84 187 661 960 950 957 5 704 280 898 826 31 300 45 478 175 900 856 715 820 733 537 530 769 344 337 680 152 812 32 212 851 786 839 11 378 673 8...']}, {'input': '0\\n', 'output': ['2\\n1 2\\n', '2\\n1 2', '2\\n1 2 ', '2\\n1 2\\n', '2\\n1 2 \\n', '2\\n1 2 ', '2\\n1 2 \\n']}, {'input': '00\\n', 'output': ['3\\n1 2 3\\n', '3\\n1 2 3 ', '3\\n1 2 3 ', '3\\n1 2 3 \\n', '3\\n1 2 3\\n', '3\\n1 2 3 \\n', '3\\n1 2 3']}, {'input': '11010\\n', 'output': ['4\\n3 1 4 2', '4\\n3 1 4 2 \\n', '4\\n3 1 4 2 \\n', '4\\n3 1 4 2\\n', '4\\n3 1 4 2 ', '4\\n3 1 4 2 ', '4\\n3 1 4 2\\n']}, {'input': '111000\\n', 'output': ['5\\n2 1 4 5 3\\n', '5\\n2 1 4 5 3 ', '5\\n2 1 4 5 3 ', '5\\n2 1 4 5 3\\n', '5\\n2 1 4 5 3', '5\\n2 1 4 5 3 \\n', '5\\n2 1 4 5 3 \\n']}, {'input': '000100010\\n', 'output': ['6\\n1 2 4 5 3 6 ', '6\\n1 2 4 5 3 6\\n', '6\\n1 2 4 5 3 6 ', '6\\n1 2 4 5 3 6', '6\\n1 2 4 5 3 6 \\n', '6\\n1 2 4 5 3 6 \\n', '6\\n1 2 4 5 3 6\\n']}, {'input': '11010011110010\\n', 'output': ['7\\n4 6 3 7 1 2 5 ', '7\\n4 6 3 7 1 2 5 \\n', '7\\n4 6 3 7 1 2 5', '7\\n4 6 3 7 1 2 5\\n', '7\\n4 6 3 7 1 2 5 \\n', '7\\n4 6 3 7 1 2 5\\n', '7\\n4 6 3 7 1 2 5 ']}, {'input': '0010100011010010\\n', 'output': ['8\\n3 6 1 4 2 8 5 7 \\n', '8\\n3 6 1 4 2 8 5 7', '8\\n3 6 1 4 2 8 5 7\\n', '8\\n3 6 1 4 2 8 5 7\\n', '8\\n3 6 1 4 2 8 5 7 \\n', '8\\n3 6 1 4 2 8 5 7 ', '8\\n3 6 1 4 2 8 5 7 ']}, {'input': '0101110010110101010\\n', 'output': ['9\\n1 7 5 3 9 4 2 6 8 \\n', '9\\n1 7 5 3 9 4 2 6 8\\n', '9\\n1 7 5 3 9 4 2 6 8 \\n', '9\\n1 7 5 3 9 4 2 6 8\\n', '9\\n1 7 5 3 9 4 2 6 8 ', '9\\n1 7 5 3 9 4 2 6 8', '9\\n1 7 5 3 9 4 2 6 8 ']}, {'input': '01001010111101110000110\\n', 'output': ['11\\n2 4 3 8 5 6 11 10 9 7 1', '11\\n2 4 3 8 5 6 11 10 9 7 1 \\n', '10\\n3 5 4 9 6 10 7 8 1 2\\n', '11\\n2 4 3 8 5 6 11 10 9 7 1 ', '10\\n3 5 4 9 6 10 7 8 1 2 ', '10\\n3 5 4 9 6 10 7 8 1 2 \\n', '11\\n2 4 3 8 5 6 11 10 9 7 1\\n', '10\\n3 5 4 9 6 10 7 8 1 2 ', '10\\n3 5 4 9 6 10 7 8 1 2\\n', '11\\n2 4 3 8 5 6 11 10 9 7 1 ', '10\\n3 5 4 9 6 10 7 8 1 2 \\n']}, {'input': '1110010110100000111100011\\n', 'output': ['11\\n7 1 8 11 6 3 4 2 5 10 9\\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 ', '11\\n7 1 8 11 6 3 4 2 5 10 9 \\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 \\n', '11\\n7 1 8 11 6 3 4 2 5 10 9 ', '11\\n7 1 8 11 6 3 4 2 5 10 9\\n', '11\\n7 1 8 11 6 3 4 2 5 10 9']}, {'input': '01001010100100100001100100111\\n', 'output': ['12\\n7 4 11 6 3 12 1 5 2 9 8 10\\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 ', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 ', '12\\n7 4 11 6 3 12 1 5 2 9 8 10', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 \\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10 \\n', '12\\n7 4 11 6 3 12 1 5 2 9 8 10\\n']}, {'input': '00110101011110101110011010101110101\\n', 'output': ['13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 ', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6\\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 \\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 ', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 \\n', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 ', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6 \\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6', '13\\n4 10 13 8 12 2 9 5 3 1 11 7 6\\n', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6 ', '14\\n4 13 14 10 2 12 8 3 9 5 11 7 1 6\\n']}, {'input': '000001101100100011101110100100111100\\n', 'output': ['14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8\\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8\\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 \\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 ', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 \\n', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8', '14\\n1 6 7 3 13 4 12 5 14 11 9 10 2 8 ']}, {'input': '01111110001111111000101010010110111011\\n', 'output': ['15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4\\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 \\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 ', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 \\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4\\n', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4', '15\\n6 1 3 15 14 13 10 11 8 5 2 9 7 12 4 ']}, {'input': '01001100110110010110001011011000010100000010011100110111010110001110001110111011000101000\\n', 'output': ['25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 \\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 ', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11\\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 \\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11 ', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11\\n', '25\\n13 4 22 23 18 20 16 17 9 5 3 24 7 14 10 15 25 19 2 6 12 21 1 8 11']}, {'input': '001011101110010101101010010101101101101110010001111110101110101100001001101011110010010001001101101000111111111100000101001101010101101101111101101100011111101100000101110011000100000011001011001101000110111111010001110100111100\\n', 'output': ['51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13\\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 ', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 \\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 \\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13\\n', '51\\n21 37 44 5 15 9 23 1 6 4 41 12 50 10 43 49 19 35 33 36 2 3 16 26 22 39 38 51 30 45 46 47 14 28 20 24 27 25 31 8 34 48 17 32 7 42 40 29 11 18 13 ']}, {'input': '00101000111111010000110101111101100111010011011011011100101101110110100011100101001010001111101011110101010111001001101001111111001000111111011010110110110000000100111100111110000110011011000100100011001110000111101110111001110111101110011000111000011000101011111000001010101100001110011001100011010100100110101010111111100111101001100100001101110010101000111010001011000100101001100111101100011100100000010101001010111011110101101001011100011011010011011111010001101110010011000010010000111\\n', 'output': ['92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 \\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 ', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 \\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47\\n', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47 ', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47', '92\\n32 58 73 3 92 79 48 77 85 62 39 78 84 4 46 69 38 34 1 72 65 13 15 52 76 82 26 87 86 8 40 81 70 19 29 91 6 24 10 31 49 60 61 43 11 2 25 80 27 42 75 28 67 57 50 35 33 12 51 18 66 37 21 16 17 44 89 88 64 9 41 63 55 53 7 22 5 68 45 59 83 30 56 36 20 71 90 23 14 74 54 47\\n']}, {'input': '0100000111110101110110101011010110001111000101011100011000111100100111001101100100110110001001001100101111001000111101100100011011100101001001011110001011000001110110100011011001010010101000001010001100000111101111011000010111011011011001101110110011111010010001100100010111110100011001010010000111000111001011011001100010000101101011110101101011111001011100001101101000001110110110010011011110000000111001101011101111000011101000101111110110100010110111000101101000010101011101101110000011010101101101101110100...', 'output': ['212\\n31 9 190 84 128 159 137 197 67 144 86 11 69 129 7 79 133 210 102 14 117 44 177 35 205 20 50 127 99 155 107 150 207 97 91 187 123 167 193 114 141 103 152 109 209 24 100 188 172 15 212 194 64 206 72 45 125 94 96 110 134 48 161 130 131 180 145 132 200 27 38 170 63 52 196 104 151 203 184 164 83 166 126 157 3 149 93 90 70 181 32 179 16 65 105 143 18 23 1 115 165 122 39 171 60 34 153 183 162 87 154 178 2 4 158 160 140 121 199 40 30 138 118 85 116 47 41 119 95 80 76 75 42 186 53 13 57 163 211 173 108 208 176 ...', '212\\n31 9 190 84 128 159 137 197 67 144 86 11 69 129 7 79 133 210 102 14 117 44 177 35 205 20 50 127 99 155 107 150 207 97 91 187 123 167 193 114 141 103 152 109 209 24 100 188 172 15 212 194 64 206 72 45 125 94 96 110 134 48 161 130 131 180 145 132 200 27 38 170 63 52 196 104 151 203 184 164 83 166 126 157 3 149 93 90 70 181 32 179 16 65 105 143 18 23 1 115 165 122 39 171 60 34 153 183 162 87 154 178 2 4 158 160 140 121 199 40 30 138 118 85 116 47 41 119 95 80 76 75 42 186 53 13 57 163 211 173 108 208 176...']}, {'input': '1010001111010111101001100111111101010001111010101100000011010011010010110110100010010111100101001111001010010110101011110011100011010100110011011001011100100110001101010010110011001100101011100110011100111010001101001011110001000100001011110010101011011010101001110110010010101100011111001000011001011001011001111101101110100101011110100100100010011110101011101000000111100100110010110110011011000110001110010100111111010001011010111010000011111000111100100001100001011101110000001011101011110110100101001111000...', 'output': ['370\\n133 105 262 192 326 368 241 47 28 237 114 282 244 108 272 203 54 163 365 370 330 64 160 267 63 91 314 334 178 155 242 332 209 20 263 120 315 106 58 233 165 158 347 264 245 24 180 246 289 151 182 42 84 212 110 349 16 191 79 356 93 275 354 153 276 83 85 70 220 131 156 278 117 44 15 187 140 55 72 215 284 344 366 291 186 62 35 240 227 268 257 118 125 355 298 166 81 197 45 312 211 2 309 351 176 177 31 149 66 185 134 4 26 251 248 281 200 195 287 162 41 295 113 8 127 308 7 102 121 336 6 269 67 128 94 193 350 ...', '370\\n133 105 262 192 326 368 241 47 28 237 114 282 244 108 272 203 54 163 365 370 330 64 160 267 63 91 314 334 178 155 242 332 209 20 263 120 315 106 58 233 165 158 347 264 245 24 180 246 289 151 182 42 84 212 110 349 16 191 79 356 93 275 354 153 276 83 85 70 220 131 156 278 117 44 15 187 140 55 72 215 284 344 366 291 186 62 35 240 227 268 257 118 125 355 298 166 81 197 45 312 211 2 309 351 176 177 31 149 66 185 134 4 26 251 248 281 200 195 287 162 41 295 113 8 127 308 7 102 121 336 6 269 67 128 94 193 350...']}, {'input': '0001001111011100100111110001100101101111100011011011010001100011101010110010011101001100001110110110101100001111001111000111010010001111001001100101010000110110000111011001001000101011001101100110101010010111101100110101110001001010001110111111010100010011000010101110000100100101010010101011011110010101101101101010111010000000110110110101100000011010101001100011111010000111010001011100100010111111010100101010111001101000010100111100111000010110111110011001001111110101010000101001111101011011101001110000110...', 'output': ['650\\n196 334 90 337 611 482 289 433 419 339 540 234 294 392 600 148 415 75 199 139 525 166 210 32 504 163 567 411 360 555 49 519 106 43 72 291 648 353 399 249 410 213 98 469 552 391 581 367 452 439 615 420 223 649 464 488 155 27 247 297 135 565 296 222 143 590 354 531 636 193 216 335 91 229 471 475 311 169 378 516 571 298 243 454 523 604 608 154 344 330 352 290 638 64 314 153 48 24 572 493 231 506 192 528 333 85 541 502 121 478 338 77 585 259 147 232 84 446 481 470 273 158 583 227 546 359 432 174 537 126 6...', '649\\n199 335 87 338 612 483 290 438 419 343 540 234 296 397 599 150 417 75 200 139 527 165 210 32 505 161 571 415 364 565 53 519 100 39 73 294 642 354 399 251 403 216 98 469 555 391 575 367 448 439 615 421 224 649 463 493 158 27 246 298 135 567 297 223 144 588 355 532 619 196 222 337 96 231 472 476 303 170 369 508 572 302 240 459 523 606 608 155 344 323 352 291 641 64 320 151 47 23 573 495 232 506 192 528 333 86 545 500 109 477 339 77 586 258 146 233 84 446 482 471 272 159 585 227 546 359 425 173 538 125 72...', '650\\n196 334 90 337 611 482 289 433 419 339 540 234 294 392 600 148 415 75 199 139 525 166 210 32 504 163 567 411 360 555 49 519 106 43 72 291 648 353 399 249 410 213 98 469 552 391 581 367 452 439 615 420 223 649 464 488 155 27 247 297 135 565 296 222 143 590 354 531 636 193 216 335 91 229 471 475 311 169 378 516 571 298 243 454 523 604 608 154 344 330 352 290 638 64 314 153 48 24 572 493 231 506 192 528 333 85 541 502 121 478 338 77 585 259 147 232 84 446 481 470 273 158 583 227 546 359 432 174 537 126 67...', '649\\n199 335 87 338 612 483 290 438 419 343 540 234 296 397 599 150 417 75 200 139 527 165 210 32 505 161 571 415 364 565 53 519 100 39 73 294 642 354 399 251 403 216 98 469 555 391 575 367 448 439 615 421 224 649 463 493 158 27 246 298 135 567 297 223 144 588 355 532 619 196 222 337 96 231 472 476 303 170 369 508 572 302 240 459 523 606 608 155 344 323 352 291 641 64 320 151 47 23 573 495 232 506 192 528 333 86 545 500 109 477 339 77 586 258 146 233 84 446 482 471 272 159 585 227 546 359 425 173 538 125 7...']}, {'input': '0000011110110111001011110010010010111111000110110100011111010010101000001110101000110011010100001011101010100010011100011010001100010010100011101000010011110100110100000110011000100111101001000000011110100000010101011101011100110011011100000001111100110101111100111000111110010000011101100110100101010101110010101110001001110011111000111110111110110100100001000011000011111011001101010011010000110110011100110111000001010110000011111101101110011011100000111111100100011000010101010111010101010010000010010101010...', 'output': ['2019\\n362 1584 1707 87 776 172 383 1440 1519 1295 1195 512 1411 290 968 38 1913 563 892 1264 1825 1344 1159 236 164 57 856 1928 1568 929 1822 293 291 554 28 461 1504 1134 317 1064 1588 335 1829 878 862 675 1482 705 1520 748 356 485 643 768 1251 994 1471 1041 1665 1542 1725 997 875 1175 1145 1778 1905 660 469 1259 1693 1286 735 865 1119 694 1142 1277 1889 1260 1596 1563 1934 1268 1844 959 115 672 601 758 823 1439 1187 1240 1313 1301 1386 212 59 904 410 1740 1843 1943 11 437 640 614 336 216 1405 1178 596 376...', '2019\\n362 1584 1707 87 776 172 383 1440 1519 1295 1195 512 1411 290 968 38 1913 563 892 1264 1825 1344 1159 236 164 57 856 1928 1568 929 1822 293 291 554 28 461 1504 1134 317 1064 1588 335 1829 878 862 675 1482 705 1520 748 356 485 643 768 1251 994 1471 1041 1665 1542 1725 997 875 1175 1145 1778 1905 660 469 1259 1693 1286 735 865 1119 694 1142 1277 1889 1260 1596 1563 1934 1268 1844 959 115 672 601 758 823 1439 1187 1240 1313 1301 1386 212 59 904 410 1740 1843 1943 11 437 640 614 336 216 1405 1178 596 376 ...']}, {'input': '1010010011111000110001110111001000110011110001110100010101001000011110010001111000011100000110001111010000111011110100000000111000000001101010001011101010101011011101011011000100001110000001110100000101110001110001101101010101100010111101010111001011110100001000011000011000010011000111011010011011111100110110110111011100001101001111100101001010101110110101010101011001101010100010011000001110101000111100101110010101011101001010110110111101001001010010010010100101111100010011000101011101010011111010011001101...', 'output': ['2218\\n1650 1628 1568 2034 2021 2 340 367 301 38 440 734 1969 1930 1317 1739 412 117 497 867 562 73 891 1375 508 2138 2159 138 152 1048 307 906 2191 2136 1684 670 1850 55 921 1267 1694 2102 844 201 1216 1900 1647 408 1680 58 1175 214 445 647 1617 1109 967 1888 2120 1407 597 492 775 1514 1623 1649 1058 868 1217 711 1186 1719 1437 2125 1665 1213 365 139 1236 1620 764 2035 881 1678 624 1239 33 490 225 1639 1204 1218 1901 680 1289 819 330 2187 547 574 1689 580 131 1864 710 129 342 1677 1162 2112 286 416 1945 282...', '2217\\n1655 1627 1563 2033 2021 2 341 371 301 33 434 732 1969 1925 1311 1733 405 111 498 861 561 73 889 1376 508 2138 2160 135 141 1034 307 905 2192 2129 1683 664 1839 50 922 1265 1700 2100 836 198 1217 1899 1644 394 1680 58 1172 215 437 649 1602 1108 967 1888 2114 1408 599 493 779 1520 1625 1647 1053 865 1218 710 1186 1718 1433 2119 1663 1216 367 138 1238 1606 745 2034 878 1672 616 1241 30 488 224 1636 1202 1226 1900 667 1288 818 323 2181 538 569 1689 577 133 1862 709 131 342 1670 1161 2112 271 416 1944 268...', '2218\\n1650 1628 1568 2034 2021 2 340 367 301 38 440 734 1969 1930 1317 1739 412 117 497 867 562 73 891 1375 508 2138 2159 138 152 1048 307 906 2191 2136 1684 670 1850 55 921 1267 1694 2102 844 201 1216 1900 1647 408 1680 58 1175 214 445 647 1617 1109 967 1888 2120 1407 597 492 775 1514 1623 1649 1058 868 1217 711 1186 1719 1437 2125 1665 1213 365 139 1236 1620 764 2035 881 1678 624 1239 33 490 225 1639 1204 1218 1901 680 1289 819 330 2187 547 574 1689 580 131 1864 710 129 342 1677 1162 2112 286 416 1945 28...', '2217\\n1655 1627 1563 2033 2021 2 341 371 301 33 434 732 1969 1925 1311 1733 405 111 498 861 561 73 889 1376 508 2138 2160 135 141 1034 307 905 2192 2129 1683 664 1839 50 922 1265 1700 2100 836 198 1217 1899 1644 394 1680 58 1172 215 437 649 1602 1108 967 1888 2114 1408 599 493 779 1520 1625 1647 1053 865 1218 710 1186 1718 1433 2119 1663 1216 367 138 1238 1606 745 2034 878 1672 616 1241 30 488 224 1636 1202 1226 1900 667 1288 818 323 2181 538 569 1689 577 133 1862 709 131 342 1670 1161 2112 271 416 1944 26...']}, {'input': '1100110011010110111000000110011001001111010101101001000111011001111100001001101101001111000100100001110110000101111010010011010110001010011110001000101101010110111100101010100101110110111001000110111000000001100110101010111011001011001101010100001001011010101010011110110110100110101111001101100001000001100101001101111101010010111110100010111010010010111111100010111100110111101111010010110000111100011001011101010100110101010001011010001011110100011110100110011101100000000010101010100111000110000011101010001...', 'output': ['7418\\n4632 5020 3554 2651 3931 4783 477 1553 3687 1968 5534 4702 7181 3818 6251 3878 2962 7215 3521 3228 5976 2883 519 4650 1710 6523 22 1480 3735 5572 3641 1538 2207 1640 2638 3904 3028 5382 53 2549 4737 3839 175 2665 6345 1459 2813 7405 3370 7199 3592 3355 6151 6609 5596 801 1734 4601 692 2502 5815 2178 4147 2410 7403 4284 6956 1162 7167 7095 1696 2940 3343 4059 3243 5999 6616 2710 2902 147 2090 827 5599 2495 3791 261 5487 5663 4945 2242 5053 4854 430 5411 5186 2503 2353 3522 6120 3589 886 4894 1946 7286...', '7418\\n4632 5020 3554 2651 3931 4783 477 1553 3687 1968 5534 4702 7181 3818 6251 3878 2962 7215 3521 3228 5976 2883 519 4650 1710 6523 22 1480 3735 5572 3641 1538 2207 1640 2638 3904 3028 5382 53 2549 4737 3839 175 2665 6345 1459 2813 7405 3370 7199 3592 3355 6151 6609 5596 801 1734 4601 692 2502 5815 2178 4147 2410 7403 4284 6956 1162 7167 7095 1696 2940 3343 4059 3243 5999 6616 2710 2902 147 2090 827 5599 2495 3791 261 5487 5663 4945 2242 5053 4854 430 5411 5186 2503 2353 3522 6120 3589 886 4894 1946 7286 ...']}, {'input': '0110101100001110100011110111011101010011010111000111001101001011101101011111111100010000010111110101010010011101001010101111001001001111001110001100000110001110010111001111000111101011110010101101111101110101010101101011111000000101111101110101101110010010011111011100100011010010110001101101000100110101111001010100111101000111100000100000111000110100000010001110110001101101001011110000010110111111011101010111010100110101000100011011101101100000010010100111000000011011000111101001001111000101101011101101110...', 'output': ['10213\\n3257 5843 4790 837 1041 1570 4550 6734 2871 1867 9081 4719 3302 261 3463 1960 5964 178 2414 8695 2233 1491 6503 1221 5638 8899 819 336 79 1389 9533 835 3763 4296 5479 2178 5311 8108 320 8558 8743 9757 9108 7134 3175 6896 8591 6786 1076 4295 8929 354 4933 2921 9333 872 6587 4784 3624 7438 2506 6588 5267 2585 4527 8422 812 7186 2442 4116 6111 5193 987 566 5137 2138 3499 9270 7829 3899 1687 2575 2554 6824 3744 1002 4398 3854 6436 5570 375 7663 435 4242 76 4153 4918 7796 9646 1344 3565 9521 1748 986 544...', '10213\\n3257 5843 4790 837 1041 1570 4550 6734 2871 1867 9081 4719 3302 261 3463 1960 5964 178 2414 8695 2233 1491 6503 1221 5638 8899 819 336 79 1389 9533 835 3763 4296 5479 2178 5311 8108 320 8558 8743 9757 9108 7134 3175 6896 8591 6786 1076 4295 8929 354 4933 2921 9333 872 6587 4784 3624 7438 2506 6588 5267 2585 4527 8422 812 7186 2442 4116 6111 5193 987 566 5137 2138 3499 9270 7829 3899 1687 2575 2554 6824 3744 1002 4398 3854 6436 5570 375 7663 435 4242 76 4153 4918 7796 9646 1344 3565 9521 1748 986 544 ...']}, {'input': '1111011001100010111011001011110101010001011110011110111111011011100001100011011100001011100011001100111100010011011110110000000010101101101110101111000001100101101100101110101001010001101110010001000001011011101101111000101110100000110111001000110100100101110110101010110100011000110100010110100110110010111010100000010111011100001010110010010001001010010100111100110000111010111101100010110111101010011111001111000100100000010101010101111011101110101000001111011111010100011110000000110100110011000101110010101...', 'output': ['28140\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 9...', '28141\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 93...', '28141\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 9...', '28140\\n23608 16972 5027 205 18417 1839 6189 19108 17266 5632 13660 3459 10542 12623 12517 23452 10290 20881 1578 12338 24569 18076 3394 2974 17437 2728 1551 8705 805 2191 10530 10971 5804 20942 12882 17142 15967 26302 15067 11063 5273 26882 10910 22214 14926 6048 10344 11547 20286 19231 24034 22873 6466 8531 11753 15887 16706 16106 23415 1826 11850 2691 22954 25621 5163 17185 1275 3113 10501 17635 25155 16664 26605 20174 9760 11723 2305 26708 3212 3359 16819 3418 1478 8510 2096 10883 949 27746 6815 26513 93...']}, {'input': '1111101001011100111111010011110010010001100110001010110001010110111000000111001110010110010110011001111010101011101111001101011101110000001111100010100110011011110101001011111010000000010001011100011110001100110110011110000111110011111110001011011111110010010100100111011011101111001000011000010010101101001001101100001101000111010100110111100010010001001101001001111010101010001010111100000010101101110101110000101111110110000100011010001110100111100100000000100111011001001100110101110101010111111110110100110...', 'output': ['47704\\n37487 27108 44381 27514 24599 9507 5852 32084 27625 26378 23042 29571 29784 7709 30085 15014 38933 37738 18336 19964 2298 8457 42652 39496 42021 31693 14015 47310 1082 27761 12759 11459 36566 11211 36354 2008 40528 34409 17391 13576 1709 45503 7439 40964 3038 9177 373 46302 38315 46960 34302 11962 20614 9258 41957 2575 4968 35461 22601 16686 40555 39845 35977 16212 36860 32352 6373 15421 849 6836 22105 4599 32307 30310 42044 11752 18020 4260 4739 22652 41404 26356 38657 43552 5688 47101 810 46904 42...', '47704\\n37487 27108 44381 27514 24599 9507 5852 32084 27625 26378 23042 29571 29784 7709 30085 15014 38933 37738 18336 19964 2298 8457 42652 39496 42021 31693 14015 47310 1082 27761 12759 11459 36566 11211 36354 2008 40528 34409 17391 13576 1709 45503 7439 40964 3038 9177 373 46302 38315 46960 34302 11962 20614 9258 41957 2575 4968 35461 22601 16686 40555 39845 35977 16212 36860 32352 6373 15421 849 6836 22105 4599 32307 30310 42044 11752 18020 4260 4739 22652 41404 26356 38657 43552 5688 47101 810 46904 422...', '47703\\n37487 27097 44371 27512 24555 9507 5851 32079 27620 26362 23034 29536 29784 7709 30083 15014 38933 37714 18336 19959 2298 8453 42652 39496 42021 31693 14012 47310 1082 27761 12759 11459 36563 11190 36354 2008 40528 34409 17391 13576 1709 45503 7439 40946 3038 9116 363 46302 38315 46960 34295 11937 20614 9258 41944 2575 4942 35457 22589 16686 40555 39845 35977 16212 36829 32352 6349 15421 849 6836 22089 4599 32307 30272 42040 11752 17994 4260 4739 22652 41374 26356 38652 43538 5688 47050 802 46904 42...', '47703\\n37487 27097 44371 27512 24555 9507 5851 32079 27620 26362 23034 29536 29784 7709 30083 15014 38933 37714 18336 19959 2298 8453 42652 39496 42021 31693 14012 47310 1082 27761 12759 11459 36563 11190 36354 2008 40528 34409 17391 13576 1709 45503 7439 40946 3038 9116 363 46302 38315 46960 34295 11937 20614 9258 41944 2575 4942 35457 22589 16686 40555 39845 35977 16212 36829 32352 6349 15421 849 6836 22089 4599 32307 30272 42040 11752 17994 4260 4739 22652 41374 26356 38652 43538 5688 47050 802 46904 422...']}, {'input': '0111100111011010101101001110111111000001110000101010001100110101010110001010100110001101100110011001101101001110101110010111010110001010100101000111110100001011110101100110010110110110010110001101100000100110111001011111100100001101001100001011111000011110001101101001011110101101010010010100101100100101100000110110011100001000010001111110010011010111011011011011101100100111100101111110101110100011101101010000100001111001101101000001100101011001101000010111111101101011100011010111011001101010010101110010111...', 'output': ['87919\\n26100 48796 75498 71615 13065 84075 48146 34244 64621 25801 78019 68925 51779 54918 46135 42091 17533 9268 72072 85828 86298 45643 37741 55965 83662 70731 64386 24966 66523 14203 73152 59441 53458 2163 35789 84859 56576 74854 38950 71388 39702 40375 40606 1011 42914 19779 36544 28166 36447 13398 83951 18832 27007 66001 60328 40901 68980 76321 46821 5549 1496 18445 25841 31230 74836 34599 35940 41184 38272 64659 62295 7568 33908 54864 68145 59720 33494 22557 59875 45992 32566 74594 67094 42440 80813 7...', '87919\\n26100 48796 75498 71615 13065 84075 48146 34244 64621 25801 78019 68925 51779 54918 46135 42091 17533 9268 72072 85828 86298 45643 37741 55965 83662 70731 64386 24966 66523 14203 73152 59441 53458 2163 35789 84859 56576 74854 38950 71388 39702 40375 40606 1011 42914 19779 36544 28166 36447 13398 83951 18832 27007 66001 60328 40901 68980 76321 46821 5549 1496 18445 25841 31230 74836 34599 35940 41184 38272 64659 62295 7568 33908 54864 68145 59720 33494 22557 59875 45992 32566 74594 67094 42440 80813 ...', '87920\\n26039 48758 75494 71599 13045 84053 48134 34238 64570 25763 78003 68897 51768 54913 46084 42063 17491 9256 72065 85731 86273 45634 37724 55924 83621 70705 64359 24947 66491 14199 73133 59409 53446 2158 35767 84801 56499 74848 38859 71359 39683 40311 40587 997 42895 19767 36521 28161 36404 13360 83936 18782 26990 65995 60263 40781 68956 76292 46810 5533 1457 18407 25822 31205 74748 34558 35900 41156 38221 64634 62271 7549 33849 54851 68123 59693 33422 22510 59840 45987 32538 74587 67049 42408 80777 79...', '87920\\n26039 48758 75494 71599 13045 84053 48134 34238 64570 25763 78003 68897 51768 54913 46084 42063 17491 9256 72065 85731 86273 45634 37724 55924 83621 70705 64359 24947 66491 14199 73133 59409 53446 2158 35767 84801 56499 74848 38859 71359 39683 40311 40587 997 42895 19767 36521 28161 36404 13360 83936 18782 26990 65995 60263 40781 68956 76292 46810 5533 1457 18407 25822 31205 74748 34558 35900 41156 38221 64634 62271 7549 33849 54851 68123 59693 33422 22510 59840 45987 32538 74587 67049 42408 80777 7...']}, {'input': '1001010101001001000110110111011111011111111001111010101101101100100011010010100101000111111110010000010000000111000000110111010010011111010100010010001100111011101110101010111001101111011100111001111010111000010000110111110111101011111110110111110111001111111111111111111111111011111110001111011110000100100011011111110100000100100010111111010100100101011010011110100010111011111000100010000100010000001100111001111110110101000111011010010010000010001101100110101110111010101110110100110111000100001010111011111...', 'output': ['75255\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 ...', '75256\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 ...', '75256\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 5...', '75255\\n59551 59536 59542 59552 59555 59550 59557 59535 59559 59538 59541 59539 59373 59534 59244 59524 56801 59360 59573 59569 59567 59571 59574 59576 59570 59575 59566 59548 59562 59561 59544 59547 59563 59565 59531 59568 59529 59509 59528 59527 59522 59515 59523 59521 59525 59246 59513 59514 59468 59480 59518 59519 59512 59520 59045 59424 59501 59381 59123 58996 59321 58982 59311 59507 59503 59511 59477 59510 59506 59226 59504 59505 59490 59616 59611 59619 59597 59584 59625 59622 59620 59583 59635 59630 5...']}, {'input': '0101110111011010110111110101111111100100100100111101111011100111110111010101111111101011110111101011111000111111010111111010011111010110010001100001010010000100001000010101000100110000001001000000010110000000011011010001100100110111010111110101001001111110110101011101111010111000001000001010100100100010011000111010001000011001100010011111100010111101100001010000010010100010001000010000010000001000011000001010010000000000111000010000000000100010111000000000001100100000000000110000111101000110100101010011111...', 'output': ['55366\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 ...', '55367\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 2...', '55367\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 ...', '55366\\n28026 27537 28027 28025 28024 27965 28023 27186 28022 27842 28021 28010 27985 27963 27931 27233 27960 27977 26972 28008 27954 27844 27915 27864 26562 27845 27572 28046 28043 28036 28041 27901 28009 28033 27100 28031 28014 27942 28028 27241 28050 28053 28047 28048 27265 28020 28042 28057 28037 28054 28049 28058 28045 28060 28062 27836 28056 28070 28012 28067 28055 28015 28038 28000 28018 27802 28035 28083 27634 28085 28079 28073 28075 28082 28076 28077 28061 28068 28017 28074 28065 28063 27893 28078 2...']}, {'input': '1110001101101110101110010101101110001110001100010110011011011101101011101011101011110111111100111011111000010011110110101000011010111101001000000010100110101111100110101110101101010101011101000000011100110101100101101000010110010100010110011001110000010101100010100111010001100110011000110011100001011111101001001110001000100111000110110100101111010101101001101000111110101111010001101110111110011101110000111011011001011100101001111100111110010101100000011010101100101110001000010111001110111000110011010101010...', 'output': ['73807\\n64878 30126 64970 27134 29745 61051 20437 39035 7396 37761 23819 25647 64962 65002 57153 64987 59459 64907 65016 46639 65005 54574 38981 6112 59113 34518 47235 49867 22617 64595 24521 33893 615 11367 8225 5488 31518 52648 64583 38134 20147 51894 26440 41204 12719 4967 64373 59056 11485 64945 60562 17739 9723 64874 46399 56120 55169 27044 11489 44003 63989 64915 16723 1983 64895 63732 21003 24194 25873 64964 2934 64994 65055 54084 10959 65062 24866 64120 28970 21308 20682 18611 64560 37461 57240 13359...', '73807\\n64878 30126 64970 27134 29745 61051 20437 39035 7396 37761 23819 25647 64962 65002 57153 64987 59459 64907 65016 46639 65005 54574 38981 6112 59113 34518 47235 49867 22617 64595 24521 33893 615 11367 8225 5488 31518 52648 64583 38134 20147 51894 26440 41204 12719 4967 64373 59056 11485 64945 60562 17739 9723 64874 46399 56120 55169 27044 11489 44003 63989 64915 16723 1983 64895 63732 21003 24194 25873 64964 2934 64994 65055 54084 10959 65062 24866 64120 28970 21308 20682 18611 64560 37461 57240 1335...']}, {'input': '1101100100011110100010101111110110010011110101111011111001111111011011111011011010011111111001001100000001011001000100010001000110000011100000000000010111110111111111111101101011111111001110111111101110110111110111101011100110111100001100001100100000000011110001001111101001110110101111001111110010000100010010000000010100001000000001001000000010001000100000000000001110001000001000000010000000000000101000000000000110100100110110100001000010010010110101100100001011110110101010111111111110111110010011011001001...', 'output': ['51533\\n4857 4859 4839 4860 4863 4852 4854 4848 4853 4855 4856 4833 4844 4845 4837 4850 4851 4838 4842 4841 4828 4840 4745 4500 4824 4810 4717 4809 4771 4759 4808 4813 4812 4702 4815 4816 4705 4821 4381 4822 4823 4825 4819 4827 4525 4830 4834 4835 4566 4836 4874 4873 4820 4871 4872 4866 4870 4829 4869 4865 4797 4782 4884 4882 4847 4875 4807 4811 4890 4880 4889 4888 4881 4885 4886 4897 4883 4893 4898 4900 4896 4887 4849 4878 4895 4891 4867 4906 4892 4905 4901 4903 4894 4908 4904 4899 4909 4910 4907 4911 4707 ...', '51533\\n4857 4859 4839 4860 4863 4852 4854 4848 4853 4855 4856 4833 4844 4845 4837 4850 4851 4838 4842 4841 4828 4840 4745 4500 4824 4810 4717 4809 4771 4759 4808 4813 4812 4702 4815 4816 4705 4821 4381 4822 4823 4825 4819 4827 4525 4830 4834 4835 4566 4836 4874 4873 4820 4871 4872 4866 4870 4829 4869 4865 4797 4782 4884 4882 4847 4875 4807 4811 4890 4880 4889 4888 4881 4885 4886 4897 4883 4893 4898 4900 4896 4887 4849 4878 4895 4891 4867 4906 4892 4905 4901 4903 4894 4908 4904 4899 4909 4910 4907 4911 4707...', '51532\\n4858 4860 4840 4861 4864 4853 4855 4849 4854 4856 4857 4834 4845 4846 4838 4851 4852 4839 4843 4842 4829 4841 4746 4501 4825 4811 4718 4810 4772 4760 4809 4814 4813 4703 4816 4817 4706 4822 4382 4823 4824 4826 4820 4828 4526 4831 4835 4836 4567 4837 4875 4874 4821 4872 4873 4867 4871 4830 4870 4866 4798 4783 4885 4883 4848 4876 4808 4812 4891 4881 4890 4889 4882 4886 4887 4898 4884 4894 4899 4901 4897 4888 4850 4879 4896 4892 4868 4907 4893 4906 4902 4904 4895 4909 4905 4900 4910 4911 4908 4912 4708...', '51532\\n4858 4860 4840 4861 4864 4853 4855 4849 4854 4856 4857 4834 4845 4846 4838 4851 4852 4839 4843 4842 4829 4841 4746 4501 4825 4811 4718 4810 4772 4760 4809 4814 4813 4703 4816 4817 4706 4822 4382 4823 4824 4826 4820 4828 4526 4831 4835 4836 4567 4837 4875 4874 4821 4872 4873 4867 4871 4830 4870 4866 4798 4783 4885 4883 4848 4876 4808 4812 4891 4881 4890 4889 4882 4886 4887 4898 4884 4894 4899 4901 4897 4888 4850 4879 4896 4892 4868 4907 4893 4906 4902 4904 4895 4909 4905 4900 4910 4911 4908 4912 4708 ...']}, {'input': '0101100100011010001011011110101111011011110110110111110100000010000011111010000110111011111011101011001000100010100100001000111011110111111000000000100000000000010001110101101111011010000010001101111011111011001000111110111101111110111110100111000110010011100001001110100010011111001000101111111110110111111110000010000000001000000000000000000000000000000000001000000000000001000010000000111010100011111110110000010111111011101111101110001000110011111111111111111011011010011101000001110100100011010100010100000...', 'output': ['50866\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051...', '50867\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051 ...', '50867\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051...', '50866\\n3118 3104 3119 3120 3121 3117 3112 3046 3101 3113 3111 3114 3133 3128 3134 3131 3129 3115 3127 3123 3126 3122 3125 3071 3157 3156 3155 3158 3160 3150 3154 3141 3153 3151 3136 3149 3135 3116 3138 3139 3140 3130 3142 3137 3144 3145 3148 3143 3146 3179 3178 3175 3168 3152 3177 3182 3181 3176 3184 3180 3183 3172 3174 3169 3171 3170 3165 3162 3161 3147 3164 3166 3167 3132 3198 3189 3199 3202 3186 3201 3206 3207 3200 3204 3203 3205 3195 3193 3173 3196 3194 3197 3188 3185 3187 3191 3190 3192 3163 3052 3051 ...']}, {'input': '0111101101001110001101111101110011111101111000000001000100000111010110100110010101111100110111111111110111101111001000000000111110110111111111111111101101110111100111001000101001111111101101100000111111101011111111011110111100001000001111001001101101000111011111111111010111111111110111111111110111100010000000000000000001010000000000000000000000111101011111110110111111111010111110101011000010111110011111110101001110101011010000011011010001111010111000000011111110111110000000000000000000110001110010110010001...', 'output': ['92133\\n52804 52807 52806 52805 52797 52799 52779 52800 52803 52776 52801 52809 52808 52811 52802 52810 52816 52815 52798 52814 52813 52812 52785 52782 52783 52784 52639 52728 52629 52778 52781 52777 52780 52787 52796 52795 52791 52793 52790 52789 52786 52788 52681 52469 52858 52847 52856 52849 52855 52864 52854 52863 52861 52862 52859 52845 52837 52843 52842 52844 52852 52851 52848 52846 52850 52824 52835 52832 52834 52833 52825 52838 52839 52836 52841 52840 52827 52829 52817 52826 52830 52831 52823 52794 ...', '92133\\n52804 52807 52806 52805 52797 52799 52779 52800 52803 52776 52801 52809 52808 52811 52802 52810 52816 52815 52798 52814 52813 52812 52785 52782 52783 52784 52639 52728 52629 52778 52781 52777 52780 52787 52796 52795 52791 52793 52790 52789 52786 52788 52681 52469 52858 52847 52856 52849 52855 52864 52854 52863 52861 52862 52859 52845 52837 52843 52842 52844 52852 52851 52848 52846 52850 52824 52835 52832 52834 52833 52825 52838 52839 52836 52841 52840 52827 52829 52817 52826 52830 52831 52823 52794 5...']}, {'input': '1111010110000101101010000010000101110010011011011100101110100001100011101111101111011010111001011111000101111011111100110101110011101100111101010000110111110111111001111011111101011101111111111111110111111111101000011101110110101100100011111110111010101000110000010101110111110111101011111111111011110011011101111001101010001001000001101011100010010100111011111111110010111110011111111111000000001000011000000000000000000000000001001000000000000010001000000000000010000000001000000001101110110111111000101000100...', 'output': ['59091\\n58467 58466 58454 58472 58468 58434 58470 58473 58471 58474 58476 58463 58477 58475 58455 58453 58262 58235 58449 57381 58452 58465 58461 58464 58459 58450 58451 58462 58446 58439 58448 58444 58443 58445 58437 58440 58442 58433 58317 58435 58302 58426 58431 58429 58432 58428 58425 58430 58255 58364 58244 58260 58266 58424 58195 58427 58423 58505 58456 58507 58436 58504 58502 58503 58498 58492 58496 58497 58501 58500 58499 58489 58422 58488 58495 58490 58482 58493 58483 58484 58485 58469 58441 58479 5...', '59091\\n58467 58466 58454 58472 58468 58434 58470 58473 58471 58474 58476 58463 58477 58475 58455 58453 58262 58235 58449 57381 58452 58465 58461 58464 58459 58450 58451 58462 58446 58439 58448 58444 58443 58445 58437 58440 58442 58433 58317 58435 58302 58426 58431 58429 58432 58428 58425 58430 58255 58364 58244 58260 58266 58424 58195 58427 58423 58505 58456 58507 58436 58504 58502 58503 58498 58492 58496 58497 58501 58500 58499 58489 58422 58488 58495 58490 58482 58493 58483 58484 58485 58469 58441 58479 ...']}, {'input': '0010100100011000000111001011000000111100111101011001001001001110111100101010000110100010000111011110111001111100111101010101100111111001010110010010010000011010101101001001111010001101011010100001000011010011111001110111111001101000000010000100010100001000001000101111100000111011110010101110101011001100001011010000000101110011010111000100110101100110011111101001010010000100011001000101011011100100011001010110100110101011110110101011011010010011111010111110011100110110101111101101111110001101101111101111011...', 'output': ['67905\\n56302 56325 49913 56323 56295 56327 56088 56330 56262 56306 56293 56304 56311 56199 56237 56321 56103 56235 56209 56196 56198 56273 52122 56282 56286 56226 56284 56081 56292 54651 56297 56299 56147 56351 56314 56356 56338 56346 56341 56309 56344 56358 56352 56360 56320 56362 56355 56152 56361 56335 56291 56242 56332 56315 56301 56219 56317 56336 56331 56270 56337 56334 56345 56342 56343 56318 56254 56218 56250 56171 56223 56216 56248 56060 56258 56205 56150 56257 56145 56263 56266 54648 56264 56281 ...', '67905\\n56302 56325 49913 56323 56295 56327 56088 56330 56262 56306 56293 56304 56311 56199 56237 56321 56103 56235 56209 56196 56198 56273 52122 56282 56286 56226 56284 56081 56292 54651 56297 56299 56147 56351 56314 56356 56338 56346 56341 56309 56344 56358 56352 56360 56320 56362 56355 56152 56361 56335 56291 56242 56332 56315 56301 56219 56317 56336 56331 56270 56337 56334 56345 56342 56343 56318 56254 56218 56250 56171 56223 56216 56248 56060 56258 56205 56150 56257 56145 56263 56266 54648 56264 56281 5...']}, {'input': '1100110100010111011100001101001001001001110100111110111001111001100111111001011011001011001100101010001000110110100111111010000001101001000001011000101001000010000100100100000000111110000101100111011110011110000110001011011011101110111001111101010001110110111111010011110101111011010010011000100111101110110101100100011011011001111000111111111110101111011010100011001111111010001110100000011010000000001100001001000000001001101000001000000110110010110011011110100100001011100100110100010001100100011111100110010...', 'output': ['98341\\n95834 95895 95456 96416 95704 96411 96426 96395 96427 96425 96413 96409 96204 94216 96357 96365 96183 96410 96241 96057 90885 95759 93536 95831 96421 95959 96353 96431 96418 96430 96185 96434 92966 96441 96423 96438 96428 95731 96424 96447 96422 96444 96448 96446 96436 96450 96449 96440 96496 96432 96497 96453 96461 96445 96506 95952 96504 96494 96501 96483 96492 96488 96493 96455 96490 96398 96484 96489 96456 96480 96463 96457 96469 96429 96470 96433 94834 95542 96477 96466 96476 96435 96473 95912 9...', '98341\\n95834 95895 95456 96416 95704 96411 96426 96395 96427 96425 96413 96409 96204 94216 96357 96365 96183 96410 96241 96057 90885 95759 93536 95831 96421 95959 96353 96431 96418 96430 96185 96434 92966 96441 96423 96438 96428 95731 96424 96447 96422 96444 96448 96446 96436 96450 96449 96440 96496 96432 96497 96453 96461 96445 96506 95952 96504 96494 96501 96483 96492 96488 96493 96455 96490 96398 96484 96489 96456 96480 96463 96457 96469 96429 96470 96433 94834 95542 96477 96466 96476 96435 96473 95912 ...', '98342\\n95835 95896 95457 96417 95705 96412 96427 96396 96428 96426 96414 96410 96205 94217 96358 96366 96184 96411 96242 96058 90886 95760 93537 95832 96422 95960 96354 96432 96419 96431 96186 96435 92967 96442 96424 96439 96429 95732 96425 96448 96423 96445 96449 96447 96437 96451 96450 96441 96497 96433 96498 96454 96462 96446 96507 95953 96505 96495 96502 96484 96493 96489 96494 96456 96491 96399 96485 96490 96457 96481 96464 96458 96470 96430 96471 96434 94835 95543 96478 96467 96477 96436 96474 95913 ...', '98342\\n95835 95896 95457 96417 95705 96412 96427 96396 96428 96426 96414 96410 96205 94217 96358 96366 96184 96411 96242 96058 90886 95760 93537 95832 96422 95960 96354 96432 96419 96431 96186 96435 92967 96442 96424 96439 96429 95732 96425 96448 96423 96445 96449 96447 96437 96451 96450 96441 96497 96433 96498 96454 96462 96446 96507 95953 96505 96495 96502 96484 96493 96489 96494 96456 96491 96399 96485 96490 96457 96481 96464 96458 96470 96430 96471 96434 94835 95543 96478 96467 96477 96436 96474 95913 9...']}, {'input': '1011100111111100011110011011001011101001110010100001100010000000010010110010010011101101110111101111011011010001010001111111011101111111111011001111111111011010011101101011110111110101111011110111101100111010100000001000100100011111101110110011100100101111101000110111001000100010000100001001001000001100000000100000001000111111100111111101111111111101011011111111111110101111001110110110101000101101111111110010011110110111011101111011101110111101010011111010111110011111001000101100111101101000000000001000011...', 'output': ['93996\\n15465 15462 15467 15459 15466 15458 15456 15439 15464 15463 15436 15441 15470 15472 15473 15453 15477 15476 15460 15474 15471 15475 15448 15454 15455 15451 15457 15444 15449 15337 15450 15437 15452 15430 15438 15391 15410 15405 15346 15445 15447 15442 15427 15443 15407 15369 15396 15393 15316 15392 15388 15296 15389 15363 15305 15291 15400 15401 15390 15399 15398 15306 15408 15409 15387 15402 15406 15397 15413 15404 15411 15327 15236 15420 15421 15359 15415 15417 15412 15424 15423 15414 15425 15428 ...', '93996\\n15465 15462 15467 15459 15466 15458 15456 15439 15464 15463 15436 15441 15470 15472 15473 15453 15477 15476 15460 15474 15471 15475 15448 15454 15455 15451 15457 15444 15449 15337 15450 15437 15452 15430 15438 15391 15410 15405 15346 15445 15447 15442 15427 15443 15407 15369 15396 15393 15316 15392 15388 15296 15389 15363 15305 15291 15400 15401 15390 15399 15398 15306 15408 15409 15387 15402 15406 15397 15413 15404 15411 15327 15236 15420 15421 15359 15415 15417 15412 15424 15423 15414 15425 15428 1...', '93997\\n15464 15461 15466 15458 15465 15457 15455 15438 15463 15462 15435 15440 15469 15471 15472 15452 15476 15475 15459 15473 15470 15474 15447 15453 15454 15450 15456 15443 15448 15336 15449 15436 15451 15429 15437 15390 15409 15404 15345 15444 15446 15441 15426 15442 15406 15368 15395 15392 15315 15391 15387 15295 15388 15362 15304 15290 15399 15400 15389 15398 15397 15305 15407 15408 15386 15401 15405 15396 15412 15403 15410 15326 15235 15419 15420 15358 15414 15416 15411 15423 15422 15413 15424 15427 1...', '93997\\n15464 15461 15466 15458 15465 15457 15455 15438 15463 15462 15435 15440 15469 15471 15472 15452 15476 15475 15459 15473 15470 15474 15447 15453 15454 15450 15456 15443 15448 15336 15449 15436 15451 15429 15437 15390 15409 15404 15345 15444 15446 15441 15426 15442 15406 15368 15395 15392 15315 15391 15387 15295 15388 15362 15304 15290 15399 15400 15389 15398 15397 15305 15407 15408 15386 15401 15405 15396 15412 15403 15410 15326 15235 15419 15420 15358 15414 15416 15411 15423 15422 15413 15424 15427 ...']}, {'input': '0001000100011000011101010010100011111110010101101001000001101011111010010001110101001000010010001000011111110000010011000001101001000110011110001010011000001110101111100100010111110111111011011110010011101001001111101110001010100100001111010000000100000100011001110100101110000011100010110010000001100110100101110111111111111101111001111001011110011111011011101100101011111111011001011111110001001011011000010100010111010010111001011111101100111000011101101011110110100010111111111101111101101000111110000001110...', 'output': ['61246\\n1761 23163 28906 18156 38891 40268 39084 42589 41231 41810 13260 24629 31817 41232 44596 30424 12456 46052 45850 45325 36025 40774 39015 29873 31197 19828 42632 44254 43482 3090 28691 17948 17358 30429 36307 35077 36460 36531 25484 25652 41182 40671 39233 9470 13196 2817 13175 2163 14837 21741 15226 3711 193 32315 11129 34526 34235 33737 29085 515 34419 35392 10387 6443 14391 20275 8120 28457 36251 35967 23454 36577 37536 38553 28598 26603 9715 8855 22177 24638 23568 3806 5148 13753 31678 33126 34232...', '61246\\n1761 23163 28906 18156 38891 40268 39084 42589 41231 41810 13260 24629 31817 41232 44596 30424 12456 46052 45850 45325 36025 40774 39015 29873 31197 19828 42632 44254 43482 3090 28691 17948 17358 30429 36307 35077 36460 36531 25484 25652 41182 40671 39233 9470 13196 2817 13175 2163 14837 21741 15226 3711 193 32315 11129 34526 34235 33737 29085 515 34419 35392 10387 6443 14391 20275 8120 28457 36251 35967 23454 36577 37536 38553 28598 26603 9715 8855 22177 24638 23568 3806 5148 13753 31678 33126 3423...']}, {'input': '0100101111100111001001110000100011010010101110100101101010010111110111011101101001010010110101000011111101100000101011100011010011100010100100111110100101101001111011101111001110011010011100001011111001011110001001001010010010100000111001101000001000111101001100101110100100010110010001100101111010010101010001111011000011001101000111001101100110000110011111110001101010111000000111001111101111001011111110101010110101011110001100111001011111100011111111111011111111101001001011001111101001010110001000011110101...', 'output': ['79551\\n1516 16436 68003 55107 78676 77649 47588 27068 38288 58675 49243 80 4068 21682 17316 27238 18321 60663 68148 866 36875 72985 71539 69754 61333 7532 2436 4935 53275 19298 76665 30512 75584 20577 26303 15502 56354 33246 15805 62821 75501 71214 23076 16034 63721 20365 31163 50220 43344 419 37633 1690 63998 51539 11108 24243 37991 7774 19406 64506 26355 1246 3343 59891 13881 71669 66489 31190 58800 10261 70837 67236 76047 76480 32308 39530 63881 16316 9452 74554 78684 57356 61795 23939 28445 57295 36205...', '79551\\n1516 16436 68003 55107 78676 77649 47588 27068 38288 58675 49243 80 4068 21682 17316 27238 18321 60663 68148 866 36875 72985 71539 69754 61333 7532 2436 4935 53275 19298 76665 30512 75584 20577 26303 15502 56354 33246 15805 62821 75501 71214 23076 16034 63721 20365 31163 50220 43344 419 37633 1690 63998 51539 11108 24243 37991 7774 19406 64506 26355 1246 3343 59891 13881 71669 66489 31190 58800 10261 70837 67236 76047 76480 32308 39530 63881 16316 9452 74554 78684 57356 61795 23939 28445 57295 36205 ...']}, {'input': '1001111011110000111000101100100110110010001011111001101101110101001011000101010110101001111111011111101101110011010100011001001011110011101101011100101110111111010000011100010000111111001110010000101100101111111100011010110001100100101010101011010010010011110010011000011001110010010000100001111000001001010110001011111100011001010010111100011110100011011001111010110000100110011101001100001100011111000010111100100100111001011000001110111010101110010111001011111011011100111101000010100000011111111111011000010...', 'output': ['91877\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 ...', '91878\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 ...', '91878\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 4...', '91877\\n76858 71022 1686 58131 70479 18235 73377 46952 90502 89715 4527 34079 6250 16888 79455 75102 55839 24007 55052 70817 55613 58541 12190 2212 11251 72373 86509 28846 53688 44070 4056 34616 25656 61782 42396 6053 35296 6538 65111 62857 19243 42830 31395 41108 45487 13159 73734 48671 1810 61295 32253 18210 6192 76637 89606 76473 59041 47839 35928 1899 65069 91583 91121 13881 21651 67702 38020 36771 20764 52110 67893 57700 55101 6656 14368 90530 89124 74492 6961 73670 33583 79070 76159 37960 59896 49671 4...']}, {'input': '0011100010100010000100010100010110111010010000000111111110111110000101011100110111000010000000000110101111111011111000111111100010001011110000011110100011010001000011111111011000100110010001000111111100100010000010011111111011101111111111101110101101111011000000000011000001000001100001000000100010000100010111100111111011100111100010001000000001000100100010111110011011110011100011001000010000001100000001001110000000000000100001001000101111101110011111110111000100100000000010001101010110100111110011100111101...', 'output': ['83741\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 50...', '83740\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 50...', '83741\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 5...', '83740\\n42680 48394 48526 15562 48424 49567 49670 41169 49833 49722 50148 49954 50144 50252 50268 49956 32344 43467 50099 50104 26203 22142 21987 16342 8881 39852 33227 31984 23632 31578 41133 39698 45654 37697 44496 48047 48028 45565 47125 47043 50715 50750 50682 50771 50799 50840 50844 13330 50837 50820 50492 50376 50594 50593 50424 50470 50664 50707 50625 50684 50213 50427 13340 50474 50476 50524 50402 50519 50583 50559 48248 45828 42288 37433 34307 46396 49799 50319 50041 50381 50380 50350 50432 48068 5...']}, {'input': '0000101111000101111011011001101001110100000010000001000010000110110010100001110001000000110010011011011101000001111110111110100000000010000010010000001010111110001110110100001011100100000101111011111110111111011101110011110111100001000001111010111000010011101111111111010111111111111011111011101111101110111111111110111101111010101111001111111111111111101111110111000011101000111111011011010011101100101011111000100010000011100010000011011100001001011101001001110001011111010000000010001111011111111110011111111...', 'output': ['96729\\n11670 13778 13631 13779 13816 11441 7464 1029 9848 12056 12034 13938 13835 13926 11532 13763 13888 13897 13945 13948 13991 13953 13942 14353 14076 14245 14382 14294 14359 14324 14514 14511 14420 14442 14472 13743 13925 14017 14117 13976 14074 14289 13845 14227 14170 14142 14165 13606 13545 13538 12022 13509 13679 13721 13738 13718 13364 13706 11332 13394 13257 13484 13481 13341 9375 13025 13179 6327 12949 12960 11823 5621 11561 11262 11525 11307 11867 12494 11939 12916 12723 7218 10751 8520 6837 437...', '96729\\n11670 13778 13631 13779 13816 11441 7464 1029 9848 12056 12034 13938 13835 13926 11532 13763 13888 13897 13945 13948 13991 13953 13942 14353 14076 14245 14382 14294 14359 14324 14514 14511 14420 14442 14472 13743 13925 14017 14117 13976 14074 14289 13845 14227 14170 14142 14165 13606 13545 13538 12022 13509 13679 13721 13738 13718 13364 13706 11332 13394 13257 13484 13481 13341 9375 13025 13179 6327 12949 12960 11823 5621 11561 11262 11525 11307 11867 12494 11939 12916 12723 7218 10751 8520 6837 4377...']}, {'input': '1001101000111111101110011010101010011111101111100011000001111010101000001101010010001111110111011010000000001010100111000101001001110111101111101111110101000111111000011110000001111101100100111110000010001110010011110000101101010110011111110110000111011100101110111101000100100000000110010001110100000010001111101001101111100101000011100000110000101110100000001110111100111100000101100101011101001001001100111000011101010110111100000110100010110010110000101010100011110101001011110000101000101001001001100011000...', 'output': ['55740\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 ...', '55740\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 4...', '55739\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 4...', '55739\\n1459 13637 6860 27098 3207 16989 41561 6582 28394 26482 16861 13173 4183 36026 51292 49432 34677 38995 13135 12029 35514 34214 19219 14659 13611 37117 43115 33604 32313 11069 51942 11680 36553 9128 30637 37414 14444 32106 52195 53393 38980 45128 44068 7506 18163 40450 27016 43111 18490 5888 7251 17264 3187 2747 53579 53129 3133 31091 13314 1446 14392 39256 49809 28558 32496 4838 15743 17523 39722 23724 35557 15807 43777 44119 5649 30120 37073 28208 28541 45596 49351 5268 5384 11776 2593 45459 30433 ...']}, {'input': '1100001110101100111011111110101111101010110000010000111100111000011000101000111101111101000011100100100000101101101001011111111100110111100010010000011011110101000110101101100001111101111110100100111100111011101100101110000110100110101111100100110101000001001100011110111111000000111001000010000111011110000010110011100010111001011001011001010000001011101001101011111001010011111001101001111011111000010100110011100100011010000100101001110011000111000011101101000110010111010111111001111101011101110100100110101...', 'output': ['72613\\n42298 21602 64334 62222 42446 47578 20231 29491 69970 71445 19081 23265 36972 33809 21595 215 5199 48737 48493 54284 55901 38316 45199 69444 61190 34816 48763 10213 60118 50384 29613 31766 23975 49659 35948 56591 45981 6174 36390 53457 25364 62232 58512 14380 43710 50378 51984 70534 66764 8926 45476 25603 44555 31289 24071 7996 69226 59489 44514 6554 16909 72259 72261 45704 12030 68678 47050 17274 18049 18347 22115 3201 49052 30639 67783 58849 26243 48231 49 6161 10285 30117 40190 51817 3662 16173 10...', '72613\\n42298 21602 64334 62222 42446 47578 20231 29491 69970 71445 19081 23265 36972 33809 21595 215 5199 48737 48493 54284 55901 38316 45199 69444 61190 34816 48763 10213 60118 50384 29613 31766 23975 49659 35948 56591 45981 6174 36390 53457 25364 62232 58512 14380 43710 50378 51984 70534 66764 8926 45476 25603 44555 31289 24071 7996 69226 59489 44514 6554 16909 72259 72261 45704 12030 68678 47050 17274 18049 18347 22115 3201 49052 30639 67783 58849 26243 48231 49 6161 10285 30117 40190 51817 3662 16173 1...']}, {'input': '1001101000110010110100100001111110001011000100001110000001101111111011010110101101101111011111100111111010000011111110111110110110010111111010111011100010001001010010000001101101001001000111011011111111011011000001001101001011110100110011111001101000010100100111011101111100111000000101100000110100000111101110011000100000010111000000110010001011101000110001000111100011000000010100011000111011001011100011000001100001000111001100011100110000010000001010100100001110010011111101110011111001110100011110001111110...', 'output': ['51878\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 4...', '51878\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 ...', '51877\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 ...', '51877\\n2763 26464 21757 32683 8554 32625 37142 22415 36099 2881 33733 33876 17183 5857 14204 19182 18507 3401 9923 21797 13950 22262 10623 27018 23506 41503 43031 42612 34718 41535 38712 4694 40262 39515 28408 14053 2592 38109 37959 26812 23544 38789 38234 19154 26617 32974 23620 17066 10478 2226 25664 14609 22880 1362 15384 12988 39711 39265 8002 29765 26780 2965 11488 44016 43910 44321 24873 44232 3124 36975 26759 43617 43201 43169 6145 32820 32741 6258 10532 2480 9200 40797 32121 19497 44328 44843 9322 4...']}, {'input': '1011110111001111000010110000111111110110101101000011110111011101010011010111111110111000111110010000100011001011101111111100100010011110110010000010110010011011000000010110001011111011110111010111110111011100100011001000100001010111100100001111110110110001001111110010010111010111110001011111001110100101100010101111101011000011011111110001111101100001110111110101010111111110110100011010111010000001111111100100000010110001111001001101000010111101101011001100101001110001001000010010010110100000000111101011100...', 'output': ['54199\\n3683 36366 35604 26567 19294 471 10977 36471 11552 36849 36855 36478 2655 34352 33660 13013 33541 1121 1111 2551 11585 6902 31959 27109 3377 22975 12180 10680 7367 21367 158 17281 21472 13155 13025 23749 291 28588 25327 14726 33187 33036 31521 29174 18388 25781 22860 20597 27046 6831 30754 30750 19570 32100 23180 44137 43271 26545 35532 43862 44904 45399 19102 45742 45585 18495 18010 153 17153 33303 29194 21861 42650 43412 34488 34343 6506 3680 27525 11027 9405 12127 37529 37473 42385 40676 38113 126...', '54199\\n3683 36366 35604 26567 19294 471 10977 36471 11552 36849 36855 36478 2655 34352 33660 13013 33541 1121 1111 2551 11585 6902 31959 27109 3377 22975 12180 10680 7367 21367 158 17281 21472 13155 13025 23749 291 28588 25327 14726 33187 33036 31521 29174 18388 25781 22860 20597 27046 6831 30754 30750 19570 32100 23180 44137 43271 26545 35532 43862 44904 45399 19102 45742 45585 18495 18010 153 17153 33303 29194 21861 42650 43412 34488 34343 6506 3680 27525 11027 9405 12127 37529 37473 42385 40676 38113 12...']}, {'input': '0011001100011001111011100010010010011101001100100011001100001101111011011000101010111100100011011010010110010010111011110111111000110011100111010001000110101010000000011010111000001111111101000100000111111000111101000111010000011001001101011011001010001110110000010110001000111101110010011100010111000010111111100111000001001001001110010110010100001011100010000001110100011111111111010000000010001100110111111001110000100000000100010100011100111010000010100100111000001000011101110001111111100111001100110100110...', 'output': ['67586\\n11775 44160 4262 7703 50501 58236 24714 25424 38597 47772 36044 19680 64902 64406 4698 40619 18727 10397 60275 57658 9684 3473 29173 37483 22942 47796 61903 63776 57490 50725 16667 41425 36834 47205 15565 14727 14731 54435 54116 43599 42565 44037 47845 43107 29192 61073 65049 4746 37741 3091 3961 60811 61364 17261 60121 3766 8254 28802 44779 46139 52098 66336 66682 30699 18180 2625 64641 63927 23601 33160 58942 52195 51192 12228 9850 11547 40524 41543 6006 29457 60724 53877 37692 38087 39001 43905 6...', '67586\\n11775 44160 4262 7703 50501 58236 24714 25424 38597 47772 36044 19680 64902 64406 4698 40619 18727 10397 60275 57658 9684 3473 29173 37483 22942 47796 61903 63776 57490 50725 16667 41425 36834 47205 15565 14727 14731 54435 54116 43599 42565 44037 47845 43107 29192 61073 65049 4746 37741 3091 3961 60811 61364 17261 60121 3766 8254 28802 44779 46139 52098 66336 66682 30699 18180 2625 64641 63927 23601 33160 58942 52195 51192 12228 9850 11547 40524 41543 6006 29457 60724 53877 37692 38087 39001 43905 60...']}, {'input': '1010100110101010011110000100110100101100111010000110010110011011001010001110010101111100010001110010111010100001001110000011111001100111100110101000111001000011111001001111010011100011101110010000110010101010101100010011110100011100111011001110110010110110111000100100110011100110010110111000010010110001010101010010101110100001001111101011101011110100100001110010010001011101011010011111101001001101111010100000011001010110001110010010000110101100011011110100100000100011100101000000110110111111101111001001000...', 'output': ['100000\\n34728 59050 36431 27331 52266 45898 46179 14883 93370 495 80118 73354 35826 81703 1196 6246 55730 38192 22095 52457 56236 96178 78621 26410 49611 37868 29184 56374 57243 44630 15782 18777 33312 98899 40070 26180 20318 79337 78026 94528 16156 83054 36456 36898 80611 43231 33964 6126 64875 98469 29829 29712 86466 90968 56790 94226 43955 60576 80489 77529 35724 73123 6427 58546 66294 28028 64142 33786 64093 93696 5577 75234 29682 43857 75173 289 95318 22311 30811 86430 46164 24799 56658 44164 38053 487...', '100001\\n34724 59046 36427 27327 52262 45894 46175 14879 93366 491 80114 73350 35822 81699 1192 6242 55726 38188 22091 52453 56232 96174 78617 26406 49607 37864 29180 56370 57239 44626 15778 18773 33308 98895 40066 26176 20314 79333 78022 94524 16152 83050 36452 36894 80607 43227 33960 6122 64871 98465 29825 29708 86462 90964 56786 94222 43951 60572 80485 77525 35720 73119 6423 58542 66290 28024 64138 33782 64089 93692 5573 75230 29678 43853 75169 285 95314 22307 30807 86426 46160 24795 56654 44160 38049 48...', '100000\\n34728 59050 36431 27331 52266 45898 46179 14883 93370 495 80118 73354 35826 81703 1196 6246 55730 38192 22095 52457 56236 96178 78621 26410 49611 37868 29184 56374 57243 44630 15782 18777 33312 98899 40070 26180 20318 79337 78026 94528 16156 83054 36456 36898 80611 43231 33964 6126 64875 98469 29829 29712 86466 90968 56790 94226 43955 60576 80489 77529 35724 73123 6427 58546 66294 28028 64142 33786 64093 93696 5577 75234 29682 43857 75173 289 95318 22311 30811 86430 46164 24799 56658 44164 38053 48...', '100001\\n34724 59046 36427 27327 52262 45894 46175 14879 93366 491 80114 73350 35822 81699 1192 6242 55726 38188 22091 52453 56232 96174 78617 26406 49607 37864 29180 56370 57239 44626 15778 18773 33308 98895 40066 26176 20314 79333 78022 94524 16152 83050 36452 36894 80607 43227 33960 6122 64871 98465 29825 29708 86462 90964 56786 94222 43951 60572 80485 77525 35720 73119 6423 58542 66290 28024 64138 33782 64089 93692 5573 75230 29678 43853 75169 285 95314 22307 30807 86426 46160 24795 56654 44160 38049 487...']}, {'input': '1001111111101111100000010111111100111110000000000000000001110000000100000000000110011110111000000000000000000000000000000000000000000000011011000111101110000000110000011101111111111100000000000000011111101110001111111110011110111111110000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111100000110111110000000110011111111100011111111111111111100101110111110000000000011111111101111111111111111111111111110000000000000000000000000010111011111111000000111101111000000111111...', 'output': ['99999\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 ...', '99999\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 5...', '100000\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004...', '100000\\n51029 51031 51030 51028 51026 51027 51037 51036 51035 51034 51032 51033 51041 51043 51042 51040 51039 51038 51047 51049 51048 51046 51044 51045 51052 51051 51050 51053 51054 51055 51056 51057 51058 51059 51061 51060 51067 51065 51066 51062 51063 51064 51068 51070 51069 51073 51072 51071 50979 50977 50978 50982 50980 50981 50988 50987 50986 50983 50985 50984 50997 50995 50996 50998 50999 51000 50994 50993 50992 50991 50989 50990 51010 51011 51012 51009 51007 51008 51001 51003 51002 51006 51005 51004 ...']}, {'input': '1111100011011011101101001010110110110100011101101101011000111101000011111000100001110011101111010011110011001100011000111001001001101011010101011110100100000111011000100110011101001011100101111100001011100100100000111011110001101101010101101001011010100111001110111100111111110010101110100011000110110010001111010011001010101010111011011010100101111111010100010000101110000110111001000000010110010111110101110100110000000111101000101110000110011110111011110101010010100101111001010000010100010100101111111000110...', 'output': ['100001\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 93166...', '100000\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 9316...', '100001\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 9316...', '100000\\n65932 5236 2457 53795 98346 39635 57579 78010 38544 76067 55547 40264 94823 10591 14847 72280 16298 85844 97240 26137 42538 74830 34659 72170 90978 12217 33011 40649 46557 9008 32521 81688 27202 98936 48581 80658 84423 29534 90172 56980 43883 89000 92165 14828 32073 25862 13609 66704 49544 81576 23326 35728 70063 10214 92217 13057 50814 52601 25404 53569 99814 60932 60198 61864 23577 50356 60014 26830 25296 72161 29088 2903 57003 97084 39593 47824 14125 63783 57146 5609 89067 82812 42167 15695 93166...']}, {'input': '0111111011011110011101001000111111001001111010000011000010111111010111101011110110110100100110000001111110100010010001011011011110111101011111011111001111111111111111011101111000100110101000011000000110111000011111011111110011101111001111111011011101111101000101101101111101101111100001101111101101111000010010100000000000100010000001000000100011111111110111101111111111111101111011111111101111011111111110010010110010010111011011110011101111110111110011100101000000100001101001110100100100010000100101111101011...', 'output': ['100000\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88923 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88880 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893...', '99999\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88922 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88879 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 8...', '100000\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88923 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88880 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 ...', '99999\\n88954 88945 88953 88952 88950 88913 88958 88941 88957 88955 88956 88951 88939 88914 88859 88943 88940 88938 88947 88937 88946 88948 88949 88933 88930 88927 88931 88929 88928 88919 88934 88888 88932 88935 88917 88936 88922 88921 88901 88926 88924 88916 88883 88864 88915 88918 88907 88920 88873 88645 88871 88874 88875 88872 88879 88854 88877 88881 88836 88882 88865 88858 88863 88867 88783 88866 88862 88353 88861 88778 88774 88759 88898 88886 88897 88896 88868 88895 88885 88860 88834 88890 88878 88893 ...']}, {'input': '1000100000011100001011101111100010011101111010010001101010000010011001101010011101111100010001110011101110001010111100001000011010010001001010001110100011010110010011111001101111000010011011100100010111111101111110001110001000101010001001010000110001010001110010010011010001111110110100111111111011010011111100010101001001000111101101000010001001010000101000111100101111101001101000001001000110111100010111001010000110101010001000000110110110010111101101001100001001101001011010000010100000100011101110000001010...', 'output': ['99999\\n22919 58763 43976 3903 72333 82721 27886 32042 34104 56249 20235 45063 55598 46531 3823 8474 67983 83978 92989 89129 75539 84923 34919 72088 32836 74129 47662 47660 13170 39413 40774 26786 16799 25822 41993 46094 45851 534 37863 41305 74614 50102 51536 77134 70724 80497 80381 21146 26981 37693 70983 38932 83166 82270 68205 50070 16527 23459 22866 10317 24056 67562 51052 15608 79658 87772 35243 91652 53022 11640 95578 92358 14852 82219 48036 95699 24918 93949 72792 57846 68173 64764 63401 16162 96084 ...', '99999\\n22919 58763 43976 3903 72333 82721 27886 32042 34104 56249 20235 45063 55598 46531 3823 8474 67983 83978 92989 89129 75539 84923 34919 72088 32836 74129 47662 47660 13170 39413 40774 26786 16799 25822 41993 46094 45851 534 37863 41305 74614 50102 51536 77134 70724 80497 80381 21146 26981 37693 70983 38932 83166 82270 68205 50070 16527 23459 22866 10317 24056 67562 51052 15608 79658 87772 35243 91652 53022 11640 95578 92358 14852 82219 48036 95699 24918 93949 72792 57846 68173 64764 63401 16162 96084...', '100000\\n23180 58741 43976 3865 72308 82710 27886 32042 34088 56215 20275 45185 55739 46516 3821 8485 67926 83976 93078 89084 75728 84909 34872 72081 32836 74150 47662 47619 13115 39479 40659 26786 16770 25847 41987 46121 45851 629 37857 41269 74565 50102 51514 77124 70699 80497 80381 21275 26979 37693 70946 38932 83083 82261 68188 50035 16527 23471 22865 10310 23964 67553 51023 15716 79787 87772 35310 91780 53018 11614 95578 92357 14852 82208 48036 95643 24907 93946 72850 57855 68170 64560 63401 16147 9648...', '100000\\n23180 58741 43976 3865 72308 82710 27886 32042 34088 56215 20275 45185 55739 46516 3821 8485 67926 83976 93078 89084 75728 84909 34872 72081 32836 74150 47662 47619 13115 39479 40659 26786 16770 25847 41987 46121 45851 629 37857 41269 74565 50102 51514 77124 70699 80497 80381 21275 26979 37693 70946 38932 83083 82261 68188 50035 16527 23471 22865 10310 23964 67553 51023 15716 79787 87772 35310 91780 53018 11614 95578 92357 14852 82208 48036 95643 24907 93946 72850 57855 68170 64560 63401 16147 96481...']}]","id":544} {"difficulty":1000,"lang":"Rust","lang_cluster":"Rust","src_uid":"bd5912fe2c5c37658f28f6b159b39645","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io;\nuse std::str::FromStr;\n\nuse std::cmp::max;\n\nfn get_line() -> String {\n let mut input = String::new();\n io::stdin().read_line(&mut input).unwrap();\n input\n}\n\nfn get_vec(s: String) -> Vec\n where T: FromStr,\n ::Err: std::fmt::Debug,\n{\n s.split_whitespace().map(|k| k.parse().unwrap()).collect()\n}\n\nfn main() {\n let s = get_line();\n let s = s.trim();\n let k: u8 = {\n get_line().trim().parse().unwrap()\n };\n\n let ans = if s.len() < k as usize {\n None\n } else {\n let mut is_there = vec![false; 26];\n for c in s.bytes() {\n let ind = c - b'a';\n let ind = ind as usize;\n is_there[ind] = true;\n }\n let cnt = is_there.into_iter().filter(|&p| p == true).count();\n Some(k - cnt as u8)\n };\n\n match ans {\n Some(ans) => println!(\"{}\", ans),\n None => println!(\"impossible\"),\n };\n}\n","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"],"human_solution":"use std::io;\nfn main(){\n let mut s=String::new();\n io::stdin().read_line(&mut s).expect(\"Something went wrong\");\n let s:&str=s.trim();\n let mut k=String::new();\n io::stdin().read_line(&mut k).expect(\"Something went wrong\");\n let k:i32=k.trim().parse().expect(\"Something went wrong\");\n if k>s.len() as i32{println!(\"impossible\")}\n else{\n let s1:Vec=\"abcdefghijklmnopqrstuvwxyz\".chars().collect();\n let mut a:[i32;26]=[0;26];\n for c in s.chars(){\n let mut d:usize=25;\n let mut b:usize=0;\n let mut m:usize=(b+d)\/2;\n while bs1[m]{b=m}\n else{d=m}\n }\n if d==1 && c=='a'{a[0]=1}\n else if a[d]==0{a[d]=1;}\n }\n let mut sum:i32=0;\n for f in 0..26{\n sum+=a[f];\n }\n if k-sum>0{println!(\"{}\",k-sum)}\n else{println!(\"0\")}\n }\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":545} {"difficulty":1200,"lang":"Rust","lang_cluster":"Rust","src_uid":"c3244e952830643938d51ce14f043d7d","execute_outcome":"WRONG_ANSWER","source_code":"use std::io::{self, BufRead};\n\nstruct Problem {\n flags: String,\n seq1: String,\n seq2: String,\n}\n\nfn reverse_ascii_str(s: &mut str) {\n unsafe {\n let bytes = s.as_bytes_mut();\n bytes.reverse();\n }\n}\n\nfn trim_end_mut(s: &mut String) {\n s.truncate(s.trim_end().len());\n}\n\nfn consecutive_subsequences(s: &str, sub1: &str, sub2: &str) -> bool {\n if let Some((i, _)) = s.match_indices(sub1).next() {\n if let Some((j, _)) = s.rmatch_indices(sub2).next() {\n if i + sub1.len() <= j {\n return true\n }\n }\n }\n false\n}\n\nfn parse_problem(mut input: B) -> io::Result {\n let mut prob = Problem { flags: String::new(),\n seq1: String::new(),\n seq2:String::new() };\n input.read_line(&mut prob.flags)?;\n input.read_line(&mut prob.seq1)?;\n input.read_line(&mut prob.seq2)?;\n trim_end_mut(&mut prob.flags);\n trim_end_mut(&mut prob.seq1);\n trim_end_mut(&mut prob.seq2);\n Ok(prob)\n}\n\n\n\nfn main() -> io::Result<()> {\n let mut problem = parse_problem(io::stdin().lock())?;\n let forward_possible = consecutive_subsequences(&mut problem.flags,\n &mut problem.seq1,\n &mut problem.seq2);\n reverse_ascii_str(&mut problem.flags);\n reverse_ascii_str(&mut problem.seq1);\n reverse_ascii_str(&mut problem.seq2);\n let backward_possible = consecutive_subsequences(&mut problem.flags,\n &mut problem.seq1,\n &mut problem.seq2);\n let out = match (forward_possible, backward_possible) {\n (true, true) => \"both\",\n (true, false) => \"forward\",\n (false, true) => \"backward\",\n (false, false) => \"fantasy\",\n };\n println!(\"{}\", out);\n Ok(())\n}\n","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"],"human_solution":"use std::io::{self, BufRead};\n\nstruct Problem {\n flags: String,\n seq1: String,\n seq2: String,\n}\n\nfn reverse_ascii_str(s: &mut str) {\n unsafe {\n let bytes = s.as_bytes_mut();\n bytes.reverse();\n }\n}\n\nfn trim_end_mut(s: &mut String) {\n s.truncate(s.trim_end().len());\n}\n\nfn consecutive_subsequences(s: &str, sub1: &str, sub2: &str) -> bool {\n if let Some((i, _)) = s.match_indices(sub1).next() {\n if let Some((j, _)) = s.rmatch_indices(sub2).next() {\n if i + sub1.len() <= j {\n return true\n }\n }\n }\n false\n}\n\nfn parse_problem(mut input: B) -> io::Result {\n let mut prob = Problem { flags: String::new(),\n seq1: String::new(),\n seq2:String::new() };\n input.read_line(&mut prob.flags)?;\n input.read_line(&mut prob.seq1)?;\n input.read_line(&mut prob.seq2)?;\n trim_end_mut(&mut prob.flags);\n trim_end_mut(&mut prob.seq1);\n trim_end_mut(&mut prob.seq2);\n Ok(prob)\n}\n\n\n\nfn main() -> io::Result<()> {\n let mut problem = parse_problem(io::stdin().lock())?;\n let forward_possible = consecutive_subsequences(&mut problem.flags,\n &mut problem.seq1,\n &mut problem.seq2);\n reverse_ascii_str(&mut problem.flags);\n let backward_possible = consecutive_subsequences(&mut problem.flags,\n &mut problem.seq1,\n &mut problem.seq2);\n let out = match (forward_possible, backward_possible) {\n (true, true) => \"both\",\n (true, false) => \"forward\",\n (false, true) => \"backward\",\n (false, false) => \"fantasy\",\n };\n println!(\"{}\", out);\n Ok(())\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":546} {"difficulty":1200,"lang":"Rust","lang_cluster":"Rust","src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io::Read;\n\nfn input(read_file: bool) -> String {\n if read_file {\n let mut file = std::fs::File::open(\"sample.txt\").unwrap();\n let mut buf = String::new();\n file.read_to_string(&mut buf).unwrap();\n buf\n } else {\n let mut buf = String::new();\n std::io::stdin().read_to_string(&mut buf).unwrap();\n buf.trim_end().to_owned()\n }\n}\n\nfn solve(ws: &mut std::str::SplitWhitespace) {\n let n: usize = ws.next().unwrap().parse().unwrap();\n let xy: Vec<(i32, i32)> = (0..n)\n .map(|_| {\n (\n ws.next().unwrap().parse().unwrap(),\n ws.next().unwrap().parse().unwrap(),\n )\n })\n .collect();\n\n let mut ans = 100000;\n for i in 0..n {\n let mut s = std::collections::HashSet::new();\n for j in 0..n {\n s.insert(xy[j].0);\n }\n s.remove(&xy[i].0);\n ans = ans.min(s.len());\n s.clear();\n for j in 0..n {\n s.insert(xy[j].1);\n }\n s.remove(&xy[i].1);\n ans = ans.min(s.len());\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n const READ_FROM_FILE: bool = false;\n\n let s = input(READ_FROM_FILE);\n let mut ws = s.split_whitespace();\n\n solve(&mut ws);\n \/\/ let t = ws.next().unwrap().parse().unwrap();\n \/\/ for _ in 0..t {}\n}\n","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"],"human_solution":"use std::io::Read;\n\nfn input(read_file: bool) -> String {\n if read_file {\n let mut file = std::fs::File::open(\"sample.txt\").unwrap();\n let mut buf = String::new();\n file.read_to_string(&mut buf).unwrap();\n buf\n } else {\n let mut buf = String::new();\n std::io::stdin().read_to_string(&mut buf).unwrap();\n buf.trim_end().to_owned()\n }\n}\n\nfn solve(ws: &mut std::str::SplitWhitespace) {\n let n: usize = ws.next().unwrap().parse().unwrap();\n let points: Vec<(i32, i32)> = (0..n)\n .map(|_| {\n (\n ws.next().unwrap().parse().unwrap(),\n ws.next().unwrap().parse().unwrap(),\n )\n })\n .collect();\n\n let mut visited = vec![false; n];\n let mut q = std::collections::VecDeque::new();\n\n let mut ans = 0;\n for i in 0..n {\n if visited[i] {\n continue;\n }\n q.push_back(points[i]);\n visited[i] = true;\n while !q.is_empty() {\n let p = q.pop_front().unwrap();\n for j in 0..n {\n if points[j] == p {\n visited[j] = true;\n continue;\n }\n if visited[j] {\n continue;\n }\n if p.0 == points[j].0 {\n q.push_back(points[j]);\n } else if p.1 == points[j].1 {\n q.push_back(points[j]);\n }\n }\n }\n ans += 1;\n }\n\n println!(\"{}\", ans - 1);\n}\n\nfn main() {\n const READ_FROM_FILE: bool = false;\n\n let s = input(READ_FROM_FILE);\n let mut ws = s.split_whitespace();\n\n solve(&mut ws);\n \/\/ let t = ws.next().unwrap().parse().unwrap();\n \/\/ for _ in 0..t {}\n}\n","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":547} {"difficulty":1700,"lang":"Rust","lang_cluster":"Rust","src_uid":"0fd33e1bdfd6c91feb3bf00a2461603f","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io::{stdin, stdout, Write, BufReader, BufRead, Read};\n\nfn gcd(mut a: u64, mut b: u64) -> u64 {\n while b != 0 {\n a %= b;\n let c = a;\n a = b;\n b = c;\n }\n return a;\n}\n\nfn solve(input: &mut BufRead, output: &mut Write) {\n let mut input = BufReader::new(input);\n\n let mut first = String::with_capacity(201);\n let mut second = String::with_capacity(201);\n\n input.read_line(&mut first).unwrap();\n input.read_line(&mut second).unwrap();\n\n let s = first.trim().as_bytes();\n let t = second.trim().as_bytes();\n\n let first = s.iter().position(|&it| it == t[0]).unwrap();\n let second = s.iter().rev().position(|&it| it == t[t.len() - 1]).unwrap();\n\n let mut answ = first.max(second);\n\n let mut pos = vec![first; t.len()];\n let mut pos_rev = vec![second; t.len()];\n\n\n let mut prev = first;\n for i in 0..t.len() {\n let pos1 = s.iter().skip(prev).position(|&it| it == t[i]).unwrap();\n prev += pos1;\n pos[i] = prev;\n prev += 1;\n }\n\n let mut rev = second;\n for i in (0..t.len()).rev() {\n let pos1 = s.iter().rev().skip(rev).position(|&it| it == t[i]).unwrap();\n rev += pos1;\n pos_rev[i] = rev;\n rev += 1;\n }\n\n for i in 0..t.len() - 1 {\n answ = answ.max((s.len() - pos_rev[i + 1] - 2) - pos[i])\n }\n\n answ = answ.max(s.len() - pos[pos.len() - 1] - 1);\n answ = answ.max(s.len() - pos_rev[0] - 1);\n\n writeln!(output, \"{}\", answ).unwrap();\n}\n\nfn main() {\n let stdin = stdin();\n let stdout = stdout();\n solve(&mut stdin.lock(), &mut stdout.lock());\n}\n\n#[cfg(test)]\nmod tests {\n use std::fs::File;\n use solve;\n use std::io::BufReader;\n\n #[test]\n fn basic_test() {\n let mut f = BufReader::new(\"bbaba\nbb\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"3\\n\");\n }\n\n #[test]\n fn basic_test2() {\n let mut f = BufReader::new(\"baaba\nab\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"2\\n\");\n }\n\n #[test]\n fn basic_test3() {\n let mut f = BufReader::new(\"abcde\nabcde\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"0\\n\");\n }\n\n #[test]\n fn basic_test4() {\n let mut f = BufReader::new(\"asdfasdf\nfasd\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"3\\n\");\n }\n\n\n\n\n}","description":"The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous) from $$$s$$$ without changing order of remaining characters (in other words, it is guaranteed that $$$t$$$ is a subsequence of $$$s$$$).For example, the strings \"test\", \"tst\", \"tt\", \"et\" and \"\" are subsequences of the string \"test\". But the strings \"tset\", \"se\", \"contest\" are not subsequences of the string \"test\".You want to remove some substring (contiguous subsequence) from $$$s$$$ of maximum possible length such that after removing this substring $$$t$$$ will remain a subsequence of $$$s$$$.If you want to remove the substring $$$s[l;r]$$$ then the string $$$s$$$ will be transformed to $$$s_1 s_2 \\dots s_{l-1} s_{r+1} s_{r+2} \\dots s_{|s|-1} s_{|s|}$$$ (where $$$|s|$$$ is the length of $$$s$$$).Your task is to find the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.","input_specification":"The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $$$s$$$.","output_specification":"Print one integer \u2014 the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.","notes":null,"sample_inputs":["bbaba\nbb","baaba\nab","abcde\nabcde","asdfasdf\nfasd"],"sample_outputs":["3","2","0","3"],"human_solution":"use std::io::{stdin, stdout, Write, BufReader, BufRead, Read};\n\nfn gcd(mut a: u64, mut b: u64) -> u64 {\n while b != 0 {\n a %= b;\n let c = a;\n a = b;\n b = c;\n }\n return a;\n}\n\nfn solve(input: &mut BufRead, output: &mut Write) {\n let mut input = BufReader::new(input);\n\n let mut first = String::with_capacity(201);\n let mut second = String::with_capacity(201);\n\n input.read_line(&mut first).unwrap();\n input.read_line(&mut second).unwrap();\n\n let s = first.trim().as_bytes();\n let t = second.trim().as_bytes();\n\n let first = s.iter().position(|&it| it == t[0]).unwrap();\n let second = s.iter().rev().position(|&it| it == t[t.len() - 1]).unwrap();\n\n let mut answ = first.max(second);\n\n let mut pos = vec![first; t.len()];\n let mut pos_rev = vec![second; t.len()];\n\n\n let mut prev = first;\n for i in 0..t.len() {\n let mut pos1 = 0;\n for j in prev..s.len() {\n if s[j] == t[i] {\n pos1 = j;\n break;\n }\n }\n prev = pos1;\n pos[i] = prev;\n prev += 1;\n }\n\n let mut rev = s.len() - 1 -second;\n for i in (0..t.len()).rev() {\n let mut pos1 = 0;\n for j in (0..=rev).rev() {\n if s[j] == t[i] {\n pos1 = j;\n break;\n }\n }\n rev = pos1;\n pos_rev[i] = rev;\n if rev > 0 {\n rev -= 1;\n }\n }\n\n for i in 0..t.len() - 1 {\n answ = answ.max(pos_rev[i + 1] - 1 - pos[i])\n }\n\n answ = answ.max(s.len() - pos[pos.len() - 1] - 1);\n answ = answ.max(pos_rev[0]);\n\n writeln!(output, \"{}\", answ).unwrap();\n}\n\nfn main() {\n let stdin = stdin();\n let stdout = stdout();\n solve(&mut stdin.lock(), &mut stdout.lock());\n}\n\n#[cfg(test)]\nmod tests {\n use std::fs::File;\n use solve;\n use std::io::BufReader;\n\n #[test]\n fn basic_test() {\n let mut f = BufReader::new(\"bbaba\nbb\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"3\\n\");\n }\n\n #[test]\n fn basic_test2() {\n let mut f = BufReader::new(\"baaba\nab\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"2\\n\");\n }\n\n #[test]\n fn basic_test3() {\n let mut f = BufReader::new(\"abcde\nabcde\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"0\\n\");\n }\n\n #[test]\n fn basic_test4() {\n let mut f = BufReader::new(\"asdfasdf\nfasd\n\".as_bytes());\n let mut buf: Vec = Vec::new();\n\n solve(&mut f, &mut buf);\n\n let res = String::from_utf8(buf).unwrap();\n assert_eq!(res, \"3\\n\");\n }\n}","testcases":"[{'input': 'bbaba\\r\\nbb\\r\\n', 'output': ['3']}, {'input': 'baaba\\r\\nab\\r\\n', 'output': ['2']}, {'input': 'abcde\\r\\nabcde\\r\\n', 'output': ['0']}, {'input': 'asdfasdf\\r\\nfasd\\r\\n', 'output': ['3']}, {'input': 'zywmerhahxlqsjekpqsdqxnjiduyjrytswiweohctztgpiorwimhjmdfofqynyggcrtzslbyvkuvqrsgwyacyvcuathplliwwshusluiqwuhutnzwvuchfedhwwfdzizltdxibtsaocpnqezstblgkfdcvfsjjyzwalkksumsaljqljmmkcyejwwdkolmcgmodoiclte\\r\\nzywmehahxlqjekqsdqjidytswwztgiowimhmffqygctzslbykurwacyvcuaplwshsluiqwuhutnwchfewwfdizttcpnqestgkfvsjylkksumaljmmkcjwwdkolmcgodcle\\r\\n', 'output': ['5']}, {'input': 'nqlswpkupyawfzygzjfntqpivmudprpmtkhwjcoabkkxfemjekxvnjikbvtbzgrxyacflvausuwgqfxvfcgxphzeiwpitswykvcsyspvimmynlyeldkqjsogjhszcqtvteiefdcissquzeynmjdhazcygrypyzjhjhsntegsuryjgpknwvnjxplztmjszidqkihuxgzc\\r\\nnlwkupywfzgzftqpiudprmkhwcozenmjdhacygryjhhntgugpkwvnjxplztszikihgc\\r\\n', 'output': ['101']}, {'input': 'mejfmlmclpqwopscpxxtkamtodhogweqtpigxgsbmsdvhcvyenqwsqpuxegugrgkopjwulnuqbqwqsarnymoursenotgeakbslepaacvwiydnqgnetsjaazblnriaqcmolxplvqtfdqtcmwduwrnmemtvlkgbbzkvaplprscuaqfvjlftkblwddcgwsqsfecoqibpncs\\r\\nm\\r\\n', 'output': ['199']}, {'input': 'kbuwmzldbajqgbdyeqqyuvdwsdzvjicqgsadjgruebcsxuhgftlykvuevsldvapqoxkrwjbwjjqquogxkpradzauxxlhrayprgnwxwumabxdojztankeqmraeqbbggrltdvcpiozbrvwhxhjpurwachimqrxrplcavtpaqzemxhrvagbngyqhacuxfbpkwqxyixdfmrj\\r\\nkbmrxrplcavtpaqemxhagbghacuxbpkwqxidmj\\r\\n', 'output': ['150']}, {'input': 'aplxwwvctglkkvfdyfpegleljcjtaxhdjnfonpedzeyvqprewgqwalqafebjvbjmpimoujgcfcnycugvdmgkjeaeggmnrspkydplacliklknqifoenxwxmtxsmakekewtkglligipuhpicngocrzhehelimoiocusgtuzkodlyqeetsiionfrphuoznnnobldhvjagmx\\r\\naplxwvctgdjfopdzevqpregwqafejvbjpmoujgccncumgkjeaeggnspdplclknifenxxmakekewgligiphingoczheheioiocustuzkodlyeesinfrpuonnobldvagmx\\r\\n', 'output': ['21']}, {'input': 'toimpgygoklxroowdhpacrtrrwmkhcgcpidapeyxrjmiqgilveimnazyydvnujtqpenfkeqdbylfdinompxupfwvirxohaampqihjueasygkucweptgcowjibgnwyqetynykgoujeargnhjbmntfovwusqavpdwtpnpqpkcgaxbhgdxloyealksmgkxprtpfugixdyfn\\r\\npgygkxrowdpcrmkcgciapxjmiqgveimnazydvnujteqdblinmpxpvxoaampesygucweptgcignwytgurgnhjtfovwusqavdtnppcxgdxyalksgkxtid\\r\\n', 'output': ['6']}, {'input': 'ziurxtzxixmsmewfuffsqdkpphssdcgybwtmzavkosqtmcntspzvftqybaldjllvgttblectspqinfdhhnpvkcbwjlqlquajueqsgymyekuswjctumsbnvvaiinxjlzcnyixfaykolkeogufvzvhnatqtelgjkqfvexghiznwubwihjkznkhepjzrnyzftmimqtlihpn\\r\\nzurzximmewfuffskppsdcybwmzavkosqtmctspvftybaljlgtltsqinfdhhpvkcwjlqlqymykusctumsbnvvainxjlcyxfykokeguvvhategjfxinuwihjznkhepjznzftmmqtlihpn\\r\\n', 'output': ['8']}, {'input': 'sowebxtwfdqpqkirbgcwzgglhkochlvjydmcksbenikriedfgrutoaqbnfdfzhqzacppcvznjnwmdadlxhowejzderdglkskznacjqqdrgmbnfxhmvgktivxrczqeafsapcbnjpccrbccutaabzwdtvbdpqduhbpcmlfkakimayhdqxhqvajpcfodvkmomvlimooncqi\\r\\nso\\r\\n', 'output': ['198']}, {'input': 'm\\r\\nm\\r\\n', 'output': ['0']}, {'input': 'td\\r\\nt\\r\\n', 'output': ['1']}, {'input': 'ipz\\r\\nz\\r\\n', 'output': ['2']}, {'input': 'cel\\r\\nc\\r\\n', 'output': ['2']}, {'input': 'xmxcpstetnnyxqbdbfsqhyjpdihhcpbxfugnmwhjadphwsialqafdvunwjqpifdqdwoxrkyetoyafjiyaosahwxfoxejwtvtousuailafdlukqfyealdakjxgfagdltxgteasiclclbdutzdxokclotgabcqbytryszetctfvfmxrfouepwyrmvnvvvhoppbcnlkdzio\\r\\npstnnyxqbfqhdipbxfgmaphialqdvunwjqpifdqdwoxketofjyaohxfoejwtousuaiaukqfyaldakjfgtxgeasiclcldtxokotgabqbrstcffxrfopyrmnvvhoppbcnlkdz\\r\\n', 'output': ['4']}, {'input': 'pibvxshjediuehnmfyvprhjtghzadeavjgnlvjwaqzlbexrlrnijokvqirbgfpnwwgnuptzotcdoooorqyqipbfawdslkvqrscnguydrywwzazwohlufbverfvoblvygevornmproyvsnjdxscgyrjmcqsmamfaugfmluuidnkmxbrzfzvmchopukbrlkuinxgridioo\\r\\npdrwwzzwohlurfvoblvygeonmpoyvjdxscjmcqsmfauguikmxbzfzmchopukbrluidioo\\r\\n', 'output': ['101']}, {'input': 'gecewmzjpvbpuvgtxiranywdxlneejahynrmfrpysxwqeymmwtotktkhncrtueulewaunbtcqnglwktiwkkkusjxhnfosjsoujaggwpuaceisnghxvgbdbeadwxshclpmocbyxqqrhthvwpedhorfeytuucbaaxrdrwvwayzadnqxfnhwkeevxzsdytxocjvpqvyxbch\\r\\nh\\r\\n', 'output': ['199']}, {'input': 'eseflxqdffomkoxxhdicryombxleqlvckmqfxxpwipivffhoozteiinpelbaukuifsoygjwyxjlqtazufqrafadzulucrgbtqfsxlnrvauxpojwbpgyzwentjokrkvkepazivjvtxsepruqorgmhvjfnjintftbvnqfwmapmcuilsbkmjgdulgirtpfpywawfpjpbxhy\\r\\nfnntftvnqwmmulbkmdgifpywfpjpxhy\\r\\n', 'output': ['150']}, {'input': 'ppneeasyjzorefvertisgxykuoqsugzppvfoubkybksuwtmmepnauteyemvtwwweftteccshepmnoxoglvpinlcduflxybdkvmjrwxcedsfjskiuxizwlckchsycmbwnlasriohmxwkkqdrpahmeuabdchfmyhbanluynzaaknssnjzbqwhudbupwhqfdvwdbhebykhg\\r\\nppnuqsppvfoubkybksuwtmmepnauteemvtwweftcsepmnooglvplcuxybdkvjrxcesfskiuzckchsycmwlaomxwkpahmabcmhanlknsnjzbwhudbupwdwdbhebyhg\\r\\n', 'output': ['21']}, {'input': 'izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\noukzkkhwazxbaarpbybsjxlylbbjbrezlasfzvtxvcdxrltffoqwlzqwneizpoygfdcmdxzesxlsitozzrfomhggrwrcfoorvhyzdpjhakuoxdjhzaalanzwqlrtmmraleyjyxutc\\r\\n', 'output': ['4']}, {'input': 'qmrzsrvfllfraflralrwlcfjxupnlomnbeuvipcyxxmksztljxqaoqnptwwemhgswpovpnvoqajaqzxpmtqarpgdrgwuuferbhjjowmljtaoiidzkrcaawzomruigpwzgsksgdkbdbrjwaszgdwreyztdctwacfmujdgxvjqoclueiwdgvjcfpfbpmbbmcufjiitndis\\r\\nqmrzsrflrrwlfjxupnlmevipcyxxmkstljaoqnptweswpovpnvoqajaxptarpgdgwufbhjjoljtiidcawzorugpwzgskgddbrazdwreyztdctcujgxvjqlewvjpfpmbbcjtndis\\r\\n', 'output': ['7']}, {'input': 'trlypzzcpqrdgejwjolsefdtaceyixfdnwbphfwutzcweeqjsfqdcuftiscihqbflemognctgylfgtwqhcqjmutymwnxzoobfxopbsduyrvdaptgqecwjtliifaytgqdlbckulbyrpqfcbxmwxzboidqmzeghltlvbobpdidklzrurmfrigprxqowfjeiapiodipbhpt\\r\\npt\\r\\n', 'output': ['198']}, {'input': 'dexradrxekhwsmctzdqyrqctyrduvazzfybzlwdrhjdxawojhilywadneuijwuuwjbnhdjitjekszqjmnhrxulxcwfrwfzjlkzagaygllqzbehxdyiaztrcpjtvrvtmzkhvgnopwdnssyvaagatdvxgwectdpelvjmsgovdxrdeffawhwcdkospyjziiyiwyoofgnxzq\\r\\ndexrdekhwczqrqtyduvzzyblwhdaojhilwanijuuwbnhjitjeksqjmnhrulxwfwflkgagllbhxyiaztcpjvrvmzkhvnnsaadvxwectdpevjsgodxdefwhwcdospyjziiwoogxz\\r\\n', 'output': ['4']}, {'input': 'lyvutlpllxxqnttfihibqdntcxbmnzpyfcpfmcqiazztsesrumkfaksqieruntdgptwgzgsuwezxnzouiyducrcksnxjfnlhiekbnqxdakumkwgunlliwtnkdsletbyeqfxqeitljzgmnqqccuhasbcrarjozprcmxcqvxvjqvjfdljvhvjyrissqopfdcbsajaolxiy\\r\\nlvuplxntihiqdncbmpyfcfqazztsrumkfasqieuntgtgzguwxnzouiydccksnxjfhieb\\r\\n', 'output': ['100']}, {'input': 'ynqvahidlgpkijhypxuxczcgmofasasypqwmloybyaxcjetnwupkkhbfakbkyispgcntzfzokejakhkyzdnndysopyhxivzgfgpqlevpfkyusruchbturvtkmqmmkwdrcnpeotelidokcydqjgmikqwbrulezdkxjrpcfzeblkcgyivijuxquvbeofjgpjlthbiqapdm\\r\\ny\\r\\n', 'output': ['199']}, {'input': 'pofvbxtueyzxgzcrthooeacytrsysourmdvkfhebuqpoofbixkxrveqijcluhgaqbeljezhpeiffpeaejkvvuhbhrlhlwuwpkbmgejmrelsnzlrubrgmqowtfucbjzvqoqcbvrqqljzvlscrrulfahdijkzosggdocqmhpbszktbucsfnfurklmlnxcshtdjhrherwxr\\r\\npofvbxtuezgrtooacytrssoumdvkuobxr\\r\\n', 'output': ['151']}, {'input': 'rycgapxwyctxltrpateousbjtijdfsrxxgexpbiwyijynvomwanlrqbzqbkoaikqyblojwamoqlgoxxtvqatcrmhulzcubrtaguxysvepnrvtppeuzgnncusougnuzcayncuedvadkezhtkqucmfvgtdzcyhlztdtdkaiocdmtmoawzvfojvkdfzlaudxxchpnbbgtkp\\r\\nrycgpxwytxltrpaeusbjijdxxgexpbiwyjynvoalrbzqaikqywamoloxxtvqrmhulcubtgxysvepnrpzgnunucncuedvequfgtcyhltdtdaiodtmazfov\\r\\n', 'output': ['20']}, {'input': 'grkhejdykjmieztowpjdazxmjqlccvlwjjspiupkmhbpuvjfkncwoiastztyekhrpsfwkqwmtrznggbkfwzrtuwswbgowsemwpmssbkzorkmjauqzpsdylnhapjopgiswihierbluojvarvrakdslncrhinbjxyxptiojddnnvxsedklyjehbvsinezsppztbpqswutf\\r\\nrkhjdykjitopjdxmqlclwjspiupkmhbufknciatzterpsfkmtrznggbkfwzrtwswgowsempsbkzokmauzpsdynhapjpgswibljvaakslncnbjxtjddnnvxyevszspztbpqstf\\r\\n', 'output': ['5']}, {'input': 'kxzkueqzheeolprfncwxyxgqqlocajzkusopvpwowdxubsvvtfvnrkyijoxqjawzkvfkainowbxdzcxbgrywttplukaorxvtimqxonumuvsqyfobzorqqsohazhjyvscjhtlgbmetpigfzhtcjipiorcrcsvvdofflgkqzymdxbeaozrgcjxrgtkxrzpshjesucdwhds\\r\\nkzkqeeolprcxyxgqqloazkuspwouvvvnkyoxjzvkinowxdzbrytluaorximxnmvfoboqqsozjvschtlgbetizhcjipirccvffgkzyxbeozgctkzpsheus\\r\\n', 'output': ['5']}, {'input': 'yddetawddikawvqdrlzrupjncowrjegdlffvqomiuczkpezqtnbnuzcalfsvptfvxkwfualvarudertbhngudovyqfqfuccfspgevzqdcknlnxwphudqnbltuvvpojjxnndexpswqcwhadiyryctuychonrgfkxvemyulrelpsjvzdhfhnwugsbtkasxwchysaxervjz\\r\\nyd\\r\\n', 'output': ['198']}, {'input': 'agjcuoizuqjsjqseebznldgxxoidwtgkmhalwefupqhhdfgnpfbwtvcxdtehporvlzpzxcqcsqughooebnsprdpvwqujiermibzbputvybnacrszmuqiilhrgjoahwqiaidlzgvzwsadziapxjyqyjqkgzuiqnsperhfpuzrxjfzfemthlwerdwxvlypnfmwgtceygropdlkgbzpiaheypygrwqshocurxcsmgmdpmuhagmfmlrkflpbbrxzxuvhygdxfudkypqrtvvitserwrxxojnshzdjbnxiemfjiedcogcbrejwsgkdttqlcdntpbdsfzrleqdmbssbazdgdfojguhwtqmqjdpduswnkfccmzfuygwozwymtzovfweibqqzhzbvxljoqmaspmtlfmxraikuoxqykrwnsrwrchqatbwivicdhvjqmymdccjmfhbxesakdshzrepdsdwhhlinhhsmkmmqaeysimevibqoprijqkxrlzvdhykrmji...', 'output': ['11']}, {'input': 'ekmxunniussgbuqgntgnnikcgwrjuxyzbsjjabvpoieadohgbzpsbvyfqwnlrrbiifxlnqslkjaxdfgnuasfrahhapbwutlxkavfsbqynpshgtwbhxkzglvemxdsqhgmttkqxkzydazcmjvagssmncbskpopijtypxipjlgcxqeasmjnmtebzidabcjjxkprlbxamvpzamdswwdsldttporjlzhuywghlscifiuaawufhypfdueunwketxcpmpenijyciygnmhcpjajsmirlpzoxdjudypuxeomhwbkxiiofdligsatpyscscsasdigxdeenofwnsexzohkuffswejxjeurfhfwhpdoktowtcejgppzpjhwxnrbvlcngpmdxktzvubtpszmprybzkmdrwmepbpmspdiavoyayeobgxfrhgsfaerivduwudniomztwwpxmvztutbmwzggnyupnwmcidzrixufecluzwauswstrmcmmvrpytqdzpdyyzc...', 'output': ['100000']}, {'input': 'zfeetfqvyhovzbtnfyuzthrdadupoterdwsmjfyeixjvgjlyxiqetattxghalgcummcpjdpcjxogrhsiuewjpuqsnmqrixdvkwrznnfrujrmbngzddwbgvjeyckyncmwcuqyysdpuklznpflxagrireowtlovfuqylrueuqpqfsihtapeanmxeltpmgluucgevtqxwdeetksddmgxsflfuztzixnosaykxsdbovexobvnwxmhlsdejiorcxrkohkbdizteoksdpvbvlndwsuzfalmjgwcegdiorijsxmhzrnsqalpebfzqsffqxmojnwodbxzldljxhvomxsbsvwhasqwyjdawrpjlhrspjcbyryxxvynpvrnuzdgxsgyjkkqixcudanvjnoiaqqkqhzhjlwyempzbayiuhqrfytwolrthkoutvxljnizbgxsulohczhibuknlvqvnyhjbizavaclbvnnypiuftwxewsdlypqqmueyjnzgugusjekhr...', 'output': ['199999']}, {'input': 'ibwycbpspvxkrzxqyvlazgbgxqivykdtjvnotglijzuyxppvexbewpyvrthjlhwquqlmrjihtmjffkswuomghqgeznlzjbvgoyxkjtdkrqqgvihcvdfbdfeloauogifatepcoswefirlhlenvrwrxjbltiepaafzseuiudolgfougduytbosukvuxoxwbbqitjesruesloteeeawmfvpznbxwonvgtntnkxmzxvxwwdohebvhxqwvjkdiytckegsficgvgiqakqskdckagfhrklutrrkvcoqtmfcphfncdkgthdlfqnnvyrhavzyfnwgkxfengzcringswzxeprhzdrytbfssncwjkjmgbqrcgdffqdayhbxwzooitjmckfjhuyguasqzerifrgftdjpkkaeyyuamuijmkzhvvnbcjyhogfzbnswjgehwkwjskaulrchvusesockapysndykowpyjsxexumyfmsqnrnqwgicanqhsstgvlibafrfpjj...', 'output': ['150002']}, {'input': 'tszyjfpbqjxxyhqaeccwzfzwquoqnurwgvfvzbkufmgtdkiwwjxvtuputgqosvllsvtruyrmwocfdyudwezslmcfhroxosfyzjtlaaqfuzivfsetuahylimngoqukeqlklqmbrwnmfcaxsluhnellfqafweotcwkkujjtahkpbfuvejmprusjdyyypniezhjnfbozndjcqxpglsrhvkkemqoamucfxxfokhnbmqghszmmbtpijhoodkacjcxpuvcxorffniondkhpdktjixrfepdbtdhizojpbrhjnmhbvbcjatgdznsdhcvhxabyvrquoeepnfkmodykurqgcswkxqzlzgnfgspowykedxfvgucgrkklcuspvrllpdammrdsrrkgskkoiupdtqwrdkdulazfmkebbwqklhjrsmnuomcihyenutolfypjdigluibtzhyxvrndhvtjtyfkwcoqldrijqazwidvygvggwrbmydsdolezxeawxhmcifkff...', 'output': ['2001']}, {'input': 'swwdfbzdbckyjwcosrwlxymfehbqucprhuxphsvrpaajbdxgqyxzxlaqotjuuyegamjgqvehzelqufkkqcqiikiufoijetjabxcogddlcgbdcadefsdjpdlyasfsanneocyyytwqaervzzdpteqigthcyvqnxhqmxgklukhmfgxvxxarjzzgyftkzlgtsyupmwxtzrdvlxyyciaavwcetkhwdbbbtlojtbnpyuaeyoebohoyxcdxqryctymslqtqttzdppeubwqcrrytotxgegelxqxrqgyfqggwrffxnvcqrwlbaxoozdujjpzoreckamwmkixuzqeegrfxsgvhnrywkjfybiycmzafjahdrewwjndpsbbmbchmdmbzkzdqhmgwbzryifdpiyrbwkoamwzvchthdaxjzjmpmkbobrkvsdurtdnmcbnspchkoskymicxagejlwabojvzmprfgwordynqzpbdiomkiyhzzesnuzlqleefdifgcbywrgc...', 'output': ['12']}, {'input': 'aqgknrbuvpltemixhplailgecsfyqfpntglasosekhfvxxconmniperqoqzkjdwkrbrbrvsxptptedafnbhidjqvejehnnjygniadhkjmrolfhhvjlojmcyohtesnihkcmilxdatkpktbyowbqsmfyezzkaysmkxdusamketbbvlxbmqsqfnrkjakoifgyrsegiiedoxzhlnsxlmellidvooormyefxezoxgelsgzyljffsxbaqmzjvdrwgczaomdhmwrxhbhqtkichbyveuazbeemappbguijilfpbozubecooazhamxxwwcdzylgxigvzmfkovkqgivuulohzjsccixczhagnpspkpauizpwdhskbawntekrqlpwpkxkbigubnkymepropihodvgczgweikhuvugttspgussqdzrseplqphpbonxfcyszgvsreegbwvxmagjejwvkjbewyffgeorzdxzxrgrbpjkmndsalmuvnbrewammrkoolgah...', 'output': ['12']}, {'input': 'qquhufraoefpkwnbyxwdrvhweolqqcpdhvxzgnrqhlesyoodzbfavhkntxnmttdxrvxkijmmotwesxktspxgszavygwugjdvunrgbkhwqonejunxbgchxtslealcnrrhsbqcorykmeoxzwlwvwnfqczjzmwhodwrgoetyfrcwlgnlejxmjpxoqmdvrmdqluxequsttqzgiycwjbeytyhmcpagzovkysyivjzodljghjtgwcrdjsgmwhgsgxuvmrhumogmalozyrhcshjjzaxvtisugyeynpodrgypcijunhdbbzhnqgcsashjqqhzmgswjveiocheyuvaeltarbinqvwxfnycsvzoxwumexupgydprppqaikvqhcepegiyytnbimfngatjuugxclzohsffmeitkxjjpnaiuhozjngkmdmgoidcrwvajnvhkqbgwvghzsctfmplbctjzfssjvarsgebfycspcbkuvvzdgmhbdrtiyrikczjtehoxpdjg...', 'output': ['198000']}, {'input': 'nhybfnqfkvbqkzhnwkleujvvqlpyuztmyiehknvkoafeppxnvzbzsjguyzaerlbrincbpqxpjjuykzcktugzeulblqmziznajdrhipftobsuaqcffhorwxaskciotzrnywgiomzaocxtzkwgpoukrujxifuihrqlbucmyjptlzpdmjiaqkxxknerwybqgfcazjjsufcsypivxwyfegbhpftubcyxoybavvtkfsegjoxuuiybqctrxrxvosvnjdurlupbbklfcdejhpziisscsbmjwwhlhorxwtcesavqkcbwvxegkvqbfplkxydflyesrujuzjetiuxdgzkfbaqkqumsknywpxscpkvocbngisnvmrdlrlzggupvkqebtzjvjowxuwrhfmehrcwknpahcnrhbqolrtztgudmwnuokgqwdcybfxzeqqaamjfylvjrfplgzcwrwpvbjprenlorqiskhpdzoqzpujoywhfiespqkshgapxrdhzbmnjzyfj...', 'output': ['12']}, {'input': 'mgdkfpbtzyzsusonyqqjcrgannhokmckciuajeqeojivbmligyyedlpyacnrotjdwbflgggffanedmcattwnhstovfgkkajcmkokybkysfvwwtyvgebbelpitmatllaqvclhvsxzaeseisqcghetvhdcabupuxrvummvxsotyglxrpqxbpecpeqlfdeklnyunyhffpucrhpaazkwteukjkkvsmcjitcqoyaiqeeeqfatmrllxmmwpacmdlerrinwoyrfocvduhsvcfoadckfhcuwpkyykrgzoifsrggvzhjbvunzriioomtrydwlxednabnunxwgujpvlhavcebmpuwdxbinvwrjodvwuzuklifrysesfedqywoftgerdeqrwoorokviewgomceqemhgdurdeuhobsbhlhyyadkialmugwpfthjlxubfytvebhxpmsknrfrcyjmcfkpluuqgpezpdzlqsolqluixfdjoenjtidddmjsrtysjafduxro...', 'output': ['100004']}, {'input': 'blprasxcaasqxfgbstpapdouiafxtcnjyvgudkfutgtwxzqsrqxccxgapizsdnsacvnwziafhncunahladmxmsthqvhsrzcmsmtlbrwcmpvpyavyvzmzugfyvrijhpjmyyphjquebsxpffoprkswqrezggzmkwxumcmnjikfvvobghwfrjpiaociyujhyeavxmjbmcqmbiuazrboqpseinpiwikmfvgoannketabhfgigrnhetdeuwlunqjhqnenpkbpqskypjrdwrswdrpefuwojwoizwajofutofkqkzrgkeqykjpxcrihsfoszrjfeupjiqiipoozokkuvjkechrwjcrhngzmyzznmviiybdeifwqbcoziffczakycyyzdqfmgachfogvfiphjcnjyjkmaqsczdvvlqbstlvkmjdufpfonfwuapzpqkeofpgzkkeheqrgdtxjealygixavmzhsyrfahezhpcryonmylqsakjoxomqvwkjfpybwfm...', 'output': ['199998']}, {'input': 'fhyaecegqjsptkrxyjnwdhqxpkvooadrhbbobizdjiigcdtxfjunoiqlzbxkoqqktlgmvagxswvxvprtzrojoqrqicjkiuotumnnegwcjfocdxfyhroraywvfexaxqzonxjfdngzzxgusolbwwucuxohbmhmrsgunuayofoleqjjblbqauuirqmcrkmtzyazviifljyavwnrmxgsyyqmgbeeofvmlrgsszqeufxjemmyamlbrfvvthkunwgfisoglawselktsgnvjdskmaqqisddthloofifvibxqqbitsniqdjoxkhjdmcapiblqixwfjxtgcnfdauvazshilcmipjsrbeqszyoqyyieahdxakzfmppssbkhzvpmidiixhasmduhkvbkbacfsieztfzcdkyqoolifqqctzswwxrfnwweaccdozzehhomjxpybkbufgxxdkezcimabmcwfbekkvfizttchggzbwxcrbxtwaujsmjamwsorwuvodmqyd...', 'output': ['150005']}, {'input': 'ilxcwdywdjivimunhsruyzteyemyqweczyhmcoivzqeronikoxhxhgcqgpabvvieyprngodbmgztdsxhyytdqvyiuixpdpejdezqcuozpdfwhgekngnbjibemzqkgyqviwqizqcanrwdcgbitbdaaedaiflelfkkrfysheopdpknyztbwjidbwvqxepetfhwixejlbblvldumdpfryglouqmocelcizhbelrwsxuabbxmjopteyzuthdpugfuhidrfrvqzhnicknrdbnysgmhgztqqmqtdbtwwewkbnalewjsypkebmwoodivouozpkdulscmtmtqjbkzdrrzbeeesgibajgcbknuvlomsqzbshujyqlksarzurbbjpfrenixwhgizkwdxdcbbbdeuspnefszdyhzbtzhdyyasczrkbzjajfphyvpbplzqpkkkxgcivxarqpitmwdhjqvqpjokoqgpqhkgpcaffyhrtgxbeqyohkzvnwjiotyyeebjv...', 'output': ['202']}, {'input': 'ituckyvcozccqsyqydkvgapurnyzwygnbagcinwswxzcpwtczuazcdvygqnyftlyeqxmudorztdgizuixzbebuczdqjqtmpekfqijzwsevylbapussxglkomwfehzqaenbdxtlyhpzhtwrerpmbriihttotjbecpbxppjrwimczlwfkszaapllrykuqhfpkbzdmlyumacsxuiopvayyenwouwnuakisujztiswlxlgwcdnonzjvjlgwwxshhguspnbmomolkragzcwmyxeijcwomazvedksotedujhvvbnaorydydfjkuaqyhrxhfxwqgxhqmxbmojnixjzkpofqqhyfqojjtdubyaellmtyjwmzbwntndfyktbvkzstqaxhplcoylecygscjgbzumdptlmhfsyjfvllctovrxqawgvyievqyzimoontbbfpuuyqpppidbbyzzovnltxbkfxtnfxeglywaoykllkwqvjqfipqchmzytqxsoulfdlygx...', 'output': ['22']}, {'input': 'lgtsqnsqeabfarshxbbljjeewemenzwtmgbdrgokrcpgcrfrnwglquiadwcggomtombzeuyrksavqzxlgxifoqljdboepxyqxcccsjqsjogkdnctknkhtcwixjoawesrbsdqashrpticmwqynzizewxjunfvyxpbueouwswmyvkuizqlypunkmvhgbmjiwdrhczpmnpcvweqmayfrjhbqczwczdrvmacobhhrcjuxnvpqiqihapjrvrpwsghasrnljskdjrthmjbjdiihmsznuclnbpartboogvsdoltoaqoqryeojpaterptmgwdpfuzecqsbehmxphgeknrggqdmiahlhffoqpfwrsuwjpkdyktuyeyetihuafqtnjscyusfvrwblcqtbqwveemjpsrnqnwlbqvxdpqpyxrygcgyvdxwktxjmtbznspplynvyljjehkdpgsksngctzjrmfulxmwxjjrfffvdxjqsrbhjaydgqxmvtyoenezlhtxhm...', 'output': ['52']}, {'input': 'pxxeuzuevuzsjhpjojhcynndyjvwzzhubcvvxqesylixusxsvzvsagtoesxrhulirbciigjujvylvoihkegaimlppbnnykiiaekjtqbeyfjhmnkdwswhigncudemcefvyjpjyrymitadeskrnhxkiyssaznhsbdgbibazkyqwfkplylybowrevvoqozrgvsnmrkwcdtkjbzdbwntpixmcaciihggwbkjnrblxrldjvvfodnymdpwajeznabcydexqoexqldsiozkjbssfixdwzomniatyptjkcrrjwghlwwptjgcprdnypwybplbcrdwtftaklwhpxlecudaldvibgmnnxviobljebmmcopeabjxmbmxawvgsnrcgednizyaavccyejxiahmqloatfmathmsuohbwsqmgzfvagyzsozpnqpdxpthnntljebycvhayntizfuvrecvdngxcauxdfggesmmmkcqctafxcokyasklcqxxuzsfgaihoghcte...', 'output': ['19800']}, {'input': 'vuurwsjugbokkznzjyvrgfngeedcmskruprygruhiuanvpkxwtxzpprbntzujfcujfeyhiotuvgoxwyhaazktguptcketlqdrvjhlgoeezyiezxyfjhchopgcvszgiayyzyivjtvsaklpcrxlsrodbmltkxwhkeqerujuamsguyklvzdcoxlpkshnampiamllkbexmflxlilqlmvspoffqfxsgstmxaaqqdehjuzvdvcgrvuzhevmnykzsuroxmhragzqsceamtdoajjqnivpakuqwlvbjjztcmcbfxtoqeogkcrlyemgytbbmqboggutowmjgtxfrtbrxstyhuerzccthslfbjkijxvhdcjyvdgelexyzfksjufkaglrxdajkzwsqfgtkuplgegwbvwyrwkhpwbtrofmnwwyjnvcorylicugxksuqecfuqnyyhsskyzgzxtbqjrdkswvucycajjrcacrnnsdajjlntdsehaasrojaoqgkwekgaxqcu...', 'output': ['12']}, {'input': 'gqhyvrektfdgoaidpyraiqtgrefdssdbmefcagensnnpjxpyjjdezmlmfaopwganapxeuzargpdyfypytrjnbwoynmhnpfqlchcoxtmdvkzyaoazmqbcaqgtevvltxidalrjxhprnbldijnhzxksdceyjhluaawodoqpbzneaqklxioopdnaadelgajoetimdgchzvahvoupbdxsamsmmmgjwllzllhgursurvnwdqdcfcpuhrgqtrtifntyqqzqigunhgqgyykfrmyluzudvkrxnnxrrkmymcdtpjfzkuaujgtftqgtbdoozbnckbhqczonhyizwbkstusbmcndtzvoqtfuugohhmxwedakgolxpkhobwkfnnutyybyhqzjejvrkjlnbhvsqtzuhheolvldsazobjhdkglbncfkglufipooizdsjxbqtizpcnaerhgjfgdyfsbrfeoqzejkdmkaitjpiokmugwuqcrbjoozrhvkhlsfdlmhulxltbl...', 'output': ['10001']}, {'input': 'tajsigcawtoryybbaglpwrngqzljetzqnenjzohyqaihtwyuyixvcofwggyfpeotmgvuwltadisznhiojrbysfvianagwbsrqojxavmkkwabuejeyshwjspvrnqafjwvkznpbalbemilinsxamfwxhnnuzddqsvvhvlnfemvwlcwiljqfitfkxrwaypqgminufsswkilerxuiajdzgclmaihwnbtmltuiljlfzrmwnlldsnwrkqwyvuhcfzhckhvhuciuhbejacmxumktzrjbewuwadjelzathgvbxljanlsqqpclrvbyhzrvtwvkjminvonrubaetnfrpuynqqoxgajwyqpevxeqdgqqgxmgpwxsoykfjsojasimmmrfxgaribqesovsunzplmddqafvltwyxvyylgmnzwmkgdadrsnaowqimmmhwycmozlfldpcsfqkvguobiqqjpxrqqejmwvlygairtkwpcyaxthvuryxmpjchcvcjibmudtbrq...', 'output': ['199997']}, {'input': 'vzhkayniphiltwmfqlpzfwesqdnqkgywekzkkibehoiirbuqjhtnxtnosbkdaqtdliuoxtmtmtkkcvgtavenebomhtltvdggwvenjhjknunprtcnztignlzxzlikmanynpllkbhqglwarmqewjmflwnmijwgglrktikpbygjwehqonpywdjfnwuzcxoiezjfyhnprzfvtftuxmkwhfagbugwkftbstxsgxxqdhkdrosudiprktogocxmrguznqowokgftxifzzsokxyvhxhzrbhuhbbucfubqqxcigdzsfhjspdcktsmullctubojuaimkvgrikilrzmghztbvsagvlwwyxbngkzzzshsnwxpdbbaxupafsywylyjgajetvolnztsqnenivcobtogvjawvnpmqvhfyummdnxcjftaiacuewmqrkytfbgbfhibqpseyfytedatnbkgvrjqekswrzhsvmgxiooogmvrmgadctpmnnaautalskqguzjsco...', 'output': ['150005']}, {'input': 'dnonjckyhvwgtdkizmmhsziqnqkjiqgywozrskfwzurjnmraueqwosydyncqgkeoamcwrfxgotludnnjkwdvzgajaepcaahowrgbcuxmxmzqxtoiemkftynzwtdkgbrxoxxqsqrwfmxcaglxnhpkvyqiodxehafklzpprsicrehyanczjpfodqvapmcexoigihhqruxwkkkqibmfmcrtcgbfxwwrpjatllsxerkyrdanymaktylloxecnvohjegltqsfqanidhignhugqnhqtftyjzcrnamyoyjetubsfrchpyorlmjcdxdacmyjnboftqioxgxpbrmhuxftbdswqywdvehpjssinbjaiubxcaahaawdyszlxprbvifrbuylrzpykhiaszosrrrjpvefgtwxlsllloqtqgqpdujlcyjyxjvhuizewqhweynqvrprlpgnmiudclitgocgwzezlnhgfhnopkyqzmgspezipjktkdpbpjeljqhuihfkzom...', 'output': ['20924']}, {'input': 'whhkdzwvmbuwwmdwgjrzooiyodolsnwoxcipdqgamtyepngtzxlvgxqgayijutpopxwkmnckeixjckoerphduosfsyzukenedmurdlstfzjrjsvkfqwgoiyzurjwawuskzkkmnfkhabrrvmpdacfttihyqrtbdrukwkroikibmqvkyleevzhcotsrfcwzgphylmqejzylinpdwiouliqtcklbsqgdzgnocrsgsxmqrwdxclhmskcmghzsgprvrycxlaaauhenkpfyvkbfvxdflrepgtrxycigphcpipubtuwguxwcgdwkpojearqfrrokugssbrxzvtpnnzmarhoedqzwriyrdfvnyeexmydsqtezdydweluswhqnfijxexqeeymtbzavcghsndblidyctxvsdxifhivogrbvjwpxotwudxiotsyxtixnfgqjdgrsimedhcldkoxyfeqsvpegxxexscrdvxfwawmqewgrlpdholvxswbjfbuplzpfkw...', 'output': ['11']}, {'input': 'bpvlttjwjwkcfbblvvdqmmrewyolpblbjlemqmndxrujzlrkipemiaowqpmayjevkywycgrohsuzxhmwtkgjupmzphtufjcnpjyybvchndqvbuowepvserzyuberjlfcxzwnpxqdgbacveyqhzhaquxrjmwnnjhczoipvefirluhhhcmlogyszurdsetczzsoqxbewkocaczpgxxwvsxnpzwxdhpzdtvhiijkufrykwjygkrzacynefwcvzmsannrpjciccgtbcogfmjtrqawqnjlemzoqejyfpygwlrqgmzftfiaewxaidjnutldvarlphirltbdkwedjzqbvtspqhufojmekvdxpzhtjriabqcijluomadsgrezstircilwnyibiilubpftnzpjddbrbvxivcepznpvnxqkgwyhmzsssjtqenngcapjmgvpxgtubfmwdrsmsanituultxwthtqknmkrtavbbhrdhjnpdlncevunpaiuomicdrufjd...', 'output': ['11']}, {'input': 'ysdiwsqoqatfjkahugrxyptzagnhyfqngklnftkyhjlosxyavmycjbzrwvjdqhxxcmzidmmlyxwbtidycretuzhogeyigavtwhxphydpojmnprnrxaqniokmommggmwjqgedwxjqtwzglaxpqkxunausaqgjrugwmclehnyjfhogskapyknhikfsccpxlsemfnulyvipftijkpmbsvydrgtmsbhsrdmpbcurrngfcapnzajgifnwpzhzgmecepjsdaunhebxslyowasyjtrdfquhibtvnknhrhykutztdteyzqltlkrdilouqyxjosmywpsiagclpnvzkbftortonmwnfoimbkrjmfrnilpspulykvjatzxhbjichhikoqbvvlsegxgnlffhvvpnkfihtayllwqstncslodybirprlcsaztcaruasglpjkrqbdgsmrvacoxqykwmarxqteyfrrxgghiclysekqqxkxjuodrmoambrtbvehtsuuzrkjk...', 'output': ['19897']}, {'input': 'npynh\\r\\nnnh\\r\\n', 'output': ['2']}, {'input': 'aa\\r\\na\\r\\n', 'output': ['1']}, {'input': 'abcc\\r\\nacc\\r\\n', 'output': ['1']}, {'input': 'qwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfgqwertyuiopasdfg\\r\\nqwertyuiopasdfg\\r\\n', 'output': ['180']}, {'input': 'tsypkoisgayandsuckedhisdadsdick\\r\\ntsypkoisgay\\r\\n', 'output': ['20']}, {'input': 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr\\r\\nabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv\\r\\n', 'output': ['100']}, {'input': 'rosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefranci\\r\\nrosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefrancirosefranci\\r\\n', 'output': ['100']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['27']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['99']}, {'input': 'izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\nizoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\\r\\n', 'output': ['0']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['100']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['109']}, {'input': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['111']}]","id":548} {"difficulty":2000,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"1244_E","execute_outcome":"RUNTIME_ERROR","source_code":"fn main() {\r\n input!{\r\n n: usize,\r\n k: usize,\r\n mut a: [usize; n],\r\n };\r\n a.sort_unstable();\r\n let sum = a.iter().sum::();\r\n\r\n let check = |max: usize| {\r\n let mut l = 0;\r\n let (mut lsum, mut rsum) = (0, sum);\r\n for (r, &x) in a.iter().enumerate() {\r\n rsum -= x;\r\n while x - a[l] > max {\r\n lsum += a[l];\r\n l += 1;\r\n }\r\n let op = if l == 0 { 0 } else { l * (x - max) - lsum } + rsum - (n - 1 - r) * x;\r\n if op <= k {\r\n return true;\r\n }\r\n }\r\n\r\n let mut r = n - 1;\r\n (lsum, rsum) = (sum, 0);\r\n for (l, &x) in a.iter().enumerate() {\r\n lsum -= x;\r\n while a[r] - x > max {\r\n rsum += a[r];\r\n r -= 1;\r\n }\r\n let op = x * l - lsum + rsum - (n - 1 - r) * (x + max);\r\n if op <= k {\r\n return true;\r\n }\r\n }\r\n false\r\n };\r\n\r\n let (mut low, mut high) = (0, a[n - 1] - a[0]);\r\n while low < high {\r\n let mid = (high - low)\/2 + low;\r\n if check(mid) {\r\n high = mid;\r\n } else {\r\n low = mid + 1;\r\n }\r\n }\r\n\r\n println!(\"{}\", high);\r\n}\r\n\r\n\r\nmod io {\r\n use std::cell::RefCell;\r\n use std::io::*;\r\n\r\n std::thread_local! {\r\n pub static STDIN: RefCell = RefCell::new(stdin());\r\n pub static STDOUT: RefCell> = RefCell::new(BufWriter::new(stdout()));\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! input {\r\n () => {};\r\n (mut $var:ident: $t:tt, $($rest:tt)*) => {\r\n let mut $var = __input_inner!($t);\r\n input!($($rest)*)\r\n };\r\n ($var:ident: $t:tt, $($rest:tt)*) => {\r\n let $var = __input_inner!($t);\r\n input!($($rest)*)\r\n };\r\n (mut $var:ident: $t:tt) => {\r\n let mut $var = __input_inner!($t);\r\n };\r\n ($var:ident: $t:tt) => {\r\n let $var = __input_inner!($t);\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! __input_inner {\r\n (($($t:tt),*)) => {\r\n ($(__input_inner!($t)),*)\r\n };\r\n ([$t:tt; $n:expr]) => {\r\n (0..$n).map(|_| __input_inner!($t)).collect::>()\r\n };\r\n ([$t:tt]) => {{\r\n let n = __input_inner!(usize);\r\n (0..n).map(|_| __input_inner!($t)).collect::>()\r\n }};\r\n (chars) => {\r\n __input_inner!(String).chars().collect::>()\r\n };\r\n (bytes) => {\r\n __input_inner!(String).into_bytes()\r\n };\r\n (usize1) => {\r\n __input_inner!(usize) - 1\r\n };\r\n ($t:ty) => {\r\n $crate::io::STDIN.with(|r| {\r\n use std::io::BufRead;\r\n let r = r.borrow_mut();\r\n let mut r = r.lock();\r\n let mut s = vec![];\r\n loop {\r\n let buf = r.fill_buf().unwrap();\r\n if buf.is_empty() {\r\n break;\r\n }\r\n if let Some(i) = buf.iter().position(u8::is_ascii_whitespace) {\r\n s.extend_from_slice(&buf[..i]);\r\n r.consume(i + 1);\r\n if !s.is_empty() {\r\n break;\r\n }\r\n } else {\r\n s.extend_from_slice(buf);\r\n let n = buf.len();\r\n r.consume(n);\r\n }\r\n }\r\n std::str::from_utf8(&s).unwrap().parse::<$t>().unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! println {\r\n () => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::writeln!(w.borrow_mut()).unwrap()\r\n })\r\n };\r\n ($($arg:tt)*) => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::writeln!(w.borrow_mut(), $($arg)*).unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! print {\r\n ($($arg:tt)*) => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::write!(w.borrow_mut(), $($arg)*).unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! flush {\r\n () => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n w.borrow_mut().flush().unwrap()\r\n })\r\n };\r\n }\r\n}","description":"You are given a sequence $$$a_1, a_2, \\dots, a_n$$$ consisting of $$$n$$$ integers.You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.Calculate the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than $$$k$$$ times.","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \\le n \\le 10^{5}, 1 \\le k \\le 10^{14})$$$ \u2014 the number of elements in the sequence and the maximum number of times you can perform the operation, respectively.\nThe second line contains a sequence of integers $$$a_1, a_2, \\dots, a_n$$$ $$$(1 \\le a_i \\le 10^{9})$$$.\n","output_specification":"Print the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than $$$k$$$ times.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"fn main() {\r\n input!{\r\n n: usize,\r\n k: usize,\r\n mut a: [usize; n],\r\n };\r\n a.sort_unstable();\r\n let sum = a.iter().sum::();\r\n\r\n let check = |max: usize| {\r\n let mut l = 0;\r\n let (mut lsum, mut rsum) = (0, sum);\r\n for (r, &x) in a.iter().enumerate() {\r\n rsum -= x;\r\n while x - a[l] > max {\r\n lsum += a[l];\r\n l += 1;\r\n }\r\n let op = if l == 0 { 0 } else { l * (x - max) - lsum } + rsum - (n - 1 - r) * x;\r\n if op <= k {\r\n return true;\r\n }\r\n }\r\n\r\n let mut r = n - 1;\r\n lsum = sum;\r\n rsum = 0;\r\n for (l, &x) in a.iter().enumerate().rev() {\r\n lsum -= x;\r\n while a[r] - x > max {\r\n rsum += a[r];\r\n r -= 1;\r\n }\r\n let op = x * l - lsum + rsum - (n - 1 - r) * (x + max);\r\n if op <= k {\r\n return true;\r\n }\r\n }\r\n false\r\n };\r\n\r\n let (mut low, mut high) = (0, a[n - 1] - a[0]);\r\n while low < high {\r\n let mid = (high - low)\/2 + low;\r\n if check(mid) {\r\n high = mid;\r\n } else {\r\n low = mid + 1;\r\n }\r\n }\r\n\r\n println!(\"{}\", high);\r\n}\r\n\r\n\r\nmod io {\r\n use std::cell::RefCell;\r\n use std::io::*;\r\n\r\n std::thread_local! {\r\n pub static STDIN: RefCell = RefCell::new(stdin());\r\n pub static STDOUT: RefCell> = RefCell::new(BufWriter::new(stdout()));\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! input {\r\n () => {};\r\n (mut $var:ident: $t:tt, $($rest:tt)*) => {\r\n let mut $var = __input_inner!($t);\r\n input!($($rest)*)\r\n };\r\n ($var:ident: $t:tt, $($rest:tt)*) => {\r\n let $var = __input_inner!($t);\r\n input!($($rest)*)\r\n };\r\n (mut $var:ident: $t:tt) => {\r\n let mut $var = __input_inner!($t);\r\n };\r\n ($var:ident: $t:tt) => {\r\n let $var = __input_inner!($t);\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! __input_inner {\r\n (($($t:tt),*)) => {\r\n ($(__input_inner!($t)),*)\r\n };\r\n ([$t:tt; $n:expr]) => {\r\n (0..$n).map(|_| __input_inner!($t)).collect::>()\r\n };\r\n ([$t:tt]) => {{\r\n let n = __input_inner!(usize);\r\n (0..n).map(|_| __input_inner!($t)).collect::>()\r\n }};\r\n (chars) => {\r\n __input_inner!(String).chars().collect::>()\r\n };\r\n (bytes) => {\r\n __input_inner!(String).into_bytes()\r\n };\r\n (usize1) => {\r\n __input_inner!(usize) - 1\r\n };\r\n ($t:ty) => {\r\n $crate::io::STDIN.with(|r| {\r\n use std::io::BufRead;\r\n let r = r.borrow_mut();\r\n let mut r = r.lock();\r\n let mut s = vec![];\r\n loop {\r\n let buf = r.fill_buf().unwrap();\r\n if buf.is_empty() {\r\n break;\r\n }\r\n if let Some(i) = buf.iter().position(u8::is_ascii_whitespace) {\r\n s.extend_from_slice(&buf[..i]);\r\n r.consume(i + 1);\r\n if !s.is_empty() {\r\n break;\r\n }\r\n } else {\r\n s.extend_from_slice(buf);\r\n let n = buf.len();\r\n r.consume(n);\r\n }\r\n }\r\n std::str::from_utf8(&s).unwrap().parse::<$t>().unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! println {\r\n () => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::writeln!(w.borrow_mut()).unwrap()\r\n })\r\n };\r\n ($($arg:tt)*) => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::writeln!(w.borrow_mut(), $($arg)*).unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! print {\r\n ($($arg:tt)*) => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n std::write!(w.borrow_mut(), $($arg)*).unwrap()\r\n })\r\n };\r\n }\r\n\r\n #[macro_export]\r\n macro_rules! flush {\r\n () => {\r\n $crate::io::STDOUT.with(|w| {\r\n use std::io::Write;\r\n w.borrow_mut().flush().unwrap()\r\n })\r\n };\r\n }\r\n}","testcases":"[{'input': ['4 5\\r\\n3 1 7 5\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 10\\r\\n100 100 100\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 9\\r\\n4 5 5 7 5 4 5 2 4 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3\\r\\n7 12 8\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['70 3956\\r\\n246 495 357 259 209 422 399 443 252 537 524 299 538 234 247 558 527 529 153 366 453 415 476 410 144 472 346 125 299 321 363 334 297 316 346 309 497 281 163 396 482 254 447 318 316 444 308 332 508 505 328 287 450 557 265 199 298 240 258 232 424 229 292 196 150 281 321 234 443 282\\r\\n'], 'output': ['92\\r\\n']}, {'input': ['13 279\\r\\n596 386 355 440 413 636 408 468 415 462 496 589 530\\r\\n'], 'output': ['131\\r\\n']}, {'input': ['11 64\\r\\n25 24 31 35 29 17 56 28 24 56 54\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['20 76\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 100000000000000\\r\\n1000000000 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 70\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 60\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['20 80\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 90\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 40\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100 1\\r\\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 67 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100 1\\r\\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 65 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 11\\r\\n2 3 1 3 3 1 2 2 2 1 2 3 3 1 1 2 1 1 3 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['40 1857\\r\\n95 1 69 16 94 2 23 43 26 51 4 68 58 17 14 40 55 95 81 78 32 20 56 48 8 88 68 77 67 14 29 63 27 99 81 75 73 66 80 50\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100 1186\\r\\n619 240 80 547 446 128 43 285 725 220 56 690 770 431 777 5 41 549 405 203 2 477 919 481 453 787 680 326 318 241 942 497 504 324 598 925 346 628 851 38 355 493 748 685 901 63 698 676 154 162 313 964 455 617 381 41 479 746 83 253 164 907 950 918 264 307 980 743 257 322 845 419 559 496 434 759 584 959 439 881 257 478 773 609 781 906 687 275 506 651 585 11 74 820 713 925 892 487 409 861\\r\\n'], 'output': ['790\\r\\n']}, {'input': ['5 1\\r\\n6 4 6 7 7\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 12\\r\\n10 1 2 13 12\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['94 1628\\r\\n585 430 515 566 398 459 345 349 572 335 457 397 435 489 421 500 525 600 429 503 353 373 481 552 469 563 494 380 408 510 393 586 484 544 481 359 424 381 569 418 515 507 348 536 559 413 578 544 565 359 435 600 459 475 340 419 599 392 528 486 344 449 449 437 471 397 608 424 508 364 603 553 447 416 414 602 514 496 488 559 552 348 392 470 468 619 422 399 618 331 595 542 354 405\\r\\n'], 'output': ['143\\r\\n']}, {'input': ['7 424\\r\\n429 186 210 425 390 290 425\\r\\n'], 'output': ['57\\r\\n']}, {'input': ['17 148\\r\\n32 38 66 52 64 65 30 34 58 30 54 66 54 55 43 66 45\\r\\n'], 'output': ['6\\r\\n']}]","id":549} {"difficulty":1800,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"1267_L","execute_outcome":"WRONG_ANSWER","source_code":"#[allow(unused_imports)]\r\nuse std::cmp::*;\r\n#[allow(unused_imports)]\r\nuse std::collections::*;\r\n#[allow(unused_imports)]\r\nuse std::io;\r\n#[allow(unused_imports)]\r\nuse std::iter::*;\r\n#[allow(unused_imports)]\r\nuse std::mem::*;\r\n#[allow(unused_imports)]\r\nuse std::str::*;\r\n#[allow(unused_imports)]\r\nuse std::usize;\r\n\r\n\/\/ vec with some initial value\r\n#[allow(unused_macros)]\r\nmacro_rules! vvec {\r\n ($($x:expr),+; $y:expr; $n:expr) => {{\r\n let mut v = vec![$y; $n];\r\n\r\n let mut it = v.iter_mut();\r\n $(\r\n *it.next().unwrap() = $x;\r\n )+\r\n\r\n v\r\n }}\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! it {\r\n ($x:expr) => {\r\n once($x)\r\n };\r\n ($first:expr,$($x:expr),+) => {\r\n once($first).chain(\r\n it!($($x),+)\r\n )\r\n }\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! pushed {\r\n ($c:expr, $x:expr) => {{\r\n let mut c = $c;\r\n c.push($x);\r\n c\r\n }};\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! inserted {\r\n ($c:expr, $($x:expr),*) => {{\r\n let mut c = $c;\r\n c.insert($($x),*);\r\n c\r\n }};\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! read_tuple {\r\n ($($t:ty),+) => {{\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n\r\n let mut it = line.trim()\r\n .split_whitespace();\r\n\r\n ($(\r\n it.next().unwrap().parse::<$t>().ok().unwrap()\r\n ),+)\r\n }}\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read() -> T {\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n line.trim().to_string().parse().ok().unwrap()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_str() -> Vec {\r\n read::().chars().collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_row() -> Vec {\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n\r\n line.trim()\r\n .split_whitespace()\r\n .map(|s| s.parse().ok().unwrap())\r\n .collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_col(n: usize) -> Vec {\r\n (0..n).map(|_| read()).collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_mat(n: usize) -> Vec> {\r\n (0..n).map(|_| read_row()).collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_vec R>(n: usize, mut f: F) -> Vec {\r\n (0..n).map(|_| f()).collect()\r\n}\r\n\r\ntrait IterCopyExt<'a, T>: IntoIterator + Sized\r\nwhere\r\n T: 'a + Copy,\r\n{\r\n fn citer(self) -> std::iter::Copied {\r\n self.into_iter().copied()\r\n }\r\n}\r\n\r\nimpl<'a, T, I> IterCopyExt<'a, T> for I\r\nwhere\r\n I: IntoIterator,\r\n T: 'a + Copy,\r\n{\r\n}\r\n\r\ntrait IteratorExt: Iterator + Sized {\r\n fn sorted(self) -> as IntoIterator>::IntoIter\r\n where\r\n Self::Item: std::cmp::Ord,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort();\r\n v.into_iter()\r\n }\r\n\r\n fn sorted_by(self, f: F) -> as IntoIterator>::IntoIter\r\n where\r\n F: FnMut(&Self::Item, &Self::Item) -> std::cmp::Ordering,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort_by(f);\r\n v.into_iter()\r\n }\r\n\r\n fn sorted_by_key(self, f: F) -> as IntoIterator>::IntoIter\r\n where\r\n F: FnMut(&Self::Item) -> K,\r\n K: std::cmp::Ord,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort_by_key(f);\r\n v.into_iter()\r\n }\r\n\r\n fn join(self, delim: &str) -> String\r\n where\r\n Self::Item: ToString,\r\n {\r\n self.enumerate().fold(String::new(), |s, (i, t)| {\r\n if i == 0 {\r\n s + &t.to_string()\r\n } else {\r\n s + delim + &t.to_string()\r\n }\r\n })\r\n }\r\n}\r\n\r\nimpl IteratorExt for I where I: Iterator {}\r\n\r\nfn main() {\r\n const M: usize = 'z' as usize - 'a' as usize + 1;\r\n\r\n let (n, l, k) = read_tuple!(usize, usize, usize);\r\n let s = read_str();\r\n let nums = s.citer().fold(vec![0; M], |mut nums, c| {\r\n nums[c as usize - 'a' as usize] += 1;\r\n nums\r\n });\r\n\r\n let (words, ..) = nums.citer().enumerate().fold(\r\n (vec![vec![]; n], 0, 0, 0),\r\n |(mut words, i, st, j), (c, m)| {\r\n let (mut mm, i1, st1) = (i..l)\r\n .flat_map(|ii| (st..k).map(move |p| (ii, p)))\r\n .take(m)\r\n .fold((m, l, 0), |(mm, _, _), (ii, p)| {\r\n words[p].push((c + 'a' as usize) as u8 as char);\r\n\r\n (\r\n mm - 1,\r\n ii + (p + 1 - st) \/ (k - st),\r\n (p + 1 - st) % (k - st) + st,\r\n )\r\n });\r\n\r\n for jj in j..n {\r\n while words[jj].len() < l {\r\n if mm == 0 {\r\n return (words, i1, st1, jj);\r\n }\r\n\r\n words[jj].push((c + 'a' as usize) as u8 as char);\r\n mm -= 1;\r\n }\r\n }\r\n\r\n return (words, i1, st1, n);\r\n },\r\n );\r\n\r\n use io::{BufWriter, Write};\r\n let stdout = io::stdout();\r\n let mut stdout = BufWriter::new(stdout.lock());\r\n for word in words {\r\n writeln!(stdout, \"{}\", word.citer().join(\"\")).unwrap();\r\n }\r\n}\r\n","description":"Lucy likes letters. She studied the definition of the lexicographical order at school and plays with it.At first, she tried to construct the lexicographically smallest word out of given letters. It was so easy! Then she tried to build multiple words and minimize one of them. This was much harder!Formally, Lucy wants to make $$$n$$$ words of length $$$l$$$ each out of the given $$$n \\cdot l$$$ letters, so that the $$$k$$$-th of them in the lexicographic order is lexicographically as small as possible.","input_specification":"The first line contains three integers $$$n$$$, $$$l$$$, and $$$k$$$ ($$$1\\\\le k \\\\le n \\\\le 1\\\\,000$$$; $$$1 \\\\le l \\\\le 1\\\\,000$$$)\u00a0\u2014 the total number of words, the length of each word, and the index of the word Lucy wants to minimize.\nThe next line contains a string of $$$n \\\\cdot l$$$ lowercase letters of the English alphabet.\n","output_specification":"Output $$$n$$$ words of $$$l$$$ letters each, one per line, using the letters from the input. Words must be sorted in the lexicographic order, and the $$$k$$$-th of them must be lexicographically as small as possible. If there are multiple answers with the smallest $$$k$$$-th word, output any of them.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"#[allow(unused_imports)]\r\nuse std::cmp::*;\r\n#[allow(unused_imports)]\r\nuse std::collections::*;\r\n#[allow(unused_imports)]\r\nuse std::io;\r\n#[allow(unused_imports)]\r\nuse std::iter::*;\r\n#[allow(unused_imports)]\r\nuse std::mem::*;\r\n#[allow(unused_imports)]\r\nuse std::str::*;\r\n#[allow(unused_imports)]\r\nuse std::usize;\r\n\r\n\/\/ vec with some initial value\r\n#[allow(unused_macros)]\r\nmacro_rules! vvec {\r\n ($($x:expr),+; $y:expr; $n:expr) => {{\r\n let mut v = vec![$y; $n];\r\n\r\n let mut it = v.iter_mut();\r\n $(\r\n *it.next().unwrap() = $x;\r\n )+\r\n\r\n v\r\n }}\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! it {\r\n ($x:expr) => {\r\n once($x)\r\n };\r\n ($first:expr,$($x:expr),+) => {\r\n once($first).chain(\r\n it!($($x),+)\r\n )\r\n }\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! pushed {\r\n ($c:expr, $x:expr) => {{\r\n let mut c = $c;\r\n c.push($x);\r\n c\r\n }};\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! inserted {\r\n ($c:expr, $($x:expr),*) => {{\r\n let mut c = $c;\r\n c.insert($($x),*);\r\n c\r\n }};\r\n}\r\n\r\n#[allow(unused_macros)]\r\nmacro_rules! read_tuple {\r\n ($($t:ty),+) => {{\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n\r\n let mut it = line.trim()\r\n .split_whitespace();\r\n\r\n ($(\r\n it.next().unwrap().parse::<$t>().ok().unwrap()\r\n ),+)\r\n }}\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read() -> T {\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n line.trim().to_string().parse().ok().unwrap()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_str() -> Vec {\r\n read::().chars().collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_row() -> Vec {\r\n let mut line = String::new();\r\n io::stdin().read_line(&mut line).unwrap();\r\n\r\n line.trim()\r\n .split_whitespace()\r\n .map(|s| s.parse().ok().unwrap())\r\n .collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_col(n: usize) -> Vec {\r\n (0..n).map(|_| read()).collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_mat(n: usize) -> Vec> {\r\n (0..n).map(|_| read_row()).collect()\r\n}\r\n\r\n#[allow(dead_code)]\r\nfn read_vec R>(n: usize, mut f: F) -> Vec {\r\n (0..n).map(|_| f()).collect()\r\n}\r\n\r\ntrait IterCopyExt<'a, T>: IntoIterator + Sized\r\nwhere\r\n T: 'a + Copy,\r\n{\r\n fn citer(self) -> std::iter::Copied {\r\n self.into_iter().copied()\r\n }\r\n}\r\n\r\nimpl<'a, T, I> IterCopyExt<'a, T> for I\r\nwhere\r\n I: IntoIterator,\r\n T: 'a + Copy,\r\n{\r\n}\r\n\r\ntrait IteratorExt: Iterator + Sized {\r\n fn sorted(self) -> as IntoIterator>::IntoIter\r\n where\r\n Self::Item: std::cmp::Ord,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort();\r\n v.into_iter()\r\n }\r\n\r\n fn sorted_by(self, f: F) -> as IntoIterator>::IntoIter\r\n where\r\n F: FnMut(&Self::Item, &Self::Item) -> std::cmp::Ordering,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort_by(f);\r\n v.into_iter()\r\n }\r\n\r\n fn sorted_by_key(self, f: F) -> as IntoIterator>::IntoIter\r\n where\r\n F: FnMut(&Self::Item) -> K,\r\n K: std::cmp::Ord,\r\n {\r\n let mut v = self.collect::>();\r\n v.sort_by_key(f);\r\n v.into_iter()\r\n }\r\n\r\n fn join(self, delim: &str) -> String\r\n where\r\n Self::Item: ToString,\r\n {\r\n self.enumerate().fold(String::new(), |s, (i, t)| {\r\n if i == 0 {\r\n s + &t.to_string()\r\n } else {\r\n s + delim + &t.to_string()\r\n }\r\n })\r\n }\r\n}\r\n\r\nimpl IteratorExt for I where I: Iterator {}\r\n\r\nfn main() {\r\n const M: usize = 'z' as usize - 'a' as usize + 1;\r\n\r\n let (n, l, k) = read_tuple!(usize, usize, usize);\r\n let s = read_str();\r\n let nums = s.citer().fold(vec![0; M], |mut nums, c| {\r\n nums[c as usize - 'a' as usize] += 1;\r\n nums\r\n });\r\n\r\n let (words, ..) = nums.citer().enumerate().fold(\r\n (vec![vec![]; n], 0, 0, 0),\r\n |(mut words, i, st, j), (c, m)| {\r\n let (mut mm, i1, st1) = (i..l)\r\n .flat_map(|ii| (st..k).map(move |p| (ii, p)))\r\n .take(m)\r\n .fold((m, i, st), |(mm, _, _), (ii, p)| {\r\n words[p].push((c + 'a' as usize) as u8 as char);\r\n\r\n (\r\n mm - 1,\r\n ii + (p + 1 - st) \/ (k - st),\r\n (p + 1 - st) % (k - st) + st,\r\n )\r\n });\r\n\r\n for jj in j..n {\r\n while words[jj].len() < l {\r\n if mm == 0 {\r\n return (words, i1, st1, jj);\r\n }\r\n\r\n words[jj].push((c + 'a' as usize) as u8 as char);\r\n mm -= 1;\r\n }\r\n }\r\n\r\n return (words, i1, st1, n);\r\n },\r\n );\r\n\r\n use io::{BufWriter, Write};\r\n let stdout = io::stdout();\r\n let mut stdout = BufWriter::new(stdout.lock());\r\n for word in words {\r\n writeln!(stdout, \"{}\", word.citer().join(\"\")).unwrap();\r\n }\r\n}\r\n","testcases":"[{'input': ['3 2 2\\r\\nabcdef\\r\\n'], 'output': ['ad\\r\\nbc\\r\\nef\\r\\n']}, {'input': ['2 3 1\\r\\nabcabc\\r\\n'], 'output': ['aab\\r\\nbcc\\r\\n']}, {'input': ['1 1 1\\r\\nd\\r\\n'], 'output': ['d\\r\\n']}, {'input': ['2 1 2\\r\\nxx\\r\\n'], 'output': ['x\\r\\nx\\r\\n']}, {'input': ['10 1 4\\r\\nmmmmmmmmmm\\r\\n'], 'output': ['m\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\n']}, {'input': ['2 3 2\\r\\nbbcadc\\r\\n'], 'output': ['acd\\r\\nbbc\\r\\n']}, {'input': ['5 5 5\\r\\nuuuuuyyyyybbbbbqqqqqkkkkk\\r\\n'], 'output': ['bkquy\\r\\nbkquy\\r\\nbkquy\\r\\nbkquy\\r\\nbkquy\\r\\n']}, {'input': ['1 1 1\\r\\nz\\r\\n'], 'output': ['z\\r\\n']}, {'input': ['1 1 1\\r\\nv\\r\\n'], 'output': ['v\\r\\n']}, {'input': ['1 1 1\\r\\nb\\r\\n'], 'output': ['b\\r\\n']}, {'input': ['1 1 1\\r\\nn\\r\\n'], 'output': ['n\\r\\n']}, {'input': ['1 9 1\\r\\nddddddddd\\r\\n'], 'output': ['ddddddddd\\r\\n']}, {'input': ['1 9 1\\r\\notoeuhojt\\r\\n'], 'output': ['ehjooottu\\r\\n']}, {'input': ['1 9 1\\r\\nwmdjwkpwf\\r\\n'], 'output': ['dfjkmpwww\\r\\n']}, {'input': ['1 10 1\\r\\nlduuukmwxx\\r\\n'], 'output': ['dklmuuuwxx\\r\\n']}, {'input': ['1 97 1\\r\\neeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\\r\\n'], 'output': ['eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\\r\\n']}, {'input': ['1 98 1\\r\\nddzzdzzddzzzzzzdzdzzdzzzzddddzzdzddddddzzddddzdzzzdzdzddzddzdzdzdzzzzdzdzddzzzzdzzzzddzzdzzdzdddzz\\r\\n'], 'output': ['dddddddddddddddddddddddddddddddddddddddddddddzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n']}, {'input': ['1 91 1\\r\\nyvphaxbrxwquqqstaislmlxjcshnhigbrbooagoirplbflfaiwkptchamaoxgvemqbprdbbzupgiivvssuuynqqtltf\\r\\n'], 'output': ['aaaaaabbbbbbbccdefffgggghhhhiiiiiijklllllmmmnnoooopppppqqqqqqrrrrsssssttttuuuuvvvvwwxxxxyyz\\r\\n']}, {'input': ['1 95 1\\r\\ntnyebggqacotqgitzqfhysnhlyuguqjdxnvttaeswgkfspvdftmqvaipklqqnttyqloqyeyzhvoiigiubceckggiidyhwuo\\r\\n'], 'output': ['aaabbcccdddeeeefffgggggggghhhhiiiiiiijkkklllmnnnnooooppqqqqqqqqqsssttttttttuuuuvvvvwwxyyyyyyyzz\\r\\n']}, {'input': ['9 1 9\\r\\neeeeeeeee\\r\\n'], 'output': ['e\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\n']}, {'input': ['10 1 3\\r\\navdtkzddkk\\r\\n'], 'output': ['a\\r\\nd\\r\\nd\\r\\nd\\r\\nk\\r\\nk\\r\\nk\\r\\nt\\r\\nv\\r\\nz\\r\\n']}, {'input': ['9 1 9\\r\\nkvmjkblhz\\r\\n'], 'output': ['b\\r\\nh\\r\\nj\\r\\nk\\r\\nk\\r\\nl\\r\\nm\\r\\nv\\r\\nz\\r\\n']}, {'input': ['10 1 10\\r\\nuucmshkhlo\\r\\n'], 'output': ['c\\r\\nh\\r\\nh\\r\\nk\\r\\nl\\r\\nm\\r\\no\\r\\ns\\r\\nu\\r\\nu\\r\\n']}, {'input': ['9 10 9\\r\\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n'], 'output': ['bbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\nbbbbbbbbbb\\r\\n']}, {'input': ['9 10 5\\r\\nafdfhplzplgrnrgzpzplbdhnulrxplafgpgbzlablzhxuhblczlpgbczrbxcnrfgfxcbflrpdnlgfruzrczgzrgpbc\\r\\n'], 'output': ['afffffgggg\\r\\naggggghhhh\\r\\nalllllllll\\r\\nbbbbcccddl\\r\\nbbbbcccdff\\r\\nlnnnnppppp\\r\\npppprrrrrr\\r\\nrrruuuxxxx\\r\\nzzzzzzzzzz\\r\\n']}, {'input': ['10 9 2\\r\\nskpjgpwrqajrdnynybnsmybttmhkboiqlndqtghvqyorholdzwasytnvteawhahjfhjknhfobiifrtfrlbjkqyxgnc\\r\\n'], 'output': ['aabbbffff\\r\\naabbcddde\\r\\nggghhhhhh\\r\\nhiiijjjjj\\r\\nkkkklllmm\\r\\nnnnnnnnoo\\r\\nooppqqqqq\\r\\nrrrrrssst\\r\\ntttttvvww\\r\\nwxyyyyyyz\\r\\n']}, {'input': ['10 10 10\\r\\nhckmixocxnktmrsaiopejoifwiwskqktgljlgobztnpvlzfuxotiaquusgdbpzufrkxdejcznsjfyctfucwzkbzluyyelrohoacz\\r\\n'], 'output': ['aghhiiiiij\\r\\najjjkkkkkk\\r\\nalllllmmnn\\r\\nbnooooooop\\r\\nbppqqrrrss\\r\\nbsstttttuu\\r\\nccuuuuvwww\\r\\nccxxxxyyyz\\r\\ncdeezzzzzz\\r\\ncdefffffgg\\r\\n']}, {'input': ['92 1 71\\r\\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\r\\n'], 'output': ['x\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\n']}, {'input': ['94 1 27\\r\\nrxzjinajagadtnzsvnptwolcrfovnafwrrlxidrsppkgwfmwwwapjmvkddfobpwvtnvzgxmzkbhfxhjnjoisdxcrzdslkb\\r\\n'], 'output': ['a\\r\\na\\r\\na\\r\\na\\r\\na\\r\\nb\\r\\nb\\r\\nb\\r\\nc\\r\\nc\\r\\nd\\r\\nd\\r\\nd\\r\\nd\\r\\nd\\r\\nd\\r\\nf\\r\\nf\\r\\nf\\r\\nf\\r\\nf\\r\\ng\\r\\ng\\r\\ng\\r\\nh\\r\\nh\\r\\ni\\r\\ni\\r\\ni\\r\\nj\\r\\nj\\r\\nj\\r\\nj\\r\\nj\\r\\nk\\r\\nk\\r\\nk\\r\\nk\\r\\nl\\r\\nl\\r\\nl\\r\\nm\\r\\nm\\r\\nm\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\no\\r\\no\\r\\no\\r\\no\\r\\np\\r\\np\\r\\np\\r\\np\\r\\np\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\ns\\r\\ns\\r\\ns\\r\\ns\\r\\nt\\r\\nt\\r\\nt\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nw\\r\\nw\\r\\nw\\r\\nw\\r\\nw\\r\\nw\\r\\nw\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nz\\r\\nz\\r\\nz\\r\\nz\\r\\nz\\r\\n']}, {'input': ['97 1 24\\r\\neilqimmlqrvapwdtsqgpyfeapibnathmuwqajnwrlhzyiqetpcaqrlnjublrttucshnoldszvvmofrbetieobjeejqaygzgjr\\r\\n'], 'output': ['a\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\nb\\r\\nb\\r\\nb\\r\\nb\\r\\nc\\r\\nc\\r\\nd\\r\\nd\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\nf\\r\\nf\\r\\ng\\r\\ng\\r\\ng\\r\\nh\\r\\nh\\r\\nh\\r\\ni\\r\\ni\\r\\ni\\r\\ni\\r\\ni\\r\\nj\\r\\nj\\r\\nj\\r\\nj\\r\\nj\\r\\nl\\r\\nl\\r\\nl\\r\\nl\\r\\nl\\r\\nl\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\no\\r\\no\\r\\no\\r\\np\\r\\np\\r\\np\\r\\np\\r\\nq\\r\\nq\\r\\nq\\r\\nq\\r\\nq\\r\\nq\\r\\nq\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\ns\\r\\ns\\r\\ns\\r\\nt\\r\\nt\\r\\nt\\r\\nt\\r\\nt\\r\\nt\\r\\nu\\r\\nu\\r\\nu\\r\\nv\\r\\nv\\r\\nv\\r\\nw\\r\\nw\\r\\nw\\r\\ny\\r\\ny\\r\\ny\\r\\nz\\r\\nz\\r\\nz\\r\\n']}, {'input': ['100 1 92\\r\\nxwcbimztwcyuckyappbkrddnxgnxqvmobveinzvvnseqxooecwrrdeuwzfzxvfkvguqrsofbbnhfcscxggpxzmruycgqfmnnoovd\\r\\n'], 'output': ['a\\r\\nb\\r\\nb\\r\\nb\\r\\nb\\r\\nb\\r\\nc\\r\\nc\\r\\nc\\r\\nc\\r\\nc\\r\\nc\\r\\nc\\r\\nd\\r\\nd\\r\\nd\\r\\nd\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\nf\\r\\nf\\r\\nf\\r\\nf\\r\\nf\\r\\ng\\r\\ng\\r\\ng\\r\\ng\\r\\ng\\r\\nh\\r\\ni\\r\\ni\\r\\nk\\r\\nk\\r\\nk\\r\\nm\\r\\nm\\r\\nm\\r\\nm\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\nn\\r\\no\\r\\no\\r\\no\\r\\no\\r\\no\\r\\no\\r\\np\\r\\np\\r\\np\\r\\nq\\r\\nq\\r\\nq\\r\\nq\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\nr\\r\\ns\\r\\ns\\r\\ns\\r\\nt\\r\\nu\\r\\nu\\r\\nu\\r\\nu\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nv\\r\\nw\\r\\nw\\r\\nw\\r\\nw\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\nx\\r\\ny\\r\\ny\\r\\ny\\r\\nz\\r\\nz\\r\\nz\\r\\nz\\r\\nz\\r\\n']}]","id":550} {"difficulty":1800,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"1283_E","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(dead_code)]\n#![allow(unused)]\n\/\/ mod tree;\n\/\/ mod dsu;\n\/\/ mod binary_lifting;\n\n\nuse std::{env, fs, io, iter, mem, ops, ptr, thread, time, usize};\nuse std::borrow::{Borrow, BorrowMut};\nuse std::cell::{Cell, Ref, RefCell, RefMut, UnsafeCell};\n\nuse std::fmt::format;\nuse std::fs::read;\nuse std::hash::{Hash, Hasher};\nuse std::io::{BufWriter, stdin, stdout, StdoutLock, Write};\nuse std::mem::{ManuallyDrop, MaybeUninit};\nuse std::ops::Bound::Included;\nuse std::process::{id, Output};\nuse std::rc::{Rc, Weak};\nuse std::slice::Iter;\nuse std::str::FromStr;\n\n\nconst P: u64 = 342325337;\n\nfn scan() -> T\n{\n static mut BUFFER: Vec = vec![];\n loop {\n if let Some(token) = unsafe { BUFFER.pop() } {\n return token.parse().ok().unwrap();\n }\n let mut input = String::new();\n std::io::stdin().read_line(&mut input).ok();\n unsafe { BUFFER = input.split_whitespace().rev().map(String::from).collect(); }\n }\n}\n\n\/\/ fn solve(w: &mut W) {\n\/\/\n\/\/ }\n\/\/ fn main() {\n\/\/\n\/\/ let stdout = io::stdout();\n\/\/ let mut writer = io::BufWriter::new(stdout.lock());\n\/\/ let mut n: usize = 1;\n\/\/ if multi {\n\/\/ n = scan();\n\/\/ }\n\/\/ for _ in 0..n {\n\/\/ solve(&mut writer);\n\/\/ }\n\/\/ }\n\nstruct Solution {\n\n}\n\n#[derive(PartialEq, Eq, Clone, Debug)]\npub struct ListNode {\n pub val: i32,\n pub next: Option>\n}\n\nimpl ListNode {\n #[inline]\n fn new(val: i32) -> Self {\n ListNode {\n next: None,\n val\n }\n }\n}\n\n\n\/\/ Definition for a binary tree node.\n#[derive(Debug, PartialEq, Eq)]\npub struct TreeNode {\n pub val: i32,\n pub left: Option>>,\n pub right: Option>>,\n}\n\nimpl TreeNode {\n #[inline]\n pub fn new(val: i32) -> Self {\n TreeNode {\n val,\n left: None,\n right: None\n }\n }\n}\n\n\nconst MULTI: bool = false;\n\nuse std::collections::{BinaryHeap, BTreeMap, BTreeSet, HashMap, HashSet, LinkedList, VecDeque};\nuse std::cmp::{max, min, Ordering, Reverse};\nuse std::time::UNIX_EPOCH;\n\n\n\nfn solve(w: &mut W) {\n let n: usize = scan();\n let mut x: Vec = vec![];\n for i in 0..n {\n x.push(scan());\n }\n x.sort();\n\n let mut ans_min = 1;\n let mut ans_max = 1;\n\n let mut min_set = HashSet::new();\n for i in 0..n {\n if x[i] == x[n - 1] {\n if !min_set.contains(&x[i]) && !min_set.contains(&(x[i] - 1)) {\n min_set.insert(x[i]);\n }\n } else {\n if !min_set.contains(&x[i]) && !min_set.contains(&(x[i] + 1)) {\n min_set.insert(x[i] + 1);\n }\n }\n }\n\n let mut max_set = HashSet::new();\n for i in 0..n {\n if !max_set.contains(&(x[i] - 1)) {\n max_set.insert(x[i] - 1);\n continue;\n }\n if !max_set.contains(&x[i]) {\n max_set.insert(x[i]);\n continue;\n }\n if !max_set.contains(&(x[i] + 1)) {\n max_set.insert(x[i] + 1);\n continue;\n }\n }\n\n writeln!(w, \"{} {}\", min_set.len(), max_set.len());\n}\n\nfn main() {\n\n let stdout = io::stdout();\n let mut writer = io::BufWriter::new(stdout.lock());\n let mut n: usize = 1;\n if MULTI {\n n = scan();\n }\n for _ in 0..n {\n solve(&mut writer);\n }\n}\n\n\n\n\/*\n\n\n *\/\n","description":"Oh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year...$$$n$$$ friends live in a city which can be represented as a number line. The $$$i$$$-th friend lives in a house with an integer coordinate $$$x_i$$$. The $$$i$$$-th friend can come celebrate the New Year to the house with coordinate $$$x_i-1$$$, $$$x_i+1$$$ or stay at $$$x_i$$$. Each friend is allowed to move no more than once.For all friends $$$1 \\le x_i \\le n$$$ holds, however, they can come to houses with coordinates $$$0$$$ and $$$n+1$$$ (if their houses are at $$$1$$$ or $$$n$$$, respectively).For example, let the initial positions be $$$x = [1, 2, 4, 4]$$$. The final ones then can be $$$[1, 3, 3, 4]$$$, $$$[0, 2, 3, 3]$$$, $$$[2, 2, 5, 5]$$$, $$$[2, 1, 3, 5]$$$ and so on. The number of occupied houses is the number of distinct positions among the final ones.So all friends choose the moves they want to perform. After that the number of occupied houses is calculated. What is the minimum and the maximum number of occupied houses can there be?","input_specification":"The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) \u2014 the number of friends.\nThe second line contains $$$n$$$ integers $$$x_1, x_2, \\dots, x_n$$$ ($$$1 \\le x_i \\le n$$$) \u2014 the coordinates of the houses of the friends.\n","output_specification":"Print two integers \u2014 the minimum and the maximum possible number of occupied houses after all moves are performed.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"struct Scanner {\n reader: R,\n line: Vec,\n ptr: usize\n\n}\n\nimpl Scanner {\n fn new(reader: R) -> Self {\n return Self {reader, line: vec![], ptr: 0};\n }\n\n fn scan(&mut self) -> T {\n loop {\n while self.ptr < self.line.len() && self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n if self.ptr != self.line.len() {\n let start = self.ptr;\n while self.ptr < self.line.len() && !self.line[self.ptr].is_ascii_whitespace() {\n self.ptr += 1;\n }\n return std::str::from_utf8(&self.line[start..self.ptr]).unwrap().parse().ok().\n expect(\"parse error\");\n }\n self.line.clear();\n self.reader.read_until(b'\\n', &mut self.line).expect(\"read error\");\n self.ptr = 0;\n }\n }\n\n}\n\nfn solve_min(counts: &Vec) -> usize {\n let mut result = 0;\n let mut ptr = 0;\n while ptr < counts.len() {\n if counts[ptr] == 0 {\n ptr += 1;\n continue;\n }\n ptr += 3;\n result += 1;\n }\n return result;\n}\n\nfn solve_max(mut counts: Vec) -> usize {\n let mut result = 0;\n for i in 0..counts.len() {\n if let Some(v) = counts.get_mut(i.wrapping_sub(1)) {\n if *v != 0 {\n *v -= 1;\n result += 1;\n continue;\n }\n }\n if counts[i] != 0 {\n counts[i] -= 1;\n result += 1;\n continue;\n }\n if let Some(v) = counts.get_mut(i + 1) {\n if *v != 0 {\n *v -= 1;\n result += 1;\n continue;\n }\n }\n }\n return result;\n}\n\nfn solve(scanner: &mut Scanner, writer: &mut W) {\n let n: usize = scanner.scan();\n let x: Vec = (0..n).map(|_| scanner.scan()).collect();\n let mut counts: Vec = vec![0; n + 2];\n for &x in &x {\n counts[x] += 1;\n }\n let min = solve_min(&counts);\n let max = solve_max(counts);\n writeln!(writer, \"{} {}\", min, max).unwrap();\n}\n\nfn main() {\n let (stdin, stdout) = (std::io::stdin(), std::io::stdout());\n let mut writer = std::io::BufWriter::new(stdout.lock());\n let mut scanner = Scanner::new(stdin.lock());\n let tests: usize = 1;\n for _ in 0..tests {\n solve(&mut scanner, &mut writer);\n }\n}\n","testcases":"[{'input': ['4\\r\\n1 2 4 4\\r\\n'], 'output': ['2 4\\r\\n']}, {'input': ['9\\r\\n1 1 8 8 8 4 4 4 4\\r\\n'], 'output': ['3 8\\r\\n']}, {'input': ['7\\r\\n4 3 7 1 4 3 3\\r\\n'], 'output': ['3 6\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['9\\r\\n9 5 7 9 6 4 6 4 8\\r\\n'], 'output': ['2 8\\r\\n']}, {'input': ['10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['4 10\\r\\n']}, {'input': ['10\\r\\n6 6 6 6 6 6 6 6 6 6\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['10\\r\\n10 7 10 10 7 10 7 7 10 10\\r\\n'], 'output': ['2 6\\r\\n']}, {'input': ['10\\r\\n6 8 9 6 5 9 4 8 8 6\\r\\n'], 'output': ['2 8\\r\\n']}, {'input': ['10\\r\\n8 8 1 1 1 2 7 7 8 4\\r\\n'], 'output': ['3 9\\r\\n']}]","id":551} {"difficulty":1700,"lang":"Rust","lang_cluster":"Rust","src_uid":"183_A","execute_outcome":"RUNTIME_ERROR","source_code":"\n\nuse std::collections::HashSet;\nuse std::io::{self, BufRead};\n\nfn main() {\n let stdin = io::stdin();\n let mut lines = stdin.lock().lines().map(|x| x.unwrap());\n let n: usize = lines.next().unwrap().parse().unwrap();\n \n let mut possible_moves: Vec = Vec::new();\n for _ in 0..n {\n possible_moves.push(lines.next().unwrap());\n }\n \n let mut possible_positions: HashSet<(i32, i32)> = HashSet::new();\n possible_positions.insert((0, 0));\n \n for moves in possible_moves {\n let mut new_positions: HashSet<(i32, i32)> = HashSet::new();\n for position in possible_positions {\n let (x, y) = position;\n match moves.as_str() {\n \"UL\" => {\n new_positions.insert((x - 1, y));\n new_positions.insert((x, y + 1));\n }\n \"UR\" => {\n new_positions.insert((x + 1, y));\n new_positions.insert((x, y + 1));\n }\n \"DL\" => {\n new_positions.insert((x - 1, y));\n new_positions.insert((x, y - 1));\n }\n \"DR\" => {\n new_positions.insert((x + 1, y));\n new_positions.insert((x, y - 1));\n }\n \"ULDR\" => {\n new_positions.insert((x - 1, y));\n new_positions.insert((x + 1, y));\n new_positions.insert((x, y + 1));\n new_positions.insert((x, y - 1));\n }\n _ => panic!(\"Invalid movement string\"),\n }\n }\n possible_positions = new_positions;\n }\n \n println!(\"{}\", possible_positions.len());\n}\n","description":"Sensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious \"Pihters\" gang. The law department states that the outlaw was driving from the gang's headquarters in his car when he crashed into an ice cream stall. The stall, the car, and the headquarters each occupies exactly one point on the two-dimensional kingdom.The outlaw's car was equipped with a GPS transmitter. The transmitter showed that the car made exactly n movements on its way from the headquarters to the stall. A movement can move the car from point (x,y) to one of these four points: to point (x-1,y) which we will mark by letter \"L\", to point (x+1,y) \u2014 \"R\", to point (x,y-1) \u2014 \"D\", to point (x,y+1) \u2014 \"U\".The GPS transmitter is very inaccurate and it doesn't preserve the exact sequence of the car's movements. Instead, it keeps records of the car's possible movements. Each record is a string of one of these types: \"UL\", \"UR\", \"DL\", \"DR\" or \"ULDR\". Each such string means that the car made a single movement corresponding to one of the characters of the string. For example, string \"UL\" means that the car moved either \"U\", or \"L\".You've received the journal with the outlaw's possible movements from the headquarters to the stall. The journal records are given in a chronological order. Given that the ice-cream stall is located at point (0,0), your task is to print the number of different points that can contain the gang headquarters (that is, the number of different possible locations of the car's origin).","input_specification":"The first line contains a single integer n (1\u2264n\u22642\u00b710^5) \u2014 the number of the car's movements from the headquarters to the stall.\nEach of the following n lines describes the car's possible movements. It is guaranteed that each possible movement is one of the following strings: \"UL\", \"UR\", \"DL\", \"DR\" or \"ULDR\". \nAll movements are given in chronological order. \nPlease do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin and cout stream or the %I64d specifier.\n","output_specification":"Print a single integer \u2014 the number of different possible locations of the gang's headquarters.\n","notes":"The figure below shows the nine possible positions of the gang headquarters from the first sample: \n \nFor example, the following movements can get the car from point (1,0) to point (0,0): \n \n","sample_inputs":["3\nUR\nUL\nULDR\n","2\nDR\nDL\n"],"sample_outputs":["9\n","4\n"],"human_solution":"\n\nuse std::collections::HashSet;\nuse std::io::{self, BufRead};\n\nfn main() {\n let stdin = io::stdin();\n let mut lines = stdin.lock().lines().map(|x| x.unwrap());\n \n let n: usize = lines.next().unwrap().parse().unwrap();\n \n let mut possible_movements: Vec = Vec::new();\n for _ in 0..n {\n possible_movements.push(lines.next().unwrap());\n }\n \n let mut possible_points: HashSet<(i32, i32)> = HashSet::new();\n possible_points.insert((0, 0));\n \n for movement in possible_movements {\n let mut new_possible_points: HashSet<(i32, i32)> = HashSet::new();\n \n for &(x, y) in &possible_points {\n match &movement[..] {\n \"UL\" => {\n new_possible_points.insert((x - 1, y));\n new_possible_points.insert((x, y + 1));\n }\n \"UR\" => {\n new_possible_points.insert((x + 1, y));\n new_possible_points.insert((x, y + 1));\n }\n \"DL\" => {\n new_possible_points.insert((x - 1, y));\n new_possible_points.insert((x, y - 1));\n }\n \"DR\" => {\n new_possible_points.insert((x + 1, y));\n new_possible_points.insert((x, y - 1));\n }\n \"ULDR\" => {\n new_possible_points.insert((x - 1, y));\n new_possible_points.insert((x + 1, y));\n new_possible_points.insert((x, y - 1));\n new_possible_points.insert((x, y + 1));\n }\n _ => panic!(\"Invalid movement\"),\n }\n }\n \n possible_points = new_possible_points;\n }\n \n println!(\"{}\", possible_points.len());\n}\n\n","testcases":"[{'input': ['3\\r\\nUR\\r\\nUL\\r\\nULDR\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['2\\r\\nDR\\r\\nDL\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4\\r\\nUL\\r\\nUR\\r\\nDR\\r\\nDL\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\nUL\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['6\\r\\nUL\\r\\nDL\\r\\nDL\\r\\nUL\\r\\nUL\\r\\nDL\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1\\r\\nUL\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\nUR\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\nDR\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\nDL\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\nULDR\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2\\r\\nUL\\r\\nULDR\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['4\\r\\nULDR\\r\\nUR\\r\\nULDR\\r\\nUR\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['10\\r\\nUR\\r\\nDR\\r\\nUL\\r\\nDR\\r\\nUL\\r\\nULDR\\r\\nUR\\r\\nUL\\r\\nULDR\\r\\nUL\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['4\\r\\nUL\\r\\nUR\\r\\nDR\\r\\nDL\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10\\r\\nUL\\r\\nUR\\r\\nUR\\r\\nDR\\r\\nDR\\r\\nDR\\r\\nDL\\r\\nDL\\r\\nDL\\r\\nDL\\r\\n'], 'output': ['35\\r\\n']}, {'input': ['6\\r\\nUR\\r\\nDL\\r\\nUR\\r\\nDL\\r\\nUR\\r\\nDL\\r\\n'], 'output': ['7\\r\\n']}]","id":552} {"difficulty":1600,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"28_B","execute_outcome":"WRONG_ANSWER","source_code":"macro_rules! stdin_to {\r\n ($name: ident: &str) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s = remove_linebreak(&s).to_string(); let $name = s; };\r\n ($name: ident: $t: ty) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s = remove_linebreak(&s).to_string(); let $name = s.parse::<$t>().unwrap(); };\r\n}\r\nmacro_rules! stdin_to_vec {\r\n ($name: ident: &str, $spl: tt) => { stdin_to!(line: &str); let $name = line.split($spl).map(|s| s.to_string()).collect::>(); };\r\n ($name: ident: $t: ty, $spl: tt) => { stdin_to!(line: &str); let $name = line.split($spl).map(|s| s.parse::<$t>().unwrap()).collect::>(); };\r\n}\r\nfn remove_linebreak(s: &str) -> &str { s.strip_suffix(\"\\r\\n\").or(s.strip_suffix(\"\\n\")).unwrap_or(s) }\r\n\r\nfn main() {\r\n stdin_to!(n: usize);\r\n}","description":"One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exchange it's value with the value of some other j-th cell, if |i-j|=di, where di is a favourite number of i-th cell. Cells make moves in any order, the number of moves is unlimited.The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to n. You are to determine whether the game could move to this state.","input_specification":"The first line contains positive integer n (1\u2264n\u2264100) \u2014 the number of cells in the array. The second line contains n distinct integers from 1 to n \u2014 permutation. The last line contains n integers from 1 to n \u2014 favourite numbers of the cells.\n","output_specification":"If the given state is reachable in the described game, output YES, otherwise NO.\n","notes":null,"sample_inputs":["5\n5 4 3 2 1\n1 1 1 1 1\n","7\n4 3 5 1 2 7 6\n4 6 6 1 6 6 1\n","7\n4 2 5 1 3 7 6\n4 6 6 1 6 6 1\n"],"sample_outputs":["YES\n","NO\n","YES\n"],"human_solution":"\/\/resubmission to find cause of Runtime Error when reading input\r\n\r\nuse std::collections::HashSet;\r\n\r\nmacro_rules! stdin_to {\r\n ($name: ident: &str) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s = remove_linebreak(&s).to_string(); let $name = s; };\r\n ($name: ident: $t: ty) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s = remove_linebreak(&s).to_string(); let $name = s.parse::<$t>().unwrap(); };\r\n}\r\nmacro_rules! stdin_to_vec {\r\n ($name: ident: &str, $spl: tt) => { stdin_to!(line: &str); let $name = line.split($spl).map(|s| s.to_string()).collect::>(); };\r\n ($name: ident: $t: ty, $spl: tt) => { stdin_to!(line: &str); let $name = line.split($spl).map(|s| s.parse::<$t>().unwrap()).collect::>(); };\r\n}\r\nfn remove_linebreak(s: &str) -> &str { s.strip_suffix(\"\\r\\n\").or(s.strip_suffix(\"\\n\")).unwrap_or(s) }\r\n\r\nfn main() {\r\n\r\n stdin_to!(n: usize);\r\n stdin_to_vec!(perm: i32, \" \");\r\n stdin_to_vec!(favs: i32, \" \");\r\n\r\n\r\n \/\/let n = 7;\r\n \/\/let perm = vec![4, 2, 5, 1, 3, 7, 6];\r\n \/\/let favs = vec![4, 6, 6, 1, 6, 6, 1];\r\n\r\n\r\n let mut arr = (0..n).collect::>();\r\n\r\n for i in 0..n {\r\n let val1 = i as i32 + 1;\r\n for j in i+1..n {\r\n let val2 = j as i32 + 1;\r\n let d = (val1-val2).abs();\r\n if d == favs[i] || d == favs[j] {\r\n \/\/println!(\"join {i} {j}\");\r\n join(i, j, &mut arr);\r\n }\r\n }\r\n }\r\n \/\/println!(\"{arr:?}\");\r\n\r\n if (0..n).all(|i| find(i, &mut arr) == find((perm[i] as i32-1) as usize, &mut arr)) {\r\n println!(\"YES\");\r\n } else {\r\n println!(\"NO\");\r\n }\r\n}\r\nfn join(a: usize, b: usize, arr: &mut Vec) {\r\n let a = find(a, arr);\r\n let b = find(b, arr);\r\n arr[a] = b;\r\n}\r\nfn find(mut x: usize, arr: &mut Vec) -> usize {\r\n while x != arr[x] { arr[x] = arr[arr[x]]; x = arr[x]; }\r\n x\r\n}","testcases":"[{'input': ['5\\r\\n5 4 3 2 1\\r\\n1 1 1 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['7\\r\\n4 3 5 1 2 7 6\\r\\n4 6 6 1 6 6 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n4 2 5 1 3 7 6\\r\\n4 6 6 1 6 6 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6\\r\\n3 2 1 4 6 5\\r\\n3 6 1 6 6 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6\\r\\n3 5 1 4 6 2\\r\\n3 6 1 6 6 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n1 2 3 4\\r\\n1 1 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['71\\r\\n1 63 3 4 5 6 7 8 9 44 29 12 13 14 55 34 42 18 52 20 21 33 23 24 25 26 27 28 19 30 47 32 15 71 37 36 69 38 39 40 41 17 43 10 45 58 35 48 49 11 51 50 53 54 22 56 57 46 59 60 61 62 2 64 65 66 67 68 31 70 16\\r\\n21 45 8 62 56 53 25 22 65 34 39 43 30 63 18 18 25 10 31 64 70 33 49 70 34 21 69 25 21 4 38 41 4 36 4 28 6 48 6 25 57 11 62 48 62 69 12 14 12 70 41 2 49 30 40 37 67 12 13 22 50 35 61 42 33 30 10 47 10 65 37\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['76\\r\\n44 47 38 4 31 6 33 8 50 69 35 26 73 14 74 16 41 9 59 75 46 7 23 52 58 10 17 49 29 64 42 19 12 36 65 34 3 37 39 1 30 76 27 2 22 55 61 48 24 5 54 11 51 28 68 18 57 60 56 71 63 25 15 66 62 32 67 53 43 70 45 72 13 40 20 21\\r\\n54 63 9 55 65 59 4 1 42 31 63 5 28 26 19 35 50 21 39 23 40 64 45 36 74 74 70 67 53 20 19 27 13 2 71 62 6 51 2 65 61 58 55 55 32 75 54 75 48 45 40 45 7 43 72 75 54 9 32 52 8 36 33 59 57 58 68 32 71 21 63 69 7 40 28 68\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['82\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 59 17 18 19 20 21 22 23 24 25 26 27 28 29 61 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 16 60 30 79 63 64 65 66 67 68 69 70 71 72 73 74 75 76 82 78 62 80 81 77\\r\\n8 79 66 53 45 15 70 17 53 28 30 70 14 49 51 43 45 14 27 30 37 51 29 55 6 5 24 6 61 31 64 47 71 60 79 64 28 64 17 38 11 13 3 72 24 70 16 14 30 72 52 33 31 71 32 66 29 45 55 32 48 14 63 60 50 50 61 2 47 26 4 26 72 3 56 19 1 47 17 26 66 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['13\\r\\n13 1 12 4 6 10 7 8 9 3 11 5 2\\r\\n6 12 12 7 11 7 10 3 1 5 2 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5\\r\\n1 3 2 4 5\\r\\n1 4 1 2 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n6 2 9 4 8 7 5 10 3 1\\r\\n2 9 7 9 4 5 1 5 3 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['68\\r\\n1 2 3 46 5 6 7 8 9 63 11 57 13 14 15 16 40 18 19 20 21 22 23 24 25 26 27 28 29 35 31 32 33 34 30 36 37 64 39 17 41 12 43 52 58 4 47 44 49 50 51 48 53 54 55 56 42 59 45 60 61 62 10 38 65 66 67 68\\r\\n13 48 67 55 4 39 47 8 4 35 50 28 28 30 63 60 52 29 2 33 48 57 40 43 25 34 62 50 60 5 3 66 32 15 7 51 51 26 47 23 67 30 27 53 40 42 5 4 60 67 11 4 31 10 62 46 45 13 14 13 24 66 53 25 22 60 14 42\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['52\\r\\n17 35 19 41 21 51 46 45 13 10 15 43 37 30 34 12 39 20 14 48 49 3 23 6 4 26 47 18 16 5 31 36 27 29 24 11 52 38 33 42 1 8 9 32 44 7 28 22 40 50 2 25\\r\\n47 6 50 13 49 22 17 18 3 11 2 43 35 8 25 38 19 41 17 5 7 8 10 51 17 30 34 48 41 8 46 10 11 45 15 28 42 32 37 33 43 31 38 13 43 19 32 19 2 47 42 46\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n5 2 4 31 1 10 44 24 9 38 20 27 35 14 37 46 8 18 41 34 7 22 25 45 32 43 6 47 39 15 26 48 30 23 16 36 17 21 50 40 3 11 12 19 42 29 28 49 33 13\\r\\n27 15 18 20 19 23 49 18 28 32 29 2 16 23 23 2 17 25 27 43 32 31 11 3 49 46 22 44 14 48 35 15 32 35 2 49 10 22 5 36 49 16 43 46 33 11 31 15 45 23\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['60\\r\\n1 2 17 4 27 6 43 26 32 10 11 12 29 14 15 16 3 44 56 20 21 22 53 24 25 8 5 28 58 7 31 9 33 57 48 36 37 38 39 30 41 50 40 35 45 46 13 18 47 55 51 52 23 54 42 19 34 49 59 60\\r\\n59 25 14 52 1 24 36 16 42 8 59 22 41 47 49 33 36 35 37 30 25 6 30 8 50 2 25 3 29 10 52 20 8 45 13 43 53 45 10 33 54 53 47 26 32 4 2 38 33 45 19 4 56 22 13 40 45 45 24 14\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['79\\r\\n1 2 3 67 5 6 7 60 9 71 63 12 31 57 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 64 32 79 34 35 45 37 38 39 40 41 42 43 44 36 46 47 48 11 50 51 52 74 54 55 56 14 58 59 8 61 62 49 13 65 66 4 68 72 70 10 69 73 53 75 76 77 78 33\\r\\n17 46 68 35 48 11 78 40 65 61 52 45 51 66 13 56 53 63 61 43 22 60 13 67 34 16 64 19 11 27 33 8 9 1 68 9 17 62 65 23 50 1 55 20 70 61 65 55 38 47 9 45 55 70 39 31 43 47 40 52 20 5 20 75 25 25 63 2 36 12 60 3 35 21 78 38 39 25 46\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['80\\r\\n39 2 33 16 36 27 65 62 40 17 44 6 13 10 43 31 66 64 63 20 59 72 9 24 12 29 77 47 71 79 50 32 55 4 35 60 7 69 14 54 3 42 15 11 75 22 28 30 49 18 46 56 51 68 5 38 25 58 73 26 61 21 37 80 19 45 53 1 70 67 23 52 41 74 34 76 57 8 48 78\\r\\n6 23 42 42 13 72 14 45 66 76 74 44 49 10 14 64 17 15 4 68 14 34 42 56 50 65 17 52 15 26 1 42 27 22 6 52 25 47 76 45 48 67 18 44 74 48 62 58 59 79 13 5 12 14 5 13 51 21 57 59 49 43 8 34 7 16 34 29 38 74 40 72 18 46 47 43 2 4 17 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8\\r\\n5 2 3 4 8 6 1 7\\r\\n6 7 7 7 7 7 2 7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['17\\r\\n1 11 3 4 5 6 7 8 9 10 2 12 13 14 15 16 17\\r\\n13 9 16 5 16 12 11 4 4 7 12 16 2 7 14 6 3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['19\\r\\n7 2 17 18 4 16 1 9 12 10 8 11 6 13 14 19 3 5 15\\r\\n12 4 9 1 13 18 14 10 18 2 17 16 12 3 16 6 5 7 7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['47\\r\\n1 32 29 9 47 6 8 36 37 10 11 16 2 14 38 40 15 44 19 35 18 22 23 12 17 41 5 31 26 25 4 27 33 34 42 7 24 28 45 20 46 13 43 30 21 3 39\\r\\n38 28 41 46 28 20 36 9 4 10 44 28 9 39 12 36 32 38 43 3 13 33 34 35 22 23 1 4 39 2 11 34 20 19 25 13 20 26 45 36 36 43 45 13 31 9 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n1\\r\\n1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n2 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n2 2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n1 1\\r\\n'], 'output': ['YES\\r\\n']}]","id":553} {"difficulty":2000,"lang":"Rust","lang_cluster":"Rust","src_uid":"31be4d38a8b5ea8738a65bfee24a5a21","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nuse std::io::Write;\n\nfn run() {\n let out = std::io::stdout();\n let mut out = std::io::BufWriter::new(out.lock());\n input! {\n n: usize,\n s: [chars; n],\n }\n\/\/ let mut p = 0;\n let mut map = std::collections::BTreeMap::new();\n for n in (1989i64..).take(100000) {\n let mut key = vec![];\n let mut d = 1;\n loop {\n key.insert(0, n \/ d % 10);\n d *= 10;\n let mut s = String::new();\n for k in key.iter() {\n s.push_str(&format!(\"{}\", *k));\n }\n if map.contains_key(&s) {\n continue;\n }\n \/*\n if n != s.parse::().unwrap() {\n if p == 0 {\n p = n;\n }\n } else if p > 0 {\n println!(\"{} {}\", p, n);\n p = 0;\n }\n *\/\n map.insert(s, n);\n break;\n }\n }\n let solve = |n: String| -> String {\n if let Some(v) = map.get(&n) {\n return format!(\"{}\", v);\n }\n let v = n.parse::().unwrap();\n let q = v \/ 10000;\n let r = v % 10000;\n let mut cond = format!(\"{}\", q).len() + 4 < n.len();\n cond |= format!(\"{}\", q).chars().all(|c| c == '1') && r < 3099;\n if cond {\n let d = 10i64.pow(n.len() as u32);\n format!(\"{}\", v + d)\n } else {\n n\n }\n };\n for s in s {\n let n = s[4..].iter().cloned().collect::();\n let ans = solve(n);\n writeln!(out, \"{}\", ans).ok();\n }\n}\n\nfn main() {\n run();\n}\n","description":"International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbreviation with non-empty string y that has never been used before. Among all such valid abbreviations they choose the shortest one and announce it to be the abbreviation of this year's competition.For example, the first three Olympiads (years 1989, 1990 and 1991, respectively) received the abbreviations IAO'9, IAO'0 and IAO'1, while the competition in 2015 received an abbreviation IAO'15, as IAO'5 has been already used in 1995.You are given a list of abbreviations. For each of them determine the year it stands for.","input_specification":"The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000)\u00a0\u2014 the number of abbreviations to process. Then n lines follow, each containing a single abbreviation. It's guaranteed that each abbreviation contains at most nine digits.","output_specification":"For each abbreviation given in the input, find the year of the corresponding Olympiad.","notes":null,"sample_inputs":["5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0","4\nIAO'9\nIAO'99\nIAO'999\nIAO'9999"],"sample_outputs":["2015\n12015\n1991\n1989\n1990","1989\n1999\n2999\n9999"],"human_solution":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nuse std::io::Write;\n\nfn run() {\n let out = std::io::stdout();\n let mut out = std::io::BufWriter::new(out.lock());\n input! {\n n: usize,\n s: [chars; n],\n }\n let mut p = 0;\n let mut map = std::collections::BTreeMap::new();\n for n in (1989i64..).take(100000) {\n let mut key = vec![];\n let mut d = 1;\n loop {\n key.insert(0, n \/ d % 10);\n d *= 10;\n let mut s = String::new();\n for k in key.iter() {\n s.push_str(&format!(\"{}\", *k));\n }\n if map.contains_key(&s) {\n continue;\n }\n if n != s.parse::().unwrap() {\n\/\/ println!(\"{} : {}\", n, s);\n if p == 0 {\n p = n;\n }\n } else if p > 0 {\n\/\/ println!(\"{} {}\", p, n);\n p = 0;\n }\n map.insert(s, n);\n break;\n }\n }\n let solve = |n: String| -> String {\n if let Some(v) = map.get(&n) {\n return format!(\"{}\", v);\n }\n let v = n.parse::().unwrap();\n let q = v \/ 10000;\n let r = v % 10000;\n let mut cond = false;\n cond |= q < 10i64.pow((n.len() - 4) as u32) \/ 9;\n cond |= format!(\"{}\", q).chars().all(|c| c == '1') && r < 3099;\n if cond {\n let d = 10i64.pow(n.len() as u32);\n format!(\"{}\", v + d)\n } else {\n n\n }\n };\n for s in s {\n let n = s[4..].iter().cloned().collect::();\n let ans = solve(n);\n writeln!(out, \"{}\", ans).ok();\n }\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': \"5\\r\\nIAO'15\\r\\nIAO'2015\\r\\nIAO'1\\r\\nIAO'9\\r\\nIAO'0\\r\\n\", 'output': ['2015\\r\\n12015\\r\\n1991\\r\\n1989\\r\\n1990']}, {'input': \"4\\r\\nIAO'9\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['1989\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1000\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'10\\r\\nIAO'11\\r\\nIAO'12\\r\\nIAO'13\\r\\nIAO'14\\r\\nIAO'15\\r\\nIAO'16\\r\\nIAO'17\\r\\nIAO'18\\r\\nIAO'19\\r\\nIAO'20\\r\\nIAO'21\\r\\nIAO'22\\r\\nIAO'23\\r\\nIAO'24\\r\\nIAO'25\\r\\nIAO'26\\r\\nIAO'27\\r\\nIAO'28\\r\\nIAO'29\\r\\nIAO'30\\r\\nIAO'31\\r\\nIAO'32\\r\\nIAO'33\\r\\nIAO'34\\r\\nIAO'35\\r\\nIAO'36\\r\\nIAO'37\\r\\nIAO'38\\r\\nIAO'39\\r\\nIAO'40\\r\\nIAO'41\\r\\nIAO'42\\r\\nIAO'43\\r\\nIAO'44\\r\\nIAO'45\\r\\nIAO'46\\r\\nIAO'47\\r\\nIAO'48\\r\\nIAO'49\\r\\nIAO'50\\r\\nIAO'51\\r\\nIAO'52\\r\\nIAO'53\\r\\nIAO'54\\r\\nIAO'55\\r\\nIAO'56\\r\\nIAO'57\\r\\nIAO'58\\r\\nIAO'59\\r\\nIAO'60\\r\\nIAO'61\\r\\nIAO'62\\r\\nIAO'63\\r\\nIAO...\", 'output': ['1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2010\\r\\n2011\\r\\n2012\\r\\n2013\\r\\n2014\\r\\n2015\\r\\n2016\\r\\n2017\\r\\n2018\\r\\n2019\\r\\n2020\\r\\n2021\\r\\n2022\\r\\n2023\\r\\n2024\\r\\n2025\\r\\n2026\\r\\n2027\\r\\n2028\\r\\n2029\\r\\n2030\\r\\n2031\\r\\n2032\\r\\n2033\\r\\n2034\\r\\n2035\\r\\n2036\\r\\n2037\\r\\n2038\\r\\n2039\\r\\n2040\\r\\n2041\\r\\n2042\\r\\n2043\\r\\n2044\\r\\n2045\\r\\n2046\\r\\n2047\\r\\n2048\\r\\n2049\\r\\n2050\\r\\n2051\\r\\n2052\\r\\n2053\\r\\n2054\\r\\n2055\\r\\n2056\\r\\n2057\\r\\n2058\\r\\n2059\\r\\n2060\\r\\n2061\\r\\n2062\\r\\n2063\\r\\n2064\\r\\n2065\\r\\n2066\\r\\n2067\\r\\n2068\\r\\n2069\\r\\n2070\\r\\n2071\\r\\n2072\\r\\n2073\\r\\n2074\\r\\n2075\\r\\n2076\\r\\n2077\\r\\n2078\\r\\n2079\\r\\n2080\\r\\n2081\\r\\n2082\\r\\n2083\\r\\n2084\\r\\n2...']}, {'input': \"1000\\r\\nIAO'111112940\\r\\nIAO'818187\\r\\nIAO'00078853\\r\\nIAO'11112867\\r\\nIAO'2677\\r\\nIAO'431790741\\r\\nIAO'5206510\\r\\nIAO'0003566\\r\\nIAO'11113008\\r\\nIAO'55873562\\r\\nIAO'870948497\\r\\nIAO'000019400\\r\\nIAO'00001733\\r\\nIAO'79230\\r\\nIAO'1113209\\r\\nIAO'00054768\\r\\nIAO'111113183\\r\\nIAO'000726284\\r\\nIAO'000984404\\r\\nIAO'13343\\r\\nIAO'853952489\\r\\nIAO'000042254\\r\\nIAO'000000083\\r\\nIAO'111113291\\r\\nIAO'1112892\\r\\nIAO'031211\\r\\nIAO'0000054\\r\\nIAO'88862\\r\\nIAO'000024897\\r\\nIAO'6068\\r\\nIAO'11113261\\r\\nIAO'1563400\\r\\nIAO'0000014\\r\\nIAO'1113147\\r\\nIAO'113122\\r\\nIAO'11113114\\r\\nIAO'11112873\\r\\nIAO'00...\", 'output': ['1111112940\\r\\n818187\\r\\n100078853\\r\\n111112867\\r\\n12677\\r\\n431790741\\r\\n5206510\\r\\n10003566\\r\\n111113008\\r\\n55873562\\r\\n870948497\\r\\n1000019400\\r\\n100001733\\r\\n79230\\r\\n1113209\\r\\n100054768\\r\\n111113183\\r\\n1000726284\\r\\n1000984404\\r\\n13343\\r\\n853952489\\r\\n1000042254\\r\\n1000000083\\r\\n111113291\\r\\n11112892\\r\\n1031211\\r\\n10000054\\r\\n88862\\r\\n1000024897\\r\\n6068\\r\\n11113261\\r\\n1563400\\r\\n10000014\\r\\n1113147\\r\\n113122\\r\\n11113114\\r\\n111112873\\r\\n1000000020\\r\\n2644846\\r\\n1113143\\r\\n111113142\\r\\n60064652\\r\\n33881\\r\\n99223093\\r\\n1113069\\r\\n11113003\\r\\n11112865\\r\\n100001371\\r\\n112865\\r\\n16735\\r\\n1000070394\\r\\n111113...']}, {'input': \"1000\\r\\nIAO'13042\\r\\nIAO'113044\\r\\nIAO'113014\\r\\nIAO'111112921\\r\\nIAO'3393\\r\\nIAO'11113123\\r\\nIAO'00042330\\r\\nIAO'0039790\\r\\nIAO'1112851\\r\\nIAO'09327\\r\\nIAO'11113210\\r\\nIAO'12940\\r\\nIAO'13374\\r\\nIAO'824097479\\r\\nIAO'90718\\r\\nIAO'112944\\r\\nIAO'12883\\r\\nIAO'227955125\\r\\nIAO'29726\\r\\nIAO'11113300\\r\\nIAO'373423793\\r\\nIAO'0059555\\r\\nIAO'40539982\\r\\nIAO'00000262\\r\\nIAO'000716486\\r\\nIAO'0040940\\r\\nIAO'00092502\\r\\nIAO'84551722\\r\\nIAO'931673356\\r\\nIAO'000048103\\r\\nIAO'0000009\\r\\nIAO'111113047\\r\\nIAO'111113101\\r\\nIAO'113132\\r\\nIAO'59665\\r\\nIAO'73538082\\r\\nIAO'11910636\\r\\nIAO'000000378\\r\\nIAO'...\", 'output': ['113042\\r\\n1113044\\r\\n1113014\\r\\n1111112921\\r\\n3393\\r\\n11113123\\r\\n100042330\\r\\n10039790\\r\\n11112851\\r\\n109327\\r\\n11113210\\r\\n112940\\r\\n13374\\r\\n824097479\\r\\n90718\\r\\n1112944\\r\\n112883\\r\\n227955125\\r\\n29726\\r\\n11113300\\r\\n373423793\\r\\n10059555\\r\\n40539982\\r\\n100000262\\r\\n1000716486\\r\\n10040940\\r\\n100092502\\r\\n84551722\\r\\n931673356\\r\\n1000048103\\r\\n10000009\\r\\n1111113047\\r\\n111113101\\r\\n113132\\r\\n59665\\r\\n73538082\\r\\n11910636\\r\\n1000000378\\r\\n38020058\\r\\n100000064\\r\\n100002195\\r\\n1100351\\r\\n1111113035\\r\\n111113019\\r\\n10005403\\r\\n1000000797\\r\\n100009407\\r\\n13290\\r\\n256572\\r\\n10016397\\r\\n12264\\r\\n43223192\\r\\n111...']}, {'input': \"1000\\r\\nIAO'11113273\\r\\nIAO'8976\\r\\nIAO'53105\\r\\nIAO'00013993\\r\\nIAO'000008754\\r\\nIAO'111112944\\r\\nIAO'000894307\\r\\nIAO'113081\\r\\nIAO'036408696\\r\\nIAO'11003\\r\\nIAO'111113304\\r\\nIAO'8416526\\r\\nIAO'236018\\r\\nIAO'3722798\\r\\nIAO'00000010\\r\\nIAO'112873\\r\\nIAO'37450\\r\\nIAO'000099605\\r\\nIAO'80580\\r\\nIAO'88114\\r\\nIAO'005746722\\r\\nIAO'111112971\\r\\nIAO'13301\\r\\nIAO'00000051\\r\\nIAO'11113128\\r\\nIAO'111112899\\r\\nIAO'11112865\\r\\nIAO'1112879\\r\\nIAO'12917\\r\\nIAO'13253\\r\\nIAO'11113260\\r\\nIAO'111112989\\r\\nIAO'1113163\\r\\nIAO'1113109\\r\\nIAO'4037959\\r\\nIAO'113022\\r\\nIAO'13346\\r\\nIAO'0001790\\r\\nIAO'4932\\r...\", 'output': ['11113273\\r\\n8976\\r\\n53105\\r\\n100013993\\r\\n1000008754\\r\\n1111112944\\r\\n1000894307\\r\\n1113081\\r\\n1036408696\\r\\n111003\\r\\n111113304\\r\\n8416526\\r\\n236018\\r\\n3722798\\r\\n100000010\\r\\n1112873\\r\\n37450\\r\\n1000099605\\r\\n80580\\r\\n88114\\r\\n1005746722\\r\\n1111112971\\r\\n13301\\r\\n100000051\\r\\n11113128\\r\\n1111112899\\r\\n111112865\\r\\n11112879\\r\\n112917\\r\\n13253\\r\\n11113260\\r\\n1111112989\\r\\n1113163\\r\\n1113109\\r\\n4037959\\r\\n1113022\\r\\n13346\\r\\n10001790\\r\\n4932\\r\\n36672\\r\\n18257129\\r\\n4772891\\r\\n108046895\\r\\n10007697\\r\\n113338\\r\\n113094\\r\\n12653\\r\\n785110421\\r\\n10000594\\r\\n113265\\r\\n10566285\\r\\n111112882\\r\\n569331178\\r\\n1000398068...']}, {'input': \"1000\\r\\nIAO'11113341\\r\\nIAO'000004632\\r\\nIAO'1112875\\r\\nIAO'113306\\r\\nIAO'112878\\r\\nIAO'002666131\\r\\nIAO'21605282\\r\\nIAO'1888\\r\\nIAO'13010\\r\\nIAO'000643083\\r\\nIAO'0000052\\r\\nIAO'113111\\r\\nIAO'00916\\r\\nIAO'29776\\r\\nIAO'445127275\\r\\nIAO'113287\\r\\nIAO'111112865\\r\\nIAO'4903398\\r\\nIAO'3617746\\r\\nIAO'079220\\r\\nIAO'111113067\\r\\nIAO'680662260\\r\\nIAO'1113017\\r\\nIAO'12893\\r\\nIAO'1112903\\r\\nIAO'841512029\\r\\nIAO'113315\\r\\nIAO'536013\\r\\nIAO'6624475\\r\\nIAO'13314\\r\\nIAO'000003682\\r\\nIAO'271008325\\r\\nIAO'04004\\r\\nIAO'000000049\\r\\nIAO'12876\\r\\nIAO'000009305\\r\\nIAO'0051405\\r\\nIAO'11112988\\r\\nIAO'0000...\", 'output': ['11113341\\r\\n1000004632\\r\\n11112875\\r\\n113306\\r\\n1112878\\r\\n1002666131\\r\\n21605282\\r\\n11888\\r\\n113010\\r\\n1000643083\\r\\n10000052\\r\\n113111\\r\\n100916\\r\\n29776\\r\\n445127275\\r\\n113287\\r\\n1111112865\\r\\n4903398\\r\\n3617746\\r\\n1079220\\r\\n1111113067\\r\\n680662260\\r\\n11113017\\r\\n112893\\r\\n11112903\\r\\n841512029\\r\\n113315\\r\\n536013\\r\\n6624475\\r\\n13314\\r\\n1000003682\\r\\n271008325\\r\\n104004\\r\\n1000000049\\r\\n112876\\r\\n1000009305\\r\\n10051405\\r\\n111112988\\r\\n100000087\\r\\n675909060\\r\\n316729520\\r\\n111113222\\r\\n8017601\\r\\n1111112992\\r\\n1113282\\r\\n100003907\\r\\n111113089\\r\\n11113002\\r\\n1112856\\r\\n5004571\\r\\n1113135\\r\\n1113217\\r\\n10...']}, {'input': \"1000\\r\\nIAO'5864\\r\\nIAO'112961\\r\\nIAO'000001780\\r\\nIAO'959112\\r\\nIAO'751285866\\r\\nIAO'0000050\\r\\nIAO'00007045\\r\\nIAO'4884\\r\\nIAO'380539882\\r\\nIAO'11112876\\r\\nIAO'7999\\r\\nIAO'111112869\\r\\nIAO'3825105\\r\\nIAO'9596134\\r\\nIAO'511898\\r\\nIAO'5347\\r\\nIAO'678172\\r\\nIAO'11112902\\r\\nIAO'111112873\\r\\nIAO'230800781\\r\\nIAO'8315\\r\\nIAO'11113216\\r\\nIAO'111113179\\r\\nIAO'052538046\\r\\nIAO'28240898\\r\\nIAO'000052957\\r\\nIAO'46208212\\r\\nIAO'196482\\r\\nIAO'71561148\\r\\nIAO'13139\\r\\nIAO'99827216\\r\\nIAO'000006898\\r\\nIAO'111113280\\r\\nIAO'113198\\r\\nIAO'000000592\\r\\nIAO'15005515\\r\\nIAO'017905\\r\\nIAO'13057\\r\\nIAO'...\", 'output': ['5864\\r\\n1112961\\r\\n1000001780\\r\\n959112\\r\\n751285866\\r\\n10000050\\r\\n100007045\\r\\n4884\\r\\n380539882\\r\\n111112876\\r\\n7999\\r\\n1111112869\\r\\n3825105\\r\\n9596134\\r\\n511898\\r\\n5347\\r\\n678172\\r\\n111112902\\r\\n1111112873\\r\\n230800781\\r\\n8315\\r\\n11113216\\r\\n111113179\\r\\n1052538046\\r\\n28240898\\r\\n1000052957\\r\\n46208212\\r\\n196482\\r\\n71561148\\r\\n13139\\r\\n99827216\\r\\n1000006898\\r\\n111113280\\r\\n113198\\r\\n1000000592\\r\\n15005515\\r\\n1017905\\r\\n113057\\r\\n1000406356\\r\\n10003323\\r\\n100005873\\r\\n48523888\\r\\n652368767\\r\\n1111113085\\r\\n10000508\\r\\n29819248\\r\\n100051354\\r\\n13159\\r\\n1000002187\\r\\n100031843\\r\\n236640073\\r\\n1000324050...']}, {'input': \"1000\\r\\nIAO'361770\\r\\nIAO'113005\\r\\nIAO'62083\\r\\nIAO'488606266\\r\\nIAO'0009107\\r\\nIAO'630923497\\r\\nIAO'000384651\\r\\nIAO'000000084\\r\\nIAO'0000452\\r\\nIAO'99608\\r\\nIAO'12129598\\r\\nIAO'111113174\\r\\nIAO'3486032\\r\\nIAO'00004501\\r\\nIAO'13058\\r\\nIAO'3271\\r\\nIAO'429137139\\r\\nIAO'810623070\\r\\nIAO'11113320\\r\\nIAO'566635279\\r\\nIAO'45462780\\r\\nIAO'112950\\r\\nIAO'8974\\r\\nIAO'1113211\\r\\nIAO'857197\\r\\nIAO'20622\\r\\nIAO'1112852\\r\\nIAO'00000054\\r\\nIAO'7075\\r\\nIAO'000893242\\r\\nIAO'458282728\\r\\nIAO'00007225\\r\\nIAO'749922761\\r\\nIAO'414594056\\r\\nIAO'0000102\\r\\nIAO'1113243\\r\\nIAO'00000073\\r\\nIAO'86119\\r\\nIAO...\", 'output': ['361770\\r\\n1113005\\r\\n62083\\r\\n488606266\\r\\n10009107\\r\\n630923497\\r\\n1000384651\\r\\n1000000084\\r\\n10000452\\r\\n99608\\r\\n12129598\\r\\n111113174\\r\\n3486032\\r\\n100004501\\r\\n113058\\r\\n3271\\r\\n429137139\\r\\n810623070\\r\\n11113320\\r\\n566635279\\r\\n45462780\\r\\n1112950\\r\\n8974\\r\\n1113211\\r\\n857197\\r\\n20622\\r\\n11112852\\r\\n100000054\\r\\n7075\\r\\n1000893242\\r\\n458282728\\r\\n100007225\\r\\n749922761\\r\\n414594056\\r\\n10000102\\r\\n1113243\\r\\n100000073\\r\\n86119\\r\\n10000663\\r\\n111113030\\r\\n80729821\\r\\n1113171\\r\\n9585546\\r\\n6474731\\r\\n111113281\\r\\n625883\\r\\n10003487\\r\\n1112893\\r\\n10004783\\r\\n8631847\\r\\n956537242\\r\\n11112953\\r\\n112864\\r\\n111...']}, {'input': \"1000\\r\\nIAO'56561116\\r\\nIAO'3195\\r\\nIAO'3617\\r\\nIAO'78233\\r\\nIAO'2088\\r\\nIAO'3763841\\r\\nIAO'13106\\r\\nIAO'5569\\r\\nIAO'11113132\\r\\nIAO'025391206\\r\\nIAO'773411423\\r\\nIAO'201748\\r\\nIAO'681772\\r\\nIAO'000000028\\r\\nIAO'1112863\\r\\nIAO'111112973\\r\\nIAO'16199\\r\\nIAO'11113099\\r\\nIAO'11113208\\r\\nIAO'53704746\\r\\nIAO'000000095\\r\\nIAO'111113204\\r\\nIAO'35462186\\r\\nIAO'12534514\\r\\nIAO'5833\\r\\nIAO'111113306\\r\\nIAO'112924\\r\\nIAO'000098261\\r\\nIAO'1113232\\r\\nIAO'31711\\r\\nIAO'0006799\\r\\nIAO'016878\\r\\nIAO'000047489\\r\\nIAO'1113116\\r\\nIAO'289357641\\r\\nIAO'113072\\r\\nIAO'0002934\\r\\nIAO'811655\\r\\nIAO'1089\\r\\nIAO...\", 'output': ['56561116\\r\\n3195\\r\\n3617\\r\\n78233\\r\\n12088\\r\\n3763841\\r\\n13106\\r\\n5569\\r\\n11113132\\r\\n1025391206\\r\\n773411423\\r\\n201748\\r\\n681772\\r\\n1000000028\\r\\n11112863\\r\\n1111112973\\r\\n16199\\r\\n11113099\\r\\n11113208\\r\\n53704746\\r\\n1000000095\\r\\n111113204\\r\\n35462186\\r\\n12534514\\r\\n5833\\r\\n111113306\\r\\n1112924\\r\\n1000098261\\r\\n1113232\\r\\n31711\\r\\n10006799\\r\\n1016878\\r\\n1000047489\\r\\n1113116\\r\\n289357641\\r\\n1113072\\r\\n10002934\\r\\n811655\\r\\n11089\\r\\n111112909\\r\\n247845626\\r\\n11113267\\r\\n328961645\\r\\n8604\\r\\n11112885\\r\\n100005524\\r\\n87071\\r\\n113313\\r\\n523148\\r\\n1112947\\r\\n11113147\\r\\n962252\\r\\n508616450\\r\\n11113204\\r\\n13338\\r\\n768...']}, {'input': \"936\\r\\nIAO'111112878\\r\\nIAO'1113081\\r\\nIAO'9634\\r\\nIAO'3340\\r\\nIAO'13318\\r\\nIAO'9252\\r\\nIAO'59349\\r\\nIAO'00000044\\r\\nIAO'13188\\r\\nIAO'2183251\\r\\nIAO'64419\\r\\nIAO'1113077\\r\\nIAO'7268\\r\\nIAO'11113017\\r\\nIAO'02144\\r\\nIAO'00098647\\r\\nIAO'1112994\\r\\nIAO'640859\\r\\nIAO'28931364\\r\\nIAO'113138\\r\\nIAO'62075\\r\\nIAO'000006092\\r\\nIAO'39337604\\r\\nIAO'501806880\\r\\nIAO'1113280\\r\\nIAO'113026\\r\\nIAO'9453624\\r\\nIAO'000004581\\r\\nIAO'237141\\r\\nIAO'00036975\\r\\nIAO'7058492\\r\\nIAO'048767\\r\\nIAO'958601\\r\\nIAO'112890\\r\\nIAO'8500800\\r\\nIAO'112900\\r\\nIAO'11113039\\r\\nIAO'000045541\\r\\nIAO'1112872\\r\\nIAO'111112886\\r...\", 'output': ['1111112878\\r\\n11113081\\r\\n9634\\r\\n3340\\r\\n13318\\r\\n9252\\r\\n59349\\r\\n100000044\\r\\n13188\\r\\n2183251\\r\\n64419\\r\\n11113077\\r\\n7268\\r\\n111113017\\r\\n102144\\r\\n100098647\\r\\n11112994\\r\\n640859\\r\\n28931364\\r\\n113138\\r\\n62075\\r\\n1000006092\\r\\n39337604\\r\\n501806880\\r\\n1113280\\r\\n1113026\\r\\n9453624\\r\\n1000004581\\r\\n237141\\r\\n100036975\\r\\n7058492\\r\\n1048767\\r\\n958601\\r\\n1112890\\r\\n8500800\\r\\n1112900\\r\\n111113039\\r\\n1000045541\\r\\n11112872\\r\\n1111112886\\r\\n11113233\\r\\n16735873\\r\\n7685\\r\\n1000000315\\r\\n77258\\r\\n113295\\r\\n112920\\r\\n111113042\\r\\n1109736490\\r\\n100006347\\r\\n1004729286\\r\\n912241097\\r\\n1113062\\r\\n1113060\\r\\n15631113\\r...']}, {'input': \"1\\r\\nIAO'111110\\r\\n\", 'output': ['1111110']}, {'input': \"2\\r\\nIAO'0\\r\\nIAO'00\\r\\n\", 'output': ['1990\\r\\n2000']}, {'input': \"1\\r\\nIAO'111111\\r\\n\", 'output': ['1111111']}, {'input': \"1\\r\\nIAO'111111111\\r\\n\", 'output': ['1111111111']}, {'input': \"1\\r\\nIAO'001\\r\\n\", 'output': ['3001']}, {'input': \"1\\r\\nIAO'2000\\r\\n\", 'output': ['12000']}, {'input': \"1\\r\\nIAO'11109999\\r\\n\", 'output': ['111109999']}, {'input': \"1\\r\\nIAO'11111\\r\\n\", 'output': ['111111']}, {'input': \"1\\r\\nIAO'100000\\r\\n\", 'output': ['1100000']}, {'input': \"1\\r\\nIAO'18999990\\r\\n\", 'output': ['18999990']}, {'input': \"1\\r\\nIAO'113098\\r\\n\", 'output': ['1113098']}, {'input': \"1\\r\\nIAO'111122\\r\\n\", 'output': ['1111122']}, {'input': \"1\\r\\nIAO'1110222\\r\\n\", 'output': ['11110222']}, {'input': \"1\\r\\nIAO'11133333\\r\\n\", 'output': ['11133333']}, {'input': \"1\\r\\nIAO'000000000\\r\\n\", 'output': ['1000000000']}, {'input': \"4\\r\\nIAO'3098\\r\\nIAO'99\\r\\nIAO'999\\r\\nIAO'9999\\r\\n\", 'output': ['13098\\r\\n1999\\r\\n2999\\r\\n9999']}, {'input': \"1\\r\\nIAO'11100000\\r\\n\", 'output': ['111100000']}, {'input': \"2\\r\\nIAO'15\\r\\nIAO'15\\r\\n\", 'output': ['2015\\r\\n2015']}, {'input': \"1\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999']}, {'input': \"63\\r\\nIAO'099999999\\r\\nIAO'999999999\\r\\nIAO'111113098\\r\\nIAO'111113099\\r\\nIAO'11113098\\r\\nIAO'11113099\\r\\nIAO'1113098\\r\\nIAO'1113099\\r\\nIAO'113098\\r\\nIAO'113099\\r\\nIAO'13098\\r\\nIAO'13099\\r\\nIAO'3098\\r\\nIAO'3099\\r\\nIAO'098\\r\\nIAO'099\\r\\nIAO'98\\r\\nIAO'99\\r\\nIAO'000000000\\r\\nIAO'000000001\\r\\nIAO'0\\r\\nIAO'1\\r\\nIAO'2\\r\\nIAO'3\\r\\nIAO'4\\r\\nIAO'5\\r\\nIAO'6\\r\\nIAO'7\\r\\nIAO'8\\r\\nIAO'9\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\nIAO'000000009\\r\\nIAO'01\\r\\nIAO'001\\r\\nIAO'0001\\r\\nIAO'02\\r\\nIAO'002\\r\\nIAO'0002\\r\\nIAO'03\\r\\nIAO'003\\r\\nIAO'0003\\r\\nIAO'0...\", 'output': ['1099999999\\r\\n999999999\\r\\n1111113098\\r\\n111113099\\r\\n111113098\\r\\n11113099\\r\\n11113098\\r\\n1113099\\r\\n1113098\\r\\n113099\\r\\n113098\\r\\n13099\\r\\n13098\\r\\n3099\\r\\n3098\\r\\n2099\\r\\n2098\\r\\n1999\\r\\n1000000000\\r\\n1000000001\\r\\n1990\\r\\n1991\\r\\n1992\\r\\n1993\\r\\n1994\\r\\n1995\\r\\n1996\\r\\n1997\\r\\n1998\\r\\n1989\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000\\r\\n1000000009\\r\\n2001\\r\\n3001\\r\\n10001\\r\\n2002\\r\\n3002\\r\\n10002\\r\\n2003\\r\\n3003\\r\\n10003\\r\\n2004\\r\\n3004\\r\\n10004\\r\\n2005\\r\\n3005\\r\\n10005\\r\\n2006\\r\\n3006\\r\\n10006\\r\\n2007\\r\\n3007\\r\\n10007\\r\\n2009\\r\\n3009\\r\\n10009']}, {'input': \"1\\r\\nIAO'1112121\\r\\n\", 'output': ['11112121']}, {'input': \"1\\r\\nIAO'111113098\\r\\n\", 'output': ['1111113098']}, {'input': \"1\\r\\nIAO'10005000\\r\\n\", 'output': ['110005000']}, {'input': \"1\\r\\nIAO'111378\\r\\n\", 'output': ['1111378']}, {'input': \"1\\r\\nIAO'112222\\r\\n\", 'output': ['1112222']}, {'input': \"1\\r\\nIAO'021113099\\r\\n\", 'output': ['1021113099']}, {'input': \"1\\r\\nIAO'123456789\\r\\n\", 'output': ['123456789']}, {'input': \"1\\r\\nIAO'000000001\\r\\n\", 'output': ['1000000001']}, {'input': \"1\\r\\nIAO'089\\r\\n\", 'output': ['3089']}, {'input': \"9\\r\\nIAO'0\\r\\nIAO'00\\r\\nIAO'000\\r\\nIAO'0000\\r\\nIAO'00000\\r\\nIAO'000000\\r\\nIAO'0000000\\r\\nIAO'00000000\\r\\nIAO'000000000\\r\\n\", 'output': ['1990\\r\\n2000\\r\\n3000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000']}, {'input': \"2\\r\\nIAO'999999999\\r\\nIAO'999999999\\r\\n\", 'output': ['999999999\\r\\n999999999']}, {'input': \"1\\r\\nIAO'2015\\r\\n\", 'output': ['12015']}, {'input': \"1\\r\\nIAO'113097\\r\\n\", 'output': ['1113097']}, {'input': \"1\\r\\nIAO'11378\\r\\n\", 'output': ['111378']}]","id":554} {"difficulty":2000,"lang":"Rust","lang_cluster":"Rust","src_uid":"391c2abbe862139733fcb997ba1629b8","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(unused_imports)]\n#![allow(unused_macros)]\nuse std::cell::{RefCell, RefMut};\nuse std::cmp::{max, min};\nuse std::collections::*;\nuse std::io::{stdin, Read};\n\n#[allow(unused_macros)]\nmacro_rules! parse {\n ($it: ident ) => {};\n ($it: ident, ) => {};\n ($it: ident, $var:ident : $t:tt $($r:tt)*) => {\n let $var = parse_val!($it, $t);\n parse!($it $($r)*);\n };\n ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {\n let mut $var = parse_val!($it, $t);\n parse!($it $($r)*);\n };\n ($it: ident, $var:ident $($r:tt)*) => {\n let $var = parse_val!($it, usize);\n parse!($it $($r)*);\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! parse_val {\n ($it: ident, [$t:tt; $len:expr]) => {\n (0..$len).map(|_| parse_val!($it, $t)).collect::>();\n };\n ($it: ident, ($($t: tt),*)) => {\n ($(parse_val!($it, $t)),*)\n };\n ($it: ident, u1) => {\n $it.next().unwrap().parse::().unwrap() -1\n };\n ($it: ident, $t: ty) => {\n $it.next().unwrap().parse::<$t>().unwrap()\n };\n}\n\n#[cfg(debug_assertions)]\nmacro_rules! debug {\n ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }\n}\n\n#[cfg(not(debug_assertions))]\nmacro_rules! debug {\n ($( $args:expr ),*) => {\n ()\n };\n}\n\nconst S: usize = 26;\nfn solve(s: &str) {\n let mut it = s.split_whitespace();\n let s: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let t: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let v: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let mut next = vec![[0; S]; v.len()];\n for i in 0..v.len() {\n for j in 0u8..(S as u8) {\n let mut curs = v[..i].to_vec();\n curs.push(j);\n let mut curs: &[u8] = &curs;\n while curs != &v[..curs.len()] {\n curs = &curs[1..];\n }\n next[i][j as usize] = curs.len();\n }\n }\n let mut dp = vec![vec![vec![0; v.len()]; t.len() + 1]; s.len() + 1];\n for i in 0..s.len() {\n for j in 0..t.len() {\n for k in 0..v.len() {\n let _m = next[k][s[i] as usize];\n if s[i] == t[j] && _m != v.len() {\n let m = _m;\n dp[i + 1][j + 1][m] = max(dp[i + 1][j + 1][m], dp[i][j][k] + 1);\n if i == 10 {}\n } else {\n dp[i + 1][j + 1][k] = max(dp[i + 1][j + 1][k], dp[i][j][k])\n }\n dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);\n dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);\n }\n }\n }\n let mut ret = 0;\n for i in 0..=s.len() {\n for j in 0..=t.len() {\n ret = max(ret, *dp[i][j].iter().max().unwrap());\n }\n }\n println!(\"{}\", ret);\n}\n\nfn main() {\n let mut s = String::new();\n stdin().read_to_string(&mut s).unwrap();\n solve(&s);\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_input() {\n let s = \"\n \";\n solve(s);\n }\n}\n","description":"In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A substring of a string is a continuous subsequence of the string. For example, BCD is a substring of ABCDEF.You are given two strings s1, s2 and another string called virus. Your task is to find the longest common subsequence of s1 and s2, such that it doesn't contain virus as a substring.","input_specification":"The input contains three strings in three separate lines: s1, s2 and virus (1\u2009\u2264\u2009|s1|,\u2009|s2|,\u2009|virus|\u2009\u2264\u2009100). Each string consists only of uppercase English letters.","output_specification":"Output the longest common subsequence of s1 and s2 without virus as a substring. If there are multiple answers, any of them will be accepted. If there is no valid common subsequence, output 0.","notes":null,"sample_inputs":["AJKEQSLOBSROFGZ\nOVGURWZLWVLUXTH\nOZ","AA\nA\nA"],"sample_outputs":["ORZ","0"],"human_solution":"#![allow(unused_imports)]\n#![allow(unused_macros)]\nuse std::cell::{RefCell, RefMut};\nuse std::cmp::{max, min};\nuse std::collections::*;\nuse std::io::{stdin, Read};\n\n#[allow(unused_macros)]\nmacro_rules! parse {\n ($it: ident ) => {};\n ($it: ident, ) => {};\n ($it: ident, $var:ident : $t:tt $($r:tt)*) => {\n let $var = parse_val!($it, $t);\n parse!($it $($r)*);\n };\n ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {\n let mut $var = parse_val!($it, $t);\n parse!($it $($r)*);\n };\n ($it: ident, $var:ident $($r:tt)*) => {\n let $var = parse_val!($it, usize);\n parse!($it $($r)*);\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! parse_val {\n ($it: ident, [$t:tt; $len:expr]) => {\n (0..$len).map(|_| parse_val!($it, $t)).collect::>();\n };\n ($it: ident, ($($t: tt),*)) => {\n ($(parse_val!($it, $t)),*)\n };\n ($it: ident, u1) => {\n $it.next().unwrap().parse::().unwrap() -1\n };\n ($it: ident, $t: ty) => {\n $it.next().unwrap().parse::<$t>().unwrap()\n };\n}\n\n#[cfg(debug_assertions)]\nmacro_rules! debug {\n ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }\n}\n\n#[cfg(not(debug_assertions))]\nmacro_rules! debug {\n ($( $args:expr ),*) => {\n ()\n };\n}\n\nfn chmax(s: &mut Vec, t: &[u8]) {\n if s.len() < t.len() {\n *s = t.to_vec();\n }\n}\n\nconst S: usize = 26;\nfn solve(s: &str) {\n let mut it = s.split_whitespace();\n let s: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let t: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let v: Vec<_> = it.next().unwrap().bytes().map(|x| x - b'A').collect();\n let mut next = vec![[0; S]; v.len()];\n for i in 0..v.len() {\n for j in 0u8..(S as u8) {\n let mut curs = v[..i].to_vec();\n curs.push(j);\n let mut curs: &[u8] = &curs;\n while curs != &v[..curs.len()] {\n curs = &curs[1..];\n }\n next[i][j as usize] = curs.len();\n }\n }\n let mut dp = vec![vec![vec![vec![]; v.len()]; t.len() + 1]; s.len() + 1];\n for i in 0..s.len() {\n for j in 0..t.len() {\n for k in 0..v.len() {\n let tmp = dp[i][j][k].clone();\n let _m = next[k][s[i] as usize];\n if s[i] == t[j] && _m != v.len() {\n let m = _m;\n let mut tmp = tmp.clone();\n tmp.push(s[i]);\n chmax(&mut dp[i + 1][j + 1][m], &tmp);\n } else {\n chmax(&mut dp[i + 1][j + 1][k], &tmp);\n }\n chmax(&mut dp[i + 1][j][k], &tmp);\n chmax(&mut dp[i][j + 1][k], &tmp);\n }\n }\n }\n let mut ret = vec![];\n for i in 0..=s.len() {\n for j in 0..=t.len() {\n for k in 0..v.len() {\n chmax(&mut ret, &dp[i][j][k]);\n }\n }\n }\n let ret: String = ret.iter().map(|&b| (b + b'A') as char).collect();\n if ret.len() == 0 {\n println!(\"{}\", 0);\n } else {\n println!(\"{}\", ret);\n }\n}\n\nfn main() {\n let mut s = String::new();\n stdin().read_to_string(&mut s).unwrap();\n solve(&s);\n}\n\n#[cfg(test)]\nmod tests {\n use super::*;\n #[test]\n fn test_input() {\n let s = \"\n \";\n solve(s);\n }\n}\n","testcases":"[{'input': 'AJKEQSLOBSROFGZ\\r\\nOVGURWZLWVLUXTH\\r\\nOZ\\r\\n', 'output': ['OGZ', 'ORZ']}, {'input': 'AA\\r\\nA\\r\\nA\\r\\n', 'output': ['0']}, {'input': 'PWBJTZPQHA\\r\\nZJMKLWSROQ\\r\\nUQ\\r\\n', 'output': ['WQ', 'ZQ']}, {'input': 'QNHRPFYMAAPJDUHBAEXNEEZSTMYHVGQPYKNMVKMBVSVLIYGUVMJHEFLJEPIWFHSLISTGOKRXNMSCXYKMAXBPKCOCNTIRPCUEPHXM\\r\\nRRFCZUGFDRKKMQTOETNELXMEWGOCDHFKIXOPVHHEWTCDNXVFKFKTKNWKEIKTCMHMHDNCLLVQSGKHBCDDYVVVQIRPZEOPUGQUGRHH\\r\\nR\\r\\n', 'output': ['FUENEMGKIVHEFEIHLSGKBCIPEPH', 'FDENEMGKIVHEWFTKNMCKBCIPEPH', 'FMENEEHKIVHEFEIHLSGKCYPOPUH', 'QNHFPHEXNETMHMHLLSGKCYPOPUH', 'QNHFPHETVKNKMMHLLSGKBCIPEPH', 'FDENEMGKIVHEFEIHLSGKCYPOPUH']}, {'input': 'CGPWTAPEVBTGANLCLVSHQIIKHDPVUHRSQPXHSNYAHPGBECICFQYDFRTRELLLEDZYWJSLOBSKDGRRDHNRRGIXAMEBGFJJTEIGUGRU\\r\\nHAWYVKRRBEIWNOGYMIYQXDCFXMMCSAYSOXQFHHIFRRCJRAWHLDDHHHAKHXVKCVPBFGGEXUKWTFWMOUUGMXTSBUTHXCJCWHCQQTYQ\\r\\nANKFDWLYSX\\r\\n', 'output': ['WVBGIQXSYHIFRRWLDDHXBGEUGU', 'WVBNIQXSYHIFRRJLDDHXBFGUGU', 'AVBIIQXSAHIFRRWLDDHXBFGUGU', 'WVBGCSSQHHIFRRWLDDHXBGFUGU', 'AVBNIQXSAHIFRRJLDDHABFGUGU', 'WVBNIDXSYHIFRRWLDDHXBGFUGU']}, {'input': 'AUNBEKNURNUPHXQYKUTAHCOLMPRQZZTVDUYCTNIRACQQTQAIDTAWJXBUTIZUASDIJZWLHAQVGCAHKTZMXSDVVWAIGQEALRFKFYTT\\r\\nQBVRFKPKLYZLYNRFTRJZZQEYAEKPFXVICUVFVQSDENBJYYNCFTOZHULSWJQTNELYLKCZTGHOARDCFXBXQGGSQIVUCJVNGFZEEZQE\\r\\nN\\r\\n', 'output': ['BKPYTRZZVICQDJTZUSJZHAQGSVVGQE', 'BRPKLZYTRQAXIUSDJZWLHACXSVVGQE', 'BRPKLRZZYACQDBTZUSWLHACXSVVGQE', 'BRPKLRZZYICQDJTZUSJZHAQGSVVGQE', 'BKPKLRZZVICQDJTZUSJZHAQGSVVGQE']}, {'input': 'BGIIURZTEUJJULBWKHDQBRFGEUOMQSREOTILICRSBUHBGTSRDHKVDDEBVHGMHXUVFJURSMFDJOOOWCYPJDVRVKLDHICPNKTBFXDJ\\r\\nXOADNTKNILGNHHBNFYNDWUNXBGDFUKUVHLPDOGOYRMOTAQELLRMHFAQEOXFWGAQUROVUSWOAWFRVIRJQVXPCXLSCQLCUWKBZUFQP\\r\\nYVF\\r\\n', 'output': ['TLBWKHDGOROTLRHEGUVUSOWVRVLCKBF', 'ILBWKHDGOMQELRHEGUVUSOWVRVLCKBF', 'TLBWKHDGOROTLRMHXFUROOWVRVLCKBF', 'TLBWKHDGOROTLRMHXFURSOWVRVLCKBF']}, {'input': 'AXBPBDEYIYKKCZBTLKBUNEQLCXXLKIUTOOATYDXYYQCLFAXAEIGTFMNTTQKCQRMEEFRYVYXAOLMUQNPJBMFBUGVXFZAJSBXWALSI\\r\\nVWFONLLKSHGHHQSFBBFWTXAITPUKNDANOCLMNFTAAMJVDLXYPILPCJCFWTNBQWEOMMXHRYHEGBJIVSXBBGQKXRIYNZFIWSZPPUUM\\r\\nPPKKLHXWWT\\r\\n', 'output': ['BBITKNCLTADXYCFTNQMRYVXBBGXFWS', 'BBITUNCLTADXYLFTNQERYVXBBGXZWS', 'BBITKNCLTADXYCFTNQMRYVXBBGXZWS']}, {'input': 'XKTAOCPCVMIOGCQKPENDKIZRZBZVRTBTGCDRQUIMVHABDIHSCGWPUTQKLPBOXAYICPWJBFLFSEPERGJZHRINEHQMYTOTKLCQCSMZ\\r\\nAITFIOUTUVZLSSIYWXSYTQMFLICCXOFSACHTKGPXRHRCGXFZXPYWKWPUOIDNEEZOKMOUYGVUJRQTIRQFCSBCWXVFCIAOLZDGENNI\\r\\nDBHOIORVCPNXCDOJKSYYIENQRJGZFHOWBYQIITMTVWXRMAMYILTHBBAJRJELWMIZOZBGPDGSTIRTQIILJRYICMUQTUAFKDYGECPY\\r\\n', 'output': ['AITTUVSWTQLICFSPRGZINEMOTQCSZ', 'TOVMIOCKGRHCGWPUOIEEGJRQTQCSZ', 'TOVMIOCKPRRCGWPUOIEEGJRQTQCSZ', 'AIITUVSWTQLICFSPRGZINEMYTQCSZ', 'AIITUVSWTQLICFSPRHRINEMYTQCSZ']}, {'input': 'UNGXODEEINVYVPHYVGSWPIPFMFLZJYRJIPCUSWVUDLLSLRPJJFWCUOYDUGXBRKWPARGLXFJCNNFUIGEZUCTPFYUIMQMJLQHTIVPO\\r\\nBWDEGORKXYCXIDWZKGFCUYIDYLTWLCDBUVHPAPFLIZPEUINQSTNRAOVYKZCKFWIJQVLSVCGLTCOEMAYRCDVVQWQENTWZALWUKKKA\\r\\nXDGPZXADAFCHKILONSXFGRHIQVMIYWUTJUPCCEKYQVYAENRHVWERJSNPVEMRYSZGYBNTQLIFKFISKZJQIQQGSKVGCNMPNIJDRTXI\\r\\n', 'output': ['GODIYVHPPFLZPUSWVLSLCOYDWALU', 'GODIYVHPPFLIPUSROYKFJCGTMQQT', 'GXDIYVHPPFLIPUSROYKCFICTMQQT', 'GODIYVHPPFLIPUSROYKCFICTMQQT', 'GXDIYVHPPFLZPUSWVLSLCOYDWALU', 'GXDIYVHPPFLZPUSROYKWGLCECQQT']}, {'input': 'KOROXDDWEUVYWJIXSFPEJFYZJDDUXISOFJTIFJSBTWIJQHMTQWLAGGMXTFALRXYCMGZNKYQRCDVTPRQDBAALTWAXTNLDPYWNSFKE\\r\\nNHZGRZFMFQGSAYOJTFKMMUPOOQXWCPPAIVRJHINJPHXTTBWRIYNOHMJKBBGXVXYZDBVBBTQRXTOFLBBCXGNICBKAAGOKAYCCJYCW\\r\\nXCXLBESCRBNKWYGFDZFKWYNLFAKEWWGRUIAQGNCFDQXCHDBEQDSWSNGVKUFOGGSPFFZWTXGZQMMFJXDWOPUEZCMZEFDHXTRJTNLW\\r\\n', 'output': ['RFFYJUXIJIJTWIHMTQXTFLCGNCBAAAYW', 'KOOXWVJIJXTBWIHMTQXTFLCGNCBAAAYW', 'KOOXWVJIPXTBWIHMTQXTFLXGNCBAAAYW', 'RFFYJUXIJIJTWIHMTQXTFLXGNCBAAAYW', 'KOOXWVJIPXTBWIHMTQXTFLCGNCBAAAYW']}, {'input': 'ESQZPIRAWBTUZSOWLYKIYCHZJPYERRXPJANKPZVPEDCXCJIDTLCARMAOTZMHJVDJXRDNQRIIOFIUTALVSCKDUSAKANKKOFKWINLQ\\r\\nGKSTYEAXFJQQUTKPZDAKHZKXCJDONKBZOTYGLYQJOGKOYMYNNNQRRVAGARKBQYJRVYYPFXTIBJJYQUWJUGAUQZUVMUHXLIQWGRMP\\r\\nUFPHNRDXLNYRIIYVOFRKRUQCWAICQUUBPHHEGBCILXHHGLOBKADQVPSQCMXJRLIZQPSRLZJNZVQPIURDQUKNHVVYNVBYGXXXXJDI\\r\\n', 'output': ['STYEXJKPZDXCJDTLOMVRQRFIUAVULQ', 'STYEXJKPZDXCJDTLOMVRQRFIUAVUIQ']}, {'input': 'UAYQUMTSNGMYBORUYXJJQZVAGBRVDWUTGUYYYOTWAHVKGGOHADXULFUFQULSAGDWFJCSDKPWBROYZIFRGGRVZQMEHKHCKNHTQSMK\\r\\nSVKVTPUZOBRKGLEAAXMIUSRISOTDIFFUCODYGNYIPSWEEBHGNWRZETXSVVMQTRBVFZMYHOHUCMLBUXBMPMSNCSHFZTAFUVTMQFGL\\r\\nTNICVANBEBOQASUEJJAOJXWNMDGAAVYNHRPSMKGMXZDJHCZHFHRRMIDWUOQCZSBKDPLSGHNHFKFYDRGVKXOLPOOWBPOWSDFLEJVX\\r\\n', 'output': ['SVVTUOKGAXUFFUCDPWBRZRVZMHHCNHTQ', 'SVVTUOKGAXUSDFCDPWBRZRVZMHHCNHTQ', 'SVVTUOKGAXUSDFCDPWBRZRVZMHHCNHTM']}, {'input': 'KEJHTOKHMKWTYSJEAJAXGADRHUKBCRHACSRDNSZIHTPQNLOSRKYBGYIIJDINTXRPMWSVMMBODAYPVVDDTIXGDIOMWUAKZVFKDAUM\\r\\nWTEVPIFAAJYIDTZSZKPPQKIOMHDZTKDMFVKSJRUFMNHZJPVSQYELWYAFACGGNRORSLGYVXAEYVLZBLDEHYDGOFDSWUYCXLXDKFSU\\r\\nTUZEQBWVBVTKETQ\\r\\n', 'output': ['EJTKHMKSJRUNHPQLYGNRSVAYVDDGOWUKFU', 'EJTOKMKSJRUHZPQLYGNRSVAYVDDGDWUKFU', 'EJTOKMKSJRUNZPQLYGNRSVAYVDDGDWUKFU', 'EJHTKMKSJRUHZPQLYGNRSVAYVDDGDWUKFU']}, {'input': 'EGQYYSKTFTURZNRDVIWBYXMRDGFWMYKFXGIFOGYJSXKDCJUAGZPVTYCHIXVFTVTCXMKHZFTXSMMQVFXZGKHCIYODDRZEYECDLKNG\\r\\nPEXXCTRFJAAKPOTBAEFRLDRZKORNMXHHXTLKMKCGPVPUOBELPLFQFXOBZWIVIQCHEJQPXKGSCQAWIMETCJVTAGXJIINTADDXJTKQ\\r\\nQURSEKPMSSEVQZI\\r\\n', 'output': ['ETFTBRDKOXKCGPVFVCHQXKCIECDK', 'EKTFRZRXMGFFXOZVCHXCMTVGIDDK', 'ETFTBRDKOXKCGPVXVCHQXKCIECDK', 'EKTFRZNXMGFFXIJXKCATCVTXTDDK', 'EKTFRZNXMGFFXIJXKCATCVTXIDDK']}, {'input': 'ZFFBNYVXOZCJPSRAEACVPAUKVTCVZYQPHVENTKOCMHNIYYMIKKLNKHLWHHWAQMWFTSYEOQQFEYAAYGMPNZCRYBVNAQTDSLXZGBCG\\r\\nPIQHLNEWAMFAKGHBGZAWRWAXCSKUDZBDOCTXAHSVFZACXGFMDSYBYYDDNQNBEZCYCULSMMPBTQOJQNRPZTRCSDLIYPLVUGJPKDTG\\r\\nZBFJPLNAKWQBTUVJKMHVBATAM\\r\\n', 'output': ['FBZRACKZOCHAFSYYYNZCYBQTSLGG', 'FBZAACKZOCHAFSYYYNZCYBQTSLGG', 'FBZRACKZOCHAMSYYYNZCYBNTDLGG', 'FBZRACUZOCHAMSYYYNZCYBNTDLGG']}, {'input': 'BTWZLIKDACZVLCKMVTIQHLFBNRCBDSWPFFKGPCQFPTOIJLPFCDMFGQKFHTDFFCCULUAYPXXIIIWBZIDMOPNHPZBEXLVARJFTBFOE\\r\\nMDXYKKWZVASJPPWRCYNMRAOBBLUNBSMQAPCPSFAGLXWJRBQTBRWXYNQGWECYNFIAJXDMUHIIMDFMSHLPIMYQXNRRUSSNXALGNWIK\\r\\nKNFVBVAOWXMZVUHAVUDKDBUVAKNHACZBGBHMUOPHWGQSDFXLHB\\r\\n', 'output': ['WZACMLNBSPFGCFIJDMHDFLPIMNXL', 'WZACLMQLBRWGCFIJDMHDFLPIMNXL', 'WZACMBNBSPFGQTIJDMHDFLPIMNXA', 'WZVCMLNBSPFGCFIJDMHDFLPIMNXL', 'WZACMLNBSPFGQTIJDMHDFLPIMNXL', 'DZVCMBNBSPFGCFIJDMHDFLPIMNXA']}, {'input': 'GOZVMIRQIGYGVAGOREQTXFXPEZYOJOXPNDGAESICXHMKQDXQPRLMRVWHXFEJVCWZDLYMQLDURUXZPTLEHPTSKXGSNEQDKLVFFLDX\\r\\nIMEVFCZXACKRRJVXDRKFWTLTRTLQQDHEBZLCOCNVPABQMIWJHRLKFUKWOVVWGGNWCJNRYOYOAJFQWCLHQIQRBZTVWKBFOXKEHHQP\\r\\nSZ\\r\\n', 'output': ['IEFZXACKRRVXFWLRTLHPKGNQLVFX', 'IVARXFEZONAIHRLVWJWLQRZTKXEQ', 'MVARXFEZOPAIHRLVWFCLQRZTKXEQ']}, {'input': 'BBYUVCIYLNUJPSEYCAAPQSDNSDDTNEHQZDPBEKQAWNAKEYFBNEEBGPDPRLCSVOWYDEDRPPEDOROCHRCNQUSPNVXGRXHNLKDETWQC\\r\\nBQCQXCAHADGJHBYIKEUWNXFUOOTVCCKJPJJCMWLAWWKSDGHFNZTCPSQNRTPCBLXDTSJLRHSCCZXQXCVLVGTROOUCUQASIQHZGNEI\\r\\nRYE\\r\\n', 'output': ['BBYUVCJPCASDNZPQNBDRLVROOCQSGNE', 'BBYINUJPCASDHZPQNPDRSVROOCUSHNE', 'BBYINUJPCASDHZPQNPDLSVROOCUSHNE', 'BBYUVCJPCASDNTPQNBDRLVROOCQSGNE', 'BBYUVCJPCASDNTPQNBDLCVROOCQSGNE']}, {'input': 'WZRKLETJRBBRZKGHEFBVEFVLIERBPSEGJVSNUZUICONWWBOOTHCOJLLZFNOCNOFJQZTZWBLKHGIWWWPBUYWBAHYJGEBJZJDTNBGN\\r\\nZINFGDCNKHYFZYYWHTIHZTKWXXXMSWOVOPQDTRWSQKBWWCPEMYFVGARELELBLGEVJCMOCFTTUVCYUQUSFONAMWKVDWMGXVNZJBWH\\r\\nAFPA\\r\\n', 'output': ['WZKTRKBEFVLEBGVCOTCFONWKWGZJB', 'WZKTRBEFVELEBEJCOTCFONWKWGZJB', 'WZKTRBEFVELEBGVCOTCFONWKWGZJB', 'WZKTRKEFVELEBEJCOTCFONWKWGZJB']}, {'input': 'ABABABB\\r\\nABABABB\\r\\nABABB\\r\\n', 'output': ['ABABAB', 'ABBABB']}, {'input': 'ABBB\\r\\nABBB\\r\\nABB\\r\\n', 'output': ['BBB']}, {'input': 'A\\r\\nBABAABAAABABABABABABAABABABABBABABABABAABBABBABAABABAABAABBAAAAAABBABABABABAABABAABABABABAABAABABABA\\r\\nB\\r\\n', 'output': ['A']}, {'input': 'ABBAABAAABABAABAABABABABAABBBABABABAAABBABAAABABABABBABBABABAABABABABABABBABAABABAABABABAAABBABABABA\\r\\nA\\r\\nB\\r\\n', 'output': ['A']}, {'input': 'ABBBABABABABABBABAABAAABABAABABABABBABAAAABABABBABAABABAAABAABBAAABAABABBABBABABBABAABABABAAAAABABAB\\r\\nB\\r\\nBABBABAABABABABABABABABABBAABABBABABBAAABAAABABBAABAABBABABBABABAABBABAABABBAABAABAABABABABABBABABAB\\r\\n', 'output': ['B']}, {'input': 'AABABAABAAABABAAABAAAABBAAABABAAABABAABAABAAAABAABAAAABAAAABAAAABBAABAAAAABAAAAABABAAAAAABABAABAAAAA\\r\\nABAABABABAAABABAABABBAABAABAABABAABABAAABBAABAAAABABABAAAAABAAAAABABABABAABAABAABAABABAABABAABAABAAB\\r\\nBABAAABABBAABABAABAA\\r\\n', 'output': ['AABABABAAABABAAABAAAABAABABAABABAABAABAAAABAABAAAABAAAABAAABAABAAAABAABABAABABAABAAAA', 'ABAABABABAAABAAAABBAABAAAABABAABABAAABAABAAAABAAAAAAABAAAAAAABAAAAABAAAAAAABABAABAAAA', 'AABABABAAABABAAABAAAABAABABAAABAAABAABAAAABAABAAAABAAAABAAABAABAAAABAABABAABABAABAAAA', 'ABAABABABAAABAAAABBAAAABAABABAABABAAABAABAAAABAABAAAAABAAAAABAAAAABABAAAAAABABAABAAAA', 'AABABABAAABABAABABBAABABAABABAABABAAABAABAAAABABAAAAAABAAAAABAAAAABABAAAAAABABAABAAAA', 'ABAABABABAAABAAAABBAAAABAABABAABABAAABAABAAAABAAAAAAABAAAAAAABAAAAABABAAAAABABAABAAAA', 'ABAABABABAAABAAAABBAABABAABABAABABAAABAABAAAABABAAAAAABAAAAABAAAAABABAAAAAABABAABAAAA', 'ABAABABABAAABAAAABBAABAAAABABAABABAAABAABAAAABAABAAAABAAAAAAABAAAAABAAAAAAABABAABAAAA']}, {'input': 'AABABABABAAAABBAAAABABABABAAAAABABAAAA\\r\\nAABABAAABABABAAABAAAAABAAABAAABABABBBABBAAABAABAAAAABABBABAAABAABAABABAAAABABAAABAAABAABABBBABBABABA\\r\\nAAAAA\\r\\n', 'output': ['AABABABABAAAABBAAAABABABABAAAABABAAAA']}, {'input': 'ZZXXAAZZAXAAZZAZZXXAAZZAXAXZZXXAAZZZZXXAZZXXAAAZZXXAAAZZXXZZXXXAAAZZXZZXXAZZXXZXXAAXAAZZZXXAXAXAZZXZ\\r\\nAZZXXAAZZXXAAXZXXAZZXAZZXZZXXAAZZXXAAZAAZZAAZZXXAA\\r\\nAAZZXAAXXAAAZZXXAZZXXAAZZXXAAAZZXXZ\\r\\n', 'output': ['ZZXXAAZZXXAAXZXXAZZXAZZXZZXXAAZZXXAAZAZZAAZZXXAA', 'ZZXXAAZZXXAAXZXXAZZXAZZXZZXXAAZZXXAAAAZZAAZZXXAA', 'AZZXAAZZXXAAXZXXAZZXAZZXZZXXAAZZXXAAZAZZAAZZXXAA']}, {'input': 'SDASSDADASDASDASDSDADASASDAAASDASDDASDDASDADASDASDSSDASDD\\r\\nSDASDASDDASDASDASDSDSDASDASDASDASDASDASDASDADASDASDASDSDASDASDDDASSD\\r\\nSDASDSDDAA\\r\\n', 'output': ['SDASSDADASDASDSDSDADASASDAAASDASDDASDDASDDASDASDDASD', 'SDASSDDASDASDASDSDDASASDAASDASDDASDDASDADASDSDSSDASD', 'SDASDADASDASDASDSDADASASDASDASDASDASDADASDASDSSDASDD', 'SDASSDDASDASDASDSDDASASDAASDASDDASDDASDADASDSDSDASDD', 'SDASDADASDASDASDSDADASASDAASDASDASDDASDADASDASDSDASD', 'SDASDADASDASDASDSDDASASDAASDASDDASDDASDADASDSDSSDASD', 'SDASDADASDASDASDSDDASASDASDASDASDDASDADASDASDSSDASDD']}, {'input': 'DASSDASDASDDAASDASDADASDASASDAS\\r\\nSDADASDASSDAASDASDASDADASSDDA\\r\\nSD\\r\\n', 'output': ['DADADADAADADADADASSA', 'DADASASAASASADADASSA']}, {'input': 'ASDASSDASDS\\r\\nDASDASDDDASDADASDASDASDASSDADASDDAASDA\\r\\nDSD\\r\\n', 'output': ['ASDASSDASDS']}, {'input': 'ASDASASDASDASDAASDASDASDASASDDAASDASSASDSDAD\\r\\nDASDASSSDASDASDASASDASSDAASDASSDDSASDASDAASDDAASDASDAASDASDDASDASDASDASDASS\\r\\nDASD\\r\\n', 'output': ['ASDASASDASASDAASDASASDASASDDAASDASSASDSDAD']}, {'input': 'DASDSDASDADASDDDSDASSDDAASDA\\r\\nDASDDASDSDADSDASDADSDSDADDASDASDDASDASDASDSDASD\\r\\nDAASD\\r\\n', 'output': ['DASDSDASDADASDDDSDASSDDASDA']}, {'input': 'ABAAAABABADABAABAABCCABADABACABACABCABADABADABACABBACAADABACABABACABADABACABABA\\r\\nBACAACABABABACABCABADABAACABADABACABAA\\r\\nABBAB\\r\\n', 'output': ['BACAACABABABACABCAADABAACABADABACABAA', 'BACAACABABABACABCABAABAACABADABACABAA', 'BAAACABABABACABCABADABAACABADABACABAA']}, {'input': 'ABAABACABADAACADABACAAB\\r\\nBAACABADABACABAAAADADAABACABACABADABABADABACABAADABBADABACAAACAABACABADABBBAA\\r\\nDABACA\\r\\n', 'output': ['ABAABACABADAACAABACAAB', 'ABAABACABADAACADABAAAB']}, {'input': 'BACABACABAACABADABABACAABACABBACAACAACABCABADAACABAABAABBADABACABADABCABAD\\r\\nBACAABADABABADABACABABACABADABACABCBADABACADABCABABADAABA\\r\\nBADABAA\\r\\n', 'output': ['BACABAABABADABACAABACABAAACABCBADAACAABABABADAABA', 'BACAABADABABAABACABBACAAAACABCBADAACADABAABADAABA', 'BACAABAAABADABACAABACABAAACABCBADAACADABCABADAABA', 'BACAABADABABAABACABBACAAAACABCBADAACADABCABADAABA', 'BACAABAAABADABACAABACABAAACABCBADAACAABABABADAABA', 'BACABAABABADABACAABACABAAACABCBADAACADABCABADAABA']}, {'input': 'ACABADABACABCABAAB\\r\\nBADAB\\r\\nACAACABA\\r\\n', 'output': ['BADAB']}, {'input': 'ABABAC\\r\\nABABAC\\r\\nABAC\\r\\n', 'output': ['ABBAC', 'ABABA']}, {'input': 'BCBCBC\\r\\nBCBCBC\\r\\nBC\\r\\n', 'output': ['CCC', 'BBB', 'CCB']}, {'input': 'AAACAAACAAADAAAAAAA\\r\\nAADAAAAAAAACDAAAAAAAAAAACAAAAABCACAAACAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA\\r\\nAAACAADAAAAADD\\r\\n', 'output': ['AAACAAACAAAAAAAAAA']}, {'input': 'ABABBB\\r\\nABABBB\\r\\nABB\\r\\n', 'output': ['BBBB', 'ABAB']}, {'input': 'ABABABAC\\r\\nABABABAC\\r\\nABABAC\\r\\n', 'output': ['ABABBAC', 'ABBABAC', 'ABABABA']}, {'input': 'BBAABAAAAABBBBBBBABABAABAABAABBABABABBBABBABBABBBABAABBBBBBAABAAAAAAAAABABAAABBABBAAAAAABAABABBAAABB\\r\\nBBAABAAAAABBBBBBBABABAABAABAABBABABABBBABBABBABBBABAABBBBBBAABAAAAAAAAABABAAABBABBAAAAAABAABABBAAABB\\r\\nBBBAA\\r\\n', 'output': ['BBAABAAAAABBBBBBBABABAABAABAABBABABABBBABBABBABBBABAABBBBBBABAAAAAAAAABABAAABBABBAAAAAABAABABBAAABB']}, {'input': 'ABABC\\r\\nABABC\\r\\nABC\\r\\n', 'output': ['ABBC', 'ABAB']}, {'input': 'BABBB\\r\\nBABBB\\r\\nABB\\r\\n', 'output': ['BBBB']}, {'input': 'ABCCCCCCCC\\r\\nABCCCCCCCC\\r\\nABC\\r\\n', 'output': ['BCCCCCCCC', 'ACCCCCCCC']}]","id":555} {"difficulty":2700,"lang":"Rust","lang_cluster":"Rust","src_uid":"40002052843ca0357dbd3158b16d59f4","execute_outcome":"WRONG_ANSWER","source_code":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/ \u3053\u3053\u307e\u3067\n\nfn run() {\n input! {\n n: usize,\n a: [usize; n],\n }\n let m = 5000;\n let mut weight = vec![0; m + 1];\n for a in a {\n if a == 0 {\n weight[1] += 1;\n } else {\n weight[a] += 1;\n }\n }\n let mut factor: Vec = vec![m; m + 1];\n let mut prime = vec![];\n for i in 2..=m {\n if factor[i] == m {\n for j in 1..=(m \/ i) {\n factor[j * i] = prime.len();\n }\n prime.push(i);\n }\n }\n let mut cnt = vec![vec![0; prime.len()]; m + 1];\n for i in 2..=m {\n let mut c = cnt[i - 1].clone();\n let mut t = i;\n while t > 1 {\n let k = factor[t];\n let p = prime[k];\n while t % p == 0 {\n c[k] += 1;\n t \/= p;\n }\n }\n cnt[i] = c;\n }\n let mut root_sum = 0u64;\n for i in 1..=m {\n root_sum += cnt[i].iter().fold(0, |s, a| s + *a) * weight[i];\n }\n let all = n as u64;\n let root_sum = root_sum;\n let mut dfs = vec![];\n for i in 0..prime.len() {\n let mut c = 0;\n let r = if i == prime.len() - 1 {m + 1} else {prime[i + 1]};\n for j in prime[i]..r {\n c += weight[j];\n }\n dfs.push((prime[i], r, i, 1, c, root_sum - c + all - c));\n }\n let mut ans = root_sum;\n while let Some((l, r, index, num, sum, w)) = dfs.pop() {\n ans = std::cmp::min(ans, w);\n if sum == 0 || l >= r || index >= prime.len() {\n continue;\n }\n if cnt[l][index] > num {\n dfs.push((l, r, index, num + 1, sum, w + all - 2 * sum));\n } else if cnt[l][index] == cnt[r - 1][index] {\n dfs.push((l, r, index - 1, 1, sum, w + all - 2 * sum));\n } else {\n let mut zero = 0;\n let mut k = l;\n while k < r && cnt[k][index] == cnt[l][index] {\n zero += weight[k];\n k += 1;\n }\n dfs.push((l, k, index - 1, 1, zero, w + all - 2 * zero));\n dfs.push((k, r, index, num + 1, sum - zero, w + all - 2 * (sum - zero)));\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n","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"],"human_solution":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/ \u3053\u3053\u307e\u3067\n\nfn run() {\n input! {\n n: usize,\n a: [usize; n],\n }\n let m = 5000;\n let mut weight = vec![0; m + 1];\n for a in a {\n if a == 0 {\n weight[1] += 1;\n } else {\n weight[a] += 1;\n }\n }\n let mut factor: Vec = vec![m; m + 1];\n let mut prime = vec![];\n for i in 2..=m {\n if factor[i] == m {\n for j in 1..=(m \/ i) {\n factor[j * i] = prime.len();\n }\n prime.push(i);\n }\n }\n let mut cnt = vec![vec![0; prime.len()]; m + 1];\n for i in 2..=m {\n let mut c = cnt[i - 1].clone();\n let mut t = i;\n while t > 1 {\n let k = factor[t];\n let p = prime[k];\n while t % p == 0 {\n c[k] += 1;\n t \/= p;\n }\n }\n cnt[i] = c;\n }\n let cnt = cnt;\n let mut root_sum = 0u64;\n for i in 1..=m {\n root_sum += cnt[i].iter().fold(0, |s, a| s + *a) * weight[i];\n }\n let all = n as u64;\n let root_sum = root_sum;\n let mut dfs = vec![(2, m + 1, prime.len() - 1, 0, all - weight[1], root_sum)];\n let mut ans = root_sum;\n while let Some((l, r, index, num, sum, w)) = dfs.pop() {\n ans = std::cmp::min(ans, w);\n if 2 * sum <= all || l >= r || index >= prime.len() {\n continue;\n }\n assert!(num <= cnt[l][index]);\n if cnt[l][index] > num {\n dfs.push((l, r, index, num + 1, sum, w + all - 2 * sum));\n } else if cnt[l][index] == cnt[r - 1][index] {\n dfs.push((l, r, index - 1, 0, sum, w));\n } else {\n let mut zero = 0;\n let mut k = l;\n while k < r && cnt[k][index] == cnt[l][index] {\n zero += weight[k];\n k += 1;\n }\n dfs.push((l, k, index - 1, 0, zero, w));\n dfs.push((k, r, index, num, sum - zero, w));\n }\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\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":556} {"difficulty":1600,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"46_C","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(non_snake_case)]\r\n#[allow(dead_code)] fn read_line() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\nfn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\nstruct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\nmacro_rules! init {($name: ident) => {let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nuse std::collections::VecDeque;\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let _n = read::();\r\n let inp = read_line();\r\n\r\n\r\n \/\/let inp = \"HTHTHTHHT\";\r\n\r\n\r\n let cycle = inp.chars().collect::>();\r\n\r\n let h_cnt = cycle.iter().filter(|&&ch| ch=='H').count();\r\n\r\n let mut t_cnt = i32::MAX;\r\n for i in 0..cycle.len() {\r\n let mut remain = h_cnt;\r\n let mut c = 0;\r\n for j in i..i+cycle.len() {\r\n if remain==0 {break}\r\n if cycle[j%cycle.len()]=='T' {c+=1};\r\n remain-=1;\r\n }\r\n if c String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\nfn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\nstruct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\nmacro_rules! init {($name: ident) => {let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nuse std::collections::VecDeque;\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let _n = read::();\r\n let inp = read_line();\r\n\r\n\r\n \/\/ let inp = \"HTHTHTHHT\";\r\n\r\n\r\n let cycle = inp.chars().collect::>();\r\n\r\n let h_cnt = cycle.iter().filter(|&&ch| ch=='H').count();\r\n\r\n let mut t_cnt = i32::MAX;\r\n for i in 0..cycle.len() {\r\n let mut remain = h_cnt;\r\n let mut c = 0;\r\n for j in i..i+cycle.len() {\r\n if remain==0 {break}\r\n if cycle[j%cycle.len()]=='T' {c+=1};\r\n remain-=1;\r\n }\r\n if c = s.split_whitespace().map(|x| x.parse().unwrap()).collect();\n\n let n = s[0];\n let m = s[1];\n\n let mut cols: Vec = [].to_vec();\n let mut rows: Vec = [].to_vec();\n let mut board: Vec> = [].to_vec();\n\n for k in 0..n {\n let mut x = String::new();\n std::io::stdin().read_line(&mut x).unwrap();\n let x: Vec = x.chars().collect::>()[..m as usize].to_vec();\n board.push(x.clone());\n\n rows.push(0);\n\n for (i, &e) in x.iter().enumerate() {\n if e == '*' {\n rows[k as usize] += 1;\n }\n if k == 0 {\n cols.push(if e == '*' { 1 } else { 0 });\n }\n else {\n if e == '*' {\n cols[i] += 1;\n }\n }\n }\n }\n\n let mut count = 0;\n\n for i in 0..n {\n for j in 0..m {\n if board[i as usize][j as usize] == '*' {\n count += (rows[i as usize] - 1) * (cols[j as usize] - 1);\n }\n }\n }\n\n println!(\"{}\", count);\n}\n","description":"You are given a n\u00d7m field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A right triangle is a triangle in which one angle is a right angle (that is, a 90 degree angle).","input_specification":"The first line contains two positive integer numbers n and m (1\u2264n,m\u22641000). The following n lines consist of m characters each, describing the field. Only '.' and '*' are allowed.\n","output_specification":"Output a single number \u2014 total number of square triangles in the field. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","notes":null,"sample_inputs":["2 2\n**\n*.\n","3 4\n*..*\n.**.\n*.**\n"],"sample_outputs":["1\n","9\n"],"human_solution":"#[allow(dead_code)] fn read_line() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\nfn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\nstruct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\nmacro_rules! init {($name: ident) => {let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let line0 = read_vec::();\r\n let n = line0[0]; let m = line0[1];\r\n let mtx = (0..n).map(|_| read_line()).collect::>();\r\n\r\n\r\n \/\/ let mtx = vec![\r\n \/\/ \"*..*\",\r\n \/\/ \".**.\",\r\n \/\/ \"*.**\",\r\n \/\/ ];\r\n\r\n \/\/ let mtx = vec![\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 let mtx = mtx.iter().map(|s| s.chars().collect::>()).collect::>();\r\n let row_c = mtx.len();\r\n let col_c = mtx[0].len();\r\n let mut rs = vec![0; row_c];\r\n let mut cs = vec![0; col_c];\r\n for r in 0..row_c {\r\n for c in 0..col_c {\r\n if mtx[r][c] == '*' {\r\n rs[r] += 1;\r\n cs[c] += 1;\r\n }\r\n }\r\n }\r\n let mut cnt: u128 = 0;\r\n for r in 0..row_c {\r\n for c in 0..col_c {\r\n if mtx[r][c] == '*' {\r\n cnt += (rs[r]-1)*(cs[c]-1);\r\n }\r\n }\r\n }\r\n\r\n println!(\"{cnt}\");\r\n}\r\n","testcases":"[{'input': ['2 2\\r\\n**\\r\\n*.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 4\\r\\n*..*\\r\\n.**.\\r\\n*.**\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3 2\\r\\n..\\r\\n..\\r\\n*.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 2\\r\\n**\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 3\\r\\n*.*\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 2\\r\\n*.\\r\\n**\\r\\n.*\\r\\n..\\r\\n.*\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 3\\r\\n.*.\\r\\n**.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n**.\\r\\n..*\\r\\n*.*\\r\\n*.*\\r\\n*..\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['4 2\\r\\n**\\r\\n**\\r\\n.*\\r\\n**\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['5 2\\r\\n**\\r\\n**\\r\\n**\\r\\n*.\\r\\n*.\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['2 3\\r\\n***\\r\\n.*.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 2\\r\\n.*\\r\\n.*\\r\\n..\\r\\n..\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['13 26\\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': ['65889\\r\\n']}, {'input': ['2 1\\r\\n.\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n*\\r\\n*\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\n*\\r\\n'], 'output': ['0\\r\\n']}]","id":558} {"difficulty":2400,"lang":"Rust","lang_cluster":"Rust","src_uid":"63e130256e23bd0693c6a1bede5e937e","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/spnauti-rusT {{{\nuse std::io::*; use std::str::{self,*}; use std::fmt::Debug;\n#[allow(unused_imports)] use std::cmp::Ordering::{self,*};\n#[allow(unused_imports)] use std::ops::{self,*};\n#[allow(unused_imports)] use std::iter::{self,*};\n#[allow(unused_imports)] use std::collections::*;\n#[allow(unused_imports)] use std::cell::*;\n#[allow(unused_macros)] macro_rules! m {\n\t($c:tt,$x:expr,$y:expr) => {{\n\t\tlet b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}\n\t}};\n}\n#[allow(unused_macros)] macro_rules! l {\n\t($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};\n\t($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};\n\t(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};\n\t(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};\n}\n#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }\n#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }\n#[allow(dead_code)] fn writer() -> BufWriter { BufWriter::new(stdout()) }\nstruct WordReaderC {buf: Vec, pos: usize, q: std::io::StdinLock<'static>}\/\/'\n#[allow(dead_code)] impl WordReaderC {\n\tfn new() -> Self {\n\t\tlet r = unsafe {&*Box::into_raw(Box::new(stdin()))};\n\t\tSelf { q: r.lock(), buf: Vec::new(), pos: 0 }\n\t}\n\tfn next_line(&mut self) -> bool {\n\t\tself.buf.clear(); self.pos = 0;\n\t\tself.q.read_until(b'\\n', &mut self.buf).unwrap_or(0) > 0\n\t}\n\tfn is_ws(c: u8) -> bool {\n\t\tc == b' ' || c == b'\\r' || c == b'\\n' || c == b'\\t'\n\t}\n\tfn byte(&mut self) -> Option {\n\t\tif self.pos == self.buf.len() { if !self.next_line() { return None; } }\n\t\tself.pos += 1; Some(self.buf[self.pos - 1])\n\t}\n\tfn vb(&mut self) -> Vec {\n\t\tlet mut s = Vec::with_capacity(8);\n\t\tlet mut f = false;\n\t\tloop {\n\t\t\tif let Some(c) = self.byte() {\n\t\t\t\tif !Self::is_ws(c) {\n\t\t\t\t\ts.push(c);\n\t\t\t\t\tf = true;\n\t\t\t\t} else if f { break; }\n\t\t\t} else { break; }\n\t\t}\n\t\ts\n\t}\n\tfn s(&mut self) -> String { String::from_utf8(self.vb()).expect(\"invalid utf8\") }\n\tfn i(&mut self) -> i32 { self.p() }\n\tfn l(&mut self) -> i64 { self.p() }\n\tfn u(&mut self) -> usize { self.p() }\n\tfn f(&mut self) -> f64 { self.p() }\n\tfn vi(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vl(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vu(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn ii(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn iu(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn p(&mut self) -> T where T::Err: Debug {\n\t\tlet w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::().unwrap()\n\t}\n\tfn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n\t\t(0..n).map(|_|self.p()).collect()\n\t}\n\tfn ip(&mut self, n: usize) -> impl Iterator where T::Err: Debug {\n\t\tself.vp(n).into_iter()\n\t}\n}\n\/\/------------------- End rusT }}}\n\n\/\/ Mint (mod any) {{{\n#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Default)] struct Mint(i32,i32);\n#[allow(dead_code)] impl Mint {\n\tfn new>(a: T, m: T) -> Self { Self(Self::cv(a,m),m.into() as i32) }\n\tunsafe fn new_unchecked(a: i32, m: i32) -> Self { Self(a,m) }\n\tfn hi(mut a: i32, m: i32) -> i32 { if a >= m { a -= m; } a }\n\tfn lo(mut a: i32, m: i32) -> i32 { if a < 0 { a += m; } a }\n\tfn cv>(a: T, m: T) -> i32 { Self::lo((a.into() % m.into()) as i32, m.into() as i32) }\n\tunsafe fn inv(self) -> Self { self.pow(self.1-2) } \/\/ ONLY FOR PRIMES!\n\tfn pow>(self, b: T) -> Self {\n\t\tlet b = b.into(); if b == 0 { Self(1,self.1) } else {\n\t\t\tlet mut res = self.pow(b\/2); res *= res; if b % 2 == 1 {res *= self;} res\n\t\t}\n\t}\n}\nimpl Add for Mint { type Output = Self; fn add(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::hi(self.0 + a.0, self.1), self.1) }}\nimpl Sub for Mint { type Output = Self; fn sub(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::lo(self.0 - a.0, self.1), self.1) }}\nimpl Mul for Mint { type Output = Self; fn mul(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::cv(self.0 as i64 * a.0 as i64, self.1 as i64), self.1) }}\nimpl Div for Mint { type Output = Self; fn div(self, a: Self) -> Self::Output { self * unsafe {a.inv()} }}\nimpl Neg for Mint { type Output = Self; fn neg(self) -> Self::Output { Self(Self::lo(-self.0, self.1), self.1) }}\nimpl AddAssign for Mint { fn add_assign(&mut self, a: Self) { *self = *self + a; } }\nimpl SubAssign for Mint { fn sub_assign(&mut self, a: Self) { *self = *self - a; } }\nimpl MulAssign for Mint { fn mul_assign(&mut self, a: Self) { *self = *self * a; } }\nimpl DivAssign for Mint { fn div_assign(&mut self, a: Self) { *self = *self \/ a; } }\nuse std::fmt::{Display, Formatter, Result};\nimpl Display for Mint { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }\n\/\/}}}\n\n\/\/ Square Matrix {{{\ntype MatT = Mint;\n#[derive(Debug,Clone)] struct Mat { n: usize, a: Vec, v0: MatT, v1: MatT }\n#[allow(dead_code)] impl Mat {\n\tfn new(n:usize,v0:MatT,v1:MatT)->Self{Self{n,a:vec![v0;n*n],v0,v1}}\n\tfn diag(n:usize,v0:MatT,v1:MatT,v:MatT)->Self{let mut m=Self::new(n,v0,v1);let mut p=0;for _ in 0..n{m.a[p]=v;p+=n+1;}m}\n\tfn pow(&self,n:u64)->Self{if n==0{Self::diag(self.n,self.v0,self.v1,self.v1)}else{let mut t=self.pow(n\/2);t*=t.clone();if n%2==1{t*=self.clone();}t}}\n\tfn range(&self,r:Range,c:Range)->Vec>{if r.startMatT{self.a[r*self.n+c]}\n\tfn at_mut<'a>(&'a mut self,r:usize,c:usize)->&'a mut MatT{&mut self.a[r*self.n+c]}\/\/'\n}\nimpl Mul for Mat{type Output=Self;fn mul(self,o:Self)->Self::Output{assert!(self.n==o.n);let n=self.n;let mut res=Self::new(n,self.v0,self.v1);\n\tfor ii in(0..n).map(|i|i*n){for j in 0..n{let mut t=self.v0;let mut kk=j;for k in 0..n{t+=self.a[ii+k]*o.a[kk];kk+=n;}res.a[ii+j]=t;}}res}}\nimpl Add for Mat{type Output=Self;fn add(mut self,o:Self)->Self{self+=o;self}}\nimpl Sub for Mat{type Output=Self;fn sub(mut self,o:Self)->Self{self-=o;self}}\nimpl MulAssign for Mat{fn mul_assign(&mut self,a:Self){*self=self.clone()*a;}}\nimpl AddAssign for Mat{fn add_assign(&mut self,o:Self){assert!(self.n==o.n);for(x,y)in self.a.iter_mut().zip(o.a.into_iter()){*x+=y;}} }\nimpl SubAssign for Mat{fn sub_assign(&mut self,o:Self){assert!(self.n==o.n);for(x,y)in self.a.iter_mut().zip(o.a.into_iter()){*x-=y;}} }\nimpl PartialEq for Mat{fn eq(&self,o:&Self)->bool{self.n==o.n&&self.a==o.a}}impl Eq for Mat{}\n\/\/ }}}\n\nfn main() {\n\tlet mut rin = reader();\n\tlet mut rout = writer();\n\n\tl!(m,l,r,k = rin.l());\n\tlet g = || -> i64 {\n\t\tfor d in (1..(r-l)\/(k-1)).rev() {\n\t\t\tif r \/ d - (l-1) \/ d >= k {\n\t\t\t\treturn d;\n\t\t\t}\n\t\t}\n\t\tpanic!(\"no\")\n\t}();\n\tlet f1 = Mint::new(1,m);\n\tlet f0 = Mint::new(0,m);\n\tlet mut mat = Mat::new(2,f0,f1);\n\t*mat.at_mut(0,0) = f0;\n\t*mat.at_mut(0,1) = f1;\n\t*mat.at_mut(1,0) = f1;\n\t*mat.at_mut(1,1) = f1;\n\tlet sol = mat.pow(g as u64).at(0,1);\n\twriteln!(rout, \"{}\", sol).ok();\n}\n\n","description":"There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations.Dima is sure that it'll be great to learn to solve the following problem by the Big Day: You're given a set A, consisting of numbers l, l\u2009+\u20091, l\u2009+\u20092, ..., r; let's consider all its k-element subsets; for each such subset let's find the largest common divisor of Fibonacci numbers with indexes, determined by the subset elements. Among all found common divisors, Dima is interested in the largest one.Dima asked to remind you that Fibonacci numbers are elements of a numeric sequence, where F1\u2009=\u20091, F2\u2009=\u20091, Fn\u2009=\u2009Fn\u2009-\u20091\u2009+\u2009Fn\u2009-\u20092 for n\u2009\u2265\u20093.Dima has more than half a century ahead to solve the given task, but you only have two hours. Count the residue from dividing the sought largest common divisor by m.","input_specification":"The first line contains four space-separated integers m, l, r and k (1\u2009\u2264\u2009m\u2009\u2264\u2009109;\u00a01\u2009\u2264\u2009l\u2009<\u2009r\u2009\u2264\u20091012;\u00a02\u2009\u2264\u2009k\u2009\u2264\u2009r\u2009-\u2009l\u2009+\u20091). 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 residue from dividing the sought greatest common divisor by m.","notes":null,"sample_inputs":["10 1 8 2","10 1 8 3"],"sample_outputs":["3","1"],"human_solution":"\/\/spnauti-rusT {{{\nuse std::io::*; use std::str::{self,*}; use std::fmt::Debug;\n#[allow(unused_imports)] use std::cmp::Ordering::{self,*};\n#[allow(unused_imports)] use std::ops::{self,*};\n#[allow(unused_imports)] use std::iter::{self,*};\n#[allow(unused_imports)] use std::collections::*;\n#[allow(unused_imports)] use std::cell::*;\n#[allow(unused_macros)] macro_rules! m {\n\t($c:tt,$x:expr,$y:expr) => {{\n\t\tlet b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}\n\t}};\n}\n#[allow(unused_macros)] macro_rules! l {\n\t($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};\n\t($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};\n\t(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};\n\t(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};\n}\n#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }\n#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }\n#[allow(dead_code)] fn writer() -> BufWriter { BufWriter::new(stdout()) }\nstruct WordReaderC {buf: Vec, pos: usize, q: std::io::StdinLock<'static>}\/\/'\n#[allow(dead_code)] impl WordReaderC {\n\tfn new() -> Self {\n\t\tlet r = unsafe {&*Box::into_raw(Box::new(stdin()))};\n\t\tSelf { q: r.lock(), buf: Vec::new(), pos: 0 }\n\t}\n\tfn next_line(&mut self) -> bool {\n\t\tself.buf.clear(); self.pos = 0;\n\t\tself.q.read_until(b'\\n', &mut self.buf).unwrap_or(0) > 0\n\t}\n\tfn is_ws(c: u8) -> bool {\n\t\tc == b' ' || c == b'\\r' || c == b'\\n' || c == b'\\t'\n\t}\n\tfn byte(&mut self) -> Option {\n\t\tif self.pos == self.buf.len() { if !self.next_line() { return None; } }\n\t\tself.pos += 1; Some(self.buf[self.pos - 1])\n\t}\n\tfn vb(&mut self) -> Vec {\n\t\tlet mut s = Vec::with_capacity(8);\n\t\tlet mut f = false;\n\t\tloop {\n\t\t\tif let Some(c) = self.byte() {\n\t\t\t\tif !Self::is_ws(c) {\n\t\t\t\t\ts.push(c);\n\t\t\t\t\tf = true;\n\t\t\t\t} else if f { break; }\n\t\t\t} else { break; }\n\t\t}\n\t\ts\n\t}\n\tfn s(&mut self) -> String { String::from_utf8(self.vb()).expect(\"invalid utf8\") }\n\tfn i(&mut self) -> i32 { self.p() }\n\tfn l(&mut self) -> i64 { self.p() }\n\tfn u(&mut self) -> usize { self.p() }\n\tfn f(&mut self) -> f64 { self.p() }\n\tfn vi(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vl(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn vu(&mut self, n: usize) -> Vec { self.vp(n) }\n\tfn ii(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn iu(&mut self, n: usize) -> impl Iterator { self.ip(n).into_iter() }\n\tfn p(&mut self) -> T where T::Err: Debug {\n\t\tlet w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::().unwrap()\n\t}\n\tfn vp(&mut self, n: usize) -> Vec where T::Err: Debug {\n\t\t(0..n).map(|_|self.p()).collect()\n\t}\n\tfn ip(&mut self, n: usize) -> impl Iterator where T::Err: Debug {\n\t\tself.vp(n).into_iter()\n\t}\n}\n\/\/------------------- End rusT }}}\n\n\/\/ Mint (mod any) {{{\n#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Default)] struct Mint(i32,i32);\n#[allow(dead_code)] impl Mint {\n\tfn new>(a: T, m: T) -> Self { Self(Self::cv(a,m),m.into() as i32) }\n\tunsafe fn new_unchecked(a: i32, m: i32) -> Self { Self(a,m) }\n\tfn hi(mut a: i32, m: i32) -> i32 { if a >= m { a -= m; } a }\n\tfn lo(mut a: i32, m: i32) -> i32 { if a < 0 { a += m; } a }\n\tfn cv>(a: T, m: T) -> i32 { Self::lo((a.into() % m.into()) as i32, m.into() as i32) }\n\tunsafe fn inv(self) -> Self { self.pow(self.1-2) } \/\/ ONLY FOR PRIMES!\n\tfn pow>(self, b: T) -> Self {\n\t\tlet b = b.into(); if b == 0 { Self(1,self.1) } else {\n\t\t\tlet mut res = self.pow(b\/2); res *= res; if b % 2 == 1 {res *= self;} res\n\t\t}\n\t}\n}\nimpl Add for Mint { type Output = Self; fn add(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::hi(self.0 + a.0, self.1), self.1) }}\nimpl Sub for Mint { type Output = Self; fn sub(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::lo(self.0 - a.0, self.1), self.1) }}\nimpl Mul for Mint { type Output = Self; fn mul(self, a: Self) -> Self::Output { assert!(self.1==a.1); Self(Self::cv(self.0 as i64 * a.0 as i64, self.1 as i64), self.1) }}\nimpl Div for Mint { type Output = Self; fn div(self, a: Self) -> Self::Output { self * unsafe {a.inv()} }}\nimpl Neg for Mint { type Output = Self; fn neg(self) -> Self::Output { Self(Self::lo(-self.0, self.1), self.1) }}\nimpl AddAssign for Mint { fn add_assign(&mut self, a: Self) { *self = *self + a; } }\nimpl SubAssign for Mint { fn sub_assign(&mut self, a: Self) { *self = *self - a; } }\nimpl MulAssign for Mint { fn mul_assign(&mut self, a: Self) { *self = *self * a; } }\nimpl DivAssign for Mint { fn div_assign(&mut self, a: Self) { *self = *self \/ a; } }\nuse std::fmt::{Display, Formatter, Result};\nimpl Display for Mint { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }\n\/\/}}}\n\n\/\/ Square Matrix {{{\ntype MatT = Mint;\n#[derive(Debug,Clone)] struct Mat { n: usize, a: Vec, v0: MatT, v1: MatT }\n#[allow(dead_code)] impl Mat {\n\tfn new(n:usize,v0:MatT,v1:MatT)->Self{Self{n,a:vec![v0;n*n],v0,v1}}\n\tfn diag(n:usize,v0:MatT,v1:MatT,v:MatT)->Self{let mut m=Self::new(n,v0,v1);let mut p=0;for _ in 0..n{m.a[p]=v;p+=n+1;}m}\n\tfn pow(&self,n:u64)->Self{if n==0{Self::diag(self.n,self.v0,self.v1,self.v1)}else{let mut t=self.pow(n\/2);t*=t.clone();if n%2==1{t*=self.clone();}t}}\n\tfn range(&self,r:Range,c:Range)->Vec>{if r.startMatT{self.a[r*self.n+c]}\n\tfn at_mut<'a>(&'a mut self,r:usize,c:usize)->&'a mut MatT{&mut self.a[r*self.n+c]}\/\/'\n}\nimpl Mul for Mat{type Output=Self;fn mul(self,o:Self)->Self::Output{assert!(self.n==o.n);let n=self.n;let mut res=Self::new(n,self.v0,self.v1);\n\tfor ii in(0..n).map(|i|i*n){for j in 0..n{let mut t=self.v0;let mut kk=j;for k in 0..n{t+=self.a[ii+k]*o.a[kk];kk+=n;}res.a[ii+j]=t;}}res}}\nimpl Add for Mat{type Output=Self;fn add(mut self,o:Self)->Self{self+=o;self}}\nimpl Sub for Mat{type Output=Self;fn sub(mut self,o:Self)->Self{self-=o;self}}\nimpl MulAssign for Mat{fn mul_assign(&mut self,a:Self){*self=self.clone()*a;}}\nimpl AddAssign for Mat{fn add_assign(&mut self,o:Self){assert!(self.n==o.n);for(x,y)in self.a.iter_mut().zip(o.a.into_iter()){*x+=y;}} }\nimpl SubAssign for Mat{fn sub_assign(&mut self,o:Self){assert!(self.n==o.n);for(x,y)in self.a.iter_mut().zip(o.a.into_iter()){*x-=y;}} }\nimpl PartialEq for Mat{fn eq(&self,o:&Self)->bool{self.n==o.n&&self.a==o.a}}impl Eq for Mat{}\n\/\/ }}}\n\nfn main() {\n\tlet mut rin = reader();\n\tlet mut rout = writer();\n\n\tl!(m,l,r,k = rin.l());\n\tif m == 1 {\n\t\twriteln!(rout, \"0\").ok();\n\t\treturn;\n\t}\n\tlet g = || -> i64 {\n\t\tlet mut a = Vec::new();\n\t\tfor d in 1.. {\n\t\t\tif d*d > r { break; }\n\t\t\ta.push(d);\n\t\t\ta.push(r\/d);\n\t\t\ta.push(l\/d);\n\t\t}\n\t\ta.sort();\n\t\ta.dedup();\n\t\ta.reverse();\n\t\tfor d in a {\n\t\t\tif r \/ d - (l-1) \/ d >= k {\n\t\t\t\treturn d;\n\t\t\t}\n\t\t}\n\t\tpanic!(\"no\")\n\t}();\n\tlet f1 = Mint::new(1,m);\n\tlet f0 = Mint::new(0,m);\n\tlet mut mat = Mat::new(2,f0,f1);\n\t*mat.at_mut(0,0) = f0;\n\t*mat.at_mut(0,1) = f1;\n\t*mat.at_mut(1,0) = f1;\n\t*mat.at_mut(1,1) = f1;\n\tlet sol = mat.pow(g as u64).at(0,1);\n\twriteln!(rout, \"{}\", sol).ok();\n}\n\n","testcases":"[{'input': '10 1 8 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '10 1 8 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 1 20 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '4 1 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1000000000 999000000000 1000000000000 1000000001\\r\\n', 'output': ['1\\r\\n']}, {'input': '643354696 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '829051283 4 9 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '549070627 2 6 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '275299363 7 8 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '232100782 7 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '466253512 1 10 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '828885826 8 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '572252279 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '888775378 3 6 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '524357331 2 4 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '467730377 5 8 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '999807424 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '355414109 1 5 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '90717740 9 10 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '733026150 5 8 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '820737413 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '689568719 4 8 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '657091243 1 6 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '386089541 8 9 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '863991268 3 4 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '854469356 260 555 272\\r\\n', 'output': ['1\\r\\n']}, {'input': '395611453 11 798 491\\r\\n', 'output': ['1\\r\\n']}, {'input': '740801616 319 352 7\\r\\n', 'output': ['5\\r\\n']}, {'input': '886543988 964 995 13\\r\\n', 'output': ['1\\r\\n']}, {'input': '724908834 353 435 21\\r\\n', 'output': ['2\\r\\n']}, {'input': '432953019 123 743 298\\r\\n', 'output': ['1\\r\\n']}, {'input': '162735738 722 830 28\\r\\n', 'output': ['2\\r\\n']}, {'input': '292717652 455 925 404\\r\\n', 'output': ['1\\r\\n']}, {'input': '469712955 323 637 310\\r\\n', 'output': ['1\\r\\n']}, {'input': '484442699 175 708 324\\r\\n', 'output': ['1\\r\\n']}, {'input': '352882236 334 543 68\\r\\n', 'output': ['2\\r\\n']}, {'input': '905420490 57 588 288\\r\\n', 'output': ['1\\r\\n']}, {'input': '718100546 681 908 124\\r\\n', 'output': ['1\\r\\n']}, {'input': '521756232 60 995 734\\r\\n', 'output': ['1\\r\\n']}, {'input': '999769304 477 723 17\\r\\n', 'output': ['610\\r\\n']}, {'input': '284765127 137 483 38\\r\\n', 'output': ['34\\r\\n']}, {'input': '378494626 818 910 16\\r\\n', 'output': ['5\\r\\n']}, {'input': '418350594 658 757 38\\r\\n', 'output': ['1\\r\\n']}, {'input': '239673066 510 755 145\\r\\n', 'output': ['1\\r\\n']}, {'input': '477001825 121 226 22\\r\\n', 'output': ['3\\r\\n']}, {'input': '850833562 487342 624253 15604\\r\\n', 'output': ['21\\r\\n']}, {'input': '776253168 501935 624447 5034\\r\\n', 'output': ['46368\\r\\n']}, {'input': '112740166 724250 820763 91354\\r\\n', 'output': ['1\\r\\n']}, {'input': '794434638 195429 577918 197816\\r\\n', 'output': ['1\\r\\n']}, {'input': '536970127 405424 806442 333727\\r\\n', 'output': ['1\\r\\n']}, {'input': '173120024 464152 639405 62848\\r\\n', 'output': ['1\\r\\n']}, {'input': '604322884 136811 746974 135514\\r\\n', 'output': ['3\\r\\n']}, {'input': '342085072 816702 835429 2448\\r\\n', 'output': ['13\\r\\n']}, {'input': '342603251 513651 575872 16399\\r\\n', 'output': ['2\\r\\n']}, {'input': '516990861 365331 514416 120353\\r\\n', 'output': ['1\\r\\n']}, {'input': '989814219 856344 952712 70116\\r\\n', 'output': ['1\\r\\n']}, {'input': '128436294 924501 935526 7097\\r\\n', 'output': ['1\\r\\n']}, {'input': '930753749 240762 304816 33119\\r\\n', 'output': ['1\\r\\n']}, {'input': '500334392 177018 213807 20966\\r\\n', 'output': ['1\\r\\n']}, {'input': '178728634 357695 636825 234054\\r\\n', 'output': ['1\\r\\n']}, {'input': '822435327 622352 898085 129237\\r\\n', 'output': ['1\\r\\n']}, {'input': '207799801 225575 230363 4101\\r\\n', 'output': ['1\\r\\n']}, {'input': '873274131 919071 929608 6597\\r\\n', 'output': ['1\\r\\n']}, {'input': '213233440 332735 968136 72864\\r\\n', 'output': ['21\\r\\n']}, {'input': '176747515 112573 755897 345857\\r\\n', 'output': ['1\\r\\n']}, {'input': '896461337 232014277619 307974127100 64176468973\\r\\n', 'output': ['1\\r\\n']}, {'input': '484166843 525464996401 759390764933 101689280407\\r\\n', 'output': ['1\\r\\n']}, {'input': '851697961 693161868155 911881110206 175212572235\\r\\n', 'output': ['1\\r\\n']}, {'input': '439334250 672097772941 732494615876 44664804365\\r\\n', 'output': ['1\\r\\n']}, {'input': '94204464 36087916686 718170323555 343248235244\\r\\n', 'output': ['1\\r\\n']}, {'input': '84735323 605652874739 762557619170 153822133015\\r\\n', 'output': ['1\\r\\n']}, {'input': '21360770 785066754170 842564125264 17876918461\\r\\n', 'output': ['2\\r\\n']}, {'input': '505249059 251318958163 361503770702 27100295491\\r\\n', 'output': ['3\\r\\n']}, {'input': '220688329 777936720815 906371247466 123531039142\\r\\n', 'output': ['1\\r\\n']}, {'input': '766452126 794358322395 934685493931 122085630645\\r\\n', 'output': ['1\\r\\n']}, {'input': '222429606 392998152462 915358102901 281100802425\\r\\n', 'output': ['1\\r\\n']}, {'input': '758880930 531051114359 641412554058 76266168689\\r\\n', 'output': ['1\\r\\n']}, {'input': '754070950 37040580265 233314567101 54515316227\\r\\n', 'output': ['2\\r\\n']}, {'input': '7417434 671183669261 881538048766 3606057091\\r\\n', 'output': ['5978569\\r\\n']}, {'input': '525779583 846043612178 943361005055 18733061595\\r\\n', 'output': ['5\\r\\n']}, {'input': '435022558 639465390342 943735699660 229744278105\\r\\n', 'output': ['1\\r\\n']}, {'input': '695678064 61102799590 232772667767 12617958334\\r\\n', 'output': ['233\\r\\n']}, {'input': '491938843 92710633332 192903440623 32543684099\\r\\n', 'output': ['2\\r\\n']}, {'input': '472015302 25781027848 844045376640 89677396520\\r\\n', 'output': ['34\\r\\n']}, {'input': '198438953 128255153816 508681842799 118232730542\\r\\n', 'output': ['2\\r\\n']}, {'input': '91 139067663884 999999999959 283084501571\\r\\n', 'output': ['2\\r\\n']}, {'input': '67 651886357845 999999999955 333765060000\\r\\n', 'output': ['1\\r\\n']}, {'input': '26 172755321697 999999999949 748328204337\\r\\n', 'output': ['1\\r\\n']}, {'input': '72 831006353527 999999999987 71879885253\\r\\n', 'output': ['1\\r\\n']}, {'input': '57 97829280565 999999999998 631455142546\\r\\n', 'output': ['1\\r\\n']}, {'input': '57 767586689935 999999999948 126106066482\\r\\n', 'output': ['1\\r\\n']}, {'input': '59 447204680121 999999999949 439602728177\\r\\n', 'output': ['1\\r\\n']}, {'input': '12 697971609680 1000000000000 51929063174\\r\\n', 'output': ['5\\r\\n']}, {'input': '11 11961531058 999999999979 397796366872\\r\\n', 'output': ['1\\r\\n']}, {'input': '88 474016746038 999999999956 143293114702\\r\\n', 'output': ['2\\r\\n']}, {'input': '54 241547671283 999999999961 594678057260\\r\\n', 'output': ['1\\r\\n']}, {'input': '58 474193094035 999999999975 34788743171\\r\\n', 'output': ['30\\r\\n']}, {'input': '39 934112975734 999999999956 3045192662\\r\\n', 'output': ['26\\r\\n']}, {'input': '45 483744571127 999999999995 11511670531\\r\\n', 'output': ['33\\r\\n']}, {'input': '65 710261362093 999999999918 134862181280\\r\\n', 'output': ['1\\r\\n']}, {'input': '77 98481782161 999999999977 38629724552\\r\\n', 'output': ['13\\r\\n']}, {'input': '75 11878056757 999999999901 911221521565\\r\\n', 'output': ['1\\r\\n']}, {'input': '74 382007414110 999999999942 226426282578\\r\\n', 'output': ['1\\r\\n']}, {'input': '58 918441992957 999999999938 44552189404\\r\\n', 'output': ['1\\r\\n']}, {'input': '65 866214593817 999999999960 6315152479\\r\\n', 'output': ['26\\r\\n']}, {'input': '643354696 983352299678 998727759639 5\\r\\n', 'output': ['513057561\\r\\n']}, {'input': '829051283 1088391361 820651073160 7\\r\\n', 'output': ['562083301\\r\\n']}, {'input': '549070627 489196200449 539980893591 3\\r\\n', 'output': ['277549405\\r\\n']}, {'input': '275299363 412116285562 820589570249 2\\r\\n', 'output': ['126012131\\r\\n']}, {'input': '232100782 947945598856 962720598687 9\\r\\n', 'output': ['107135445\\r\\n']}, {'input': '466253512 569941491511 940361459626 2\\r\\n', 'output': ['110403922\\r\\n']}, {'input': '828885826 535837481630 996470141756 9\\r\\n', 'output': ['803726132\\r\\n']}, {'input': '572252279 347359014378 476278618064 10\\r\\n', 'output': ['160894508\\r\\n']}, {'input': '888775378 394050745011 583350787788 8\\r\\n', 'output': ['266895167\\r\\n']}, {'input': '524357331 975373409792 993143162930 9\\r\\n', 'output': ['82693750\\r\\n']}, {'input': '467730377 498527596823 599363691390 9\\r\\n', 'output': ['162487839\\r\\n']}, {'input': '999807424 28852515549 693410552314 5\\r\\n', 'output': ['268962728\\r\\n']}, {'input': '355414109 321003964279 526062497801 10\\r\\n', 'output': ['175118262\\r\\n']}, {'input': '90717740 443545087482 618991227417 4\\r\\n', 'output': ['59327245\\r\\n']}, {'input': '733026150 276417674735 483233777723 2\\r\\n', 'output': ['410699288\\r\\n']}, {'input': '820737413 461416856210 478264812791 4\\r\\n', 'output': ['188543974\\r\\n']}, {'input': '689568719 291290991961 563984423945 4\\r\\n', 'output': ['272335774\\r\\n']}, {'input': '657091243 313541859466 743294479974 5\\r\\n', 'output': ['127910302\\r\\n']}, {'input': '386089541 576088663274 944905248353 10\\r\\n', 'output': ['369112903\\r\\n']}, {'input': '863991268 70609416573 891955208431 3\\r\\n', 'output': ['1505748\\r\\n']}, {'input': '1000000000 1 1000000000000 1000000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '999999999 1 1000000000000 1000000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1 1000000000000 1000000000000\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 1 2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 7 12 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '100 6 12 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '1000000000 999999999999 1000000000000 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 4 8 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '100000 51 100 2\\r\\n', 'output': ['24578\\r\\n']}, {'input': '1000000000 10 15 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '1000 66 99 2\\r\\n', 'output': ['578\\r\\n']}, {'input': '1000000000 500000000001 1000000000000 2\\r\\n', 'output': ['434013378\\r\\n']}, {'input': '1000000 987665 1000000 1234\\r\\n', 'output': ['55\\r\\n']}, {'input': '1000 666666666666 999999999999 2\\r\\n', 'output': ['378\\r\\n']}, {'input': '100 6 13 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '123456789 100000000000 300000000000 3\\r\\n', 'output': ['33025443\\r\\n']}, {'input': '1000000000 1 1000000000000 2\\r\\n', 'output': ['439453125\\r\\n']}, {'input': '123456789 100000000000 300000000000 100\\r\\n', 'output': ['10381690\\r\\n']}, {'input': '999999983 27644 60308 96\\r\\n', 'output': ['841887331\\r\\n']}, {'input': '999999983 24937 53808 60\\r\\n', 'output': ['34401697\\r\\n']}, {'input': '999999937 123456789012 987654321098 2\\r\\n', 'output': ['224062417\\r\\n']}, {'input': '1000000000 10000 11000 3\\r\\n', 'output': ['521294125\\r\\n']}, {'input': '500 19 39 2\\r\\n', 'output': ['181\\r\\n']}, {'input': '10007 6 12 2\\r\\n', 'output': ['8\\r\\n']}, {'input': '100 7 13 2\\r\\n', 'output': ['3\\r\\n']}]","id":559} {"difficulty":1600,"lang":"Rust","lang_cluster":"Rust","src_uid":"68_B","execute_outcome":"WRONG_ANSWER","source_code":"fn main() {\n let input = \"3 50\\n4 2 1\\n\";\n let mut lines = input.lines();\n let nk: Vec = lines\n .next()\n .unwrap()\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n let n = nk[0];\n let k = nk[1];\n let a: Vec = lines\n .next()\n .unwrap()\n .split_whitespace()\n .map(|x| x.parse().unwrap())\n .collect();\n let mut min_energy = i32::MAX;\n for i in 0..n {\n min_energy = min_energy.min(a[i]);\n }\n let mut max_energy = i32::MIN;\n for i in 0..n {\n max_energy = max_energy.max(a[i]);\n }\n let mut low = min_energy as f64;\n let mut high = max_energy as f64;\n while high - low > 1e-6 {\n let mid = (low + high) \/ 2.0;\n let mut total_loss = 0.0;\n for i in 0..n {\n if a[i] > mid as i32 {\n total_loss += (a[i] - mid as i32) as f64 * (k as f64 \/ 100.0);\n }\n else {\n total_loss -= (mid as i32 - a[i]) as f64 * (k as f64 \/ 100.0);\n }\n }\n if total_loss > 0.0 {\n low = mid;\n }\n else {\n high = mid;\n }\n }\n println!(\"{:.9}\", low);\n}","description":"It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be transferred from one accumulator to the other. Every time x units of energy are transferred (x is not necessarily an integer) k percent of it is lost. That is, if x units were transferred from one accumulator to the other, amount of energy in the first one decreased by x units and in other increased by units.Your task is to help Petya find what maximum equal amount of energy can be stored in each accumulator after the transfers.","input_specification":"First line of the input contains two integers n and k (1\u2264n\u226410000,0\u2264k\u226499) \u2014 number of accumulators and the percent of energy that is lost during transfers.\nNext line contains n integers a1,a2,... ,an \u2014 amounts of energy in the first, second, .., n-th accumulator respectively (0\u2264ai\u22641000,1\u2264i\u2264n).\n","output_specification":"Output maximum possible amount of energy that can remain in each of accumulators after the transfers of energy.\nThe absolute or relative error in the answer should not exceed 10^-6.\n","notes":null,"sample_inputs":["3 50\n4 2 1\n","2 90\n1 11\n"],"sample_outputs":["2.000000000\n","1.909090909\n"],"human_solution":"use std::io::{self, Read};\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_to_string(&mut input).unwrap();\n\n let mut lines = input.lines();\n let params: Vec = lines.next().unwrap().split_whitespace().map(|x| x.parse().unwrap()).collect();\n let n = params[0];\n let k = params[1];\n\n let energy: Vec = lines.next().unwrap().split_whitespace().map(|x| x.parse().unwrap()).collect();\n\n let mut low = 0.0;\n let mut high = 1000.0;\n\n for _ in 0..100 {\n let mid = (low + high) \/ 2.0;\n let mut total_loss = 0.0;\n\n for i in 0..n {\n if energy[i] > mid {\n total_loss += (energy[i] - mid) * (1.0 - (k as f64) \/ 100.0);\n } else {\n total_loss -= (mid - energy[i]);\n }\n }\n\n if total_loss > 0.0 {\n low = mid;\n } else {\n high = mid;\n }\n }\n\n println!(\"{:.9}\", low);\n}\n","testcases":"[{'input': ['3 50\\r\\n4 2 1\\r\\n'], 'output': ['2.000000000\\r\\n']}, {'input': ['2 90\\r\\n1 11\\r\\n'], 'output': ['1.909090909\\r\\n']}, {'input': ['5 26\\r\\n42 65 23 43 64\\r\\n'], 'output': ['45.415178571\\r\\n']}, {'input': ['5 45\\r\\n964 515 454 623 594\\r\\n'], 'output': ['594.109756098\\r\\n']}, {'input': ['1 20\\r\\n784\\r\\n'], 'output': ['784.000000000\\r\\n']}, {'input': ['10 20\\r\\n812 896 36 596 709 641 679 778 738 302\\r\\n'], 'output': ['597.255813953\\r\\n']}, {'input': ['10 83\\r\\n689 759 779 927 15 231 976 943 604 917\\r\\n'], 'output': ['406.839285714\\r\\n']}, {'input': ['11 1\\r\\n235 280 196 670 495 379 391 280 847 875 506\\r\\n'], 'output': ['467.586301370\\r\\n']}, {'input': ['12 71\\r\\n472 111 924 103 975 527 807 618 400 523 607 424\\r\\n'], 'output': ['413.249554367\\r\\n']}, {'input': ['13 89\\r\\n19 944 341 846 764 676 222 957 953 481 708 920 950\\r\\n'], 'output': ['361.924390244\\r\\n']}, {'input': ['14 6\\r\\n256 465 759 589 242 824 638 985 506 128 809 105 301 827\\r\\n'], 'output': ['523.427098675\\r\\n']}, {'input': ['100 95\\r\\n154 444 715 98 35 347 799 313 40 821 118 786 31 587 888 84 88 751 98 86 321 720 201 247 302 518 663 904 482 385 139 646 581 995 847 775 173 252 508 722 380 922 634 911 102 384 346 212 705 380 220 221 492 421 244 591 758 631 370 866 536 872 294 152 337 810 761 235 789 839 365 366 623 897 905 249 685 838 380 873 702 379 865 68 215 168 425 264 652 228 167 498 733 41 502 21 565 956 430 171\\r\\n'], 'output': ['179.075000000\\r\\n']}, {'input': ['101 71\\r\\n113 551 568 26 650 547 89 668 64 651 110 515 482 401 170 971 623 672 135 106 985 751 286 255 82 588 122 568 751 867 335 488 324 122 829 256 675 471 255 723 630 802 667 665 206 774 573 499 361 202 620 522 72 220 739 868 101 135 254 519 896 227 224 968 263 826 466 377 360 24 124 874 877 513 130 79 630 786 265 150 232 783 449 914 815 557 646 367 733 576 840 683 417 709 569 432 515 702 811 877 286\\r\\n'], 'output': ['343.047284817\\r\\n']}, {'input': ['102 99\\r\\n73 348 420 956 955 436 69 714 87 480 102 555 933 215 452 167 157 593 863 816 337 471 371 574 862 967 581 543 330 348 221 640 378 250 500 428 866 379 1 723 880 992 9 419 0 163 800 96 16 25 19 513 653 19 924 144 135 950 449 481 255 582 844 473 189 841 862 520 242 210 573 381 130 820 357 911 884 735 460 428 764 187 344 760 413 636 868 780 123 614 822 869 792 66 636 843 465 449 191 891 819 30\\r\\n'], 'output': ['68.702920443\\r\\n']}, {'input': ['103 26\\r\\n33 455 273 884 569 636 360 69 802 310 405 594 693 339 43 53 692 514 590 835 1000 191 456 582 641 35 731 207 600 830 416 483 431 377 481 910 367 597 58 413 128 873 42 173 104 553 26 383 673 849 728 503 924 819 108 422 169 454 333 134 926 247 464 289 115 547 567 663 123 396 21 890 385 436 584 432 829 683 345 706 294 901 238 606 12 24 89 882 203 962 804 745 166 425 393 252 415 195 571 596 41 486 445\\r\\n'], 'output': ['419.922659430\\r\\n']}, {'input': ['104 54\\r\\n683 252 125 813 874 835 651 424 826 139 397 323 143 153 326 941 536 435 317 854 353 222 851 591 420 415 190 872 178 311 612 635 174 505 153 81 559 815 805 414 378 62 75 929 208 942 254 670 329 671 127 494 504 618 292 699 203 959 218 788 285 602 83 104 41 562 272 806 4 582 780 87 639 743 811 263 83 632 230 984 826 304 133 142 612 413 310 985 594 309 787 930 541 92 461 663 675 942 952 610 574 633 758 999\\r\\n'], 'output': ['399.430903462\\r\\n']}]","id":560} {"difficulty":2500,"lang":"Rust","lang_cluster":"Rust","src_uid":"6bd41042c6a442765cd93c73d55f6189","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ ---------- begin SegmentTree Point update Range query ----------\nmod segment_tree {\n pub struct PURQ T> {\n n: usize,\n a: Vec,\n id: T,\n op: F,\n }\n #[allow(dead_code)]\n impl T> PURQ {\n pub fn new(n: usize, id: T, op: F) -> PURQ {\n let mut k = 1;\n while k < n {\n k *= 2;\n }\n PURQ {\n n: k,\n a: vec![id.clone(); 2 * k],\n id: id,\n op: op,\n }\n }\n pub fn update(&mut self, x: usize, v: T) {\n let mut k = self.n + x;\n let a = &mut self.a;\n a[k] = v;\n k >>= 1;\n while k > 0 {\n a[k] = (self.op)(a[2 * k].clone(), a[2 * k + 1].clone());\n k >>= 1;\n }\n }\n pub fn update_tmp(&mut self, x: usize, v: T) {\n self.a[x + self.n] = v;\n }\n pub fn update_all(&mut self) {\n for k in (1..(self.n)).rev() {\n self.a[k] = (self.op)(self.a[2 * k].clone(), self.a[2 * k + 1].clone());\n }\n }\n pub fn find(&self, mut l: usize, mut r: usize) -> T {\n let mut p = self.id.clone();\n let mut q = self.id.clone();\n l += self.n;\n r += self.n;\n while l < r {\n if (l & 1) == 1 {\n p = (self.op)(p, self.a[l].clone());\n l += 1;\n }\n if (r & 1) == 1 {\n r -= 1;\n q = (self.op)(self.a[r].clone(), q);\n }\n l >>= 1;\n r >>= 1;\n }\n (self.op)(p, q)\n }\n }\n}\n\/\/ ---------- end SegmentTree Point update Range query ----------\n\nconst MOD: u64 = (1u64 << 61) - 1;\n\n#[derive(Clone, Copy, PartialEq, Eq)]\nstruct ModInt(u64);\n\nimpl std::ops::Add for ModInt {\n type Output = Self;\n fn add(self, rhs: Self) -> Self::Output {\n assert!(self.0 < MOD && rhs.0 < MOD);\n let mut d = self.0 + rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::Sub for ModInt {\n type Output = Self;\n fn sub(self, rhs: Self) -> Self::Output {\n assert!(self.0 < MOD && rhs.0 < MOD);\n let mut d = self.0 + MOD - rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::Mul for ModInt {\n type Output = Self;\n fn mul(self, rhs: Self) -> Self::Output {\n assert!(self.0 < MOD && rhs.0 < MOD);\n const MASK31: u64 = (1u64 << 31) - 1;\n const MASK30: u64 = (1u64 << 30) - 1;\n let au = self.0 >> 31;\n let ad = self.0 & MASK31;\n let bu = rhs.0 >> 31;\n let bd = rhs.0 & MASK31;\n let mid = ad * bu + au * bd;\n let midu = mid >> 30;\n let midd = mid & MASK30;\n let sum = au * bu * 2 + midu + (midd << 31) + ad * bd;\n let mut ans = (sum >> 61) + (sum & MOD);\n if ans >= MOD {\n ans -= MOD;\n }\n ModInt(ans)\n }\n}\n\nimpl ModInt {\n fn new(v: u64) -> Self {\n ModInt(v % MOD)\n }\n fn zero() -> Self {\n ModInt(0)\n }\n fn pow(&self, n: u64) -> Self {\n let mut t = ModInt(1);\n let mut s = *self;\n let mut n = n;\n while n > 0 {\n if n & 1 == 1 {\n t = t * s;\n }\n s = s * s;\n n >>= 1;\n }\n t\n }\n fn inv(&self) -> Self {\n assert!(self.0 > 0);\n self.pow(MOD - 2)\n }\n}\n\npub const BASE_NUM: usize = 2;\n\n#[derive(Clone, PartialEq, Eq)]\npub struct ModVector {\n val: [ModInt; BASE_NUM],\n}\n\nimpl ModVector {\n pub fn zero() -> Self {\n ModVector {\n val: [ModInt::zero(); BASE_NUM],\n }\n }\n pub fn new(v: &[u64]) -> Self {\n assert!(v.len() >= BASE_NUM);\n let mut ans = ModVector::zero();\n for (x, a) in ans.val.iter_mut().zip(v.iter()) {\n *x = ModInt::new(*a);\n }\n ans\n }\n pub fn one(v: u64) -> Self {\n ModVector::new(&[v; BASE_NUM])\n }\n pub fn add(&self, rhs: &Self) -> Self {\n let mut ans = ModVector::zero();\n for (c, (a, b)) in ans.val.iter_mut().zip(self.val.iter().zip(rhs.val.iter())) {\n *c = *a + *b;\n }\n ans\n }\n pub fn sub(&self, rhs: &Self) -> Self {\n let mut ans = ModVector::zero();\n for (c, (a, b)) in ans.val.iter_mut().zip(self.val.iter().zip(rhs.val.iter())) {\n *c = *a - *b;\n }\n ans\n }\n pub fn mul(&self, rhs: &Self) -> Self {\n let mut ans = ModVector::zero();\n for (c, (a, b)) in ans.val.iter_mut().zip(self.val.iter().zip(rhs.val.iter())) {\n *c = *a * *b;\n }\n ans\n }\n pub fn inv(&self) -> Self {\n let mut ans = ModVector::zero();\n for (x, a) in ans.val.iter_mut().zip(self.val.iter()) {\n *x = a.inv();\n }\n ans\n }\n}\n\npub fn rand_time() -> u32 {\n use std::time::{SystemTime, UNIX_EPOCH};\n SystemTime::now().duration_since(UNIX_EPOCH).unwrap().subsec_nanos()\n}\n\npub fn rand_memory() -> u32 {\n Box::into_raw(Box::new(\"I hope this is a random number\")) as u32\n}\n\nuse std::io::Read;\nuse std::io::Write;\n\nfn run() {\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n let mut it = s.trim().split_whitespace();\n let n: usize = it.next().unwrap().parse().unwrap();\n let t: Vec = it.next().unwrap().chars().map(|c| c.to_digit(10).unwrap()).collect();\n let rad = ModVector::new(&vec![rand_time() as u64, rand_memory() as u64]);\n let inv = rad.inv();\n let mut pow = vec![ModVector::new(&[1, 1])];\n for _ in 0..n {\n let v = pow.last().unwrap().mul(&rad);\n pow.push(v);\n }\n type T = (ModVector, usize, bool, bool);\n let fold = |a: T, b: T| -> T {\n if a.1 == 0 {\n return b;\n }\n if b.1 == 0 {\n return a;\n }\n if a.3 && b.2 {\n let mut val = a.0.sub(&ModVector::one(2).mul(&pow[a.1 - 1]));\n val = val.add(&pow[a.1 - 1].mul(&inv.mul(&b.0.sub(&ModVector::one(2)))));\n let len = a.1 + b.1 - 2;\n match (a.1 == 1, b.1 == 1) {\n (true, true) => (val, len, false, false),\n (true, false) => (val, len, a.2, false),\n (false, true) => (val, len, false, b.3),\n (false, false) => (val, len, a.2, b.3),\n }\n } else {\n let val = a.0.add(&b.0.mul(&pow[a.1]));\n let len = a.1 + b.1;\n (val, len, a.2, b.3)\n }\n };\n let mut seg = segment_tree::PURQ::new(n, (ModVector::zero(), 0, false, false), fold);\n for (i, &c) in t.iter().enumerate() {\n if c == 1 {\n seg.update_tmp(i, (ModVector::one(2), 1, true, true));\n } else {\n seg.update_tmp(i, (ModVector::one(1), 1, false, false));\n }\n }\n seg.update_all();\n let q: usize = it.next().unwrap().parse().unwrap();\n let out = std::io::stdout();\n let mut out = std::io::BufWriter::new(out.lock());\n for _ in 0..q {\n let a: usize = it.next().unwrap().parse().unwrap();\n let b: usize = it.next().unwrap().parse().unwrap();\n let len: usize = it.next().unwrap().parse().unwrap();\n let ans = if seg.find(a - 1, a - 1 + len) == seg.find(b - 1, b - 1 + len) {\n \"Yes\"\n } else {\n \"No\"\n };\n writeln!(out, \"{}\", ans).ok();\n }\n}\n\nfn main() {\n run();\n}\n","description":"In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string $$$s$$$ starting from the $$$l$$$-th character and ending with the $$$r$$$-th character as $$$s[l \\dots r]$$$. The characters of each string are numbered from $$$1$$$.We can perform several operations on the strings we consider. Each operation is to choose a substring of our string and replace it with another string. There are two possible types of operations: replace 011 with 110, or replace 110 with 011. For example, if we apply exactly one operation to the string 110011110, it can be transformed into 011011110, 110110110, or 110011011.Binary string $$$a$$$ is considered reachable from binary string $$$b$$$ if there exists a sequence $$$s_1$$$, $$$s_2$$$, ..., $$$s_k$$$ such that $$$s_1 = a$$$, $$$s_k = b$$$, and for every $$$i \\in [1, k - 1]$$$, $$$s_i$$$ can be transformed into $$$s_{i + 1}$$$ using exactly one operation. Note that $$$k$$$ can be equal to $$$1$$$, i.\u2009e., every string is reachable from itself.You are given a string $$$t$$$ and $$$q$$$ queries to it. Each query consists of three integers $$$l_1$$$, $$$l_2$$$ and $$$len$$$. To answer each query, you have to determine whether $$$t[l_1 \\dots l_1 + len - 1]$$$ is reachable from $$$t[l_2 \\dots l_2 + len - 1]$$$.","input_specification":"The first line contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) \u2014 the length of string $$$t$$$. The second line contains one string $$$t$$$ ($$$|t| = n$$$). Each character of $$$t$$$ is either 0 or 1. The third line contains one integer $$$q$$$ ($$$1 \\le q \\le 2 \\cdot 10^5$$$) \u2014 the number of queries. Then $$$q$$$ lines follow, each line represents a query. The $$$i$$$-th line contains three integers $$$l_1$$$, $$$l_2$$$ and $$$len$$$ ($$$1 \\le l_1, l_2 \\le |t|$$$, $$$1 \\le len \\le |t| - \\max(l_1, l_2) + 1$$$) for the $$$i$$$-th query.","output_specification":"For each query, print either YES if $$$t[l_1 \\dots l_1 + len - 1]$$$ is reachable from $$$t[l_2 \\dots l_2 + len - 1]$$$, or NO otherwise. You may print each letter in any register.","notes":null,"sample_inputs":["5\n11011\n3\n1 3 3\n1 4 2\n1 2 3"],"sample_outputs":["Yes\nYes\nNo"],"human_solution":"\/\/ ---------- begin SegmentTree Point update Range query ----------\nmod segment_tree {\n pub struct PURQ T> {\n n: usize,\n a: Vec,\n id: T,\n op: F,\n }\n #[allow(dead_code)]\n impl T> PURQ {\n pub fn new(n: usize, id: T, op: F) -> PURQ {\n let mut k = 1;\n while k < n {\n k *= 2;\n }\n PURQ {\n n: k,\n a: vec![id.clone(); 2 * k],\n id: id,\n op: op,\n }\n }\n pub fn update(&mut self, x: usize, v: T) {\n let mut k = self.n + x;\n let a = &mut self.a;\n a[k] = v;\n k >>= 1;\n while k > 0 {\n a[k] = (self.op)(a[2 * k].clone(), a[2 * k + 1].clone());\n k >>= 1;\n }\n }\n pub fn update_tmp(&mut self, x: usize, v: T) {\n self.a[x + self.n] = v;\n }\n pub fn update_all(&mut self) {\n for k in (1..(self.n)).rev() {\n self.a[k] = (self.op)(self.a[2 * k].clone(), self.a[2 * k + 1].clone());\n }\n }\n pub fn find(&self, mut l: usize, mut r: usize) -> T {\n let mut p = self.id.clone();\n let mut q = self.id.clone();\n l += self.n;\n r += self.n;\n while l < r {\n if (l & 1) == 1 {\n p = (self.op)(p, self.a[l].clone());\n l += 1;\n }\n if (r & 1) == 1 {\n r -= 1;\n q = (self.op)(self.a[r].clone(), q);\n }\n l >>= 1;\n r >>= 1;\n }\n (self.op)(p, q)\n }\n }\n}\n\/\/ ---------- end SegmentTree Point update Range query ----------\n\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/ \u3053\u3053\u307e\u3067\n\nuse std::io::Write;\n\nfn mod_pow(r: u128, mut n: u128, p: u128) -> u128 {\n let mut t = 1;\n let mut s = r;\n while n > 0 {\n if n & 1 == 1 {\n t = t * s % p;\n }\n s = s * s % p;\n n >>= 1;\n }\n t\n}\n\nfn run() {\n input! {\n n: usize,\n s: chars,\n q: usize,\n ask: [(usize1, usize1, usize); q],\n }\n const MOD: u128 = 4611686018427194327;\n let rad = 3;\n let mut pow = vec![1; n + 1];\n for i in 1..=n {\n pow[i] = pow[i - 1] * rad % MOD;\n }\n let inv = mod_pow(rad, MOD - 2, MOD);\n type T = (u128, usize, bool, bool);\/\/ \u30cf\u30c3\u30b7\u30e5\u3001\u9577\u3055\u3001\u5148\u982d1, \u6700\u5f8c1\n let fold = |a: T, b: T| -> T {\n if a.1 == 0 {\n return b;\n }\n if b.1 == 0 {\n return a;\n }\n if a.3 && b.2 {\n let mut val = a.0;\n val = (val + MOD - 2 * pow[a.1 - 1] % MOD) % MOD;\n val = (val + pow[a.1 - 1] * (b.0 + MOD - 2) % MOD * inv % MOD) % MOD;\n let len = a.1 + b.1 - 2;\n return match (a.1 == 1, b.1 == 1) {\n (true, true) => (0, 0, false, false),\n (true, false) => (val, len, false, b.3),\n (false, true) => (val, len, a.2, false),\n (false, false) => (val, len, a.2, b.3),\n };\n }\n let val = (a.0 + pow[a.1] * b.0 % MOD) % MOD;\n let len = a.1 + b.1;\n (val, len, a.2, b.3)\n };\n let mut seg = segment_tree::PURQ::new(n, (0, 0, false, false), fold);\n for i in 0..n {\n if s[i] == '1' {\n seg.update_tmp(i, (2, 1, true, true));\n } else {\n seg.update_tmp(i, (1, 1, false, false));\n }\n }\n seg.update_all();\n let out = std::io::stdout();\n let mut out = std::io::BufWriter::new(out.lock());\n for (x, y, len) in ask {\n let p = seg.find(x, x + len);\n let q = seg.find(y, y + len);\n if p.0 == q.0 && p.1 == q.1 {\n writeln!(out, \"Yes\").ok();\n } else {\n writeln!(out, \"No\").ok();\n }\n }\n\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': '5\\r\\n11011\\r\\n3\\r\\n1 3 3\\r\\n1 4 2\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo']}, {'input': '1\\r\\n0\\r\\n1\\r\\n1 1 1\\r\\n', 'output': ['Yes', 'YES']}, {'input': '3\\r\\n010\\r\\n3\\r\\n1 3 1\\r\\n1 3 1\\r\\n3 2 1\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo']}, {'input': '10\\r\\n0100001001\\r\\n10\\r\\n2 5 4\\r\\n10 2 1\\r\\n5 3 5\\r\\n2 9 2\\r\\n5 3 1\\r\\n3 3 3\\r\\n9 8 1\\r\\n5 3 1\\r\\n9 5 2\\r\\n2 3 6\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n0011011100000010101111011010010000010101000011111110101001010110110011000100001110011001111110100110\\r\\n100\\r\\n47 34 50\\r\\n81 65 15\\r\\n28 41 17\\r\\n96 23 1\\r\\n48 10 10\\r\\n74 44 12\\r\\n69 100 1\\r\\n96 100 1\\r\\n94 58 3\\r\\n9 35 35\\r\\n79 12 16\\r\\n76 25 18\\r\\n49 100 1\\r\\n66 32 19\\r\\n81 18 19\\r\\n45 37 15\\r\\n59 86 1\\r\\n74 65 8\\r\\n1 79 2\\r\\n54 100 1\\r\\n56 2 9\\r\\n54 65 30\\r\\n19 15 9\\r\\n33 5 12\\r\\n9 93 5\\r\\n26 80 1\\r\\n76 47 21\\r\\n75 80 5\\r\\n60 59 37\\r\\n37 62 25\\r\\n15 86 6\\r\\n19 62 14\\r\\n80 23 14\\r\\n94 97 3\\r\\n77 33 9\\r\\n17 99 2\\r\\n58 100 1\\r\\n72 24 6\\r\\n78 74 16\\r\\n69 81 20\\r\\n38 71 26\\r\\n50 91 8\\r\\n...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo', 'NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO']}, {'input': '500\\r\\n10101010110101101010011101110000101100111110001010111001011110101011100011100000010101100011100001001101100101111101101010000000011110110111000101000000100101000110011101111000111001110100101101010110000011101100000100011010000010001011011110010010101111100101000101010010101001010111011101010100101101110001111010000010001101111101000000010101011100101011000110100000011100100000101010011000001000000010101101000010110001010111110011010001011100100101001110110000111101111110001101111100111011001110\\r\\n500\\r...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r...']}, {'input': '1000\\r\\n1101011101100111001101100100011111111111101011111101101100110110001011010101100011001000110001010010110001110001100011111010000010100110101001001110101110001101100101101101110110111100110111000111010010010000011110011010100001001100000011110110111111100111001001110001111011110001011111010011100101000111101111001101100111010101000110011100010001110001000100011001111100111010101110111101011010011010111101010010011100000001110010110100010111100001011010110110000100111011011010010001110001100111111100111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...']}, {'input': '5000\\r\\n0001010011111111001110011001010001001010001000000001001101010110100000101100001010000011100000000001101100111100100110110101001101000101101100100001010010101011001101110011000111000011101111111001101100010011110001010011111001110111101010110001111110000110110101001101010111110001000001101111110111010010100010100111101100000100010101000100011110001100100000011111100110001101011011011010110110010001110011011101100010101011000101101011010110001110101001010000110010111001111100101011000100011111111100111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '10000\\r\\n011000111101001111011011110111110010111111000011101001001101101000101000100100110011011001011011110010111000011100111101000001011010000101101101001000101101000110110111000110010110011001110100000110001101010000110000010100010010001010100100000110000111100000001000110101001001100010101100101100101100110101010111010100000111110100000011110111001001110011101100011010100110100000110011111001100000010111001101101011011010000111010110101101001100010000100100000000010101000111110100010110110000110101101001...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '50000\\r\\n001001000010000010100000110101110001110011111000110000111010101001010010010010100101001011101011000110111010111010011100011101101011101011100011110001110111111011110111000000110111011011110001111111011110110010100010010011101110011011110000011001010001110001010100011100101011111101010010011101010111100001110000010100010100011111010011111100101011011101011010000000111101101010000001011111110010011111011000010100001100110100001010110010011111010001101101111011110010101111001010111001010010111101000101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '100000\\r\\n00010100100100000110010011001110000010010100010110011001011011101011000000101010000111111101000011110100001111100100001001001100001001111111101100001000000101000100010010100111110000110101010100111111000010000010101101010101101001000100101101001100110001000111000110010011011011111000001100000011011111110000010010111100101110010110000001010000000101000111000110100101100110000011100001101111111101001011111011101011111100111110011000101110101001000010010101000101101110101001110001100101111000111010001...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01111000110011111010011100001001110000011011010111110100111110001000000101000001011101101110001111110000011111010000000010101001000001111011100110000101001010000000101101111000011011001001100111011100000010010100100111010001110000101001110110001110011000000101010101010010110011010001010111010011001011001011000000010000000010010010101000101001011101001110111100110000011001001001000110111000000010011110011100000101010010111100011100101110111010011101000011111110111001110110100101100000100001101010010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '5\\r\\n00010\\r\\n5\\r\\n5 3 1\\r\\n2 1 2\\r\\n4 1 1\\r\\n3 1 3\\r\\n2 1 3\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO', 'Yes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n1100001101111101100010001011111101000101111101001000000011111001101001111101010011101100010101111010\\r\\n100\\r\\n33 74 19\\r\\n84 44 1\\r\\n2 7 87\\r\\n70 100 1\\r\\n18 97 3\\r\\n81 46 17\\r\\n64 25 35\\r\\n43 80 18\\r\\n4 17 56\\r\\n85 98 3\\r\\n10 78 3\\r\\n8 32 69\\r\\n42 49 6\\r\\n23 9 20\\r\\n69 100 1\\r\\n35 77 10\\r\\n97 48 1\\r\\n40 8 33\\r\\n29 89 8\\r\\n63 80 4\\r\\n65 20 9\\r\\n78 75 20\\r\\n47 26 9\\r\\n65 72 21\\r\\n91 86 2\\r\\n45 5 10\\r\\n13 2 39\\r\\n60 56 4\\r\\n80 8 7\\r\\n67 19 31\\r\\n38 18 27\\r\\n31 55 8\\r\\n76 34 25\\r\\n39 43 48\\r\\n28 31 44\\r\\n30 63 18\\r\\n96 8 4\\r\\n59 77 11\\r\\n26 12 2\\r\\n3 10 44\\r\\n91 73 3\\r\\n23 19 42\\r\\n23 26 1...', '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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo']}, {'input': '50\\r\\n01110011100101101001001101110101011011101011010011\\r\\n50\\r\\n10 18 32\\r\\n13 50 1\\r\\n5 42 1\\r\\n10 6 35\\r\\n47 4 4\\r\\n42 44 7\\r\\n50 7 1\\r\\n45 1 5\\r\\n14 38 11\\r\\n28 29 4\\r\\n7 48 2\\r\\n35 10 1\\r\\n12 44 6\\r\\n28 26 4\\r\\n43 4 4\\r\\n42 12 4\\r\\n47 29 3\\r\\n47 49 1\\r\\n19 47 2\\r\\n3 46 2\\r\\n9 17 23\\r\\n17 30 1\\r\\n1 31 11\\r\\n48 48 1\\r\\n14 27 9\\r\\n15 26 4\\r\\n7 32 10\\r\\n39 33 4\\r\\n8 46 3\\r\\n7 42 8\\r\\n34 25 12\\r\\n18 18 9\\r\\n41 14 6\\r\\n25 25 24\\r\\n22 26 24\\r\\n49 9 2\\r\\n27 44 4\\r\\n5 32 9\\r\\n18 34 7\\r\\n23 22 4\\r\\n16 26 12\\r\\n8 49 2\\r\\n4 10 30\\r\\n21 8 20\\r\\n26 27 5\\r\\n4 29 14\\r\\n32 22 2\\r\\n34 40 2\\r\\n26 49 1\\r\\n6 13 34\\r\\n', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO']}, {'input': '5\\r\\n11010\\r\\n5\\r\\n2 1 4\\r\\n3 5 1\\r\\n4 2 1\\r\\n4 5 1\\r\\n2 4 2\\r\\n', 'output': ['No\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes', 'NO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES']}, {'input': '50\\r\\n01110100101100100100011001100001110010010000000101\\r\\n50\\r\\n27 18 7\\r\\n22 35 2\\r\\n50 35 1\\r\\n41 16 1\\r\\n27 5 5\\r\\n11 6 33\\r\\n7 19 2\\r\\n9 12 33\\r\\n14 37 4\\r\\n1 22 8\\r\\n22 3 5\\r\\n50 42 1\\r\\n50 38 1\\r\\n29 20 2\\r\\n20 34 17\\r\\n20 4 29\\r\\n16 21 3\\r\\n11 43 3\\r\\n15 45 1\\r\\n12 28 3\\r\\n31 34 13\\r\\n43 1 8\\r\\n3 41 1\\r\\n18 3 13\\r\\n29 44 6\\r\\n47 44 3\\r\\n40 43 2\\r\\n6 46 5\\r\\n9 12 35\\r\\n19 45 2\\r\\n38 47 4\\r\\n19 47 3\\r\\n48 3 1\\r\\n16 12 9\\r\\n24 18 2\\r\\n32 40 4\\r\\n16 28 11\\r\\n33 22 12\\r\\n7 16 9\\r\\n17 30 3\\r\\n16 13 26\\r\\n46 24 5\\r\\n48 17 2\\r\\n25 32 15\\r\\n46 19 1\\r\\n40 29 2\\r\\n36 34 10\\r\\n47 27 4\\r\\n43 18 6\\r\\n4 10 12\\r\\n', 'output': ['Yes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo', 'YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO']}, {'input': '200000\\r\\n01101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101100110100110010110100101100110100101101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011001101001011010011001011010010110011010011001011001101001011010011001011001101001100101101001011001101001100101100110100101101001100101101001011001101001011010011001011001101001100101101001011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '100000\\r\\n10010110010001011010100111111011011010010101001110001111111011110001100100001010101101111000010101011011101000000011001100011100111111000111111111001001011110000111000011101110001001001010010000100111001010110100100001100110101000110001001001111010000110001111101010110110010100101010101010011110011000001011010010010110111000011110001011110011011101001001011001111010110101010001111011001101001100000101100101000111110010000001010110000000110111110000010011110111100111101110001001000011110100111100011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01000010110111000011001001110000111001000101000001101110100010110101001101100011101110000111100000110010010001110011111011011101000111001111010010000001001100000100000101101000110101011001101110111000111011111001111000001010010001001000011000100111110101000111011001110101001100100001110001100001110111101110111100011011000011110000010001010100001011001100111100011010010001010011111000111101011101110111100111100010110011110111100111111001111100110110011001111001111010001111000001010110000100010111100...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '1\\r\\n1\\r\\n200\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...', 'YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nY...']}, {'input': '2\\r\\n00\\r\\n200\\r\\n1 1 2\\r\\n2 1 1\\r\\n1 1 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 1 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 1 2\\r\\n2 2 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n2 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n2 1 1\\r\\n2 1 1\\r\\n1 1 1\\r\\n2 1 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n1 2 1\\r\\n1 1 1\\r\\n2 ...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...', 'YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nY...']}, {'input': '3\\r\\n101\\r\\n200\\r\\n2 2 2\\r\\n3 2 1\\r\\n3 1 1\\r\\n2 2 2\\r\\n2 1 2\\r\\n1 3 1\\r\\n1 1 2\\r\\n1 3 1\\r\\n3 3 1\\r\\n1 1 2\\r\\n1 2 1\\r\\n1 3 1\\r\\n3 3 1\\r\\n1 1 3\\r\\n3 3 1\\r\\n2 2 1\\r\\n2 1 1\\r\\n1 2 2\\r\\n3 2 1\\r\\n1 2 1\\r\\n2 2 1\\r\\n1 1 2\\r\\n3 2 1\\r\\n2 2 2\\r\\n3 1 1\\r\\n1 2 2\\r\\n1 3 1\\r\\n1 1 1\\r\\n3 3 1\\r\\n1 2 1\\r\\n2 2 2\\r\\n1 1 2\\r\\n2 3 1\\r\\n3 1 1\\r\\n2 3 1\\r\\n2 3 1\\r\\n2 1 1\\r\\n3 1 1\\r\\n2 3 1\\r\\n2 3 1\\r\\n3 2 1\\r\\n2 2 1\\r\\n3 3 1\\r\\n2 1 2\\r\\n2 2 2\\r\\n1 3 1\\r\\n1 1 2\\r\\n3 1 1\\r\\n3 2 1\\r\\n3 2 1\\r\\n3 1 1\\r\\n2 2 2\\r\\n2 2 1\\r\\n2 2 2\\r\\n2 1 1\\r\\n1 1 3\\r\\n1 2 2\\r\\n3 3 1\\r\\n2 2 2\\r\\n3 3 1\\r\\n3 3 1\\r\\n3 2 1\\r\\n1 3 1\\r\\n2 1 2\\r\\n1 1 1\\r\\n3 2 1\\r\\n2 3 1\\r\\n2 1 1\\r\\n1 3 1\\r\\n3 3 1\\r\\n2 1 2\\r\\n1...', 'output': ['Yes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\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\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes...', 'YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\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\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES...']}, {'input': '10\\r\\n0010010101\\r\\n200\\r\\n5 2 3\\r\\n8 2 1\\r\\n7 4 4\\r\\n8 4 2\\r\\n6 8 1\\r\\n5 7 3\\r\\n8 4 3\\r\\n7 4 4\\r\\n3 4 5\\r\\n9 1 2\\r\\n7 2 2\\r\\n9 8 1\\r\\n3 1 2\\r\\n1 9 1\\r\\n9 5 2\\r\\n2 6 4\\r\\n6 3 1\\r\\n1 4 7\\r\\n10 1 1\\r\\n7 6 1\\r\\n6 10 1\\r\\n9 8 2\\r\\n8 4 2\\r\\n7 8 2\\r\\n4 8 3\\r\\n8 5 2\\r\\n9 9 1\\r\\n3 3 8\\r\\n5 9 2\\r\\n2 10 1\\r\\n3 9 1\\r\\n1 6 3\\r\\n6 9 2\\r\\n4 7 2\\r\\n1 9 2\\r\\n6 7 3\\r\\n7 1 1\\r\\n5 5 5\\r\\n4 3 1\\r\\n2 6 2\\r\\n4 4 4\\r\\n3 10 1\\r\\n6 4 1\\r\\n4 9 1\\r\\n1 10 1\\r\\n2 10 1\\r\\n9 7 2\\r\\n8 1 2\\r\\n7 1 1\\r\\n10 7 1\\r\\n5 9 1\\r\\n7 1 1\\r\\n7 6 4\\r\\n2 2 9\\r\\n4 1 5\\r\\n9 5 2\\r\\n9 2 1\\r\\n2 2 1\\r\\n9 2 1\\r\\n1 2 8\\r\\n7 5 1\\r\\n1 7 1\\r\\n2 10 1\\r\\n6 8 2\\r\\n5 3 2\\r\\n3 7 3\\r\\n8 2 2\\r\\n8 10 1\\r\\n7 2 2...', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nYES\\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\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES...', 'Yes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nYes\\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\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes...']}, {'input': '500\\r\\n11000010101101111101111110011100110000110010101001100111100100010101001000011010111101111110001000110010001101000100110011100011010110001000000011100111100111101100101000101100001101100011011101101000001000011111100011110001100101010110101001011010001101100101111101000001000110001010011111000111000111010001111011110101001110010001011100011110111100110101110100011011110100010110011101011100011101101110111011101101000011000011101010011010011011001011001010010100101001010111100010100000101010100000\\r\\n2000...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '1000\\r\\n1000011001001011010111011001010110101110111101011101101001111001111101000011101110011011101010110101001000011000101110101011010001101100100001001010111000101110101000110000110101011111001100001011111101010101000110000100110000100010110111110100011111100011111001001010011100000010111011101100010100000001100000000100101000000110101111000100010110110111010001001110011111010101001010000111010100110110010001010111100011001001001001111111101100110010010100101100001100010111101111011001111010111101010010101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '14227\\r\\n001101111010010010111101010111010010010100111111011110110101100111101001000000100111011101100011001110010011001011010000110101001110111010010101000010001010100001100001100111010000111111010101010110101001001010110000010110111000000010111101011100000011100001000101100011011110101111011100001001011000000011000101001000011001011000101101101100110101000010001101101101100010000111010010100000110000001111101001111101011101000111100001111001011000110011101101101001111011110010010000010001001111100000111010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '10\\r\\n1101011011\\r\\n10\\r\\n10 3 1\\r\\n10 10 1\\r\\n5 10 1\\r\\n10 4 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n10 4 1\\r\\n4 5 2\\r\\n3 5 3\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO', 'No\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo']}, {'input': '100\\r\\n1101101100000011011011011011011000011000111000011000111111001111010011000011110011000011011110011000\\r\\n1000\\r\\n44 42 12\\r\\n67 64 19\\r\\n61 36 40\\r\\n67 46 5\\r\\n44 63 20\\r\\n39 45 39\\r\\n65 68 8\\r\\n44 37 28\\r\\n38 45 30\\r\\n38 66 26\\r\\n41 70 6\\r\\n39 45 32\\r\\n42 46 24\\r\\n43 44 57\\r\\n67 45 9\\r\\n63 65 32\\r\\n37 40 60\\r\\n63 63 2\\r\\n66 71 30\\r\\n62 61 14\\r\\n40 67 12\\r\\n69 66 25\\r\\n61 37 2\\r\\n41 66 5\\r\\n71 44 2\\r\\n65 67 7\\r\\n62 36 9\\r\\n42 38 51\\r\\n37 41 60\\r\\n37 42 58\\r\\n41 61 18\\r\\n41 36 47\\r\\n66 67 14\\r\\n70 71 19\\r\\n39 62 15\\r\\n70 63 26\\r\\n68 71 2\\r\\n42 36 16\\r\\n40 44 41\\r\\n66 63 14\\r\\n61 44 27\\r...', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'Yes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n01000100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010001010001010001000101000101000100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001010001000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010100010100010001010001000101000101000100010...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00010101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101010001010001010100010100010101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010001010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101000101010001010100010100010101000101010001010001010100010100010101000101010001010001010100010101000101000...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00011111010001111101011001111100010111011011011101110001110110111101111111011101100101100111011111011111101101011100110101111001011100110101011110010011011101011011010110110111110111111101111001010001001101111101111101100111011001111111110111011001011100011111110001110111011001111101110001001101111101110011011100010111011001111101011001110011010111001111011101111100110111110110010111110110011100110111011101100111010001110011011111011100010111100101111100011111011111000101111011011101001101110111011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01110111100101111100010101001101110111110001111111110101110011110111110101111111000111011100011101110111011110010101100101011100011101110111001101110100011111011111011101100111110111011111001101010110011101111111010110110111010110110101110111110011010111011100110101111111001101111101110111011011010111011011110101010001010101100101110110010111011101100111011101110001111101110001110111110111011011011101111111110001111111010111011001010111110011010100011101110101100111011111010110011101001101111101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01111011011000001101111001100001100000110000001100110011011000011110001101100011011011110110110000000111101100110001100111100001101100110001100110011011110011011011111100011000110001100110001100011011001100000001100011001111111100011011000001111110110110001100110011000110110000011011011011000011001111001111000011110110110110110000110110110110110011000110110001100011011011110001100000111100000110000111101100011011000000110001100000001111011011001100111100110011110001100000110011011000011110111101101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '200000\\r\\n11110011110110110000000011011000111100111111011011000111100001100001111000000011001100110000011011000000011110000011000000110001100011000011000000000011011110011110111100000011110111100111100011110110000011000110001100000110000011011111101100110000110110110110110110111100001101100000001100011110110111100011011001111011001100011110110110110000011001100001100000000000011001101101100011011110001100011000110000110001100000111100000000110000111101100011000000000011001111000011110110110000011011110001111...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r...']}, {'input': '10\\r\\n1100111011\\r\\n10\\r\\n10 10 1\\r\\n5 4 5\\r\\n6 10 1\\r\\n10 10 1\\r\\n10 10 1\\r\\n5 5 4\\r\\n6 10 1\\r\\n4 6 4\\r\\n10 10 1\\r\\n6 10 1\\r\\n', 'output': ['Yes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes', 'YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES']}, {'input': '100\\r\\n0110011011001100110001100110011001111011011011101100110110000110110100111100110110001100101100000110\\r\\n1000\\r\\n66 69 2\\r\\n72 92 4\\r\\n85 71 4\\r\\n94 50 3\\r\\n45 85 5\\r\\n94 52 2\\r\\n65 89 9\\r\\n70 89 8\\r\\n64 45 35\\r\\n84 44 13\\r\\n93 52 1\\r\\n71 43 10\\r\\n88 73 7\\r\\n93 45 6\\r\\n71 71 10\\r\\n70 46 18\\r\\n44 43 52\\r\\n87 65 2\\r\\n52 86 15\\r\\n71 88 6\\r\\n44 69 28\\r\\n44 48 26\\r\\n91 63 4\\r\\n85 84 13\\r\\n90 70 4\\r\\n85 63 12\\r\\n50 46 51\\r\\n72 46 17\\r\\n92 49 9\\r\\n69 71 11\\r\\n90 91 10\\r\\n91 69 3\\r\\n63 43 35\\r\\n48 92 8\\r\\n84 89 10\\r\\n65 64 8\\r\\n89 89 1\\r\\n73 73 10\\r\\n70 47 4\\r\\n73 84 11\\r\\n50 68 29\\r\\n69 64 3\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r...', 'No\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r...']}, {'input': '200000\\r\\n00010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', '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\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nN...', 'NO\\r\\nNO\\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\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nN...']}, {'input': '200000\\r\\n01000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010...', 'output': ['No\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\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\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\n...', 'NO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\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\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...']}, {'input': '200000\\r\\n01100111010101110111010111011111111101011111110101010111011101110111010111010111011111011101110111010111010101010101110111111101111111011111011101110111011111010101111101110111010101111101110111110111010101010111011111011101110111011111011111011111011111010101011101110111010111011111011111011101110111110101110111011101110101111101110101110101111111011101011111011101011101010111110111011111010111110101111101111101110111010111011101110111110101011111110101010101010101011111011111010111011111010101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n11010110011101100111011001000101101101110011011111110110011111000111111100011101100111000111111101100111000111000111110011010001111101100100011111000111001101110011010001110110110111111111110011110101100101100111011011010110110111110110110111110001111101100111000111110001111100011100010001000101100101100111011110011100011100010011011111000111001101110110010011110111110001110011110100110100011111011001110011110111001101111100110111000100011100010111100100011100011100111101111111011001110011011101111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n11001100000011110110001111110110011011000001101100000001100001101101101111011000000001101111011111100011110011001100011011110001101101101111011011000000000110110110110110011111100110011001101100110011001100011011000011011000000011110000001111001100000001101111000011000000011011011110110000001111011110111101100001101100000000000111100011001100011011000110001100110011011011000000000011000111100011011011011001101101111011000001101101111000001100000000110110001101100110000110110011000110011110110110011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n01111110000110000011011011011000000110110110111101100011011001100000011000110011001100000110000000011111100110110011000110110000000110110110001111011011001100000001100110110111100011001100000000110110000110110001100011000011011011011001100011011000110110001111001101100110011110000000011000110110011000111100110001101100000111101111000011011000011011011011000110110110110110000011000110011110000111101100001101100001101100111100011000011110001111000001100000001111011110000011000110110110110111101101100...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '200000\\r\\n11111111111111111111111101111111111111111011111111111111110111111111111111111111111011111111111111111111111111110111111111111111111111111110111111111111011111111111111011111111111111111111110111111111111111111110111111111111111111111101111111111111111011111111111111110111111111111110111111111111111111111111111101111111111111111111101111111111110111111111111111111111111011111111111101111111111110111111111111011111111111111111101111111111111111110111111111111111111111111011111111111111111111111111110...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...']}, {'input': '200000\\r\\n11111111111111111111110111111111111011111111111111110111111111111111111111101111111111011111111111111111111111111111101111111111111111011111111111111111111111101111111111111111011111111111111111111111111111101111111111111111111101111111111110111111111111111111111101111111111111111111111011111111111111111111111101111111111111111110111111111111011111111111111110111111111111111101111111111111111111111110111111111111111111011111111111111111111111111011111111111111111111011111111111111111111111111111101...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n11111111111111111111111111111111110111111111111110111111111111111111111111110111111111101111111111111111111111111101111111111111111111101111111101111111111111101111111111111111111101111111111110111111111111111101111111111111101111111111011111111111111111111011111111011111111111111111111110111111111111111101111111111111101111111111111111111101111111111111111111101111111111111111011111111111111111111111101111111111111111111111111111111101111111111111111111111011111111011111111111111011111111111111011...', 'output': ['No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...']}, {'input': '200000\\r\\n11111111111101111111111111111111101111111101111111111111111111101111111111111111110111111111111111101111111111111111111111110111111111111111111111111011111111110111111111111111111111111011111111111111110111111111111111111110111111111111111101111111111110111111111111111111111101111111111111111111101111111111111111111111111111110111111111111011111111111111111111111111011111111011111111111111111111111101111111111111101111111111111111111111111111011111111111111111101111111111110111111111111011111111111...', '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\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r...']}, {'input': '200000\\r\\n11111111111111110111111111111111111110111111111111111111111101111111111111111111111110111111111101111111111111111110111111111111111101111111111111111011111111111111011111111111111011111111111111110111111111111111111111111011111111111111111101111111111111111111101111111111110111111111111111101111111111111111111111111111011111111111111110111111111111111101111111111111111111111110111111111111111111111101111111111111111111111110111111111111111111110111111111111111111111111011111111111111111101111111111...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n11111111111111011111111111111111101111111111111111111111111111111101111111111011111111111111110111111111111111111011011111111111111111111111111110111111111111111111111111110111111110111111111111111111111111111111110111111111111111101111111111111101111111111011111111111111111111110111111111111111111111111011111111111111110111111111111111111110111111111111111111011111111111111110111111111111110111111111111111111111101111110111111111111111111111101111111111111111011111111111111111111111111111111011111...', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n11111111111111110111111111111111111110111111111111111111111111111101111111111111111110111111111111111111011111111111111011111111111111111111111101111111111111101111111111110111111111111111111111111011111111111111011111111111111111111111111110111111111111111111111111111111110111111111111111101111111111111111111111011111111111111111111110111111111111111111111111011111111111111111111111111111101111111111111111111111111111110111111111111111111111111011111111111111111111011111111111111111101111111111011...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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': '200000\\r\\n11111111111101111111111110111111111101111111111111111111101111111111111111111101111111111111101111110111111111111111101111111111011110111111111111111111110111111111111011111111111111111111011111111111111011111111111111110111111111111111111111111111101111111111111111011111111111111111111110111111111101111111111111101111111111111101111111111110111111111111111101111111111111111111111111101111110111111111101111111111111111111111011111111111111111111110111111111111111101111111111111101111111111111111111...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101010111010101010101010101010101010101010101010111010101010101011101010101010101010101010101011101010101010101010101110101010101010101011101010101010101010101010101010101010101010101110101010101010101010101110101010101010101010101010101010101010101010101010101010101010101010101011101010101010101110101010101010101010101010101010101010101010111010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...']}, {'input': '200000\\r\\n01001001010010010100101001001010010010100111010010010100101110010010100100101001010010010100101101110100101001001010010100100101110010010100111010010011101001010010010100100101001010010010111001001010010100100111011100101001001010010010100101001001010010010100101001001010010100100101110011100101001010010010100101001001010010010100101001001010110100101001010010010100101011010010100100101001010010010100101001001010010010100101001001011100100101001010010010101101010010010100100101001010010010100100101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00101001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001010010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n00101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nN...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nN...', 'No\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\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\\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\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r...', 'NO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\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\\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\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r...']}, {'input': '200000\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\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\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\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\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\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\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\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\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nYes\\r\\nNo\\r\\nYes\\r\\nYes\\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\\nYes\\r\\nNo\\r\\nYes\\r\\nNo\\r\\n...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\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\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n...', 'NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101001001010010100100101001001010010100100101001010111101001010010010100101001001010010100100101001001010010100100101001001010010100100101001010010011101001001010010100100101001010010010100100101001010010010100100101001010010010100101001001010010010100101001001010010010100101001001010010100100101...', '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\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r...']}, {'input': '200000\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010111010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO...', 'No\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo...']}, {'input': '200000\\r\\n00101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['Yes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nYes...', 'YES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES...']}, {'input': '131072\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No', 'NO']}, {'input': '131072\\r\\n01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No', 'NO']}, {'input': '10000\\r\\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...', 'output': ['No']}, {'input': '2000\\r\\n0101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010...', 'output': ['No']}, {'input': '8000\\r\\n0101010101010101010101010101010101100101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101100101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '8000\\r\\n0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '2000\\r\\n0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101100101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '4000\\r\\n0010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001010000010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000010000000001000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000...', 'output': ['No']}, {'input': '200000\\r\\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...']}, {'input': '200000\\r\\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['Yes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nYes\\r\\nY...']}, {'input': '20000\\r\\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2738\\r\\n1010001001010100100000001010010100010010000100010101010100100100100100101001010100101010001010100010010101001000000010100101000100100000100010010101001000000010100101000100100001000101010101001001001001001010010101001010100010101000100101010010000000101001010001001000001000100101010010000000101001010001001000001000100101010010000000101001010001001000010001010101010010010010010010100101010010101000100001010101010010010010010010100101010010101000100001010101010010010010010010100101010010101000101010001...', 'output': ['No']}, {'input': '104\\r\\n01000100100101000001001000100001010100010011111111110101001010010100010101001010010101001010101010101010\\r\\n1\\r\\n1 53 52\\r\\n', 'output': ['No']}, {'input': '96\\r\\n000100000000001000010010010010001010100111111111101010010010001010101000100100100101010001010010\\r\\n1\\r\\n1 49 48\\r\\n', 'output': ['No']}, {'input': '2842\\r\\n0100101010010101010101010010010010010010100101000101000100100010101010100010100100101000001000010001001000101010101000101001001010000010000100010010001010101010001010010010100000100001001010100101010101010100100100100100101001010001010010101001010101010101001001001001001010010100010100010010001010101010001010010010100000100001001010100101010101010100100100100100101001010001010010101001010101010101001001001001001010010100010100010010001010101010001010010010100000100001000100100010101010100010100100101...', 'output': ['No']}, {'input': '3026\\r\\n1001010100100101010010010010010101010001001010101001010010101010010101010010100101010100100100100101000101010010010101001001001001010101000100101010100101001010101001010101001010010101010010010010010100010101001001010100100100100101010100010010101010010100101010100101010100101001010101001001001001010001010100100101010010010010010101010001001010101001010010101010010101010010100101010100100100100101000101010010010101001001001001010101000100101010100101001010101001010101001010010101010010010010010100010...', 'output': ['No']}, {'input': '2000\\r\\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '2000\\r\\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000...', 'output': ['No']}, {'input': '24000\\r\\n011001011010101010100110100101010101011001100110010101010110010110101001101001100101100110100110100110011010011001101010100101101010101010011010010101010101100110011001010101011001011010100110100110010110011010011010011001101001100110101001011001011001011010010110010101010110010110101010101001010110101010101001101001100101011010100101010110010110010110101010100101100101101001011001010101011001011010101010100101011010101010100110100110010101101010010101011001011001011010101001011001011001011010100101...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '160\\r\\n1010010101100101100110101010100101010110100101011001100110101001011010101001100101011010101010101001100101010101011010011001010110011010011001101001100101100101\\r\\n1\\r\\n1 81 80\\r\\n', 'output': ['No']}, {'input': '240\\r\\n011010101001011010100110101001011001011010100101100110011001011010010101010110100110010110100101101001101001101001010110011010010101011010011010010101010110011001100110101001010101100110101001100110101010100101010101011010010101010110101010\\r\\n1\\r\\n1 121 120\\r\\n', 'output': ['No']}, {'input': '6000\\r\\n0110101001100101100110100101101010100101101010100110101010010101011001011010100101100110100110010101100101101001100101100110101010011010100110101001100101100110100110010101010110011010101010101001101001100110011010010110100110101010101001100110100110011010010110100110100110100110101010100101011001100101101010101001101010010110101001100101100101101010010110100110011010100101010110101001010101011001010110101010010110010101100101100110100110010101010110101001101001100101010101100101101001011001101001101...', '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\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo\\r\\nNo']}, {'input': '160\\r\\n0101100101011001100110101010100110011001101001101010100101011010011001010110010110011010010101011001010101100110010110010110101010010101100110101010101010010110\\r\\n1\\r\\n1 81 80\\r\\n', 'output': ['No']}, {'input': '240\\r\\n010101010101010101011001011001101010011010011010101001010101101010100101100101011010101001010101011001100110010110011010010101010101010101100101100110101001101001101010100101010110101010010110010101101010100101010101100110011001011001101001\\r\\n1\\r\\n1 121 120\\r\\n', 'output': ['No']}, {'input': '182\\r\\n00101000101001010000010010100000100100010000001010100100001000010101000000000000100000100001001000000000000010100000100101000000010001000010100000001000100001001010101010000100000101\\r\\n1\\r\\n1 92 91\\r\\n', 'output': ['No']}, {'input': '248\\r\\n01011010011010101001010101011001101001101001100110100110101001101001010101100101011001010101100110010101010101011010101010100110100110101010010101010110011010011010011001101001101010011010010101011001010110010101011001100101010101010110101010101001\\r\\n1\\r\\n1 125 124\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010100110101010101010100110101010101010101010101010101010101010101001101010011010101010101010101010101010101010101010101010100110101010101010101010101010011010101010011010101010101010101010101010101010101010100110101010101010101010101001101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101001101010101010011001101010101010101010101010101010101010101001101010101010101010101010100110101010101010101010101010101001101010101010101010101001101010101001101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010101010011010101010101010100110101010100110101010101010101010101010101010101010101010101010011010101010011010101010101010101010101010101010100110101010101010101010101010100110101010011010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101001101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001101010101001101010101010101010101010101010011001101010101010101001101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n010110100110010110011010101010100110011001101010011010010110101010101010101010101010101010101010010110010110101001101001011010010110101001010110100110101001101010011010010110101010011010101001011001101010011010011001100101011010011010100101101001010101100101011001101010011001011010101010101010101010011001101010101001101010011001100101011001011010101001101001101001100101011001100101011010100110100101100110101010100101011010100101100110011010101001011010101001010101011010101010011010011010101001010101...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010100110101010101010101010101010100110101010101010101010101001101010101010101010011010101010101010101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101010011010101010101010101010101010101010100110101010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010101010100110101010100110101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '238\\r\\n0100010101001010101000010001000001000100100101001000000010000001010100101010101001010010111111111111111111111111111111110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100\\r\\n1\\r\\n1 120 119\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n100110101010101010101001011010101010101010101010101001101010101010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101001011010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101010100110101001101010101001101010100110101001101010101010101010011010101010011010101001100110101010101010100110101010101010101001101010101010101010101010101010011010101010100110101010101010101001101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010100110101010101001101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010011010101010101010101010101001101010101010101010101010011010011010101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010101010100110101010101010101010101010101001101010101010100110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101001011010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101001101010101010101010101010101001101010101010101010101010101010101010101010101010101001101010100110011001101010101010101010101010101010101010101010100110101010101010101010101010101010101010101010101010101010101010011010101010101010101010011010101010011010011010101010101010101010101010101010101010101010101010101010101010101001101010101010101010101010101010101010101010101010101010101001011010101010101010101010101010101010101010101010101001010101101010101010101010101010101010...', 'output': ['No']}, {'input': '358\\r\\n0100100101000100100001010010000001000010000101000010100100100100000000100010100001001001001000010010010100101010001010001010001111111111111111111111111111111111111111111111111111110101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100\\r\\n1\\r\\n1 180 179\\r\\n', 'output': ['No']}, {'input': '10000\\r\\n101001101010101010101010100110101010101010101010101010011010101010101010101010011001101010101010101010101010101010101010101010101010101010101001101010101010101010101010100110101010101010101010101010101010010110101010101010101010101010101010100110101010101010101001101010101010101010011010101010101010101010101010011010101010101010011010101010101010101010101010101010101010101010101010101010101010011010101001011010100101100110101010101010101010101010101010101010101010101010101010101010101010101001101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010101010101010101010101010101010101010101010100110011010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100110101010101010101010100110101010101010101001101010101001101010101010101001101010101010101010101010101010101010101010101010101010101010011010101010101010101010101010011010101001100110100101101001101010101010101010101001101010101010101010100110011010101010101010101010101010011010101010101010101010101001101010101010101010101010...', 'output': ['No']}, {'input': '10000\\r\\n101010101010101010101010011010101010101010101010101010011010101010101010101010101010101010101010101010101010101010101010100110101010101010101001101010101010101010011010101001100110011010101010101010101010101010011010101010101010101010101010101010101010101010101001101010101010101010101010101010011001101010101010101010101010101010101010101010101010011010101010101010011001101010101010101010101010101010101010101010101010010110101010100110101010101010100110010101101010101010101010101010101010101010101010...', 'output': ['No']}, {'input': '5460\\r\\n0000000100000000000000000000101000000000000000000000010000000010010000000000100000000000000000000000100000000000100000000000100000010000000001000101000000000001000100000000000000000000000000000010000000000010000000001000001010000001000000000000001000000000000000000000000000000000000000100000100010010100000000000000100001000000000000000000000000000010001000010000000000000001000000010000100000000000100000001000000010001000000000000001010000001000000000000000000000000000000000000000000001000100000100010...', 'output': ['No']}]","id":561} {"difficulty":1600,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"70_B","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(non_snake_case)]\r\n#[allow(dead_code)] fn read_line() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\n#[allow(dead_code)] fn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\n#[allow(dead_code)] struct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\n#[allow(dead_code)] macro_rules! init {($name: ident) => {#[allow(unused_mut)]let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let n = read::();\r\n let inp = read_line();\r\n\r\n\r\n \/\/ let n = 2;\r\n \/\/ let inp = \"How are you?\";\r\n\r\n \/\/ let n = 25;\r\n \/\/ let inp = \"Hello! Do you like fish? Why?\";\r\n\r\n\r\n let sntncs = inp.split(['.', '?', '!']);\r\n let mut cnt = 1;\r\n let mut sntnc_c = 0;\r\n let mut p = 0;\r\n for sntnc in sntncs {\r\n if sntnc.len()==0 {continue};\r\n \/\/ println!(\"sntnc:{sntnc} len:{}\", sntnc.len());\r\n if p+sntnc.len()+1<=n {\r\n sntnc_c += 1;\r\n \/\/ println!(\"+{}\", &inp[p..p+sntnc.len()+1]);\r\n p += sntnc.len()+1;\r\n } else {\r\n if sntnc_c==0 {\r\n println!(\"Impossible\");\r\n return;\r\n }\r\n \/\/ println!(\"|{}\", &inp[p..p+sntnc.len()+1]);\r\n p += sntnc.len()+1;\r\n cnt += 1;\r\n }\r\n }\r\n println!(\"{cnt}\");\r\n\r\n}\r\n","description":"Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!Fangy did not like it, so he faced the task of breaking the text into minimal messages on his own so that no sentence were broken into pieces when it is sent and the number of text messages to be sent would be minimal. If two consecutive sentences are in different messages, the space between them can be ignored (Fangy does not write this space).The little walrus's text looks in the following manner: TEXT ::= SENTENCE | SENTENCE SPACE TEXTSENTENCE ::= WORD SPACE SENTENCE | WORD ENDEND ::= {'.', '?', '!'}WORD ::= LETTER | LETTER WORDLETTER ::= {'a'..'z', 'A'..'Z'}SPACE ::= ' 'SPACE stands for the symbol of a space.So, how many messages did Fangy send?","input_specification":"The first line contains an integer n, which is the size of one message (2\u2264n\u2264255). The second line contains the text. The length of the text does not exceed 10^4 characters. It is guaranteed that the text satisfies the above described format. Specifically, this implies that the text is not empty.\n","output_specification":"On the first and only line print the number of text messages Fangy will need. If it is impossible to split the text, print \"Impossible\" without the quotes.\n","notes":"Let's take a look at the third sample. The text will be split into three messages: \"Hello!\", \"Do you like fish?\" and \"Why?\".\n","sample_inputs":["25\nHello. I am a little walrus.\n","2\nHow are you?\n","19\nHello! Do you like fish? Why?\n"],"sample_outputs":["2\n","Impossible\n","3\n"],"human_solution":"#![allow(non_snake_case)]\r\n#[allow(dead_code)] fn read_line() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\n#[allow(dead_code)] fn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\n#[allow(dead_code)] struct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\n#[allow(dead_code)] macro_rules! init {($name: ident) => {#[allow(unused_mut)]let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let n = read::();\r\n let inp = read_line();\r\n\r\n\r\n \/\/ let n = 4;\r\n \/\/ let inp = \"ab. b. de.\";\r\n\r\n \/\/ let n = 146;\r\n \/\/ let inp = \"iIQVkDsPqzAJyBrtHk EhBSN gzDoigItCMzETerb cIbXhTPbKYMdMoYqyFTEN. qcrrseVwmaZEiQUQoGT SUyErST lJDejKkjqTdoUrHR tsZYDyI? pmuNNHYqQUISxdZfWOB XdEECvNz hnNmVfODaIC qjhRIEPAlEsQBxo apZ! gCpqoiUFIwWLBOmYubywj qJojFVhLd dCpovICpXHfgihydEOoij?\";\r\n\r\n \/\/ let n = 2;\r\n \/\/ let inp = \"How are you?\";\r\n\r\n \/\/ let n = 19;\r\n \/\/ let inp = \"Hello! Do you like fish? Why?\";\r\n\r\n\r\n let sntncs = inp.split(['.', '?', '!']);\r\n let mut cnt = 1;\r\n let mut sntnc_c = 0;\r\n let mut p = 0;\r\n let mut i = 0;\r\n for sntnc in sntncs {\r\n if sntnc.len()==0 {continue};\r\n let sntnc = sntnc.trim();\r\n\r\n let sntnc_len = sntnc.len()+1; \/\/+1 for .,?,!\r\n let spaced_sntnc_len = sntnc_len + if i==0{0}else{1};\r\n if sntnc_len > n {\r\n println!(\"Impossible\");\r\n return;\r\n }\r\n\r\n \/\/println!(\"sntnc:{sntnc} len:{}\", sntnc.len());\r\n if p+spaced_sntnc_len<=n {\r\n \/\/ println!(\"spaced_sntnc_len {}\", spaced_sntnc_len);\r\n sntnc_c += 1;\r\n p += spaced_sntnc_len;\r\n } else {\r\n if sntnc_c==0 {\r\n println!(\"Impossible\");\r\n return;\r\n }\r\n p = sntnc_len;\r\n cnt += 1;\r\n }\r\n\r\n i+=1;\r\n }\r\n println!(\"{cnt}\");\r\n\r\n}\r\n","testcases":"[{'input': ['25\\r\\nHello. I am a little walrus.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\nHow are you?\\r\\n'], 'output': ['Impossible\\r\\n']}, {'input': ['19\\r\\nHello! Do you like fish? Why?\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\na. A.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['191\\r\\nEvx vnxZtUSgtzH yDNXCsTaxCKQus gVZLHppOplkGGekIK xbme. krbusMqUs YEnBBTJpjNicZPlx TqEtBPcbejZMzvn fFTub CHYWLmiOFkDdzR! LoQmXPfHJ KVnfrbrFooVSkj xwAZwrRr DdILZ kpco cLoRmJbVKhnbOEhnHKpci. PgYhxFPXdlvlrp mDLZBnVRf AgRMUjxepFuLyKlIAhLS wtmEiLDNUAHpZEsKnkOu!\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['146\\r\\niIQVkDsPqzAJyBrtHk EhBSN gzDoigItCMzETerb cIbXhTPbKYMdMoYqyFTEN. qcrrseVwmaZEiQUQoGT SUyErST lJDejKkjqTdoUrHR tsZYDyI? pmuNNHYqQUISxdZfWOB XdEECvNz hnNmVfODaIC qjhRIEPAlEsQBxo apZ! gCpqoiUFIwWLBOmYubywj qJojFVhLd dCpovICpXHfgihydEOoij?\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['151\\r\\nayDIuxJXWNqu OImqJLodviANkQNxZ OpDpwyoPQdZyosXJpqRx! ZFQNQJPnoEVUEEbjqs iyfUYK HuGCOtlsEllsCiHIdEuW ZmlRSWVOmLAD MSYsC? CGKxobjmddejDDdF qbQsAWi qxViwV iLmPHfhLjP ZfNCItjZikwaQyhQGC? bvSaaZhwHdbNKSiiI bEJXRjANEasfrElNHPA UuQCajtuODHgxwgL qbssJss TqT.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['123\\r\\nOjg CVJm qfE RnHislFds nNKKt TCPLWukqNGAsVBplYbTfq? VeYKjfFGTzXWA ydpVZLIImNub yApKnAHv iXQmqv GjQvxrnAgtfTApiQyCKtg. GdmapGwvI udRqxTbnzgnOUNZx slAuEuLGCJycZJvtCczQ vommS xuuT eIK! DOJeFEaubbz HYLGlIIlNKfyaJQKVN eFNnUvKKCQLXvGhwX gjmRscMkedELUlHq? aTbyMGB EofzX wcAEjyRQpxghWvXhdJb cwIz FEUsEFicYZ.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['126\\r\\ntjQvloOnRednqfvIRudX wAPhGdwEZ BiuuuAW EfSzDuRTdC rptjpHnxyM? FkLaTBruN IwuIQMdpdUpn etTVVJUsKztaR YNY EAENiDgJwYXDDrayjyuKp! yKqRNHznLRpnTqjisR LuapWDnWmwYDE NcClOZBNzMYrpa? SEZdSZIgBekpCPvyEiO AMjztArkFRJuS ilycvolFExqxrXJK. sLvBUxjIOomxUqYd jZsOXWN iBtqSykbeUbAsQgRVs DinPLrpzt.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['118\\r\\ngweVo bjbEKaZQw PpSi AWOYt sQSvAHNRswh vUaGuLbtExNECz! USsQxMCjaGOmUESwHvyY SshkERibaWkmNLSZOtWZy FFTUWQgekPRjLRetAdSFt! sIhcimZTisFvndrYioLF HetLn wjoaDUKfbkagupl QdYb fFiV GNqBygStKQw. XLiYZEOGnTLSHmCwktEr pVBePMoRGopNt LdEujxuxzmlbycQdR?\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['16\\r\\nAbacaba. Abacaba. abacaba. abacab.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['21\\r\\nHello. I am a little walrus.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['16\\r\\nAbacaba. Abacab. abacaba. abacaba.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\nhello! how are you?\\r\\n'], 'output': ['Impossible\\r\\n']}, {'input': ['5\\r\\nabc. abcd.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['16\\r\\nabacaba. abacab. Abacaba. Abacaba.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\na. b. c. d.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['8\\r\\nabc! ab.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\na. b.\\r\\n'], 'output': ['2\\r\\n']}]","id":562} {"difficulty":2200,"lang":"Rust","lang_cluster":"Rust","src_uid":"7225266f663699ff7e16b726cadfe9ee","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"\/\/ ---------- begin input macro ----------\n\/\/ reference: https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\/\/ ---------- end input macro ----------\n\nfn run() {\n input! {\n m: u64,\n xaniar: (usize, usize, u64, u64),\n abol: (usize, usize, u64, u64),\n }\n let cond = |b: bool| {\n if !b {\n println!(\"-1\");\n std::process::exit(0);\n }\n };\n let next = |h: usize| -> usize {\n let x = xaniar.2;\n let y = xaniar.3;\n ((h as u64 * x + y) % m) as usize\n };\n let mut time = vec![None; m as usize];\n let mut p = xaniar.0;\n time[p] = Some(0);\n let mut k = 1;\n p = next(p);\n while time[p].is_none() {\n time[p] = Some(k);\n k += 1;\n p = next(p);\n }\n let step = k - time[p].unwrap();\n let a = xaniar.1;\n cond(time[a].is_some());\n if time[a].unwrap() < time[p].unwrap() {\n let next = |h: usize| -> usize {\n let x = abol.2;\n let y = abol.3;\n ((h as u64 * x + y) % m) as usize\n };\n let t = time[a].unwrap();\n let mut p = abol.0;\n for _ in 0..t {\n p = next(p);\n }\n cond(p == abol.1);\n println!(\"{}\", t);\n return;\n }\n let t = time[a].unwrap();\n let mut abol = abol;\n for _ in 0..t {\n abol.0 = {\n let x = abol.2;\n let y = abol.3;\n ((abol.0 as u64 * x + y) % m) as usize\n };\n }\n let mut mat = (1, 0);\n for _ in 0..step {\n mat = (mat.0 * abol.2 % m, (mat.1 * abol.2 + abol.3) % m);\n }\n abol.2 = mat.0;\n abol.3 = mat.1;\n let mut time = vec![None; m as usize];\n let next = |h: usize| -> usize {\n let x = abol.2;\n let y = abol.3;\n ((h as u64 * x + y) % m) as usize\n };\n let mut p = abol.0;\n time[abol.0] = Some(0);\n p = next(p);\n let mut k = 1;\n while time[p].is_some() {\n time[p] = Some(k);\n p = next(p);\n k += 1;\n }\n cond(time[abol.1].is_some());\n let ans = time[abol.1].unwrap() as u64 * step as u64 + t as u64;\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n","description":"Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar. So, if height of Xaniar is h1 and height of Abol is h2, after one second height of Xaniar will become and height of Abol will become where x1,\u2009y1,\u2009x2 and y2 are some integer numbers and denotes the remainder of a modulo b.Mike is a competitive programmer fan. He wants to know the minimum time it takes until height of Xania is a1 and height of Abol is a2.Mike has asked you for your help. Calculate the minimum time or say it will never happen.","input_specification":"The first line of input contains integer m (2\u2009\u2264\u2009m\u2009\u2264\u2009106). The second line of input contains integers h1 and a1 (0\u2009\u2264\u2009h1,\u2009a1\u2009<\u2009m). The third line of input contains integers x1 and y1 (0\u2009\u2264\u2009x1,\u2009y1\u2009<\u2009m). The fourth line of input contains integers h2 and a2 (0\u2009\u2264\u2009h2,\u2009a2\u2009<\u2009m). The fifth line of input contains integers x2 and y2 (0\u2009\u2264\u2009x2,\u2009y2\u2009<\u2009m). It is guaranteed that h1\u2009\u2260\u2009a1 and h2\u2009\u2260\u2009a2.","output_specification":"Print the minimum number of seconds until Xaniar reaches height a1 and Abol reaches height a2 or print -1 otherwise.","notes":"NoteIn the first sample, heights sequences are following:Xaniar: Abol: ","sample_inputs":["5\n4 2\n1 1\n0 1\n2 3","1023\n1 2\n1 0\n1 2\n1 1"],"sample_outputs":["3","-1"],"human_solution":"\/\/ ---------- begin input macro ----------\n\/\/ reference: https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\/\/ ---------- end input macro ----------\n\nfn run() {\n input! {\n m: u64,\n xaniar: (usize, usize, u64, u64),\n abol: (usize, usize, u64, u64),\n }\n let cond = |b: bool| {\n if !b {\n println!(\"-1\");\n std::process::exit(0);\n }\n };\n let next = |h: usize| -> usize {\n let x = xaniar.2;\n let y = xaniar.3;\n ((h as u64 * x + y) % m) as usize\n };\n let mut time = vec![None; m as usize];\n let mut p = xaniar.0;\n time[p] = Some(0);\n let mut k = 1;\n p = next(p);\n while time[p].is_none() {\n time[p] = Some(k);\n k += 1;\n p = next(p);\n }\n let step = k - time[p].unwrap();\n let a = xaniar.1;\n cond(time[a].is_some());\n if time[a].unwrap() < time[p].unwrap() {\n let next = |h: usize| -> usize {\n let x = abol.2;\n let y = abol.3;\n ((h as u64 * x + y) % m) as usize\n };\n let t = time[a].unwrap();\n let mut p = abol.0;\n for _ in 0..t {\n p = next(p);\n }\n cond(p == abol.1);\n println!(\"{}\", t);\n return;\n }\n let t = time[a].unwrap();\n let mut abol = abol;\n for _ in 0..t {\n abol.0 = {\n let x = abol.2;\n let y = abol.3;\n ((abol.0 as u64 * x + y) % m) as usize\n };\n }\n let mut mat = (1, 0);\n for _ in 0..step {\n mat = (mat.0 * abol.2 % m, (mat.1 * abol.2 + abol.3) % m);\n }\n abol.2 = mat.0;\n abol.3 = mat.1;\n let mut time = vec![None; m as usize];\n let next = |h: usize| -> usize {\n let x = abol.2;\n let y = abol.3;\n ((h as u64 * x + y) % m) as usize\n };\n let mut p = abol.0;\n time[abol.0] = Some(0);\n p = next(p);\n let mut k = 1;\n while time[p].is_none() {\n time[p] = Some(k);\n p = next(p);\n k += 1;\n }\n cond(time[abol.1].is_some());\n let ans = time[abol.1].unwrap() as u64 * step as u64 + t as u64;\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': '5\\r\\n4 2\\r\\n1 1\\r\\n0 1\\r\\n2 3\\r\\n', 'output': ['3']}, {'input': '1023\\r\\n1 2\\r\\n1 0\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['-1']}, {'input': '1023\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n', 'output': ['512']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n1 0\\r\\n0 1\\r\\n', 'output': ['-1']}, {'input': '17\\r\\n15 12\\r\\n15 12\\r\\n12 14\\r\\n1 11\\r\\n', 'output': ['-1']}, {'input': '29\\r\\n4 0\\r\\n1 1\\r\\n25 20\\r\\n16 0\\r\\n', 'output': ['170']}, {'input': '91\\r\\n9 64\\r\\n75 32\\r\\n60 81\\r\\n35 46\\r\\n', 'output': ['5']}, {'input': '91\\r\\n38 74\\r\\n66 10\\r\\n40 76\\r\\n17 13\\r\\n', 'output': ['-1']}, {'input': '100\\r\\n11 20\\r\\n99 31\\r\\n60 44\\r\\n45 64\\r\\n', 'output': ['3']}, {'input': '9999\\r\\n4879 6224\\r\\n63 7313\\r\\n4279 6583\\r\\n438 1627\\r\\n', 'output': ['4']}, {'input': '10000\\r\\n8681 4319\\r\\n9740 5980\\r\\n24 137\\r\\n462 7971\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n76036 94415\\r\\n34870 43365\\r\\n56647 26095\\r\\n88580 30995\\r\\n', 'output': ['5']}, {'input': '100000\\r\\n90861 77058\\r\\n96282 30306\\r\\n45940 25601\\r\\n17117 48287\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n220036 846131\\r\\n698020 485511\\r\\n656298 242999\\r\\n766802 905433\\r\\n', 'output': ['5297']}, {'input': '1000000\\r\\n536586 435396\\r\\n748740 34356\\r\\n135075 790803\\r\\n547356 534911\\r\\n', 'output': ['9958']}, {'input': '1000000\\r\\n661647 690400\\r\\n864868 326304\\r\\n581148 452012\\r\\n327910 197092\\r\\n', 'output': ['1021']}, {'input': '1000000\\r\\n233404 949288\\r\\n893747 751429\\r\\n692094 57207\\r\\n674400 583468\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n358465 242431\\r\\n977171 267570\\r\\n170871 616951\\r\\n711850 180241\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n707719 502871\\r\\n60595 816414\\r\\n649648 143990\\r\\n525107 66615\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n192005 690428\\r\\n971158 641039\\r\\n974183 1882\\r\\n127579 312317\\r\\n', 'output': ['470479']}, {'input': '999983\\r\\n420528 808305\\r\\n387096 497121\\r\\n596163 353326\\r\\n47177 758204\\r\\n', 'output': ['548500']}, {'input': '999983\\r\\n651224 992349\\r\\n803017 393514\\r\\n258455 402487\\r\\n888310 244420\\r\\n', 'output': ['126531']}, {'input': '999983\\r\\n151890 906425\\r\\n851007 9094\\r\\n696594 968184\\r\\n867017 157783\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n380412 325756\\r\\n266945 907644\\r\\n318575 83081\\r\\n786616 603671\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n570797 704759\\r\\n723177 763726\\r\\n978676 238272\\r\\n708387 89886\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n408725 408721\\r\\n1 1\\r\\n378562 294895\\r\\n984270 0\\r\\n', 'output': ['499981500166']}, {'input': '999983\\r\\n639420 639416\\r\\n1 1\\r\\n507684 954997\\r\\n466316 0\\r\\n', 'output': ['499981500166']}, {'input': '999983\\r\\n867942 867939\\r\\n1 1\\r\\n963840 536667\\r\\n899441 0\\r\\n', 'output': ['999964000320']}, {'input': '999961\\r\\n664221 931770\\r\\n530542 936292\\r\\n885122 515424\\r\\n868560 472225\\r\\n', 'output': ['-1']}, {'input': '999961\\r\\n744938 661980\\r\\n845908 76370\\r\\n237399 381935\\r\\n418010 938769\\r\\n', 'output': ['203332']}, {'input': '999961\\r\\n89288 89284\\r\\n1 1\\r\\n764559 727291\\r\\n999322 0\\r\\n', 'output': ['999920001595']}, {'input': '1000000\\r\\n661703 661699\\r\\n1 1\\r\\n425192 823944\\r\\n854093 0\\r\\n', 'output': ['-1']}, {'input': '100019\\r\\n98811 98807\\r\\n1 1\\r\\n91322 14787\\r\\n72253 0\\r\\n', 'output': ['10003600319']}, {'input': '524288\\r\\n199980 199978\\r\\n1 1\\r\\n236260 325076\\r\\n81773 0\\r\\n', 'output': ['-1']}, {'input': '524288\\r\\n47283 489031\\r\\n305624 183135\\r\\n141146 335913\\r\\n519614 150715\\r\\n', 'output': ['19']}, {'input': '524288\\r\\n83398 33987\\r\\n158854 211502\\r\\n36433 18758\\r\\n218812 517001\\r\\n', 'output': ['-1']}, {'input': '912488\\r\\n681639 518634\\r\\n168348 212018\\r\\n255428 4970\\r\\n31726 664998\\r\\n', 'output': ['34838']}, {'input': '129081\\r\\n128454 36771\\r\\n116353 2940\\r\\n95311 22200\\r\\n579 118683\\r\\n', 'output': ['68409']}, {'input': '129081\\r\\n45717 106320\\r\\n121816 69841\\r\\n5161 4872\\r\\n102076 100020\\r\\n', 'output': ['-1']}, {'input': '4\\r\\n1 2\\r\\n1 1\\r\\n0 1\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '3\\r\\n1 0\\r\\n1 1\\r\\n1 2\\r\\n2 0\\r\\n', 'output': ['5']}, {'input': '3\\r\\n0 2\\r\\n1 0\\r\\n2 0\\r\\n2 1\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n0 1\\r\\n0 1\\r\\n0 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n1 1\\r\\n0 1\\r\\n1 1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n0 1\\r\\n1 1\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n0 1\\r\\n1 0\\r\\n0 1\\r\\n1 1\\r\\n', 'output': ['-1']}, {'input': '1000000\\r\\n1 0\\r\\n1 1\\r\\n1 0\\r\\n1 1\\r\\n', 'output': ['999999']}, {'input': '1000000\\r\\n2 1\\r\\n1 1\\r\\n2 0\\r\\n1 2\\r\\n', 'output': ['999999']}, {'input': '6\\r\\n1 2\\r\\n3 5\\r\\n0 2\\r\\n4 2\\r\\n', 'output': ['1']}, {'input': '545\\r\\n26 40\\r\\n477 97\\r\\n454 394\\r\\n15 264\\r\\n', 'output': ['90']}, {'input': '3\\r\\n1 0\\r\\n0 1\\r\\n0 2\\r\\n1 0\\r\\n', 'output': ['-1']}, {'input': '1376\\r\\n1227 1349\\r\\n313 193\\r\\n1113 361\\r\\n1314 23\\r\\n', 'output': ['338']}, {'input': '1376\\r\\n1322 1320\\r\\n1 1\\r\\n776 495\\r\\n38 0\\r\\n', 'output': ['-1']}, {'input': '1376\\r\\n152 405\\r\\n1083 1328\\r\\n76 856\\r\\n49 629\\r\\n', 'output': ['-1']}, {'input': '1392\\r\\n1060 796\\r\\n512 242\\r\\n1386 1346\\r\\n1310 1199\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n5827 41281\\r\\n41285 70821\\r\\n99199 42807\\r\\n65667 94952\\r\\n', 'output': ['13770']}, {'input': '100000\\r\\n51157 27741\\r\\n40564 90740\\r\\n45270 52367\\r\\n31585 92150\\r\\n', 'output': ['-1']}, {'input': '100000\\r\\n70525 70522\\r\\n1 1\\r\\n89465 30265\\r\\n33279 0\\r\\n', 'output': ['-1']}, {'input': '10\\r\\n1 6\\r\\n7 9\\r\\n1 4\\r\\n4 0\\r\\n', 'output': ['1']}, {'input': '10\\r\\n9 6\\r\\n0 8\\r\\n3 0\\r\\n2 7\\r\\n', 'output': ['-1']}, {'input': '10\\r\\n4 2\\r\\n1 1\\r\\n7 3\\r\\n9 0\\r\\n', 'output': ['-1']}, {'input': '6\\r\\n5 1\\r\\n1 1\\r\\n3 1\\r\\n3 0\\r\\n', 'output': ['-1']}, {'input': '999983\\r\\n3 1\\r\\n1 1\\r\\n8 1\\r\\n2 0\\r\\n', 'output': ['499981500168']}, {'input': '18\\r\\n3 9\\r\\n3 0\\r\\n1 3\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '18\\r\\n1 3\\r\\n3 0\\r\\n3 9\\r\\n3 0\\r\\n', 'output': ['1']}, {'input': '16\\r\\n1 0\\r\\n2 0\\r\\n1 2\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '16\\r\\n8 0\\r\\n2 0\\r\\n1 4\\r\\n2 0\\r\\n', 'output': ['2']}, {'input': '999983\\r\\n2 1\\r\\n2 0\\r\\n1 0\\r\\n1 1\\r\\n', 'output': ['499982500152']}, {'input': '324\\r\\n2 54\\r\\n3 0\\r\\n27 108\\r\\n2 0\\r\\n', 'output': ['-1']}, {'input': '999993\\r\\n499997 1\\r\\n2 3\\r\\n1 4\\r\\n1 1\\r\\n', 'output': ['39325724721']}, {'input': '999983\\r\\n1 37827\\r\\n1 1\\r\\n2 192083\\r\\n3 0\\r\\n', 'output': ['404303164556']}, {'input': '41222\\r\\n30759 26408\\r\\n31332 39118\\r\\n5026 25812\\r\\n1 9030\\r\\n', 'output': ['58900566']}, {'input': '100007\\r\\n2 1\\r\\n2 0\\r\\n3 1\\r\\n1 1\\r\\n', 'output': ['434330399']}, {'input': '8\\r\\n0 4\\r\\n4 4\\r\\n1 4\\r\\n2 0\\r\\n', 'output': ['2']}]","id":563} {"difficulty":2000,"lang":"Rust","lang_cluster":"Rust","src_uid":"75ec99318736a8a1b62a8d51efd95355","execute_outcome":"WRONG_ANSWER","source_code":"fn main() {\n\n use std::io::{self, Read};\n use std::cmp::Ordering;\n use std::collections::{HashMap,HashSet};\n use std::mem;\n \n let mut buffer = String::new();\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n\n handle.read_to_string(&mut buffer).unwrap();\n\n let input_strs = buffer.split_whitespace().take(3).map( |x| x.parse::().unwrap() ).collect::< Vec >();\n\n let n = *input_strs.iter().nth(0).unwrap();\n\n let mut hs = HashSet::new();\n hs.insert(0);\n\n let mut dp_count = HashMap::new();\n \n \/\/strategy: use dp and the number of additional unique values added per round tops off at some point for value denominations of 1, 5, 10, 50\n \/\/ so use that value for bigger number of rounds\n for i in 0..13 {\n let mut temp = HashSet::new();\n for j in hs.iter() {\n temp.insert( *j + 1 );\n temp.insert( *j + 5 );\n temp.insert( *j + 10 );\n temp.insert( *j + 50 );\n }\n mem::swap( & mut temp, & mut hs );\n let count = hs.len();\n dp_count.insert(i+1, count);\n }\n\n let ans = if n <= 12 {\n *dp_count.get(&n).expect(\"dp_count\")\n } else {\n let increment = *dp_count.get(&12).unwrap() - *dp_count.get(&11).unwrap();\n *dp_count.get(&12).unwrap() + (n as usize - 12) * increment\n };\n println!( \"{}\", ans );\n}\n","description":"Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers $$$1$$$, $$$5$$$, $$$10$$$ and $$$50$$$ respectively. The use of other roman digits is not allowed.Numbers in this system are written as a sequence of one or more digits. We define the value of the sequence simply as the sum of digits in it.For example, the number XXXV evaluates to $$$35$$$ and the number IXI\u00a0\u2014 to $$$12$$$.Pay attention to the difference to the traditional roman system\u00a0\u2014 in our system any sequence of digits is valid, moreover the order of digits doesn't matter, for example IX means $$$11$$$, not $$$9$$$.One can notice that this system is ambiguous, and some numbers can be written in many different ways. Your goal is to determine how many distinct integers can be represented by exactly $$$n$$$ roman digits I, V, X, L.","input_specification":"The only line of the input file contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^9$$$)\u00a0\u2014 the number of roman digits to use.","output_specification":"Output a single integer\u00a0\u2014 the number of distinct integers which can be represented using $$$n$$$ roman digits exactly.","notes":"NoteIn the first sample there are exactly $$$4$$$ integers which can be represented\u00a0\u2014 I, V, X and L.In the second sample it is possible to represent integers $$$2$$$ (II), $$$6$$$ (VI), $$$10$$$ (VV), $$$11$$$ (XI), $$$15$$$ (XV), $$$20$$$ (XX), $$$51$$$ (IL), $$$55$$$ (VL), $$$60$$$ (XL) and $$$100$$$ (LL).","sample_inputs":["1","2","10"],"sample_outputs":["4","10","244"],"human_solution":"fn main() {\n\n use std::io::{self, Read};\n use std::cmp::Ordering;\n use std::collections::{HashMap,HashSet};\n use std::mem;\n \n let mut buffer = String::new();\n let stdin = io::stdin();\n let mut handle = stdin.lock();\n\n handle.read_to_string(&mut buffer).unwrap();\n\n let input_strs = buffer.split_whitespace().take(3).map( |x| x.parse::().unwrap() ).collect::< Vec >();\n\n let n = *input_strs.iter().nth(0).unwrap();\n\n let mut hs = HashSet::new();\n hs.insert(0);\n\n let mut dp_count = HashMap::new();\n\n \/\/dp_count.insert( &0, 1 );\n \n \/\/strategy: use dp and the number of additional unique values added per round tops off at some point for value denominations of 1, 5, 10, 50\n \/\/ so use that value for bigger number of rounds\n for i in 0..13 {\n let mut temp = HashSet::new();\n for j in hs.iter() {\n temp.insert( *j + 1i64 );\n temp.insert( *j + 5i64 );\n temp.insert( *j + 10i64 );\n temp.insert( *j + 50i64 );\n }\n mem::swap( & mut temp, & mut hs );\n let count = hs.len();\n dp_count.insert(i+1, count);\n }\n\n let ans = if n <= 12 {\n *dp_count.get(&n).expect(\"dp_count\") as i64\n } else {\n let increment = *dp_count.get(&12).unwrap() - *dp_count.get(&11).unwrap();\n *dp_count.get(&12).unwrap() as i64 + (n as i64 - 12i64) * increment as i64\n };\n println!( \"{}\", ans );\n}\n","testcases":"[{'input': '1\\r\\n', 'output': ['4']}, {'input': '2\\r\\n', 'output': ['10']}, {'input': '10\\r\\n', 'output': ['244']}, {'input': '1000\\r\\n', 'output': ['48753']}, {'input': '2000\\r\\n', 'output': ['97753']}, {'input': '5000\\r\\n', 'output': ['244753']}, {'input': '10000\\r\\n', 'output': ['489753']}, {'input': '111199\\r\\n', 'output': ['5448504']}, {'input': '101232812\\r\\n', 'output': ['4960407541']}, {'input': '1000000000\\r\\n', 'output': ['48999999753']}, {'input': '3\\r\\n', 'output': ['20']}, {'input': '4\\r\\n', 'output': ['35']}, {'input': '5\\r\\n', 'output': ['56']}, {'input': '6\\r\\n', 'output': ['83']}, {'input': '7\\r\\n', 'output': ['116']}, {'input': '8\\r\\n', 'output': ['155']}, {'input': '9\\r\\n', 'output': ['198']}, {'input': '11\\r\\n', 'output': ['292']}, {'input': '12\\r\\n', 'output': ['341']}, {'input': '13\\r\\n', 'output': ['390']}, {'input': '55\\r\\n', 'output': ['2448']}, {'input': '100\\r\\n', 'output': ['4653']}, {'input': '150\\r\\n', 'output': ['7103']}, {'input': '1200\\r\\n', 'output': ['58553']}, {'input': '9999999\\r\\n', 'output': ['489999704']}, {'input': '100000000\\r\\n', 'output': ['4899999753']}, {'input': '500000000\\r\\n', 'output': ['24499999753']}, {'input': '600000000\\r\\n', 'output': ['29399999753']}, {'input': '709000900\\r\\n', 'output': ['34741043853']}, {'input': '999999999\\r\\n', 'output': ['48999999704']}, {'input': '20\\r\\n', 'output': ['733']}, {'input': '35\\r\\n', 'output': ['1468']}, {'input': '56\\r\\n', 'output': ['2497']}, {'input': '83\\r\\n', 'output': ['3820']}, {'input': '116\\r\\n', 'output': ['5437']}, {'input': '155\\r\\n', 'output': ['7348']}, {'input': '198\\r\\n', 'output': ['9455']}, {'input': '244\\r\\n', 'output': ['11709']}, {'input': '292\\r\\n', 'output': ['14061']}, {'input': '14\\r\\n', 'output': ['439']}]","id":564} {"difficulty":2400,"lang":"Rust","lang_cluster":"Rust","src_uid":"788cb3da98fd4a56720f800588061b79","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ ---------- begin ModInt ----------\nconst MOD: u32 = 1_000_000_007;\n\n#[derive(Clone, Copy)]\nstruct ModInt(u32);\n\nimpl std::ops::Add for ModInt {\n type Output = ModInt;\n fn add(self, rhs: ModInt) -> Self::Output {\n let mut d = self.0 + rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::AddAssign for ModInt {\n fn add_assign(&mut self, rhs: ModInt) {\n *self = *self + rhs;\n }\n}\n\nimpl std::ops::Sub for ModInt {\n type Output = ModInt;\n fn sub(self, rhs: ModInt) -> Self::Output {\n let mut d = self.0 + MOD - rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::SubAssign for ModInt {\n fn sub_assign(&mut self, rhs: ModInt) {\n *self = *self - rhs;\n }\n}\n\nimpl std::ops::Mul for ModInt {\n type Output = ModInt;\n fn mul(self, rhs: ModInt) -> Self::Output {\n ModInt((self.0 as u64 * rhs.0 as u64 % MOD as u64) as u32)\n }\n}\n\nimpl std::ops::MulAssign for ModInt {\n fn mul_assign(&mut self, rhs: ModInt) {\n *self = *self * rhs;\n }\n}\n\nimpl std::ops::Neg for ModInt {\n type Output = ModInt;\n fn neg(self) -> Self::Output {\n ModInt(if self.0 == 0 {0} else {MOD - self.0})\n }\n}\n\nimpl std::fmt::Display for ModInt {\n fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {\n write!(f, \"{}\", self.0)\n }\n}\n\nimpl std::str::FromStr for ModInt {\n type Err = std::num::ParseIntError;\n fn from_str(s: &str) -> Result {\n let val = s.parse::()?;\n Ok(ModInt::new(val))\n }\n}\n\nimpl From for ModInt {\n fn from(val: usize) -> Self {\n ModInt((val % MOD as usize) as u32)\n }\n}\n\n#[allow(dead_code)]\nimpl ModInt {\n pub fn new(n: u32) -> ModInt {\n ModInt(n % MOD)\n }\n pub fn zero() -> ModInt {\n ModInt(0)\n }\n pub fn one() -> ModInt {\n ModInt(1)\n }\n pub fn pow(self, mut n: u32) -> ModInt {\n let mut t = ModInt::one();\n let mut s = self;\n while n > 0 {\n if n & 1 == 1 {\n t *= s;\n }\n s *= s;\n n >>= 1;\n }\n t\n }\n pub fn inv(self) -> ModInt {\n assert!(self.0 > 0);\n self.pow(MOD - 2)\n }\n}\n\/\/ ---------- end ModInt ----------\n\/\/ ---------- begin Precalc ----------\n#[allow(dead_code)]\nstruct Precalc {\n inv: Vec,\n fact: Vec,\n ifact: Vec,\n}\n\n#[allow(dead_code)]\nimpl Precalc {\n pub fn new(n: usize) -> Precalc {\n let mut inv = vec![ModInt::one(); n + 1];\n let mut fact = vec![ModInt::one(); n + 1];\n let mut ifact = vec![ModInt::one(); n + 1];\n for i in 2..(n + 1) {\n inv[i] = -inv[MOD as usize % i] * ModInt(MOD \/ i as u32);\n fact[i] = fact[i - 1] * ModInt(i as u32);\n ifact[i] = ifact[i - 1] * inv[i];\n }\n Precalc {\n inv: inv,\n fact: fact,\n ifact: ifact,\n }\n }\n pub fn inv(&self, n: usize) -> ModInt {\n self.inv[n]\n }\n pub fn fact(&self, n: usize) -> ModInt {\n self.fact[n]\n }\n pub fn ifact(&self, n: usize) -> ModInt {\n self.ifact[n]\n }\n pub fn comb(&self, n: usize, k: usize) -> ModInt {\n if k > n {\n return ModInt::zero();\n }\n self.fact[n] * self.ifact[k] * self.ifact[n - k]\n }\n}\n\/\/ ---------- end Precalc ----------\n\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nfn run() {\n input! {\n n: usize,\n w: usize,\n a: [usize; n],\n }\n let mut a = a;\n a.sort();\n let mut dp = vec![vec![ModInt::zero(); w + 1]; 2];\n dp[0][0] = ModInt::one();\n dp[1][0] = ModInt::one();\n for d in a.windows(2) {\n let d = d[1] - d[0];\n let mut next = vec![vec![ModInt::zero(); w + 1]; dp.len() + 1];\n \/\/ \u5358\u4f53\n for (i, dp) in dp.iter().enumerate() {\n let next = &mut next[i];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += v;\n } else {\n break;\n }\n }\n }\n \/\/ \u9589\u3058\u308b\n for (i, dp) in dp.iter().enumerate().skip(1) {\n let next = &mut next[i - 1];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += v;\n } else {\n break;\n }\n }\n }\n \/\/ \u5272\u308a\u5f53\u3066\n for (i, dp) in dp.iter().enumerate().skip(1) {\n let next = &mut next[i];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += ModInt::from(i) * v;\n } else {\n break;\n }\n }\n }\n \/\/ \u958b\u304f\n for (i, dp) in dp.iter().enumerate() {\n let next = &mut next[i + 1];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += v;\n } else {\n break;\n }\n }\n }\n dp = next;\n }\n let mut ans = ModInt::zero();\n for a in dp[0].iter() {\n ans += *a;\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n","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"],"human_solution":"\/\/ ---------- begin ModInt ----------\nconst MOD: u32 = 1_000_000_007;\n\n#[derive(Clone, Copy)]\nstruct ModInt(u32);\n\nimpl std::ops::Add for ModInt {\n type Output = ModInt;\n fn add(self, rhs: ModInt) -> Self::Output {\n let mut d = self.0 + rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::AddAssign for ModInt {\n fn add_assign(&mut self, rhs: ModInt) {\n *self = *self + rhs;\n }\n}\n\nimpl std::ops::Sub for ModInt {\n type Output = ModInt;\n fn sub(self, rhs: ModInt) -> Self::Output {\n let mut d = self.0 + MOD - rhs.0;\n if d >= MOD {\n d -= MOD;\n }\n ModInt(d)\n }\n}\n\nimpl std::ops::SubAssign for ModInt {\n fn sub_assign(&mut self, rhs: ModInt) {\n *self = *self - rhs;\n }\n}\n\nimpl std::ops::Mul for ModInt {\n type Output = ModInt;\n fn mul(self, rhs: ModInt) -> Self::Output {\n ModInt((self.0 as u64 * rhs.0 as u64 % MOD as u64) as u32)\n }\n}\n\nimpl std::ops::MulAssign for ModInt {\n fn mul_assign(&mut self, rhs: ModInt) {\n *self = *self * rhs;\n }\n}\n\nimpl std::ops::Neg for ModInt {\n type Output = ModInt;\n fn neg(self) -> Self::Output {\n ModInt(if self.0 == 0 {0} else {MOD - self.0})\n }\n}\n\nimpl std::fmt::Display for ModInt {\n fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {\n write!(f, \"{}\", self.0)\n }\n}\n\nimpl std::str::FromStr for ModInt {\n type Err = std::num::ParseIntError;\n fn from_str(s: &str) -> Result {\n let val = s.parse::()?;\n Ok(ModInt::new(val))\n }\n}\n\nimpl From for ModInt {\n fn from(val: usize) -> Self {\n ModInt((val % MOD as usize) as u32)\n }\n}\n\n#[allow(dead_code)]\nimpl ModInt {\n pub fn new(n: u32) -> ModInt {\n ModInt(n % MOD)\n }\n pub fn zero() -> ModInt {\n ModInt(0)\n }\n pub fn one() -> ModInt {\n ModInt(1)\n }\n pub fn pow(self, mut n: u32) -> ModInt {\n let mut t = ModInt::one();\n let mut s = self;\n while n > 0 {\n if n & 1 == 1 {\n t *= s;\n }\n s *= s;\n n >>= 1;\n }\n t\n }\n pub fn inv(self) -> ModInt {\n assert!(self.0 > 0);\n self.pow(MOD - 2)\n }\n}\n\/\/ ---------- end ModInt ----------\n\/\/ ---------- begin Precalc ----------\n#[allow(dead_code)]\nstruct Precalc {\n inv: Vec,\n fact: Vec,\n ifact: Vec,\n}\n\n#[allow(dead_code)]\nimpl Precalc {\n pub fn new(n: usize) -> Precalc {\n let mut inv = vec![ModInt::one(); n + 1];\n let mut fact = vec![ModInt::one(); n + 1];\n let mut ifact = vec![ModInt::one(); n + 1];\n for i in 2..(n + 1) {\n inv[i] = -inv[MOD as usize % i] * ModInt(MOD \/ i as u32);\n fact[i] = fact[i - 1] * ModInt(i as u32);\n ifact[i] = ifact[i - 1] * inv[i];\n }\n Precalc {\n inv: inv,\n fact: fact,\n ifact: ifact,\n }\n }\n pub fn inv(&self, n: usize) -> ModInt {\n self.inv[n]\n }\n pub fn fact(&self, n: usize) -> ModInt {\n self.fact[n]\n }\n pub fn ifact(&self, n: usize) -> ModInt {\n self.ifact[n]\n }\n pub fn comb(&self, n: usize, k: usize) -> ModInt {\n if k > n {\n return ModInt::zero();\n }\n self.fact[n] * self.ifact[k] * self.ifact[n - k]\n }\n}\n\/\/ ---------- end Precalc ----------\n\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nfn run() {\n input! {\n n: usize,\n w: usize,\n a: [usize; n],\n }\n let mut a = a;\n a.sort();\n let mut dp = vec![vec![ModInt::zero(); w + 1]; 2];\n dp[0][0] = ModInt::one();\n dp[1][0] = ModInt::one();\n for d in a.windows(2) {\n let d = d[1] - d[0];\n let mut next = vec![vec![ModInt::zero(); w + 1]; dp.len() + 1];\n \/\/ \u5358\u4f53\n for (i, dp) in dp.iter().enumerate() {\n let next = &mut next[i];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += v;\n } else {\n break;\n }\n }\n }\n \/\/ \u9589\u3058\u308b\n for (i, dp) in dp.iter().enumerate().skip(1) {\n let next = &mut next[i - 1];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += ModInt::from(i) * v;\n } else {\n break;\n }\n }\n }\n \/\/ \u5272\u308a\u5f53\u3066\n for (i, dp) in dp.iter().enumerate().skip(1) {\n let next = &mut next[i];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += ModInt::from(i) * v;\n } else {\n break;\n }\n }\n }\n \/\/ \u958b\u304f\n for (i, dp) in dp.iter().enumerate() {\n let next = &mut next[i + 1];\n for (j, &v) in dp.iter().enumerate() {\n if let Some(p) = next.get_mut(j + i * d) {\n *p += v;\n } else {\n break;\n }\n }\n }\n dp = next;\n }\n let mut ans = ModInt::zero();\n for a in dp[0].iter() {\n ans += *a;\n }\n println!(\"{}\", ans);\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': '3 2\\r\\n2 4 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 3\\r\\n7 8 9 10\\r\\n', 'output': ['13\\r\\n']}, {'input': '4 0\\r\\n5 10 20 21\\r\\n', 'output': ['1\\r\\n']}, {'input': '20 1000\\r\\n50 50 100 100 150 150 200 200 250 250 300 300 350 350 400 400 450 450 500 500\\r\\n', 'output': ['97456952\\r\\n']}, {'input': '5 222\\r\\n58 369 477 58 90\\r\\n', 'output': ['10\\r\\n']}, {'input': '9 222\\r\\n304 142 38 334 73 122 252 381 438\\r\\n', 'output': ['423\\r\\n']}, {'input': '9 247\\r\\n359 350 140 26 293 488 57 481 71\\r\\n', 'output': ['414\\r\\n']}, {'input': '5 341\\r\\n412 32 189 303 172\\r\\n', 'output': ['26\\r\\n']}, {'input': '200 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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': ['380668983\\r\\n']}, {'input': '121 19\\r\\n1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 1 1 2 1 1 1 1 2 2 2 2 1 1 2 1 1 2 1 1 1 1 1 2 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 1 1 2 1 1 2 2 1 1 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 1 2 1 2 2 2 2 2 1 1 2 2 1 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 1 1 1 1 1 2 2 1 2 1\\r\\n', 'output': ['378568711\\r\\n']}, {'input': '3 4\\r\\n10 7 10\\r\\n', 'output': ['5\\r\\n']}, {'input': '1 5\\r\\n3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 5\\r\\n9\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 2\\r\\n3 10 5 6 5\\r\\n', 'output': ['8\\r\\n']}, {'input': '1 2\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '166 7\\r\\n9 8 7 2 9 9 7 7 3 1 9 9 9 7 1 5 5 6 6 2 3 2 10 9 3 5 8 8 6 3 10 3 4 8 6 5 1 7 2 9 1 4 9 10 6 8 6 7 8 3 2 1 10 5 6 6 3 7 4 9 10 3 1 10 9 9 2 10 3 2 4 8 9 6 1 9 10 10 10 9 5 8 9 7 9 6 7 5 4 7 8 9 8 5 10 5 4 10 8 5 10 10 10 8 7 3 2 6 3 1 7 5 7 10 7 8 8 8 5 5 8 10 2 10 2 4 10 2 3 1 1 4 5 8 7 9 4 10 2 9 8 1 1 5 9 5 2 1 7 7 9 10 2 2 10 10 6 8 5 5 9 4 3 1 10 5\\r\\n', 'output': ['194851520\\r\\n']}, {'input': '94 17\\r\\n9 10 10 5 2 7 10 9 5 5 7 7 6 10 4 10 3 7 4 9 2 5 1 5 4 2 9 8 4 3 9 5 7 10 10 6 3 1 9 9 2 8 8 8 7 2 4 5 2 5 7 7 4 9 4 9 4 10 5 10 9 7 3 6 10 3 1 10 6 4 8 9 4 10 7 2 9 8 7 10 2 2 4 1 4 6 10 7 2 4 9 4 8 5\\r\\n', 'output': ['650765262\\r\\n']}, {'input': '14 26\\r\\n3 7 8 4 7 5 10 8 4 4 1 6 7 7\\r\\n', 'output': ['190894282\\r\\n']}, {'input': '142 24\\r\\n8 1 10 6 5 3 9 4 4 8 2 7 4 4 1 2 7 4 7 3 3 9 9 6 6 10 8 5 3 2 3 4 7 9 9 8 4 7 8 6 9 1 7 9 10 2 6 1 9 9 1 10 2 10 6 5 10 2 3 8 3 7 1 8 9 10 1 8 10 7 2 5 1 1 4 6 5 7 6 10 4 4 7 4 10 5 10 9 8 7 4 10 4 4 3 4 10 6 1 4 8 5 10 6 3 8 8 4 2 3 2 1 7 5 2 4 2 3 10 7 8 3 10 9 1 7 7 5 5 5 10 8 8 2 6 9 7 2 4 7 7 3\\r\\n', 'output': ['287439553\\r\\n']}, {'input': '166 34\\r\\n6 5 3 3 4 5 4 6 4 6 2 6 5 1 7 4 5 5 6 1 2 2 6 4 3 7 4 5 1 7 3 1 6 5 1 3 6 4 9 7 6 6 6 5 8 6 2 4 5 6 10 10 4 8 3 6 1 4 7 9 8 5 2 9 8 10 2 2 6 1 3 6 6 9 10 8 10 5 8 10 5 9 2 4 8 2 9 2 1 9 5 9 3 8 1 10 4 1 1 4 9 6 10 6 2 1 4 5 5 8 10 10 5 6 3 10 1 8 5 10 3 3 10 9 7 4 1 9 9 10 8 3 4 2 8 10 6 3 10 10 4 6 8 7 9 7 10 3 1 10 4 10 5 2 7 9 4 10 6 2 6 3 9 10 9 10\\r\\n', 'output': ['772974256\\r\\n']}, {'input': '171 302\\r\\n64 51 53 35 36 42 67 27 55 85 97 23 47 8 59 69 50 15 28 36 22 12 49 99 54 11 10 91 91 78 59 65 68 5 20 77 42 59 85 65 69 35 59 86 45 96 41 82 89 93 80 25 16 22 68 8 23 57 48 53 16 21 50 44 70 75 33 32 43 32 77 40 8 41 23 82 61 51 26 88 58 23 6 69 11 95 89 41 70 95 81 50 99 81 48 36 62 85 64 58 25 30 23 27 30 87 45 42 67 47 1 1 86 33 43 78 41 57 72 86 55 25 69 36 77 97 48 24 9 20 50 5 2 84 80 62 7 5 49 2 16 3 62 8 40 24 94 60 9 95 22 27 58 20 22 95 16 53 6 8 74 54 94 65 62 90 95 17 77 32 99\\r\\n', 'output': ['49555477\\r\\n']}, {'input': '158 396\\r\\n10 33 14 7 23 30 23 9 99 41 88 56 70 25 85 27 68 60 73 14 32 87 6 16 71 64 22 66 9 48 46 93 81 9 50 48 80 70 78 76 49 89 56 74 56 40 67 45 3 41 77 49 8 56 55 29 78 69 52 70 55 99 85 6 59 99 24 66 4 23 4 51 84 67 79 65 6 67 80 36 85 47 45 37 75 38 39 59 7 11 81 7 12 79 56 87 9 97 30 32 27 21 42 85 17 50 69 13 51 12 73 60 14 94 93 31 10 9 70 67 52 63 45 38 37 13 46 50 53 29 50 57 49 81 71 79 58 74 19 47 19 14 16 82 18 11 71 90 28 21 48 16 41 52 24 6 4 23\\r\\n', 'output': ['757778575\\r\\n']}, {'input': '169 129\\r\\n66 70 83 26 65 94 1 56 17 64 58 68 23 73 45 93 30 94 22 55 68 29 73 44 35 39 71 76 76 76 19 98 99 26 43 73 96 6 72 23 8 56 34 17 91 64 17 33 56 92 41 22 92 59 23 96 35 94 82 1 61 41 75 89 10 74 13 64 50 78 49 83 6 62 43 22 61 95 28 4 76 14 54 41 83 81 83 23 13 57 10 2 44 54 89 41 27 58 57 47 26 82 97 82 5 35 27 31 89 6 73 36 94 89 29 96 3 88 82 27 50 56 73 24 17 56 25 9 2 47 71 86 96 79 35 42 31 73 13 89 52 30 88 96 46 91 23 60 79 2 19 7 73 40 6 29 61 29 67 85 75 11 8 34 60 19 87 23 55\\r\\n', 'output': ['538924707\\r\\n']}, {'input': '195 110\\r\\n3 4 5 1 3 5 4 1 2 4 3 2 4 4 3 2 5 5 5 3 3 3 5 3 5 4 2 5 1 1 2 3 4 5 5 2 2 4 3 4 2 4 4 3 4 2 3 3 3 5 2 1 3 2 5 5 2 2 1 2 2 5 4 2 4 2 4 1 4 2 4 4 4 4 3 5 3 1 2 2 3 4 3 4 4 1 2 1 2 4 5 2 4 3 4 1 4 4 4 5 1 2 4 5 3 5 3 4 2 4 5 2 5 2 5 4 1 5 1 4 2 5 1 2 4 1 3 3 5 5 4 2 3 4 5 4 4 5 2 3 4 2 5 3 2 1 5 3 5 3 5 2 3 2 5 3 5 4 5 1 5 3 3 2 2 5 4 3 3 2 5 5 5 5 2 1 2 3 1 3 5 2 4 5 3 2 2 5 5 2 3 1 3 4 5\\r\\n', 'output': ['21311661\\r\\n']}, {'input': '196 17\\r\\n4 4 2 2 4 2 2 4 4 3 4 1 5 4 4 5 4 1 1 1 5 1 1 4 3 4 4 1 1 1 5 3 2 4 2 1 5 3 4 2 4 2 5 4 1 4 1 2 3 5 3 5 3 2 5 5 5 2 2 1 1 2 2 2 5 4 5 2 5 5 3 1 5 3 5 5 1 3 3 2 3 2 2 1 5 1 2 5 4 5 4 3 4 4 4 1 5 5 2 2 2 5 3 4 5 3 3 2 4 4 4 3 1 1 1 5 2 5 1 5 1 2 3 3 4 4 5 4 2 5 4 2 3 3 4 5 2 2 4 5 5 2 2 1 3 3 4 3 2 3 4 4 5 2 5 1 4 5 2 3 2 4 4 3 4 4 2 5 5 5 5 4 1 3 2 1 4 5 3 2 3 3 5 4 3 1 4 4 5 2 5 2 2 1 4 3\\r\\n', 'output': ['140496580\\r\\n']}, {'input': '200 558\\r\\n1 1 1 3 2 1 1 5 1 2 1 1 2 2 1 5 2 5 2 5 3 2 4 1 5 2 3 2 3 1 2 2 1 4 4 2 5 1 4 3 2 2 4 5 4 5 2 5 5 4 3 5 4 5 5 2 3 4 3 1 5 4 3 3 3 3 2 2 3 4 1 3 1 4 5 2 3 4 1 5 2 3 3 5 5 3 3 1 2 5 3 4 2 5 2 3 3 1 3 2 3 5 1 2 1 1 3 4 1 3 2 1 1 4 2 5 1 2 1 2 2 2 2 2 3 4 2 2 4 4 2 1 3 3 2 4 1 3 5 4 5 1 5 2 1 4 2 3 4 1 4 5 1 1 5 2 4 5 5 4 4 5 3 1 1 5 4 2 2 5 1 3 3 3 4 1 1 2 3 4 1 5 2 2 3 1 4 3 5 1 5 3 2 1 3 2 1 1 3 2\\r\\n', 'output': ['380668983\\r\\n']}, {'input': '190 152\\r\\n2 2 4 4 4 2 2 1 2 3 5 5 4 3 5 1 2 2 2 2 3 3 5 2 1 1 3 4 3 2 2 4 2 3 1 4 2 2 3 2 3 5 3 2 4 1 4 1 2 4 1 3 4 4 3 4 4 4 4 5 2 4 5 3 3 5 4 4 3 4 1 4 1 4 3 3 5 5 2 3 2 2 2 5 4 4 2 4 3 4 2 2 1 4 1 2 3 3 3 5 1 5 5 1 4 3 2 5 2 5 5 5 2 3 3 4 1 1 3 2 5 5 2 5 2 3 5 1 1 5 4 1 1 3 5 2 3 4 3 4 2 1 4 3 5 2 1 1 1 5 2 5 3 4 5 5 2 3 5 5 5 5 1 5 2 5 5 2 4 4 4 3 1 1 2 1 4 4 3 4 2 5 5 3 4 5 5 2 1 4\\r\\n', 'output': ['3475416\\r\\n']}, {'input': '191 640\\r\\n20 10 14 20 13 9 16 5 14 1 11 18 16 17 7 4 15 18 17 3 3 15 14 20 18 2 4 14 20 17 7 2 3 9 5 10 7 6 7 17 3 5 10 1 18 13 15 4 15 7 19 1 17 6 15 12 4 19 1 9 18 18 9 13 3 15 9 3 17 14 18 4 9 3 9 19 20 15 18 11 3 1 12 8 11 10 20 14 14 6 2 14 16 1 7 2 11 15 1 9 20 4 1 1 3 20 20 4 11 7 19 3 3 6 15 10 18 9 13 14 16 12 3 1 15 10 5 14 19 17 9 10 10 15 12 12 5 2 11 6 5 6 7 14 7 6 5 10 13 10 18 20 18 20 12 7 6 10 4 4 3 13 14 5 9 10 4 6 11 11 15 15 12 19 4 7 20 3 12 4 16 6 4 9 17 10 18 11 13 12 18\\r\\n', 'output': ['66598866\\r\\n']}, {'input': '197 344\\r\\n5 11 3 17 16 1 12 7 13 5 9 11 15 14 13 7 13 11 5 9 20 11 11 9 19 3 20 4 6 15 2 14 16 5 19 5 5 5 12 12 12 19 18 1 5 17 13 7 17 14 4 5 9 20 14 13 15 3 8 2 13 16 20 10 20 14 8 17 14 4 9 16 8 13 5 2 13 11 9 7 9 5 11 20 3 17 9 12 12 3 9 19 6 3 15 9 5 11 2 3 13 14 15 7 9 19 16 11 6 8 11 18 11 11 16 18 3 5 10 19 10 6 3 19 3 18 16 16 7 3 10 13 13 16 19 13 4 7 1 7 12 9 6 8 6 1 6 20 7 12 9 13 13 12 10 10 10 16 9 6 11 14 14 7 2 1 16 15 12 7 15 18 8 4 6 18 2 17 6 5 13 19 12 7 1 9 15 9 18 5 8 3 7 8 4 15 8\\r\\n', 'output': ['132934747\\r\\n']}, {'input': '200 0\\r\\n2 5 2 7 6 10 10 4 7 9 1 5 7 1 8 5 9 8 5 2 6 4 9 10 5 4 4 4 8 7 7 5 9 7 7 4 9 8 5 8 10 5 1 2 8 4 3 7 9 6 9 3 9 2 1 9 2 7 4 10 4 7 10 6 1 6 7 4 4 9 10 3 5 5 1 2 8 6 6 2 2 8 6 3 6 1 4 6 10 6 4 8 3 9 6 7 7 8 5 2 10 9 2 7 3 6 10 6 8 9 6 6 8 4 6 9 2 10 9 4 2 3 4 1 3 9 4 2 4 10 10 1 2 3 9 8 2 1 10 7 8 3 10 5 3 10 9 1 9 2 6 7 2 1 10 4 4 9 9 1 8 1 10 9 8 9 9 7 4 3 6 7 10 9 2 7 8 10 2 7 7 6 9 5 9 7 3 1 7 1 5 9 7 3 10 3 10 8 5 7\\r\\n', 'output': ['563633437\\r\\n']}, {'input': '107 59\\r\\n416 332 455 497 251 13 496 46 176 382 357 268 441 302 305 11 274 61 412 18 225 332 173 371 54 179 378 85 471 176 439 36 81 275 452 212 261 488 166 274 89 183 478 337 313 196 130 87 14 223 341 46 45 306 175 488 113 354 107 411 469 122 436 293 311 60 453 245 184 13 425 360 302 205 151 89 433 285 119 301 274 64 127 496 350 354 262 2 148 232 117 28 11 398 237 460 421 347 142 76 391 317 164 484 35 310 453\\r\\n', 'output': ['955755252\\r\\n']}, {'input': '27 383\\r\\n161 2 16 478 438 205 151 229 116 230 447 497 456 219 28 57 200 6 161 400 338 11 426 283 275 40 190\\r\\n', 'output': ['258971846\\r\\n']}, {'input': '107 497\\r\\n218 342 381 296 272 169 321 275 435 461 422 209 413 366 295 332 458 253 302 245 70 353 405 420 439 314 232 466 364 374 4 469 116 291 75 500 212 127 157 440 429 396 53 68 151 264 2 134 73 31 494 148 426 459 27 175 225 287 241 60 14 437 457 446 51 350 233 177 88 455 497 303 107 130 76 125 441 229 325 318 187 459 178 172 226 236 465 289 491 494 146 280 456 475 286 457 277 224 435 365 100 77 145 448 118 454 431\\r\\n', 'output': ['480907144\\r\\n']}, {'input': '27 209\\r\\n272 116 134 369 255 453 477 162 78 1 12 142 236 283 209 390 476 493 51 23 387 32 262 128 160 71 56\\r\\n', 'output': ['415376034\\r\\n']}, {'input': '85 655\\r\\n411 473 456 4 14 135 49 240 191 230 60 375 373 115 301 20 421 187 267 347 207 428 81 318 10 370 428 272 247 322 294 477 274 110 238 244 72 399 146 392 207 83 164 87 257 341 97 94 286 375 25 271 177 270 169 149 279 105 387 92 352 342 274 247 236 344 35 336 419 465 169 371 62 112 490 48 36 343 248 428 241 223 369 296 86\\r\\n', 'output': ['275193712\\r\\n']}, {'input': '107 19\\r\\n2 5 2 5 4 4 1 5 3 3 4 3 2 5 3 1 4 1 4 1 3 1 4 4 1 5 4 1 2 3 3 3 4 2 5 2 3 4 5 2 1 5 3 1 5 5 1 5 3 3 3 5 5 2 4 3 3 4 5 4 2 5 2 4 3 5 2 5 2 1 1 1 1 2 1 4 2 3 4 3 2 4 4 2 2 3 5 5 1 4 1 2 4 4 1 3 3 5 2 3 4 1 2 3 1 5 2\\r\\n', 'output': ['114012476\\r\\n']}, {'input': '186 35\\r\\n4 4 3 2 4 3 1 2 2 2 4 2 5 3 1 3 1 1 2 4 2 5 5 5 1 3 4 1 5 3 5 5 2 4 5 3 1 1 2 1 2 4 2 3 3 4 4 3 3 5 3 1 4 5 5 4 5 2 3 1 2 2 2 4 3 4 1 4 1 2 1 1 1 5 1 1 4 5 3 5 3 3 4 1 5 1 1 4 5 3 3 2 5 3 5 1 5 2 5 1 4 2 4 5 4 4 4 5 4 4 2 5 2 4 4 5 3 2 5 4 1 1 5 5 5 5 1 3 2 5 5 4 3 2 2 5 5 3 1 4 3 4 3 1 2 5 4 4 2 2 5 3 2 1 2 1 1 3 1 4 1 2 3 2 1 5 5 2 2 1 2 1 5 2 4 4 3 2 5 5 2 3 4 5 5 3\\r\\n', 'output': ['273232004\\r\\n']}, {'input': '150 978\\r\\n34 20 7 39 15 14 39 49 36 13 12 12 30 40 4 17 8 2 48 10 16 2 33 36 41 30 4 35 32 35 12 14 28 3 7 3 36 46 43 19 7 38 48 24 19 21 9 31 3 3 8 23 21 49 44 29 15 6 11 40 39 12 44 40 41 37 7 39 40 17 34 21 22 19 30 21 14 3 16 50 38 38 27 7 4 33 20 23 27 32 14 50 33 36 38 22 27 27 14 2 27 37 33 6 21 44 25 17 28 22 43 10 33 21 42 4 7 42 10 20 22 49 14 18 26 19 43 4 31 18 13 17 5 46 19 35 31 14 28 29 48 9 9 4 10 15 30 5 9 23\\r\\n', 'output': ['338032038\\r\\n']}, {'input': '115 588\\r\\n39 133 47 175 120 1 183 148 115 9 196 101 18 156 156 74 43 149 95 56 72 84 32 104 16 188 88 168 164 18 36 105 131 60 26 151 46 160 16 45 76 16 157 190 120 37 102 29 190 57 178 38 89 75 143 2 80 7 11 31 101 28 171 46 93 100 23 163 146 135 12 73 140 144 177 43 19 158 26 20 39 173 97 8 169 139 23 105 7 171 79 11 156 77 164 63 165 124 126 108 125 118 58 129 146 152 31 133 5 160 89 136 174 121 185\\r\\n', 'output': ['27195433\\r\\n']}]","id":565} {"difficulty":1600,"lang":"Rust 2021","lang_cluster":"Rust","src_uid":"95_A","execute_outcome":"WRONG_ANSWER","source_code":"#![allow(non_snake_case)]\r\n#[allow(dead_code)] fn read_line() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\n#[allow(dead_code)] fn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\n#[allow(dead_code)] struct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\n#[allow(dead_code)] macro_rules! init {($name: ident) => {#[allow(unused_mut)]let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let excl_c = read::();\r\n let excl_ws = (0..excl_c).map(|_| read_line()).collect::>();\r\n let excl_ws = excl_ws.iter().map(|s| s.as_str()).collect::>();\r\n let inp = read_line();\r\n let the_ch = read_line().chars().next().unwrap();\r\n\r\n\r\n \/\/ let excl_ws = vec![\r\n \/\/ \"aCa\",\r\n \/\/ \"cba\",\r\n \/\/ ];\r\n \/\/ let inp = \"abAcaba\";\r\n \/\/ let the_ch = 'c';\r\n\r\n\r\n let mut repl = vec![0; 100];\r\n let inp_lc = inp.to_lowercase();\r\n for &w in &excl_ws {\r\n let mut p = 0;\r\n while let Some(o) = inp_lc[p..].find(&w.to_lowercase()) {\r\n for i in p+o..p+o+w.len() {repl[i]=1}\r\n p += o + 1;\r\n }\r\n }\r\n \r\n fn match_case(ch: char, to_ch: char) -> char {\r\n if to_ch.is_uppercase(){ch.to_uppercase().next().unwrap()}else{ch.to_lowercase().next().unwrap()}\r\n }\r\n let mut inp = inp.chars().collect::>();\r\n for i in 0..repl.len() {\r\n if repl[i]==1 {\r\n if inp[i]==the_ch {\r\n inp[i] = match_case(if the_ch=='a'{'b'}else{'a'}, inp[i]);\r\n } else {\r\n inp[i] = match_case(the_ch, inp[i]);\r\n }\r\n }\r\n }\r\n\r\n \/\/println!(\"{inp:?}\");\r\n println!(\"{}\", inp.iter().collect::());\r\n}\r\n","description":"Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1,s2,...,sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings \"aBC\" and \"ABc\" are considered equal.After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l,r (1\u2264l\u2264i\u2264r\u2264|w|) such that substring w[l\u00a0...\u00a0r] is contained in the collection s1,s2,...,sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.","input_specification":"The first line contains the only integer n (1\u2264n\u2264100) \u2014 the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n+1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.\n","output_specification":"Output the only line \u2014 Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.\nThe lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1\u2264i\u2264|a|), that ai String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).expect(\"failed to read line\"); buffer.trim().to_string() }\r\n#[allow(dead_code)] fn read() -> T where T::Err: std::fmt::Debug { read_line().trim().parse::().expect(\"failed to read value\") }\r\n#[allow(dead_code)]fn read_vec() -> Vec where T::Err: std::fmt::Debug { read_line().split_whitespace().map(|x| x.parse::().expect(\"failed to read values\")).collect() }\r\n#[allow(dead_code)] fn lock_stdout() -> std::io::BufWriter> { let stdout = std::io::stdout().lock(); std::io::BufWriter::new(stdout) }\r\n#[allow(dead_code)] struct StdoutLogger {buf: std::io::BufWriter>}impl StdoutLogger {fn log(&mut self, s: &str) {std::io::Write::write(&mut self.buf, s.as_bytes()).expect(\"error writing stdout\");std::io::Write::write(&mut self.buf, \"\\n\".as_bytes()).expect(\"error writing stdout\");}}\r\n#[allow(dead_code)] macro_rules! init {($name: ident) => {#[allow(unused_mut)]let mut $name = StdoutLogger{buf:lock_stdout()};}}\r\n\r\nfn main() {\r\n init!(outp);\r\n\r\n\r\n let excl_c = read::();\r\n let excl_ws = (0..excl_c).map(|_| read_line()).collect::>();\r\n let excl_ws = excl_ws.iter().map(|s| s.as_str()).collect::>();\r\n let inp = read_line();\r\n let the_ch = read_line().chars().next().unwrap();\r\n\r\n\r\n \/\/ let excl_ws = vec![\r\n \/\/ \"aCa\",\r\n \/\/ \"cba\",\r\n \/\/ ];\r\n \/\/ let inp = \"abAcaba\";\r\n \/\/ let the_ch = 'c';\r\n\r\n\r\n let mut repl = vec![0; 100];\r\n let inp_lc = inp.to_lowercase();\r\n for &w in &excl_ws {\r\n let mut p = 0;\r\n while let Some(o) = inp_lc[p..].find(&w.to_lowercase()) {\r\n for i in p+o..p+o+w.len() {repl[i]=1}\r\n p += o + 1;\r\n }\r\n }\r\n \r\n fn match_case(ch: char, to_ch: char) -> char {\r\n if to_ch.is_uppercase(){ch.to_uppercase().next().unwrap()}else{ch.to_lowercase().next().unwrap()}\r\n }\r\n let mut inp = inp.chars().collect::>();\r\n for i in 0..repl.len() {\r\n if repl[i]==1 {\r\n let the_ch_lc = the_ch.to_lowercase().next().unwrap();\r\n let inp_lc = inp[i].to_lowercase().next().unwrap();\r\n if inp_lc==the_ch_lc {\r\n inp[i] = match_case(if the_ch_lc=='a'{'b'}else{'a'}, inp[i]);\r\n } else {\r\n inp[i] = match_case(the_ch, inp[i]);\r\n }\r\n }\r\n }\r\n\r\n \/\/println!(\"{inp:?}\");\r\n println!(\"{}\", inp.iter().collect::());\r\n}\r\n","testcases":"[{'input': ['3\\r\\nbers\\r\\nucky\\r\\nelu\\r\\nPetrLoveLuckyNumbers\\r\\nt\\r\\n'], 'output': ['PetrLovtTttttNumtttt\\r\\n']}, {'input': ['4\\r\\nhello\\r\\nparty\\r\\nabefglghjdhfgj\\r\\nIVan\\r\\npetrsmatchwin\\r\\na\\r\\n'], 'output': ['petrsmatchwin\\r\\n']}, {'input': ['2\\r\\naCa\\r\\ncba\\r\\nabAcaba\\r\\nc\\r\\n'], 'output': ['abCacba\\r\\n']}, {'input': ['3\\r\\nlol\\r\\nhello\\r\\neho\\r\\nPetrUnited\\r\\nt\\r\\n'], 'output': ['PetrUnited\\r\\n']}, {'input': ['2\\r\\ntrsd\\r\\ndream\\r\\nPetrsDreamOh\\r\\ny\\r\\n'], 'output': ['PeyyyYyyyyOh\\r\\n']}, {'input': ['1\\r\\nPetrsDreamOh\\r\\nPetrsDreamOh\\r\\nh\\r\\n'], 'output': ['HhhhhHhhhhHa\\r\\n']}, {'input': ['3\\r\\netr\\r\\ned\\r\\nied\\r\\nPetrUnited\\r\\nd\\r\\n'], 'output': ['PdddUnitda\\r\\n']}, {'input': ['3\\r\\netr\\r\\ned\\r\\nied\\r\\nPetrUnited\\r\\nz\\r\\n'], 'output': ['PzzzUnitzz\\r\\n']}, {'input': ['3\\r\\nab\\r\\nBa\\r\\naB\\r\\nABBA\\r\\na\\r\\n'], 'output': ['BAAB\\r\\n']}, {'input': ['3\\r\\nab\\r\\nBa\\r\\naB\\r\\nABBAC\\r\\nb\\r\\n'], 'output': ['BAABC\\r\\n']}, {'input': ['7\\r\\na\\r\\nb\\r\\ng\\r\\nk\\r\\ne\\r\\nt\\r\\nt\\r\\nA\\r\\na\\r\\n'], 'output': ['B\\r\\n']}, {'input': ['4\\r\\nEfron\\r\\nKeyt\\r\\ncesho\\r\\ncool\\r\\nCodeForcesHockeyTeam\\r\\np\\r\\n'], 'output': ['CodeForpppPpcpppPeam\\r\\n']}, {'input': ['4\\r\\nEfron\\r\\nKeyt\\r\\ncesho\\r\\ncool\\r\\nCodeForcesOldHockeyNewTeam\\r\\np\\r\\n'], 'output': ['CodeForcesOldHockeyNewTeam\\r\\n']}, {'input': ['2\\r\\nA\\r\\nB\\r\\nabababBabaBBaBBBBAaaaAAAAA\\r\\na\\r\\n'], 'output': ['bababaAbabAAbAAAABbbbBBBBB\\r\\n']}, {'input': ['7\\r\\nS\\r\\nT\\r\\ng\\r\\ni\\r\\nO\\r\\nr\\r\\nq\\r\\nkljpfP\\r\\nv\\r\\n'], 'output': ['kljpfP\\r\\n']}, {'input': ['47\\r\\nV\\r\\nS\\r\\ng\\r\\nr\\r\\nC\\r\\nR\\r\\nB\\r\\nb\\r\\nl\\r\\nW\\r\\nJ\\r\\ni\\r\\nU\\r\\nn\\r\\nq\\r\\nq\\r\\nj\\r\\nL\\r\\nR\\r\\nu\\r\\nQ\\r\\nC\\r\\nf\\r\\nC\\r\\nU\\r\\nu\\r\\nx\\r\\nh\\r\\nq\\r\\nE\\r\\nY\\r\\nu\\r\\nK\\r\\nt\\r\\nM\\r\\nU\\r\\nA\\r\\nA\\r\\ns\\r\\ni\\r\\nV\\r\\nT\\r\\nj\\r\\nb\\r\\nk\\r\\nW\\r\\nN\\r\\nNlVwRlWzQQWoCI\\r\\nz\\r\\n'], 'output': ['ZzZzZzZzZZZoZZ\\r\\n']}, {'input': ['47\\r\\njw\\r\\nL\\r\\nxIp\\r\\nW\\r\\nI\\r\\naI\\r\\nEp\\r\\nylG\\r\\nNe\\r\\nEglZ\\r\\noYkyo\\r\\nwDuZK\\r\\nDVh\\r\\nuoAoF\\r\\nGWj\\r\\nt\\r\\nP\\r\\nuNQz\\r\\nbPSg\\r\\neqru\\r\\nxvll\\r\\nO\\r\\nmb\\r\\nCM\\r\\nwnmvv\\r\\nYpFsq\\r\\nFYID\\r\\nc\\r\\nr\\r\\nrhbl\\r\\nYseyB\\r\\nRGcRj\\r\\nhDtz\\r\\nW\\r\\nQlQWB\\r\\nY\\r\\nftSl\\r\\nyPlAd\\r\\nLPgVw\\r\\nEIGOF\\r\\nTQ\\r\\nQrFcr\\r\\nspu\\r\\nK\\r\\nIJ\\r\\nfXUd\\r\\nGhpV\\r\\nDxUhKXELSLIiJMIOsbrpPQPXFwH\\r\\nw\\r\\n'], 'output': ['DxUhWXEWSWWwWMWWsbwwWQWXFaH\\r\\n']}, {'input': ['74\\r\\nPjc\\r\\nZcOWk\\r\\nM\\r\\nyMyp\\r\\ncH\\r\\nTzmX\\r\\nA\\r\\nXgl\\r\\nKVB\\r\\nbljv\\r\\nIH\\r\\nu\\r\\nnu\\r\\nLdahF\\r\\nt\\r\\nO\\r\\nSv\\r\\nuzFT\\r\\nzfNd\\r\\nUM\\r\\nbXR\\r\\nUQbXk\\r\\nAA\\r\\ngVmH\\r\\nng\\r\\nF\\r\\nK\\r\\nHP\\r\\nIu\\r\\nwrH\\r\\nN\\r\\nPnTIQ\\r\\nkUY\\r\\nyabHN\\r\\nTA\\r\\nvrgl\\r\\nyxmsh\\r\\nTrQ\\r\\nX\\r\\nvIbrl\\r\\nMfu\\r\\nPfN\\r\\ni\\r\\nrH\\r\\nt\\r\\nHl\\r\\nUwst\\r\\nj\\r\\nB\\r\\nBiDCA\\r\\nJcE\\r\\nfd\\r\\nbXuI\\r\\nWWSU\\r\\nrd\\r\\nmj\\r\\nt\\r\\nIGrPe\\r\\nQl\\r\\nxfoSV\\r\\no\\r\\nWKdG\\r\\nTqeu\\r\\nE\\r\\nbZyg\\r\\nbVqR\\r\\nzY\\r\\nZD\\r\\nhHpdP\\r\\njHww\\r\\nlfU\\r\\ngVem\\r\\nt\\r\\nBD\\r\\nhUOfmkiMZhZxTuuiAyPuoutEQiPfZFSQVMMQxckAqtlRv\\r\\nx\\r\\n'], 'output': ['hXXxxxxXZhZaXxxxXyPxxxxXQxPxZXSQVXXQacxXqxlRv\\r\\n']}, {'input': ['74\\r\\nULa\\r\\nn\\r\\nvq\\r\\nbybI\\r\\nfCX\\r\\nEEi\\r\\nSg\\r\\nxj\\r\\nIDz\\r\\nfsP\\r\\nM\\r\\nGGjx\\r\\nDpY\\r\\ngffu\\r\\nK\\r\\nMy\\r\\nqbtz\\r\\nk\\r\\nbLNb\\r\\nqET\\r\\nN\\r\\nBBY\\r\\nx\\r\\nKHUT\\r\\nUju\\r\\ntyXI\\r\\no\\r\\nChXY\\r\\neia\\r\\nR\\r\\nakHR\\r\\ng\\r\\nax\\r\\nKyY\\r\\nwpdl\\r\\nCZA\\r\\nsmFl\\r\\nLVDJ\\r\\nO\\r\\nxHF\\r\\nW\\r\\nTMZ\\r\\nvN\\r\\nqiT\\r\\ng\\r\\nI\\r\\nPsR\\r\\nsCJL\\r\\nN\\r\\naSCi\\r\\nJYD\\r\\nP\\r\\nA\\r\\nM\\r\\nT\\r\\nG\\r\\ngU\\r\\nk\\r\\nA\\r\\nloT\\r\\nEbP\\r\\nZ\\r\\nEoo\\r\\nQ\\r\\nGGY\\r\\nZcbG\\r\\ntvYl\\r\\nM\\r\\nczMR\\r\\nj\\r\\ne\\r\\nlLjf\\r\\nY\\r\\nzm\\r\\nqifNoaopvznANCLmPpfToShyelsYSFllyQLUDYbcQ\\r\\ng\\r\\n'], 'output': ['ggfGggggvggGGCLgGgfGgShgglsGSFllgGLUDGbcG\\r\\n']}, {'input': ['74\\r\\nM\\r\\nLQ\\r\\nH\\r\\ncA\\r\\nqj\\r\\nD\\r\\nnj\\r\\nzD\\r\\njM\\r\\ns\\r\\nR\\r\\noC\\r\\nFh\\r\\nlO\\r\\nj\\r\\nc\\r\\nEn\\r\\nAB\\r\\nsw\\r\\nT\\r\\nz\\r\\nEb\\r\\nb\\r\\nu\\r\\nmj\\r\\nMI\\r\\nD\\r\\nj\\r\\nH\\r\\np\\r\\nzD\\r\\nV\\r\\nR\\r\\nvg\\r\\nH\\r\\nS\\r\\nBy\\r\\nu\\r\\nQP\\r\\nB\\r\\ndD\\r\\nrI\\r\\nJF\\r\\nnA\\r\\nsv\\r\\nz\\r\\na\\r\\nl\\r\\nI\\r\\nFJ\\r\\nK\\r\\nH\\r\\nT\\r\\nF\\r\\nl\\r\\ntC\\r\\ng\\r\\ns\\r\\nNl\\r\\nUj\\r\\nu\\r\\nA\\r\\nOO\\r\\nLd\\r\\nk\\r\\nk\\r\\nkM\\r\\nLY\\r\\nbn\\r\\nv\\r\\nfT\\r\\nC\\r\\nI\\r\\nc\\r\\naeBolOleYgGmSLkFCPJPbQZUeodomjS\\r\\nv\\r\\n'], 'output': ['vvVovVveYvVvVVvVVVVVvQVVeovovvV\\r\\n']}, {'input': ['99\\r\\ns\\r\\nc\\r\\nN\\r\\nN\\r\\ni\\r\\ni\\r\\nW\\r\\nJ\\r\\nA\\r\\nW\\r\\nm\\r\\nB\\r\\nf\\r\\nO\\r\\nm\\r\\nk\\r\\nQ\\r\\nf\\r\\nx\\r\\np\\r\\nl\\r\\nH\\r\\nH\\r\\no\\r\\nn\\r\\nC\\r\\nK\\r\\nR\\r\\ns\\r\\nT\\r\\nJ\\r\\nv\\r\\nC\\r\\nZ\\r\\nd\\r\\nl\\r\\nr\\r\\no\\r\\nD\\r\\ng\\r\\na\\r\\nA\\r\\nE\\r\\nk\\r\\nN\\r\\nw\\r\\na\\r\\nb\\r\\no\\r\\nk\\r\\nv\\r\\nc\\r\\ni\\r\\nj\\r\\nE\\r\\nl\\r\\no\\r\\nf\\r\\nv\\r\\ns\\r\\nh\\r\\nx\\r\\nm\\r\\nE\\r\\nN\\r\\nt\\r\\nj\\r\\nk\\r\\ng\\r\\nk\\r\\nX\\r\\nW\\r\\ni\\r\\nX\\r\\nm\\r\\nw\\r\\nK\\r\\nL\\r\\nQ\\r\\nr\\r\\nj\\r\\nf\\r\\no\\r\\nw\\r\\nv\\r\\nS\\r\\no\\r\\nH\\r\\ne\\r\\nL\\r\\nL\\r\\nd\\r\\nP\\r\\nr\\r\\ng\\r\\nz\\r\\nz\\r\\nq\\r\\nd\\r\\nBBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly\\r\\nq\\r\\n'], 'output': ['QQQQyQQQuQqqqqQYQqqqQQqQQqQQAquQAQqQQqy\\r\\n']}, {'input': ['77\\r\\nGw\\r\\nZw\\r\\nqg\\r\\neO\\r\\nmx\\r\\nfE\\r\\nqD\\r\\nVv\\r\\nRs\\r\\nbd\\r\\nwA\\r\\nnh\\r\\nDm\\r\\nbR\\r\\nxV\\r\\nwe\\r\\nKH\\r\\nbl\\r\\nVy\\r\\naJ\\r\\nFr\\r\\nNP\\r\\nir\\r\\nxh\\r\\nFq\\r\\nDG\\r\\nNh\\r\\ndW\\r\\naG\\r\\nkm\\r\\nNS\\r\\nOm\\r\\nyC\\r\\nts\\r\\nZt\\r\\nEN\\r\\nFs\\r\\njA\\r\\nvf\\r\\nde\\r\\nDa\\r\\nAW\\r\\nBv\\r\\nmO\\r\\nDk\\r\\nYj\\r\\nfl\\r\\ndj\\r\\nJF\\r\\ndI\\r\\nhr\\r\\nzk\\r\\nam\\r\\nLT\\r\\nPJ\\r\\nAQ\\r\\nOW\\r\\nWN\\r\\nUG\\r\\nTL\\r\\nSZ\\r\\nBK\\r\\nLp\\r\\njW\\r\\nrY\\r\\nPB\\r\\nRj\\r\\nBw\\r\\ngl\\r\\nlK\\r\\nWj\\r\\nPl\\r\\nfx\\r\\nYO\\r\\nbX\\r\\nSN\\r\\nPt\\r\\nxPDCKNGWsNSlScKgBNEooOTnSuycVtvdToGmFoEfsUorvsSNcQIlaXRQqrfTZZoNvjutjhGpGXmNSQQWCzeHhMJAxclmiNnErpxH\\r\\nh\\r\\n'], 'output': ['xPDCKNHHhHHlScKgBNHhoOThHuhhVtvdToGmFoEhhUorvsHHcQIlaXRQqrfTZZoNvjutjhGpGXmHHQQWCzeHhMHHxclmiNnErphA\\r\\n']}, {'input': ['100\\r\\nqn\\r\\nBE\\r\\nyN\\r\\nep\\r\\nPq\\r\\nXz\\r\\nLM\\r\\nEZ\\r\\ndb\\r\\nMn\\r\\nbn\\r\\nFe\\r\\nqA\\r\\nzc\\r\\nyq\\r\\npC\\r\\nyA\\r\\nWk\\r\\nYq\\r\\nrs\\r\\noD\\r\\nvD\\r\\nzW\\r\\nxZ\\r\\nbl\\r\\nur\\r\\nkf\\r\\ndf\\r\\nLS\\r\\nUW\\r\\nMy\\r\\nhR\\r\\nsh\\r\\nNh\\r\\nog\\r\\nCW\\r\\nor\\r\\nzo\\r\\nrO\\r\\nao\\r\\nXH\\r\\nDq\\r\\nKa\\r\\nlL\\r\\nYQ\\r\\nOh\\r\\nRZ\\r\\nAx\\r\\nta\\r\\nko\\r\\nDn\\r\\nNg\\r\\nNy\\r\\nDB\\r\\nYD\\r\\njO\\r\\nAp\\r\\nFT\\r\\noB\\r\\nNc\\r\\nwB\\r\\nHO\\r\\neW\\r\\nAc\\r\\nDr\\r\\nMt\\r\\nDf\\r\\nbF\\r\\nFP\\r\\nRa\\r\\nnF\\r\\nhF\\r\\nXC\\r\\nnG\\r\\nan\\r\\nZY\\r\\nuB\\r\\nHP\\r\\nOR\\r\\nKN\\r\\nUv\\r\\nLe\\r\\nIj\\r\\nlH\\r\\nVw\\r\\njb\\r\\nXn\\r\\nqu\\r\\nJo\\r\\nzL\\r\\nKW\\r\\nLS\\r\\naV\\r\\nLs\\r\\nBX\\r\\nMY\\r\\noK\\r\\nfh\\r\\ngP\\r\\nTB\\r\\npBWBEkqznLlZykhmPrfidzWbQMNDdBaDLykOfdvOZjKoUxCqKwJdGuhseuxaYcVyAGTSTwXYmKweRMUdbyfxssSNGLSAhckIknDj\\r\\nd\\r\\n'], 'output': ['pBDDDkqznDdDdkhmPrfiddDdQDDDaDaDLydDfdvOZjDdUdDqDdJdGuhseuxaYcVdDGTSTwXYmDdeRMUadyfxssSDDDDAhckIddDj\\r\\n']}, {'input': ['3\\r\\na\\r\\nA\\r\\na\\r\\nA\\r\\na\\r\\n'], 'output': ['B\\r\\n']}, {'input': ['3\\r\\na\\r\\nA\\r\\na\\r\\nA\\r\\nb\\r\\n'], 'output': ['B\\r\\n']}, {'input': ['4\\r\\na\\r\\nA\\r\\ni\\r\\nA\\r\\nPetyaIsVeryCoolGuy\\r\\np\\r\\n'], 'output': ['PetypPsVeryCoolGuy\\r\\n']}, {'input': ['3\\r\\njap\\r\\nthd\\r\\ndshipssinceW\\r\\nJapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper\\r\\nc\\r\\n'], 'output': ['CccanisexperiencingitsgreatestharcccccccccacCorldWarIItharcccccccccacCorldWarIItesthardshixper\\r\\n']}, {'input': ['3\\r\\njap\\r\\nthd\\r\\ndshipssinceW\\r\\nJapanisexperiencingitsgreatesthardshipssinceWorldWarIIthardshipssinceWorldWarIItesthardshixper\\r\\na\\r\\n'], 'output': ['AbaanisexperiencingitsgreatestharaaaaaaaaaaaAorldWarIItharaaaaaaaaaaaAorldWarIItesthardshixper\\r\\n']}, {'input': ['7\\r\\na\\r\\nh\\r\\nu\\r\\np\\r\\nfgh\\r\\nwyz\\r\\ndefghijkl\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\na\\r\\n'], 'output': ['bbcaaaaaaaaamnoaqrstavwxyz\\r\\n']}, {'input': ['9\\r\\na\\r\\nh\\r\\nu\\r\\np\\r\\nz\\r\\nfgh\\r\\nwyz\\r\\ndefghijkl\\r\\nghijklmnopqrstu\\r\\nabcdefghijklmnopqrstuvwxyz\\r\\na\\r\\n'], 'output': ['bbcaaaaaaaaaaaaaaaaaavwxya\\r\\n']}, {'input': ['3\\r\\nab\\r\\nBa\\r\\naB\\r\\nABBA\\r\\nl\\r\\n'], 'output': ['LLLL\\r\\n']}]","id":566} {"difficulty":2600,"lang":"Rust","lang_cluster":"Rust","src_uid":"a9bad412597726f8cdc0cfa2da891bc4","execute_outcome":"RUNTIME_ERROR","source_code":"use std::io::{self, BufReader, Read, Stdin, Bytes};\nuse std::fmt::Debug;\nuse std::cmp;\nuse std::str::FromStr;\n\n\/\/\/ A stdin helper to deal with normal oj input.\npub struct OjReader {\n bs: Bytes>,\n}\n\npub fn from_stdin() -> OjReader {\n let input = io::stdin();\n let reader = BufReader::new(input);\n OjReader { bs: reader.bytes() }\n}\n\nimpl OjReader {\n pub fn next(&mut self) -> T\n where E: Debug,\n T: FromStr\n {\n loop {\n match self.next_opt() {\n Some(t) => return t,\n None => {},\n }\n }\n }\n\n pub fn next_opt(&mut self) -> Option\n where E: Debug,\n T: FromStr\n {\n self.next_trunk(|b| b == b' ' || b == b'\\t' || b == b'\\n' || b == b'\\r')\n }\n\n \/\/ TODO: handle windows style line seperator \\r\\n\n fn next_trunk(&mut self, is_sep: F) -> Option\n where E: Debug,\n T: FromStr,\n F: Fn(u8) -> bool\n {\n let mut res = vec![];\n loop {\n match self.bs.next() {\n None => {\n assert!(!res.is_empty());\n break;\n },\n Some(r) => {\n let b = r.unwrap();\n if is_sep(b) {\n break;\n }\n res.push(b);\n }\n }\n }\n if res.is_empty() {\n return None;\n }\n unsafe { Some(String::from_utf8_unchecked(res).parse::().unwrap()) }\n }\n\n pub fn next_line(&mut self) -> String {\n self.next_line_opt().unwrap()\n }\n\n pub fn next_line_opt(&mut self) -> Option {\n self.next_trunk(|b| b == b'\\n' || b == b'\\r')\n }\n}\n\nmacro_rules! odiv {\n ($lhs:expr, $rhs:expr) => ({\n if $lhs < 0 {\n 0\n } else {\n $lhs \/ $rhs + 1\n }\n });\n}\n\n#[derive(Debug)]\nstruct Problem {\n a: isize,\n b: isize,\n thls: Vec,\n}\n\nfn search(p: &mut Problem, i: usize, tmp_sol: &mut Vec, sol: &mut Vec) {\n assert!(i > 0);\n if i == p.thls.len() - 2 {\n let res = cmp::max(odiv!(p.thls[i], p.a), odiv!(cmp::max(p.thls[i - 1], p.thls[i + 1]), p.b)) as usize;\n if !sol.is_empty() && sol.len() <= tmp_sol.len() + res {\n return;\n }\n *sol = tmp_sol.clone();\n for _ in 0..res {\n sol.push(i + 1);\n }\n } else if i < p.thls.len() - 2 {\n let min = odiv!(p.thls[i - 1], p.b) as usize;\n let max = cmp::max(odiv!(p.thls[i], p.a), odiv!(p.thls[i + 1], p.b)) as usize;\n let (old_one, old_two, last_moves) = (p.thls[i], p.thls[i + 1], tmp_sol.len());\n p.thls[i] -= p.a * min as isize;\n p.thls[i + 1] -= p.b * min as isize;\n tmp_sol.resize(last_moves + min, i + 1);\n for _ in min..cmp::max(min + 1, max) {\n search(p, i + 1, tmp_sol, sol);\n p.thls[i] -= p.a;\n p.thls[i + 1] -= p.b;\n tmp_sol.push(i + 1);\n if tmp_sol.len() > sol.len() {\n break;\n }\n }\n p.thls[i] = old_one;\n p.thls[i + 1] = old_two;\n tmp_sol.truncate(last_moves);\n } else {\n unreachable!();\n }\n}\n\n\/\/ Simple a + b example\nfn main() {\n let mut reader = from_stdin();\n let (n, a, b) = (reader.next(), reader.next(), reader.next());\n let mut problem = Problem {\n a: a,\n b: b,\n thls: Vec::with_capacity(n),\n };\n for _ in 0..n {\n problem.thls.push(reader.next());\n }\n let (mut tmp_sol, mut sol) = (vec![], vec![]);\n search(&mut problem, 1, &mut tmp_sol, &mut sol);\n println!(\"{}\", sol.len());\n for idx in sol {\n print!(\"{} \", idx);\n }\n print!(\"\\n\");\n}\n","description":"This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.Polycarp likes to play computer role-playing game \u00abLizards and Basements\u00bb. At the moment he is playing it as a magician. At one of the last levels he has to fight the line of archers. The only spell with which he can damage them is a fire ball. If Polycarp hits the i-th archer with his fire ball (they are numbered from left to right), the archer loses a health points. At the same time the spell damages the archers adjacent to the i-th (if any) \u2014 they lose b (1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910) health points each.As the extreme archers (i.e. archers numbered 1 and n) are very far, the fire ball cannot reach them. Polycarp can hit any other archer with his fire ball.The amount of health points for each archer is known. An archer will be killed when this amount is less than 0. What is the minimum amount of spells Polycarp can use to kill all the enemies?Polycarp can throw his fire ball into an archer if the latter is already killed.","input_specification":"The first line of the input contains three integers n,\u2009a,\u2009b (3\u2009\u2264\u2009n\u2009\u2264\u200910; 1\u2009\u2264\u2009b\u2009<\u2009a\u2009\u2264\u200910). The second line contains a sequence of n integers \u2014 h1,\u2009h2,\u2009...,\u2009hn (1\u2009\u2264\u2009hi\u2009\u2264\u200915), where hi is the amount of health points the i-th archer has.","output_specification":"In the first line print t \u2014 the required minimum amount of fire balls. In the second line print t numbers \u2014 indexes of the archers that Polycarp should hit to kill all the archers in t shots. All these numbers should be between 2 and n\u2009-\u20091. Separate numbers with spaces. If there are several solutions, output any of them. Print numbers in any order.","notes":null,"sample_inputs":["3 2 1\n2 2 2","4 3 1\n1 4 1 1"],"sample_outputs":["3\n2 2 2","4\n2 2 3 3"],"human_solution":"use std::io::{self, BufReader, Read, Stdin, Bytes};\nuse std::fmt::Debug;\nuse std::cmp;\nuse std::str::FromStr;\n\n\/\/\/ A stdin helper to deal with normal oj input.\npub struct OjReader {\n bs: Bytes>,\n}\n\npub fn from_stdin() -> OjReader {\n let input = io::stdin();\n let reader = BufReader::new(input);\n OjReader { bs: reader.bytes() }\n}\n\nimpl OjReader {\n pub fn next(&mut self) -> T\n where E: Debug,\n T: FromStr\n {\n loop {\n match self.next_opt() {\n Some(t) => return t,\n None => {},\n }\n }\n }\n\n pub fn next_opt(&mut self) -> Option\n where E: Debug,\n T: FromStr\n {\n self.next_trunk(|b| b == b' ' || b == b'\\t' || b == b'\\n' || b == b'\\r')\n }\n\n \/\/ TODO: handle windows style line seperator \\r\\n\n fn next_trunk(&mut self, is_sep: F) -> Option\n where E: Debug,\n T: FromStr,\n F: Fn(u8) -> bool\n {\n let mut res = vec![];\n loop {\n match self.bs.next() {\n None => {\n assert!(!res.is_empty());\n break;\n },\n Some(r) => {\n let b = r.unwrap();\n if is_sep(b) {\n break;\n }\n res.push(b);\n }\n }\n }\n if res.is_empty() {\n return None;\n }\n unsafe { Some(String::from_utf8_unchecked(res).parse::().unwrap()) }\n }\n\n pub fn next_line(&mut self) -> String {\n self.next_line_opt().unwrap()\n }\n\n pub fn next_line_opt(&mut self) -> Option {\n self.next_trunk(|b| b == b'\\n' || b == b'\\r')\n }\n}\n\nmacro_rules! odiv {\n ($lhs:expr, $rhs:expr) => ({\n if $lhs < 0 {\n 0\n } else {\n $lhs \/ $rhs + 1\n }\n });\n}\n\n#[derive(Debug)]\nstruct Problem {\n a: isize,\n b: isize,\n thls: Vec,\n}\n\nfn search(p: &mut Problem, i: usize, tmp_sol: &mut Vec, sol: &mut Vec) {\n assert!(i > 0);\n if i == p.thls.len() - 2 {\n let res = cmp::max(odiv!(p.thls[i], p.a), odiv!(cmp::max(p.thls[i - 1], p.thls[i + 1]), p.b)) as usize;\n if !sol.is_empty() && sol.len() <= tmp_sol.len() + res {\n return;\n }\n *sol = tmp_sol.clone();\n for _ in 0..res {\n sol.push(i + 1);\n }\n } else if i < p.thls.len() - 2 {\n let min = odiv!(p.thls[i - 1], p.b) as usize;\n let max = cmp::max(odiv!(p.thls[i], p.a), odiv!(p.thls[i + 1], p.b)) as usize;\n let (old_one, old_two, last_moves) = (p.thls[i], p.thls[i + 1], tmp_sol.len());\n p.thls[i] -= p.a * min as isize;\n p.thls[i + 1] -= p.b * min as isize;\n tmp_sol.resize(last_moves + min, i + 1);\n for _ in min..cmp::max(min + 1, max + 1) {\n search(p, i + 1, tmp_sol, sol);\n p.thls[i] -= p.a;\n p.thls[i + 1] -= p.b;\n tmp_sol.push(i + 1);\n if tmp_sol.len() > sol.len() {\n break;\n }\n }\n p.thls[i] = old_one;\n p.thls[i + 1] = old_two;\n tmp_sol.truncate(last_moves);\n } else {\n unreachable!();\n }\n}\n\n\/\/ Simple a + b example\nfn main() {\n let mut reader = from_stdin();\n let (n, a, b) = (reader.next(), reader.next(), reader.next());\n let mut problem = Problem {\n a: a,\n b: b,\n thls: Vec::with_capacity(n),\n };\n for _ in 0..n {\n problem.thls.push(reader.next());\n }\n let (mut tmp_sol, mut sol) = (vec![], vec![]);\n search(&mut problem, 1, &mut tmp_sol, &mut sol);\n println!(\"{}\", sol.len());\n for idx in sol {\n print!(\"{} \", idx);\n }\n print!(\"\\n\");\n}\n","testcases":"[{'input': '3 2 1\\r\\n2 2 2\\r\\n', 'output': ['3\\r\\n2 2 2 ']}, {'input': '4 3 1\\r\\n1 4 1 1\\r\\n', 'output': ['4\\r\\n2 2 3 3 ']}, {'input': '3 5 3\\r\\n1 2 1\\r\\n', 'output': ['1\\r\\n2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 3\\r\\n3 2 2\\r\\n', 'output': ['2\\r\\n2 2 ']}, {'input': '3 5 1\\r\\n10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 1\\r\\n1 9 10\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 2 ']}, {'input': '3 5 3\\r\\n10 9 7\\r\\n', 'output': ['4\\r\\n2 2 2 2 ']}, {'input': '3 5 2\\r\\n9 3 6\\r\\n', 'output': ['5\\r\\n2 2 2 2 2 ']}, {'input': '4 5 3\\r\\n2 2 2 1\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n2 3 2 2\\r\\n', 'output': ['2\\r\\n2 3 ']}, {'input': '4 5 3\\r\\n4 2 4 2\\r\\n', 'output': ['3\\r\\n2 2 3 ']}, {'input': '4 5 1\\r\\n4 9 1 8\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n9 9 3 4\\r\\n', 'output': ['6\\r\\n2 2 2 2 3 3 ']}, {'input': '4 5 1\\r\\n8 8 9 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 ']}, {'input': '4 5 3\\r\\n10 10 10 10\\r\\n', 'output': ['8\\r\\n2 2 2 2 3 3 3 3 ']}, {'input': '4 5 2\\r\\n7 3 8 5\\r\\n', 'output': ['7\\r\\n2 2 2 2 3 3 3 ']}, {'input': '4 5 3\\r\\n5 10 7 7\\r\\n', 'output': ['5\\r\\n2 2 3 3 3 ']}, {'input': '4 3 1\\r\\n8 10 9 7\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 ']}, {'input': '10 9 5\\r\\n12 14 11 11 14 14 12 15 14 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 6 7 9 9 9 ']}, {'input': '10 5 2\\r\\n12 10 6 7 11 4 3 5 9 3\\r\\n', 'output': ['13\\r\\n2 2 2 2 2 2 2 4 5 5 7 9 9 ']}, {'input': '10 4 1\\r\\n5 12 10 5 13 6 5 5 2 10\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 3 4 5 5 5 6 7 8 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 1\\r\\n10 12 11 4 12 1 15 15 11 12\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 5 5 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n6 12 9 3 7 3 3 11 13 10\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 3 5 5 5 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 1\\r\\n8 7 9 8 14 1 9 11 8 13\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 4 5 5 7 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n9 11 9 11 4 5 7 13 12 9\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 4 7 7 9 9 9 9 ']}, {'input': '10 8 2\\r\\n11 10 13 12 9 10 9 9 10 12\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 6 8 7 10 10 9 6 6 7\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 6 7 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 5 4 5 5 4 5 4 5 4\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n2 1 2 4 2 4 3 2 2 4\\r\\n', 'output': ['6\\r\\n2 5 5 7 9 9 ']}, {'input': '10 3 1\\r\\n4 4 3 3 3 3 2 1 3 1\\r\\n', 'output': ['11\\r\\n2 2 2 2 2 4 5 6 7 9 9 ']}, {'input': '10 7 1\\r\\n3 3 2 1 3 1 2 2 3 1\\r\\n', 'output': ['9\\r\\n2 2 2 2 5 5 7 9 9 ']}, {'input': '10 10 1\\r\\n8 8 8 8 8 8 8 8 8 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n11 9 11 10 10 11 9 10 9 11\\r\\n', 'output': ['33\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n10 9 14 9 13 11 14 10 14 10\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 4 4 5 6 6 6 7 7 8 9 9 9 9 9 9 ']}, {'input': '10 8 6\\r\\n14 12 14 12 10 8 10 13 9 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 8 9 9 9 ']}, {'input': '10 4 1\\r\\n7 8 9 8 8 7 8 9 7 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 4 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 10 9 9 10 9 9 10 9 10\\r\\n', 'output': ['34\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 4\\r\\n11 10 10 10 10 12 10 10 10 12\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 10 4\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['4\\r\\n2 5 8 9 ']}, {'input': '10 2 1\\r\\n9 12 12 8 8 5 14 10 7 3\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 7 7 7 7 7 7 7 8 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 15 15 14 14 14\\r\\n', 'output': ['49\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 6 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n9 8 8 8 11 11 9 10 9 11\\r\\n', 'output': ['13\\r\\n2 2 2 2 5 5 5 7 7 9 9 9 9 ']}, {'input': '10 6 2\\r\\n11 8 10 11 10 8 8 13 9 13\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n3 7 9 12 11 3 4 3 14 8\\r\\n', 'output': ['22\\r\\n2 2 2 2 3 4 4 4 5 5 5 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 1\\r\\n6 7 10 7 6 8 9 8 6 9\\r\\n', 'output': ['25\\r\\n2 2 2 2 2 2 2 3 4 4 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n2 9 2 6 8 7 6 5 6 2\\r\\n', 'output': ['8\\r\\n2 2 4 5 6 7 9 9 ']}, {'input': '10 7 3\\r\\n2 7 2 7 3 4 3 2 4 3\\r\\n', 'output': ['7\\r\\n2 3 5 5 7 9 9 ']}, {'input': '10 6 3\\r\\n8 9 8 9 8 9 10 9 8 9\\r\\n', 'output': ['12\\r\\n2 2 2 4 5 5 7 7 9 9 9 9 ']}, {'input': '10 2 1\\r\\n10 9 10 9 9 9 10 8 8 10\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 3\\r\\n4 4 5 6 4 6 4 5 5 4\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 9 2\\r\\n5 7 8 8 7 5 7 4 4 5\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 9 5\\r\\n8 7 5 9 8 7 8 11 11 8\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 7 4\\r\\n5 6 6 6 7 7 6 5 5 5\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 9 1\\r\\n10 11 11 11 11 11 11 11 11 11\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 5 1\\r\\n6 5 6 5 6 6 6 5 6 6\\r\\n', 'output': ['19\\r\\n2 2 2 2 2 2 2 4 5 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n8 7 9 7 9 12 12 6 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n7 3 5 3 5 5 3 4 2 4\\r\\n', 'output': ['10\\r\\n2 2 2 2 5 5 7 9 9 9 ']}, {'input': '10 7 2\\r\\n5 2 5 3 2 3 4 3 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 5 5 7 9 9 ']}, {'input': '10 2 1\\r\\n5 3 6 6 7 4 4 4 3 3\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 6 1\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['36\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 11 11 11 15 15 12 15 12 14\\r\\n', 'output': ['47\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 5 5 5 5 5 6 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 1\\r\\n9 15 15 11 8 10 13 9 15 9\\r\\n', 'output': ['28\\r\\n2 2 2 2 2 2 2 2 2 2 3 4 4 5 6 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n12 12 14 13 14 12 14 14 11 14\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 6 7 8 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 5 5 5 5 5 5 6 4 4\\r\\n', 'output': ['7\\r\\n2 2 5 5 7 9 9 ']}, {'input': '10 8 7\\r\\n15 15 15 15 15 15 15 15 15 15\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 9 5\\r\\n11 10 4 4 6 9 11 4 10 8\\r\\n', 'output': ['8\\r\\n2 2 2 5 7 8 9 9 ']}, {'input': '10 6 3\\r\\n9 12 8 11 7 14 8 5 15 10\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 3 1\\r\\n4 4 4 4 3 4 3 3 3 3\\r\\n', 'output': ['14\\r\\n2 2 2 2 2 4 5 5 6 7 9 9 9 9 ']}, {'input': '10 6 4\\r\\n11 10 10 10 12 12 12 10 10 10\\r\\n', 'output': ['11\\r\\n2 2 2 4 4 6 6 7 9 9 9 ']}, {'input': '10 6 1\\r\\n3 2 4 4 8 12 5 10 12 6\\r\\n', 'output': ['17\\r\\n2 2 2 2 4 5 6 6 7 8 9 9 9 9 9 9 9 ']}, {'input': '10 9 5\\r\\n13 13 13 13 13 12 12 12 12 12\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 4 1\\r\\n7 7 6 6 6 8 6 7 6 7\\r\\n', 'output': ['23\\r\\n2 2 2 2 2 2 2 2 4 5 5 5 6 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 3\\r\\n13 10 12 10 9 12 11 8 12 12\\r\\n', 'output': ['15\\r\\n2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 ']}, {'input': '10 6 2\\r\\n1 4 5 4 4 2 3 6 6 4\\r\\n', 'output': ['8\\r\\n2 4 4 6 8 9 9 9 ']}, {'input': '10 8 1\\r\\n12 6 7 9 3 12 5 9 5 11\\r\\n', 'output': ['30\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 6 6 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 4 2\\r\\n13 14 10 6 8 7 8 8 11 5\\r\\n', 'output': ['16\\r\\n2 2 2 2 2 2 2 4 5 5 7 7 8 9 9 9 ']}, {'input': '10 8 1\\r\\n3 4 5 6 4 6 5 6 5 4\\r\\n', 'output': ['15\\r\\n2 2 2 2 4 4 5 6 7 9 9 9 9 9 9 ']}, {'input': '10 7 2\\r\\n12 10 9 9 15 15 10 14 15 15\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 2 2 4 5 5 6 6 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 1\\r\\n9 9 8 8 8 9 9 8 8 8\\r\\n', 'output': ['29\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n5 4 5 4 4 4 4 4 4 5\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n11 8 5 13 8 9 11 15 11 12\\r\\n', 'output': ['11\\r\\n2 2 2 5 5 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n7 10 15 5 15 5 5 5 11 7\\r\\n', 'output': ['24\\r\\n2 2 2 2 2 2 2 2 3 3 5 5 5 5 7 7 9 9 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n5 5 4 4 4 4 4 4 5 4\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 6 2\\r\\n5 8 4 5 1 3 6 7 5 3\\r\\n', 'output': ['8\\r\\n2 2 2 4 7 7 9 9 ']}, {'input': '10 5 2\\r\\n10 12 10 10 11 9 11 11 9 9\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 2 4 5 5 5 7 7 8 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n9 8 10 10 11 11 8 9 10 11\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 7 9 9 9 ']}, {'input': '10 3 2\\r\\n3 5 1 4 5 3 3 1 3 4\\r\\n', 'output': ['9\\r\\n2 2 4 5 6 8 9 9 9 ']}, {'input': '10 3 2\\r\\n4 9 6 9 6 8 4 5 6 9\\r\\n', 'output': ['15\\r\\n2 2 2 3 5 5 5 5 7 8 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n8 9 8 9 8 8 8 8 8 8\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 4 4 5 5 7 7 7 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n11 6 9 9 11 10 7 13 11 9\\r\\n', 'output': ['35\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 5 5 5 5 5 5 5 5 7 7 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 1\\r\\n4 5 5 3 7 5 6 5 6 8\\r\\n', 'output': ['18\\r\\n2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 9 6\\r\\n15 14 14 12 15 10 9 14 13 8\\r\\n', 'output': ['9\\r\\n2 2 2 4 5 6 8 9 9 ']}, {'input': '10 7 1\\r\\n9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 5 6 7 7 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 6 5\\r\\n4 5 4 1 3 6 3 2 2 2\\r\\n', 'output': ['4\\r\\n2 5 7 9 ']}, {'input': '10 10 3\\r\\n10 8 11 11 10 11 11 9 7 10\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 3 2\\r\\n7 8 11 6 8 7 2 3 8 7\\r\\n', 'output': ['13\\r\\n2 2 2 2 4 4 5 6 6 9 9 9 9 ']}, {'input': '10 8 6\\r\\n9 9 8 10 7 13 7 11 13 12\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 3 2\\r\\n9 13 9 10 12 10 14 13 11 11\\r\\n', 'output': ['21\\r\\n2 2 2 2 2 4 5 5 5 5 7 7 7 7 7 9 9 9 9 9 9 ']}, {'input': '10 3 2\\r\\n12 12 14 15 15 12 12 14 12 14\\r\\n', 'output': ['26\\r\\n2 2 2 2 2 2 2 4 4 4 4 5 5 6 7 7 7 8 9 9 9 9 9 9 9 9 ']}, {'input': '10 7 4\\r\\n6 4 8 4 8 7 10 6 8 6\\r\\n', 'output': ['8\\r\\n2 2 4 6 6 8 9 9 ']}, {'input': '10 5 4\\r\\n14 14 14 10 13 15 13 13 10 14\\r\\n', 'output': ['14\\r\\n2 2 2 2 5 5 5 7 7 8 9 9 9 9 ']}, {'input': '10 10 2\\r\\n10 10 13 10 10 12 6 8 11 12\\r\\n', 'output': ['17\\r\\n2 2 2 2 2 2 4 5 6 7 9 9 9 9 9 9 9 ']}, {'input': '10 6 4\\r\\n5 6 5 6 6 7 5 7 9 9\\r\\n', 'output': ['8\\r\\n2 2 5 5 7 9 9 9 ']}, {'input': '10 7 5\\r\\n10 10 10 10 10 10 10 10 10 10\\r\\n', 'output': ['10\\r\\n2 2 2 4 5 7 7 9 9 9 ']}, {'input': '10 5 1\\r\\n11 10 10 10 11 11 11 10 11 11\\r\\n', 'output': ['32\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 4 4 5 5 6 6 7 7 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 10 4\\r\\n13 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['12\\r\\n2 2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 5 2\\r\\n4 5 3 6 7 8 4 4 9 6\\r\\n', 'output': ['11\\r\\n2 2 2 4 5 6 7 9 9 9 9 ']}, {'input': '10 7 3\\r\\n5 9 8 8 8 7 6 7 6 5\\r\\n', 'output': ['8\\r\\n2 2 4 5 7 7 9 9 ']}, {'input': '10 2 1\\r\\n12 13 15 14 14 11 12 14 11 15\\r\\n', 'output': ['46\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 5 5 5 5 5 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n13 12 15 12 14 14 14 15 13 15\\r\\n', 'output': ['48\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 14 15 14 15 14 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 6 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n14 15 15 14 15 14 15 14 15 15\\r\\n', 'output': ['50\\r\\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n9 7 14 8 14 15 15 9 12 13\\r\\n', 'output': ['42\\r\\n2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}, {'input': '10 2 1\\r\\n4 14 13 15 14 5 8 11 12 14\\r\\n', 'output': ['38\\r\\n2 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ']}]","id":567} {"difficulty":2600,"lang":"Rust","lang_cluster":"Rust","src_uid":"ba9c136f84375cd317f0f8b53e3939c7","execute_outcome":"COMPILATION_ERROR","source_code":"#[allow(unused_imports)]\nuse std::cmp::*;\n#[allow(unused_imports)]\nuse std::collections::*;\nuse std::io::{Write, BufWriter};\n\/\/ https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8\nmacro_rules! input {\n ($($r:tt)*) => {\n let stdin = std::io::stdin();\n let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));\n let mut next = move || -> String{\n bytes\n .by_ref()\n .map(|r|r.unwrap() as char)\n .skip_while(|c|c.is_whitespace())\n .take_while(|c|!c.is_whitespace())\n .collect()\n };\n input_inner!{next, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($next:expr) => {};\n ($next:expr, ) => {};\n\n ($next:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($next, $t);\n input_inner!{$next $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($next:expr, ( $($t:tt),* )) => {\n ( $(read_value!($next, $t)),* )\n };\n\n ($next:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($next, $t)).collect::>()\n };\n\n ($next:expr, chars) => {\n read_value!($next, String).chars().collect::>()\n };\n\n ($next:expr, usize1) => {\n read_value!($next, usize) - 1\n };\n\n ($next:expr, [ $t:tt ]) => {{\n let len = read_value!($next, usize);\n (0..len).map(|_| read_value!($next, $t)).collect::>()\n }};\n\n ($next:expr, $t:ty) => {\n $next().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\/ Verified by https:\/\/atcoder.jp\/contests\/arc093\/submissions\/3968098\nmod mod_int {\n use std::ops::*;\n pub trait Mod: Copy { fn m() -> i64; }\n #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]\n pub struct ModInt { pub x: i64, phantom: ::std::marker::PhantomData }\n impl ModInt {\n \/\/ x >= 0\n pub fn new(x: i64) -> Self { ModInt::new_internal(x % M::m()) }\n fn new_internal(x: i64) -> Self {\n ModInt { x: x, phantom: ::std::marker::PhantomData }\n }\n pub fn pow(self, mut e: i64) -> Self {\n debug_assert!(e >= 0);\n let mut sum = ModInt::new_internal(1);\n let mut cur = self;\n while e > 0 {\n if e % 2 != 0 { sum *= cur; }\n cur *= cur;\n e \/= 2;\n }\n sum\n }\n #[allow(dead_code)]\n pub fn inv(self) -> Self { self.pow(M::m() - 2) }\n }\n impl>> Add for ModInt {\n type Output = Self;\n fn add(self, other: T) -> Self {\n let other = other.into();\n let mut sum = self.x + other.x;\n if sum >= M::m() { sum -= M::m(); }\n ModInt::new_internal(sum)\n }\n }\n impl>> Sub for ModInt {\n type Output = Self;\n fn sub(self, other: T) -> Self {\n let other = other.into();\n let mut sum = self.x - other.x;\n if sum < 0 { sum += M::m(); }\n ModInt::new_internal(sum)\n }\n }\n impl>> Mul for ModInt {\n type Output = Self;\n fn mul(self, other: T) -> Self { ModInt::new(self.x * other.into().x % M::m()) }\n }\n impl>> AddAssign for ModInt {\n fn add_assign(&mut self, other: T) { *self = *self + other; }\n }\n impl>> SubAssign for ModInt {\n fn sub_assign(&mut self, other: T) { *self = *self - other; }\n }\n impl>> MulAssign for ModInt {\n fn mul_assign(&mut self, other: T) { *self = *self * other; }\n }\n impl Neg for ModInt {\n type Output = Self;\n fn neg(self) -> Self { ModInt::new(0) - self }\n }\n impl ::std::fmt::Display for ModInt {\n fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {\n self.x.fmt(f)\n }\n }\n impl ::std::fmt::Debug for ModInt {\n fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {\n let (mut a, mut b, _) = red(self.x, M::m());\n if b < 0 {\n a = -a;\n b = -b;\n }\n write!(f, \"{}\/{}\", a, b)\n }\n }\n impl From for ModInt {\n fn from(x: i64) -> Self { Self::new(x) }\n }\n \/\/ Finds the simplest fraction x\/y congruent to r mod p.\n \/\/ The return value (x, y, z) satisfies x = y * r + z * p.\n fn red(r: i64, p: i64) -> (i64, i64, i64) {\n if r.abs() <= 10000 {\n return (r, 1, 0);\n }\n let mut nxt_r = p % r;\n let mut q = p \/ r;\n if 2 * nxt_r >= r {\n nxt_r -= r;\n q += 1;\n }\n if 2 * nxt_r <= -r {\n nxt_r += r;\n q -= 1;\n }\n let (x, z, y) = red(nxt_r, r);\n (x, y - q * z, z)\n }\n} \/\/ mod mod_int\n\nmacro_rules! define_mod {\n ($struct_name: ident, $modulo: expr) => {\n #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]\n struct $struct_name {}\n impl mod_int::Mod for $struct_name { fn m() -> i64 { $modulo } }\n }\n}\nconst MOD: i64 = 998244353;\ndefine_mod!(P, MOD);\ntype ModInt = mod_int::ModInt

;\n\nfn solve() {\n let out = std::io::stdout();\n let mut out = BufWriter::new(out.lock());\n macro_rules! puts {\n ($($format:tt)*) => (write!(out,$($format)*).unwrap());\n }\n input! {\n n: usize, m: usize,\n a: [i32; n],\n w: [i64; n],\n }\n let mut dp = vec![vec![[ModInt::new(0); 2]; m + 1]; m + 1];\n let mut prob = vec![vec![[ModInt::new(0); 2]; m + 1]; m + 1];\n let mut wsum = ModInt::new(0);\n let mut upsum = ModInt::new(0);\n let mut downsum = ModInt::new(0);\n for i in 0..n {\n wsum += w[i];\n if a[i] == 1 {\n upsum += w[i];\n } else {\n downsum += w[i];\n }\n }\n dp[0][0] = [ModInt::new(1); 2];\n prob[0][0] = [ModInt::new(1); 2];\n for up in 0..2 {\n for i in 0..m {\n for j in 0..m - i {\n \/\/ TODO O(log MOD)\n let whole = wsum + i as i64 - j as i64;\n if whole == ModInt::new(0) || dp[i][j][up] == ModInt::new(0) {\n continue;\n }\n let wholeinv = whole.inv();\n let up_coef = if up == 1 {\n upsum + i as i64 + 1\n } else {\n upsum + i as i64\n } * wholeinv;\n let down_coef = if up == 1 {\n downsum - j as i64\n } else {\n downsum - j as i64 - 1\n } * wholeinv;\n dp[i + 1][j][up] += up_coef * dp[i][j][up];\n dp[i][j + 1][up] += down_coef * dp[i][j][up];\n prob[i + 1][j][up] += (upsum + i as i64) * wholeinv * dp[i][j][up];\n prob[i][j + 1][up] += (downsum - i as i64) * wholeinv * dp[i][j][up];\n }\n }\n }\n let mut ans = [ModInt::new(0); 2];\n for up in 0..2 {\n for i in 0..m + 1 {\n ans[up] += dp[i][m - i][up];\n }\n }\n for i in 0..n {\n if a[i] == 1 {\n puts!(\"{}\\n\", ans[1] * w[i]);\n } else {\n puts!(\"{}\\n\", ans[0] * w[i]);\n }\n }\n \n}\n\nfn main() {\n \/\/ In order to avoid potential stack overflow, spawn a new thread.\n let stack_size = 104_857_600; \/\/ 100 MB\n let thd = std::thread::Builder::new().stack_size(stack_size);\n thd.spawn(|| solve()).unwrap().join().unwrap();\n}\n","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"],"human_solution":"\/\/ https:\/\/codeforces.com\/contest\/1172\/problem\/C2\n\/\/\n#![allow(unused_imports)]\nuse std::io::*;\nuse std::io::Write;\nuse std::fmt::*;\nuse std::str::*;\nuse std::cmp::*;\nuse std::collections::*;\n\n#[allow(unused_macros)]\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n\n ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {\n let mut $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n\n ($iter:expr, [ next \/ $t:tt ]) => {\n {\n let len = read_value!($iter, usize);\n (0..len).map(|_| read_value!($iter, $t)).collect::>()\n }\n };\n\n ($iter:expr, switch) => {\n {\n let ty = read_value!($iter, i32);\n if ty == 1 {\n vec![ty, read_value!($iter, i32), read_value!($iter, i32)]\n } else if ty == 2 {\n vec![ty, read_value!($iter, i32)]\n } else {\n vec![ty, read_value!($iter, i32)]\n }\n }\n };\n\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! dvec {\n ($t:expr ; $len:expr) => {\n vec![$t; $len]\n };\n\n ($t:expr ; $len:expr, $($rest:expr),*) => {\n vec![dvec!($t; $($rest),*); $len]\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! ifv {\n ($t:expr, $a:expr, $b: expr) => {\n if $t { $a } else { $b }\n }\n}\n\n#[allow(unused_macros)]\nmacro_rules! fill {\n ($t:expr, $v:expr) => {\n for i in 0..$t.len() {\n $t[i] = $v;\n }\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! join {\n ($t:expr, $glue:expr) => {\n $t.into_iter().map(|w| w.to_string()).collect::>().join($glue)\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! debug {\n ($($a:expr),*) => {\n println!(concat!($(stringify!($a), \" = {:?}, \"),*), $($a),*);\n }\n}\n\n\nconst MOD: i64 = 998244353;\n\nfn inv(a: i64) -> i64 {\n pow(a, MOD - 2)\n}\n\nfn pow(a: i64, p: i64) -> i64 {\n let mut p = p;\n let mut aa = a;\n let mut ret = 1;\n while p >= 1 {\n if p & 1 == 1 {\n ret *= aa;\n ret %= MOD;\n }\n p >>= 1;\n aa = aa * aa % MOD;\n }\n ret\n}\n\nfn main() {\n input! {\n n: usize, m: usize,\n mut a: [i64; n],\n w: [i64; n]\n };\n\n let mut like_weight = 0;\n let mut dislike_weight = 0;\n for i in 0..n {\n if a[i] == 1 {\n like_weight += w[i];\n } else {\n dislike_weight += w[i];\n }\n }\n\n\n let GETA = 3100;\n let mut denom_pm = vec![0; GETA*2];\n for i in 0..GETA*2 {\n let w = i as i64 + like_weight + dislike_weight;\n denom_pm[i] = ifv!(w >= GETA as i64, inv(w-GETA as i64), 0);\n }\n let mut quot = |l: usize, d: usize, num: i64| ifv!(num <= 0, 0, num * denom_pm[GETA+l-d] % MOD);\n\n let mut dp = dvec!(0; 2, m+1, m+1);\n for i in 0..m+1 {\n dp[0][i][m-i] = 1;\n dp[1][i][m-i] = 1;\n }\n for i in (0..m+1).rev() {\n for j in (0..m+1).rev() {\n if i+j >= m {\n continue;\n }\n let mut total0 = 0;\n let mut total1 = 0;\n\n if i+1 <= m {\n total0 += dp[0][i+1][j] * quot(i, j, like_weight+(i as i64)+1);\n total1 += dp[1][i+1][j] * quot(i, j, like_weight+(i as i64));\n }\n if j+1 <= m {\n total0 += dp[0][i][j+1] * quot(i, j, dislike_weight-(j as i64));\n total1 += dp[1][i][j+1] * quot(i, j, dislike_weight-(j as i64)-1);\n }\n dp[0][i][j] = total0 % MOD;\n dp[1][i][j] = total1 % MOD;\n }\n }\n\n let out = stdout();\n let mut out = BufWriter::new(out.lock());\n for i in 0..n {\n if a[i] == 1 {\n writeln!(out, \"{}\", dp[0][0][0] * w[i] % MOD);\n } else {\n writeln!(out, \"{}\", dp[1][0][0] * w[i] % MOD);\n }\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":568} {"difficulty":1700,"lang":"Rust","lang_cluster":"Rust","src_uid":"c1cfe1f67217afd4c3c30a6327e0add9","execute_outcome":"WRONG_ANSWER","source_code":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nfn run() {\n input! {\n n: usize,\n p: [[i64; 5]; n],\n }\n if n > 10 {\n println!(\"0\");\n return;\n }\n let mut ans = vec![];\n for i in 0..n {\n let mut q = p.clone();\n let p = q.remove(i);\n for q in q.iter_mut() {\n for (q, p) in q.iter_mut().zip(p.iter()) {\n *q -= *p;\n }\n }\n let mut ok = true;\n for (i, a) in q.iter().enumerate() {\n for b in q.iter().take(i) {\n let mut sum = 0;\n for (a, b) in a.iter().zip(b.iter()) {\n sum += *a * *b;\n }\n if sum > 0 {\n ok = false;\n }\n }\n }\n if ok {\n ans.push(i + 1);\n }\n }\n println!(\"{}\", ans.len());\n for (i, a) in ans.iter().enumerate() {\n if i > 0 {\n print!(\" \");\n }\n print!(\"{}\", a);\n }\n println!();\n}\n\nfn main() {\n run();\n}\n","description":"You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors and is acute (i.e. strictly less than ). Otherwise, the point is called good.The angle between vectors and in 5-dimensional space is defined as , where is the scalar product and is length of .Given the list of points, print the indices of the good points in ascending order.","input_specification":"The first line of input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009103)\u00a0\u2014 the number of points. The next n lines of input contain five integers ai,\u2009bi,\u2009ci,\u2009di,\u2009ei (|ai|,\u2009|bi|,\u2009|ci|,\u2009|di|,\u2009|ei|\u2009\u2264\u2009103) \u00a0\u2014 the coordinates of the i-th point. All points are distinct.","output_specification":"First, print a single integer k\u00a0\u2014 the number of good points. Then, print k integers, each on their own line\u00a0\u2014 the indices of the good points in ascending order.","notes":"NoteIn the first sample, the first point forms exactly a angle with all other pairs of points, so it is good.In the second sample, along the cd plane, we can see the points look as follows:We can see that all angles here are acute, so no points are good.","sample_inputs":["6\n0 0 0 0 0\n1 0 0 0 0\n0 1 0 0 0\n0 0 1 0 0\n0 0 0 1 0\n0 0 0 0 1","3\n0 0 1 2 0\n0 0 9 2 0\n0 0 5 9 0"],"sample_outputs":["1\n1","0"],"human_solution":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\nfn run() {\n input! {\n n: usize,\n p: [[i64; 5]; n],\n }\n if n > 100 {\n println!(\"0\");\n return;\n }\n let mut ans = vec![];\n for i in 0..n {\n let mut q = p.clone();\n let p = q.remove(i);\n for q in q.iter_mut() {\n for (q, p) in q.iter_mut().zip(p.iter()) {\n *q -= *p;\n }\n }\n let mut ok = true;\n for (i, a) in q.iter().enumerate() {\n for b in q.iter().take(i) {\n let mut sum = 0;\n for (a, b) in a.iter().zip(b.iter()) {\n sum += *a * *b;\n }\n if sum > 0 {\n ok = false;\n }\n }\n }\n if ok {\n ans.push(i + 1);\n }\n }\n println!(\"{}\", ans.len());\n for (i, a) in ans.iter().enumerate() {\n if i > 0 {\n print!(\" \");\n }\n print!(\"{}\", a);\n }\n println!();\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': '6\\r\\n0 0 0 0 0\\r\\n1 0 0 0 0\\r\\n0 1 0 0 0\\r\\n0 0 1 0 0\\r\\n0 0 0 1 0\\r\\n0 0 0 0 1\\r\\n', 'output': ['1\\r\\n1']}, {'input': '3\\r\\n0 0 1 2 0\\r\\n0 0 9 2 0\\r\\n0 0 5 9 0\\r\\n', 'output': ['0']}, {'input': '1\\r\\n0 0 0 0 0\\r\\n', 'output': ['1\\r\\n1']}, {'input': '2\\r\\n0 1 2 3 4\\r\\n5 6 7 8 9\\r\\n', 'output': ['2\\r\\n1\\r\\n2']}, {'input': '992\\r\\n-1000 -1000 1000 -30 -1000\\r\\n-1000 -1000 -1000 -1000 -50\\r\\n-30 1000 1000 -1000 1000\\r\\n-1000 -60 -1000 -1000 1000\\r\\n1000 -10 -1000 -1000 1000\\r\\n1000 1000 -1000 -60 -1000\\r\\n1000 1000 1000 0 -1000\\r\\n-30 1000 -1000 -1000 1000\\r\\n1000 1000 -1000 20 -1000\\r\\n1000 -1000 1000 -1000 -20\\r\\n-1000 -1000 1000 -20 -1000\\r\\n-1000 -10 -1000 1000 -1000\\r\\n-1000 20 -1000 -1000 -1000\\r\\n1000 1000 1000 0 1000\\r\\n40 1000 -1000 1000 1000\\r\\n1000 -1000 -40 -1000 1000\\r\\n-1000 1000 1000 -40 -1000\\r\\n1000 20 -1000 -1000 -1000\\r\\n-1000 -50 1000 -1000 -10...', 'output': ['0']}, {'input': '960\\r\\n-30 -1000 1000 1000 -1000\\r\\n1000 -1000 -20 1000 -1000\\r\\n1000 1000 1000 1000 -20\\r\\n-60 1000 1000 1000 1000\\r\\n-30 1000 1000 1000 1000\\r\\n-1000 -1000 50 -1000 -1000\\r\\n1000 -50 -1000 1000 1000\\r\\n20 1000 1000 1000 -1000\\r\\n1000 1000 1000 10 1000\\r\\n-1000 -1000 40 1000 1000\\r\\n10 -1000 -1000 1000 -1000\\r\\n1000 -1000 1000 -1000 30\\r\\n-1000 -1000 -20 -1000 -1000\\r\\n1000 -1000 -40 -1000 -1000\\r\\n-1000 -40 -1000 1000 -1000\\r\\n1000 1000 -1000 0 -1000\\r\\n1000 1000 -1000 -1000 40\\r\\n-1000 1000 -30 1000 1000\\r\\n1000 -1000 50 -1000 -1000\\r\\n1000 -...', 'output': ['0']}, {'input': '768\\r\\n715 -250 -245 715 -130\\r\\n325 -425 175 650 -650\\r\\n325 -25 60 455 -650\\r\\n65 125 545 -65 -455\\r\\n260 -325 -65 455 -195\\r\\n455 -550 -370 715 65\\r\\n325 325 65 -455 -650\\r\\n325 -200 480 390 -650\\r\\n-65 -200 -365 -195 455\\r\\n260 275 185 455 -195\\r\\n-65 125 545 -65 455\\r\\n455 200 365 195 65\\r\\n260 -775 170 -65 -195\\r\\n520 -500 -490 -195 -390\\r\\n-65 -725 50 650 455\\r\\n0 -250 -245 715 0\\r\\n-65 -50 120 910 455\\r\\n260 -200 480 390 -195\\r\\n-195 25 -60 -455 -260\\r\\n0 -50 120 910 0\\r\\n260 -875 410 130 -195\\r\\n195 100 -240 -195 260\\r\\n-65 225 305 -260 455\\r\\n...', 'output': ['0']}, {'input': '10\\r\\n0 -110 68 -51 -155\\r\\n-85 -110 68 -51 -155\\r\\n85 -70 51 68 -230\\r\\n0 -40 51 68 75\\r\\n0 5 -51 -68 -190\\r\\n85 0 0 0 0\\r\\n85 -115 -68 51 35\\r\\n85 -75 -187 34 -40\\r\\n-85 -110 -136 102 -155\\r\\n85 -110 -17 119 -155\\r\\n', 'output': ['0']}, {'input': '6\\r\\n-305 -390 638 -623 343\\r\\n479 755 -343 144 89\\r\\n-268 843 -461 989 -301\\r\\n-986 -274 347 -847 -728\\r\\n278 718 -372 -674 270\\r\\n-477 562 -489 -858 611\\r\\n', 'output': ['0']}, {'input': '10\\r\\n-705 38 170 -768 689\\r\\n-705 86 248 -768 709\\r\\n-705 86 170 -742 709\\r\\n-705 86 144 -768 709\\r\\n-705 86 170 -820 709\\r\\n-705 106 170 -768 661\\r\\n-822 86 170 -768 709\\r\\n-705 98 170 -768 714\\r\\n-705 86 170 -768 709\\r\\n-601 86 170 -768 709\\r\\n', 'output': ['1\\r\\n9']}, {'input': '11\\r\\n358 -724 -232 53 -520\\r\\n486 -554 -328 53 -220\\r\\n358 -554 -232 -372 -520\\r\\n358 -554 -232 308 -520\\r\\n868 -554 448 53 -520\\r\\n478 -554 -322 53 -600\\r\\n358 296 -232 53 -520\\r\\n256 -554 -368 53 -520\\r\\n230 -554 -136 53 -820\\r\\n-182 -554 173 53 -160\\r\\n358 -554 -232 53 -520\\r\\n', 'output': ['1\\r\\n11']}, {'input': '8\\r\\n-559 581 509 257 343\\r\\n-544 451 569 277 343\\r\\n-451 451 434 401 343\\r\\n-559 451 509 257 83\\r\\n-664 451 89 117 343\\r\\n-559 451 509 257 993\\r\\n-715 451 509 374 343\\r\\n-811 451 684 -79 343\\r\\n', 'output': ['0']}, {'input': '999\\r\\n-301 26 -665 194 -96\\r\\n-901 -537 578 418 152\\r\\n346 -572 111 785 -659\\r\\n-774 433 -503 655 -778\\r\\n-314 -17 493 869 -509\\r\\n548 -725 -570 -491 -325\\r\\n-957 448 -556 985 -810\\r\\n270 -748 -397 -488 -561\\r\\n-247 -96 494 -759 731\\r\\n91 -380 37 537 191\\r\\n-466 262 -76 -70 500\\r\\n206 160 698 -714 -277\\r\\n845 456 -813 316 514\\r\\n467 -950 286 310 735\\r\\n521 -141 -148 559 299\\r\\n-396 379 947 462 668\\r\\n570 -879 -520 -383 55\\r\\n705 350 -191 368 -39\\r\\n698 -23 987 237 -204\\r\\n-808 -190 559 4 -227\\r\\n563 -172 -987 -265 -908\\r\\n451 -117 -217 -849 239\\r\\n93...', 'output': ['0']}, {'input': '11\\r\\n8 8 8 8 8\\r\\n2 2 2 2 2\\r\\n0 0 0 0 0\\r\\n6 6 6 6 6\\r\\n7 7 7 7 7\\r\\n10 10 10 10 10\\r\\n9 9 9 9 9\\r\\n3 3 3 3 3\\r\\n1 1 1 1 1\\r\\n5 5 5 5 5\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '7\\r\\n49 457 -650 325 -325\\r\\n0 0 325 325 0\\r\\n253 204 -325 0 -325\\r\\n204 -253 325 325 325\\r\\n408 -506 -325 -325 325\\r\\n49 457 -650 325 -650\\r\\n0 0 0 650 -325\\r\\n', 'output': ['0']}, {'input': '1000\\r\\n89 -573 642 349 -32\\r\\n-619 -549 767 -674 414\\r\\n-405 -68 -629 -343 -734\\r\\n-889 220 -814 329 -336\\r\\n-887 396 -531 -800 -940\\r\\n-849 142 -700 705 -311\\r\\n258 584 -547 -661 -153\\r\\n-58 717 658 -477 456\\r\\n-375 -530 195 681 716\\r\\n-944 274 491 -475 215\\r\\n270 989 960 536 -990\\r\\n685 889 -386 -556 303\\r\\n557 -374 589 488 -65\\r\\n-159 224 -753 -277 577\\r\\n-67 -786 -495 -72 -811\\r\\n-429 -202 522 812 -249\\r\\n807 341 -773 -197 -585\\r\\n128 -943 -653 924 -492\\r\\n-602 815 180 -871 -939\\r\\n-583 863 915 -513 768\\r\\n774 791 -337 649 170\\r\\n-341 834 -528 ...', 'output': ['0']}, {'input': '1000\\r\\n0 0 0 0 0\\r\\n1 1 1 1 1\\r\\n2 2 2 2 2\\r\\n3 3 3 3 3\\r\\n4 4 4 4 4\\r\\n5 5 5 5 5\\r\\n6 6 6 6 6\\r\\n7 7 7 7 7\\r\\n8 8 8 8 8\\r\\n9 9 9 9 9\\r\\n10 10 10 10 10\\r\\n11 11 11 11 11\\r\\n12 12 12 12 12\\r\\n13 13 13 13 13\\r\\n14 14 14 14 14\\r\\n15 15 15 15 15\\r\\n16 16 16 16 16\\r\\n17 17 17 17 17\\r\\n18 18 18 18 18\\r\\n19 19 19 19 19\\r\\n20 20 20 20 20\\r\\n21 21 21 21 21\\r\\n22 22 22 22 22\\r\\n23 23 23 23 23\\r\\n24 24 24 24 24\\r\\n25 25 25 25 25\\r\\n26 26 26 26 26\\r\\n27 27 27 27 27\\r\\n28 28 28 28 28\\r\\n29 29 29 29 29\\r\\n30 30 30 30 30\\r\\n31 31 31 31 31\\r\\n32 32 32 32 32\\r\\n33 33 33 33 33\\r\\n34 34 34 34...', 'output': ['0']}, {'input': '11\\r\\n1 0 0 0 0\\r\\n-1 0 0 0 0\\r\\n0 1 0 0 0\\r\\n0 -1 0 0 0\\r\\n0 0 1 0 0\\r\\n0 0 -1 0 0\\r\\n0 0 0 1 0\\r\\n0 0 0 -1 0\\r\\n0 0 0 0 1\\r\\n0 0 0 0 -1\\r\\n0 0 0 0 0\\r\\n', 'output': ['1\\r\\n11']}, {'input': '4\\r\\n0 0 0 0 0\\r\\n1 0 0 0 0\\r\\n0 1 0 0 0\\r\\n0 1 1 0 0\\r\\n', 'output': ['0']}]","id":569} {"difficulty":1600,"lang":"Rust","lang_cluster":"Rust","src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","execute_outcome":"RUNTIME_ERROR","source_code":"macro_rules! parse_line {\n ($t: ty) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let a_str = a_str.trim();\n a_str.parse::<$t>().expect(\"parse error\")\n });\n ($($t: ty),+) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let mut a_iter = a_str.split_whitespace();\n (\n $(\n a_iter.next().unwrap().parse::<$t>().expect(\"parse error\"),\n )+\n )\n })\n}\n\n#[allow(unused_macros)]\nmacro_rules! parse_line_to_vec {\n ($t: ty) => {{\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n (a_str\n .split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect::>())\n }};\n}\n\nuse std::io::Write;\n\nfn solve(writer: &mut std::io::BufWriter) {\n let (n, m) = parse_line!(usize, usize);\n let mut a = Vec::new();\n let mut pro = vec![0; n];\n let mut con = vec![0; n];\n let mut cons = 0;\n for _ in 0..n {\n let x = parse_line!(i32);\n a.push(x);\n if x > 0 {\n pro[(x - 1) as usize] += 1;\n }else{\n con[(-x - 1) as usize] += 1;\n cons += 1;\n }\n }\n let mut candidates = vec![false; n];\n let mut single = false;\n let mut more = false;\n for i in 0..n {\n if pro[i] + cons - con[i] == m {\n more = single;\n single = true;\n candidates[i] = true;\n }\n }\n for x in a {\n if x > 0 {\n if candidates[(x - 1) as usize] {\n if single && !more {\n writeln!(writer, \"Truth\").unwrap();\n }else{\n writeln!(writer, \"Not defined\").unwrap();\n }\n }else{\n writeln!(writer, \"Lie\").unwrap();\n }\n }else{\n if !candidates[(-x - 1) as usize] {\n writeln!(writer, \"Truth\").unwrap();\n }else{\n writeln!(writer, \"Not defined\").unwrap();\n }\n }\n }\n}\n\nfn main() {\n let mut writer = std::io::BufWriter::new(std::io::stdout());\n let tests = 1; \/\/ parse_line!(usize);\n for _ in 0..tests {\n solve(&mut writer);\n }\n}\n","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"],"human_solution":"macro_rules! parse_line {\n ($t: ty) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let a_str = a_str.trim();\n a_str.parse::<$t>().expect(\"parse error\")\n });\n ($($t: ty),+) => ({\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n let mut a_iter = a_str.split_whitespace();\n (\n $(\n a_iter.next().unwrap().parse::<$t>().expect(\"parse error\"),\n )+\n )\n })\n}\n\n#[allow(unused_macros)]\nmacro_rules! parse_line_to_vec {\n ($t: ty) => {{\n let mut a_str = String::new();\n std::io::stdin().read_line(&mut a_str).expect(\"read error\");\n (a_str\n .split_whitespace()\n .map(|x| x.parse::<$t>().unwrap())\n .collect::>())\n }};\n}\n\nuse std::io::Write;\n\nfn solve(writer: &mut std::io::BufWriter) {\n let (n, m) = parse_line!(usize, usize);\n let mut a = Vec::new();\n let mut pro = vec![0; n];\n let mut con = vec![0; n];\n let mut cons = 0;\n for _ in 0..n {\n let x = parse_line!(i32);\n a.push(x);\n if x > 0 {\n pro[(x - 1) as usize] += 1;\n }else{\n con[(-x - 1) as usize] += 1;\n cons += 1;\n }\n }\n let mut candidates = vec![false; n];\n let mut single = false;\n let mut more = false;\n for i in 0..n {\n if pro[i] + cons - con[i] == m {\n more = single;\n single = true;\n candidates[i] = true;\n }\n }\n for x in a {\n if x > 0 {\n if candidates[(x - 1) as usize] {\n if single && !more {\n writeln!(writer, \"Truth\").unwrap();\n }else{\n writeln!(writer, \"Not defined\").unwrap();\n }\n }else{\n writeln!(writer, \"Lie\").unwrap();\n }\n }else{\n if !candidates[(-x - 1) as usize] {\n writeln!(writer, \"Truth\").unwrap();\n }else{\n if single && !more {\n writeln!(writer, \"Lie\").unwrap();\n }else{\n writeln!(writer, \"Not defined\").unwrap();\n }\n }\n }\n }\n}\n\nfn main() {\n let mut writer = std::io::BufWriter::new(std::io::stdout());\n let tests = 1; \/\/ parse_line!(usize);\n for _ in 0..tests {\n solve(&mut writer);\n }\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":570} {"difficulty":1600,"lang":"Rust","lang_cluster":"Rust","src_uid":"d3a0402de1338a1a542a86ac5b484acc","execute_outcome":"TIME_LIMIT_EXCEEDED","source_code":"use std::io::{self, BufWriter, Write};\nuse std::str::{self, SplitAsciiWhitespace};\n\n\/\/ I have no idea what I'm doing\n\nstruct It {\n x: usize,\n n: usize,\n mark: Vec,\n}\n\nfn primes_that_divide(n: usize) -> It {\n It {\n x: 2,\n n: n,\n mark: vec![false; n + 1],\n }\n}\n\nimpl Iterator for It {\n type Item = usize;\n fn next(&mut self) -> Option {\n while self.x <= self.n {\n if self.mark[self.x] {\n self.x += 1;\n continue;\n }\n\n for y in self.mark.iter_mut().skip(self.x).step_by(self.x) {\n *y = true;\n }\n\n if self.n % self.x == 0 {\n self.x += 1;\n return Some(self.x - 1);\n }\n\n self.x += 1;\n }\n\n None\n }\n}\n\nfn is_lucky(n: usize, mood: &[bool], p: usize) -> bool {\n let step = n \/ p;\n (0..step).any(|start|\n (start..n).step_by(step).all(|i| mood[i]))\n}\n\nfn main() -> Result<(), io::Error> {\n let (stdin, stdout) = (io::stdin(), io::stdout());\n let mut scan = UnsafeScanner::new(stdin.lock());\n let mut out = BufWriter::new(stdout.lock());\n\n let n: usize = scan.token();\n let mood: Vec<_> = (0..n).map(|_| scan.token::()).map(|c| c == '1').collect();\n\n let ans = primes_that_divide(n)\n .filter(|&p| p > 2)\n .any(|p| is_lucky(n, &mood, p));\n\n writeln!(out, \"{}\", match ans {\n true => \"YES\",\n false => \"NO\",\n })?;\n\n Ok(())\n}\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n\/\/\/ Copied from https:\/\/github.com\/EbTech\/rust-algorithms\/blob\/master\/src\/scanner.rs\n\/\/\/ Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts\n\/\/\/ **REQUIRES** Rust 1.34 or higher\npub struct UnsafeScanner {\n reader: R,\n buf_str: Vec,\n buf_iter: SplitAsciiWhitespace<'static>,\n}\n\nimpl UnsafeScanner {\n pub fn new(reader: R) -> Self {\n Self {\n reader,\n buf_str: vec![],\n buf_iter: \"\".split_ascii_whitespace(),\n }\n }\n\n \/\/\/ This function should be marked unsafe, but noone has time for that in a\n \/\/\/ programming contest. Use at your own risk!\n pub fn token(&mut self) -> T {\n loop {\n if let Some(token) = self.buf_iter.next() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n self.buf_str.clear();\n self.reader\n .read_until(b'\\n', &mut self.buf_str)\n .expect(\"Failed read\");\n self.buf_iter = unsafe {\n let slice = str::from_utf8_unchecked(&self.buf_str);\n std::mem::transmute(slice.split_ascii_whitespace())\n }\n }\n }\n\n pub fn pair(&mut self) -> (T, T) {\n (self.token(), self.token())\n }\n}\n","description":"There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights in a good mood should be located. Otherwise, the next month will bring misfortunes.A convex polygon is regular if all its sides have same length and all his angles are equal. In this problem we consider only regular polygons with at least 3 vertices, i. e. only nondegenerated.On a picture below some examples of such polygons are present. Green points mean knights in a good mood. Red points mean ones in a bad mood. King Arthur knows the knights' moods. Help him find out if the next month will be fortunate or not.","input_specification":"The first line contains number n, which is the number of knights at the round table (3\u2009\u2264\u2009n\u2009\u2264\u2009105). The second line contains space-separated moods of all the n knights in the order of passing them around the table. \"1\" means that the knight is in a good mood an \"0\" means that he is in a bad mood.","output_specification":"Print \"YES\" without the quotes if the following month will turn out to be lucky. Otherwise, print \"NO\".","notes":null,"sample_inputs":["3\n1 1 1","6\n1 0 1 1 1 0","6\n1 0 0 1 0 1"],"sample_outputs":["YES","YES","NO"],"human_solution":"use std::io::{self, BufWriter, Write};\nuse std::str::{self, SplitAsciiWhitespace};\n\n\/\/ I have no idea what I'm doing\n\nstruct It {\n x: usize,\n n: usize,\n mark: Vec,\n}\n\n\/\/ 4 is prime\nfn primes_that_divide(n: usize) -> It {\n It {\n x: 3,\n n: n,\n mark: vec![false; n + 1],\n }\n}\n\nimpl Iterator for It {\n type Item = usize;\n fn next(&mut self) -> Option {\n while self.x <= self.n {\n if self.mark[self.x] {\n self.x += 1;\n continue;\n }\n\n for y in self.mark.iter_mut().skip(self.x).step_by(self.x) {\n *y = true;\n }\n\n if self.n % self.x == 0 {\n self.x += 1;\n return Some(self.x - 1);\n }\n\n self.x += 1;\n }\n\n None\n }\n}\n\nfn is_lucky(n: usize, mood: &[bool], p: usize) -> bool {\n let step = n \/ p;\n (0..step).any(|start|\n (start..n).step_by(step).all(|i| mood[i]))\n}\n\nfn main() -> Result<(), io::Error> {\n let (stdin, stdout) = (io::stdin(), io::stdout());\n let mut scan = UnsafeScanner::new(stdin.lock());\n let mut out = BufWriter::new(stdout.lock());\n\n let n: usize = scan.token();\n let mood: Vec<_> = (0..n).map(|_| scan.token::()).map(|c| c == '1').collect();\n\n let ans = primes_that_divide(n)\n .any(|p| is_lucky(n, &mood, p));\n\n writeln!(out, \"{}\", match ans {\n true => \"YES\",\n false => \"NO\",\n })?;\n\n Ok(())\n}\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n\/\/\/ Copied from https:\/\/github.com\/EbTech\/rust-algorithms\/blob\/master\/src\/scanner.rs\n\/\/\/ Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts\n\/\/\/ **REQUIRES** Rust 1.34 or higher\npub struct UnsafeScanner {\n reader: R,\n buf_str: Vec,\n buf_iter: SplitAsciiWhitespace<'static>,\n}\n\nimpl UnsafeScanner {\n pub fn new(reader: R) -> Self {\n Self {\n reader,\n buf_str: vec![],\n buf_iter: \"\".split_ascii_whitespace(),\n }\n }\n\n \/\/\/ This function should be marked unsafe, but noone has time for that in a\n \/\/\/ programming contest. Use at your own risk!\n pub fn token(&mut self) -> T {\n loop {\n if let Some(token) = self.buf_iter.next() {\n return token.parse().ok().expect(\"Failed parse\");\n }\n self.buf_str.clear();\n self.reader\n .read_until(b'\\n', &mut self.buf_str)\n .expect(\"Failed read\");\n self.buf_iter = unsafe {\n let slice = str::from_utf8_unchecked(&self.buf_str);\n std::mem::transmute(slice.split_ascii_whitespace())\n }\n }\n }\n\n pub fn pair(&mut self) -> (T, T) {\n (self.token(), self.token())\n }\n}\n","testcases":"[{'input': '3\\r\\n1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 1 1 1 0\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n1 0 0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '10\\r\\n1 0 1 1 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 0 1 0 1 1 0 1 0 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '29\\r\\n0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1\\r\\n', 'output': ['NO']}, {'input': '77\\r\\n0 1 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1\\r\\n', 'output': ['YES']}, {'input': '99\\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 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\\r\\n', 'output': ['YES']}, {'input': '18\\r\\n0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 0\\r\\n', 'output': ['NO']}, {'input': '3\\r\\n0 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n0 1 0 1\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '4\\r\\n0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '4\\r\\n1 0 1 1\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 0 1 1 0\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '6\\r\\n0 0 1 0 0 1\\r\\n', 'output': ['NO']}, {'input': '6\\r\\n0 1 0 0 0 0\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n0 0 1 0 0 0 1\\r\\n', 'output': ['NO']}, {'input': '7\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '8\\r\\n1 0 1 0 1 0 1 0\\r\\n', 'output': ['YES']}, {'input': '15\\r\\n0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\\r\\n', 'output': ['YES']}, {'input': '30\\r\\n1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0\\r\\n', 'output': ['YES']}, {'input': '100\\r\\n1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0\\r\\n', 'output': ['YES']}, {'input': '113\\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\\r\\n', 'output': ['YES']}]","id":571} {"difficulty":1600,"lang":"Rust","lang_cluster":"Rust","src_uid":"ed1a2ae733121af6486568e528fe2d84","execute_outcome":"WRONG_ANSWER","source_code":"#[allow(unused_macros)]\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n let mut next = || { iter.next().unwrap() };\n input_inner!{next, $($r)*}\n };\n ($($r:tt)*) => {\n let stdin = std::io::stdin();\n let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));\n let mut next = move || -> String{\n bytes\n .by_ref()\n .map(|r|r.unwrap() as char)\n .skip_while(|c|c.is_whitespace())\n .take_while(|c|!c.is_whitespace())\n .collect()\n };\n input_inner!{next, $($r)*}\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! input_inner {\n ($next:expr) => {};\n ($next:expr, ) => {};\n\n ($next:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($next, $t);\n input_inner!{$next $($r)*}\n };\n\n ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {\n let mut $var = read_value!($next, $t);\n input_inner!{$next $($r)*}\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! read_value {\n ($next:expr, ( $($t:tt),* )) => {\n ( $(read_value!($next, $t)),* )\n };\n\n ($next:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($next, $t)).collect::>()\n };\n\n ($next:expr, chars) => {\n read_value!($next, String).chars().collect::>()\n };\n\n ($next:expr, usize1) => {\n read_value!($next, usize) - 1\n };\n\n ($next:expr, $t:ty) => {\n $next().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n#[allow(unused_macros)]\nmacro_rules! debug {\n ($($a:expr),*) => {\n #[cfg(debug_assertions)]\n writeln!(&mut std::io::stderr(), concat!(\"[DEBUG] \", $(stringify!($a), \"={:?} \"),*), $($a),*);\n }\n}\n\n#[allow(unused_imports)]\nuse std::cmp::{min, max};\n#[allow(unused_imports)]\nuse std::io::{stdout, stdin, BufWriter, Write};\n\nconst INF:usize= 2 << 30;\n\nfn rec(cur: usize, u: usize, k: usize, cnt: &Vec, ans: &mut Vec) -> Vec {\n debug!(cur, u, k);\n let mut v = vec![0; 20];\n if cur > u {\n return v;\n }\n let v1 = rec(cur*2, u, k, cnt, ans);\n let v2 = rec(cur*2+1, u, k, cnt, ans);\n v[0] = cnt[cur];\n\n let mut temp = cnt[cur];\n let mut cost = 0;\n for i in 0..19 {\n v[i+1] = v1[i] + v2[i];\n if k - temp > 0 {\n cost += (i+1) * min(k-temp, v[i+1]);\n temp += min(k-temp, v[i+1]);\n }\n }\n if temp == k {\n ans[cur] = cost;\n }\n v\n}\n\n\nfn main() {\n let out = std::io::stdout();\n let mut out = BufWriter::new(out.lock());\n macro_rules! puts {\n ($($format:tt)*) => (write!(out,$($format)*).unwrap());\n }\n\n input!{\n n: usize,\n k: usize,\n aa: [usize; n],\n }\n let mut m = *aa.iter().max().unwrap();\n let mut cnt = vec![0; m+1];\n let mut ans = vec![INF; m+1];\n for a in aa {\n cnt[a] += 1;\n }\n rec(1, m, k, &cnt, &mut ans);\n let ans = ans.iter().min().unwrap();\n puts!(\"{}\\n\", ans);\n}\n","description":"The only difference between easy and hard versions is the number of elements in the array.You are given an array $$$a$$$ consisting of $$$n$$$ integers. In one move you can choose any $$$a_i$$$ and divide it by $$$2$$$ rounding down (in other words, in one move you can set $$$a_i := \\lfloor\\frac{a_i}{2}\\rfloor$$$).You can perform such an operation any (possibly, zero) number of times with any $$$a_i$$$.Your task is to calculate the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.Don't forget that it is possible to have $$$a_i = 0$$$ after some operations, thus the answer always exists.","input_specification":"The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le k \\le n \\le 50$$$) \u2014 the number of elements in the array and the number of equal numbers required. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 2 \\cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.","output_specification":"Print one integer \u2014 the minimum possible number of operations required to obtain at least $$$k$$$ equal numbers in the array.","notes":null,"sample_inputs":["5 3\n1 2 2 4 5","5 3\n1 2 3 4 5","5 3\n1 2 3 3 3"],"sample_outputs":["1","2","0"],"human_solution":"use std::io;\nuse std::str::FromStr;\nuse std::num::ParseIntError;\nuse std::ops::Index;\n\nstruct RevBinary {\n data: Vec,\n}\n\nimpl FromStr for RevBinary {\n type Err = ParseIntError;\n\n fn from_str(s: &str) -> Result {\n let i = s.parse::()?;\n\n Ok(RevBinary::new(i))\n }\n}\n\nimpl Index for RevBinary {\n type Output = bool;\n\n fn index(&self, i: usize) -> &Self::Output {\n &self.data[self.data.len() - i - 1]\n }\n}\n\nimpl RevBinary {\n fn new(x : u32) -> RevBinary {\n let mut y = x;\n let mut bin : Vec = Vec::new();\n while y != 0 {\n bin.push(if y % 2 == 1 { true } else { false }); \n y \/= 2;\n }\n RevBinary {\n data: bin,\n }\n }\n\n fn size(&self) -> usize {\n self.data.len()\n }\n}\n\nfn process_node(all: &Vec, ind: Vec, depth: usize, k: u32) -> u32 {\n let mut result : u32 = ind.iter().take(k as usize).map(|&x| all[x].size() - depth).sum::() as u32;\n\n if result == 0 {\n return 0;\n }\n\n let new_ind : (Vec, Vec) = ind.iter().filter(|&&x| all[x].size() > depth).partition(|&&x| all[x][depth]);\n if new_ind.0.len() >= k as usize {\n result = result.min(process_node(&all, new_ind.0, depth + 1, k));\n }\n if result != 0 && new_ind.1.len() >= k as usize {\n result = result.min(process_node(&all, new_ind.1, depth + 1, k));\n }\n result\n}\n\nfn main() {\n let mut input = String::new();\n io::stdin().read_line(&mut input).expect(\"failed to read input\");\n let mut input_iter = input.split_whitespace();\n let n = input_iter.next().unwrap().parse::().unwrap();\n let k = input_iter.next().unwrap().parse::().unwrap();\n let mut buffer = String::new();\n io::stdin().read_line(&mut buffer).expect(\"failed to read input\");\n let mut a = buffer.split_whitespace().map(|x| x.parse::().unwrap()).collect::>();\n a.sort_by(|a, b| a.size().cmp(&b.size()));\n \n println!(\"{}\", process_node(&a, (0..n).collect::>(), 0, k));\n}","testcases":"[{'input': '5 3\\r\\n1 2 2 4 5\\r\\n', 'output': ['1']}, {'input': '5 3\\r\\n1 2 3 4 5\\r\\n', 'output': ['2']}, {'input': '5 3\\r\\n1 2 3 3 3\\r\\n', 'output': ['0']}, {'input': '1 1\\r\\n1337\\r\\n', 'output': ['0']}, {'input': '200000 100000\\r\\n150002 156252 199995 199996 149998 156248 199991 199992 114062 131640 199987 199988 149994 156244 199983 199984 128119 105636 199979 199980 149990 156240 199975 199976 107907 131636 199971 199972 149986 156236 199967 199968 128115 117796 199963 199964 114058 131632 199959 199960 149982 156228 199955 199956 128111 110012 199951 199952 149978 156224 199947 199948 102223 131628 199943 199944 149974 156220 199939 199940 128107 131624 199935 199936 149970 156216 199931 199932 149966 156212 199927...', 'output': ['1468946']}, {'input': '50 2\\r\\n72548 51391 1788 171949 148789 151619 19225 8774 52484 74830 20086 51129 151145 87650 108005 112019 126739 124087 158096 59027 34500 87415 115058 194160 171792 136832 1114 112592 171746 199013 101484 182930 185656 154861 191455 165701 140450 3475 160191 122350 66759 93252 60972 124615 119327 108068 149786 8698 63546 187913\\r\\n', 'output': ['12']}, {'input': '50 2\\r\\n3 6 10 1 14 5 26 11 6 1 23 43 7 23 20 11 15 11 2 1 8 37 2 19 31 18 2 4 15 84 9 29 38 46 9 21 2 2 13 114 28 9 6 20 14 46 4 20 39 99\\r\\n', 'output': ['0']}, {'input': '50 2\\r\\n199995 199977 199982 199979 199998 199991 199999 199976 199974 199971 199966 199999 199978 199987 199989 199995 199968 199987 199988 199987 199987 199998 199988 199958 199985 199999 199997 199939 199992 199999 199985 199994 199987 199965 199947 199991 199993 199997 199998 199994 199971 199999 199999 199990 199993 199983 199983 199999 199970 199952\\r\\n', 'output': ['0']}, {'input': '50 7\\r\\n155076 162909 18349 8937 38161 128479 127526 128714 164477 163037 130796 160247 17004 73321 175301 175796 79144 75670 46299 197255 10139 2112 195709 124860 6485 137601 63708 117985 94924 65661 113294 85898 7511 137431 115791 66126 146803 121145 96379 126408 195646 70033 131093 86487 94591 3086 59652 188702 27036 78631\\r\\n', 'output': ['79']}, {'input': '50 7\\r\\n1 2 27 54 6 15 24 1 9 28 3 26 8 12 7 6 8 54 23 8 7 13 18 10 1 33 24 10 34 13 12 9 16 11 36 50 39 9 8 10 2 5 6 4 7 67 21 12 6 55\\r\\n', 'output': ['3']}, {'input': '50 7\\r\\n199961 199990 199995 199997 199963 199995 199985 199994 199974 199974 199997 199991 199993 199982 199991 199982 199963 200000 199994 199997 199963 199991 199947 199996 199994 199995 199995 199990 199972 199973 199980 199955 199984 199998 199998 199992 199986 199986 199997 199995 199987 199958 199982 199998 199996 199995 199979 199943 199992 199993\\r\\n', 'output': ['7']}, {'input': '50 25\\r\\n162847 80339 131433 130128 135933 64805 74277 145697 92574 169638 26992 155045 32254 97675 177503 143802 44012 171388 185307 33652 194764 80214 169507 71832 180118 117737 198279 89826 9941 120250 158894 31871 616 190147 159249 158867 131076 77551 95165 54709 51376 145758 74581 26670 48775 29351 4750 55294 129850 19793\\r\\n', 'output': ['364']}, {'input': '50 25\\r\\n19 1 17 6 4 21 9 16 5 21 2 12 17 11 54 18 36 20 34 17 32 1 4 14 26 11 6 2 7 5 2 3 12 16 20 5 16 1 18 55 16 20 2 3 2 12 65 20 7 11\\r\\n', 'output': ['43']}, {'input': '50 25\\r\\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 199996 199910 199997 199976 200000 199999 199997 199998 199973 199996 199917\\r\\n', 'output': ['125']}, {'input': '50 50\\r\\n86175 169571 61423 53837 33228 49923 87369 11875 167105 101762 128203 19011 191596 19500 11213 950 192557 164451 58008 34390 39704 128606 191084 14227 57911 129189 124795 42481 69510 59862 146348 57352 158069 68387 196697 46595 84330 168274 88721 191842 155836 39164 195031 53880 188281 11150 132256 87853 179233 135499\\r\\n', 'output': ['780']}, {'input': '50 50\\r\\n8 63 44 78 3 65 7 27 13 45 7 5 18 94 25 17 26 10 21 44 5 13 6 30 10 11 44 14 71 17 10 5 4 9 8 21 4 9 25 18 3 14 15 8 7 11 5 28 9 1\\r\\n', 'output': ['167']}, {'input': '50 50\\r\\n199987 199984 199987 199977 199996 199923 199984 199995 199991 200000 199998 199990 199983 199981 199973 199989 199981 199993 199959 199994 199973 199962 199998 199970 199999 199981 199996 199996 199985 199980 199959 199990 199982 199987 199992 199997 199985 199976 199947 199998 199962 199987 199984 199982 199999 199997 199985 199992 199979 199974\\r\\n', 'output': ['450']}, {'input': '50 1\\r\\n156420 126738 188531 85575 23728 72842 190346 24786 118328 137944 126942 115577 175247 85409 146194 31398 189417 52337 135886 162083 146559 131125 31741 152481 57935 26624 106893 55028 81626 99143 182257 129556 100261 11429 156642 27997 105720 173400 140250 164944 26466 132034 86679 190160 161138 179688 2975 149862 38336 67959\\r\\n', 'output': ['0']}, {'input': '200000 2\\r\\n176158 176769 40627 19400 151736 188493 136139 77698 179121 134117 178035 140418 162114 135099 84129 162379 76419 104776 60147 117288 170931 90437 119080 55204 21173 138483 148836 69586 51085 50644 103281 37829 188454 53551 64569 89945 44943 75344 15181 174825 81977 9989 111265 195606 173051 160162 138381 76999 124303 18814 61133 195491 108882 28148 186882 169752 3079 198883 116144 92760 131861 77871 36414 42967 197445 155133 173497 182862 21765 86715 10896 8891 187559 143445 114265 80031 152290 ...', 'output': ['0']}, {'input': '200000 2\\r\\n15 6 64 30 16 10 33 28 10 7 37 96 5 11 13 25 2 7 8 49 27 35 16 32 24 7 10 44 33 20 25 14 7 2 80 26 3 8 5 17 29 2 7 6 31 19 7 45 1 5 39 30 7 4 9 8 13 9 27 11 11 9 52 48 66 7 37 4 2 42 15 39 16 22 22 53 42 12 11 28 27 4 11 8 12 10 7 1 20 14 15 16 17 26 14 27 4 60 12 31 8 14 72 7 1 38 7 3 11 7 23 5 3 30 15 10 40 72 11 11 32 21 32 11 32 11 9 52 3 68 27 8 20 16 5 4 19 47 3 39 40 37 16 29 26 36 60 20 56 27 2 38 30 18 5 7 3 27 10 16 36 25 10 23 16 20 58 11 5 5 32 5 10 7 51 8 11 24 37 55 2 10 37 38 13 1 ...', 'output': ['0']}, {'input': '200000 2\\r\\n199925 199998 199996 199972 199875 199931 199997 199980 199986 199983 199977 199999 199986 199948 199997 199946 199986 199994 199978 199956 199994 199988 199998 199965 199991 199996 199994 199993 199995 199941 200000 200000 199988 199998 199992 199999 199962 199999 199999 199987 199947 199981 199998 199994 199989 199988 199961 199981 199995 199988 199985 199981 199963 200000 199974 199997 200000 199993 199984 199995 199985 199985 199948 199970 199989 199910 199976 199946 199987 199974 199986 1999...', 'output': ['0']}, {'input': '200000 50\\r\\n89125 181814 109104 150035 118196 41142 80649 126486 180876 147942 11426 196094 152188 28730 92060 19362 182872 195147 70878 111164 35511 195859 40847 189737 80884 179444 75422 155821 93039 129202 14075 30636 32265 15924 85723 144946 43243 68999 81655 43372 3903 102043 5453 63533 165813 51716 33118 154090 52928 1274 81006 144446 102615 40217 127304 28135 142644 81314 114999 82951 121368 10744 166094 152868 5893 118756 55201 114536 40195 29010 121930 26657 120732 184850 108645 179138 172191 19906...', 'output': ['142']}, {'input': '200000 50\\r\\n29 16 86 40 24 1 6 15 7 30 7 1 1 27 11 7 15 19 1 24 17 2 5 18 13 15 6 10 36 1 4 4 12 29 97 5 2 7 49 27 22 16 11 12 4 24 30 5 43 6 71 99 3 12 6 4 12 4 6 6 1 30 41 8 13 5 12 11 7 23 23 14 11 27 12 8 27 5 7 8 17 10 9 5 3 1 30 5 28 53 5 10 12 7 22 24 2 22 2 12 82 1 8 8 15 3 3 1 12 3 5 4 26 13 22 16 19 23 12 24 7 53 5 48 17 83 10 20 11 61 44 1 8 9 52 19 23 24 6 91 14 48 42 1 9 56 17 17 4 8 70 21 9 4 18 8 4 24 48 14 2 52 20 30 19 67 8 4 16 4 44 23 2 11 10 15 7 19 19 6 2 28 43 41 11 7 16 73 13 11 14 14...', 'output': ['0']}, {'input': '200000 50\\r\\n199951 199984 199999 199989 199994 199996 199979 199985 199986 199993 199995 199986 199987 199991 199983 199974 199996 199997 199999 199996 199997 199965 199984 199919 200000 199993 199987 199940 199964 199994 199995 199997 200000 199977 199927 199995 199983 199946 199979 199978 199962 199996 199983 199995 199992 199964 199981 199980 199966 199947 199990 199979 199998 199969 199984 199997 199959 199998 199932 199994 199951 199997 199999 199994 199993 199998 199999 199998 199974 199941 199996 199...', 'output': ['0']}, {'input': '200000 5000\\r\\n79381 79230 141388 31307 165375 187864 19920 60514 15684 142282 106397 63201 127752 46886 94521 98380 42260 14463 163598 78057 117076 118960 91435 125315 54487 101590 2241 86634 175827 70289 117798 162929 136223 163143 148246 155631 103799 13538 45613 54719 111804 37261 188334 55871 167729 108986 130559 77461 105407 164447 94891 150629 174066 97332 100766 119964 20217 156471 113389 108201 108522 69928 137932 54974 5691 180045 50709 5139 122890 172079 77384 136612 166807 112859 192517 169518 93...', 'output': ['51474']}, {'input': '200000 5000\\r\\n30 22 8 30 19 8 19 74 23 8 13 34 1 3 13 14 52 15 52 11 2 6 24 1 20 93 4 68 24 32 11 21 18 10 8 3 3 40 13 67 25 1 29 3 80 13 43 23 31 9 19 61 34 10 3 21 29 15 1 3 23 19 6 17 16 39 59 11 29 5 11 78 36 81 18 21 9 40 25 22 16 19 33 13 33 1 13 19 85 31 10 93 68 26 61 36 15 27 8 3 25 27 15 3 26 23 6 17 4 1 35 1 1 6 5 19 21 35 42 7 12 9 16 61 3 20 26 34 66 35 19 16 33 15 5 5 14 1 18 2 17 20 2 1 18 54 15 7 28 21 15 2 9 3 11 21 28 40 15 16 4 4 4 5 59 2 41 1 5 2 5 27 33 1 2 5 69 28 41 21 1 36 21 24 47 2...', 'output': ['0']}, {'input': '200000 5000\\r\\n199982 199959 199999 199990 199999 199988 199999 199997 199998 199952 199998 199995 199994 199999 199993 199994 199975 199985 199972 199989 199981 199976 199959 199987 199999 199996 199992 199988 199967 199997 199991 199982 199970 199938 199993 199984 199948 199986 199987 199954 199955 199993 199965 199994 199996 200000 199942 199999 199978 199999 199934 199998 199988 199993 199982 199982 199971 199998 199964 199976 199982 199993 199949 199987 199982 199970 199987 199982 199978 199970 199989 1...', 'output': ['0']}, {'input': '200000 100000\\r\\n34325 22969 103009 71027 2038 152578 5879 138977 191292 113909 109908 96249 184205 44508 147634 148777 176276 77032 69901 98564 189633 111725 130407 192895 152327 45155 47364 152117 95645 72935 162863 53604 68862 135160 17204 99950 90345 50234 48612 90841 131041 80246 83412 156495 160173 137432 191901 105695 179289 34864 101790 92090 197748 92914 144694 6006 139600 158454 110410 189327 88326 181432 40645 153505 87151 22745 109139 53679 5803 170908 84133 199840 50398 55018 166192 27004 82542 ...', 'output': ['1469076']}, {'input': '200000 100000\\r\\n7 32 54 4 21 7 46 25 29 10 4 24 16 28 2 37 7 50 36 3 28 8 19 16 28 10 12 9 55 5 2 1 21 28 9 8 29 1 39 10 19 2 3 43 12 8 11 13 4 23 3 6 21 3 25 5 16 13 14 20 54 22 44 37 10 12 8 3 1 4 3 39 18 52 78 20 12 11 20 24 32 5 13 19 5 50 1 2 65 7 15 22 3 54 30 6 11 6 21 12 14 36 50 12 3 6 21 13 52 49 6 21 64 7 47 21 8 2 7 12 20 3 35 23 41 17 6 27 31 3 64 18 13 5 11 1 7 39 32 4 3 3 34 2 6 9 9 61 3 46 4 27 11 10 51 2 104 9 6 8 29 54 20 3 2 21 8 17 29 10 18 47 5 13 12 3 17 2 2 21 25 8 12 15 23 6 22 40 13...', 'output': ['203774']}, {'input': '200000 100000\\r\\n199995 199985 199996 199949 199992 199991 199967 199997 199970 199987 199983 199969 199963 199948 199991 199927 199967 199997 199962 199996 199994 199996 199967 199968 199988 199987 200000 199995 199980 199989 199978 199973 199988 199999 199996 199999 200000 199995 199994 199989 199970 199998 200000 199994 199989 199977 199977 199991 199998 199996 199966 199999 199992 199960 199971 199980 199989 199965 199979 199993 199955 199991 199945 199990 199919 199966 199991 199966 199986 199999 199988...', 'output': ['400000']}, {'input': '200000 199999\\r\\n59140 28957 29004 124065 198366 31262 20255 555 101812 77794 57243 80983 106873 59781 102126 113354 195632 71253 185623 44381 152629 3476 7721 165148 72116 153977 116812 24392 130480 27568 110844 128214 148350 41366 196296 167855 69895 160766 128532 28654 179594 199534 69783 99429 155223 197218 74846 22616 20885 92744 1863 74047 34173 36675 12871 113417 156700 120361 23269 179092 74197 99589 20668 190966 59229 37589 167805 94519 179133 95820 126635 40724 46228 84754 72989 25150 175250 90047 ...', 'output': ['3137884']}, {'input': '200000 199999\\r\\n60 39 34 20 61 27 3 20 14 53 12 1 41 20 18 29 27 16 5 36 6 79 21 25 62 28 6 45 13 4 16 13 30 50 32 19 17 26 9 24 28 4 13 21 18 12 13 28 24 20 8 32 12 50 30 27 4 18 4 11 6 46 8 14 26 14 27 1 120 1 10 5 4 23 15 9 7 5 6 18 11 12 13 18 33 1 67 28 88 13 63 26 29 38 13 28 15 65 10 20 23 24 4 62 6 71 24 10 8 6 38 16 21 22 21 27 5 2 10 19 34 19 4 34 15 5 23 86 1 9 22 20 8 4 1 15 19 32 46 25 15 31 6 12 4 4 29 66 10 23 34 4 27 14 4 69 23 41 54 33 14 6 28 35 14 6 18 24 29 1 6 4 3 27 17 5 54 22 19 48 7 ...', 'output': ['650309']}, {'input': '200000 199999\\r\\n199991 199994 199961 199957 199983 199958 199999 199984 199983 200000 199983 199955 199997 199994 199973 199964 199958 199983 199926 199968 199955 199992 199994 199973 199974 199978 199992 199950 199938 199941 199952 199996 199989 199958 199990 199975 199979 199978 199955 199994 199969 199965 199948 199989 199993 199991 199974 199992 199982 199986 199990 199945 200000 199983 199999 199996 199955 199992 199989 199927 199978 199984 199995 199854 199949 199992 199945 199972 199982 199997 199948...', 'output': ['1799991']}, {'input': '200000 200000\\r\\n197543 192033 68698 92316 101105 108314 167424 42287 198103 96873 181007 90054 44902 63014 39886 13121 100673 922 101400 163828 48349 72261 114526 119401 113604 103065 183011 154652 109138 126652 94974 30269 145851 94410 40539 199281 85891 36305 175226 125138 47940 79444 33199 37866 77228 74953 41056 75132 149820 158299 95563 78843 133706 31336 60925 129361 122496 29955 139867 84314 17627 94387 140829 195174 79980 183347 109006 164346 54490 196784 129358 193423 197279 196494 32464 124498 787...', 'output': ['3137948']}, {'input': '200000 200000\\r\\n5 9 15 1 65 41 24 10 20 50 5 14 1 9 67 19 11 32 7 35 19 23 6 60 37 7 30 66 2 11 15 14 1 79 33 15 28 10 34 7 29 22 13 45 1 19 45 107 18 6 26 18 22 44 23 3 4 24 38 22 2 97 7 32 8 11 66 33 2 38 17 6 66 26 66 16 2 4 28 24 7 11 42 14 36 3 27 1 23 5 3 20 12 24 39 14 5 4 27 1 76 3 7 11 21 44 51 22 25 18 10 17 22 4 101 44 12 42 36 62 4 15 15 3 37 22 4 21 7 91 28 25 3 3 28 6 11 13 6 11 4 1 3 10 2 86 2 4 9 26 20 17 3 31 20 3 6 41 17 3 22 20 19 64 2 21 4 18 9 3 6 7 1 31 7 17 58 34 40 3 2 45 24 24 38 6 ...', 'output': ['648723']}, {'input': '200000 200000\\r\\n199954 199998 199997 199905 199992 199987 200000 199993 199994 199999 199990 199992 199991 199956 199972 199978 199998 199989 199980 199998 199982 199997 199988 199995 199982 199998 199988 199985 199979 199997 199996 199980 199992 199998 199984 199986 199990 199987 199997 199967 199983 199995 199881 199987 199950 199963 199991 199970 199985 199993 199931 199947 199995 199987 199998 199998 200000 199960 199967 199999 199982 199999 199909 199906 199968 199997 199985 200000 199994 199968 199987...', 'output': ['1800000']}, {'input': '200000 1\\r\\n92734 60628 60074 189922 26674 109716 131452 126414 69158 197231 150299 180674 162024 132858 122318 114462 28697 57218 62129 44535 50287 166852 35763 13525 41908 19763 87319 187829 136772 183477 184055 127559 46163 77415 62460 95345 177509 77973 27943 17418 98580 16066 145484 28448 39054 31782 191569 152755 57877 90347 148020 176439 185789 129328 26690 34006 61489 152262 136097 134956 178158 19957 59783 88393 161221 83768 108416 146739 107166 50877 179052 139105 26032 40934 195390 8897 28938 1995...', 'output': ['0']}, {'input': '122222 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 1 1 1...', 'output': ['0']}, {'input': '80000 79999\\r\\n1 40001 3 60001 5 40003 7 70001 9 40005 11 60003 13 40007 15 75001 17 40009 19 60005 21 40011 23 70003 25 40013 27 60007 29 40015 31 77501 33 40017 35 60009 37 40019 39 70005 41 40021 43 60011 45 40023 47 75003 49 40025 51 60013 53 40027 55 70007 57 40029 59 60015 61 40031 63 78751 65 40033 67 60017 69 40035 71 70009 73 40037 75 60019 77 40039 79 75005 81 40041 83 60021 85 40043 87 70011 89 40045 91 60023 93 40047 95 77503 97 40049 99 60025 101 40051 103 70013 105 40053 107 60027 109 40055 111...', 'output': ['1148930']}, {'input': '200000 200000\\r\\n34270 172662 160315 82250 122014 143563 189833 179410 199358 34011 154756 108685 144055 4444 198531 7726 180229 189819 131221 82152 107365 30928 15920 39640 109263 13894 39369 120853 167341 35740 99808 28942 6959 40064 30514 18025 197628 113087 162701 152773 49494 157652 83875 154323 119790 69069 7265 126682 179363 138690 17595 32863 126791 35121 67392 130851 113513 633 97905 84860 114018 30176 50547 123183 159184 39079 93299 154446 164239 157492 131022 165855 140555 128259 147364 197301 326...', 'output': ['3137875']}, {'input': '200000 2000\\r\\n370 166204 57007 38501 172522 141517 103303 64223 42659 20177 51346 53306 9530 151444 89650 4420 26956 107479 43444 48925 91520 131437 35119 1378 2629 111439 156790 168445 177463 179056 49024 195535 132940 103843 16822 179209 31004 36692 153316 89047 58328 14300 81899 72998 159058 41977 136270 69400 54278 61813 29924 48797 93959 94814 180334 115732 78508 87670 47762 7003 110845 27316 199711 16579 2593 70955 81361 80479 173377 3833 47015 14246 143011 60562 19331 138151 135055 79910 19538 31933 ...', 'output': ['16946']}, {'input': '50 4\\r\\n29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30 29 16 86 40 24 1 6 15 7 30\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n2 2 2 2 2\\r\\n', 'output': ['0']}, {'input': '7 3\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '5 3\\r\\n4 4 4 4 4\\r\\n', 'output': ['0']}, {'input': '7 4\\r\\n3 3 3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '10 6\\r\\n7 7 7 7 7 7 7 7 7 7\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n9 9 9 9\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n3 3 3 3\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n3 3 3 3 3\\r\\n', 'output': ['0']}, {'input': '4 2\\r\\n2 2 2 2\\r\\n', 'output': ['0']}, {'input': '5 2\\r\\n9 9 9 9 9\\r\\n', 'output': ['0']}]","id":572} {"difficulty":2200,"lang":"Rust","lang_cluster":"Rust","src_uid":"fc29e8c1a9117c1dd307131d852b6088","execute_outcome":"WRONG_ANSWER","source_code":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\n\/\/ \u6700\u5927\u5024\u306f\u8caa\u6b32\u306b\u5272\u308a\u5f53\u3066\u308c\u3070\u826f\u3044\uff1f\n\/\/ 2\u51aa\u3092\u5747\u7b49\u306b\u5272\u308a\u632f\u308b\u3001\u5272\u308a\u632f\u308c\u306a\u304b\u3063\u305f\u306e\u306f2\u51aa\u3067\u306a\u3044\u5217\u306b\u7a81\u3063\u8fbc\u3080\n\/\/ 2\u51aa\u3067\u306a\u3044\u5217\u3092\u8caa\u6b32\u306b\u5272\u308a\u5f53\u3066\u308b\n\/\/ \u5c0f\u3055\u3044\u5024\u3092\u5c0f\u3055\u3044\u5024\u306b\u5272\u308a\u632f\u308b\u611f\u3058\n\/\/ \u3053\u308c\u3067\u3067\u304d\u306a\u3044\u306a\u3089No\n\/\/ \u3067\u304d\u305f\u3089\uff1f\n\/\/ \u5c0f\u3055\u3044\u5217\u3092\u89e3\u6d88\u3057\u3066\u518d\u5272\u308a\u5f53\u3066\u304c\u3067\u304d\u308b\u304b\u3068\u3044\u3046\u306e\u3092\u9806\u306b\u7d9a\u3051\u308b\u3068\u3044\u3044\u304b\n\/\/ \u8a08\u7b97\u91cf\uff1f\n\/\/ \u5168\u90e81\u3068\u304b\u3060\u3068\u5272\u308a\u5f53\u3066\u306e\u56de\u6570\u304cO(N)\u306b\u306a\u308b\u3001\u8f9b\u3044\n\/\/ \u5272\u308a\u5f53\u3066\u53ef\u80fd\u304b\u306f\u5358\u8abf\u306a\u306e\u3067\u4e8c\u5206\u63a2\u7d22\n\nfn valid(beki: &[u64], b: &mut [u64]) -> bool {\n b.sort();\n let mut p = 0;\n for pow in beki.iter().rev() {\n if p < b.len() && *pow * 2 >= b[p] {\n p += 1;\n }\n }\n p == b.len()\n}\n\nfn run() {\n input! {\n n: usize,\n a: [u64; n],\n }\n let mut beki = vec![];\n let mut k = 0;\n while k < n && a[k] == 1 {\n beki.push(1);\n k += 1;\n }\n let mut pos = 0;\n let mut b = vec![];\n for a in a[k..].iter() {\n if *a == beki[pos] * 2 {\n beki[pos] *= 2;\n pos = (pos + 1) % beki.len();\n } else {\n pos = 0;\n b.push(*a);\n }\n }\n if !valid(&beki, &mut b) {\n println!(\"-1\");\n return;\n }\n let mut ok = beki.len();\n let mut ng = 0;\n while ok - ng > 1 {\n let mid = (ok + ng) \/ 2;\n let mut b = b.clone();\n for p in beki[mid..].iter() {\n let mut k = 1;\n while k <= *p {\n b.push(k);\n k *= 2;\n }\n }\n if valid(&beki[..mid], &mut b) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n let mut s = String::new();\n for k in ok..=beki.len() {\n s.push_str(&format!(\"{} \", k));\n }\n s.pop();\n println!(\"{}\", s);\n}\n\nfn main() {\n run();\n}\n","description":"It can be shown that any positive integer x can be uniquely represented as x\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u2009...\u2009+\u20092k\u2009-\u20091\u2009+\u2009r, where k and r are integers, k\u2009\u2265\u20090, 0\u2009<;\u2009r\u2009\u2264\u20092k. Let's call that representation prairie partition of x.For example, the prairie partitions of 12, 17, 7 and 1 are: 12\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u20095,17\u2009=\u20091\u2009+\u20092\u2009+\u20094\u2009+\u20098\u2009+\u20092,7\u2009=\u20091\u2009+\u20092\u2009+\u20094,1\u2009=\u20091. Alice took a sequence of positive integers (possibly with repeating elements), replaced every element with the sequence of summands in its prairie partition, arranged the resulting numbers in non-decreasing order and gave them to Borys. Now Borys wonders how many elements Alice's original sequence could contain. Find all possible options!","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009105)\u00a0\u2014 the number of numbers given from Alice to Borys. The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u20091012; a1\u2009\u2264\u2009a2\u2009\u2264\u2009...\u2009\u2264\u2009an)\u00a0\u2014 the numbers given from Alice to Borys.","output_specification":"Output, in increasing order, all possible values of m such that there exists a sequence of positive integers of length m such that if you replace every element with the summands in its prairie partition and arrange the resulting numbers in non-decreasing order, you will get the sequence given in the input. If there are no such values of m, output a single integer -1.","notes":"NoteIn the first example, Alice could get the input sequence from [6,\u200920] as the original sequence.In the second example, Alice's original sequence could be either [4,\u20095] or [3,\u20093,\u20093].","sample_inputs":["8\n1 1 2 2 3 4 5 8","6\n1 1 1 2 2 2","5\n1 2 4 4 4"],"sample_outputs":["2","2 3","-1"],"human_solution":"\/\/https:\/\/qiita.com\/tanakh\/items\/0ba42c7ca36cd29d0ac8 \u3088\u308a\nmacro_rules! input {\n (source = $s:expr, $($r:tt)*) => {\n let mut iter = $s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n ($($r:tt)*) => {\n let s = {\n use std::io::Read;\n let mut s = String::new();\n std::io::stdin().read_to_string(&mut s).unwrap();\n s\n };\n let mut iter = s.split_whitespace();\n input_inner!{iter, $($r)*}\n };\n}\n\nmacro_rules! input_inner {\n ($iter:expr) => {};\n ($iter:expr, ) => {};\n ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {\n let $var = read_value!($iter, $t);\n input_inner!{$iter $($r)*}\n };\n}\n\nmacro_rules! read_value {\n ($iter:expr, ( $($t:tt),* )) => {\n ( $(read_value!($iter, $t)),* )\n };\n ($iter:expr, [ $t:tt ; $len:expr ]) => {\n (0..$len).map(|_| read_value!($iter, $t)).collect::>()\n };\n ($iter:expr, chars) => {\n read_value!($iter, String).chars().collect::>()\n };\n ($iter:expr, bytes) => {\n read_value!($iter, String).bytes().collect::>()\n };\n ($iter:expr, usize1) => {\n read_value!($iter, usize) - 1\n };\n ($iter:expr, $t:ty) => {\n $iter.next().unwrap().parse::<$t>().expect(\"Parse error\")\n };\n}\n\n\/\/\n\n\/\/ \u6700\u5927\u5024\u306f\u8caa\u6b32\u306b\u5272\u308a\u5f53\u3066\u308c\u3070\u826f\u3044\uff1f\n\/\/ 2\u51aa\u3092\u5747\u7b49\u306b\u5272\u308a\u632f\u308b\u3001\u5272\u308a\u632f\u308c\u306a\u304b\u3063\u305f\u306e\u306f2\u51aa\u3067\u306a\u3044\u5217\u306b\u7a81\u3063\u8fbc\u3080\n\/\/ 2\u51aa\u3067\u306a\u3044\u5217\u3092\u8caa\u6b32\u306b\u5272\u308a\u5f53\u3066\u308b\n\/\/ \u5c0f\u3055\u3044\u5024\u3092\u5c0f\u3055\u3044\u5024\u306b\u5272\u308a\u632f\u308b\u611f\u3058\n\/\/ \u3053\u308c\u3067\u3067\u304d\u306a\u3044\u306a\u3089No\n\/\/ \u3067\u304d\u305f\u3089\uff1f\n\/\/ \u5c0f\u3055\u3044\u5217\u3092\u89e3\u6d88\u3057\u3066\u518d\u5272\u308a\u5f53\u3066\u304c\u3067\u304d\u308b\u304b\u3068\u3044\u3046\u306e\u3092\u9806\u306b\u7d9a\u3051\u308b\u3068\u3044\u3044\u304b\n\/\/ \u8a08\u7b97\u91cf\uff1f\n\/\/ \u5168\u90e81\u3068\u304b\u3060\u3068\u5272\u308a\u5f53\u3066\u306e\u56de\u6570\u304cO(N)\u306b\u306a\u308b\u3001\u8f9b\u3044\n\/\/ \u5272\u308a\u5f53\u3066\u53ef\u80fd\u304b\u306f\u5358\u8abf\u306a\u306e\u3067\u4e8c\u5206\u63a2\u7d22\n\nfn valid(beki: &[u64], b: &mut [u64]) -> bool {\n b.sort();\n let mut p = 0;\n for pow in beki.iter().rev() {\n if p < b.len() && *pow * 2 >= b[p] {\n p += 1;\n }\n }\n p == b.len()\n}\n\nfn run() {\n input! {\n n: usize,\n a: [u64; n],\n }\n let mut beki = vec![];\n let mut k = 0;\n while k < n && a[k] == 1 {\n beki.push(1);\n k += 1;\n }\n if k == 0 {\n println!(\"-1\");\n return;\n }\n let mut pos = 0;\n let mut b = vec![];\n for a in a[k..].iter() {\n if *a == beki[pos] * 2 {\n beki[pos] *= 2;\n pos = (pos + 1) % beki.len();\n } else {\n pos = 0;\n if *a == beki[pos] * 2 {\n beki[pos] *= 2;\n pos = (pos + 1) % beki.len();\n } else {\n b.push(*a);\n }\n }\n }\n let (beki, b) = (beki, b);\n if !valid(&beki, &mut b.clone()) {\n println!(\"-1\");\n return;\n }\n let mut ok = beki.len();\n let mut ng = 0;\n while ok - ng > 1 {\n let mid = (ok + ng) \/ 2;\n let mut b = b.clone();\n for p in beki[mid..].iter() {\n let mut k = 1;\n while k <= *p {\n b.push(k);\n k *= 2;\n }\n }\n if valid(&beki[..mid], &mut b) {\n ok = mid;\n } else {\n ng = mid;\n }\n }\n let mut s = String::new();\n for k in ok..=beki.len() {\n s.push_str(&format!(\"{} \", k));\n }\n s.pop();\n println!(\"{}\", s);\n}\n\nfn main() {\n run();\n}\n","testcases":"[{'input': '8\\r\\n1 1 2 2 3 4 5 8\\r\\n', 'output': ['2']}, {'input': '6\\r\\n1 1 1 2 2 2\\r\\n', 'output': ['2 3']}, {'input': '5\\r\\n1 2 4 4 4\\r\\n', 'output': ['-1']}, {'input': '20\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 8 8 10 10 11\\r\\n', 'output': ['4']}, {'input': '20\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2\\r\\n', 'output': ['9 10 11 12 13 14 15 16 17']}, {'input': '25\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 8 13 15 16 16 31 32 36 41 55\\r\\n', 'output': ['-1']}, {'input': '25\\r\\n1 1 1 1 2 2 2 2 4 4 4 4 8 8 8 9 16 16 32 40 43 53 61 64 128\\r\\n', 'output': ['-1']}, {'input': '45\\r\\n1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 8 8 8 8 8 8 16 16 16 16 16 32 32 32 32 32 41 64 64 64 64 128 128 128 256 256 512\\r\\n', 'output': ['5']}, {'input': '100\\r\\n1 1 1 1 1 1 1 2 2 2 2 2 2 2 4 4 4 4 4 4 4 6 8 8 8 8 8 8 8 10 16 16 16 16 16 16 16 17 22 24 24 30 32 32 32 32 32 32 48 62 64 64 65 65 67 70 74 88 89 98 99 101 101 109 121 127 128 128 137 143 152 153 155 156 160 161 170 183 186 196 196 214 220 226 228 230 238 240 241 245 249 249 250 253 254 256 256 512 1024 1703\\r\\n', 'output': ['-1']}, {'input': '101\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 7 8 8 8 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 32 32 32 32 32 32 32 32 32 32 64 64 64 64 64 64 64 64 64 128 128 128 128 128 128 128 128 239 256 256 256 256 256 373 512 512 512 512 695 1024 1024 1024\\r\\n', 'output': ['11 12']}, {'input': '101\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 4 4 4 4 4 4 5 8 8 8 8 8 8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 16 16 16 16 26 32 32 32 32 32 32 32 32 49 58 64 64 64 64 64 64 122 128 128 128 128 128 128 256 256 256 256 256 491 512 512 512 512 718 1024 1024 1024 2935 3123\\r\\n', 'output': ['-1']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3...', '-1', '3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3...', '7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7...', '3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3...', '5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5...', '3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280', '3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3...', '14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 1...', '37514 37515 37516 37517 37518 37519 37520 37521 37522 37523 37524 37525 37526 37527 37528 37529 37530 37531 37532 37533 37534 37535 37536 37537 37538 37539 37540 37541 37542 37543 37544 37545 37546 37547 37548 37549 37550 37551 37552 37553 37554 37555 37556 37557 37558 37559 37560 37561 37562 37563 37564 37565 37566 37567 37568 37569 37570 37571 37572 37573 37574 37575 37576 37577 37578 37579 37580 37581 37582 37583 37584 37585 37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 37598 3...', '5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5...', '3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3...', '3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3...', '41638 41639 41640 41641 41642 41643 41644 41645 41646 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 41662 41663 41664 41665 41666 41667 41668 41669 41670 41671 41672 41673 41674 41675 41676 41677 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 41700 41701 41702 41703 41704 41705 41706 41707 41708 41709 41710 41711 41712 41713 41714 41715 41716 41717 41718 41719 41720 41721 41722 4...', '9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9...', '7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7...', '7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7...', '2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565', '5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5...', '3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3...', '19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 1...', '3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3...', '19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 1...', '50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 50025 50026 50027 50028 50029 50030 50031 50032 50033 50034 50035 50036 50037 50038 50039 50040 50041 50042 50043 50044 50045 50046 50047 50048 50049 50050 50051 50052 50053 50054 50055 50056 50057 50058 50059 50060 50061 50062 50063 50064 50065 50066 50067 50068 50069 50070 50071 50072 50073 50074 50075 50076 50077 50078 50079 50080 50081 50082 50083 50084 5...', '5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6...', '3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3...', '3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3...']}, {'input': '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 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 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 6 6 6 8 8 8 8 8 8 8 8 11 13 14\\r\\n', 'output': ['27 28 29 30 31 32 33 34 35 36 37 38']}, {'input': '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 1 1 1 1 1 1...', 'output': ['14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 50025 50026 50027 50028 50029 50030 50031 50032 50033 50034 50035 50036 50037 50038 50039 50040 50041 50042 50043 50044 50045 50046 50047 50048 50049 50050 50051 50052 50053 50054 50055 50056 50057 50058 50059 50060 50061 50062 50063 50064 50065 50066 50067 50068 50069 50070 50071 50072 50073 50074 50075 50076 50077 50078 50079 50080 50081 50082 50083 50084 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['41638 41639 41640 41641 41642 41643 41644 41645 41646 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 41662 41663 41664 41665 41666 41667 41668 41669 41670 41671 41672 41673 41674 41675 41676 41677 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 41700 41701 41702 41703 41704 41705 41706 41707 41708 41709 41710 41711 41712 41713 41714 41715 41716 41717 41718 41719 41720 41721 41722 4...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['37514 37515 37516 37517 37518 37519 37520 37521 37522 37523 37524 37525 37526 37527 37528 37529 37530 37531 37532 37533 37534 37535 37536 37537 37538 37539 37540 37541 37542 37543 37544 37545 37546 37547 37548 37549 37550 37551 37552 37553 37554 37555 37556 37557 37558 37559 37560 37561 37562 37563 37564 37565 37566 37567 37568 37569 37570 37571 37572 37573 37574 37575 37576 37577 37578 37579 37580 37581 37582 37583 37584 37585 37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 37598 3...']}, {'input': '99995\\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 1 ...', 'output': ['-1', '10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 1...']}, {'input': '99995\\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 1 ...', 'output': ['10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 1...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280']}, {'input': '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 1 1 1 1 1 1...', 'output': ['2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565']}, {'input': '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 1 1 1 1 1 1...', 'output': ['3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5...']}, {'input': '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 1 1 1 1 1 1...', 'output': ['-1']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5...']}, {'input': '1\\r\\n1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1 2']}, {'input': '1\\r\\n2\\r\\n', 'output': ['-1']}, {'input': '1\\r\\n1000000000000\\r\\n', 'output': ['-1']}, {'input': '2\\r\\n1 1000000000000\\r\\n', 'output': ['-1']}, {'input': '40\\r\\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888\\r\\n', 'output': ['1']}, {'input': '41\\r\\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888 1000000000000\\r\\n', 'output': ['1']}, {'input': '41\\r\\n1 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888\\r\\n', 'output': ['1 2']}, {'input': '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 1 1 1 1 1 1...', 'output': ['5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6...']}, {'input': '99000\\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 1 ...', 'output': ['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 5039 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 5094 5095 5096 5097 5098 5099 5100 5101 5102 5...', '5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5...', '20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 2...']}, {'input': '99000\\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 1 ...', 'output': ['5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5...']}, {'input': '99000\\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 1 ...', 'output': ['20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 2...']}, {'input': '99990\\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 1 ...', 'output': ['20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 2...']}, {'input': '96\\r\\n1 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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8 8 8 8 8 8 8 8 8 8 8 9 12 12 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 18 21\\r\\n', 'output': ['-1']}, {'input': '99979\\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 1 ...', 'output': ['-1']}, {'input': '99976\\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 1 ...', 'output': ['-1']}, {'input': '99981\\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 1 ...', 'output': ['-1']}, {'input': '99982\\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 1 ...', 'output': ['-1']}, {'input': '99998\\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 1 ...', 'output': ['-1']}, {'input': '99997\\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 1 ...', 'output': ['-1']}, {'input': '99974\\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 1 ...', 'output': ['-1']}, {'input': '99994\\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 1 ...', 'output': ['-1']}, {'input': '99984\\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 1 ...', 'output': ['-1']}, {'input': '99977\\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 1 ...', 'output': ['-1']}, {'input': '99975\\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 1 ...', 'output': ['-1']}, {'input': '99989\\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 1 ...', 'output': ['-1']}]","id":573} {"difficulty":1400,"lang":"D","lang_cluster":"D","src_uid":"1009_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio, std.string, std.conv;\r\nimport std.range, std.algorithm, std.array, std.typecons, std.container;\r\nimport std.math, std.numeric, core.bitop;\r\n\r\n\r\nvoid main() {\r\n dchar[] s = readln.chomp.to!(dchar[]);\r\n int n = s.length.to!int;\r\n\r\n int l, r;\r\n\r\n while (l < n) {\r\n while (r < n && s[r] != '0') {\r\n r++;\r\n }\r\n s[l..r].sort();\r\n r++;\r\n l = r;\r\n }\r\n\r\n debug {\r\n writeln(s);\r\n }\r\n\r\n l = r = 0;\r\n\r\n while (l < n) {\r\n while (r < n && s[r] != '2') {\r\n r++;\r\n }\r\n s[l..r].sort();\r\n r++;\r\n l = r;\r\n }\r\n\r\n writeln(s);\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\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\r\nvoid scan(T...)(ref T args) {\r\n import std.stdio : readln;\r\n import std.algorithm : splitter;\r\n import std.conv : to;\r\n import std.range.primitives;\r\n\r\n auto line = readln().splitter();\r\n foreach (ref arg; args) {\r\n arg = line.front.to!(typeof(arg));\r\n line.popFront();\r\n }\r\n assert(line.empty);\r\n}\r\n\r\n\r\n\r\nvoid fillAll(R, T)(ref R arr, T value) {\r\n static if (is(typeof(arr[] = value))) {\r\n arr[] = value;\r\n }\r\n else {\r\n foreach (ref e; arr) {\r\n fillAll(e, value);\r\n }\r\n }\r\n}\r\n","description":"You are given a ternary string (it is a string which consists only of characters '0', '1' and '2').You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace \"01\" with \"10\" or vice versa) or any two adjacent (consecutive) characters '1' and '2' (i.e. replace \"12\" with \"21\" or vice versa).For example, for string \"010210\" we can perform the following moves: \"010210\" $$$\\rightarrow$$$ \"100210\"; \"010210\" $$$\\rightarrow$$$ \"001210\"; \"010210\" $$$\\rightarrow$$$ \"010120\"; \"010210\" $$$\\rightarrow$$$ \"010201\". Note than you cannot swap \"02\" $$$\\rightarrow$$$ \"20\" and vice versa. You cannot perform any other operations with the given string excluding described above.You task is to obtain the minimum possible (lexicographically) string by using these swaps arbitrary number of times (possibly, zero).String $$$a$$$ is lexicographically less than string $$$b$$$ (if strings $$$a$$$ and $$$b$$$ have the same length) if there exists some position $$$i$$$ ($$$1 \\le i \\le |a|$$$, where $$$|s|$$$ is the length of the string $$$s$$$) such that for every $$$j < i$$$ holds $$$a_j = b_j$$$, and $$$a_i < b_i$$$.","input_specification":"The first line of the input contains the string $$$s$$$ consisting only of characters '0', '1' and '2', its length is between $$$1$$$ and $$$10^5$$$ (inclusive).\n","output_specification":"Print a single string \u2014 the minimum possible (lexicographically) string you can obtain by using the swaps described above arbitrary number of times (possibly, zero).\n","notes":null,"sample_inputs":["100210\n","11222121\n","20\n"],"sample_outputs":["001120\n","11112222\n","20\n"],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop, std.bitmanip;\n\nvoid main() {\n auto S = readln.chomp;\n auto N = S.length.to!int;\n string A = \"\";\n string B = \"\";\n\n foreach (i; 0..N) {\n if (S[i] == '1') A ~= S[i];\n else B ~= S[i];\n }\n\n if (B.empty) {\n A.writeln;\n return;\n }\n\n int x = B.length.to!int;\n foreach (i; 0..B.length.to!int) {\n if (B[i] == '2') {\n x = i;\n break;\n }\n }\n\n writeln(B[0..x] ~ A ~ B[x..$]);\n}\n","testcases":"[{'input': ['100210\\r\\n'], 'output': ['001120\\r\\n']}, {'input': ['11222121\\r\\n'], 'output': ['11112222\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['1002\\r\\n'], 'output': ['0012\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['01\\r\\n']}, {'input': ['000021\\r\\n'], 'output': ['000012\\r\\n']}, {'input': ['021\\r\\n'], 'output': ['012\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['201\\r\\n'], 'output': ['120\\r\\n']}, {'input': ['2112120\\r\\n'], 'output': ['1112220\\r\\n']}, {'input': ['102\\r\\n'], 'output': ['012\\r\\n']}, {'input': ['202\\r\\n'], 'output': ['202\\r\\n']}, {'input': ['220201\\r\\n'], 'output': ['122020\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['100022202\\r\\n'], 'output': ['000122202\\r\\n']}, {'input': ['01\\r\\n'], 'output': ['01\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['1\\r\\n']}]","id":574} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"110_A","execute_outcome":"WRONG_ANSWER","source_code":"import std;\r\n\r\nvoid main() {\r\n long n;\r\n readf(\"%d\\n\", n);\r\n\r\n bool isNearlyLucky = !(n == 4 || n == 7);\r\n while (n > 0) {\r\n long d = n % 10;\r\n isNearlyLucky &= (d == 4 || d == 7);\r\n\r\n n \/= 10;\r\n }\r\n\r\n writeln(isNearlyLucky ? \"YES\" : \"NO\");\r\n}","description":"Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky digits in it is a lucky number. He wonders whether number n is a nearly lucky number.","input_specification":"The only line contains an integer n (1\u2264n\u226410^18).\nPlease do not use the %lld specificator to read or write 64-bit numbers in \u0421++. It is preferred to use the cin, cout streams or the %I64d specificator.\n","output_specification":"Print on the single line \"YES\" if n is a nearly lucky number. Otherwise, print \"NO\" (without the quotes).\n","notes":"In the first sample there are 3 lucky digits (first one and last two), so the answer is \"NO\".\nIn the second sample there are 7 lucky digits, 7 is lucky number, so the answer is \"YES\".\nIn the third sample there are no lucky digits, so the answer is \"NO\".\n","sample_inputs":["40047\n","7747774\n","1000000000000000000\n"],"sample_outputs":["NO\n","YES\n","NO\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n string n;\r\n readf(\"%s\\n\", n);\r\n\r\n ulong cnt = n.count('4') + n.count('7');\r\n\r\n bool isNearlyLucky = (cnt > 0);\r\n while (cnt > 0) {\r\n ulong d = cnt % 10;\r\n isNearlyLucky &= (d == 4 || d == 7);\r\n\r\n cnt \/= 10;\r\n }\r\n\r\n writeln(isNearlyLucky ? \"YES\" : \"NO\");\r\n}","testcases":"[{'input': ['40047\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7747774\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['474404774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4744000695826\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10000000004744744\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['446486416781684178\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999999999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['87414417444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['111222333444555667\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4700\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3794555488744477\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['444444444444444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['474447447774444774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['777777777777777\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['34777745021000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['963\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['855474448854788540\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999999999999994744\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['400000000474\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['123456789123456789\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['740577777584945874\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7777777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4444000111222333\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['9847745885202111\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['123456000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4744447444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4747477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['777777777444444444\\r\\n'], 'output': ['NO\\r\\n']}]","id":575} {"difficulty":1300,"lang":"D","lang_cluster":"D","src_uid":"1113_B","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop, std.bitmanip;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nimmutable long INF = 10L ^^ 18 + 23;\r\n\r\nimmutable int A = 100;\r\n\r\nvoid main()\r\n{ \r\n int n;\r\n readf(\"%s\", &n);\r\n readln;\r\n \r\n auto a = readln.chomp.split.map!(to!int).array;\r\n \r\n auto sm = a.sum();\r\n \r\n if (n == 1) {\r\n sm.writeln;\r\n return;\r\n }\r\n \r\n int mxgain = 0;\r\n for (int i = 2; i < A; ++i) {\r\n int curbig = -1;\r\n for (int j = 0; j < n; ++j) {\r\n if (a[j] % i != 0) continue;\r\n \r\n if (curbig == -1 || a[j] > a[curbig]) curbig = j;\r\n }\r\n \r\n if (curbig == -1) continue;\r\n \r\n int cursm = -1;\r\n for (int j = 0; j < n; ++j) {\r\n if (j == curbig) continue;\r\n \r\n if (cursm == -1 || a[j] < cursm) cursm = j;\r\n }\r\n \r\n int curgain = (a[curbig] + a[cursm]) - (a[curbig] \/ i + a[cursm] * i);\r\n mxgain = max(mxgain, curgain);\r\n }\r\n \r\n int ans = sm - mxgain;\r\n ans.writeln;\r\n}","description":"One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by $$$n$$$ machines, and the power of the $$$i$$$-th machine is $$$a_i$$$. This year 2D decided to cultivate a new culture, but what exactly he didn't say. For the successful growth of the new culture, it is necessary to slightly change the powers of the machines. 2D can at most once choose an arbitrary integer $$$x$$$, then choose one machine and reduce the power of its machine by $$$x$$$ times, and at the same time increase the power of one another machine by $$$x$$$ times (powers of all the machines must stay positive integers). Note that he may not do that if he wants. More formally, 2D can choose two such indices $$$i$$$ and $$$j$$$, and one integer $$$x$$$ such that $$$x$$$ is a divisor of $$$a_i$$$, and change powers as following: $$$a_i = \\frac{a_i}{x}$$$, $$$a_j = a_j \\cdot x$$$Sasha is very curious, that's why he wants to calculate the minimum total power the farmer can reach. There are too many machines, and Sasha can't cope with computations, help him!","input_specification":"The first line contains one integer $$$n$$$ ($$$2 \\\\le n \\\\le 5 \\\\cdot 10^4$$$)\u00a0\u2014 the number of machines.\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\\\ldots, a_n$$$ ($$$1 \\\\le a_i \\\\le 100$$$)\u00a0\u2014 the powers of the machines.\n","output_specification":"Print one integer\u00a0\u2014 minimum total power.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import core.bitop, std.bitmanip;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nimmutable long INF = 10L ^^ 18 + 23;\r\n\r\nimmutable int A = 100;\r\n\r\nvoid main()\r\n{ \r\n int n;\r\n readf(\"%s\", &n);\r\n readln;\r\n \r\n auto a = readln.chomp.split.map!(to!int).array;\r\n \r\n auto sm = a.sum();\r\n \r\n if (n == 1) {\r\n sm.writeln;\r\n return;\r\n }\r\n \r\n int mxgain = 0;\r\n for (int i = 2; i < A; ++i) {\r\n int curbig = -1;\r\n for (int j = 0; j < n; ++j) {\r\n if (a[j] % i != 0) continue;\r\n \r\n if (curbig == -1 || a[j] > a[curbig]) curbig = j;\r\n }\r\n \r\n if (curbig == -1) continue;\r\n \r\n int cursm = -1;\r\n for (int j = 0; j < n; ++j) {\r\n if (j == curbig) continue;\r\n \r\n if (cursm == -1 || a[j] < a[cursm]) cursm = j;\r\n }\r\n \r\n int curgain = (a[curbig] + a[cursm]) - (a[curbig] \/ i + a[cursm] * i);\r\n mxgain = max(mxgain, curgain);\r\n }\r\n \r\n int ans = sm - mxgain;\r\n ans.writeln;\r\n}","testcases":"[{'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['4\\r\\n4 2 4 4\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['5\\r\\n2 4 2 3 7\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['2\\r\\n94 70\\r\\n'], 'output': ['164\\r\\n']}, {'input': ['12\\r\\n95 98 98 92 94 97 100 83 93 97 87 72\\r\\n'], 'output': ['1106\\r\\n']}, {'input': ['166\\r\\n61 19 19 67 11 11 73 89 73 11 47 2 59 43 61 31 19 83 71 19 29 97 89 97 2 11 5 73 19 2 19 7 41 53 5 23 11 89 2 23 47 47 83 71 17 71 67 67 43 3 29 97 17 83 11 19 67 17 97 7 19 29 29 41 13 71 29 19 19 43 47 17 71 3 13 71 41 19 47 7 29 43 29 97 31 11 43 17 23 83 37 61 79 31 17 5 59 13 67 29 29 11 43 67 89 83 59 3 67 31 2 41 53 29 79 61 31 71 41 3 61 71 19 53 29 7 53 11 31 73 31 83 2 79 47 5 89 83 29 67 89 97 73 11 41 31 47 37 31 41 31 13 37 79 23 47 37 79 37 7 7 71 23 83 19 31\\r\\n'], 'output': ['6916\\r\\n']}, {'input': ['184\\r\\n81 32 32 64 17 64 17 32 16 2 32 9 9 17 17 49 8 2 16 9 2 4 27 27 17 8 17 2 32 17 8 2 32 8 17 9 29 8 17 8 16 2 9 8 8 32 13 9 64 8 27 2 32 27 16 8 8 9 32 2 81 16 16 2 4 81 64 49 17 2 2 17 32 9 2 17 17 8 16 64 13 8 64 2 3 9 64 32 17 49 31 13 2 8 27 16 16 32 32 2 49 16 81 32 27 9 17 32 27 32 17 4 4 17 32 9 32 8 2 4 27 16 4 7 32 29 9 8 8 27 32 31 32 3 2 8 17 64 2 5 8 2 17 81 27 9 64 3 9 2 49 49 25 4 16 32 17 64 16 3 8 8 32 2 9 2 32 27 27 9 4 32 2 8 64 13 64 29 8 64 13 2 27 2\\r\\n'], 'output': ['3847\\r\\n']}, {'input': ['2\\r\\n42 9\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['3\\r\\n25 1 26\\r\\n'], 'output': ['36\\r\\n']}, {'input': ['5\\r\\n20 30 40 50 60\\r\\n'], 'output': ['190\\r\\n']}, {'input': ['3\\r\\n1 36 38\\r\\n'], 'output': ['50\\r\\n']}]","id":576} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"112_A","execute_outcome":"WRONG_ANSWER","source_code":"module main;\r\nimport std.stdio, std.uni, std.algorithm;\r\n\r\nvoid main()\r\n{\r\n char[] a, b;\r\n readf!\" %s\\n %s\"(a, b);\r\n writeln(clamp(sicmp(a, b), -1, 1));\r\n}","description":"Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case does not matter, that is an uppercase letter is considered equivalent to the corresponding lowercase letter. Help Petya perform the comparison.","input_specification":"Each of the first two lines contains a bought string. The strings' lengths range from 1 to 100 inclusive. It is guaranteed that the strings are of the same length and also consist of uppercase and lowercase Latin letters.\n","output_specification":"If the first string is less than the second one, print \"-1\". If the second string is less than the first one, print \"1\". If the strings are equal, print \"0\". Note that the letters' case is not taken into consideration when the strings are compared.\n","notes":"If you want more formal information about the lexicographical order (also known as the \"dictionary order\" or \"alphabetical order\"), you can visit the following site:\n http:\/\/en.wikipedia.org\/wiki\/Lexicographical_order","sample_inputs":["aaaa\naaaA\n","abs\nAbz\n","abcdefg\nAbCdEfF\n"],"sample_outputs":["0\n","-1\n","1\n"],"human_solution":"import std.stdio;\r\nimport std.string;\r\nimport std.uni;\r\n\r\nvoid main() {\r\n auto str_1 = strip(readln).toLower;\r\n auto str_2 = strip(readln).toLower;\r\n if (str_1 == str_2)\r\n writeln(0);\r\n else if (str_1 > str_2)\r\n writeln(1);\r\n else\r\n writeln(-1);\r\n}","testcases":"[{'input': ['aaaa\\r\\naaaA\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abs\\r\\nAbz\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['abcdefg\\r\\nAbCdEfF\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['asadasdasd\\r\\nasdwasdawd\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['aslkjlkasdd\\r\\nasdlkjdajwi\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aAaaaAAaAaaAzZsssSsdDfeEaeqZlpP\\r\\nAaaaAaaAaaAaZzSSSSsDdFeeAeQZLpp\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['bwuEhEveouaTECagLZiqmUdxEmhRSOzMauJRWLQMppZOumxhAmwuGeDIkvkBLvMXwUoFmpAfDprBcFtEwOULcZWRQhcTbTbX\\r\\nHhoDWbcxwiMnCNexOsKsujLiSGcLllXOkRSbnOzThAjnnliLYFFmsYkOfpTxRNEfBsoUHfoLTiqAINRPxWRqrTJhgfkKcDOH\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['kGWUuguKzcvxqKTNpxeDWXpXkrXDvGMFGoXKDfPBZvWSDUyIYBynbKOUonHvmZaKeirUhfmVRKtGhAdBfKMWXDUoqvbfpfHYcg\\r\\ncvOULleuIIiYVVxcLZmHVpNGXuEpzcWZZWyMOwIwbpkKPwCfkVbKkUuosvxYCKjqfVmHfJKbdrsAcatPYgrCABaFcoBuOmMfFt\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['nCeNVIzHqPceNhjHeHvJvgBsNFiXBATRrjSTXJzhLMDMxiJztphxBRlDlqwDFImWeEPkggZCXSRwelOdpNrYnTepiOqpvkr\\r\\nHJbjJFtlvNxIbkKlxQUwmZHJFVNMwPAPDRslIoXISBYHHfymyIaQHLgECPxAmqnOCizwXnIUBRmpYUBVPenoUKhCobKdOjL\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['ttXjenUAlfixytHEOrPkgXmkKTSGYuyVXGIHYmWWYGlBYpHkujueqBSgjLguSgiMGJWATIGEUjjAjKXdMiVbHozZUmqQtFrT\\r\\nJziDBFBDmDJCcGqFsQwDFBYdOidLxxhBCtScznnDgnsiStlWFnEXQrJxqTXKPxZyIGfLIToETKWZBPUIBmLeImrlSBWCkTNo\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['AjQhPqSVhwQQjcgCycjKorWBgFCRuQBwgdVuAPSMJAvTyxGVuFHjfJzkKfsmfhFbKqFrFIohSZBbpjgEHebezmVlGLTPSCTMf\\r\\nXhxWuSnMmKFrCUOwkTUmvKAfbTbHWzzOTzxJatLLCdlGnHVaBUnxDlsqpvjLHMThOPAFBggVKDyKBrZAmjnjrhHlrnSkyzBja\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['HCIgYtnqcMyjVngziNflxKHtdTmcRJhzMAjFAsNdWXFJYEhiTzsQUtFNkAbdrFBRmvLirkuirqTDvIpEfyiIqkrwsjvpPWTEdI\\r\\nErqiiWKsmIjyZuzgTlTqxYZwlrpvRyaVhRTOYUqtPMVGGtWOkDCOOQRKrkkRzPftyQCkYkzKkzTPqqXmeZhvvEEiEhkdOmoMvy\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['mtBeJYILXcECGyEVSyzLFdQJbiVnnfkbsYYsdUJSIRmyzLfTTtFwIBmRLVnwcewIqcuydkcLpflHAFyDaToLiFMgeHvQorTVbI\\r\\nClLvyejznjbRfCDcrCzkLvqQaGzTjwmWONBdCctJAPJBcQrcYvHaSLQgPIJbmkFBhFzuQLBiRzAdNHulCjIAkBvZxxlkdzUWLR\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['tjucSbGESVmVridTBjTmpVBCwwdWKBPeBvmgdxgIVLwQxveETnSdxkTVJpXoperWSgdpPMKNmwDiGeHfxnuqaDissgXPlMuNZIr\\r\\nHfjOOJhomqNIKHvqSgfySjlsWJQBuWYwhLQhlZYlpZwboMpoLoluGsBmhhlYgeIouwdkPfiaAIrkYRlxtiFazOPOllPsNZHcIZd\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['AanbDfbZNlUodtBQlvPMyomStKNhgvSGhSbTdabxGFGGXCdpsJDimsAykKjfBDPMulkhBMsqLmVKLDoesHZsRAEEdEzqigueXInY\\r\\ncwfyjoppiJNrjrOLNZkqcGimrpTsiyFBVgMWEPXsMrxLJDDbtYzerXiFGuLBcQYitLdqhGHBpdjRnkUegmnwhGHAKXGyFtscWDSI\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['HRfxniwuJCaHOcaOVgjOGHXKrwxrDQxJpppeGDXnTAowyKbCsCQPbchCKeTWOcKbySSYnoaTJDnmRcyGPbfXJyZoPcARHBu\\r\\nxkLXvwkvGIWSQaFTznLOctUXNuzzBBOlqvzmVfTSejekTAlwidRrsxkbZTsGGeEWxCXHzqWVuLGoCyrGjKkQoHqduXwYQKC\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['OjYwwNuPESIazoyLFREpObIaMKhCaKAMWMfRGgucEuyNYRantwdwQkmflzfqbcFRaXBnZoIUGsFqXZHGKwlaBUXABBcQEWWPvkjW\\r\\nRxLqGcTTpBwHrHltCOllnTpRKLDofBUqqHxnOtVWPgvGaeHIevgUSOeeDOJubfqonFpVNGVbHFcAhjnyFvrrqnRgKhkYqQZmRfUl\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['tatuhQPIzjptlzzJpCAPXSRTKZRlwgfoCIsFjJquRoIDyZZYRSPdFUTjjUPhLBBfeEIfLQpygKXRcyQFiQsEtRtLnZErBqW\\r\\ntkHUjllbafLUWhVCnvblKjgYIEoHhsjVmrDBmAWbvtkHxDbRFvsXAjHIrujaDbYwOZmacknhZPeCcorbRgHjjgAgoJdjvLo\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['cymCPGqdXKUdADEWDdUaLEEMHiXHsdAZuDnJDMUvxvrLRBrPSDpXPAgMRoGplLtniFRTomDTAHXWAdgUveTxaqKVSvnOyhOwiRN\\r\\nuhmyEWzapiRNPFDisvHTbenXMfeZaHqOFlKjrfQjUBwdFktNpeiRoDWuBftZLcCZZAVfioOihZVNqiNCNDIsUdIhvbcaxpTRWoV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['sSvpcITJAwghVfJaLKBmyjOkhltTGjYJVLWCYMFUomiJaKQYhXTajvZVHIMHbyckYROGQZzjWyWCcnmDmrkvTKfHSSzCIhsXgEZa\\r\\nvhCXkCwAmErGVBPBAnkSYEYvseFKbWSktoqaHYXUmYkHfOkRwuEyBRoGoBrOXBKVxXycjZGStuvDarnXMbZLWrbjrisDoJBdSvWJ\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['hJDANKUNBisOOINDsTixJmYgHNogtpwswwcvVMptfGwIjvqgwTYFcqTdyAqaqlnhOCMtsnWXQqtjFwQlEcBtMFAtSqnqthVb\\r\\nrNquIcjNWESjpPVWmzUJFrelpUZeGDmSvCurCqVmKHKVAAPkaHksniOlzjiKYIJtvbuQWZRufMebpTFPqyxIWWjfPaWYiNlK\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['ycLoapxsfsDTHMSfAAPIUpiEhQKUIXUcXEiopMBuuZLHtfPpLmCHwNMNQUwsEXxCEmKHTBSnKhtQhGWUvppUFZUgSpbeChX\\r\\ndCZhgVXofkGousCzObxZSJwXcHIaqUDSCPKzXntcVmPxtNcXmVcjsetZYxedmgQzXTZHMvzjoaXCMKsncGciSDqQWIIRlys\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['nvUbnrywIePXcoukIhwTfUVcHUEgXcsMyNQhmMlTltZiCooyZiIKRIGVHMCnTKgzXXIuvoNDEZswKoACOBGSyVNqTNQqMhAG\\r\\nplxuGSsyyJjdvpddrSebOARSAYcZKEaKjqbCwvjhNykuaECoQVHTVFMKXwvrQXRaqXsHsBaGVhCxGRxNyGUbMlxOarMZNXxy\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['EncmXtAblQzcVRzMQqdDqXfAhXbtJKQwZVWyHoWUckohnZqfoCmNJDzexFgFJYrwNHGgzCJTzQQFnxGlhmvQTpicTkEeVICKac\\r\\nNIUNZoMLFMyAjVgQLITELJSodIXcGSDWfhFypRoGYuogJpnqGTotWxVqpvBHjFOWcDRDtARsaHarHaOkeNWEHGTaGOFCOFEwvK\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['UG\\r\\nak\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['JZR\\r\\nVae\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['a\\r\\nZ\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['rk\\r\\nkv\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['RvuT\\r\\nbJzE\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['PPS\\r\\nydq\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['q\\r\\nq\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['peOw\\r\\nIgSJ\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['PyK\\r\\noKN\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['O\\r\\ni\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['NmGY\\r\\npDlP\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['nG\\r\\nZf\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['m\\r\\na\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['MWyB\\r\\nWZEV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['Gre\\r\\nfxc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['Ooq\\r\\nwap\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['XId\\r\\nlbB\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['lfFpECEqUMEOJhipvkZjDPcpDNJedOVXiSMgBvBZbtfzIKekcvpWPCazKAhJyHircRtgcBIJwwstpHaLAgxFOngAWUZRgCef\\r\\nLfFPEcequmeojHIpVkzjDPcpdNJEDOVXiSmGBVBZBtfZikEKcvPwpCAzKAHJyHIrCRTgCbIJWwSTphALagXfOnGAwUzRGcEF\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['DQBdtSEDtFGiNRUeJNbOIfDZnsryUlzJHGTXGFXnwsVyxNtLgmklmFvRCzYETBVdmkpJJIvIOkMDgCFHZOTODiYrkwXd\\r\\nDQbDtsEdTFginRUEJNBOIfdZnsryulZJHGtxGFxnwSvYxnTLgmKlmFVRCzyEtBVdmKpJjiVioKMDgCFhzoTODiYrKwXD\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['tYWRijFQSzHBpCjUzqBtNvBKyzZRnIdWEuyqnORBQTLyOQglIGfYJIRjuxnbLvkqZakNqPiGDvgpWYkfxYNXsdoKXZtRkSasfa\\r\\nTYwRiJfqsZHBPcJuZQBTnVbkyZZRnidwEuYQnorbQTLYOqGligFyjirJUxnblVKqZaknQpigDVGPwyKfxyNXSDoKxztRKSaSFA\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['KhScXYiErQIUtmVhNTCXSLAviefIeHIIdiGhsYnPkSBaDTvMkyanfMLBOvDWgRybLtDqvXVdVjccNunDyijhhZEAKBrdz\\r\\nkHsCXyiErqIuTMVHNTCxSLaViEFIEhIIDiGHsYNpKsBAdTvMKyANFMLBovdwGRYbLtdQVxvDVJCcNUndYiJHhzeakBrdZ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['cpPQMpjRQJKQVXjWDYECXbagSmNcVfOuBWNZxihdERraVuiOpSVDCPgTGuSQALNoVjySceHcKXwOEpSzXrEqWwwrYeppNiWhDVg\\r\\nCPPqmPjRqJkQvxJwdyECXBAGsMNcVfOuBWNzxIhderRavUiOpSvDCpGTgusqAlNovjyScEhCKXwoePSZxrEQwWwryEPPniWHDvG\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['SajcCGMepaLjZIWLRBGFcrZRCRvvoCsIyKsQerbrwsIamxxpRmQSZSalasJLVFbCHCuXJlubciQAvLxXYBazLsMKLHLdDQ\\r\\nsaJcCgmEpaLJziWlrBgFcRzrCrVVOcSIykSQerBrwSIamxxPrMqSzSalASjLVFbChCUxjLUbCIQAVlxxybAZLsmkLhLDdQ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['kigPrWNTOUNDBskAfefjhHYZNYdnfZWuXWzHiBxFQryBbAkPtenFwWvCSTYGpzOntUNzNUhxRWjKmicTwLwJAnbAxj\\r\\nkigpRWntOUNdBsKaFEFjhhYZnYDNfzWuXwZhibxFQRybbakPteNfwwvcStyGPzoNTunznuHXrWjKMIctWLWJANBAxJ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['nTomZZuTTRTAAPoUsySVFGElrpQRNLjqvFmcYytiheQnjUhPLnqNBiYtQkljbcvmjuNAVKbvQOWpqqFlQhAhULIhquoCnjUI\\r\\nntOmzZuttrtAAPOUSySVFgeLRPQrNLjQvfmCyYTiHEQnjuHPlNQNbIYtqKLJBCVmjunavkbvQOWPQQFlqHaHULIHQuOcnJUi\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abac\\r\\nadaa\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['Bbc\\r\\nabc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['aaaba\\r\\naaaab\\r\\n'], 'output': ['1\\r\\n']}]","id":577} {"difficulty":1000,"lang":"D","lang_cluster":"D","src_uid":"114_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio, std.string, std.algorithm;\r\nimport std.conv, std.array;\r\n\r\nuint f(uint k, uint l) {\r\n uint c = 0;\r\n while (l % k == 0) {\r\n l \/= k;\r\n c++;\r\n }\r\n if (l == 1) { return c; }\r\n else { return 0; }\r\n}\r\n\r\nvoid main() {\r\n uint k, l; readf(\"%d\\n%d\", &k, &l);\r\n uint c = k.f(l);\r\n if (c == 0) { \r\n writeln(\"NO\");\r\n } else {\r\n writeln(\"YES\");\r\n writeln(c \/ 2);\r\n }\r\n}\r\n","description":"When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word \"tma\" (which now means \"too much to be counted\") used to stand for a thousand and \"tma tmyschaya\" (which literally means \"the tma of tmas\") used to stand for a million.Petya wanted to modernize the words we use for numbers and invented a word petricium that represents number k. Moreover, petricium la petricium stands for number k^2, petricium la petricium la petricium stands for k^3 and so on. All numbers of this form are called petriciumus cifera, and the number's importance is the number of articles la in its title.Petya's invention brought on a challenge that needed to be solved quickly: does some number l belong to the set petriciumus cifera? As Petya is a very busy schoolboy he needs to automate the process, he asked you to solve it.","input_specification":"The first input line contains integer number k, the second line contains integer number l (2\u2264k,l\u22642^31-1).\n","output_specification":"You should print in the first line of the output \"YES\", if the number belongs to the set petriciumus cifera and otherwise print \"NO\". If the number belongs to the set, then print on the seconds line the only number \u2014 the importance of number l.\n","notes":null,"sample_inputs":["5\n25\n","3\n8\n"],"sample_outputs":["YES\n1\n","NO\n"],"human_solution":"import std.stdio, std.string, std.algorithm;\r\nimport std.conv, std.array;\r\n\r\nuint f(uint k, uint l) {\r\n uint c = 0;\r\n while (l % k == 0) {\r\n l \/= k;\r\n c++;\r\n }\r\n if (l == 1) { return c; }\r\n else { return 0; }\r\n}\r\n\r\nvoid main() {\r\n uint k, l; readf(\"%d\\n%d\", &k, &l);\r\n uint c = k.f(l);\r\n if (c == 0) { \r\n writeln(\"NO\");\r\n } else {\r\n writeln(\"YES\");\r\n writeln(c - 1);\r\n }\r\n}\r\n","testcases":"[{'input': ['5\\r\\n25\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['3\\r\\n8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['123\\r\\n123\\r\\n'], 'output': ['YES\\n0\\r\\n']}, {'input': ['99\\r\\n970300\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1000\\r\\n6666666\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['59\\r\\n3571\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['256\\r\\n16777217\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4638\\r\\n21511044\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['24\\r\\n191102976\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['52010\\r\\n557556453\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['61703211\\r\\n1750753082\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['137\\r\\n2571353\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['8758\\r\\n1746157336\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n64\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['96\\r\\n884736\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['1094841453\\r\\n1656354409\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1154413\\r\\n1229512809\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2442144\\r\\n505226241\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['11548057\\r\\n1033418098\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['581\\r\\n196122941\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['146\\r\\n1913781536\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['945916\\r\\n1403881488\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['68269\\r\\n365689065\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['30\\r\\n900\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['6\\r\\n1296\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['1470193122\\r\\n1420950405\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['90750\\r\\n1793111557\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1950054\\r\\n1664545956\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6767692\\r\\n123762320\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1437134\\r\\n1622348229\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['444103\\r\\n1806462642\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2592\\r\\n6718464\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['50141\\r\\n366636234\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['835\\r\\n582182875\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['156604\\r\\n902492689\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['27385965\\r\\n1742270058\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n9\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['35\\r\\n1838265625\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['8\\r\\n4096\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['85955\\r\\n945811082\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['54958832\\r\\n956670209\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1475381\\r\\n1348159738\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7313241\\r\\n413670642\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['582470\\r\\n2116368165\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['26859739\\r\\n595086170\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['249766393\\r\\n1582130\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['11734\\r\\n137686756\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['925093\\r\\n1098566745\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['40\\r\\n1600\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['2147483647\\r\\n2147483647\\r\\n'], 'output': ['YES\\n0\\r\\n']}, {'input': ['2147483646\\r\\n2147483647\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2147483647\\r\\n2147483646\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2147483647\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n1073741825\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n1073741824\\r\\n'], 'output': ['YES\\n29\\r\\n']}, {'input': ['10000\\r\\n10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n10000\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['10\\r\\n2000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n1000000000\\r\\n'], 'output': ['YES\\n8\\r\\n']}, {'input': ['5\\r\\n1808548329\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2147483646\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['25\\r\\n125\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n18\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5\\r\\n30\\r\\n'], 'output': ['NO\\r\\n']}]","id":578} {"difficulty":1100,"lang":"D","lang_cluster":"D","src_uid":"116_B","execute_outcome":"WRONG_ANSWER","source_code":"module cf_116B;\r\n\r\nimport std.stdio, std.algorithm;\r\n\r\nstruct PigPosition {\r\n int x, y;\r\n int wolfs;\r\n}\r\n\r\nvoid main() {\r\n immutable int[] DX = [-1, 1, 0, 0],\r\n DY = [0, 0, -1, 1];\r\n immutable int MAX_SIZE = 10;\r\n\r\n int n, m;\r\n char[MAX_SIZE][MAX_SIZE] field;\r\n PigPosition[] wolfsForPig;\r\n\r\n readf(\"%d %d\\n\", &n, &m);\r\n for (int i = 0; i < n; ++i) {\r\n for (int j = 0; j < m; ++j) {\r\n readf(\"%c\", &field[i][j]);\r\n writefln(\"<%c>\", field[i][j]);\r\n if (field[i][j] == 'P') {\r\n wolfsForPig ~= PigPosition(i, j, 0);\r\n for (int k = 0; k < DX.length; ++k) {\r\n int dx = i + DX[k];\r\n int dy = j + DY[k];\r\n\r\n if (dx >= 0 && dx < n && dy >= 0 && dy < m && field[dx][dy] == 'W') {\r\n ++wolfsForPig[$ - 1].wolfs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n char temporary; \/\/ skip new line character\r\n readf(\"%c\", &temporary);\r\n }\r\n\r\n sort!((a, b) { return a.wolfs < b.wolfs; })(wolfsForPig);\r\n\r\n int eatenPigs = 0;\r\n for (int i = 0; i < wolfsForPig.length; ++i) {\r\n for (int j = 0; j < DX.length; ++j) {\r\n int dx = wolfsForPig[i].x + DX[j];\r\n int dy = wolfsForPig[i].y + DY[j];\r\n\r\n if (dx >= 0 && dx < n && dy >= 0 && dy < m && field[dx][dy] == 'W') {\r\n field[dx][dy] = '.';\r\n\r\n ++eatenPigs;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n writeln(eatenPigs);\r\n}","description":"Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size n\u00d7m. Each cell in this grid was either empty, containing one little pig, or containing one wolf.A little pig and a wolf are adjacent if the cells that they are located at share a side. The little pigs are afraid of wolves, so there will be at most one wolf adjacent to each little pig. But each wolf may be adjacent to any number of little pigs.They have been living peacefully for several years. But today the wolves got hungry. One by one, each wolf will choose one of the little pigs adjacent to it (if any), and eats the poor little pig. This process is not repeated. That is, each wolf will get to eat at most one little pig. Once a little pig gets eaten, it disappears and cannot be eaten by any other wolf.What is the maximum number of little pigs that may be eaten by the wolves?","input_specification":"The first line contains integers n and m (1\u2264n,m\u226410) which denotes the number of rows and columns in our two-dimensional grid, respectively. Then follow n lines containing m characters each \u2014 that is the grid description. \".\" means that this cell is empty. \"P\" means that this cell contains a little pig. \"W\" means that this cell contains a wolf. \nIt is guaranteed that there will be at most one wolf adjacent to any little pig.\n","output_specification":"Print a single number \u2014 the maximal number of little pigs that may be eaten by the wolves.\n","notes":"In the first example, one possible scenario in which two little pigs get eaten by the wolves is as follows. \n \n","sample_inputs":["2 3\nPPW\nW.P\n","3 3\nP.W\n.P.\nW.P\n"],"sample_outputs":["2\n","0\n"],"human_solution":"module cf_116B;\r\n\r\nimport std.stdio, std.algorithm;\r\n\r\nstruct PigPosition {\r\n int x, y;\r\n int wolfs;\r\n}\r\n\r\nvoid main() {\r\n immutable int[] DX = [-1, 1, 0, 0],\r\n DY = [0, 0, -1, 1];\r\n immutable int MAX_SIZE = 10;\r\n\r\n int n, m;\r\n char[MAX_SIZE][MAX_SIZE] field;\r\n PigPosition[] wolfsForPig;\r\n\r\n readf(\"%d %d\\n\", &n, &m);\r\n for (int i = 0; i < n; ++i) {\r\n for (int j = 0; j < m; ++j) {\r\n readf(\"%c\", &field[i][j]);\r\n if (field[i][j] == 'P') {\r\n wolfsForPig ~= PigPosition(i, j, 0);\r\n for (int k = 0; k < DX.length; ++k) {\r\n int dx = i + DX[k];\r\n int dy = j + DY[k];\r\n\r\n if (dx >= 0 && dx < n && dy >= 0 && dy < m && field[dx][dy] == 'W') {\r\n ++wolfsForPig[$ - 1].wolfs;\r\n }\r\n }\r\n }\r\n }\r\n\r\n char temporary; \/\/ skip new line character\r\n readf(\"%c\", &temporary);\r\n }\r\n\r\n sort!((a, b) { return a.wolfs < b.wolfs; })(wolfsForPig);\r\n\r\n int eatenPigs = 0;\r\n for (int i = 0; i < wolfsForPig.length; ++i) {\r\n for (int j = 0; j < DX.length; ++j) {\r\n int dx = wolfsForPig[i].x + DX[j];\r\n int dy = wolfsForPig[i].y + DY[j];\r\n\r\n if (dx >= 0 && dx < n && dy >= 0 && dy < m && field[dx][dy] == 'W') {\r\n field[dx][dy] = '.';\r\n\r\n ++eatenPigs;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n writeln(eatenPigs);\r\n}","testcases":"[{'input': ['2 3\\r\\nPPW\\r\\nW.P\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 3\\r\\nP.W\\r\\n.P.\\r\\nW.P\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1\\r\\nP\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 6\\r\\nWW..WW\\r\\n.PPPP.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6 2\\r\\n.W\\r\\n.W\\r\\n.P\\r\\nWP\\r\\n.P\\r\\nPW\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 10\\r\\nW..WWP.P.P\\r\\nW..PP.WWP.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 2\\r\\nP.\\r\\n.W\\r\\nPW\\r\\n..\\r\\nW.\\r\\nW.\\r\\n..\\r\\nP.\\r\\nWP\\r\\nPP\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 4\\r\\nWPPW\\r\\n.P..\\r\\nPWW.\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 3\\r\\n.WW\\r\\n..P\\r\\nP.P\\r\\nPWW\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['8 4\\r\\nP.WW\\r\\nW..P\\r\\nP..P\\r\\nP.WW\\r\\n..P.\\r\\nW.P.\\r\\nWP.W\\r\\nP..P\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1 1\\r\\nW\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 10\\r\\n..P.PW.P.P\\r\\nP.WP.W..WP\\r\\nW..P.P..WP\\r\\nW.PWW.P.P.\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['5 1\\r\\n.\\r\\nP\\r\\n.\\r\\n.\\r\\nW\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 5\\r\\n..WP.\\r\\nWP..W\\r\\nW.PP.\\r\\n.PWW.\\r\\nP.PPP\\r\\nWP..W\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10 10\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1\\r\\n.\\r\\nW\\r\\nW\\r\\nP\\r\\nP\\r\\n.\\r\\n.\\r\\n.\\r\\nW\\r\\nP\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 10\\r\\nP.PW.PW..W\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 10\\r\\nPP..PPWPPW\\r\\nPPPPPPPP..\\r\\n.PPPPPPP.P\\r\\nPPPPPPPPPP\\r\\nPWP.PPP.PP\\r\\nPW.PP.PPPP\\r\\nPPPPPP.PPW\\r\\n..PPWPPP.P\\r\\nWPPPPPPPPP\\r\\nWP.WPPPWPP\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['10 10\\r\\nPPPPPPPPPP\\r\\nPPPPPPPWPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 10\\r\\nPPPPPPPPWP\\r\\nPPPWPPPPPP\\r\\nPPPPPPPPPP\\r\\nPWWPPWPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPWPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPWPPW\\r\\nPPPPPPPPPP\\r\\nPPWPPPPPWP\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['10 10\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 4\\r\\nW..P\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10\\r\\nP.W.P.W.P.\\r\\n.W.P.W.P.W\\r\\nP.W.P.W.P.\\r\\n.W.P.W.P.W\\r\\nP.W.P.W.P.\\r\\n.W.P.W.P.W\\r\\nP.W.P.W.P.\\r\\n.W.P.W.P.W\\r\\nP.W.P.W.P.\\r\\n.W.P.W.P.W\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10\\r\\nWPPPWPPPWP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nWPPPWPPPWP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nWPPPWPPPWP\\r\\nPPPPPPPPPP\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10 10\\r\\nPPPPPPPPPP\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nPPPPPPPPPP\\r\\nPPPPPPPPPP\\r\\nWWWWWWWWWW\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['4 1\\r\\n.\\r\\nW\\r\\nP\\r\\n.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 10\\r\\nP..W.PPWW.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 1\\r\\nP\\r\\nP\\r\\nW\\r\\nW\\r\\n.\\r\\nP\\r\\n.\\r\\n.\\r\\n.\\r\\nW\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10\\r\\nPPPWPPPWPP\\r\\nPWPPPWPPPP\\r\\nPPPPPPPPPP\\r\\nWPPWPPWPPW\\r\\nPPPPPPPPPP\\r\\nPWPPWPPWPP\\r\\nPPPPPPPPPP\\r\\nPPWPPWPPWP\\r\\nPPPPPPPPPP\\r\\nWPPWPPWPPW\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['10 10\\r\\nWPPPPWPPWP\\r\\nPPPWPPPPPP\\r\\nPWPPPPWPPP\\r\\nPPPPWPPPWP\\r\\nWPPPPPPPPP\\r\\nPPPWPPWPPP\\r\\nPWPPPPPPWP\\r\\nPPPPWPPPPP\\r\\nWPPPPPWPPP\\r\\nPPPWPPPPWP\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['4 4\\r\\n.P..\\r\\n.W..\\r\\n.P..\\r\\n..W.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 1\\r\\n.\\r\\n.\\r\\nW\\r\\nP\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 10\\r\\nWPPPPWPPWP\\r\\nPPPWPPPPPP\\r\\nPWPPPPWPPP\\r\\nPPPPWPPPWP\\r\\nWPPPPPPPPP\\r\\nPPPWPPWPPP\\r\\nPWPPPPPPWP\\r\\nPPPPWPPPPP\\r\\nWPPPPPWPPP\\r\\nPPPWPPPPWP\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['2 3\\r\\nWWP\\r\\nPPP\\r\\n'], 'output': ['2\\r\\n']}]","id":579} {"difficulty":1000,"lang":"D","lang_cluster":"D","src_uid":"131_A","execute_outcome":"RUNTIME_ERROR","source_code":"\/**\r\n * CodeForces Problem 344.B (1)\r\n * ACM summer training contest (3b)\r\n * Noein\r\n *\/\r\n \r\nimport std.stdio;\r\n \r\nT mut(T)(in T inval) {\r\n import std.traits;\r\n \r\n Unqual!T new_val = inval;\r\n \r\n return new_val;\r\n}\r\n \r\nT imut(T)(in T inval) {\r\n immutable new_val = inval;\r\n \r\n return new_val;\r\n}\r\n\r\n\/*\r\n T abs(T)(in T inval) { return ((inval < 0) ? -inval : inval); }\r\n T min(T)(in T l, in T r) { return ((l < r) ? l : r); }\r\n*\/\r\n\r\nchar to_lower(const ref char ch, bool f = true) {\r\n if(f) {\r\n if(ch >= 'A' && ch <= 'Z') {\r\n int dl = ('a' - 'A');\r\n return cast(char)(ch + dl);\r\n } \r\n }\r\n else if(ch >= 'a' && ch <= 'z') {\r\n int dl = ('a' - 'A');\r\n return cast(char)(ch - dl);\r\n }\r\n \r\n return ch;\r\n}\r\n\r\nbool chk_caps_locked(const char[] in_str) {\r\n bool f = true;\r\n foreach(c; in_str[1..$]) {\r\n f &= (c <= 'Z' && c >= 'A');\r\n }\r\n return f;\r\n}\r\n\r\nvoid main() {\r\n string maybe_caps_locked;\r\n \r\n readf(\"%s \", &maybe_caps_locked);\r\n string res;\r\n if(chk_caps_locked(maybe_caps_locked))\r\n {\r\n foreach(c; maybe_caps_locked) {\r\n res ~= c.to_lower();\r\n }\r\n res = to_lower(maybe_caps_locked[0], false) ~ res[1..$];\r\n }\r\n \r\n writeln(res);\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\r\n","description":"wHAT DO WE NEED cAPS LOCK FOR?Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage. Let's consider that a word has been typed with the Caps lock key accidentally switched on, if: either it only contains uppercase letters; or all letters except for the first one are uppercase. In this case we should automatically change the case of all letters. For example, the case of the letters that form words \"hELLO\", \"HTTP\", \"z\" should be changed.Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged.","input_specification":"The first line of the input data contains a word consisting of uppercase and lowercase Latin letters. The word's length is from 1 to 100 characters, inclusive.\n","output_specification":"Print the result of the given word's processing.\n","notes":null,"sample_inputs":["cAPS\n","Lock\n"],"sample_outputs":["Caps","Lock\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n dstring s;\r\n readf(\"%s\\n\", s);\r\n\r\n auto len = s.length;\r\n bool need = true;\r\n foreach (i; 1 .. len) {\r\n need &= std.uni.isUpper(s[i]);\r\n }\r\n\r\n dchar[] res = s.dup;\r\n if (need) {\r\n foreach (i, x; s) {\r\n if (std.uni.isUpper(x)) res[i] = std.uni.toLower(x);\r\n else res[i] = std.uni.toUpper(x);\r\n }\r\n }\r\n\r\n res.writeln;\r\n}","testcases":"[{'input': ['cAPS\\r\\n'], 'output': ['Caps']}, {'input': ['Lock\\r\\n'], 'output': ['Lock\\r\\n']}, {'input': ['cAPSlOCK\\r\\n'], 'output': ['cAPSlOCK\\r\\n']}, {'input': ['CAPs\\r\\n'], 'output': ['CAPs\\r\\n']}, {'input': ['LoCK\\r\\n'], 'output': ['LoCK\\r\\n']}, {'input': ['OOPS\\r\\n'], 'output': ['oops']}, {'input': ['oops\\r\\n'], 'output': ['oops\\r\\n']}, {'input': ['a\\r\\n'], 'output': ['A']}, {'input': ['A\\r\\n'], 'output': ['a']}, {'input': ['aA\\r\\n'], 'output': ['Aa']}, {'input': ['Zz\\r\\n'], 'output': ['Zz\\r\\n']}, {'input': ['Az\\r\\n'], 'output': ['Az\\r\\n']}, {'input': ['zA\\r\\n'], 'output': ['Za']}, {'input': ['AAA\\r\\n'], 'output': ['aaa']}, {'input': ['AAa\\r\\n'], 'output': ['AAa\\r\\n']}, {'input': ['AaR\\r\\n'], 'output': ['AaR\\r\\n']}, {'input': ['Tdr\\r\\n'], 'output': ['Tdr\\r\\n']}, {'input': ['aTF\\r\\n'], 'output': ['Atf']}, {'input': ['fYd\\r\\n'], 'output': ['fYd\\r\\n']}, {'input': ['dsA\\r\\n'], 'output': ['dsA\\r\\n']}, {'input': ['fru\\r\\n'], 'output': ['fru\\r\\n']}, {'input': ['hYBKF\\r\\n'], 'output': ['Hybkf']}, {'input': ['XweAR\\r\\n'], 'output': ['XweAR\\r\\n']}, {'input': ['mogqx\\r\\n'], 'output': ['mogqx\\r\\n']}, {'input': ['eOhEi\\r\\n'], 'output': ['eOhEi\\r\\n']}, {'input': ['nkdku\\r\\n'], 'output': ['nkdku\\r\\n']}, {'input': ['zcnko\\r\\n'], 'output': ['zcnko\\r\\n']}, {'input': ['lcccd\\r\\n'], 'output': ['lcccd\\r\\n']}, {'input': ['vwmvg\\r\\n'], 'output': ['vwmvg\\r\\n']}, {'input': ['lvchf\\r\\n'], 'output': ['lvchf\\r\\n']}, {'input': ['IUNVZCCHEWENCHQQXQYPUJCRDZLUXCLJHXPHBXEUUGNXOOOPBMOBRIBHHMIRILYJGYYGFMTMFSVURGYHUWDRLQVIBRLPEVAMJQYO\\r\\n'], 'output': ['iunvzcchewenchqqxqypujcrdzluxcljhxphbxeuugnxooopbmobribhhmirilyjgyygfmtmfsvurgyhuwdrlqvibrlpevamjqyo']}, {'input': ['OBHSZCAMDXEJWOZLKXQKIVXUUQJKJLMMFNBPXAEFXGVNSKQLJGXHUXHGCOTESIVKSFMVVXFVMTEKACRIWALAGGMCGFEXQKNYMRTG\\r\\n'], 'output': ['obhszcamdxejwozlkxqkivxuuqjkjlmmfnbpxaefxgvnskqljgxhuxhgcotesivksfmvvxfvmtekacriwalaggmcgfexqknymrtg']}, {'input': ['IKJYZIKROIYUUCTHSVSKZTETNNOCMAUBLFJCEVANCADASMZRCNLBZPQRXESHEEMOMEPCHROSRTNBIDXYMEPJSIXSZQEBTEKKUHFS\\r\\n'], 'output': ['ikjyzikroiyuucthsvskztetnnocmaublfjcevancadasmzrcnlbzpqrxesheemomepchrosrtnbidxymepjsixszqebtekkuhfs']}, {'input': ['cTKDZNWVYRTFPQLDAUUNSPKTDJTUPPFPRXRSINTVFVNNQNKXWUZUDHZBUSOKTABUEDQKUIVRTTVUREEOBJTSDKJKVEGFXVHXEYPE\\r\\n'], 'output': ['Ctkdznwvyrtfpqldauunspktdjtuppfprxrsintvfvnnqnkxwuzudhzbusoktabuedqkuivrttvureeobjtsdkjkvegfxvhxeype']}, {'input': ['uCKJZRGZJCPPLEEYJTUNKOQSWGBMTBQEVPYFPIPEKRVYQNTDPANOIXKMPINNFUSZWCURGBDPYTEKBEKCPMVZPMWAOSHJYMGKOMBQ\\r\\n'], 'output': ['Uckjzrgzjcppleeyjtunkoqswgbmtbqevpyfpipekrvyqntdpanoixkmpinnfuszwcurgbdpytekbekcpmvzpmwaoshjymgkombq']}, {'input': ['KETAXTSWAAOBKUOKUQREHIOMVMMRSAEWKGXZKRASwTVNSSFSNIWYNPSTMRADOADEEBURRHPOOBIEUIBGYDJCEKPNLEUCANZYJKMR\\r\\n'], 'output': ['KETAXTSWAAOBKUOKUQREHIOMVMMRSAEWKGXZKRASwTVNSSFSNIWYNPSTMRADOADEEBURRHPOOBIEUIBGYDJCEKPNLEUCANZYJKMR\\r\\n']}, {'input': ['ZEKGDMWJPVUWFlNXRLUmWKLMMYSLRQQIBRWDPKWITUIMZYYKOEYGREKHHZRZZUFPVTNIHKGTCCTLOKSZITXXZDMPITHNZUIGDZLE\\r\\n'], 'output': ['ZEKGDMWJPVUWFlNXRLUmWKLMMYSLRQQIBRWDPKWITUIMZYYKOEYGREKHHZRZZUFPVTNIHKGTCCTLOKSZITXXZDMPITHNZUIGDZLE\\r\\n']}, {'input': ['TcMbVPCFvnNkCEUUCIFLgBJeCOKuJhIGwXFrhAZjuAhBraMSchBfWwIuHAEbgJOFzGtxDLDXzDSaPCFujGGxgxdlHUIQYRrMFCgJ\\r\\n'], 'output': ['TcMbVPCFvnNkCEUUCIFLgBJeCOKuJhIGwXFrhAZjuAhBraMSchBfWwIuHAEbgJOFzGtxDLDXzDSaPCFujGGxgxdlHUIQYRrMFCgJ\\r\\n']}, {'input': ['xFGqoLILNvxARKuIntPfeukFtMbvzDezKpPRAKkIoIvwqNXnehRVwkkXYvuRCeoieBaBfTjwsYhDeCLvBwktntyluoxCYVioXGdm\\r\\n'], 'output': ['xFGqoLILNvxARKuIntPfeukFtMbvzDezKpPRAKkIoIvwqNXnehRVwkkXYvuRCeoieBaBfTjwsYhDeCLvBwktntyluoxCYVioXGdm\\r\\n']}, {'input': ['udvqolbxdwbkijwvhlyaelhynmnfgszbhgshlcwdkaibceqomzujndixuzivlsjyjqxzxodzbukxxhwwultvekdfntwpzlhhrIjm\\r\\n'], 'output': ['udvqolbxdwbkijwvhlyaelhynmnfgszbhgshlcwdkaibceqomzujndixuzivlsjyjqxzxodzbukxxhwwultvekdfntwpzlhhrIjm\\r\\n']}, {'input': ['jgpwhetqqoncighgzbbaLwwwxkxivuwtokehrgprfgewzcwxkavwoflcgsgbhoeamzbefzoonwsyzisetoydrpufktzgbaycgaeg\\r\\n'], 'output': ['jgpwhetqqoncighgzbbaLwwwxkxivuwtokehrgprfgewzcwxkavwoflcgsgbhoeamzbefzoonwsyzisetoydrpufktzgbaycgaeg\\r\\n']}, {'input': ['vyujsazdstbnkxeunedfbolicojzjpufgfemhtmdrswvmuhoivjvonacefqenbqudelmdegxqtbwezsbydmanzutvdgkgrjxzlnc\\r\\n'], 'output': ['vyujsazdstbnkxeunedfbolicojzjpufgfemhtmdrswvmuhoivjvonacefqenbqudelmdegxqtbwezsbydmanzutvdgkgrjxzlnc\\r\\n']}, {'input': ['pivqnuqkaofcduvbttztjbuavrqwiqrwkfncmvatoxruelyoecnkpqraiahumiaiqeyjapbqyrsxcdgjbihivtqezvasfmzntdfv\\r\\n'], 'output': ['pivqnuqkaofcduvbttztjbuavrqwiqrwkfncmvatoxruelyoecnkpqraiahumiaiqeyjapbqyrsxcdgjbihivtqezvasfmzntdfv\\r\\n']}, {'input': ['upvtbsxswbohxshdrbjxcungzquhuomgxwlryvshshsfvqbrxvcikbglietlpqkiwbhiqpmdwuqosbtdvyxekkaqiwrbsibpoect\\r\\n'], 'output': ['upvtbsxswbohxshdrbjxcungzquhuomgxwlryvshshsfvqbrxvcikbglietlpqkiwbhiqpmdwuqosbtdvyxekkaqiwrbsibpoect\\r\\n']}, {'input': ['cTKDZNWVYRTFPQLDAUUNSPKTDJTUPPFPRXRSINTVFVNNQNKXWUZUDHZBUSOKTABUEDQKUIVRTTVUREEOBJTSDKJKVEGFXVHXEYPE\\r\\n'], 'output': ['Ctkdznwvyrtfpqldauunspktdjtuppfprxrsintvfvnnqnkxwuzudhzbusoktabuedqkuivrttvureeobjtsdkjkvegfxvhxeype']}, {'input': ['JEGDOFJOFGJHFROGHOFGMHOFGHORGFHMOu\\r\\n'], 'output': ['JEGDOFJOFGJHFROGHOFGMHOFGHORGFHMOu\\r\\n']}, {'input': ['aBACABa\\r\\n'], 'output': ['aBACABa\\r\\n']}, {'input': ['AAAAAAAAAAAAAAAAAAAAAAAAaa\\r\\n'], 'output': ['AAAAAAAAAAAAAAAAAAAAAAAAaa\\r\\n']}, {'input': ['aaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n'], 'output': ['aaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n']}, {'input': ['dDDDDDDDDDDDDD\\r\\n'], 'output': ['Dddddddddddddd']}, {'input': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': ['z\\r\\n'], 'output': ['Z']}, {'input': ['AZ\\r\\n'], 'output': ['az']}, {'input': ['Z\\r\\n'], 'output': ['z']}, {'input': ['aAAAA\\r\\n'], 'output': ['Aaaaa']}, {'input': ['F\\r\\n'], 'output': ['f']}]","id":580} {"difficulty":1300,"lang":"D","lang_cluster":"D","src_uid":"135_A","execute_outcome":"RUNTIME_ERROR","source_code":"\u00ef\u00bb\u00bfimport std.stdio;\r\nimport std.algorithm;\r\n\r\nvoid main() {\r\n\tint n;\r\n\tint[] a;\r\n\tint temp;\r\n\r\n\treadf(\" %s %s\", &n, &temp);\r\n\r\n\ta ~= temp;\r\n\tint max = temp;\r\n\r\n\tint idx = 0;\r\n\tforeach (i; 1 .. n) {\r\n\t\treadf(\" %s\", &temp);\r\n\t\ta ~= temp;\r\n\t\tif (temp > max) {\r\n\t\t\tmax = temp;\r\n\t\t\tidx = i;\r\n\t\t}\r\n\t}\r\n\r\n\t(a[idx] == 1) ? a[idx] = 2 : a[idx] = 1;\r\n\r\n\twritefln(\"%(%s %)\", sort(a));\r\n}","description":"Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 10^9, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that also lies in the range from 1 to 10^9, inclusive. It is not allowed to replace a number with itself or to change no number at all. After the replacement Petya sorted the array by the numbers' non-decreasing. Now he wants to know for each position: what minimum number could occupy it after the replacement and the sorting.","input_specification":"The first line contains a single integer n (1\u2264n\u226410^5), which represents how many numbers the array has. The next line contains n space-separated integers \u2014 the array's description. All elements of the array lie in the range from 1 to 10^9, inclusive.\n","output_specification":"Print n space-separated integers \u2014 the minimum possible values of each array element after one replacement and the sorting are performed.\n","notes":null,"sample_inputs":["5\n1 2 3 4 5\n","5\n2 3 4 5 6\n","3\n2 2 2\n"],"sample_outputs":["1 1 2 3 4\n","1 2 3 4 5\n","1 2 2\n"],"human_solution":"import std.stdio\r\n , std.typecons\r\n , std.traits\r\n , std.algorithm\r\n , std.range\r\n , std.container;\r\n\r\n\r\nvoid main() {\r\n const len = {\r\n uint t;\r\n readf(\"%s\\n\", &t);\r\n return t;\r\n }();\r\n \r\n uint[] data = new uint[len];\r\n \r\n auto mymax = tuple(0, 0);\r\n foreach(idx, ref i; data) {\r\n readf(\"%s \", &i);\r\n if(i > mymax[1]) { mymax[1] = i; mymax[0] = idx; }\r\n }\r\n \r\n if(mymax[1] != 1) {\r\n data[mymax[0]] = 1;\r\n }\r\n else\r\n {\r\n data[mymax[0]] = 2;\r\n }\r\n \r\n \/*data.sort()\r\n .y!((auto ref arr){\r\n foreach(ref a; arr) {\r\n write(a, \" \");\r\n }\r\n });\r\n *\/\r\n \r\n (auto ref arr){\r\n foreach(ref a; arr) {\r\n write(a, \" \");\r\n }\r\n }\r\n ( data.sort() );\r\n}\r\n\r\nalias y(alias clos) = clos;\r\n\r\nalias var(alias elem) = std.traits.Unqual!(typeof(elem));\r\n\r\nauto mut(T)(auto ref T in_val) {\r\n std.traits.Unqual!(T) rv = in_val;\r\n return rv;\r\n}\r\n\r\nauto imut(T)(auto ref T in_val) {\r\n immutable immrv = in_val;\r\n return immrv;\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\r\n\r\n\r\n\r\n\r\n\r\n","testcases":"[{'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['1 1 2 3 4\\r\\n']}, {'input': ['5\\r\\n2 3 4 5 6\\r\\n'], 'output': ['1 2 3 4 5\\r\\n']}, {'input': ['3\\r\\n2 2 2\\r\\n'], 'output': ['1 2 2\\r\\n']}, {'input': ['4\\r\\n1 1 2 3\\r\\n'], 'output': ['1 1 1 2\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n'], 'output': ['1 1 2\\r\\n']}, {'input': ['10\\r\\n5 6 1 2 3 1 3 45 7 1000000000\\r\\n'], 'output': ['1 1 1 2 3 3 5 6 7 45\\r\\n']}, {'input': ['4\\r\\n1000000000 234765 3485636 385634876\\r\\n'], 'output': ['1 234765 3485636 385634876\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['25\\r\\n1 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2\\r\\n'], 'output': ['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\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3\\r\\n1 2 1\\r\\n'], 'output': ['1 1 1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n1 1 2\\r\\n'], 'output': ['1 1 1\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2\\r\\n1 3\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['2\\r\\n5 5\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['1\\r\\n5\\r\\n'], 'output': ['1\\r\\n']}]","id":581} {"difficulty":1000,"lang":"D","lang_cluster":"D","src_uid":"137_B","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio;\r\nimport std.ascii;\r\nimport std.range;\r\nimport std.array;\r\nimport std.functional;\r\nimport std.algorithm;\r\nimport std.conv;\r\nimport std.container;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.string;\r\nimport std.c.string;\r\nimport std.random;\r\nimport std.regex;\r\nimport std.typecons;\r\n\r\nvoid main() {\r\n int N; scanf(\"%d\\n\", &N);\r\n auto u = new bool[N];\r\n int c;\r\n foreach (i; 0 .. N) {\r\n int x; scanf(\"%d\", &x);\r\n x--;\r\n if (x >= N) c++;\r\n if (u[x]) c++;\r\n u[x] = true;\r\n }\r\n writeln(c);\r\n}\r\n","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,a2,...,an 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\u2264n\u22645000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1\u2264ai\u22645000,1\u2264i\u2264n).\n","output_specification":"Print the only number \u2014 the minimum number of changes needed to get the permutation.\n","notes":"The first sample contains the permutation, which is why no replacements are required.\nIn the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.\nIn the third sample we can replace the second element with number 4 and the fourth element with number 2.\n","sample_inputs":["3\n3 1 2\n","2\n2 2\n","5\n5 3 3 3 1\n"],"sample_outputs":["0\n","1\n","2\n"],"human_solution":"module cf_137B;\r\n\r\nimport std.stdio, std.algorithm;\r\n\r\nvoid main() {\r\n\tint n;\r\n\tint[] numbers;\r\n\r\n\treadf(\"%d\", &n);\r\n\tnumbers = new int[n];\r\n\tfor (auto i = 0; i < n; ++i) {\r\n\t\treadf(\" %d\", &numbers[i]);\r\n\t}\r\n\r\n\tsort(numbers);\r\n\t\r\n\tint skip = 0, index = 0;\r\n\tfor (auto i = 1; i <= n; ++i) {\r\n\t\tif (index >= n) {\r\n\t\t\t++skip;\r\n\t\t\tcontinue;\r\n\t\t}\r\n\r\n\t\tif (numbers[index] == i) {\r\n\t\t\twhile (index < n && numbers[index] == i) {\r\n\t\t\t\t++index;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t++skip;\r\n\t\t}\r\n\t}\r\n\r\n\twriteln(skip);\r\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":582} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"1398_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.conv;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.string;\r\nimport std.uni;\r\nimport std.math;\r\nimport std.container.rbtree;\r\nimport std.range;\r\n\r\nvoid main()\r\n{\r\n auto t = to!long(readln().chomp);\r\n OUTER: foreach(_; 0..t)\r\n {\r\n auto n = readln();\r\n auto arr = readln().chomp.splitter(\" \").map!(to!long).map!(x => pow(x, 2)).array;\r\n\r\n for(int i = 0; i < arr.length; i++)\r\n {\r\n for(int j = i+1; j < arr.length; j++)\r\n {\r\n double target = arr[i]+arr[j];\r\n bool found = false;\r\n for(int z = j+1; z < arr.length; z++)\r\n {\r\n if(arr[z] >= target)\r\n {\r\n writeln(format(\"%d %d %d\", i, j, z));\r\n continue OUTER;\r\n }\r\n }\r\n }\r\n }\r\n \r\n writeln(\"-1\");\r\n }\r\n}","description":"You are given an array $$$a_1, a_2, \\dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \\le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \\le i < j < k \\le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$ (for example it is possible to construct a non-degenerate triangle with sides $$$3$$$, $$$4$$$ and $$$5$$$ but impossible with sides $$$3$$$, $$$4$$$ and $$$7$$$). If it is impossible to find such triple, report it.","input_specification":"The first line contains one integer $$$t$$$ ($$$1 \\\\le t \\\\le 1000$$$)\u00a0\u2014 the number of test cases.\nThe first line of each test case contains one integer $$$n$$$ ($$$3 \\\\le n \\\\le 5 \\\\cdot 10^4$$$)\u00a0\u2014 the length of the array $$$a$$$.\nThe second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \\\\dots , a_n$$$ ($$$1 \\\\le a_i \\\\le 10^9$$$; $$$a_{i - 1} \\\\le a_i$$$)\u00a0\u2014 the array $$$a$$$.\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.\n","output_specification":"For each test case print the answer to it in one line.\nIf there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i < j < k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are multiple answers, print any of them.\nOtherwise, print -1.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import std.algorithm;\r\nimport std.conv;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\n\r\nvoid main ()\r\n{\r\n\tauto tests = readln.strip.to !(int);\r\n\tforeach (test; 0..tests)\r\n\t{\r\n\t\tauto n = readln.strip.to !(int);\r\n\t\tauto a = readln.splitter.map !(to !(int)).array;\r\n\t\tauto p = n.iota.array;\r\n\t\tmakeIndex (a, p);\r\n\t\tif (a[p[0]] + a[p[1]] <= a[p[$ - 1]])\r\n\t\t{\r\n\t\t\tauto q = [p[0], p[1], p[$ - 1]];\r\n\t\t\tsort (q);\r\n\t\t\tq[] += 1;\r\n\t\t\twritefln !(\"%(%s %)\") (q);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\twriteln (-1);\r\n\t\t}\r\n\t}\r\n}\r\n","testcases":"[{'input': ['3\\r\\n7\\r\\n4 6 11 11 15 18 20\\r\\n4\\r\\n10 10 10 11\\r\\n3\\r\\n1 1 1000000000\\r\\n'], 'output': ['1 2 7\\r\\n-1\\r\\n1 2 3\\r\\n']}, {'input': ['1\\r\\n3\\r\\n78788 78788 100000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n3\\r\\n78788 78788 157577\\r\\n'], 'output': ['1 2 3\\r\\n']}, {'input': ['1\\r\\n10\\r\\n1 7 7 7 7 9 9 9 9 9\\r\\n'], 'output': ['1 2 10\\r\\n']}, {'input': ['1\\r\\n6\\r\\n1 1 1 2 2 3\\r\\n'], 'output': ['1 2 6\\r\\n']}, {'input': ['1\\r\\n3\\r\\n5623 5624 10000000\\r\\n'], 'output': ['1 2 3\\r\\n']}, {'input': ['1\\r\\n3\\r\\n5739271 5739272 20000000\\r\\n'], 'output': ['1 2 3\\r\\n']}, {'input': ['1\\r\\n14\\r\\n1 2 2 2 2 2 2 2 2 2 2 2 2 4\\r\\n'], 'output': ['1 2 14\\r\\n']}, {'input': ['1\\r\\n3\\r\\n1 65535 10000000\\r\\n'], 'output': ['1 2 3\\r\\n']}, {'input': ['1\\r\\n3\\r\\n21 78868 80000\\r\\n'], 'output': ['1 2 3\\r\\n']}, {'input': ['1\\r\\n15\\r\\n3 4 7 8 9 10 11 12 13 14 15 16 32 36 39\\r\\n'], 'output': ['1 2 15\\r\\n']}]","id":583} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"148_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.algorithm;\r\nimport std.range;\r\n\r\nvoid main()\r\n{\r\n uint[4] nums;\r\n uint total;\r\n readf(\"%s\\n%s\\n%s\\n%s\\n%s\\n\", &nums[0], &nums[1], &nums[2], &nums[3], &total);\r\n auto sequence = iota(1, total+1).map!(a => any!(b => a%b==0)(nums.dup));\r\n sequence.save.writeln;\r\n reduce!((a,b) => a + b)(0, sequence).writeln;\r\n}","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,l,m,n and d, each number in a separate line (1\u2264k,l,m,n\u226410, 1\u2264d\u226410^5).\n","output_specification":"Output the number of damaged dragons.\n","notes":"In 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.\nIn the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.\n","sample_inputs":["1\n2\n3\n4\n12\n","2\n3\n4\n5\n24\n"],"sample_outputs":["12\n","17\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n auto k = new int[](4);\r\n foreach (i; 0 .. 4) readf(\"%d\\n\", k[i]);\r\n\r\n int d;\r\n readf(\"%d\\n\", d);\r\n\r\n auto dragons = new bool[](d+1);\r\n foreach (x; k) {\r\n int p = x;\r\n while (p <= d) {\r\n dragons[p] = true;\r\n p += x;\r\n }\r\n }\r\n\r\n auto res = dragons.count(true);\r\n res.writeln;\r\n}","testcases":"[{'input': ['1\\r\\n2\\r\\n3\\r\\n4\\r\\n12\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['2\\r\\n3\\r\\n4\\r\\n5\\r\\n24\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n100000\\r\\n'], 'output': ['100000\\r\\n']}, {'input': ['10\\r\\n9\\r\\n8\\r\\n7\\r\\n6\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\n4\\r\\n4\\r\\n3\\r\\n65437\\r\\n'], 'output': ['32718\\r\\n']}, {'input': ['8\\r\\n4\\r\\n1\\r\\n10\\r\\n59392\\r\\n'], 'output': ['59392\\r\\n']}, {'input': ['4\\r\\n1\\r\\n8\\r\\n7\\r\\n44835\\r\\n'], 'output': ['44835\\r\\n']}, {'input': ['6\\r\\n1\\r\\n7\\r\\n2\\r\\n62982\\r\\n'], 'output': ['62982\\r\\n']}, {'input': ['2\\r\\n7\\r\\n4\\r\\n9\\r\\n56937\\r\\n'], 'output': ['35246\\r\\n']}, {'input': ['2\\r\\n9\\r\\n8\\r\\n1\\r\\n75083\\r\\n'], 'output': ['75083\\r\\n']}, {'input': ['8\\r\\n7\\r\\n7\\r\\n6\\r\\n69038\\r\\n'], 'output': ['24656\\r\\n']}, {'input': ['4\\r\\n4\\r\\n2\\r\\n3\\r\\n54481\\r\\n'], 'output': ['36320\\r\\n']}, {'input': ['6\\r\\n4\\r\\n9\\r\\n8\\r\\n72628\\r\\n'], 'output': ['28244\\r\\n']}, {'input': ['9\\r\\n7\\r\\n8\\r\\n10\\r\\n42357\\r\\n'], 'output': ['16540\\r\\n']}, {'input': ['5\\r\\n6\\r\\n4\\r\\n3\\r\\n60504\\r\\n'], 'output': ['36302\\r\\n']}, {'input': ['7\\r\\n2\\r\\n3\\r\\n8\\r\\n21754\\r\\n'], 'output': ['15539\\r\\n']}, {'input': ['1\\r\\n2\\r\\n10\\r\\n4\\r\\n39901\\r\\n'], 'output': ['39901\\r\\n']}, {'input': ['3\\r\\n4\\r\\n7\\r\\n1\\r\\n58048\\r\\n'], 'output': ['58048\\r\\n']}, {'input': ['9\\r\\n10\\r\\n4\\r\\n6\\r\\n52003\\r\\n'], 'output': ['21956\\r\\n']}, {'input': ['5\\r\\n10\\r\\n9\\r\\n3\\r\\n70149\\r\\n'], 'output': ['32736\\r\\n']}, {'input': ['5\\r\\n5\\r\\n5\\r\\n10\\r\\n55592\\r\\n'], 'output': ['11118\\r\\n']}, {'input': ['1\\r\\n5\\r\\n2\\r\\n6\\r\\n49547\\r\\n'], 'output': ['49547\\r\\n']}, {'input': ['3\\r\\n7\\r\\n7\\r\\n7\\r\\n84046\\r\\n'], 'output': ['36019\\r\\n']}, {'input': ['10\\r\\n2\\r\\n1\\r\\n8\\r\\n63537\\r\\n'], 'output': ['63537\\r\\n']}, {'input': ['7\\r\\n2\\r\\n10\\r\\n5\\r\\n81684\\r\\n'], 'output': ['53678\\r\\n']}, {'input': ['7\\r\\n1\\r\\n6\\r\\n8\\r\\n99831\\r\\n'], 'output': ['99831\\r\\n']}, {'input': ['3\\r\\n9\\r\\n3\\r\\n3\\r\\n61082\\r\\n'], 'output': ['20360\\r\\n']}, {'input': ['5\\r\\n5\\r\\n8\\r\\n9\\r\\n79228\\r\\n'], 'output': ['29931\\r\\n']}, {'input': ['1\\r\\n5\\r\\n5\\r\\n6\\r\\n89535\\r\\n'], 'output': ['89535\\r\\n']}, {'input': ['5\\r\\n5\\r\\n2\\r\\n1\\r\\n7682\\r\\n'], 'output': ['7682\\r\\n']}, {'input': ['7\\r\\n4\\r\\n8\\r\\n8\\r\\n25829\\r\\n'], 'output': ['9224\\r\\n']}, {'input': ['3\\r\\n4\\r\\n3\\r\\n3\\r\\n87079\\r\\n'], 'output': ['43539\\r\\n']}, {'input': ['5\\r\\n8\\r\\n4\\r\\n9\\r\\n5226\\r\\n'], 'output': ['2438\\r\\n']}, {'input': ['4\\r\\n9\\r\\n6\\r\\n6\\r\\n1070\\r\\n'], 'output': ['415\\r\\n']}, {'input': ['10\\r\\n10\\r\\n10\\r\\n10\\r\\n100000\\r\\n'], 'output': ['10000\\r\\n']}, {'input': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n10\\r\\n10\\r\\n10\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n10\\r\\n1\\r\\n10\\r\\n10\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['10\\r\\n10\\r\\n1\\r\\n10\\r\\n100\\r\\n'], 'output': ['100\\r\\n']}, {'input': ['2\\r\\n2\\r\\n2\\r\\n2\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}]","id":584} {"difficulty":900,"lang":"D","lang_cluster":"D","src_uid":"149_A","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio;\r\n\r\nvoid main() {\r\n\tint[12] array;\r\n\tint n;\r\n\treadf(\" %s\", &n);\r\n\tfor (int i = 0; i < 12; i++)\r\n\t\treadf(\" %s\", &array[i]);\r\n\r\n\tarray.sort;\r\n\r\n\tint counter = 0;\r\n\tint count = 0;\t\r\n\tforeach_reverse(e; array) {\r\n\t\tif (counter >= n) {\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tcounter += e;\r\n\t\tcount++;\r\n\t\t\r\n\t}\r\n\r\n\twriteln(count);\r\n}","description":"What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until... Today Petya opened the cupboard and found a scary note there. His parents had left him with duties: he should water their favourite flower all year, each day, in the morning, in the afternoon and in the evening. \"Wait a second!\" \u2014 thought Petya. He know for a fact that if he fulfills the parents' task in the i-th (1\u2264i\u226412) month of the year, then the flower will grow by ai centimeters, and if he doesn't water the flower in the i-th month, then the flower won't grow this month. Petya also knows that try as he might, his parents won't believe that he has been watering the flower if it grows strictly less than by k centimeters. Help Petya choose the minimum number of months when he will water the flower, given that the flower should grow no less than by k centimeters.","input_specification":"The first line contains exactly one integer k (0\u2264k\u2264100). The next line contains twelve space-separated integers: the i-th (1\u2264i\u226412) number in the line represents ai (0\u2264ai\u2264100). \n","output_specification":"Print the only integer \u2014 the minimum number of months when Petya has to water the flower so that the flower grows no less than by k centimeters. If the flower can't grow by k centimeters in a year, print -1.\n","notes":"Let's consider the first sample test. There it is enough to water the flower during the seventh and the ninth month. Then the flower grows by exactly five centimeters.\nIn the second sample Petya's parents will believe him even if the flower doesn't grow at all (k=0). So, it is possible for Petya not to water the flower at all.\n","sample_inputs":["5\n1 1 1 1 2 2 3 2 2 1 1 1\n","0\n0 0 0 0 0 0 0 1 1 2 3 0\n","11\n1 1 4 1 1 5 1 1 4 1 1 1\n"],"sample_outputs":["2\n","0\n","3\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n int k;\r\n readf(\"%d\\n\", k);\r\n\r\n auto a = readln.chomp.split.to!(int[]);\r\n\r\n if (k == 0) {\r\n writeln(0);\r\n return;\r\n }\r\n\r\n a.sort!\"a > b\";\r\n\r\n foreach (i, x; a) {\r\n k -= x;\r\n if (k <= 0) {\r\n writeln(i+1);\r\n return;\r\n }\r\n }\r\n\r\n writeln(-1);\r\n}","testcases":"[{'input': ['5\\r\\n1 1 1 1 2 2 3 2 2 1 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0\\r\\n0 0 0 0 0 0 0 1 1 2 3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['11\\r\\n1 1 4 1 1 5 1 1 4 1 1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['15\\r\\n20 1 1 1 1 2 2 1 2 2 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n8 9 100 12 14 17 21 10 11 100 23 10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['52\\r\\n1 12 3 11 4 5 10 6 9 7 8 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['50\\r\\n2 2 3 4 5 4 4 5 7 3 2 7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n55 81 28 48 99 20 67 95 6 19 10 93\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['93\\r\\n85 40 93 66 92 43 61 3 64 51 90 21\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['99\\r\\n36 34 22 0 0 0 52 12 0 0 33 47\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['99\\r\\n28 32 31 0 10 35 11 18 0 0 32 28\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['99\\r\\n19 17 0 1 18 11 29 9 29 22 0 8\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['76\\r\\n2 16 11 10 12 0 20 4 4 14 11 14\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['41\\r\\n2 1 7 7 4 2 4 4 9 3 10 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['47\\r\\n8 2 2 4 3 1 9 4 2 7 7 8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['58\\r\\n6 11 7 0 5 6 3 9 4 9 5 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['32\\r\\n5 2 4 1 5 0 5 1 4 3 0 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['31\\r\\n6 1 0 4 4 5 1 0 5 3 2 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['35\\r\\n2 3 0 0 6 3 3 4 3 5 0 6\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['41\\r\\n3 1 3 4 3 6 6 1 4 4 0 6\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['97\\r\\n0 5 3 12 10 16 22 8 21 17 21 10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100\\r\\n21 21 0 0 4 13 0 26 0 0 0 15\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100\\r\\n0 0 16 5 22 0 5 0 25 0 14 13\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['97\\r\\n17 0 10 0 0 0 18 0 14 23 15 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100\\r\\n0 9 0 18 7 0 0 14 33 3 0 16\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['95\\r\\n5 2 13 0 15 18 17 0 6 11 0 8\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['94\\r\\n11 13 0 9 15 8 8 16 3 7 1 3\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['96\\r\\n8 4 12 15 8 0 4 10 6 6 12 11\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['100\\r\\n5 5 3 8 6 5 0 3 3 8 1 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100\\r\\n1 0 0 1 1 0 1 1 1 1 2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100\\r\\n6 3 2 0 4 1 2 2 2 2 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n100 100 100 100 100 100 100 100 100 100 100 100\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n100 100 100 100 100 100 100 100 100 100 100 100\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['12\\r\\n1 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['13\\r\\n1 1 1 1 1 1 1 1 1 1 1 2\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['15\\r\\n10 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['-1\\r\\n']}]","id":585} {"difficulty":900,"lang":"D","lang_cluster":"D","src_uid":"160_A","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio;\r\nimport std.array;\r\nimport std.algorithm;\r\nimport std.conv;\r\n\r\nint main() {\r\n auto s = stdin.byLine;\r\n s.popFront();\r\n auto arr = s.front.split(\" \").map!(i => to!int(i))();\r\n int[] arr_sum;\r\n arr_sum.length = arr.length;\r\n arr_sum[0] = arr[0];\r\n for (uint i = 1; i < arr.length; i++) {\r\n arr_sum[i] = arr[i] + arr_sum[i - 1];\r\n }\r\n float max = arr_sum[arr_sum.length - 1];\r\n int idx = 0;\r\n for (uint i = arr_sum.length - 1; i >= 0; i--) {\r\n if (arr_sum[i] < (max\/2)) {\r\n idx = i;\r\n break;\r\n }\r\n }\r\n writeln(arr_sum.length - idx - 1);\r\n return 0;\r\n}","description":"Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like.Now let's imagine a typical morning in your family. You haven't woken up yet, and Mom is already going to work. She has been so hasty that she has nearly forgotten to leave the two of her darling children some money to buy lunches in the school cafeteria. She fished in the purse and found some number of coins, or to be exact, n coins of arbitrary values a1,a2,...,an. But as Mom was running out of time, she didn't split the coins for you two. So she scribbled a note asking you to split the money equally.As you woke up, you found Mom's coins and read her note. \"But why split the money equally?\" \u2014 you thought. After all, your twin is sleeping and he won't know anything. So you decided to act like that: pick for yourself some subset of coins so that the sum of values of your coins is strictly larger than the sum of values of the remaining coins that your twin will have. However, you correctly thought that if you take too many coins, the twin will suspect the deception. So, you've decided to stick to the following strategy to avoid suspicions: you take the minimum number of coins, whose sum of values is strictly more than the sum of values of the remaining coins. On this basis, determine what minimum number of coins you need to take to divide them in the described manner.","input_specification":"The first line contains integer n (1\u2264n\u2264100) \u2014 the number of coins. The second line contains a sequence of n integers a1, a2, ..., an (1\u2264ai\u2264100) \u2014 the coins' values. All numbers are separated with spaces.\n","output_specification":"In the single line print the single number \u2014 the minimum needed number of coins.\n","notes":"In the first sample you will have to take 2 coins (you and your twin have sums equal to 6,0 correspondingly). If you take 1 coin, you get sums 3,3. If you take 0 coins, you get sums 0,6. Those variants do not satisfy you as your sum should be strictly more that your twins' sum.\nIn the second sample one coin isn't enough for us, too. You can pick coins with values 1,2 or 2,2. In any case, the minimum number of coins equals 2. \n","sample_inputs":["2\n3 3\n","3\n2 1 2\n"],"sample_outputs":["2\n","2\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n int n;\r\n readf(\"%d\\n\", n);\r\n\r\n auto a = readln.chomp.split.to!(int[]);\r\n\r\n a.sort!\"a > b\";\r\n\r\n int res, num, rem = a.sum;\r\n foreach (x; a) {\r\n if (num > rem) break;\r\n\r\n ++res, num += x, rem -= x;\r\n }\r\n\r\n res.writeln;\r\n}","testcases":"[{'input': ['2\\r\\n3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n2 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n4 2 2 2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['7\\r\\n1 10 1 2 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3 2 3 3 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n2 1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6\\r\\n1 1 1 1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7\\r\\n10 10 5 5 5 5 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\n2 1 2 2 2 1 1 2 1 2 2 1 1 1 1 2 1 1 1 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n4 2 4 4 3 4 2 2 4 2 3 1 1 2 2 3 3 3 1 4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n35 26 41 40 45 46 22 26 39 23 11 15 47 42 18 15 27 10 45 40\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n7 84 100 10 31 35 41 2 63 44 57 4 63 11 23 49 98 71 16 90\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['50\\r\\n19 2 12 26 17 27 10 26 17 17 5 24 11 15 3 9 16 18 19 1 25 23 18 6 2 7 25 7 21 25 13 29 16 9 25 3 14 30 18 4 10 28 6 10 8 2 2 4 8 28\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['70\\r\\n2 18 18 47 25 5 14 9 19 46 36 49 33 32 38 23 32 39 8 29 31 17 24 21 10 15 33 37 46 21 22 11 20 35 39 13 11 30 28 40 39 47 1 17 24 24 21 46 12 2 20 43 8 16 44 11 45 10 13 44 31 45 45 46 11 10 33 35 23 42\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['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': ['51\\r\\n']}, {'input': ['100\\r\\n1 2 2 1 2 1 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 2 2 1 2 1 2 1 2 2 2 1 2 1 2 2 1 1 2 2 1 1 2 2 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 1 2 2 1 1 1 1 2 1 1 1 1 2 2 2 2\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['100\\r\\n1 2 3 2 1 2 2 3 1 3 3 2 2 1 1 2 2 1 1 1 1 2 3 3 2 1 1 2 2 2 3 3 3 2 1 3 1 3 3 2 3 1 2 2 2 3 2 1 1 3 3 3 3 2 1 1 2 3 2 2 3 2 3 2 2 3 2 2 2 2 3 3 3 1 3 3 1 1 2 3 2 2 2 2 3 3 3 2 1 2 3 1 1 2 3 3 1 3 3 2\\r\\n'], 'output': ['36\\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': ['33\\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': ['30\\r\\n']}, {'input': ['100\\r\\n16 9 11 8 11 4 9 17 4 8 4 10 9 10 6 3 3 15 1 6 1 15 12 18 6 14 13 18 1 7 18 4 10 7 10 12 3 16 14 4 10 8 10 7 19 13 15 1 4 8 16 10 6 4 3 16 11 10 7 3 4 16 1 20 1 11 4 16 10 7 7 12 18 19 3 17 19 3 4 19 2 12 11 3 18 20 2 2 14 4 20 13 13 11 16 20 19 14 7 2\\r\\n'], 'output': ['29\\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': ['30\\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': ['29\\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 92 93 94 95 96 97 98 99 100\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n4 1 2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n2 2 2 4 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n100 99 99 100\\r\\n'], 'output': ['2\\r\\n']}]","id":586} {"difficulty":1500,"lang":"D","lang_cluster":"D","src_uid":"166_E","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\nimport std.math;\n\nvoid main(){\n uint n;\n readf(\"%s\\n\",&n);\n\n solve1(n);\n \/\/solve2(n+1);\n}\n\nvoid solve2(uint size){\n uint mod = 1000000007;\n uint[] m = new uint[size];\n\n m[0] = 0;\n m[1] = 0;\n m[2] = 3;\n m[3] = 6;\n for(uint i = 4; i < m.length; i++){\n auto sum = 0;\n \/\/writefln(\"<%s>\",i);\n for(uint n = 0; n < i-2; n++){\n sum += pow(2,n)*m[i-n-2];\n \/\/writefln(\"%s,%s = %s\",n,i-n-2,pow(2,n)*m[i-n-2]);\n }\n m[i] = (3*(sum + pow(2,i-2))) % mod;\n }\n\n writeln(m[size-1]);\n}\n\nvoid solve1(uint n){\n uint k = n;\n if(n < 10){\n n = 10;\n }\n\n uint mod = 1000000007;\n \/\/uint size = 1000000;\n \/\/uint size = 10;\n uint[] m = new uint[n+1];\n\n m[0] = 0;\n m[1] = 0;\n m[2] = 3;\n m[3] = 6;\n for(uint i = 4; i < m.length; i++){\n auto x1 = m[i-1] % mod;\n auto x2 = m[i-2] % mod;\n m[i] = (2*x1+3*x2) % mod;\n }\n\n writeln(m[k]);\n}\n","description":"You are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly. An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each moment of time he makes a step from one vertex to another one along some edge of the tetrahedron. The ant just can't stand on one place.You do not have to do much to solve the problem: your task is to count the number of ways in which the ant can go from the initial vertex D to itself in exactly n steps. In other words, you are asked to find out the number of different cyclic paths with the length of n from vertex D to itself. As the number can be quite large, you should print it modulo 1000000007 (10^9+7). ","input_specification":"The first line contains the only integer n (1\u2264n\u226410^7) \u2014 the required length of the cyclic path.\n","output_specification":"Print the only integer \u2014 the required number of ways modulo 1000000007 (10^9+7).\n","notes":"The required paths in the first sample are: \n D-A-D D-B-D D-C-D ","sample_inputs":["2\n","4\n"],"sample_outputs":["3\n","21\n"],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop, core.stdc.stdio, std.bitmanip;\n\n\nvoid main() {\n immutable int MOD = 10^^9+7;\n auto N = readln.chomp.to!int;\n\n auto dp = new long[][](2, 4);\n dp[0][0] = 1;\n dp[0][1] = dp[0][2] = dp[0][3] = 0;\n\n foreach (i; 0..N) {\n auto cur = i % 2;\n auto tar = 1 - cur;\n dp[tar][0] = (dp[cur][1] + dp[cur][2] + dp[cur][3]) % MOD;\n dp[tar][1] = (dp[cur][0] + dp[cur][2] + dp[cur][3]) % MOD;\n dp[tar][2] = (dp[cur][0] + dp[cur][1] + dp[cur][3]) % MOD;\n dp[tar][3] = (dp[cur][0] + dp[cur][1] + dp[cur][2]) % MOD;\n }\n\n writeln(dp[N%2][0]);\n}\n","testcases":"[{'input': ['2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['183\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['546\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['1641\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['4920\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['14763\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['3587226\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['782663359\\r\\n']}, {'input': ['10000000\\r\\n'], 'output': ['192336614\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['721510432\\r\\n']}, {'input': ['300\\r\\n'], 'output': ['327873818\\r\\n']}, {'input': ['900\\r\\n'], 'output': ['295068084\\r\\n']}, {'input': ['1500\\r\\n'], 'output': ['451187545\\r\\n']}, {'input': ['3000\\r\\n'], 'output': ['645417275\\r\\n']}, {'input': ['5000\\r\\n'], 'output': ['755610910\\r\\n']}, {'input': ['10000\\r\\n'], 'output': ['723907367\\r\\n']}, {'input': ['50000\\r\\n'], 'output': ['969527595\\r\\n']}, {'input': ['90000\\r\\n'], 'output': ['548978368\\r\\n']}, {'input': ['99999\\r\\n'], 'output': ['909741855\\r\\n']}, {'input': ['100000\\r\\n'], 'output': ['729225554\\r\\n']}, {'input': ['300000\\r\\n'], 'output': ['93822635\\r\\n']}, {'input': ['800000\\r\\n'], 'output': ['178940616\\r\\n']}, {'input': ['1000000\\r\\n'], 'output': ['266233856\\r\\n']}, {'input': ['4000000\\r\\n'], 'output': ['882155933\\r\\n']}, {'input': ['9000000\\r\\n'], 'output': ['295060537\\r\\n']}, {'input': ['9999999\\r\\n'], 'output': ['730778875\\r\\n']}, {'input': ['1000000\\r\\n'], 'output': ['266233856\\r\\n']}, {'input': ['9999999\\r\\n'], 'output': ['730778875\\r\\n']}, {'input': ['10000000\\r\\n'], 'output': ['192336614\\r\\n']}, {'input': ['9999998\\r\\n'], 'output': ['576926295\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['782663359\\r\\n']}, {'input': ['31\\r\\n'], 'output': ['347990060\\r\\n']}]","id":587} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"169_A","execute_outcome":"WRONG_ANSWER","source_code":"module _template;\r\nimport std.stdio;\r\nimport std.algorithm;\r\nimport std.container;\r\nimport std.range;\r\nimport std.numeric;\r\nimport std.conv;\r\nimport std.typecons;\r\nimport std.format;\r\n\r\nstruct IO {\r\n string read_string() {\r\n while (tokens.empty) {\r\n tokens = readln.split;\r\n }\r\n auto token = tokens.front;\r\n tokens.popFront;\r\n return token;\r\n }\r\n \r\n int read_int() {\r\n return read_string.to!int;\r\n }\r\n \r\n string[] tokens;\r\n}\r\n\r\nvoid main() {\r\n IO cin;\r\n int t = 1;\r\n \/\/ int t = cin.read_int;\r\n while (t--) {\r\n int n = cin.read_int;\r\n int a = cin.read_int;\r\n int b = cin.read_int;\r\n\r\n int[] v = new int[n];\r\n for (int i = 0; i < n; i++) {\r\n v[i] = cin.read_int;\r\n }\r\n sort(v);\r\n writeln(v[b] - v[a]);\r\n } \r\n}","description":"Petya and Vasya are brothers. Today is a special day for them as their parents left them home alone and commissioned them to do n chores. Each chore is characterized by a single parameter \u2014 its complexity. The complexity of the i-th chore equals hi.As Petya is older, he wants to take the chores with complexity larger than some value x (hi>x) to leave to Vasya the chores with complexity less than or equal to x (hi\u2264x). The brothers have already decided that Petya will do exactly a chores and Vasya will do exactly b chores (a+b=n).In how many ways can they choose an integer x so that Petya got exactly a chores and Vasya got exactly b chores?","input_specification":"The first input line contains three integers n,a and b (2\u2264n\u22642000; a,b\u22651; a+b=n) \u2014 the total number of chores, the number of Petya's chores and the number of Vasya's chores.\nThe next line contains a sequence of integers h1,h2,...,hn (1\u2264hi\u226410^9), hi is the complexity of the i-th chore. The numbers in the given sequence are not necessarily different.\nAll numbers on the lines are separated by single spaces.\n","output_specification":"Print the required number of ways to choose an integer value of x. If there are no such ways, print 0.\n","notes":"In the first sample the possible values of x are 3, 4 or 5.\nIn the second sample it is impossible to find such x, that Petya got 3 chores and Vasya got 4.\n","sample_inputs":["5 2 3\n6 2 3 100 1\n","7 3 4\n1 1 9 1 1 1 1\n"],"sample_outputs":["3\n","0\n"],"human_solution":"module _template;\r\nimport std.stdio;\r\nimport std.algorithm;\r\nimport std.container;\r\nimport std.range;\r\nimport std.numeric;\r\nimport std.conv;\r\nimport std.typecons;\r\nimport std.format;\r\n\r\nstruct IO {\r\n string read_string() {\r\n while (tokens.empty) {\r\n tokens = readln.split;\r\n }\r\n auto token = tokens.front;\r\n tokens.popFront;\r\n return token;\r\n }\r\n \r\n int read_int() {\r\n return read_string.to!int;\r\n }\r\n \r\n string[] tokens;\r\n}\r\n\r\nvoid main() {\r\n IO cin;\r\n int t = 1;\r\n \/\/ int t = cin.read_int;\r\n while (t--) {\r\n int n = cin.read_int;\r\n int a = cin.read_int;\r\n int b = cin.read_int;\r\n\r\n int[] v = new int[n];\r\n for (int i = 0; i < n; i++) {\r\n v[i] = cin.read_int;\r\n }\r\n sort(v);\r\n writeln(v[b] - v[b - 1]);\r\n } \r\n}","testcases":"[{'input': ['5 2 3\\r\\n6 2 3 100 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['7 3 4\\r\\n1 1 9 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1 1\\r\\n10 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['2 1 1\\r\\n7 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1 1\\r\\n1 1000000000\\r\\n'], 'output': ['999999999\\r\\n']}, {'input': ['3 1 2\\r\\n6 5 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 2 1\\r\\n10 10 8\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['8 3 5\\r\\n42 55 61 72 83 10 22 33\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10 5 5\\r\\n1 2 3 4 5 999999999 999999998 999999997 999999996 999999995\\r\\n'], 'output': ['999999990\\r\\n']}, {'input': ['4 1 3\\r\\n10 8 7 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 2 2\\r\\n402 10 10 402\\r\\n'], 'output': ['392\\r\\n']}, {'input': ['4 1 3\\r\\n10 402 402 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 3 1\\r\\n100 100 200 200\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['150 10 140\\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\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['102 101 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\\r\\n'], 'output': ['0\\r\\n']}]","id":588} {"difficulty":1300,"lang":"D","lang_cluster":"D","src_uid":"189_A","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio, std.algorithm, std.string, std.conv, std.range;\n\nvoid main() {\n int n, a, b, c;\n readf(\"%d %d %d %d\\n\", &n, &a, &b, &c);\n dp(n, a, b, c).writeln;\n}\n\nint dp(int n, int a, int b, int c) {\n int[] r = new int[n + 1];\n foreach (e; [ a, b, c ]) {\n r[e] = 1;\n }\n\n foreach (int i, ref e; r) {\n if (e > 0) {\n foreach (cut; [ a, b, c ]) {\n if (i + cut <= n) {\n r[i + cut] = max(r[i] + 1, r[i + cut]);\n }\n }\n }\n }\n\n return r[n];\n}\n","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\u2264n,a,b,c\u22644000) \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.\n","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.\n","notes":"In the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.\nIn the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2.\n","sample_inputs":["5 5 3 2\n","7 5 5 2\n"],"sample_outputs":["2\n","2\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n auto a = readln.chomp.split.to!(int[]);\r\n\r\n int n = a.front;\r\n a.popFront;\r\n\r\n auto cnts = new int[](n+1);\r\n foreach (x; a) {\r\n if (x <= n) cnts[x] = 1;\r\n }\r\n\r\n foreach (i; 0 .. n) {\r\n if (cnts[i] == 0) continue;\r\n\r\n foreach (x; a) {\r\n if (i + x > n) continue;\r\n\r\n cnts[i+x] = max(cnts[i+x], cnts[i]+1);\r\n }\r\n }\r\n\r\n int res = cnts[n];\r\n res.writeln;\r\n}","testcases":"[{'input': ['5 5 3 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['7 5 5 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 4 4 4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4000 1 2 3\\r\\n'], 'output': ['4000\\r\\n']}, {'input': ['4000 3 4 5\\r\\n'], 'output': ['1333\\r\\n']}, {'input': ['10 3 4 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['100 23 15 50\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3119 3515 1021 7\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['918 102 1327 1733\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3164 42 430 1309\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['3043 317 1141 2438\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['26 1 772 2683\\r\\n'], 'output': ['26\\r\\n']}, {'input': ['370 2 1 15\\r\\n'], 'output': ['370\\r\\n']}, {'input': ['734 12 6 2\\r\\n'], 'output': ['367\\r\\n']}, {'input': ['418 18 14 17\\r\\n'], 'output': ['29\\r\\n']}, {'input': ['18 16 28 9\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['14 6 2 17\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['29 27 18 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['29 12 7 10\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['27 23 4 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 14 5 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 17 26 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['9 1 10 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['2 19 15 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 6 4 9\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 6 2 9\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2 2 9 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 2 4 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['27 24 5 27\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2683 83 26 2709\\r\\n'], 'output': ['101\\r\\n']}, {'input': ['728 412 789 158\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3964 4 2916 176\\r\\n'], 'output': ['991\\r\\n']}, {'input': ['3399 2035 2 3334\\r\\n'], 'output': ['683\\r\\n']}, {'input': ['3455 244 3301 3\\r\\n'], 'output': ['991\\r\\n']}, {'input': ['595 2263 3625 1\\r\\n'], 'output': ['595\\r\\n']}, {'input': ['4000 1 1 1\\r\\n'], 'output': ['4000\\r\\n']}, {'input': ['3999 2 2 3999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['25 6 8 11\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4000 500 1000 2000\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['53 10 11 23\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100 100 1 1\\r\\n'], 'output': ['100\\r\\n']}, {'input': ['17 3 4 10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['413 101 102 105\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['490 4 49 50\\r\\n'], 'output': ['111\\r\\n']}, {'input': ['3999 2 3 3\\r\\n'], 'output': ['1999\\r\\n']}, {'input': ['8 3 8 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 1 3 3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100 3 17 22\\r\\n'], 'output': ['27\\r\\n']}, {'input': ['4000 2 3 4\\r\\n'], 'output': ['2000\\r\\n']}, {'input': ['4000 3 3 5\\r\\n'], 'output': ['1332\\r\\n']}, {'input': ['13 4 6 7\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4000 5 2 2\\r\\n'], 'output': ['2000\\r\\n']}, {'input': ['3999 2 2 3\\r\\n'], 'output': ['1999\\r\\n']}, {'input': ['4000 33 7 3333\\r\\n'], 'output': ['564\\r\\n']}, {'input': ['60 33 20 9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100 9 11 99\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['2009 6 8 9\\r\\n'], 'output': ['334\\r\\n']}]","id":589} {"difficulty":1300,"lang":"D","lang_cluster":"D","src_uid":"192_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.string;\r\nimport std.conv;\r\n\r\n\r\nint main() {\r\n debug stdin = File(\"in.txt\", \"r\");\r\n\r\n int[44722] tri = void;\r\n foreach (i; 0 .. 44722) {\r\n tri[i] = i * (i + 1) \/ 2;\r\n }\r\n\r\n int n;\r\n readf(\" %s\\n\", &n);\r\n\r\n foreach (i; 0 .. 44722) {\r\n int a = tri[i];\r\n foreach (j; i .. 44722) {\r\n int b = tri[j];\r\n if (a + b >= n) {\r\n if (a + b > n) break;\r\n else {\r\n writeln(\"YES\");\r\n return 0;\r\n }\r\n }\r\n }\r\n }\r\n writeln(\"NO\");\r\n\r\n return 0;\r\n}\r\n","description":"As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are those that are representable as a sum of two triangular numbers.A well-known hipster Andrew adores everything funky and cool but unfortunately, he isn't good at maths. Given number n, help him define whether this number can be represented by a sum of two triangular numbers (not necessarily different)!","input_specification":"The first input line contains an integer n (1\u2264n\u226410^9).\n","output_specification":"Print \"YES\" (without the quotes), if n can be represented as a sum of two triangular numbers, otherwise print \"NO\" (without the quotes).\n","notes":"In the first sample number .\nIn the second sample number 512 can not be represented as a sum of two triangular numbers.\n","sample_inputs":["256\n","512\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"import std.stdio;\r\nimport std.range;\r\n\r\nint main() {\r\n debug stdin = File(\"in.txt\", \"r\");\r\n\r\n int[44722] tri = void;\r\n foreach (i; 0 .. 44722) {\r\n tri[i] = i * (i + 1) \/ 2;\r\n }\r\n\r\n int n;\r\n readf(\" %s\\n\", &n);\r\n\r\n int[] triRange = tri;\r\n auto asr = assumeSorted(triRange);\r\n foreach (i; 1 .. 44722) {\r\n int cand = n - tri[i];\r\n if (cand < 1) break;\r\n auto er = asr.equalRange(cand);\r\n if (!er.empty) {\r\n writeln(\"YES\");\r\n return 0;\r\n }\r\n }\r\n writeln(\"NO\");\r\n\r\n return 0;\r\n}\r\n","testcases":"[{'input': ['256\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['512\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['80\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['828\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6035\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['39210\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['79712\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['190492\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5722367\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['816761542\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['17\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['41\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['69\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['82\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['85\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['736\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['895\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['934\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6213\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['7405\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['9919\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['40942\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['41992\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['68535\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['405718\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1046146\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3761248\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6195181\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['35354345\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['81282830\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['187719774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['296798673\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['938938476\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999887464\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999111944\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999966520\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999912080\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999992017\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999990474\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999999190\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999999125\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999999940\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999999995\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999999999\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['83495494\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['968022000\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['399980000\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999999998\\r\\n'], 'output': ['NO\\r\\n']}]","id":590} {"difficulty":1000,"lang":"D","lang_cluster":"D","src_uid":"1_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\n\r\nvoid main() {\r\n int n, m, a;\r\n readf(\"%s %s %s\\n\", n, m, a);\r\n writeln(((n + a - 1) \/ a) * ((m + a - 1) \/ a));\r\n}","description":"Theatre Square in the capital city of Berland has a rectangular shape with the size n\u00d7m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a\u00d7a.What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.","input_specification":"The input contains three positive integer numbers in the first line: n,m and a (1\u2264n,m,a\u226410^9).\n","output_specification":"Write the needed number of flagstones.\n","notes":null,"sample_inputs":["6 6 4\n"],"sample_outputs":["4\n"],"human_solution":"import std;\r\n\r\nvoid main() {\r\n long n, m, a;\r\n readf(\"%d %d %d\\n\", n, m, a);\r\n\r\n long x = (n + a - 1) \/ a, y = (m + a - 1) \/ a;\r\n\r\n long res = x * y;\r\n res.writeln;\r\n}","testcases":"[{'input': ['6 6 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 3 4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 1\\r\\n'], 'output': ['1000000000000000000\\r\\n']}, {'input': ['12 13 4\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['222 332 5\\r\\n'], 'output': ['3015\\r\\n']}, {'input': ['1000 1000 10\\r\\n'], 'output': ['10000\\r\\n']}, {'input': ['1001 1000 10\\r\\n'], 'output': ['10100\\r\\n']}, {'input': ['100 10001 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 999999999\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1000000000 1000000000 192\\r\\n'], 'output': ['27126743055556\\r\\n']}, {'input': ['1000000000 987654321 1\\r\\n'], 'output': ['987654321000000000\\r\\n']}, {'input': ['456784567 1000000000 51\\r\\n'], 'output': ['175618850864484\\r\\n']}, {'input': ['39916800 134217728 40320\\r\\n'], 'output': ['3295710\\r\\n']}]","id":591} {"difficulty":1200,"lang":"D","lang_cluster":"D","src_uid":"203_A","execute_outcome":"WRONG_ANSWER","source_code":"module cf_203A;\r\n\r\nimport std.stdio;\r\n\r\nvoid main() {\r\n int x, t, a, b, da, db;\r\n\r\n readf(\"%d %d %d %d %d %d\", &x, &t, &a, &b, &da, &db);\r\n\r\n bool valeraSaidTrue = false;\r\n int aa = a;\r\n\r\n dualFor:\r\n for (int i = 0; i < t; ++i) {\r\n int bb = b;\r\n\r\n for (int j = 0; j < t; ++j) {\r\n if (aa + bb == x) {\r\n valeraSaidTrue = true;\r\n break dualFor;\r\n }\r\n bb -= db;\r\n }\r\n aa -= da;\r\n }\r\n\r\n if (x == a || x == b || x == 0) {\r\n valeraSaidTrue = true;\r\n }\r\n\r\n writeln(valeraSaidTrue? \"YES\": \"NO\");\r\n}","description":"A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend's words and decided to check whether Valera could have shown such a result.He knows that the contest number 300 was unusual because there were only two problems. The contest lasted for t minutes, the minutes are numbered starting from zero. The first problem had the initial cost of a points, and every minute its cost reduced by da points. The second problem had the initial cost of b points, and every minute this cost reduced by db points. Thus, as soon as the zero minute of the contest is over, the first problem will cost a-da points, and the second problem will cost b-db points. It is guaranteed that at any moment of the contest each problem has a non-negative cost.Arkady asks you to find out whether Valera could have got exactly x points for this contest. You should assume that Valera could have solved any number of the offered problems. You should also assume that for each problem Valera made no more than one attempt, besides, he could have submitted both problems at the same minute of the contest, starting with minute 0 and ending with minute number t-1. Please note that Valera can't submit a solution exactly t minutes after the start of the contest or later.","input_specification":"The single line of the input contains six integers x,t,a,b,da,db (0\u2264x\u2264600;\u00a01\u2264t,a,b,da,db\u2264300) \u2014 Valera's result, the contest's duration, the initial cost of the first problem, the initial cost of the second problem, the number of points that the first and the second problem lose per minute, correspondingly.\nIt is guaranteed that at each minute of the contest each problem has a non-negative cost, that is, a-i\u00b7da\u22650 and b-i\u00b7db\u22650 for all 0\u2264i\u2264t-1.\n","output_specification":"If Valera could have earned exactly x points at a contest, print \"YES\", otherwise print \"NO\" (without the quotes).\n","notes":"In the first sample Valera could have acted like this: he could have submitted the first problem at minute 0 and the second problem \u2014 at minute 2. Then the first problem brings him 20 points and the second problem brings him 10 points, that in total gives the required 30 points.\n","sample_inputs":["30 5 20 20 3 5\n","10 4 100 5 5 1\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"module cf_203A;\r\n\r\nimport std.stdio;\r\n\r\nvoid main() {\r\n int x, t, a, b, da, db;\r\n\r\n readf(\"%d %d %d %d %d %d\", &x, &t, &a, &b, &da, &db);\r\n\r\n bool valeraSaidTrue = false;\r\n int aa = a;\r\n\r\n dualFor:\r\n for (int i = 0; i <= t; ++i) {\r\n int bb = b;\r\n\r\n if (i == t) {\r\n aa = 0;\r\n }\r\n for (int j = 0; j <= t; ++j) {\r\n if (j == t) {\r\n bb = 0;\r\n }\r\n if (aa + bb == x) {\r\n valeraSaidTrue = true;\r\n break dualFor;\r\n }\r\n bb -= db;\r\n }\r\n aa -= da;\r\n }\r\n\r\n writeln(valeraSaidTrue? \"YES\": \"NO\");\r\n}","testcases":"[{'input': ['30 5 20 20 3 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 4 100 5 5 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['0 7 30 50 3 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50 10 30 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['40 1 40 5 11 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['35 8 20 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 2 27 4 11 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['64 12 258 141 10 7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5 3 11 100 2 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 4 11 80 2 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['28 3 16 20 3 10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 2 11 1 11 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15 5 230 213 32 25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['223 92 123 118 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['375 6 133 267 19 36\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['80 5 39 40 1 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['543 4 31 69 6 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['38 100 99 245 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 1 20 15 17 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['360 5 215 4 52 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['363 2 280 239 5 231\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['46 7 18 6 3 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 3 135 12 21 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15 5 230 213 32 25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 5 29 36 5 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['59 4 113 45 25 12\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['74 72 104 71 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16 24 26 23 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['11 1 10 1 10 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['13 3 11 14 5 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 2 1 2 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['145 26 25 150 1 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['59 18 50 17 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['230 125 175 124 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['142 1 66 76 18 39\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 3 5 6 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6 46 95 45 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16 73 92 72 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 18 272 17 6 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 21 178 20 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 15 86 84 5 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 35 208 98 6 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 11 67 82 6 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['30 9 18 83 1 7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['18 12 11 54 1 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['41 77 96 145 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['27 45 44 169 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50 5 30 60 3 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['49 2 50 20 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['49 2 50 20 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['17 10 10 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}]","id":592} {"difficulty":1200,"lang":"D","lang_cluster":"D","src_uid":"217_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.conv;\r\nimport std.string;\r\nimport std.typecons;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.range;\r\nimport std.math;\r\n\r\nvoid main()\r\n{\r\n auto n = readln().chomp().to!int();\r\n auto p = new int[][](n, 2);\r\n auto f = new bool[n];\r\n\r\n foreach (i; iota(n)) {\r\n p[i] = readln().split().map!(to!int)().array();\r\n }\r\n\r\n foreach (i; iota(n)) {\r\n foreach (j; iota(n)) {\r\n if (i == j) continue;\r\n if (p[i][0] == p[j][0] || p[i][1] == p[j][1]) {\r\n f[j] = 1;\r\n }\r\n }\r\n }\r\n\r\n int cnt;\r\n foreach (i; iota(n)) {\r\n if (!f[i]) cnt++;\r\n }\r\n\r\n writeln(cnt ? cnt - 1 : 0);\r\n}","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\u2264n\u2264100) \u2014 the number of snow drifts. Each of the following n lines contains two integers xi and yi (1\u2264xi,yi\u22641000) \u2014 the coordinates of the i-th snow drift.\nNote 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.\n","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.\n","notes":null,"sample_inputs":["2\n2 1\n1 2\n","2\n2 1\n4 1\n"],"sample_outputs":["1\n","0\n"],"human_solution":"import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;\r\nimport std.uni, std.math, std.container, std.typecons, std.typetuple;\r\nimport core.bitop, std.datetime;\r\n\r\nimmutable int mod = 10^^9 + 7;\r\n\r\nvoid main(){\r\n int n = readln.chomp.to!int;\r\n\r\n auto x = new int[](n);\r\n auto y = new int[](n);\r\n\r\n foreach(i ; 0 .. n){\r\n readVars(x[i], y[i]);\r\n }\r\n\r\n auto visited = new bool[](n);\r\n\r\n int ans;\r\n\r\n foreach(i ; 0 .. n){\r\n if(!visited[i]){\r\n dfs(n, x, y, visited, i);\r\n ans++;\r\n }\r\n }\r\n\r\n writeln(ans - 1);\r\n}\r\n\r\nvoid dfs(int n, int[] x, int[] y, bool[] visited, int i) {\r\n visited[i] = true;\r\n\r\n foreach(j ; 0 .. n){\r\n if((x[j] == x[i] || y[j] == y[i]) && !visited[j]){\r\n dfs(n, x, y, visited, j);\r\n }\r\n }\r\n}\r\n\r\n\r\nvoid readVars(T...)(auto ref T args){\r\n auto line = readln.split;\r\n foreach(ref arg ; args){\r\n arg = line.front.to!(typeof(arg));\r\n line.popFront;\r\n }\r\n if(!line.empty){\r\n writeln(line);\r\n throw new Exception(\"args num < input num\");\r\n }\r\n}","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":593} {"difficulty":1400,"lang":"D","lang_cluster":"D","src_uid":"233_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\nimport std.math;\nimport std.algorithm;\n\nvoid main() {\n\tlong N, ans =1000000000+42;\n\treadf(\" %d\",&N);\n\tfor(int i =0; i < 100; i++) {\n\t\treal D =sqrt(1.0*i*i+4.0*N);\n\t\tif(fabs(D*D-i*i-4*N) > 1e-9) continue;\n\t\tlong x =cast(long)(round(D));\n\t\tif((x-i)%2 != 0) continue;\n\t\tx =(x-i)\/2;\n\t\t\n\t\tint s =0; long y =x;\n\t\twhile(y > 0) {\n\t\t\ts +=y%10;\n\t\t\ty \/=10;}\n\t\t\n\t\tif(s == i) ans =min(ans,x);}\n\t\n\tif(ans > 1000000000) writeln(-1);\n\telse writeln(ans);}\n \t \t \t \t \t \t\t \t \t\t\t \t","description":"Let's consider equation:x^2+s(x)\u00b7x-n=0, where x,n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer n, find the smallest positive integer root of equation x, or else determine that there are no such roots.","input_specification":"A single line contains integer n (1\u2264n\u226410^18) \u2014 the equation parameter.\nPlease, 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. \n","output_specification":"Print -1, if the equation doesn't have integer positive roots. Otherwise print such smallest integer x (x>0), that the equation given in the statement holds.\n","notes":"In the first test case x=1 is the minimum root. As s(1)=1 and 1^2+1\u00b71-2=0.\nIn the second test case x=10 is the minimum root. As s(10)=1+0=1 and 10^2+1\u00b710-110=0.\nIn the third test case the equation has no roots.\n","sample_inputs":["2\n","110\n","4\n"],"sample_outputs":["1\n","10\n","-1\n"],"human_solution":"import std.stdio, std.math;\n\nint s(long n) {\n\tint t = 0;\n\twhile (n > 0) {\n\t\tt += n % 10;\n\t\tn \/= 10;\n\t}\n\treturn t;\n}\n\nint m(long n) {\n\tint t = 0;\n\twhile (n > 0) { t++; n \/= 10; }\n\treturn t * 9;\n}\n\n\/*\nx^2 + tx > n\nx^2 + tx + t^2\/4 > n + t^2\/4\nx + t\/2 > sqrt(4n^2+t^2)\/2\nx > sqrt(4n^2+t^2)\/2-t\/2\n*\/\n\nlong solve(long n) {\n\tlong r = cast(long) sqrt(n * 1.0);\n\tlong t = m(r);\n\tlong l = cast(long) (sqrt(4.0 * n + 1.0 * t * t) \/ 2 - t \/ 2);\n\tif (l == 0) l++;\n\twhile (l <= r) {\n\t\tif (n % l == 0) {\n\t\t\tif (l * (l + s(l)) == n) return l;\n\t\t}\n\t\tl++;\n\t}\n\treturn -1;\n}\n\nvoid main() {\n\tlong n;\n\treadf(\"%d\", &n);\n\twriteln(solve(n));\n}\n","testcases":"[{'input': ['2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['110\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10000000100000000\\r\\n'], 'output': ['100000000\\r\\n']}, {'input': ['10000006999999929\\r\\n'], 'output': ['99999999\\r\\n']}, {'input': ['172541340\\r\\n'], 'output': ['13131\\r\\n']}, {'input': ['172580744\\r\\n'], 'output': ['13132\\r\\n']}, {'input': ['10000100000\\r\\n'], 'output': ['100000\\r\\n']}, {'input': ['1000001000000\\r\\n'], 'output': ['1000000\\r\\n']}, {'input': ['100000010000000\\r\\n'], 'output': ['10000000\\r\\n']}, {'input': ['425\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1085\\r\\n'], 'output': ['31\\r\\n']}, {'input': ['4296409065\\r\\n'], 'output': ['65535\\r\\n']}, {'input': ['9211004165221796\\r\\n'], 'output': ['95973949\\r\\n']}, {'input': ['1245131330556680\\r\\n'], 'output': ['35286397\\r\\n']}, {'input': ['40000000400000000\\r\\n'], 'output': ['200000000\\r\\n']}, {'input': ['90000000900000000\\r\\n'], 'output': ['300000000\\r\\n']}, {'input': ['160000001600000000\\r\\n'], 'output': ['400000000\\r\\n']}, {'input': ['250000002500000000\\r\\n'], 'output': ['500000000\\r\\n']}, {'input': ['360000003600000000\\r\\n'], 'output': ['600000000\\r\\n']}, {'input': ['490000004900000000\\r\\n'], 'output': ['700000000\\r\\n']}, {'input': ['640000006400000000\\r\\n'], 'output': ['800000000\\r\\n']}, {'input': ['810000008100000000\\r\\n'], 'output': ['900000000\\r\\n']}, {'input': ['902500013300000000\\r\\n'], 'output': ['950000000\\r\\n']}, {'input': ['790123519209876480\\r\\n'], 'output': ['888888888\\r\\n']}, {'input': ['100000609999938\\r\\n'], 'output': ['9999999\\r\\n']}, {'input': ['1000051999947\\r\\n'], 'output': ['999999\\r\\n']}, {'input': ['10004299956\\r\\n'], 'output': ['99999\\r\\n']}, {'input': ['40000014199999928\\r\\n'], 'output': ['199999999\\r\\n']}, {'input': ['90000021599999927\\r\\n'], 'output': ['299999999\\r\\n']}, {'input': ['160000029199999926\\r\\n'], 'output': ['399999999\\r\\n']}, {'input': ['250000036999999925\\r\\n'], 'output': ['499999999\\r\\n']}, {'input': ['360000044999999924\\r\\n'], 'output': ['599999999\\r\\n']}, {'input': ['810000070199999921\\r\\n'], 'output': ['899999999\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['980100017820000000\\r\\n'], 'output': ['990000000\\r\\n']}, {'input': ['990025022885000000\\r\\n'], 'output': ['995000000\\r\\n']}, {'input': ['9999999900000001\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['99999999999999999\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['89997012024799500\\r\\n'], 'output': ['299994990\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['999999999999999997\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['999999887000001932\\r\\n'], 'output': ['999999908\\r\\n']}, {'input': ['162\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['999920076596999923\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['9999956110095370\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['999999863000003700\\r\\n'], 'output': ['999999900\\r\\n']}]","id":594} {"difficulty":1500,"lang":"D","lang_cluster":"D","src_uid":"24_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.string;\nimport std.stdio;\nimport std.conv;\nimport std.algorithm;\nimport std.typecons;\nimport std.range;\nimport std.array;\n\nvoid main()\n{\n int[][string] positions;\n int [string] points;\n auto n = readln.chomp.to!int;\n foreach(i; 0..n )\n {\n auto m = readln.chomp.to!int;\n foreach(j; 0..m )\n {\n auto s = readln.chomp; \n if (! (s in positions)) \n positions[s] = repeat(0).take(50).array;\n positions[s] = positions[s].zip(repeat(0).take(j).array ~ [1] ~ repeat(0).take(50-j-1).array).map!\"a[0]+a[1]\".array;\n points[s] += ([25, 18, 15, 12, 10, 8, 6, 4, 2, 1] ~ repeat(0).take(40).array)[j];\n }\n }\n\n Tuple!(string, int,int[])[] arr;\n foreach(k,v; points) \n arr~=tuple(k,v,positions[k]);\n \/\/writeln(arr);\n arr.multiSort!(\"a[1]>b[1]\", \n \"a[2][0] > b[2][0] \", \" a[2][1] > b[2][1] \", \" a[2][2] > b[2][2] \", \n \"a[2][3] > b[2][3] \", \" a[2][4] > b[2][4] \", \" a[2][5] > b[2][5] \", \n \"a[2][6] > b[2][6] \", \" a[2][7] > b[2][7] \", \" a[2][8] > b[2][8] \", \n \"a[2][9] > b[2][9] \", \" a[2][10] > b[2][10] \", \" a[2][11] > b[2][11] \", \n \"a[2][12] > b[2][12] \", \" a[2][13] > b[2][13] \", \" a[2][14] > b[2][14] \", \n \"a[2][15] > b[2][15] \", \" a[2][16] > b[2][16] \", \" a[2][17] > b[2][17] \", \n \"a[2][18] > b[2][18] \", \" a[2][19] > b[2][19] \", \" a[2][20] > b[2][20] \", \n \"a[2][21] > b[2][21] \", \" a[2][22] > b[2][22] \", \" a[2][23] > b[2][23] \", \n \"a[2][24] > b[2][24] \", \" a[2][25] > b[2][25] \", \" a[2][26] > b[2][26] \", \n \"a[2][27] > b[2][27] \", \" a[2][28] > b[2][28] \", \" a[2][29] > b[2][29] \", \n \"a[2][30] > b[2][30] \", \" a[2][31] > b[2][31] \", \" a[2][32] > b[2][32] \", \n \"a[2][33] > b[2][33] \", \" a[2][34] > b[2][34] \", \" a[2][35] > b[2][35] \", \n \"a[2][36] > b[2][36] \", \" a[2][37] > b[2][37] \", \" a[2][38] > b[2][38] \", \n \"a[2][39] > b[2][39] \", \" a[2][40] > b[2][40] \", \" a[2][41] > b[2][41] \", \n \"a[2][42] > b[2][42] \", \" a[2][43] > b[2][43] \", \" a[2][44] > b[2][44] \", \n \"a[2][45] > b[2][45] \", \" a[2][46] > b[2][46] \", \" a[2][47] > b[2][47] \", \n \"a[2][48] > b[2][48] \", \" a[2][49] > b[2][49] \");\n writeln(arr[0][0]);\n arr.multiSort!(\n \"a[2][0] > b[2][0] \", \" a[2][1] > b[2][1] \", \" a[2][2] > b[2][2] \", \n \"a[2][3] > b[2][3] \", \" a[2][4] > b[2][4] \", \" a[2][5] > b[2][5] \", \n \"a[2][6] > b[2][6] \", \" a[2][7] > b[2][7] \", \" a[2][8] > b[2][8] \", \n \"a[2][9] > b[2][9] \", \" a[2][10] > b[2][10] \", \" a[2][11] > b[2][11] \", \n \"a[2][12] > b[2][12] \", \" a[2][13] > b[2][13] \", \" a[2][14] > b[2][14] \", \n \"a[2][15] > b[2][15] \", \" a[2][16] > b[2][16] \", \" a[2][17] > b[2][17] \", \n \"a[2][18] > b[2][18] \", \" a[2][19] > b[2][19] \", \" a[2][20] > b[2][20] \", \n \"a[2][21] > b[2][21] \", \" a[2][22] > b[2][22] \", \" a[2][23] > b[2][23] \", \n \"a[2][24] > b[2][24] \", \" a[2][25] > b[2][25] \", \" a[2][26] > b[2][26] \", \n \"a[2][27] > b[2][27] \", \" a[2][28] > b[2][28] \", \" a[2][29] > b[2][29] \", \n \"a[2][30] > b[2][30] \", \" a[2][31] > b[2][31] \", \" a[2][32] > b[2][32] \", \n \"a[2][33] > b[2][33] \", \" a[2][34] > b[2][34] \", \" a[2][35] > b[2][35] \", \n \"a[2][36] > b[2][36] \", \" a[2][37] > b[2][37] \", \" a[2][38] > b[2][38] \", \n \"a[2][39] > b[2][39] \", \" a[2][40] > b[2][40] \", \" a[2][41] > b[2][41] \", \n \"a[2][42] > b[2][42] \", \" a[2][43] > b[2][43] \", \" a[2][44] > b[2][44] \", \n \"a[2][45] > b[2][45] \", \" a[2][46] > b[2][46] \", \" a[2][47] > b[2][47] \", \n \"a[2][48] > b[2][48] \", \" a[2][49] > b[2][49] \");\n writeln(arr[0][0]);\n}\n ","description":"Formula One championship consists of series of races called Grand Prix. After every race drivers receive points according to their final position. Only the top 10 drivers receive points in the following order 25, 18, 15, 12, 10, 8, 6, 4, 2, 1. At the conclusion of the championship the driver with most points is the champion. If there is a tie, champion is the one with most wins (i.e. first places). If a tie still exists, it is chosen the one with most second places, and so on, until there are no more place to use for compare. Last year another scoring system was proposed but rejected. In it the champion is the one with most wins. If there is tie, champion is the one with most points. If a tie still exists it is proceeded the same way as in the original scoring system, that is comparing number of second, third, forth, and so on, places.You are given the result of all races during the season and you are to determine the champion according to both scoring systems. It is guaranteed, that both systems will produce unique champion.","input_specification":"The first line contain integer t (1\u2264t\u226420), where t is the number of races. After that all races are described one by one. Every race description start with an integer n (1\u2264n\u226450) on a line of itself, where n is the number of clasified drivers in the given race. After that n lines follow with the classification for the race, each containing the name of a driver. The names of drivers are given in order from the first to the last place. The name of the driver consists of lowercase and uppercase English letters and has length at most 50 characters. Comparing of names should be case-sensetive.\n","output_specification":"Your output should contain exactly two line. On the first line is the name of the champion according to the original rule, and on the second line the name of the champion according to the alternative rule.\n","notes":"It is not guaranteed that the same drivers participate in all races. For the championship consider every driver that has participated in at least one race. The total number of drivers during the whole season is not more then 50.\n","sample_inputs":["3\n3\nHamilton\nVettel\nWebber\n2\nWebber\nVettel\n2\nHamilton\nVettel\n","2\n7\nProst\nSurtees\nNakajima\nSchumacher\nButton\nDeLaRosa\nBuemi\n8\nAlonso\nProst\nNinoFarina\nJimClark\nDeLaRosa\nNakajima\nPatrese\nSurtees\n"],"sample_outputs":["Vettel\nHamilton\n","Prost\nProst\n"],"human_solution":"import std.string;\nimport std.stdio;\nimport std.conv;\nimport std.algorithm;\nimport std.typecons;\nimport std.range;\nimport std.array;\n\nvoid main()\n{\n Tuple!(int,int[])[string] players;\n auto n = readln.chomp.to!int;\n foreach(i; 0..n )\n {\n auto m = readln.chomp.to!int;\n foreach(j; 0..m )\n {\n auto s = readln.chomp; \n auto t = players.require(s, tuple(0, repeat(0).take(50).array));\n players[s][0] = t[0] + ([25, 18, 15, 12, 10, 8, 6, 4, 2, 1] ~ repeat(0).take(40).array)[j];\n players[s][1] = t[1].zip(chain(repeat(0).take(j), only(1) , repeat(0).take(50-j-1))).map!\"a[0]+a[1]\".array;\n }\n }\n auto arr = players.byPair.array;\n arr.multiSort!(\n \"a.value[0] > b.value[0]\",\n \"a.value[1][0] > b.value[1][0] \",\n \"a.value[1][1] > b.value[1][1] \",\n \"a.value[1][2] > b.value[1][2] \",\n \"a.value[1][3] > b.value[1][3] \",\n \"a.value[1][4] > b.value[1][4] \",\n \"a.value[1][5] > b.value[1][5] \",\n \"a.value[1][6] > b.value[1][6] \",\n \"a.value[1][7] > b.value[1][7] \",\n \"a.value[1][8] > b.value[1][8] \",\n \"a.value[1][9] > b.value[1][9] \",\n \"a.value[1][10] > b.value[1][10] \",\n \"a.value[1][11] > b.value[1][11] \",\n \"a.value[1][12] > b.value[1][12] \",\n \"a.value[1][13] > b.value[1][13] \",\n \"a.value[1][14] > b.value[1][14] \",\n \"a.value[1][15] > b.value[1][15] \",\n \"a.value[1][16] > b.value[1][16] \",\n \"a.value[1][17] > b.value[1][17] \",\n \"a.value[1][18] > b.value[1][18] \",\n \"a.value[1][19] > b.value[1][19] \",\n \"a.value[1][20] > b.value[1][20] \",\n \"a.value[1][21] > b.value[1][21] \",\n \"a.value[1][22] > b.value[1][22] \",\n \"a.value[1][23] > b.value[1][23] \",\n \"a.value[1][24] > b.value[1][24] \",\n \"a.value[1][25] > b.value[1][25] \",\n \"a.value[1][26] > b.value[1][26] \",\n \"a.value[1][27] > b.value[1][27] \",\n \"a.value[1][28] > b.value[1][28] \",\n \"a.value[1][29] > b.value[1][29] \",\n \"a.value[1][30] > b.value[1][30] \",\n \"a.value[1][31] > b.value[1][31] \",\n \"a.value[1][32] > b.value[1][32] \",\n \"a.value[1][33] > b.value[1][33] \",\n \"a.value[1][34] > b.value[1][34] \",\n \"a.value[1][35] > b.value[1][35] \",\n \"a.value[1][36] > b.value[1][36] \",\n \"a.value[1][37] > b.value[1][37] \",\n \"a.value[1][38] > b.value[1][38] \",\n \"a.value[1][39] > b.value[1][39] \",\n \"a.value[1][40] > b.value[1][40] \");\n writeln(arr[0][0]);\n arr.multiSort!(\n \"a.value[1][0] > b.value[1][0] \",\n \"a.value[0] > b.value[0]\", \n \"a.value[1][1] > b.value[1][1] \",\n \"a.value[1][2] > b.value[1][2] \",\n \"a.value[1][3] > b.value[1][3] \",\n \"a.value[1][4] > b.value[1][4] \",\n \"a.value[1][5] > b.value[1][5] \",\n \"a.value[1][6] > b.value[1][6] \",\n \"a.value[1][7] > b.value[1][7] \",\n \"a.value[1][8] > b.value[1][8] \",\n \"a.value[1][9] > b.value[1][9] \",\n \"a.value[1][10] > b.value[1][10] \",\n \"a.value[1][11] > b.value[1][11] \",\n \"a.value[1][12] > b.value[1][12] \",\n \"a.value[1][13] > b.value[1][13] \",\n \"a.value[1][14] > b.value[1][14] \",\n \"a.value[1][15] > b.value[1][15] \",\n \"a.value[1][16] > b.value[1][16] \",\n \"a.value[1][17] > b.value[1][17] \",\n \"a.value[1][18] > b.value[1][18] \",\n \"a.value[1][19] > b.value[1][19] \",\n \"a.value[1][20] > b.value[1][20] \",\n \"a.value[1][21] > b.value[1][21] \",\n \"a.value[1][22] > b.value[1][22] \",\n \"a.value[1][23] > b.value[1][23] \",\n \"a.value[1][24] > b.value[1][24] \",\n \"a.value[1][25] > b.value[1][25] \",\n \"a.value[1][26] > b.value[1][26] \",\n \"a.value[1][27] > b.value[1][27] \",\n \"a.value[1][28] > b.value[1][28] \",\n \"a.value[1][29] > b.value[1][29] \",\n \"a.value[1][30] > b.value[1][30] \",\n \"a.value[1][31] > b.value[1][31] \",\n \"a.value[1][32] > b.value[1][32] \",\n \"a.value[1][33] > b.value[1][33] \",\n \"a.value[1][34] > b.value[1][34] \",\n \"a.value[1][35] > b.value[1][35] \",\n \"a.value[1][36] > b.value[1][36] \",\n \"a.value[1][37] > b.value[1][37] \",\n \"a.value[1][38] > b.value[1][38] \",\n \"a.value[1][39] > b.value[1][39] \",\n \"a.value[1][40] > b.value[1][40] \");\n writeln(arr[0][0]);\n}\n ","testcases":"[{'input': ['3\\r\\n3\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\n2\\r\\nWebber\\r\\nVettel\\r\\n2\\r\\nHamilton\\r\\nVettel\\r\\n'], 'output': ['Vettel\\r\\nHamilton\\r\\n']}, {'input': ['2\\r\\n7\\r\\nProst\\r\\nSurtees\\r\\nNakajima\\r\\nSchumacher\\r\\nButton\\r\\nDeLaRosa\\r\\nBuemi\\r\\n8\\r\\nAlonso\\r\\nProst\\r\\nNinoFarina\\r\\nJimClark\\r\\nDeLaRosa\\r\\nNakajima\\r\\nPatrese\\r\\nSurtees\\r\\n'], 'output': ['Prost\\r\\nProst\\r\\n']}, {'input': ['5\\r\\n3\\r\\nWebber\\r\\nTrulli\\r\\nJones\\r\\n9\\r\\nVilleneuve\\r\\nBerger\\r\\nJimClark\\r\\nReneArnoux\\r\\nKubica\\r\\nJones\\r\\nScheckter\\r\\nKobayashi\\r\\nJamesHunt\\r\\n10\\r\\nTrulli\\r\\nJackBrabham\\r\\nKobayashi\\r\\nNakajima\\r\\nAndretti\\r\\nScheckter\\r\\nDeLaRosa\\r\\nReneArnoux\\r\\nKovalainen\\r\\nJones\\r\\n3\\r\\nBerger\\r\\nJimClark\\r\\nTrulli\\r\\n15\\r\\nNakajima\\r\\nVilleneuve\\r\\nBerger\\r\\nTrulli\\r\\nJamesHunt\\r\\nMassa\\r\\nReneArnoux\\r\\nKubica\\r\\nJimClark\\r\\nDeLaRosa\\r\\nJackBrabham\\r\\nHill\\r\\nKobayashi\\r\\ndiGrassi\\r\\nJones\\r\\n'], 'output': ['Trulli\\r\\nTrulli\\r\\n']}, {'input': ['2\\r\\n18\\r\\nKubica\\r\\nHawthorn\\r\\nSurtees\\r\\nBerger\\r\\nKobayashi\\r\\nWebber\\r\\nJackBrabham\\r\\nJimClark\\r\\nPatrese\\r\\nJones\\r\\nHakkinen\\r\\nJackieStewert\\r\\nMensel\\r\\nSenna\\r\\nHamilton\\r\\nAlonso\\r\\nHulkenberg\\r\\nBarichelo\\r\\n9\\r\\nHawthorn\\r\\nSutil\\r\\nBarichelo\\r\\nJackieStewert\\r\\nJones\\r\\nScheckter\\r\\nPiquet\\r\\nLiuzzi\\r\\nKovalainen\\r\\n'], 'output': ['Hawthorn\\r\\nHawthorn\\r\\n']}, {'input': ['6\\r\\n2\\r\\nAlbertoAscari\\r\\nHamilton\\r\\n5\\r\\nScheckter\\r\\nAlguersuari\\r\\nVettel\\r\\nPetrov\\r\\nProst\\r\\n5\\r\\nAlbertoAscari\\r\\nScheckter\\r\\nAlguersuari\\r\\nVettel\\r\\nHamilton\\r\\n3\\r\\nScheckter\\r\\nHamilton\\r\\nAlguersuari\\r\\n3\\r\\nAlbertoAscari\\r\\nScheckter\\r\\nProst\\r\\n4\\r\\nAlbertoAscari\\r\\nAlguersuari\\r\\nScheckter\\r\\nHamilton\\r\\n'], 'output': ['Scheckter\\r\\nAlbertoAscari\\r\\n']}, {'input': ['15\\r\\n3\\r\\nSenna\\r\\nFittipaldi\\r\\nLauda\\r\\n2\\r\\nSenna\\r\\nFittipaldi\\r\\n2\\r\\nFittipaldi\\r\\nLauda\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nFittipaldi\\r\\nSenna\\r\\nLauda\\r\\n1\\r\\nSenna\\r\\n3\\r\\nSenna\\r\\nFittipaldi\\r\\nLauda\\r\\n1\\r\\nLauda\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nSenna\\r\\nFittipaldi\\r\\n2\\r\\nLauda\\r\\nSenna\\r\\n1\\r\\nSenna\\r\\n3\\r\\nFittipaldi\\r\\nLauda\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nFittipaldi\\r\\nSenna\\r\\n3\\r\\nLauda\\r\\nSenna\\r\\nFittipaldi\\r\\n'], 'output': ['Senna\\r\\nLauda\\r\\n']}, {'input': ['11\\r\\n4\\r\\nLauda\\r\\nRosberg\\r\\nBerger\\r\\nBarichelo\\r\\n4\\r\\nGlock\\r\\nPatrese\\r\\nBarichelo\\r\\nLauda\\r\\n7\\r\\nGlock\\r\\nBarichelo\\r\\nSchumacher\\r\\nLauda\\r\\nPatrese\\r\\nBerger\\r\\nRosberg\\r\\n4\\r\\nBerger\\r\\nRosberg\\r\\nPatrese\\r\\nBarichelo\\r\\n3\\r\\nSchumacher\\r\\nGlock\\r\\nPatrese\\r\\n1\\r\\nBarichelo\\r\\n1\\r\\nBarichelo\\r\\n5\\r\\nRosberg\\r\\nBerger\\r\\nGlock\\r\\nBarichelo\\r\\nPatrese\\r\\n1\\r\\nBerger\\r\\n3\\r\\nBerger\\r\\nSchumacher\\r\\nLauda\\r\\n4\\r\\nRosberg\\r\\nSchumacher\\r\\nBarichelo\\r\\nLauda\\r\\n'], 'output': ['Barichelo\\r\\nBerger\\r\\n']}, {'input': ['2\\r\\n11\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\nButton\\r\\nKubica\\r\\nPetrov\\r\\nRoseberg\\r\\nSchumacher\\r\\nAlonson\\r\\nMassa\\r\\nSenna\\r\\n10\\r\\nSenna\\r\\nKobayashi\\r\\nDeLaRosa\\r\\nHakkinen\\r\\nRaikkonen\\r\\nProst\\r\\nJimClark\\r\\nNakajima\\r\\nBerger\\r\\nAlbertoAscari\\r\\n'], 'output': ['Senna\\r\\nSenna\\r\\n']}, {'input': ['2\\r\\n10\\r\\nHamilton\\r\\nVettel\\r\\nWebber\\r\\nButton\\r\\nKubica\\r\\nPetrov\\r\\nRoseberg\\r\\nSchumacher\\r\\nAlonson\\r\\nMassa\\r\\n11\\r\\nSenna\\r\\nKobayashi\\r\\nDeLaRosa\\r\\nHakkinen\\r\\nRaikkonen\\r\\nProst\\r\\nJimClark\\r\\nNakajima\\r\\nBerger\\r\\nAlbertoAscari\\r\\nHamilton\\r\\n'], 'output': ['Hamilton\\r\\nHamilton\\r\\n']}, {'input': ['1\\r\\n50\\r\\nJamesHunt\\r\\nNakajima\\r\\nHakkinen\\r\\nScheckter\\r\\nJones\\r\\nHill\\r\\nHawthorn\\r\\nVettel\\r\\nHulkenberg\\r\\nSutil\\r\\nGlock\\r\\nWebber\\r\\nAlbertoAscari\\r\\nMensel\\r\\nBuemi\\r\\nKubica\\r\\ndiGrassi\\r\\nJimClark\\r\\nKovalainen\\r\\nTrulli\\r\\nBarichelo\\r\\nSurtees\\r\\nJackieStewert\\r\\nLauda\\r\\nRaikkonen\\r\\nVilleneuve\\r\\nFangio\\r\\nButton\\r\\nDeLaRosa\\r\\nProst\\r\\nRosberg\\r\\nAlonso\\r\\nBerger\\r\\nPatrese\\r\\nHamilton\\r\\nJochenRindt\\r\\nNinoFarina\\r\\nKobayashi\\r\\nFittipaldi\\r\\nAlguersuari\\r\\nDennyHulme\\r\\nSchumacher\\r\\nPetrov\\r\\nPiquet\\r\\nAndretti\\r\\nJackBrabham\\r\\nMassa\\r\\nSenna\\r\\nLiuzzi\\r\\nReneArnoux\\r\\n'], 'output': ['JamesHunt\\r\\nJamesHunt\\r\\n']}, {'input': ['1\\r\\n1\\r\\nA\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['2\\r\\n1\\r\\nA\\r\\n1\\r\\nA\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['2\\r\\n2\\r\\nA\\r\\nB\\r\\n2\\r\\nA\\r\\nC\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['3\\r\\n2\\r\\nA\\r\\nB\\r\\n2\\r\\nA\\r\\nD\\r\\n2\\r\\nA\\r\\nC\\r\\n'], 'output': ['A\\r\\nA\\r\\n']}, {'input': ['20\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n'], 'output': ['b\\r\\nb\\r\\n']}, {'input': ['20\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n'], 'output': ['b\\r\\nb\\r\\n']}, {'input': ['20\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nba\\r\\nb\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nba\\r\\na\\r\\nab\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n'], 'output': ['ab\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n'], 'output': ['ab\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nab\\r\\nb\\r\\n4\\r\\nab\\r\\na\\r\\nba\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\na\\r\\nb\\r\\nba\\r\\nab\\r\\n'], 'output': ['b\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\nab\\r\\nb\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\nab\\r\\na\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nba\\r\\na\\r\\nab\\r\\nb\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\nba\\r\\na\\r\\nab\\r\\n4\\r\\na\\r\\nba\\r\\nb\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n'], 'output': ['b\\r\\nab\\r\\n']}, {'input': ['20\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\nb\\r\\na\\r\\nab\\r\\nba\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nb\\r\\na\\r\\nba\\r\\nab\\r\\n4\\r\\nab\\r\\nba\\r\\na\\r\\nb\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nba\\r\\nb\\r\\na\\r\\nab\\r\\n4\\r\\nab\\r\\na\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\na\\r\\nab\\r\\nb\\r\\nba\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nba\\r\\nab\\r\\na\\r\\nb\\r\\n4\\r\\nba\\r\\nab\\r\\nb\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\nba\\r\\na\\r\\n4\\r\\nb\\r\\nab\\r\\na\\r\\nba\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n4\\r\\na\\r\\nba\\r\\nab\\r\\nb\\r\\n4\\r\\nb\\r\\nba\\r\\nab\\r\\na\\r\\n4\\r\\nab\\r\\nb\\r\\na\\r\\nba\\r\\n'], 'output': ['ab\\r\\nb\\r\\n']}]","id":595} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"47_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\n\nconst int MOD = 1000003;\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n for (int i = 1; i <= 30; ++i)\n\tif (i * (i + 1) \/ 2 == n) {\n\t writeln(\"YES\");\n\t return 0;\n\t}\n writeln(\"NO\");\n return 0;\n}\n","description":"A triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the number of dots in a triangle with n dots on a side. . You can learn more about these numbers from Wikipedia (http:\/\/en.wikipedia.org\/wiki\/Triangular_number).Your task is to find out if a given integer is a triangular number.","input_specification":"The first line contains the single number n (1\u2264n\u2264500) \u2014 the given integer.\n","output_specification":"If the given integer is a triangular number output YES, otherwise output NO.\n","notes":null,"sample_inputs":["1\n","2\n","3\n"],"sample_outputs":["YES\n","NO\n","YES\n"],"human_solution":"import std.stdio;\n\nconst int MOD = 1000003;\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n for (int i = 1; i <= 100; ++i)\n\tif (i * (i + 1) \/ 2 == n) {\n\t writeln(\"YES\");\n\t return 0;\n\t}\n writeln(\"NO\");\n return 0;\n}\n","testcases":"[{'input': ['1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['22\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['121\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['135\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['136\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['137\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['152\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['153\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['154\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['171\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['189\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['190\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['191\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['210\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['211\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['231\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['232\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['252\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['253\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['254\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['275\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['276\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['277\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['299\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['300\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['301\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['324\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['325\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['326\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['350\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['351\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['352\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['377\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['378\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['406\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['434\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['435\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['464\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['465\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['495\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['496\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['497\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['331\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['413\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['177\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['122\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['478\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['188\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['474\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['48\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['498\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['499\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['500\\r\\n'], 'output': ['NO\\r\\n']}]","id":596} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"4_A","execute_outcome":"WRONG_ANSWER","source_code":"import std;\n\nvoid main()\n{\n readln().strip.to!int % 2 == 0 ? \"YES\".writeln : \"NO\".writeln;\n}","description":"One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.","input_specification":"The first (and the only) input line contains integer number w (1\u2264w\u2264100) \u2014 the weight of the watermelon bought by the boys.\n","output_specification":"Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in the opposite case.\n","notes":"For example, the boys can divide the watermelon into two parts of 2 and 6 kilos respectively (another variant \u2014 two parts of 4 and 4 kilos).\n","sample_inputs":["8\n"],"sample_outputs":["YES\n"],"human_solution":"import std.stdio;\r\n\r\nvoid main()\r\n{\r\n int w;\r\n readf(\"%d\", &w);\r\n\r\n writeln(w > 2 && w % 2 == 0 ? \"YES\" : \"NO\");\r\n}\r\n","testcases":"[{'input': ['8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['53\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['77\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['32\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['44\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['98\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['99\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['90\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['67\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['88\\r\\n'], 'output': ['YES\\r\\n']}]","id":597} {"difficulty":1200,"lang":"D","lang_cluster":"D","src_uid":"4_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.conv;\r\nimport std.string;\r\nimport std.typecons;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.range;\r\nimport std.math;\r\nimport std.regex;\r\n\r\nvoid main()\r\n{\r\n int[][] times;\r\n int sum, diff;\r\n\r\n auto input = readln().split().map!(to!int)();\r\n\r\n a:foreach (s; stdin.byLine()) {\r\n \tauto t = s.split().map!(to!int)().array();\r\n\r\n \twhile (sum + t[1] > input[1]) {\r\n \t\tif (t[1] - 1 >= t[0]) {\r\n \t\t\tt[1]--;\r\n \t\t} else {\r\n \t\t\tdiff = sum + t[1] - input[1];\r\n \t\t\tforeach_reverse (tt; times) {\r\n \t\t\t\twhile (tt[0] != tt[1] && diff) {\r\n \t\t\t\t\ttt[1]--;\r\n \t\t\t\t\tdiff--;\r\n \t\t\t\t\tsum--;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\tif (diff) {writeln(\"u\");break a;}\r\n \t}\r\n\r\n \ttimes ~= t;\r\n \tsum += t[1];\r\n }\r\n\r\n if (sum != input[1] || diff) {\r\n \twriteln(\"NO\");\r\n } else {\r\n \twriteln(\"YES\");\r\n \tforeach (t; times[0 .. $-1]) {\r\n \t\twrite(t[1], \" \");\r\n \t}\r\n \twriteln(times[$-1][1]);\r\n }\r\n \r\n}","description":"Tomorrow Peter has a Biology exam. He does not like this subject much, but d days ago he learnt that he would have to take this exam. Peter's strict parents made him prepare for the exam immediately, for this purpose he has to study not less than minTimei and not more than maxTimei hours per each i-th day. Moreover, they warned Peter that a day before the exam they would check how he has followed their instructions.So, today is the day when Peter's parents ask him to show the timetable of his preparatory studies. But the boy has counted only the sum of hours sumTime spent him on preparation, and now he wants to know if he can show his parents a timetable s\u0441hedule with d numbers, where each number s\u0441hedulei stands for the time in hours spent by Peter each i-th day on biology studies, and satisfying the limitations imposed by his parents, and at the same time the sum total of all schedulei should equal to sumTime.","input_specification":"The first input line contains two integer numbers d,sumTime (1\u2264d\u226430,0\u2264sumTime\u2264240) \u2014 the amount of days, during which Peter studied, and the total amount of hours, spent on preparation. Each of the following d lines contains two integer numbers minTimei,maxTimei (0\u2264minTimei\u2264maxTimei\u22648), separated by a space \u2014 minimum and maximum amount of hours that Peter could spent in the i-th day.\n","output_specification":"In the first line print YES, and in the second line print d numbers (separated by a space), each of the numbers \u2014 amount of hours, spent by Peter on preparation in the corresponding day, if he followed his parents' instructions; or print NO in the unique line. If there are many solutions, print any of them.\n","notes":null,"sample_inputs":["1 48\n5 7\n","2 5\n0 1\n3 5\n"],"sample_outputs":["NO\n","YES\n1 4 "],"human_solution":"import std.stdio;\r\nimport std.conv;\r\nimport std.string;\r\nimport std.typecons;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.range;\r\nimport std.math;\r\nimport std.regex;\r\n\r\nvoid main()\r\n{\r\n int[][] times;\r\n int sum, diff;\r\n\r\n auto input = readln().split().map!(to!int)();\r\n\r\n a:foreach (s; stdin.byLine()) {\r\n \tauto t = s.split().map!(to!int)().array();\r\n\r\n \twhile (sum + t[1] > input[1]) {\r\n \t\tif (t[1] - 1 >= t[0]) {\r\n \t\t\tt[1]--;\r\n \t\t} else {\r\n \t\t\tdiff = sum + t[1] - input[1];\r\n \t\t\tforeach_reverse (tt; times) {\r\n \t\t\t\twhile (tt[0] != tt[1] && diff) {\r\n \t\t\t\t\ttt[1]--;\r\n \t\t\t\t\tdiff--;\r\n \t\t\t\t\tsum--;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n \t\tif (diff) break a;\r\n \t}\r\n\r\n \ttimes ~= t;\r\n \tsum += t[1];\r\n }\r\n\r\n if (sum != input[1] || diff) {\r\n \twriteln(\"NO\");\r\n } else {\r\n \twriteln(\"YES\");\r\n \tforeach (t; times[0 .. $-1]) {\r\n \t\twrite(t[1], \" \");\r\n \t}\r\n \twriteln(times[$-1][1]);\r\n }\r\n \r\n}","testcases":"[{'input': ['1 48\\r\\n5 7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 5\\r\\n0 1\\r\\n3 5\\r\\n'], 'output': ['YES\\r\\n1 4 ']}, {'input': ['1 1\\r\\n5 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1 4\\r\\n2 4\\r\\n'], 'output': ['YES\\r\\n4 ']}, {'input': ['2 5\\r\\n4 6\\r\\n0 0\\r\\n'], 'output': ['YES\\r\\n5 0 ']}, {'input': ['27 97\\r\\n2 8\\r\\n0 5\\r\\n5 6\\r\\n3 6\\r\\n5 5\\r\\n1 2\\r\\n3 5\\r\\n1 8\\r\\n0 4\\r\\n3 3\\r\\n0 2\\r\\n0 0\\r\\n4 8\\r\\n5 6\\r\\n5 8\\r\\n0 7\\r\\n1 4\\r\\n0 4\\r\\n1 5\\r\\n3 7\\r\\n2 5\\r\\n5 6\\r\\n4 7\\r\\n3 8\\r\\n0 1\\r\\n3 4\\r\\n5 7\\r\\n'], 'output': ['YES\\r\\n8 5 6 6 5 2 5 8 4 3 2 0 6 5 5 0 1 0 1 3 2 5 4 3 0 3 5 ']}, {'input': ['30 92\\r\\n4 5\\r\\n4 7\\r\\n2 6\\r\\n8 8\\r\\n7 8\\r\\n4 5\\r\\n1 5\\r\\n7 8\\r\\n1 2\\r\\n6 8\\r\\n2 7\\r\\n2 4\\r\\n0 0\\r\\n1 3\\r\\n4 5\\r\\n1 1\\r\\n0 7\\r\\n2 5\\r\\n2 5\\r\\n3 3\\r\\n1 2\\r\\n1 7\\r\\n5 5\\r\\n5 8\\r\\n6 7\\r\\n0 3\\r\\n2 6\\r\\n0 7\\r\\n5 6\\r\\n2 5\\r\\n'], 'output': ['YES\\r\\n5 7 2 8 7 4 1 7 1 6 2 2 0 1 4 1 0 2 2 3 1 1 5 5 6 0 2 0 5 2 ']}, {'input': ['30 178\\r\\n1 6\\r\\n2 7\\r\\n2 5\\r\\n2 8\\r\\n1 6\\r\\n2 8\\r\\n3 4\\r\\n2 7\\r\\n0 2\\r\\n0 8\\r\\n0 3\\r\\n0 2\\r\\n2 4\\r\\n4 8\\r\\n6 8\\r\\n0 8\\r\\n0 6\\r\\n1 8\\r\\n0 3\\r\\n6 7\\r\\n4 8\\r\\n2 7\\r\\n1 1\\r\\n3 7\\r\\n3 6\\r\\n2 5\\r\\n4 7\\r\\n2 2\\r\\n1 8\\r\\n5 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['30 71\\r\\n1 3\\r\\n0 6\\r\\n3 5\\r\\n3 6\\r\\n2 4\\r\\n2 8\\r\\n2 4\\r\\n3 8\\r\\n3 5\\r\\n2 4\\r\\n2 3\\r\\n3 7\\r\\n0 0\\r\\n5 7\\r\\n0 2\\r\\n5 8\\r\\n0 8\\r\\n4 7\\r\\n0 3\\r\\n3 7\\r\\n2 3\\r\\n4 5\\r\\n7 8\\r\\n7 7\\r\\n2 7\\r\\n1 3\\r\\n0 1\\r\\n1 5\\r\\n6 7\\r\\n5 8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['30 119\\r\\n2 7\\r\\n1 3\\r\\n0 3\\r\\n3 4\\r\\n7 7\\r\\n7 7\\r\\n0 5\\r\\n2 3\\r\\n0 8\\r\\n0 8\\r\\n0 5\\r\\n5 7\\r\\n2 2\\r\\n2 6\\r\\n2 5\\r\\n3 7\\r\\n0 8\\r\\n0 2\\r\\n1 3\\r\\n2 3\\r\\n1 4\\r\\n0 1\\r\\n3 7\\r\\n7 8\\r\\n1 2\\r\\n0 6\\r\\n1 8\\r\\n1 7\\r\\n4 8\\r\\n1 4\\r\\n'], 'output': ['YES\\r\\n7 3 3 4 7 7 5 3 8 8 5 7 2 6 5 7 8 2 1 2 1 0 3 7 1 0 1 1 4 1 ']}, {'input': ['1 0\\r\\n0 0\\r\\n'], 'output': ['YES\\r\\n0 ']}, {'input': ['30 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n0 0\\r\\n'], 'output': ['YES\\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 ']}, {'input': ['30 240\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n8 8\\r\\n'], 'output': ['YES\\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 ']}, {'input': ['30 64\\r\\n7 7\\r\\n3 4\\r\\n0 4\\r\\n5 8\\r\\n1 3\\r\\n1 1\\r\\n0 2\\r\\n0 4\\r\\n7 7\\r\\n3 5\\r\\n4 4\\r\\n0 4\\r\\n4 5\\r\\n1 4\\r\\n4 6\\r\\n5 7\\r\\n1 4\\r\\n1 2\\r\\n3 3\\r\\n0 2\\r\\n3 7\\r\\n3 4\\r\\n0 3\\r\\n3 8\\r\\n0 8\\r\\n0 1\\r\\n0 3\\r\\n4 5\\r\\n1 5\\r\\n0 3\\r\\n'], 'output': ['YES\\r\\n7 3 0 5 1 1 0 0 7 3 4 0 4 1 4 5 1 1 3 0 3 3 0 3 0 0 0 4 1 0 ']}, {'input': ['30 189\\r\\n0 8\\r\\n3 8\\r\\n5 8\\r\\n2 2\\r\\n7 7\\r\\n2 8\\r\\n7 8\\r\\n2 5\\r\\n1 7\\r\\n0 1\\r\\n3 4\\r\\n1 7\\r\\n1 6\\r\\n5 6\\r\\n3 7\\r\\n4 7\\r\\n4 7\\r\\n4 7\\r\\n5 5\\r\\n0 5\\r\\n4 7\\r\\n3 5\\r\\n0 6\\r\\n4 8\\r\\n2 5\\r\\n5 6\\r\\n5 6\\r\\n2 8\\r\\n0 7\\r\\n7 8\\r\\n'], 'output': ['YES\\r\\n8 8 8 2 7 8 8 5 7 1 4 7 6 6 7 7 7 7 5 5 7 5 6 8 5 6 6 8 7 8 ']}]","id":598} {"difficulty":900,"lang":"D","lang_cluster":"D","src_uid":"572_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio, std.range, std.string, std.conv, std.algorithm;\nimport std.math;\n\nvoid main() {\n readln;\n int k, m;\n readf(\"%d %d\\n\", &k, &m);\n int[] a = readln.chomp.split.map!(to!int).array;\n int[] b = readln.chomp.split.map!(to!int).array;\n\n if (a[k - 1] < b[0]) {\n \"YES\".writeln;\n } else {\n \"NO\".writeln;\n }\n}","description":"You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any number chosen in the second array.","input_specification":"The first line contains two integers nA,nB (1\u2264nA,nB\u226410^5), separated by a space \u2014 the sizes of arrays A and B, correspondingly.\nThe second line contains two integers k and m (1\u2264k\u2264nA,1\u2264m\u2264nB), separated by a space.\nThe third line contains nA numbers a1,a2,... anA (-10^9\u2264a1\u2264a2\u2264...\u2264anA\u226410^9), separated by spaces \u2014 elements of array A.\nThe fourth line contains nB integers b1,b2,... bnB (-10^9\u2264b1\u2264b2\u2264...\u2264bnB\u226410^9), separated by spaces \u2014 elements of array B.\n","output_specification":"Print \"YES\" (without the quotes), if you can choose k numbers in array A and m numbers in array B so that any number chosen in array A was strictly less than any number chosen in array B. Otherwise, print \"NO\" (without the quotes).\n","notes":"In the first sample test you can, for example, choose numbers 1 and 2 from array A and number 3 from array B (1 < 3 and 2 < 3).\nIn the second sample test the only way to choose k elements in the first array and m elements in the second one is to choose all numbers in both arrays, but then not all the numbers chosen in A will be less than all the numbers chosen in B: .\n","sample_inputs":["3 3\n2 1\n1 2 3\n3 4 5\n","3 3\n3 3\n1 2 3\n3 4 5\n","5 2\n3 1\n1 1 1 1 1\n2 2\n"],"sample_outputs":["YES\n","NO\n","YES\n"],"human_solution":"import std.stdio, std.range, std.string, std.conv, std.algorithm;\nimport std.math;\n\nvoid main() {\n readln;\n int k, m;\n readf(\"%d %d\\n\", &k, &m);\n int[] a = readln.chomp.split.map!(to!int).array;\n int[] b = readln.chomp.split.map!(to!int).array;\n\n if (a[k - 1] < b[$ - m]) {\n \"YES\".writeln;\n } else {\n \"NO\".writeln;\n }\n}","testcases":"[{'input': ['3 3\\r\\n2 1\\r\\n1 2 3\\r\\n3 4 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n3 3\\r\\n1 2 3\\r\\n3 4 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 2\\r\\n3 1\\r\\n1 1 1 1 1\\r\\n2 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 5\\r\\n1 1\\r\\n5 5 5\\r\\n5 5 5 5 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n1\\r\\n1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 3\\r\\n1 1\\r\\n1 2 3\\r\\n1 2 3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 2 3\\r\\n1 2 3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n2 2\\r\\n1 2 3\\r\\n1 2 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10 15\\r\\n10 1\\r\\n1 1 5 17 22 29 32 36 39 48\\r\\n9 10 20 23 26 26 32 32 33 39 43 45 47 49 49\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 15\\r\\n1 15\\r\\n91 91 91 92 92 94 94 95 98 100\\r\\n92 92 93 93 93 94 95 96 97 98 98 99 99 100 100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['15 10\\r\\n12 5\\r\\n9 25 25 32 32 38 40 41 46 46 48 51 64 64 73\\r\\n5 14 30 35 50 52 67 79 89 99\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['15 10\\r\\n4 10\\r\\n22 32 35 45 45 50 51 55 79 80 83 88 90 92 93\\r\\n46 48 52 55 60 60 68 75 80 81\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20 30\\r\\n2 8\\r\\n6 7 7 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 10\\r\\n1 1 2 2 2 2 2 2 2 3 3 4 5 5 5 5 6 6 6 6 6 6 7 7 7 8 8 9 10 10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['20 30\\r\\n19 29\\r\\n1 1 2 2 2 3 4 4 7 7 7 8 8 8 8 8 9 9 9 9\\r\\n6 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n-1000000000\\r\\n30\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n1 3\\r\\n1 3 3\\r\\n3 3 3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 3\\r\\n1 1\\r\\n3 3 3\\r\\n2 2 2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 5\\r\\n3 3\\r\\n1 5 6 7 8\\r\\n1 2 5 6 7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 4\\r\\n2 2\\r\\n5 6 7\\r\\n1 2 3 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 3\\r\\n3 3\\r\\n1 2 3\\r\\n4 5 6\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5 5\\r\\n4 5\\r\\n2 2 3 4 5\\r\\n5 6 7 8 9\\r\\n'], 'output': ['YES\\r\\n']}]","id":599} {"difficulty":800,"lang":"D","lang_cluster":"D","src_uid":"71_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\nimport std.string;\nimport std.format;\n\nvoid main() {\n int n;\n string ans;\n formattedRead(strip(readln()), \"%d\", n);\n while(n-- > 0) {\n string s = strip(readln());\n if (s.length > 10)\n ans ~= s[0] ~ \"10\" ~ s[$ - 1];\n else\n ans ~= s;\n if (n > 0) ans ~= \"\\n\";\n }\n writeln(ans);\n}","description":"Sometimes some words like \"localization\" or \"internationalization\" are so long that writing them many times in one text is quite tiresome.Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.Thus, \"localization\" will be spelt as \"l10n\", and \"internationalization\u00bb will be spelt as \"i18n\".You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.","input_specification":"The first line contains an integer n (1\u2264n\u2264100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.\n","output_specification":"Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.\n","notes":null,"sample_inputs":["4\nword\nlocalization\ninternationalization\npneumonoultramicroscopicsilicovolcanoconiosis\n"],"sample_outputs":["word\nl10n\ni18n\np43s\n"],"human_solution":"import std;\n\n\nvoid main() {\n auto input = stdin.byLine();\n input.dropOne.each!(x => abbrev(x.to!string).writeln);\n}\n\nstring abbrev(string word) {\n auto wl = word.length;\n return wl > 10 ? word[0].to!string ~ (wl-2).to!string ~ word[$-1].to!string : word;\n}","testcases":"[{'input': ['4\\r\\nword\\r\\nlocalization\\r\\ninternationalization\\r\\npneumonoultramicroscopicsilicovolcanoconiosis\\r\\n'], 'output': ['word\\r\\nl10n\\r\\ni18n\\r\\np43s\\r\\n']}, {'input': ['5\\r\\nabcdefgh\\r\\nabcdefghi\\r\\nabcdefghij\\r\\nabcdefghijk\\r\\nabcdefghijklm\\r\\n'], 'output': ['abcdefgh\\r\\nabcdefghi\\r\\nabcdefghij\\r\\na9k\\r\\na11m\\r\\n']}, {'input': ['3\\r\\nnjfngnrurunrgunrunvurn\\r\\njfvnjfdnvjdbfvsbdubruvbubvkdb\\r\\nksdnvidnviudbvibd\\r\\n'], 'output': ['n20n\\r\\nj27b\\r\\nk15d\\r\\n']}, {'input': ['1\\r\\ntcyctkktcctrcyvbyiuhihhhgyvyvyvyvjvytchjckt\\r\\n'], 'output': ['t41t\\r\\n']}, {'input': ['24\\r\\nyou\\r\\nare\\r\\nregistered\\r\\nfor\\r\\npractice\\r\\nyou\\r\\ncan\\r\\nsolve\\r\\nproblems\\r\\nunofficially\\r\\nresults\\r\\ncan\\r\\nbe\\r\\nfound\\r\\nin\\r\\nthe\\r\\ncontest\\r\\nstatus\\r\\nand\\r\\nin\\r\\nthe\\r\\nbottom\\r\\nof\\r\\nstandings\\r\\n'], 'output': ['you\\r\\nare\\r\\nregistered\\r\\nfor\\r\\npractice\\r\\nyou\\r\\ncan\\r\\nsolve\\r\\nproblems\\r\\nu10y\\r\\nresults\\r\\ncan\\r\\nbe\\r\\nfound\\r\\nin\\r\\nthe\\r\\ncontest\\r\\nstatus\\r\\nand\\r\\nin\\r\\nthe\\r\\nbottom\\r\\nof\\r\\nstandings\\r\\n']}, {'input': ['1\\r\\na\\r\\n'], 'output': ['a\\r\\n']}, {'input': ['26\\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\\n'], 'output': ['a\\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\\n']}, {'input': ['1\\r\\nabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij\\r\\n'], 'output': ['a98j\\r\\n']}, {'input': ['10\\r\\ngyartjdxxlcl\\r\\nfzsck\\r\\nuidwu\\r\\nxbymclornemdmtj\\r\\nilppyoapitawgje\\r\\ncibzc\\r\\ndrgbeu\\r\\nhezplmsdekhhbo\\r\\nfeuzlrimbqbytdu\\r\\nkgdco\\r\\n'], 'output': ['g10l\\r\\nfzsck\\r\\nuidwu\\r\\nx13j\\r\\ni13e\\r\\ncibzc\\r\\ndrgbeu\\r\\nh12o\\r\\nf13u\\r\\nkgdco\\r\\n']}, {'input': ['20\\r\\nlkpmx\\r\\nkovxmxorlgwaomlswjxlpnbvltfv\\r\\nhykasjxqyjrmybejnmeumzha\\r\\ntuevlumpqbbhbww\\r\\nqgqsphvrmupxxc\\r\\ntrissbaf\\r\\nqfgrlinkzvzqdryckaizutd\\r\\nzzqtoaxkvwoscyx\\r\\noswytrlnhpjvvnwookx\\r\\nlpuzqgec\\r\\ngyzqfwxggtvpjhzmzmdw\\r\\nrlxjgmvdftvrmvbdwudra\\r\\nvsntnjpepnvdaxiporggmglhagv\\r\\nxlvcqkqgcrbgtgglj\\r\\nlyxwxbiszyhlsrgzeedzprbmcpduvq\\r\\nyrmqqvrkqskqukzqrwukpsifgtdc\\r\\nxpuohcsjhhuhvr\\r\\nvvlfrlxpvqejngwrbfbpmqeirxlw\\r\\nsvmasocxdvadmaxtrpakysmeaympy\\r\\nyuflqboqfdt\\r\\n'], 'output': ['lkpmx\\r\\nk26v\\r\\nh22a\\r\\nt13w\\r\\nq12c\\r\\ntrissbaf\\r\\nq21d\\r\\nz13x\\r\\no17x\\r\\nlpuzqgec\\r\\ng18w\\r\\nr19a\\r\\nv25v\\r\\nx15j\\r\\nl28q\\r\\ny26c\\r\\nx12r\\r\\nv26w\\r\\ns27y\\r\\ny9t\\r\\n']}, {'input': ['100\\r\\nm\\r\\nz\\r\\ns\\r\\nv\\r\\nd\\r\\nr\\r\\nv\\r\\ny\\r\\ny\\r\\ne\\r\\np\\r\\nt\\r\\nc\\r\\na\\r\\nn\\r\\nm\\r\\np\\r\\ng\\r\\ni\\r\\nj\\r\\nc\\r\\na\\r\\nb\\r\\nq\\r\\ne\\r\\nn\\r\\nv\\r\\no\\r\\nk\\r\\nx\\r\\nf\\r\\ni\\r\\nl\\r\\na\\r\\nq\\r\\nr\\r\\nu\\r\\nb\\r\\ns\\r\\nl\\r\\nc\\r\\nl\\r\\ne\\r\\nv\\r\\nj\\r\\nm\\r\\nx\\r\\nb\\r\\na\\r\\nq\\r\\nb\\r\\na\\r\\nf\\r\\nj\\r\\nv\\r\\nm\\r\\nq\\r\\nc\\r\\nt\\r\\nt\\r\\nn\\r\\nx\\r\\no\\r\\ny\\r\\nr\\r\\nu\\r\\nh\\r\\nm\\r\\nj\\r\\np\\r\\nj\\r\\nq\\r\\nz\\r\\ns\\r\\nj\\r\\no\\r\\ng\\r\\nc\\r\\nm\\r\\nn\\r\\no\\r\\nm\\r\\nr\\r\\no\\r\\ns\\r\\nt\\r\\nh\\r\\nr\\r\\np\\r\\nk\\r\\nb\\r\\nz\\r\\ng\\r\\no\\r\\nc\\r\\nc\\r\\nz\\r\\nz\\r\\ng\\r\\nr\\r\\n'], 'output': ['m\\r\\nz\\r\\ns\\r\\nv\\r\\nd\\r\\nr\\r\\nv\\r\\ny\\r\\ny\\r\\ne\\r\\np\\r\\nt\\r\\nc\\r\\na\\r\\nn\\r\\nm\\r\\np\\r\\ng\\r\\ni\\r\\nj\\r\\nc\\r\\na\\r\\nb\\r\\nq\\r\\ne\\r\\nn\\r\\nv\\r\\no\\r\\nk\\r\\nx\\r\\nf\\r\\ni\\r\\nl\\r\\na\\r\\nq\\r\\nr\\r\\nu\\r\\nb\\r\\ns\\r\\nl\\r\\nc\\r\\nl\\r\\ne\\r\\nv\\r\\nj\\r\\nm\\r\\nx\\r\\nb\\r\\na\\r\\nq\\r\\nb\\r\\na\\r\\nf\\r\\nj\\r\\nv\\r\\nm\\r\\nq\\r\\nc\\r\\nt\\r\\nt\\r\\nn\\r\\nx\\r\\no\\r\\ny\\r\\nr\\r\\nu\\r\\nh\\r\\nm\\r\\nj\\r\\np\\r\\nj\\r\\nq\\r\\nz\\r\\ns\\r\\nj\\r\\no\\r\\ng\\r\\nc\\r\\nm\\r\\nn\\r\\no\\r\\nm\\r\\nr\\r\\no\\r\\ns\\r\\nt\\r\\nh\\r\\nr\\r\\np\\r\\nk\\r\\nb\\r\\nz\\r\\ng\\r\\no\\r\\nc\\r\\nc\\r\\nz\\r\\nz\\r\\ng\\r\\nr\\r\\n']}]","id":600} {"difficulty":1300,"lang":"D","lang_cluster":"D","src_uid":"71_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.format;\r\nimport std.stdio;\r\n\r\nvoid main() {\r\n int n, k, t;\r\n readf(\"%s %s %s\\n\", n, k, t);\r\n int progress = cast(int)(cast(real)(t * n * k) \/ 100.0);\r\n int full = progress \/ k;\r\n foreach (i; 0..full) \"%d \".format(k).write;\r\n \"%d \".format(progress - full * k).write;\r\n foreach (i; 0..n - full - 1) \"%d \".format(0).write;\r\n writeln;\r\n}","description":"A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the left to the right. Each square has saturation (ai for the i-th square), which is measured by an integer from 0 to k. When the bar for some i (1\u2264i\u2264n) is displayed, squares 1,2,... ,i-1 has the saturation k, squares i+1,i+2,... ,n has the saturation 0, and the saturation of the square i can have any value from 0 to k.So some first squares of the progress bar always have the saturation k. Some last squares always have the saturation 0. And there is no more than one square that has the saturation different from 0 and k.The degree of the process's completion is measured in percents. Let the process be t% completed. Then the following inequation is fulfilled: An example of such a bar can be seen on the picture. For the given n, k, t determine the measures of saturation for all the squares ai of the progress bar.","input_specification":"We are given 3 space-separated integers n, k, t (1\u2264n,k\u2264100, 0\u2264t\u2264100).\n","output_specification":"Print n numbers. The i-th of them should be equal to ai.\n","notes":null,"sample_inputs":["10 10 54\n","11 13 37\n"],"sample_outputs":["10 10 10 10 10 4 0 0 0 0 ","13 13 13 13 0 0 0 0 0 0 0 "],"human_solution":"import std.format;\r\nimport std.stdio;\r\n\r\nvoid main() {\r\n int n, k, t;\r\n readf(\"%s %s %s\\n\", n, k, t);\r\n int progress = cast(int)(cast(real)(t * n * k) \/ 100.0);\r\n int full = progress \/ k;\r\n foreach (i; 0..full) \"%d \".format(k).write;\r\n if (full < n) {\r\n \"%d \".format(progress - full * k).write;\r\n foreach (i; 0..n - full - 1) \"%d \".format(0).write;\r\n }\r\n writeln;\r\n}","testcases":"[{'input': ['10 10 54\\r\\n'], 'output': ['10 10 10 10 10 4 0 0 0 0 ']}, {'input': ['11 13 37\\r\\n'], 'output': ['13 13 13 13 0 0 0 0 0 0 0 ']}, {'input': ['9 25 50\\r\\n'], 'output': ['25 25 25 25 12 0 0 0 0 ']}, {'input': ['43 47 77\\r\\n'], 'output': ['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 5 0 0 0 0 0 0 0 0 0 ']}, {'input': ['20 1 43\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 4 61\\r\\n'], 'output': ['4 4 4 4 4 4 4 4 4 4 1 0 0 0 0 0 0 ']}, {'input': ['10 16 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 13 100\\r\\n'], 'output': ['13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 ']}, {'input': ['11 9 1\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['9 11 99\\r\\n'], 'output': ['11 11 11 11 11 11 11 11 10 ']}, {'input': ['6 17 1\\r\\n'], 'output': ['1 0 0 0 0 0 ']}, {'input': ['6 17 99\\r\\n'], 'output': ['17 17 17 17 17 15 ']}, {'input': ['17 6 1\\r\\n'], 'output': ['1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['17 6 99\\r\\n'], 'output': ['6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 4 ']}, {'input': ['99 1 1\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['99 1 99\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 ']}, {'input': ['1 1 0\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 37\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 50\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 51\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 99\\r\\n'], 'output': ['0 ']}, {'input': ['1 1 100\\r\\n'], 'output': ['1 ']}, {'input': ['1 17 35\\r\\n'], 'output': ['5 ']}, {'input': ['1 31 88\\r\\n'], 'output': ['27 ']}, {'input': ['1 100 0\\r\\n'], 'output': ['0 ']}, {'input': ['1 100 38\\r\\n'], 'output': ['38 ']}, {'input': ['1 100 99\\r\\n'], 'output': ['99 ']}, {'input': ['1 100 100\\r\\n'], 'output': ['100 ']}, {'input': ['1 99 99\\r\\n'], 'output': ['98 ']}, {'input': ['100 100 73\\r\\n'], 'output': ['100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 100 100\\r\\n'], 'output': ['100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ']}, {'input': ['100 13 100\\r\\n'], 'output': ['13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 ']}, {'input': ['100 1 100\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ']}, {'input': ['100 1 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 13 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 63 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['100 100 0\\r\\n'], 'output': ['0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['2 99 51\\r\\n'], 'output': ['99 1 ']}, {'input': ['2 1 49\\r\\n'], 'output': ['0 0 ']}, {'input': ['2 1 100\\r\\n'], 'output': ['1 1 ']}, {'input': ['2 13 0\\r\\n'], 'output': ['0 0 ']}, {'input': ['99 1 51\\r\\n'], 'output': ['1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['15 25 93\\r\\n'], 'output': ['25 25 25 25 25 25 25 25 25 25 25 25 25 23 0 ']}, {'input': ['60 51 85\\r\\n'], 'output': ['51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 ']}, {'input': ['4 78 78\\r\\n'], 'output': ['78 78 78 9 ']}, {'input': ['49 4 4\\r\\n'], 'output': ['4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ']}, {'input': ['42 83 98\\r\\n'], 'output': ['83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 83 13 ']}, {'input': ['87 9 90\\r\\n'], 'output': ['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 2 0 0 0 0 0 0 0 0 ']}, {'input': ['31 36 83\\r\\n'], 'output': ['36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 26 0 0 0 0 0 ']}, {'input': ['24 14 76\\r\\n'], 'output': ['14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 3 0 0 0 0 0 ']}]","id":601} {"difficulty":1000,"lang":"D","lang_cluster":"D","src_uid":"859_B","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop, core.stdc.stdio;\n\nint point(int x, int y) {\n if (32 * x <= y) return 3000;\n else if (16 * x <= y) return 2500;\n else if (8 * x <= y) return 2000;\n else if (4 * x <= y) return 1500;\n else if (2 * x <= y) return 1000;\n else return 500;\n}\n\nvoid main() {\n auto N = readln.chomp.to!int;\n auto A = N.iota.map!(_ => readln.split.map!(to!int).array).array;\n\n auto solved = new int[](5);\n foreach (i; 0..N) foreach (j; 0..5) if (A[i][j] != -1) solved[j] += 1;\n\n auto ud = new int[](5);\n foreach (i; 0..5) {\n if (A[0][i] == A[1][i]) ud[i] = 0;\n else if (A[0][i] == -1) ud[i] = -1;\n else if (A[1][i] == -1) ud[i] = 1;\n else if (A[0][i] > A[1][i]) ud[i] = -1;\n else if (A[0][i] < A[1][i]) ud[i] = 1;\n }\n\n auto P = new int[](N);\n foreach (i; 0..5) P[i] = point(solved[i], N);\n\n int ans = -1;\n foreach (i; 0..10000) {\n int v, p;\n foreach (j; 0..5) {\n if (ud[i] > 0) P[i] = point(solved[i], N);\n else P[i] = point(solved[i] + i, N);\n if (A[0][i] != -1) v += P[i] \/ 250 * (250 - A[0][i]);\n if (A[1][i] != -1) p += P[i] \/ 250 * (250 - A[1][i]);\n }\n if (v > p) {\n ans = i;\n break;\n }\n }\n\n ans.writeln;\n}\n","description":"Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of a region whose area is exactly N blocks. Your friend is quite lazy and would like your help to find the shortest possible route that meets the requirements. The city is laid out in a square grid pattern, and is large enough that for the sake of the problem it can be considered infinite.","input_specification":"Input will consist of a single integer N (1\u2264N\u226410^6), the number of city blocks that must be enclosed by the route.\n","output_specification":"Print the minimum perimeter that can be achieved.\n","notes":"Here are some possible shapes for the examples:\n\n","sample_inputs":["4\n","11\n","22\n"],"sample_outputs":["8\n","14\n","20\n"],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop;\n\nvoid main() {\n auto N = readln.chomp.to!int;\n int ans = 1 << 29;\n\n foreach (i; 1..10^^6+1) {\n int x = (N - 1) \/ i + 1;\n ans = min(ans, x * 2 + i * 2);\n }\n\n ans.writeln;\n}\n","testcases":"[{'input': ['4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['22\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1024\\r\\n'], 'output': ['128\\r\\n']}, {'input': ['101\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['1000000\\r\\n'], 'output': ['4000\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['999000\\r\\n'], 'output': ['3998\\r\\n']}, {'input': ['999001\\r\\n'], 'output': ['4000\\r\\n']}, {'input': ['999999\\r\\n'], 'output': ['4000\\r\\n']}, {'input': ['933206\\r\\n'], 'output': ['3866\\r\\n']}, {'input': ['718351\\r\\n'], 'output': ['3392\\r\\n']}, {'input': ['607443\\r\\n'], 'output': ['3118\\r\\n']}, {'input': ['347887\\r\\n'], 'output': ['2360\\r\\n']}, {'input': ['246206\\r\\n'], 'output': ['1986\\r\\n']}, {'input': ['151375\\r\\n'], 'output': ['1558\\r\\n']}, {'input': ['12639\\r\\n'], 'output': ['450\\r\\n']}, {'input': ['3751\\r\\n'], 'output': ['246\\r\\n']}, {'input': ['3607\\r\\n'], 'output': ['242\\r\\n']}, {'input': ['124\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['64\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['31\\r\\n'], 'output': ['24\\r\\n']}, {'input': ['23\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['59637\\r\\n'], 'output': ['978\\r\\n']}]","id":602} {"difficulty":900,"lang":"D","lang_cluster":"D","src_uid":"981_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.array;\r\nimport std.container;\r\nimport std.conv;\r\nimport std.math;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nvoid main()\r\n{\r\n auto s = readln.chomp.map!(to!dchar).array;\r\n \r\n int ans = 0;\r\n auto isPal = (dchar[] s) => s == s.retro.array;\r\n foreach ( st; 0..s.length ) {\r\n foreach ( end; st+1..s.length ) {\r\n if ( !isPal( s[st..end] ) ) ans = cast(int) max( ans, cast(int) end - st );\r\n }\r\n }\r\n \r\n writeln( ans );\r\n}","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\u2264l\u2264r\u2264|s|$$$) of a string $$$s=s_{1}s_{2} \\ldots s_{|s|}$$$ is the string $$$s_{l}s_{l+1} \\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.\n","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$$$.\nNote that there can be multiple longest substrings that are not palindromes, but their length is unique.\n","notes":"\"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$$$.\nThe 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$$$.\nAll 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$$$.\n","sample_inputs":["mew\n","wuffuw\n","qqqqqqqq\n"],"sample_outputs":["3\n","5\n","0\n"],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop, std.bitmanip, std.datetime;\n\nbool is_p(string s) {\n int n = s.length.to!int;\n foreach (i; 0..n\/2) if (s[i] != s[n-i-1]) return false;\n return true;\n}\n\nvoid main() {\n auto S = readln.chomp;\n auto N = S.length.to!int;\n\n foreach_reverse (i; 1..N+1) {\n foreach (j; 0..N-i+1) {\n if (!is_p(S[j..j+i])) {\n writeln(i);\n return;\n }\n }\n }\n\n writeln(0);\n}\n","testcases":"[{'input': ['mew\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['wuffuw\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['qqqqqqqq\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['ijvji\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['iiiiiii\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['wobervhvvkihcuyjtmqhaaigvvgiaahqmtjyuchikvvhvrebow\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['wobervhvvkihcuyjtmqhaaigvahheoqleromusrartldojsjvy\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['ijvxljt\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['fyhcncnchyf\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['ffffffffffff\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['fyhcncfsepqj\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['ybejrrlbcinttnicblrrjeby\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['yyyyyyyyyyyyyyyyyyyyyyyyy\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['ybejrrlbcintahovgjddrqatv\\r\\n'], 'output': ['25\\r\\n']}, {'input': ['oftmhcmclgyqaojljoaqyglcmchmtfo\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['oooooooooooooooooooooooooooooooo\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['oftmhcmclgyqaojllbotztajglsmcilv\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['gxandbtgpbknxvnkjaajknvxnkbpgtbdnaxg\\r\\n'], 'output': ['35\\r\\n']}, {'input': ['gggggggggggggggggggggggggggggggggggg\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['gxandbtgpbknxvnkjaygommzqitqzjfalfkk\\r\\n'], 'output': ['36\\r\\n']}, {'input': ['fcliblymyqckxvieotjooojtoeivxkcqymylbilcf\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['fffffffffffffffffffffffffffffffffffffffffff\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['fcliblymyqckxvieotjootiqwtyznhhvuhbaixwqnsy\\r\\n'], 'output': ['43\\r\\n']}, {'input': ['rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['rajccqwqnqmshmerpvjyfepxwpxyldzpzhctqjnstxyfmlhiy\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['a\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abca\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaabaaaaa\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['aba\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['asaa\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aabaa\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aabbaa\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['abcdaaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaholaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['abcdefghijka\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['aaadcba\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaaabaaaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['abaa\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['abcbaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['ab\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['l\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aaaabcaaaa\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['abbaaaaaabba\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['abaaa\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['baa\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aaaaaaabbba\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['ccbcc\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['bbbaaab\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['abaaaaaaaa\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['abaaba\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['aabsdfaaaa\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['aaaba\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['aaabaaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['baaabbb\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['ccbbabbcc\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['cabc\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aabcd\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['abcdea\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['bbabb\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaabababaaaaa\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['bbabbb\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['aababd\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abaaaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['aaaaaaaabbba\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['aabca\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['aaabccbaaa\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaab\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['babb\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['abcaa\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['qwqq\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaaaaaaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['aaab\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaaabaaaaa\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['wwuww\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaabcbaaaaa\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['aaabbbaaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['aabcbaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abccdefccba\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['aabbcbbaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['aaaabbaaaa\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['aabcda\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abbca\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['aaaaaabbaaa\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['sssssspssssss\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['sdnmsdcs\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['aaabbbccbbbaaa\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['cbdbdc\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abb\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['abcdefaaaa\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['abbbaaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['v\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abccbba\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['axyza\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['abcdefgaaaa\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['aaabcdaaa\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['aaaacaaaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['abbbaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abcdee\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['oom\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aabcaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abba\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aaca\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aacbca\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['ababa\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['abcda\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['cccaaccc\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaabcda\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aabaaaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['abbaaaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaabcbaaa\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['aabba\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['xyxx\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aaaaaaaaaaaabc\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['bbaaaabb\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['aaabaa\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['sssssabsssss\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['bbbaaaabbb\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['abbbbaaaa\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['wwufuww\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['oowoo\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['cccaccc\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['aaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['bbbcc\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['abcdef\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['abbba\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['aab\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['aaba\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['azbyaaa\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['oooooiooooo\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['aabbbbbaaaaaa\\r\\n'], 'output': ['13\\r\\n']}]","id":603} {"difficulty":2500,"lang":"D","lang_cluster":"D","src_uid":"1017_F","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.conv;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\n\r\nimmutable int limit = 20_000;\r\n\r\nvoid main ()\r\n{\r\n\tuint n;\r\n\tuint a, b, c, d;\r\n\twhile (readf (\" %s %s %s %s %s\", &n, &a, &b, &c, &d) > 0)\r\n\t{\r\n\t\tauto s = new bool [limit];\r\n\t\ts[] = true;\r\n\t\ts[0] = false;\r\n\t\ts[1] = false;\r\n\t\tfor (uint g = 2; g * g < limit; g++)\r\n\t\t{\r\n\t\t\tif (s[g])\r\n\t\t\t{\r\n\t\t\t\tfor (uint e = g; e * g < limit; e++)\r\n\t\t\t\t{\r\n\t\t\t\t\ts[e * g] = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tuint [] p;\r\n\t\tforeach (g; 0..limit)\r\n\t\t{\r\n\t\t\tif (s[g])\r\n\t\t\t{\r\n\t\t\t\tp ~= g;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tuint res = 0;\r\n\t\tn += 1;\r\n\t\tauto t = new bool [limit];\r\n\t\tfor (uint start = 0; start < n; start += limit)\r\n\t\t{\r\n\t\t\tuint finish = min (start + limit, n);\r\n\t\t\tif (start == 0)\r\n\t\t\t{\r\n\t\t\t\tt[] = s[];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tt[] = true;\r\n\t\t\t\tforeach (g; p)\r\n\t\t\t\t{\r\n\t\t\t\t\tuint lo = (start + g - 1) \/ g * g;\r\n\t\t\t\t\twhile (lo < finish)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tt[lo - start] = false;\r\n\t\t\t\t\t\tlo += g;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tforeach (i; start..finish)\r\n\t\t\t{\r\n\t\t\t\tif (t[i - start])\r\n\t\t\t\t{\r\n\t\t\t\t\tuint cur = a;\r\n\t\t\t\t\tcur = cur * i + b;\r\n\t\t\t\t\tcur = cur * i + c;\r\n\t\t\t\t\tcur = cur * i + d;\r\n\r\n\t\t\t\t\tuint mult = 0;\r\n\t\t\t\t\tuint k = n;\r\n\t\t\t\t\twhile (k > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tk \/= i;\r\n\t\t\t\t\t\tmult += k;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tres += cur * mult;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","description":"Notice: unusual memory limit!After the war, destroyed cities in the neutral zone were restored. And children went back to school.The war changed the world, as well as education. In those hard days, a new math concept was created.As we all know, logarithm function can be described as: $$$$$$ \\log(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 \\log p_1 + a_2 \\log p_2 + ... + a_k \\log p_k $$$$$$ Where $$$p_1^{a_1}p_2^{a_2}...p_k^{a_2}$$$ is the prime factorization of a integer. A problem is that the function uses itself in the definition. That is why it is hard to calculate.So, the mathematicians from the neutral zone invented this: $$$$$$ \\text{exlog}_f(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 f(p_1) + a_2 f(p_2) + ... + a_k f(p_k) $$$$$$Notice that $$$\\text{exlog}_f(1)$$$ is always equal to $$$0$$$.This concept for any function $$$f$$$ was too hard for children. So teachers told them that $$$f$$$ can only be a polynomial of degree no more than $$$3$$$ in daily uses (i.e., $$$f(x) = Ax^3+Bx^2+Cx+D$$$).\"Class is over! Don't forget to do your homework!\" Here it is: $$$$$$ \\sum_{i=1}^n \\text{exlog}_f(i) $$$$$$Help children to do their homework. Since the value can be very big, you need to find the answer modulo $$$2^{32}$$$.","input_specification":"The only line contains five integers $$$n$$$, $$$A$$$, $$$B$$$, $$$C$$$, and $$$D$$$ ($$$1 \\le n \\le 3 \\cdot 10^8$$$, $$$0 \\le A,B,C,D \\le 10^6$$$).\n","output_specification":"Print the answer modulo $$$2^{32}$$$.\n","notes":"In the first sample:\n$$$\\text{exlog}_f(1) = 0$$$\n$$$\\text{exlog}_f(2) = 2$$$\n$$$\\text{exlog}_f(3) = 3$$$\n$$$\\text{exlog}_f(4) = 2 + 2 = 4$$$\n$$$\\text{exlog}_f(5) = 5$$$\n$$$\\text{exlog}_f(6) = 2 + 3 = 5$$$\n$$$\\text{exlog}_f(7) = 7$$$\n$$$\\text{exlog}_f(8) = 2 + 2 + 2 = 6$$$\n$$$\\text{exlog}_f(9) = 3 + 3 = 6$$$\n$$$\\text{exlog}_f(10) = 2 + 5 = 7$$$\n$$$\\text{exlog}_f(11) = 11$$$\n$$$\\text{exlog}_f(12) = 2 + 2 + 3 = 7$$$\n$$$ \\sum_{i=1}^{12} \\text{exlog}_f(i)=63 $$$\nIn the second sample:\n$$$\\text{exlog}_f(1) = 0$$$\n$$$\\text{exlog}_f(2) = (1 \\times 2^3 + 2 \\times 2^2 + 3 \\times 2 + 4) = 26$$$\n$$$\\text{exlog}_f(3) = (1 \\times 3^3 + 2 \\times 3^2 + 3 \\times 3 + 4) = 58$$$\n$$$\\text{exlog}_f(4) = 2 \\times \\text{exlog}_f(2) = 52$$$\n$$$ \\sum_{i=1}^4 \\text{exlog}_f(i)=0+26+58+52=136 $$$\n","sample_inputs":["12 0 0 1 0\n","4 1 2 3 4\n"],"sample_outputs":["63\n","136\n"],"human_solution":"import std.algorithm;\r\nimport std.conv;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\n\r\nimmutable int limit = 50_000;\r\n\r\nvoid main ()\r\n{\r\n\tauto s = new bool [limit];\r\n\ts[] = true;\r\n\ts[0] = false;\r\n\ts[1] = false;\r\n\tfor (uint g = 2; g * g < limit; g++)\r\n\t{\r\n\t\tif (s[g])\r\n\t\t{\r\n\t\t\tfor (uint e = g; e * g < limit; e++)\r\n\t\t\t{\r\n\t\t\t\ts[e * g] = false;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tuint [] p;\r\n\tforeach (g; 0..limit)\r\n\t{\r\n\t\tif (s[g])\r\n\t\t{\r\n\t\t\tp ~= g;\r\n\t\t}\r\n\t}\r\n\r\n\tuint n;\r\n\tuint a, b, c, d;\r\n\twhile (readf (\" %s %s %s %s %s\", &n, &a, &b, &c, &d) > 0)\r\n\t{\r\n\t\tuint res = 0;\r\n\t\tauto t = new bool [limit];\r\n\t\tfor (uint start = 0; start <= n; start += limit)\r\n\t\t{\r\n\t\t\tuint finish = min (start + limit, n + 1);\r\n\t\t\tif (start == 0)\r\n\t\t\t{\r\n\t\t\t\tt[] = s[];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tt[] = true;\r\n\t\t\t\tforeach (g; p)\r\n\t\t\t\t{\r\n\t\t\t\t\tuint lo = (start + g - 1) \/ g * g;\r\n\t\t\t\t\twhile (lo < finish)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tt[lo - start] = false;\r\n\t\t\t\t\t\tlo += g;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tforeach (i; start..finish)\r\n\t\t\t{\r\n\t\t\t\tif (t[i - start])\r\n\t\t\t\t{\r\n\t\t\t\t\tdebug {writeln (i);}\r\n\t\t\t\t\tuint cur = a;\r\n\t\t\t\t\tcur = cur * i + b;\r\n\t\t\t\t\tcur = cur * i + c;\r\n\t\t\t\t\tcur = cur * i + d;\r\n\r\n\t\t\t\t\tuint mult = 0;\r\n\t\t\t\t\tuint k = n;\r\n\t\t\t\t\twhile (k > 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tk \/= i;\r\n\t\t\t\t\t\tmult += k;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tres += cur * mult;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['12 0 0 1 0\\r\\n'], 'output': ['63\\r\\n']}, {'input': ['4 1 2 3 4\\r\\n'], 'output': ['136\\r\\n']}, {'input': ['100 0 0 1 0\\r\\n'], 'output': ['2280\\r\\n']}, {'input': ['300000000 0 0 1 0\\r\\n'], 'output': ['2157335784\\r\\n']}, {'input': ['300000000 1000000 1000000 1000000 1000000\\r\\n'], 'output': ['2738740608\\r\\n']}, {'input': ['1 1 1 0 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 77509 917257 256046 85912\\r\\n'], 'output': ['2189425894\\r\\n']}, {'input': ['174 914867 134668 860580 813837\\r\\n'], 'output': ['1906368573\\r\\n']}, {'input': ['7307 15667 448959 550199 568110\\r\\n'], 'output': ['3869526700\\r\\n']}, {'input': ['23524 232395 15809 278124 45779\\r\\n'], 'output': ['4101232007\\r\\n']}, {'input': ['797787 621368 705429 32396 138631\\r\\n'], 'output': ['4268163107\\r\\n']}, {'input': ['5632674 151219 471037 547065 635009\\r\\n'], 'output': ['4254536482\\r\\n']}, {'input': ['96487145 877838 225309 602918 676219\\r\\n'], 'output': ['4004191947\\r\\n']}, {'input': ['43388160 290506 261589 262358 287454\\r\\n'], 'output': ['3243153926\\r\\n']}, {'input': ['84633708 687509 234119 265599 226693\\r\\n'], 'output': ['3650325824\\r\\n']}, {'input': ['120741147 9828 205964 157159 240615\\r\\n'], 'output': ['1104433686\\r\\n']}, {'input': ['263213444 406832 252492 85717 179854\\r\\n'], 'output': ['3232411671\\r\\n']}, {'input': ['300000000 3 4 5 6\\r\\n'], 'output': ['1232483660\\r\\n']}]","id":604} {"difficulty":2600,"lang":"D","lang_cluster":"D","src_uid":"1091_F","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.conv;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\twhile (readf (\" %s\", &n) > 0)\r\n\t{\r\n\t\treadln;\r\n\t\tauto d = readln.splitter.map !(to !(long)).array;\r\n\t\tauto s = readln.strip;\r\n\r\n\t\tauto need = new long [n + 1];\r\n\t\tauto grassAhead = new long [n + 1];\r\n\t\tlong cur = 0;\r\n\t\tneed[n] = cur;\r\n\t\tgrassAhead[n] = 0;\r\n\t\tforeach_reverse (i; 0..n)\r\n\t\t{\r\n\t\t\tgrassAhead[i] = grassAhead[i + 1];\r\n\t\t\tswitch (s[i])\r\n\t\t\t{\r\n\t\t\t\tcase 'G': cur -= d[i];\r\n\t\t\t\t grassAhead[i] += d[i]; break;\r\n\t\t\t\tcase 'W': cur -= d[i]; break;\r\n\t\t\t\tcase 'L': cur += d[i]; break;\r\n\t\t\t\tdefault: assert (false);\r\n\t\t\t}\r\n\t\t\tcur = max (cur, 0);\r\n\t\t\tneed[i] = cur;\r\n\t\t}\r\n\t\tdebug {writeln (need);}\r\n\r\n\t\tbool seenWater = false;\r\n\t\tlong res = 0;\r\n\t\tlong energy = 0;\r\n\t\tlong walkDist = 0;\r\n\t\tlong swimDist = 0;\r\n\t\tlong grassFlown = 0;\r\n\t\tforeach (i; 0..n)\r\n\t\t{\r\n\t\t\tswitch (s[i])\r\n\t\t\t{\r\n\t\t\t\tcase 'G': energy += d[i];\r\n\t\t\t\t res += d[i] * 5; break;\r\n\t\t\t\tcase 'W': energy += d[i];\r\n\t\t\t\t seenWater = true;\r\n\t\t\t\t res += d[i] * 3; break;\r\n\t\t\t\tcase 'L': energy -= d[i];\r\n\t\t\t\t res += d[i] * 1; break;\r\n\t\t\t\tdefault: assert (false);\r\n\t\t\t}\r\n\t\t\tif (energy < 0)\r\n\t\t\t{\r\n\t\t\t\tres += (seenWater ? 3 : 5) * (-energy);\r\n\t\t\t\tenergy = 0;\r\n\t\t\t}\r\n\t\t\tif (energy > need[i + 1])\r\n\t\t\t{\r\n\t\t\t\tauto delta = energy - need[i + 1];\r\n\t\t\t\tauto deltaGrass = min (delta,\r\n\t\t\t\t grassAhead[i] - grassFlown);\r\n\t\t\t\tgrassFlown += deltaGrass;\r\n\t\t\t\tres -= 2 * deltaGrass;\r\n\t\t\t\tres -= 1 * (delta - deltaGrass);\r\n\t\t\t\tenergy = need[i + 1];\r\n\t\t\t}\r\n\t\t\tif (s[i] == 'G')\r\n\t\t\t{\r\n\t\t\t\tgrassFlown = max (grassFlown - d[i], 0);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","description":"Bob is a duck. He wants to get to Alice's nest, so that those two can duck! Duck is the ultimate animal! (Image courtesy of See Bang)The journey can be represented as a straight line, consisting of $$$n$$$ segments. Bob is located to the left of the first segment, while Alice's nest is on the right of the last segment. Each segment has a length in meters, and also terrain type: grass, water or lava. Bob has three movement types: swimming, walking and flying. He can switch between them or change his direction at any point in time (even when he is located at a non-integer coordinate), and doing so doesn't require any extra time. Bob can swim only on the water, walk only on the grass and fly over any terrain. Flying one meter takes $$$1$$$ second, swimming one meter takes $$$3$$$ seconds, and finally walking one meter takes $$$5$$$ seconds.Bob has a finite amount of energy, called stamina. Swimming and walking is relaxing for him, so he gains $$$1$$$ stamina for every meter he walks or swims. On the other hand, flying is quite tiring, and he spends $$$1$$$ stamina for every meter flown. Staying in place does not influence his stamina at all. Of course, his stamina can never become negative. Initially, his stamina is zero.What is the shortest possible time in which he can reach Alice's nest? ","input_specification":"The first line contains a single integer $$$n$$$\u00a0($$$1 \\leq n \\leq 10^5$$$)\u00a0\u2014 the number of segments of terrain. \nThe second line contains $$$n$$$ integers $$$l_1, l_2, \\dots, l_n$$$\u00a0($$$1 \\leq l_i \\leq 10^{12}$$$). The $$$l_i$$$ represents the length of the $$$i$$$-th terrain segment in meters.\nThe third line contains a string $$$s$$$ consisting of $$$n$$$ characters \"G\", \"W\", \"L\", representing Grass, Water and Lava, respectively. \nIt is guaranteed that the first segment is not Lava.\n","output_specification":"Output a single integer $$$t$$$\u00a0\u2014 the minimum time Bob needs to reach Alice. \n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import std.algorithm;\r\nimport std.conv;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\twhile (readf (\" %s\", &n) > 0)\r\n\t{\r\n\t\treadln;\r\n\t\tauto d = readln.splitter.map !(to !(long)).array;\r\n\t\tauto s = readln.strip;\r\n\r\n\t\tauto need = new long [n + 1];\r\n\t\tauto grassAhead = new long [n + 1];\r\n\t\tlong cur = 0;\r\n\t\tneed[n] = cur;\r\n\t\tgrassAhead[n] = 0;\r\n\t\tforeach_reverse (i; 0..n)\r\n\t\t{\r\n\t\t\tgrassAhead[i] = grassAhead[i + 1];\r\n\t\t\tswitch (s[i])\r\n\t\t\t{\r\n\t\t\t\tcase 'G': cur -= d[i];\r\n\t\t\t\t grassAhead[i] += d[i] * 2; break;\r\n\t\t\t\tcase 'W': cur -= d[i]; break;\r\n\t\t\t\tcase 'L': cur += d[i]; break;\r\n\t\t\t\tdefault: assert (false);\r\n\t\t\t}\r\n\t\t\tcur = max (cur, 0);\r\n\t\t\tneed[i] = cur;\r\n\t\t}\r\n\t\tdebug {writeln (need);}\r\n\t\tdebug {writeln (grassAhead);}\r\n\r\n\t\tbool seenWater = false;\r\n\t\tlong res = 0;\r\n\t\tlong energy = 0;\r\n\t\tlong walkDist = 0;\r\n\t\tlong swimDist = 0;\r\n\t\tlong grassFlown = 0;\r\n\t\tforeach (i; 0..n)\r\n\t\t{\r\n\t\t\tswitch (s[i])\r\n\t\t\t{\r\n\t\t\t\tcase 'G': energy += d[i];\r\n\t\t\t\t res += d[i] * 5; break;\r\n\t\t\t\tcase 'W': energy += d[i];\r\n\t\t\t\t seenWater = true;\r\n\t\t\t\t res += d[i] * 3; break;\r\n\t\t\t\tcase 'L': energy -= d[i];\r\n\t\t\t\t res += d[i] * 1; break;\r\n\t\t\t\tdefault: assert (false);\r\n\t\t\t}\r\n\t\t\tif (energy < 0)\r\n\t\t\t{\r\n\t\t\t\tres += (seenWater ? 3 : 5) * (-energy);\r\n\t\t\t\tenergy = 0;\r\n\t\t\t}\r\n\t\t\tif (energy > need[i + 1])\r\n\t\t\t{\r\n\t\t\t\tauto delta = energy - need[i + 1];\r\n\t\t\t\tauto deltaGrass = min (delta,\r\n\t\t\t\t grassAhead[i] - grassFlown);\r\n\t\t\t\tgrassFlown += deltaGrass;\r\n\t\t\t\tres -= 2 * deltaGrass;\r\n\t\t\t\tres -= 1 * (delta - deltaGrass);\r\n\t\t\t\tenergy = need[i + 1];\r\n\t\t\t}\r\n\t\t\tif (s[i] == 'G')\r\n\t\t\t{\r\n\t\t\t\tgrassFlown = max (grassFlown - d[i] * 2, 0);\r\n\t\t\t}\r\n\t\t\tdebug {writeln (grassFlown);}\r\n\t\t}\r\n\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['1\\r\\n10\\r\\nG\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['2\\r\\n10 10\\r\\nWL\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\nWL\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['3\\r\\n10 10 10\\r\\nGLW\\r\\n'], 'output': ['80\\r\\n']}, {'input': ['2\\r\\n2 10\\r\\nGL\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['1\\r\\n10\\r\\nW\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['1\\r\\n9\\r\\nW\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['1\\r\\n9\\r\\nG\\r\\n'], 'output': ['27\\r\\n']}, {'input': ['2\\r\\n10 10\\r\\nGL\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['3\\r\\n10 10 50\\r\\nWGL\\r\\n'], 'output': ['220\\r\\n']}, {'input': ['3\\r\\n10 9 10\\r\\nGLW\\r\\n'], 'output': ['77\\r\\n']}, {'input': ['2\\r\\n100 100\\r\\nWG\\r\\n'], 'output': ['400\\r\\n']}, {'input': ['2\\r\\n100 100\\r\\nGW\\r\\n'], 'output': ['500\\r\\n']}, {'input': ['2\\r\\n1 1000000000000\\r\\nGW\\r\\n'], 'output': ['2000000000003\\r\\n']}, {'input': ['4\\r\\n1 1 1 1\\r\\nWGWL\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['10\\r\\n324839129156 133475576222 987711341463 185514358673 88712073883 243757012712 950854402304 21947060440 598567289966 674328002732\\r\\nGLLLLLLLLW\\r\\n'], 'output': ['20611890699442\\r\\n']}, {'input': ['5\\r\\n2 2 1 1 1\\r\\nWGLLW\\r\\n'], 'output': ['16\\r\\n']}]","id":605} {"difficulty":2200,"lang":"D","lang_cluster":"D","src_uid":"1092_D1","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\r\nimport std.typecons, std.range, std.random, std.math, std.container;\r\nimport std.numeric, std.bigint, core.bitop, core.stdc.string;\r\n\r\nvoid main() {\r\n auto N = readln.chomp.to!int;\r\n auto A = readln.split.map!(x => x.to!long % 2).array;\r\n\r\n auto cnt = A.count(1);\r\n\r\n if (cnt % 2 == 1 && (N - cnt) % 2 == 1) {\r\n writeln(\"NO\");\r\n return;\r\n }\r\n\r\n if ((N-1).iota.map!(i => A[i] != A[i+1]).all) {\r\n writeln(\"NO\");\r\n return;\r\n }\r\n\r\n writeln(\"YES\");\r\n}\r\n","description":"Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.The current state of the wall can be respresented by a sequence $$$a$$$ of $$$n$$$ integers, with $$$a_i$$$ being the height of the $$$i$$$-th part of the wall.Vova can only use $$$2 \\times 1$$$ bricks to put in the wall (he has infinite supply of them, however).Vova can put bricks horizontally on the neighboring parts of the wall of equal height. It means that if for some $$$i$$$ the current height of part $$$i$$$ is the same as for part $$$i + 1$$$, then Vova can put a brick there and thus increase both heights by 1. Obviously, Vova can't put bricks in such a way that its parts turn out to be off the borders (to the left of part $$$1$$$ of the wall or to the right of part $$$n$$$ of it).The next paragraph is specific to the version 1 of the problem.Vova can also put bricks vertically. That means increasing height of any part of the wall by 2.Vova is a perfectionist, so he considers the wall completed when: all parts of the wall has the same height; the wall has no empty spaces inside it. Can Vova complete the wall using any amount of bricks (possibly zero)?","input_specification":"The first line contains a single integer $$$n$$$ ($$$1 \\\\le n \\\\le 2 \\\\cdot 10^5$$$) \u2014 the number of parts in the wall.\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\\\dots, a_n$$$ ($$$1 \\\\le a_i \\\\le 10^9$$$) \u2014 the initial heights of the parts of the wall.\n","output_specification":"Print \"YES\" if Vova can complete the wall using any amount of bricks (possibly zero).\nPrint \"NO\" otherwise.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\r\nimport std.typecons, std.range, std.random, std.math, std.container;\r\nimport std.numeric, std.bigint, core.bitop, core.stdc.string;\r\n\r\nvoid main() {\r\n auto N = readln.chomp.to!int;\r\n auto A = readln.split.map!(x => x.to!long % 2).array;\r\n\r\n bool solve() {\r\n if (A.count(1) % 2 == 1) {\r\n return false;\r\n }\r\n\r\n auto even = iota(0, N, 2).filter!(i => A[i] == 1).array.length;\r\n auto odd = iota(1, N, 2).filter!(i => A[i] == 1).array.length;\r\n return even == odd;\r\n }\r\n\r\n if (solve) {\r\n writeln(\"YES\");\r\n return;\r\n }\r\n\r\n foreach (i; 0..N) A[i] ^= 1;\r\n\r\n if (solve) {\r\n writeln(\"YES\");\r\n return;\r\n }\r\n\r\n writeln(\"NO\");\r\n}\r\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":606} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"1095_F","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.container;\r\nimport std.random;\r\nimport std.range;\r\nimport std.algorithm;\r\nimport std.typecons;\r\nimport std.conv;\r\nimport std.format;\r\n\r\nint[] par;\r\nlong[] smallest;\r\n\r\nint find_set(int v) {\r\n\tif (v == par[v]) return v;\r\n\treturn par[v] = find_set(par[v]);\r\n}\r\n\r\nMt19937 rng;\r\n\r\nvoid unite(int a, int b) {\r\n\ta = find_set(a);\r\n\tb = find_set(b);\r\n\tif (rng.front % 2) swap(a, b);\r\n\trng.popFront();\r\n\tpar[b] = a;\r\n\tsmallest[a] = min(smallest[a], smallest[b]);\r\n}\r\n\r\nvoid main() \r\n{\r\n\tpar = iota(200000).array;\r\n\r\n\tint n, m;\r\n\tstdin.byLine.front.formattedRead!\"%d %d\"(n, m);\r\n\r\n\tauto S = redBlackTree!(Tuple!(long, int));\r\n\tauto offers = redBlackTree!(Tuple!(long, int, int));\r\n\r\n\tsmallest = stdin.byLine.front.split(\" \").map!`parse!long(a)`.array;\r\n\r\n\tsmallest.writeln;\r\n\r\n\tforeach (i, e; smallest) {\r\n\t\tS.insert(tuple(e, i.to!int));\r\n\t}\r\n\r\n\tfor (int i = 0; i < m; i++) {\r\n\t\tint a, b;\r\n\t\tlong w;\r\n\t\tstdin.byLine.front.formattedRead!\"%d %d %d\"(a, b, w);\r\n\r\n\t\ta--; b--;\r\n\t\toffers.insert(tuple(w, a, b));\r\n\t}\r\n\r\n\tlong totalCost = 0;\r\n\twhile (true) {\r\n\t\tif (S.length == 1) {\r\n\t\t\twriteln(totalCost);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\twhile (offers.length > 0 && find_set(offers.front[1]) == find_set(offers.front[2]))\r\n\t\t\toffers.removeFront();\r\n\r\n\t\tauto c1 = S.front; S.removeFront();\r\n\t\tauto c2 = S.front; S.removeFront();\r\n\t\tauto cost = c1[0] + c2[0];\r\n\r\n\t\tif (offers.length > 0 && offers.front[0] < cost) {\r\n\t\t\tS.insert([c1, c2]);\r\n\t\t\ttotalCost += offers.front[0];\r\n\t\t\tint x = offers.front[1];\r\n\t\t\tint y = offers.front[2];\r\n\r\n\t\t\tint setx = find_set(x);\r\n\t\t\tint sety = find_set(y);\r\n\r\n\t\t\tS.removeKey(tuple(smallest[setx], setx));\r\n\t\t\tS.removeKey(tuple(smallest[sety], sety));\r\n\t\t\tunite(x, y);\r\n\t\t\tint setxy = find_set(x);\r\n\t\t\tS.insert(tuple(smallest[setxy], setxy));\r\n\t\t} else {\r\n\t\t\ttotalCost += cost;\r\n\t\t\tint x = c1[1];\r\n\t\t\tint y = c2[1];\r\n\t\t\tunite(x, y);\r\n\r\n\t\t\tint setxy = find_set(x);\r\n\t\t\tS.insert(tuple(smallest[setxy], setxy));\r\n\t\t}\r\n\t}\r\n}","description":"You are given an undirected graph consisting of $$$n$$$ vertices. A number is written on each vertex; the number on vertex $$$i$$$ is $$$a_i$$$. Initially there are no edges in the graph.You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $$$x$$$ and $$$y$$$ is $$$a_x + a_y$$$ coins. There are also $$$m$$$ special offers, each of them is denoted by three numbers $$$x$$$, $$$y$$$ and $$$w$$$, and means that you can add an edge connecting vertices $$$x$$$ and $$$y$$$ and pay $$$w$$$ coins for it. You don't have to use special offers: if there is a pair of vertices $$$x$$$ and $$$y$$$ that has a special offer associated with it, you still may connect these two vertices paying $$$a_x + a_y$$$ coins for it.What is the minimum number of coins you have to spend to make the graph connected? Recall that a graph is connected if it's possible to get from any vertex to any other vertex using only the edges belonging to this graph.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\\\le n \\\\le 2 \\\\cdot 10^5$$$, $$$0 \\\\le m \\\\le 2 \\\\cdot 10^5$$$) \u2014 the number of vertices in the graph and the number of special offers, respectively.\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\\\dots, a_n$$$ ($$$1 \\\\le a_i \\\\le 10^{12}$$$) \u2014 the numbers written on the vertices.\nThen $$$m$$$ lines follow, each containing three integers $$$x$$$, $$$y$$$ and $$$w$$$ ($$$1 \\\\le x, y \\\\le n$$$, $$$1 \\\\le w \\\\le 10^{12}$$$, $$$x \\\\ne y$$$) denoting a special offer: you may add an edge connecting vertex $$$x$$$ and vertex $$$y$$$, and this edge will cost $$$w$$$ coins.\n","output_specification":"Print one integer \u2014 the minimum number of coins you have to pay to make the graph connected.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\r\nimport std.typecons, std.range, std.random, std.math, std.container;\r\nimport std.numeric, std.bigint, core.bitop, core.stdc.string;\r\n\r\n\r\nvoid main() {\r\n auto s = readln.split.map!(to!int);\r\n auto N = s[0];\r\n auto M = s[1];\r\n auto A = readln.split.map!(to!long).array;\r\n auto X = new Tuple!(int, long)[][](N);\r\n foreach (i; 0..M) {\r\n auto t = readln.split;\r\n auto u = t[0].to!int - 1;\r\n auto v = t[1].to!int - 1;\r\n auto w = t[2].to!long;\r\n X[u] ~= tuple(v, w);\r\n X[v] ~= tuple(u, w);\r\n }\r\n\r\n long ans = 0;\r\n int S = A.minIndex.to!int;\r\n auto pq = new BinaryHeap!(Array!(Tuple!(int, long)), \"a[1] > b[1]\")();\r\n auto used = new bool[](N);\r\n used[S] = true;\r\n\r\n foreach (i; 0..N) {\r\n if (i == S) continue;\r\n pq.insert(tuple(i, A[S] + A[i]));\r\n }\r\n\r\n foreach (t; X[S]) {\r\n pq.insert(tuple(t[0], t[1]));\r\n }\r\n\r\n while (!pq.empty) {\r\n auto t = pq.front;\r\n pq.removeFront;\r\n auto u = t[0];\r\n auto w = t[1];\r\n if (used[u]) continue;\r\n ans += w;\r\n used[u] = true;\r\n foreach (v; X[u]) {\r\n if (used[v[0]]) continue;\r\n pq.insert(tuple(v[0], v[1]));\r\n }\r\n }\r\n\r\n ans.writeln;\r\n}\r\n","testcases":"[{'input': ['3 2\\r\\n1 3 3\\r\\n2 3 5\\r\\n2 1 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4 0\\r\\n1 3 3 7\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['5 4\\r\\n1 2 3 4 5\\r\\n1 2 8\\r\\n1 3 10\\r\\n1 4 7\\r\\n1 5 15\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['10 0\\r\\n9 9 5 2 2 5 8 5 1 7\\r\\n'], 'output': ['61\\r\\n']}, {'input': ['10 1\\r\\n2 2 9 7 2 3 7 7 1 1\\r\\n5 8 4\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['10 10\\r\\n3 4 5 10 10 9 5 4 7 8\\r\\n1 5 5\\r\\n10 3 18\\r\\n1 7 20\\r\\n7 8 20\\r\\n10 4 8\\r\\n10 2 17\\r\\n9 4 2\\r\\n7 5 16\\r\\n1 8 17\\r\\n7 10 18\\r\\n'], 'output': ['67\\r\\n']}, {'input': ['1 0\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n72 94\\r\\n2 1 24\\r\\n'], 'output': ['24\\r\\n']}, {'input': ['2 1\\r\\n100000000000 100000000000\\r\\n1 2 199999999999\\r\\n'], 'output': ['199999999999\\r\\n']}, {'input': ['3 3\\r\\n2 3 1\\r\\n1 2 18\\r\\n2 3 18\\r\\n3 1 18\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['2 0\\r\\n1000000000000 1000000000000\\r\\n'], 'output': ['2000000000000\\r\\n']}]","id":607} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"1163_C1","execute_outcome":"WRONG_ANSWER","source_code":"void main() {\r\nimport std.stdio;\r\nwriteln(long.sizeof);\r\n}","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.\nEach 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.\nIt is guaranteed that all of these $$$n$$$ points are distinct.\n","output_specification":"Print a single integer\u00a0\u2014 the number of pairs of wires that are intersecting.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import std.stdio, std.conv, std.string;\nimport std.array, std.range, std.algorithm, std.container;\nimport std.math, std.random, std.bigint, std.datetime, std.format;\nstring read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }\n\nint DEBUG_LEVEL = 0;\nvoid print()(){ writeln(\"\"); }\nvoid print(T, A ...)(T t, lazy A a){ write(t), print(a); }\nvoid print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }\n\nvoid main(string[] args){\n\tif(args.length > 1 && args[1] == \"-debug\"){\n\t\tif(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;\n\t\telse DEBUG_LEVEL = 1;\n\t}\n\t\n\tint n = read.to!int;\n\tlong[] xs, ys;\n\tforeach(i; 0 .. n) xs ~= read.to!int, ys ~= read.to!int;\n\t\n\tprint!1(\"xs:\", xs);\n\tprint!1(\"ys:\", ys);\n\t\n\tlong[long] kcnt;\n\tbool[long] mset;\n\tforeach(i; 0 .. n) foreach(j; 0 .. i){\n\t\tlong dx = xs[i] - xs[j];\n\t\tlong dy = ys[i] - ys[j];\n\t\tlong c = dx * ys[i] - dy * xs[i];\n\t\tprint!1(\"dx:\", dx, \" dy:\", dy, \" c:\", c);\n\t\t\n\t\tif(dx == 0){\n\t\t\tif(dy < 0) dy = -dy, c = -c;\n\t\t\tlong g = gcd(dy, c);\n\t\t\tdy \/= g, c \/= g;\n\t\t}\n\t\telse if(dy == 0){\n\t\t\tif(dx < 0) dx = -dx, c = -c;\n\t\t\tlong g = gcd(dx, c);\n\t\t\tdx \/= g, c \/= g;\n\t\t}\n\t\telse if(c == 0){\n\t\t\tif(dx < 0) dx = -dx, dy = -dy;\n\t\t\tlong g = gcd(dx, dy);\n\t\t\tdx \/= g, dy \/= g;\n\t\t}\n\t\telse{\n\t\t\tif(dx < 0) dx = -dx, dy = -dy, c = -c;\n\t\t\tlong g = gcd(gcd(dx, dy), c);\n\t\t\tdx \/= g, dy \/= g, c \/= g;\n\t\t}\n\t\t\n\t\tprint!1(\" -> dx:\", dx, \" dy:\", dy, \" c:\", c);\n\t\t\n\t\tlong k = 100000 * dy + dx;\n\t\tlong m = k * 10000000 + c;\n\t\tif(m !in mset){\n\t\t\tif(k !in kcnt) kcnt[k] = 0;\n\t\t\tmset[m] = 1;\n\t\t\tkcnt[k] += 1;\n\t\t}\n\t}\n\tprint!1(\"kcnt:\", kcnt);\n\tprint!1(\"mset:\", mset);\n\t\n\tlong[] ks = kcnt.keys;\n\tlong[] ms = mset.keys;\n\tlong ans = ms.length * (ms.length - 1) \/ 2;\n\tforeach(k; ks) ans -= kcnt[k] * (kcnt[k] - 1) \/ 2;\n\tans.writeln;\n\t\t\n\t\n}\nlong gcd(long a, long b){\n\tif(b == 0) return a;\n\tif(b < 0) return gcd(a, -b);\n\tif(a % b == 0) return b;\n\tif(a < b) return gcd(b, a);\n\telse return gcd(b, a % b);\n}\n\n\n\/*\n\n\"How many different direction vectors can we have?\"\n\n(x1, y1), (x2, y2) -> (x1 - x2, y1 - y2).\nhere x1 - x2 and y1 - y2 are relatively prime and x1 - x2 > 0,\nor (1, 0), or (0, 1).\n\nO(N^2) = 1000 x 1000.\n\n(y1 - y2)(x - x1) - (x1 - x2)(y - y1) = 0\ndy x - dx y + dx y1 - dy x1 = 0\n\n*\/\n","testcases":"[{'input': ['4\\r\\n0 0\\r\\n1 1\\r\\n0 3\\r\\n1 2\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['4\\r\\n0 0\\r\\n0 2\\r\\n0 4\\r\\n2 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3\\r\\n-1 -1\\r\\n1 0\\r\\n3 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n-10000 -10000\\r\\n-10000 10000\\r\\n10000 -10000\\r\\n10000 10000\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['4\\r\\n-10000 -10000\\r\\n-10000 -9999\\r\\n10000 10000\\r\\n9999 10000\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['16\\r\\n0 0\\r\\n0 2\\r\\n0 4\\r\\n0 6\\r\\n2 0\\r\\n2 2\\r\\n2 4\\r\\n2 6\\r\\n4 0\\r\\n4 2\\r\\n4 4\\r\\n4 6\\r\\n6 0\\r\\n6 2\\r\\n6 4\\r\\n6 6\\r\\n'], 'output': ['1783\\r\\n']}, {'input': ['25\\r\\n-10000 -10000\\r\\n-10000 -5000\\r\\n-10000 0\\r\\n-10000 5000\\r\\n-10000 10000\\r\\n-5000 -10000\\r\\n-5000 -5000\\r\\n-5000 0\\r\\n-5000 5000\\r\\n-5000 10000\\r\\n0 -10000\\r\\n0 -5000\\r\\n0 0\\r\\n0 5000\\r\\n0 10000\\r\\n5000 -10000\\r\\n5000 -5000\\r\\n5000 0\\r\\n5000 5000\\r\\n5000 10000\\r\\n10000 -10000\\r\\n10000 -5000\\r\\n10000 0\\r\\n10000 5000\\r\\n10000 10000\\r\\n'], 'output': ['9324\\r\\n']}, {'input': ['2\\r\\n10000 10000\\r\\n-10000 -10000\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20\\r\\n-5118 -9140\\r\\n-5118 -7807\\r\\n-5118 -5328\\r\\n-5118 -3139\\r\\n-5118 -1442\\r\\n-5118 -1169\\r\\n-5118 -733\\r\\n-5118 3460\\r\\n-5118 8555\\r\\n-5118 9702\\r\\n-3971 -9140\\r\\n-3971 -7807\\r\\n-3971 -5328\\r\\n-3971 -3139\\r\\n-3971 -1442\\r\\n-3971 -1169\\r\\n-3971 -733\\r\\n-3971 3460\\r\\n-3971 8555\\r\\n-3971 9702\\r\\n'], 'output': ['5105\\r\\n']}, {'input': ['21\\r\\n-8207 -8742\\r\\n-8207 2162\\r\\n-8207 3741\\r\\n-6190 -8742\\r\\n-6190 2162\\r\\n-6190 3741\\r\\n-2214 -8742\\r\\n-2214 2162\\r\\n-2214 3741\\r\\n-1839 -8742\\r\\n-1839 2162\\r\\n-1839 3741\\r\\n207 -8742\\r\\n207 2162\\r\\n207 3741\\r\\n3032 -8742\\r\\n3032 2162\\r\\n3032 3741\\r\\n8740 -8742\\r\\n8740 2162\\r\\n8740 3741\\r\\n'], 'output': ['9156\\r\\n']}, {'input': ['20\\r\\n-7068 -9088\\r\\n-7068 -7174\\r\\n-7068 -6012\\r\\n-7068 -3037\\r\\n-7068 3299\\r\\n532 -9088\\r\\n532 -7174\\r\\n532 -6012\\r\\n532 -3037\\r\\n532 3299\\r\\n6883 -9088\\r\\n6883 -7174\\r\\n6883 -6012\\r\\n6883 -3037\\r\\n6883 3299\\r\\n8251 -9088\\r\\n8251 -7174\\r\\n8251 -6012\\r\\n8251 -3037\\r\\n8251 3299\\r\\n'], 'output': ['8240\\r\\n']}, {'input': ['25\\r\\n1964 -4517\\r\\n5939 -4080\\r\\n9503 -7541\\r\\n-5037 -6950\\r\\n-9914 5015\\r\\n-435 7555\\r\\n-9321 -2202\\r\\n-5036 4224\\r\\n4946 -6785\\r\\n-6824 -9830\\r\\n-9124 9117\\r\\n-8396 -2748\\r\\n9284 556\\r\\n-1672 -6681\\r\\n-8782 9912\\r\\n-8164 4679\\r\\n1804 -6201\\r\\n-1155 2405\\r\\n-858 4105\\r\\n419 -7325\\r\\n-8034 -3084\\r\\n-7823 -5829\\r\\n-5784 5391\\r\\n9515 5259\\r\\n-8078 752\\r\\n'], 'output': ['44850\\r\\n']}, {'input': ['25\\r\\n5061 -2382\\r\\n-4080 9503\\r\\n-4081 9503\\r\\n5061 -2381\\r\\n-6549 9641\\r\\n-8510 6047\\r\\n-8110 8720\\r\\n6829 -8424\\r\\n-1413 -5926\\r\\n2446 -3190\\r\\n5405 8413\\r\\n8272 6829\\r\\n3034 -3978\\r\\n-3403 3036\\r\\n1383 4041\\r\\n829 327\\r\\n-4079 9504\\r\\n9293 -5091\\r\\n486 -5050\\r\\n6384 3727\\r\\n4787 6634\\r\\n4492 1126\\r\\n-1288 -4938\\r\\n4345 8056\\r\\n-3402 3035\\r\\n'], 'output': ['43365\\r\\n']}, {'input': ['16\\r\\n297 3286\\r\\n-9374 4754\\r\\n7891 -4091\\r\\n6087 -1252\\r\\n3371 -858\\r\\n789 -9370\\r\\n7241 2950\\r\\n-7390 355\\r\\n-5536 -3119\\r\\n2413 -5560\\r\\n4673 7622\\r\\n5344 -9455\\r\\n1918 -8370\\r\\n-6034 -4144\\r\\n9018 -996\\r\\n-7542 -9138\\r\\n'], 'output': ['7140\\r\\n']}, {'input': ['16\\r\\n-7073 -2432\\r\\n4754 7891\\r\\n4753 7890\\r\\n4755 7892\\r\\n1033 -7465\\r\\n4487 -9951\\r\\n-4613 3633\\r\\n-6753 9089\\r\\n5853 -1919\\r\\n-236 5170\\r\\n4754 7889\\r\\n-9989 -3488\\r\\n-1390 5520\\r\\n3139 8543\\r\\n4754 7890\\r\\n7576 5150\\r\\n'], 'output': ['6670\\r\\n']}, {'input': ['12\\r\\n1804 -7018\\r\\n-3551 1915\\r\\n-8148 5497\\r\\n-3430 -2988\\r\\n377 -1656\\r\\n-3799 6338\\r\\n-4248 -8428\\r\\n7371 -5005\\r\\n1216 406\\r\\n-294 5589\\r\\n-6477 -8889\\r\\n-8919 3676\\r\\n'], 'output': ['2145\\r\\n']}, {'input': ['12\\r\\n-9440 -8967\\r\\n1915 -8148\\r\\n-7216 8361\\r\\n6338 -4248\\r\\n-1425 -2251\\r\\n1216 406\\r\\n-2676 8355\\r\\n-8889 -8919\\r\\n-1163 -4185\\r\\n5018 -7302\\r\\n-2724 3986\\r\\n-7890 1900\\r\\n'], 'output': ['2016\\r\\n']}, {'input': ['10\\r\\n3986 -4462\\r\\n-5492 -8077\\r\\n-5005 4012\\r\\n8092 5848\\r\\n5159 9077\\r\\n-9814 5652\\r\\n-2848 -6707\\r\\n-1528 8298\\r\\n9444 -4143\\r\\n-7928 1163\\r\\n'], 'output': ['990\\r\\n']}, {'input': ['10\\r\\n-5475 1753\\r\\n-8077 -5005\\r\\n7903 -131\\r\\n5159 9077\\r\\n5159 9076\\r\\n-6761 4557\\r\\n-9188 -9329\\r\\n-4591 617\\r\\n-9686 -6410\\r\\n648 -1608\\r\\n'], 'output': ['990\\r\\n']}, {'input': ['2\\r\\n6757 4799\\r\\n-1343 -7745\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n8303 2432\\r\\n-7745 -4751\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n-9129 -8491\\r\\n-9129 -1754\\r\\n-9129 -1316\\r\\n1679 -8491\\r\\n1679 -1754\\r\\n1679 -1316\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['3\\r\\n-4928 7147\\r\\n3808 3567\\r\\n2434 8649\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n-1547 4830\\r\\n3567 2434\\r\\n1522 -4418\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['9\\r\\n-8172 -8016\\r\\n-8172 -63\\r\\n-8172 9586\\r\\n-1609 -8016\\r\\n-1609 -63\\r\\n-1609 9586\\r\\n2972 -8016\\r\\n2972 -63\\r\\n2972 9586\\r\\n'], 'output': ['270\\r\\n']}, {'input': ['4\\r\\n5648 -804\\r\\n1518 -2267\\r\\n7358 -6618\\r\\n-4504 2047\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['4\\r\\n-3955 7228\\r\\n-2267 7358\\r\\n-5256 -1266\\r\\n9674 -3048\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['12\\r\\n796 -415\\r\\n796 169\\r\\n796 2695\\r\\n1979 -415\\r\\n1979 169\\r\\n1979 2695\\r\\n5371 -415\\r\\n5371 169\\r\\n5371 2695\\r\\n8366 -415\\r\\n8366 169\\r\\n8366 2695\\r\\n'], 'output': ['894\\r\\n']}, {'input': ['5\\r\\n-8893 8986\\r\\n-3629 9045\\r\\n-7719 -6470\\r\\n-258 4491\\r\\n-6902 -6866\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['5\\r\\n8456 -2932\\r\\n9045 -7719\\r\\n-10000 6748\\r\\n9044 -7720\\r\\n-1125 -914\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['15\\r\\n-7871 -4833\\r\\n-7871 -1936\\r\\n-7871 425\\r\\n-4790 -4833\\r\\n-4790 -1936\\r\\n-4790 425\\r\\n912 -4833\\r\\n912 -1936\\r\\n912 425\\r\\n4236 -4833\\r\\n4236 -1936\\r\\n4236 425\\r\\n8382 -4833\\r\\n8382 -1936\\r\\n8382 425\\r\\n'], 'output': ['2265\\r\\n']}, {'input': ['42\\r\\n-5391 -2932\\r\\n-5391 -2868\\r\\n-5391 1744\\r\\n-5391 2236\\r\\n-5391 4148\\r\\n-5391 5217\\r\\n-5391 6188\\r\\n-3584 -2932\\r\\n-3584 -2868\\r\\n-3584 1744\\r\\n-3584 2236\\r\\n-3584 4148\\r\\n-3584 5217\\r\\n-3584 6188\\r\\n-1657 -2932\\r\\n-1657 -2868\\r\\n-1657 1744\\r\\n-1657 2236\\r\\n-1657 4148\\r\\n-1657 5217\\r\\n-1657 6188\\r\\n3218 -2932\\r\\n3218 -2868\\r\\n3218 1744\\r\\n3218 2236\\r\\n3218 4148\\r\\n3218 5217\\r\\n3218 6188\\r\\n7582 -2932\\r\\n7582 -2868\\r\\n7582 1744\\r\\n7582 2236\\r\\n7582 4148\\r\\n7582 5217\\r\\n7582 6188\\r\\n8131 -2932\\r\\n8131 -2868\\r\\n8131 1744\\r\\n8131 2236\\r\\n8131 4148\\r\\n8131 5217\\r\\n8131 6188\\r\\n'], 'output': ['206367\\r\\n']}]","id":608} {"difficulty":1600,"lang":"D","lang_cluster":"D","src_uid":"131_D","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.typecons;\r\nimport std.range;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.conv;\r\n\r\nstruct Queue(T) {\r\n private T[] items = [T.init];\r\n private size_t first, last;\r\n\r\n @property bool empty() { \r\n return first == last; \r\n }\r\n\r\n void push(T top) { \r\n if (last == items.length) {\r\n items.length = max(1, items.length*2);\r\n }\r\n items[last] = top;\r\n last++;\r\n }\r\n\r\n T pop() {\r\n if (this.empty)\r\n throw new Exception(\"Empty Queue.\");\r\n auto top = items[first];\r\n first++;\r\n return top;\r\n }\r\n}\r\n\r\nvoid main() {\r\n int n;\r\n readf(\" %d\", &n);\r\n auto g = new int[][](n+1, 0);\r\n auto parent = new int[](n+1);\r\n auto visited = new int[](n+1);\r\n auto cycle = new int[](n+1);\r\n auto distances = new int[](n+1);\r\n int a,b;\r\n while (readf(\" %d %d\", &a, &b)) {\r\n g[a] ~= b;\r\n g[b] ~= a;\r\n }\r\n bool cycle_found = false;\r\n void dfs(int u, int p) {\r\n visited[u] = 1;\r\n parent[u] = p;\r\n if(cycle_found) return;\r\n foreach (v; g[u]) {\r\n if (v == p || visited[v] == 2 || cycle_found) continue;\r\n if (visited[v] == 1) {\r\n cycle[v] = 1;\r\n int x = u;\r\n while (x != v) {\r\n cycle[x] = 1;\r\n x = parent[x];\r\n }\r\n cycle_found = true;\r\n return;\r\n }\r\n dfs(v, u);\r\n }\r\n visited[u] = 2;\r\n }\r\n \r\n \r\n void bfs(int u0) {\r\n Queue!int q;\r\n q.push(u0);\r\n while (!q.empty) {\r\n auto u = q.pop();\r\n visited[u] = 1;\r\n foreach (v; g[u]) {\r\n if (visited[v]) continue;\r\n if (!cycle[v]) {\r\n distances[v] = distances[u] + 1;\r\n }\r\n q.push(v);\r\n }\r\n }\r\n }\r\n dfs(1, 0);\r\n visited[] = 0;\r\n bfs(to!int(cycle.countUntil(1) + 1));\r\n debug {\r\n writeln(cycle);\r\n }\r\n writefln(\"%(%s %)\", distances[1..$]);\r\n}\r\n","description":"A subway scheme, classic for all Berland cities is represented by a set of n stations connected by n passages, each of which connects exactly two stations and does not pass through any others. Besides, in the classic scheme one can get from any station to any other one along the passages. The passages can be used to move in both directions. Between each pair of stations there is no more than one passage.Berland mathematicians have recently proved a theorem that states that any classic scheme has a ringroad. There can be only one ringroad. In other words, in any classic scheme one can find the only scheme consisting of stations (where any two neighbouring ones are linked by a passage) and this cycle doesn't contain any station more than once.This invention had a powerful social impact as now the stations could be compared according to their distance from the ringroad. For example, a citizen could say \"I live in three passages from the ringroad\" and another one could reply \"you loser, I live in one passage from the ringroad\". The Internet soon got filled with applications that promised to count the distance from the station to the ringroad (send a text message to a short number...).The Berland government decided to put an end to these disturbances and start to control the situation. You are requested to write a program that can determine the remoteness from the ringroad for each station by the city subway scheme.","input_specification":"The first line contains an integer n (3\u2264n\u22643000), n is the number of stations (and trains at the same time) in the subway scheme. Then n lines contain descriptions of the trains, one per line. Each line contains a pair of integers xi,yi (1\u2264xi,yi\u2264n) and represents the presence of a passage from station xi to station yi. The stations are numbered from 1 to n in an arbitrary order. It is guaranteed that xi\u2260yi and that no pair of stations contain more than one passage. The passages can be used to travel both ways. It is guaranteed that the given description represents a classic subway scheme.\n","output_specification":"Print n numbers. Separate the numbers by spaces, the i-th one should be equal to the distance of the i-th station from the ringroad. For the ringroad stations print number 0.\n","notes":null,"sample_inputs":["4\n1 3\n4 3\n4 2\n1 2\n","6\n1 2\n3 4\n6 4\n2 3\n1 3\n3 5\n"],"sample_outputs":["0 0 0 0 ","0 0 0 1 1 2 "],"human_solution":"import std.stdio;\r\nimport std.typecons;\r\nimport std.range;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.conv;\r\n\r\nstruct Queue(T) {\r\n private T[] items = [T.init];\r\n private size_t first, last;\r\n\r\n @property bool empty() { \r\n return first == last; \r\n }\r\n\r\n void push(T top) { \r\n if (last == items.length) {\r\n items.length = max(1, items.length*2);\r\n }\r\n items[last] = top;\r\n last++;\r\n }\r\n\r\n T pop() {\r\n if (this.empty)\r\n throw new Exception(\"Empty Queue.\");\r\n auto top = items[first];\r\n first++;\r\n return top;\r\n }\r\n}\r\n\r\nvoid main() {\r\n int n;\r\n readf(\" %d\", &n);\r\n auto g = new int[][](n+1, 0);\r\n auto parent = new int[](n+1);\r\n auto visited = new int[](n+1);\r\n auto cycle = new int[](n+1);\r\n auto distances = new int[](n+1);\r\n int a,b;\r\n while (readf(\" %d %d\", &a, &b)) {\r\n g[a] ~= b;\r\n g[b] ~= a;\r\n }\r\n bool cycle_found = false;\r\n void dfs(int u, int p) {\r\n visited[u] = 1;\r\n parent[u] = p;\r\n if(cycle_found) return;\r\n foreach (v; g[u]) {\r\n if (v == p || visited[v] == 2 || cycle_found) continue;\r\n if (visited[v] == 1) {\r\n cycle[v] = 1;\r\n int x = u;\r\n while (x != v) {\r\n cycle[x] = 1;\r\n x = parent[x];\r\n }\r\n cycle_found = true;\r\n return;\r\n }\r\n dfs(v, u);\r\n }\r\n visited[u] = 2;\r\n }\r\n \r\n \r\n void bfs(int u0) {\r\n Queue!int q;\r\n q.push(u0);\r\n while (!q.empty) {\r\n auto u = q.pop();\r\n visited[u] = 1;\r\n foreach (v; g[u]) {\r\n debug {\r\n writeln(\"Start: \", v);\r\n }\r\n if (visited[v]) continue;\r\n debug {\r\n writeln(\"not visited\");\r\n }\r\n if (!cycle[v]) {\r\n distances[v] = distances[u] + 1;\r\n debug {\r\n writeln(distances[v], ' ', distances[u]);\r\n }\r\n }\r\n q.push(v);\r\n }\r\n }\r\n }\r\n dfs(1, 0);\r\n visited[] = 0;\r\n bfs(to!int(cycle.countUntil(1)));\r\n debug {\r\n writeln(cycle);\r\n }\r\n writefln(\"%(%s %)\", distances[1..$]);\r\n}\r\n","testcases":"[{'input': ['4\\r\\n1 3\\r\\n4 3\\r\\n4 2\\r\\n1 2\\r\\n'], 'output': ['0 0 0 0 ']}, {'input': ['6\\r\\n1 2\\r\\n3 4\\r\\n6 4\\r\\n2 3\\r\\n1 3\\r\\n3 5\\r\\n'], 'output': ['0 0 0 1 1 2 ']}, {'input': ['3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['0 0 0 ']}, {'input': ['4\\r\\n3 1\\r\\n3 4\\r\\n2 1\\r\\n4 2\\r\\n'], 'output': ['0 0 0 0 ']}, {'input': ['4\\r\\n4 3\\r\\n1 3\\r\\n2 1\\r\\n2 3\\r\\n'], 'output': ['0 0 0 1 ']}, {'input': ['5\\r\\n2 5\\r\\n4 5\\r\\n4 3\\r\\n4 2\\r\\n1 4\\r\\n'], 'output': ['1 0 1 0 0 ']}, {'input': ['8\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n6 8\\r\\n'], 'output': ['0 0 0 1 2 3 4 4 ']}, {'input': ['5\\r\\n1 3\\r\\n1 5\\r\\n4 2\\r\\n2 3\\r\\n5 2\\r\\n'], 'output': ['0 0 0 1 0 ']}, {'input': ['5\\r\\n4 1\\r\\n1 3\\r\\n5 3\\r\\n2 4\\r\\n5 2\\r\\n'], 'output': ['0 0 0 0 0 ']}, {'input': ['10\\r\\n8 2\\r\\n10 5\\r\\n9 5\\r\\n3 9\\r\\n4 7\\r\\n3 1\\r\\n7 2\\r\\n10 6\\r\\n7 8\\r\\n1 4\\r\\n'], 'output': ['2 0 3 1 5 7 0 0 4 6 ']}, {'input': ['10\\r\\n10 7\\r\\n1 5\\r\\n2 1\\r\\n4 1\\r\\n1 10\\r\\n3 1\\r\\n9 7\\r\\n1 8\\r\\n7 6\\r\\n7 1\\r\\n'], 'output': ['0 1 1 1 1 1 0 1 1 0 ']}, {'input': ['6\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n4 6\\r\\n'], 'output': ['3 2 1 0 0 0 ']}]","id":609} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"137_D","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.ascii;\r\nimport std.range;\r\nimport std.array;\r\nimport std.functional;\r\nimport std.algorithm;\r\nimport std.conv;\r\nimport std.container;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.string;\r\nimport std.c.string;\r\nimport std.random;\r\nimport std.regex;\r\nimport std.typecons;\r\n\r\nstring s; int K;\r\n\r\nstruct R {\r\n int from, to;\r\n int diff;\r\n}\r\n\r\nstring modify(in string s) {\r\n int N = cast(int)(s.length);\r\n auto t = s[0 .. N \/ 2].dup;\r\n t.reverse;\r\n if (N & 1) {\r\n return s[0 .. N \/ 2] ~ s[N \/ 2] ~ t.idup;\r\n } else {\r\n return s[0 .. N \/ 2] ~ t.idup;\r\n }\r\n}\r\n\r\nvoid main() {\r\n s = readln.chomp;\r\n scanf(\"%d\\n\", &K);\r\n int N = cast(int)s.length;\r\n\r\n R[] rs;\r\n foreach (int i; 0 .. N) {\r\n foreach (int j; i + 1 .. N + 1) {\r\n int count(in string s) {\r\n int n = cast(int)s.length;\r\n int ret = 0;\r\n foreach (int i, c; s) {\r\n if (c != s[n - 1 - i]) ret++;\r\n }\r\n return ret \/ 2;\r\n }\r\n rs ~= R(i, j, count(s[i .. j]));\r\n }\r\n }\r\n\r\n rs.sort!\"a.from < b.from\";\r\n const INF = 1<<28;\r\n auto dp = new int[][](K + 1, N + 1);\r\n auto prev = new int[][](K + 1, N + 1);\r\n foreach (k; 0 .. K + 1) dp[k][] = INF;\r\n for (int i = 0; i < N && rs[i].from == 0; i++) {\r\n dp[1][rs[i].to] = rs[i].diff;\r\n prev[1][rs[i].to] = rs[i].from;\r\n }\r\n foreach (k; 1 .. K) {\r\n foreach (n; 0 .. N) dp[k + 1][n] = min(dp[k + 1][n], dp[k][n]);\r\n foreach (r; rs) {\r\n if (dp[k + 1][r.to] > dp[k][r.from] + r.diff) {\r\n dp[k + 1][r.to] = dp[k][r.from] + r.diff;\r\n prev[k + 1][r.to] = r.from;\r\n }\r\n }\r\n }\r\n int ansCount = INF;\r\n int ansK = 0;\r\n foreach (int k; 0 .. K + 1) {\r\n if (ansCount > dp[k][N]) {\r\n ansCount = dp[k][N];\r\n ansK = k;\r\n }\r\n }\r\n writeln(ansCount);\r\n int n = N;\r\n int p = prev[ansK][N];\r\n string[] ans;\r\n int k = ansK;\r\n while (k > 0) {\r\n ans ~= s[p .. n];\r\n n = p;\r\n p = prev[--k][n];\r\n }\r\n writeln(ans.map!(modify).join(\"+\"));\r\n \/\/foreach (l; dp[1 .. $]) l.writeln;\r\n}\r\n","description":"Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite game Fur2 and didn't have enough time to do the literature task. As Innocentius didn't want to get an F, he decided to do the task and read the book called \"Storm and Calm\" during the IT and Math lessons (he never used to have problems with these subjects). When the IT teacher Mr. Watkins saw this, he decided to give Innocentius another task so that the boy concentrated more on the lesson and less \u2014 on the staff that has nothing to do with IT. Mr. Watkins said that a palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. A concatenation of strings a, b is a string ab that results from consecutive adding of string b to string a. Of course, Innocentius knew it all but the task was much harder than he could have imagined. Mr. Watkins asked change in the \"Storm and Calm\" the minimum number of characters so that the text of the book would also be a concatenation of no more than k palindromes. Innocentius can't complete the task and therefore asks you to help him.","input_specification":"The first input line contains a non-empty string s which is the text of \"Storm and Calm\" (without spaces). The length of the string s does not exceed 500 characters. String s consists of uppercase and lowercase Latin letters. The second line contains a single number k (1\u2264k\u2264|s|, where |s| represents the length of the string s).\n","output_specification":"Print on the first line the minimum number of changes that Innocentius will have to make. Print on the second line the string consisting of no more than k palindromes. Each palindrome should be non-empty and consist of uppercase and lowercase Latin letters. Use the character \"+\" (ASCII-code 43) to separate consecutive palindromes. If there exist several solutions, print any of them.\nThe letters' case does matter, that is an uppercase letter is not considered equivalent to the corresponding lowercase letter.\n","notes":null,"sample_inputs":["abacaba\n1\n","abdcaba\n2\n","abdcaba\n5\n","abacababababbcbabcd\n3\n"],"sample_outputs":["0\nabacaba\n","1\nabdcdba\n","0\na+b+d+c+aba\n","1\nabacaba+babab+bcbabcb\n"],"human_solution":"import std.stdio;\r\nimport std.ascii;\r\nimport std.range;\r\nimport std.array;\r\nimport std.functional;\r\nimport std.algorithm;\r\nimport std.conv;\r\nimport std.container;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.string;\r\nimport std.c.string;\r\nimport std.random;\r\nimport std.regex;\r\nimport std.typecons;\r\n\r\nstring s; int K;\r\n\r\nstruct R {\r\n int from, to;\r\n int diff;\r\n}\r\n\r\nstring modify(in string s) {\r\n int N = cast(int)(s.length);\r\n auto t = s[0 .. N \/ 2].dup;\r\n t.reverse;\r\n if (N & 1) {\r\n return s[0 .. N \/ 2] ~ s[N \/ 2] ~ t.idup;\r\n } else {\r\n return s[0 .. N \/ 2] ~ t.idup;\r\n }\r\n}\r\n\r\nvoid main() {\r\n s = readln.chomp;\r\n scanf(\"%d\\n\", &K);\r\n int N = cast(int)s.length;\r\n\r\n R[] rs;\r\n foreach (int i; 0 .. N) {\r\n foreach (int j; i + 1 .. N + 1) {\r\n int count(in string s) {\r\n int n = cast(int)s.length;\r\n int ret = 0;\r\n foreach (int i, c; s) {\r\n if (c != s[n - 1 - i]) ret++;\r\n }\r\n return ret \/ 2;\r\n }\r\n rs ~= R(i, j, count(s[i .. j]));\r\n }\r\n }\r\n\r\n rs.sort!\"a.from < b.from\";\r\n const INF = 1<<28;\r\n auto dp = new int[][](K + 1, N + 1);\r\n auto prev = new int[][](K + 1, N + 1);\r\n foreach (k; 0 .. K + 1) dp[k][] = INF;\r\n for (int i = 0; i < N && rs[i].from == 0; i++) {\r\n dp[1][rs[i].to] = rs[i].diff;\r\n prev[1][rs[i].to] = rs[i].from;\r\n }\r\n foreach (k; 1 .. K) {\r\n foreach (n; 0 .. N) dp[k + 1][n] = min(dp[k + 1][n], dp[k][n]);\r\n foreach (r; rs) {\r\n if (dp[k + 1][r.to] > dp[k][r.from] + r.diff) {\r\n dp[k + 1][r.to] = dp[k][r.from] + r.diff;\r\n prev[k + 1][r.to] = r.from;\r\n }\r\n }\r\n }\r\n int ansCount = INF;\r\n int ansK = 0;\r\n foreach (int k; 0 .. K + 1) {\r\n if (ansCount > dp[k][N]) {\r\n ansCount = dp[k][N];\r\n ansK = k;\r\n }\r\n }\r\n writeln(ansCount);\r\n int n = N;\r\n int p = prev[ansK][N];\r\n string[] ans;\r\n int k = ansK;\r\n while (k > 0) {\r\n ans ~= s[p .. n];\r\n n = p;\r\n p = prev[--k][n];\r\n }\r\n ans.reverse;\r\n writeln(ans.map!(modify).join(\"+\"));\r\n \/\/foreach (l; dp[1 .. $]) l.writeln;\r\n}\r\n","testcases":"[{'input': ['abacaba\\r\\n1\\r\\n'], 'output': ['0\\r\\nabacaba\\r\\n']}, {'input': ['abdcaba\\r\\n2\\r\\n'], 'output': ['1\\r\\nabdcdba\\r\\n']}, {'input': ['abdcaba\\r\\n5\\r\\n'], 'output': ['0\\r\\na+b+d+c+aba\\r\\n']}, {'input': ['abacababababbcbabcd\\r\\n3\\r\\n'], 'output': ['1\\r\\nabacaba+babab+bcbabcb\\r\\n']}, {'input': ['abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n1\\r\\n'], 'output': ['0\\r\\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba\\r\\n']}, {'input': ['abcabcabcabcxyzxyzxyzxyz\\r\\n5\\r\\n'], 'output': ['7\\r\\na+b+cabcaacbac+xyzxyzzyxzyx\\r\\n']}, {'input': ['aaaaaabbbbbb\\r\\n1\\r\\n'], 'output': ['6\\r\\naaaaaaaaaaaa\\r\\n']}, {'input': ['abcdefg\\r\\n7\\r\\n'], 'output': ['0\\r\\na+b+c+d+e+f+g\\r\\n']}, {'input': ['xxxyyyzzz\\r\\n2\\r\\n'], 'output': ['3\\r\\nxxxyyyxxx\\r\\n']}, {'input': ['zpbdnUpuVzOCzkgMmOXMgnrWrrHAylLovxRLSkRyRlsyZXUYBXZqjpWiHhjwEnNhJTBEFqSvgoSzcDSnNJXdDEyJwyxyEZdtTKcm\\r\\n30\\r\\n'], 'output': ['22\\r\\nz+pbddbp+u+V+zOOz+k+gMmOmMg+n+rWr+r+H+A+y+l+L+o+v+x+RLSLR+yRlRy+ZXUYUXZ+qjpWiHhjwEwjhHiWpjq+SvgvS+z+c+D+SnNnS+dDEyJwwJyEDd+tTKTt\\r\\n']}, {'input': ['a\\r\\n1\\r\\n'], 'output': ['0\\r\\na\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\\r\\n1\\r\\n'], 'output': ['200\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': ['y\\r\\n1\\r\\n'], 'output': ['0\\r\\ny\\r\\n']}, {'input': ['NbdjyyjdbN\\r\\n1\\r\\n'], 'output': ['0\\r\\nNbdjyyjdbN\\r\\n']}, {'input': ['ttniaiCiCp\\r\\n5\\r\\n'], 'output': ['0\\r\\ntt+n+iai+CiC+p\\r\\n']}, {'input': ['GCDnnDCzmNvNmzQQmTzYWtwEaWiiWaEwtWYzTmsDODszuzRWcOzWmhmWzOcWRzuzhhTWawwaWTywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n10\\r\\n'], 'output': ['0\\r\\nG+CDnnDC+zmNvNmz+QQ+mTzYWtwEaWiiWaEwtWYzTm+sDODs+zuzRWcOzWmhmWzOcWRzuz+hh+TWawwaWT+ywPxfyHWgvTQffQTvgWHyfxPwy\\r\\n']}, {'input': ['SWPEISxfnvQhDdWMUMDDFAgnjkoNpKZJWgeftsapnfTiTULMcl\\r\\n50\\r\\n'], 'output': ['0\\r\\nS+W+P+E+I+S+x+f+n+v+Q+h+D+d+W+MUM+DD+F+A+g+n+j+k+o+N+p+K+Z+J+W+g+e+f+t+s+a+p+n+f+TiT+U+L+M+c+l\\r\\n']}, {'input': ['QBJXFByWnwnwyusOgBKpUqxTjfEJaPrRYUHItEVI\\r\\n3\\r\\n'], 'output': ['14\\r\\nQBJXFByWnwnWyBFXJBQ+pUqxTjfEEfjTxqUp+ItEtI\\r\\n']}, {'input': ['YGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n1\\r\\n'], 'output': ['0\\r\\nYGkzboLjDJFMARChEQBTTBQEhCRAMFJDjLobzkGY\\r\\n']}, {'input': ['QsAQXXlArrAlXaBSSBaX\\r\\n4\\r\\n'], 'output': ['1\\r\\nQssQ+XX+lArrAl+XaBSSBaX\\r\\n']}, {'input': ['npRAxpncpgQqTHHTqQgpcSbYEhvKBPRDUjnXznRXnjUDRPlKvhEYbNgrtVweZIhmyEqEymhItDwVtrgN\\r\\n5\\r\\n'], 'output': ['5\\r\\nnpRARpn+cpgQqTHHTqQgpc+S+bYEhvKBPRDUjnXznzXnjUDRPBKvhEYb+NgrtVweZIhmyEqEymhIZewVtrgN\\r\\n']}, {'input': ['WdYlPYGSNSGYPlYdWpIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhzVWOelUjtrMyIpZassaZBSohcqchoSBZKgKZlhMOXMoMXOMZGZvvRkqSOmHWZxSxZWHmOSrkRvvWPW\\r\\n10\\r\\n'], 'output': ['3\\r\\nWdYlPYGSNSGYPlYdW+pIyMrtjUleOWVihRoZkUyXWuKuWXyUkZoRhiVWOelUjtrMyIp+ZassaZ+BSohcqchoSB+ZKgKZ+ll+MOXMoMXOM+ZGZ+vvRkqSOmHWZxSxZWHmOSqkRvv+WPW\\r\\n']}, {'input': ['vbjmuTEWtvQvdMHTuUogvaWmqiwwPmJaupYrqhRfiRRifqhVMxMWIJPPJBnyJkToeUUdAfjoXzCTyMBVUMyTPyXYYBxmcHNTBcCcmxRXwOtmsbwXHKccOHtPtWWvCtMCkcMlfMTRhazNVkeWNCaPRP\\r\\n20\\r\\n'], 'output': ['37\\r\\nvbjmuTEWtvQvtWETumjbv+aWmqiwiqmWa+u+p+YrY+hRfiRRifRh+VMxMV+IJPPJI+nyJyn+oeUUdUUeo+XzCTyMBVBMyTCzX+YY+BxmcHNTTNHcmxB+XwOtmtOwX+HKccKH+tPt+WW+vCtMCkCMtCv+TRhazNVkkVNzahRT\\r\\n']}, {'input': ['DdHqZfmOqjEoTvmDQiiRFdfMzfRjLUCwFYdfBaZvNPlocnwtkBKmzVGPBxJhmxnDlCOlqiZoKXWgzXundzeEaRbYpqbTtPEnGgRzpdXLmNThaJSBzPglWuywvRkzaQEUHzPVfZOiFOZxymgmAAdnks\\r\\n20\\r\\n'], 'output': ['53\\r\\nDdD+qZffZq+jEj+TvmDQiiRFdfMzfRfzMfdFRiiQDmvT+PlocnwtktwncolP+BxJhJxB+D+lCCl+qiZiq+XWgWX+undzeEaRbYbRaEezdnu+gRzpdXLmNNmLXdpzRg+lWuyuWl+kzaQEQazk+VfZOiiOZfV+mgm+AA+d+nkn\\r\\n']}, {'input': ['gwsEqXXqEswgETtttTEmQakaBmHOiOHwQQwzWuylXwwfuufwwXlyuWzxVeQQeVMRAUZDMBggBMDZUARDPGKKGPDUUDKDQQNENtiWLLLLWitNlKvvKlNJbJjijQvFOFvQXwKKKKwKznTmTnzKuNxlxNucynmmnymMqBqMmTUnCjCnUTEqFKSmQQmSKFqAmKNNKmARRoRR\\r\\n30\\r\\n'], 'output': ['2\\r\\ngwsEqXXqEswg+ETtttTE+mQakaQm+HOiOH+wQQw+zWuylXwwfuufwwXlyuWz+xVeQQeVx+RAUZDMBggBMDZUAR+DPGKKGPD+UU+DKD+QQ+NEN+tiWLLLLWit+NlKvvKlN+JbJ+jij+QvFOFvQ+X+wKKKKw+KznTmTnzK+uNxlxNu+c+ynmmny+mMqBqMm+TUnCjCnUT+E+qFKSmQQmSKFq+AmKNNKmA+RRoRR\\r\\n']}, {'input': ['eVxEoJPwziDXrGUnqlbhwhbloeUGrXDYzwPwtExVeoLVCZZZZCVLoCRzukaOmLtpRJRSzNIbXAlTtsoUyyerrtYlAXgIEzSRJRFtLmVakuzcCwtKUmLeAmuAeLmUKtwxJVRmekiKrArArHJqemRVJxSllejgLHybDDbyULgjFoLdYsXOtmjnZvQkiiikQvZnjmuOXsOdLnFEpepefnxilxnEnpepfUjQOjIoAtmtRRCqnRRtmtAoIGOQjP\\r\\n10\\r\\n'], 'output': ['30\\r\\neVxEoJPwziDXrGUnqlbhwhblqnUGrXDizwPJoExVe+oLVCZZZZCVLo+CRzukaOmLtpRJRSzNIbXAlTtsoUyyUostTlAXbINzSRJRptLmOakuzRC+wtKUmLeAmmAeLmUKtw+xJVRmekiKrArArKikemRVJx+SllS+jgLHybDDbyHLgj+FoLdYsXOtmjnZvQkiiikQvZnjmtOXsYdLoF+EpepefnxiixnfepepE+UjQOjIoAtmtRRCqCRRtmtAoIjOQjU\\r\\n']}, {'input': ['wRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n1\\r\\n'], 'output': ['0\\r\\nwRzsfMPSqeqliRUCGTIdlvGzQlbNzoMSZtMqBMondKEaSKEOrGcsTbaSQevfuNJiRIwvxtLzQImPelCacIhEpdlEXlIYPmfgBgTsCesyzetsQZIIqLMaLHhbQYNCTytxTQObFwfOziIBUiQSGIUtAeeAtUIGSQiUBIizOfwFbOQTxtyTCNYQbhHLaMLqIIZQstezyseCsTgBgfmPYIlXEldpEhIcaClePmIQzLtxvwIRiJNufveQSabTscGrOEKSaEKdnoMBqMtZSMozNblQzGvldITGCURilqeqSPMfszRw\\r\\n']}, {'input': ['fgYTcOUewXjIIjXweUbcTogfniuXbkOCWRKsWCOkbXAinbubBYxyQQyxYBKypwIvfItIfvIwpyKRfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWkzmBwXcDzWXXwIBQJEVbYQVDLHExeXAHuJXfxoilFOXzbbzRKeliocpOvyNOycwdHjbbjHdwcyONhvOWcIYhQbnwnbFNYIxPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgLZyLHZAJNwSzuKJPLfOtJMitSaTYyBeygPxkiRVhIVSCIvJvvJGICSVWhVRpBCiPWNVCnlnCVNWPiCDVBqKHFWufvpwsswyvfuWFHKqBVD\\r\\n13\\r\\n'], 'output': ['38\\r\\nfgYTcOUewXjIIjXweUOcTYgf+niuXbkOCWRKRWCOkbXuin+bub+BYxyQQyxYB+KypwIvfItIfvIwpyK+RfXJTHcXexAnUBVQWbVnJQBIwYXWzDcXoBmzWWzmBoXcDzWXYwIBQJnVbWQVBUnAxeXcHTJXfR+oilFOXzbbzXOFlio+cpOvyNOycwdHjbbjHdwcyONyvOpc+IYhQbnwnbQhYI+xPgycByYUQStiFRtOzLPJKuzBwfJAZHayZNgrgNZyaHZAJfwBzuKJPLzOtRFitSQUYyBcygPx+kiRVhIVSCIvJvvJvICSVIhVRik+CiPWNVCnlnCVNWPiC+DVBqKHFWufvpwsswpvfuWFHKqBVD\\r\\n']}, {'input': ['anZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n1\\r\\n'], 'output': ['0\\r\\nanZBQZPTfBdhFsBUBTXoZlxkNItepGNkhrRWrIjYJIANGHTGwrFldvwdTooioQkuGRFvIemljhshRpJVMNxTPugHWBnITYyLymOnJLZzFGPmakDhpaUiwWakzPSYjZJLUpoDofCUijrHYxiBSYNbJmITVKcbKBrZZWyGrBPhaikdxnEbHqxqQYIQwTitxaLHkGRhbmumeRHHsxfCVoIKemNeRZrlEpdcRkFocGZohvIKYquujOtPfdzDrIIrDzdfPtOjuuqYKIvhoZGcoFkRcdpElrZReNmeKIoVCfxsHHRemumbhRGkHLaxtiTwQIYQqxqHbEnxdkiahPBrGyWZZrBKbcKVTImJbNYSBixYHrjiUCfoDopULJZjYSPzkaWwiUaphDkamPGFzZLJnOmyLyYTInBWHguPTxNMVJpRhshjlmeIvFRGukQoiooTdwvdlFrwGTHGNAIJYjIrWRrhkNGpetINkxlZoXTBUBsFhdBfTPZQBZna\\r\\n']}, {'input': ['sODJlDMHKskoUnPqUoksKHMDTJDOqqutqYPGWYqtulMAbgQcBSzSjfoiYyjIbrZxzughddhguzxZubIQeYiofjSziBcQgbAMWcckXcWUUWcXkpkSDTHeNNeHTDSkpgguDk\\r\\n94\\r\\n'], 'output': ['0\\r\\ns+O+D+J+l+D+M+H+K+s+k+o+U+n+P+q+U+o+k+s+K+H+M+D+T+J+D+O+qq+u+t+q+Y+P+G+W+Y+q+t+u+l+M+A+b+g+Q+c+B+SzS+j+f+o+i+Y+y+j+I+b+r+ZxzughddhguzxZ+u+b+I+Q+e+Y+i+o+f+j+S+z+i+B+c+Q+g+b+A+M+W+cc+kXcWUUWcXk+pkSDTHeNNeHTDSkp+gg+u+D+k\\r\\n']}, {'input': ['eAfVVOAwrZUBZrddkqHxmfuTbSDozpObTuffxEpkUvphyFhwaFhhiKhZeGEVvWGUkGptGBdMHTYYQcCdHBHDdYdDotouzzDrMHuuHMrELXcuoGpTmUUnoNzUfUmTpGoFcXLEkcYsCmcTvuoSmIDIjO\\r\\n101\\r\\n'], 'output': ['4\\r\\ne+A+f+VV+O+A+w+r+Z+U+B+Z+r+dd+k+q+H+x+m+f+u+T+b+S+D+o+z+p+O+b+T+u+ff+x+E+p+k+U+v+p+h+y+F+h+w+a+F+hh+i+K+h+Z+e+G+E+V+v+W+G+U+k+G+p+t+G+B+d+M+H+T+YY+Q+c+C+d+HBH+DdYdD+oto+u+zz+D+rMHuuHMr+ELXcuoGpTmUUnoNonUUmTpGoucXLE+k+c+Y+s+C+m+c+T+v+u+o+S+m+IDI+j+O\\r\\n']}, {'input': ['kKBYQwipkLMkqjltKKagWfXynkXOHfHsbthvYsUyAsAfWcbjOlFFaICcpmBVBiteGerPiKjdMZqwdyirPDgJdJOHonMXWkvRVFKxkXCeqUsjeSMZpgMUPRRTiQGfGbySUIJnsnGprQFmFrZJfylAGB\\r\\n114\\r\\n'], 'output': ['5\\r\\nk+K+B+Y+Q+w+i+p+kLLk+q+j+l+t+KK+a+g+W+f+XynyX+O+HfH+sbthtbs+U+y+AsA+f+W+c+b+j+O+l+FF+a+I+C+c+p+m+BVB+i+t+eGe+r+P+i+K+j+d+M+Z+q+w+d+y+i+r+P+D+g+JdJ+O+H+o+n+M+X+W+k+v+R+V+F+K+x+k+X+C+e+q+U+s+j+e+S+MZpZM+U+P+RR+T+i+Q+GfG+b+y+S+U+I+J+nsn+G+p+r+Q+FmF+r+Z+J+f+y+l+A+G+B\\r\\n']}, {'input': ['tjTBpykkypBTjIexukbkuxeSJNRzEEzRNJScwVwDrUozZYYZzoUruauBzjssNzBbSSbXUWcjUvUjcWUePndNNdxxDFSiPnvjiijvnPiSFDxxAyaayAYzjBBjzBuWItiDUDNfawfwafNDUDiuIWuBjAWRPiPRWAtXewGGwTXtTTvejJJjtvJJFyjyFDDXaWwvCCCvwWaX\\r\\n182\\r\\n'], 'output': ['0\\r\\nt+jTBpykkypBTj+I+exukbkuxe+SJNRzEEzRNJS+c+wVw+D+rUozZYYZzoUr+uau+B+z+j+ss+N+z+B+bSSb+X+UWcjUvUjcWU+e+P+n+dNNd+xxDFSiPnvjiijvnPiSFDxx+AyaayA+Y+zjBBjz+B+u+W+I+t+iDUDNfawfwafNDUDi+u+I+W+u+B+j+AWRPiPRWA+t+X+e+wGGw+T+X+t+TT+v+e+jJJj+t+v+JJ+FyjyF+DD+XaWwvCCCvwWaX\\r\\n']}, {'input': ['zQQziKpcCZVKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXTodxZMezrlsBlGUZWMrMiKVuCcGGLQYgqifBVjvGoGSjVBfiqsYQLGLGqeWyuxJhhJHuyNeqwrNQuOvlsJBlokJcZujGRrnJRmmRJuWRGjuhcJkYIBJslVOuyNrQolfIepLARflumuIjUoKZeoBQdYGxYvFDFvYSGsdnaoeZKMUjIXmulfRBLyeIfloglNoaRXNeNXRkoNegAA\\r\\n41\\r\\n'], 'output': ['21\\r\\nzQQz+i+K+p+c+C+Z+VKiMrMvZUGlvslrzeMZxdoPXwFizYziFwXPodxZMezrlsvlGUZvMrMiKV+u+C+c+GG+LQYgqifBVjvGoGvjVBfiqgYQL+GLG+q+e+W+y+u+x+JhhJ+H+u+y+N+e+q+w+rNQuOvlsJBlokJcZujGRrnJRmmRJnrRGjuZcJkolBJslvOuQNr+Q+olfIepLARflumuIjUoKZeoBQdYGxYvFDFvYxGYdQBoeZKoUjIumulfRALpeIflo+g+l+NoaRXNeNXRaoN+e+g+AA\\r\\n']}, {'input': ['NIwgwfTKMVQyCQXyWNtvjwlPpwjkDDnRdNdyvdtSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwUJFViLADpYhJslnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJStrvydNdRnDDkjwpPlwjvtNWUXQCyQVMKTfwgwIN\\r\\n85\\r\\n'], 'output': ['2\\r\\nN+I+wgw+f+T+K+M+V+Q+y+C+Q+X+y+W+N+t+v+j+w+l+P+p+w+j+k+DD+n+R+dNd+y+v+d+tSJSylryoGctOpyEzwwCerInheSprPXjVZkyqxJecTdNbloLeMjCloBkkTDTvuYJfBvTRMBsverunluJhYpDALiVFJxwQRtgXmluLPMltopYWzrKKrzWYpotlMPLulmXgtRQwxJFViLADpYhJulnurevsBMRTvBfJYuvTDTkkBolCjMeLolbNdTceJxqykZVjXPrpSehnIreCwwzEypOtcGoyrlySJSt+r+v+y+dNd+R+n+DD+k+j+w+p+P+l+w+j+v+t+N+W+U+X+Q+C+y+Q+V+M+K+T+f+wgw+I+N\\r\\n']}, {'input': ['acaoDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzOjIRmrFjORuyxAZhRDoBjNJGNMFFMTQsNjBtTTtZFZPBRzKnGvYUuwyWixoqSkxBJqoWiWTIuUYvGnKzRoaITJjRiuIIifpNwnOBGBOnwNpfiIIukajjQbplxlpbQiDLNLCZCzfxLxyJnMEMrdQKBbWWqaOXdGORUHwXcadcXwHMROGAXOaqMKpBKQdLMAGIJyxLxfHCZCLNLDyewSmLIRpACnNONNnCApVILmSweyFofWbAfttMArOnrMdNysgofPNujqwwJJwCqjuDPfngsyNdsXnOrAMtmfAaWPoFYRhBmMgLgXmvxBY\\r\\n131\\r\\n'], 'output': ['16\\r\\naca+oDRhZqxyuyOjFrJzIjSzYsYvpldjdlpvYsYzSjIzJrFjOyuyxqZhRDo+B+j+N+J+G+N+MFFM+T+Q+s+N+j+B+tTTt+ZFZ+P+B+R+z+K+n+G+v+Y+U+u+w+y+W+i+x+o+q+S+k+x+B+J+q+o+WiW+T+I+u+U+Y+v+G+n+K+z+R+o+a+I+T+J+j+R+i+uIIifpNwnOBGBOnwNpfiIIu+k+a+jj+QbplxlpbQ+i+D+LNL+CZC+z+f+xLx+y+J+n+MEM+r+d+Q+K+B+b+WW+qaOXdGORUHwXcaacXwHUROGdXOaq+M+K+p+B+K+Q+d+L+M+A+G+I+J+y+xLx+f+H+CZC+LNL+D+yewSmLIRpACnNOONnCApRILmSwey+F+o+f+W+b+AfttMArOnrMdNysgofPNujqwwJJwwqjuNPfogsyNdMrnOrAMttfA+a+W+P+o+F+Y+R+h+B+m+M+gLg+X+m+v+x+B+Y\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n400\\r\\n'], 'output': ['0\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': ['aa\\r\\n1\\r\\n'], 'output': ['0\\r\\naa\\r\\n']}, {'input': ['aA\\r\\n1\\r\\n'], 'output': ['1\\r\\naa\\r\\n']}, {'input': ['aA\\r\\n2\\r\\n'], 'output': ['0\\r\\na+A\\r\\n']}]","id":610} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"138_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.string;\r\nimport std.algorithm;\r\n\r\nvoid main() {\r\n char[] n = readln.chomp.dup;\r\n uint[10] map1, map2;\r\n string perm1 = \"\";\r\n string perm2 = \"\";\r\n\r\n foreach (digit; n) {\r\n map1[digit - '0']++;\r\n map2[digit - '0']++;\r\n }\r\n\r\n bool proceed = false;\r\n uint zeros = 0;\r\n uint zeroPairs = 0;\r\n\r\n \/\/ check optimal last zero\r\n for (int i = 1; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[10 - i] != 0 && map2[9 - i] == 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[10 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 10 - i + '0';\r\n }\r\n }\r\n\r\n \/\/ check non-optimal last zero\r\n for (int i = 1; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[10 - i] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[10 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 10 - i + '0';\r\n }\r\n }\r\n\r\n while (proceed) {\r\n proceed = false;\r\n for (int i = 0; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[9 - i] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[9 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 9 - i + '0';\r\n }\r\n }\r\n if (!proceed && map1[0] != 0 && map2[0] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[0]--;\r\n map2[0]--;\r\n zeroPairs++;\r\n }\r\n }\r\n\r\n for (int i = 0; i <= 9 && !proceed; i++) {\r\n while (map1[i] != 0) {\r\n perm1 ~= i + '0';\r\n map1[i]--;\r\n }\r\n while (map2[i] != 0) {\r\n perm2 ~= i + '0';\r\n map2[i]--;\r\n }\r\n }\r\n\r\n perm1 = perm1.dup.reverse;\r\n perm2 = perm2.dup.reverse;\r\n\r\n for (int i = 0; i < zeroPairs; i++) {\r\n perm1 ~= '0';\r\n perm2 ~= '0';\r\n }\r\n\r\n writeln(perm1);\r\n writeln(perm2);\r\n}\r\n","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 10^5. The number is written without any leading zeroes.\n","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.\n","notes":null,"sample_inputs":["198\n","500\n"],"sample_outputs":["981\n819\n","500\n500\n"],"human_solution":"import std.stdio;\r\nimport std.string;\r\nimport std.algorithm;\r\n\r\nvoid main() {\r\n char[] n = readln.chomp.dup;\r\n uint[10] map1, map2;\r\n string perm1 = \"\";\r\n string perm2 = \"\";\r\n\r\n foreach (digit; n) {\r\n map1[digit - '0']++;\r\n map2[digit - '0']++;\r\n }\r\n\r\n bool proceed = false;\r\n uint zeros = 0;\r\n uint zeroPairs = 0;\r\n\r\n \/\/ check optimal last zero\r\n for (int i = 1; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[10 - i] != 0 && map1[9 - i] < map1[i] && map1[9 - (10 - i)] < map1[10 - i]) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[10 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 10 - i + '0';\r\n }\r\n }\r\n\r\n \/\/ check non-optimal last zero\r\n for (int i = 1; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[10 - i] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[10 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 10 - i + '0';\r\n }\r\n }\r\n\r\n while (proceed) {\r\n proceed = false;\r\n for (int i = 0; i <= 9 && !proceed; i++) {\r\n if (map1[i] != 0 && map2[9 - i] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[i]--;\r\n map2[9 - i]--;\r\n perm1 ~= i + '0';\r\n perm2 ~= 9 - i + '0';\r\n }\r\n }\r\n if (!proceed && map1[0] != 0 && map2[0] != 0) {\r\n proceed = true;\r\n zeros++;\r\n map1[0]--;\r\n map2[0]--;\r\n zeroPairs++;\r\n }\r\n }\r\n\r\n for (int i = 0; i <= 9 && !proceed; i++) {\r\n while (map1[i] != 0) {\r\n perm1 ~= i + '0';\r\n map1[i]--;\r\n }\r\n while (map2[i] != 0) {\r\n perm2 ~= i + '0';\r\n map2[i]--;\r\n }\r\n }\r\n\r\n perm1 = perm1.dup.reverse;\r\n perm2 = perm2.dup.reverse;\r\n\r\n for (int i = 0; i < zeroPairs; i++) {\r\n perm1 ~= '0';\r\n perm2 ~= '0';\r\n }\r\n\r\n writeln(perm1);\r\n writeln(perm2);\r\n}\r\n","testcases":"[{'input': ['198\\r\\n'], 'output': ['981\\r\\n819\\r\\n']}, {'input': ['500\\r\\n'], 'output': ['500\\r\\n500\\r\\n']}, {'input': ['1061\\r\\n'], 'output': ['6110\\r\\n6110\\r\\n']}, {'input': ['1099\\r\\n'], 'output': ['9901\\r\\n1099\\r\\n']}, {'input': ['4877\\r\\n'], 'output': ['8774\\r\\n8774\\r\\n']}, {'input': ['787027\\r\\n'], 'output': ['877720\\r\\n777280\\r\\n']}, {'input': ['7665711\\r\\n'], 'output': ['7766115\\r\\n7766115\\r\\n']}, {'input': ['670042\\r\\n'], 'output': ['672400\\r\\n427600\\r\\n']}, {'input': ['87417\\r\\n'], 'output': ['87741\\r\\n87741\\r\\n']}, {'input': ['27183007\\r\\n'], 'output': ['78721300\\r\\n31278700\\r\\n']}, {'input': ['2603340571199714716025114079373828413509944752618962350632892540710372640383149198328312562980217104434880337288055817064\\r\\n'], 'output': ['4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\\r\\n4444333333322110000000000111111111111122222222222333333334444444445555555556666666677777777777888888888888899999999990000\\r\\n']}, {'input': ['8679647744\\r\\n'], 'output': ['9877766444\\r\\n9877764446\\r\\n']}, {'input': ['220737406285\\r\\n'], 'output': ['877654322200\\r\\n222345677800\\r\\n']}, {'input': ['993522733475817\\r\\n'], 'output': ['997533877542213\\r\\n995333122457787\\r\\n']}, {'input': ['5057017252180797906185\\r\\n'], 'output': ['7765551998877221100500\\r\\n7765551001122778899500\\r\\n']}, {'input': ['12414711447744142772\\r\\n'], 'output': ['77777444444422211111\\r\\n77777444444422211111\\r\\n']}, {'input': ['3037225037514100860827276704\\r\\n'], 'output': ['7887777665544332222113000000\\r\\n3112222334455667777887000000\\r\\n']}, {'input': ['346762409573609367635944363650432097309\\r\\n'], 'output': ['774499999776666666555444333333322000003\\r\\n744300000223333333444555666666677999997\\r\\n']}, {'input': ['21504009080570645002760268009722803470954749000131\\r\\n'], 'output': ['69999888777776655554444332222211100004000000000000\\r\\n40000111222223344445555667777788899996000000000000\\r\\n']}, {'input': ['3311314413231141411421432122343321141133112122342341334443214\\r\\n'], 'output': ['4444444444444433333333333333332222222222211111111111111111111\\r\\n4444444444444433333333333333332222222222211111111111111111111\\r\\n']}, {'input': ['9070901003919040000887091134838800004472724709967020097067025050205000220352709096100405900207957128\\r\\n'], 'output': ['7999999999999888888777777777766655555544444433322222222221111110000000000003000000000000000000000000\\r\\n3000000000000111111222222222233344444455555566677777777778888889999999999997000000000000000000000000\\r\\n']}, {'input': ['41818138314831348134448848318148131818813388313344833114141141184383813143343448843131343384181384844431384114113314313144848133488818418384818848341344811441811141313448341888341118488811314338434488\\r\\n'], 'output': ['88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111\\r\\n88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111\\r\\n']}, {'input': ['404\\r\\n'], 'output': ['440\\r\\n440\\r\\n']}, {'input': ['545\\r\\n'], 'output': ['545\\r\\n455\\r\\n']}]","id":611} {"difficulty":1700,"lang":"D","lang_cluster":"D","src_uid":"1400_B","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.container;\r\nimport std.typecons;\r\nimport std.conv;\r\nimport std.array;\r\nimport std.string;\r\nimport std.range;\r\nimport std.algorithm;\r\nimport core.bitop;\r\nimport core.stdc.stdio : scanf;\r\n\r\nT read(T)() { return readln.chomp.to!T; }\r\nT[] readarray(T)() { return readln.chomp.split(\" \").map!(to!T).array; }\r\nvoid chmin(T)(ref T a, in T b) { a = min(a, b); }\r\nvoid chmax(T)(ref T a, in T b) { a = max(a, b); }\r\n\r\nvoid main() {\r\n int T = read!int;\r\n foreach (t; 0 .. T) solve();\r\n}\r\n\r\nvoid solve() {\r\n long P, F; readf(\"%d %d\\n\", &P, &F);\r\n int Cs, Cw; readf(\"%d %d\\n\", &Cs, &Cw);\r\n long S, W; readf(\"%d %d\\n\", &S, &W);\r\n\r\n long ans = 0;\r\n for (int np = 0; np <= Cs; np++) {\r\n long r = P - np * S;\r\n if (r < 0) break;\r\n long mp = min(r \/ W, Cw);\r\n long Rs = Cs - np;\r\n long Rw = Cw - mp;\r\n if (S < W) {\r\n long nf, mf;\r\n if (F \/ S <= Rs) {\r\n nf = F \/ S;\r\n mf = 0;\r\n } else {\r\n nf = Rs;\r\n mf = min((F - nf * S) \/ W, Rw);\r\n }\r\n ans.chmax(np + mp + nf + mf);\r\n } else {\r\n long nf, mf;\r\n if (F \/ W <= Rw) {\r\n mf = F \/ W;\r\n nf = 0;\r\n } else {\r\n mf = Rw;\r\n nf = min((F - mf * W) \/ W, Rs);\r\n }\r\n ans.chmax(np + mp + nf + mf);\r\n }\r\n }\r\n writeln(ans);\r\n}\r\n","description":"You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your follower\u00a0\u2014 at most $$$f$$$ units.In the blacksmith shop, you found $$$cnt_s$$$ swords and $$$cnt_w$$$ war axes. Each sword weights $$$s$$$ units and each war axe\u00a0\u2014 $$$w$$$ units. You don't care what to take, since each of them will melt into one steel ingot.What is the maximum number of weapons (both swords and war axes) you and your follower can carry out from the shop?","input_specification":"The first line contains a single integer $$$t$$$ ($$$1 \\\\le t \\\\le 10^4$$$)\u00a0\u2014 the number of test cases.\nThe first line of each test case contains two integers $$$p$$$ and $$$f$$$ ($$$1 \\\\le p, f \\\\le 10^9$$$)\u00a0\u2014 yours and your follower's capacities.\nThe second line of each test case contains two integers $$$cnt_s$$$ and $$$cnt_w$$$ ($$$1 \\\\le cnt_s, cnt_w \\\\le 2 \\\\cdot 10^5$$$)\u00a0\u2014 the number of swords and war axes in the shop.\nThe third line of each test case contains two integers $$$s$$$ and $$$w$$$ ($$$1 \\\\le s, w \\\\le 10^9$$$)\u00a0\u2014 the weights of each sword and each war axe.\nIt's guaranteed that the total number of swords and the total number of war axes in all test cases don't exceed $$$2 \\\\cdot 10^5$$$.\n","output_specification":"For each test case, print the maximum number of weapons (both swords and war axes) you and your follower can carry.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional, std.meta;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.ascii, std.typecons;\r\n\r\nvoid main()\r\n{\r\n auto t = readln.chomp.to!int;\r\n \r\n auto rln = () => readln.chomp.split.map!(to!int).array;\r\n \r\n while (t--) {\r\n auto cap = rln();\r\n auto cnt = rln();\r\n auto w = rln();\r\n \r\n if (w[0] > w[1]) {\r\n swap(w[0], w[1]);\r\n swap(cnt[0], cnt[1]);\r\n }\r\n \r\n int fitItem(ref int sz, const int w, ref int cnt) {\r\n int fit = min(cnt, sz \/ w);\r\n sz -= fit * w;\r\n cnt -= fit;\r\n return fit;\r\n }\r\n \r\n int mxinfst = min(cnt[0], cap[0] \/ w[0]);\r\n int ans = 0;\r\n foreach (oneinfst; 0 .. mxinfst + 1) {\r\n auto sz = cap.dup;\r\n auto cnttmp = [cnt[0] - oneinfst, cnt[1]];\r\n \r\n int cur = fitItem(sz[0], w[0], oneinfst);\r\n cur += fitItem(sz[0], w[1], cnttmp[1]);\r\n \r\n cur += fitItem(sz[1], w[0], cnttmp[0]);\r\n cur += fitItem(sz[1], w[1], cnttmp[1]);\r\n \r\n ans = max(ans, cur);\r\n }\r\n \r\n ans.writeln;\r\n }\r\n}","testcases":"[{'input': ['3\\r\\n33 27\\r\\n6 10\\r\\n5 6\\r\\n100 200\\r\\n10 10\\r\\n5 5\\r\\n1 19\\r\\n1 3\\r\\n19 5\\r\\n'], 'output': ['11\\r\\n20\\r\\n3\\r\\n']}, {'input': ['4\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n5 5\\r\\n1 1\\r\\n1 1\\r\\n978671046 946619174\\r\\n26305 31241\\r\\n33456 33457\\r\\n780000000 800041032\\r\\n172000 168000\\r\\n4989 5206\\r\\n'], 'output': ['2\\r\\n2\\r\\n57546\\r\\n310673\\r\\n']}, {'input': ['1\\r\\n15 10\\r\\n200000 4\\r\\n15 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n100000 10\\r\\n200000 4\\r\\n100000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1000000000 10\\r\\n3 3\\r\\n1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1000000000 10\\r\\n4 4\\r\\n1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n200000 200000\\r\\n1000000000 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n100000 100000\\r\\n1000000000 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n986082376 374024551\\r\\n172928 118959\\r\\n284377441 987683134\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n100000 100000\\r\\n100000000 1000000000\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['1\\r\\n999999999 999999999\\r\\n200000 100000\\r\\n100000000 1000000000\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['1\\r\\n1000000000 500000000\\r\\n200000 200000\\r\\n5000 5000\\r\\n'], 'output': ['300000\\r\\n']}, {'input': ['1\\r\\n843982886 177404513\\r\\n144606 105292\\r\\n809564322 980335578\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n23812 581789726\\r\\n28704 171296\\r\\n31323 30334\\r\\n'], 'output': ['19179\\r\\n']}, {'input': ['1\\r\\n999999999 999999999\\r\\n100000 100000\\r\\n100000000 1000000000\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['1\\r\\n999999999 10\\r\\n100000 100000\\r\\n1000000000 1000000000\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n8 7\\r\\n2 4\\r\\n7 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n159497910 116723529\\r\\n74488 83068\\r\\n153433438 293181540\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6\\r\\n440127115 59542490\\r\\n113160 63681\\r\\n914375267 372048972\\r\\n360329499 164840636\\r\\n79742 45217\\r\\n532257581 195263884\\r\\n216208167 441094543\\r\\n253 89809\\r\\n965024248 602353641\\r\\n213954477 211522798\\r\\n3816 1154\\r\\n715157243 560488034\\r\\n933770650 747678900\\r\\n2872 16\\r\\n526225289 634644133\\r\\n424806766 890106113\\r\\n153 40\\r\\n218290988 246666118\\r\\n'], 'output': ['1\\r\\n1\\r\\n0\\r\\n0\\r\\n2\\r\\n5\\r\\n']}, {'input': ['9\\r\\n631699562 445566897\\r\\n36732 42199\\r\\n802212816 704743502\\r\\n857979734 17729530\\r\\n44049 148274\\r\\n536127267 610131965\\r\\n262389488 60362340\\r\\n111661 8901\\r\\n379873147 29333146\\r\\n94988044 790494276\\r\\n4871 126\\r\\n906634597 532160657\\r\\n686218453 330162337\\r\\n1652 198\\r\\n94228878 120807430\\r\\n321833307 555554721\\r\\n174 286\\r\\n164142798 245870019\\r\\n583705694 473613874\\r\\n34 14\\r\\n838913144 523540071\\r\\n196289882 210697725\\r\\n366 1\\r\\n458219233 754817996\\r\\n479775444 695584136\\r\\n436 1\\r\\n719273007 639139513\\r\\n'], 'output': ['0\\r\\n1\\r\\n10\\r\\n1\\r\\n10\\r\\n4\\r\\n1\\r\\n0\\r\\n1\\r\\n']}, {'input': ['9\\r\\n607507108 880745414\\r\\n184230 66305\\r\\n906536667 186993202\\r\\n520422972 197897190\\r\\n12401 74495\\r\\n211761103 151974837\\r\\n745713555 339263849\\r\\n2882 25114\\r\\n443432137 901173409\\r\\n416530278 970541235\\r\\n50 2363\\r\\n64417257 232990460\\r\\n877914971 164179133\\r\\n152 20747\\r\\n27142466 583304616\\r\\n172509165 832852193\\r\\n169 6094\\r\\n462709318 217268143\\r\\n838981787 320801506\\r\\n22 4430\\r\\n26389360 806794193\\r\\n202207825 985202495\\r\\n62 146\\r\\n107497012 524519500\\r\\n64228375 241524154\\r\\n5 123\\r\\n436786468 965256427\\r\\n'], 'output': ['7\\r\\n4\\r\\n1\\r\\n21\\r\\n38\\r\\n3\\r\\n22\\r\\n10\\r\\n0\\r\\n']}, {'input': ['6\\r\\n375768703 43661123\\r\\n86513 85909\\r\\n399354188 255381217\\r\\n637383632 402045942\\r\\n85481 21206\\r\\n608615040 864891223\\r\\n584779257 62789079\\r\\n1978 31344\\r\\n267683378 412975691\\r\\n984667447 810343159\\r\\n24975 14322\\r\\n781765204 100211566\\r\\n648591888 43792157\\r\\n51 22015\\r\\n508545221 597685263\\r\\n913187498 891325066\\r\\n616 24989\\r\\n930384945 923754846\\r\\n'], 'output': ['1\\r\\n1\\r\\n2\\r\\n17\\r\\n1\\r\\n0\\r\\n']}, {'input': ['9\\r\\n475033014 267058742\\r\\n26843 148652\\r\\n850113755 279316120\\r\\n871120869 885251487\\r\\n51363 15651\\r\\n220811492 256297120\\r\\n473761699 194406678\\r\\n38725 23371\\r\\n167395720 333327477\\r\\n107541472 19164492\\r\\n74340 1113\\r\\n654389849 224345301\\r\\n663158140 437349008\\r\\n332 5052\\r\\n971865476 538450184\\r\\n959712803 461224210\\r\\n3821 6144\\r\\n119698472 652792989\\r\\n853432424 940060247\\r\\n747 13\\r\\n795773428 45401185\\r\\n961552160 519042556\\r\\n1580 1\\r\\n14471168 182354592\\r\\n461092866 223026607\\r\\n1438 3\\r\\n150236397 209625248\\r\\n'], 'output': ['1\\r\\n7\\r\\n3\\r\\n0\\r\\n1\\r\\n11\\r\\n14\\r\\n101\\r\\n4\\r\\n']}, {'input': ['7\\r\\n770686292 31470126\\r\\n29744 152362\\r\\n162986893 666311542\\r\\n649791217 102684421\\r\\n138433 30198\\r\\n309416632 333240823\\r\\n29593103 784586869\\r\\n17102 14749\\r\\n441831527 778131692\\r\\n505391768 242704743\\r\\n1244 1845\\r\\n858318748 573608162\\r\\n735765251 873810739\\r\\n379 434\\r\\n268198989 224679292\\r\\n313063120 27674236\\r\\n10972 24\\r\\n754356578 362655697\\r\\n657164356 250088782\\r\\n1528 253\\r\\n236847599 107080200\\r\\n'], 'output': ['4\\r\\n2\\r\\n1\\r\\n0\\r\\n6\\r\\n0\\r\\n8\\r\\n']}, {'input': ['6\\r\\n771635296 217191977\\r\\n155049 100468\\r\\n374552077 861617770\\r\\n379993499 579502537\\r\\n41379 97347\\r\\n332561502 523936642\\r\\n617938825 882432192\\r\\n1873 1526\\r\\n546099297 851499251\\r\\n461546535 978874972\\r\\n134 130\\r\\n139684946 934801176\\r\\n226629019 643827031\\r\\n520 154\\r\\n469973119 321904605\\r\\n399351792 264918512\\r\\n955 230\\r\\n377771650 522257503\\r\\n'], 'output': ['2\\r\\n2\\r\\n2\\r\\n10\\r\\n2\\r\\n1\\r\\n']}, {'input': ['5\\r\\n271379090 437448400\\r\\n174321 187248\\r\\n206800031 916857527\\r\\n955345759 395736922\\r\\n24979 8201\\r\\n320498176 544492482\\r\\n839334876 648699568\\r\\n137 2972\\r\\n39451852 17987462\\r\\n800762178 834957066\\r\\n362 1540\\r\\n208813023 104244043\\r\\n384328248 951674305\\r\\n135 3\\r\\n248443950 457837665\\r\\n'], 'output': ['3\\r\\n3\\r\\n82\\r\\n15\\r\\n4\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n200000 200000\\r\\n1 1\\r\\n'], 'output': ['400000\\r\\n']}, {'input': ['2\\r\\n904947081 97413347\\r\\n92080 43244\\r\\n478330090 142390503\\r\\n366817612 170001641\\r\\n96496 118744\\r\\n218196778 537806289\\r\\n'], 'output': ['6\\r\\n1\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n200000 200000\\r\\n99 99999\\r\\n'], 'output': ['219802\\r\\n']}, {'input': ['9\\r\\n963639298 961185941\\r\\n114156 134554\\r\\n190757851 76075401\\r\\n476738721 594984842\\r\\n85771 27870\\r\\n671491309 948799671\\r\\n55178773 483024012\\r\\n48 23031\\r\\n913828718 704626517\\r\\n352339448 944638775\\r\\n3 12367\\r\\n735205996 288464482\\r\\n577550287 482754435\\r\\n18 1955\\r\\n152312455 134311706\\r\\n17048670 757134972\\r\\n1 212\\r\\n766718664 802218300\\r\\n594156618 224966720\\r\\n1 1\\r\\n279904958 988000378\\r\\n405581814 999700794\\r\\n1 6\\r\\n18082783 852613441\\r\\n358371479 11276958\\r\\n1 4\\r\\n718998558 986129579\\r\\n'], 'output': ['24\\r\\n0\\r\\n0\\r\\n4\\r\\n7\\r\\n0\\r\\n1\\r\\n2\\r\\n0\\r\\n']}, {'input': ['7\\r\\n830022920 827557314\\r\\n156539 147441\\r\\n138303859 104143630\\r\\n294607178 713823297\\r\\n20210 42715\\r\\n497916857 896438972\\r\\n909152264 769020210\\r\\n13812 5913\\r\\n267364374 618236712\\r\\n60415558 272872683\\r\\n8579 2255\\r\\n127645461 273280362\\r\\n782223781 296336262\\r\\n823 340\\r\\n403285729 721930917\\r\\n875994952 49435565\\r\\n11 1324\\r\\n500816309 258162260\\r\\n734281479 99795366\\r\\n13 4\\r\\n550870662 729483479\\r\\n'], 'output': ['14\\r\\n1\\r\\n5\\r\\n2\\r\\n1\\r\\n3\\r\\n1\\r\\n']}, {'input': ['2\\r\\n136598030 103994096\\r\\n15511 77886\\r\\n940625674 837244563\\r\\n112475634 537694455\\r\\n18783 119072\\r\\n764533893 694335169\\r\\n'], 'output': ['0\\r\\n0\\r\\n']}, {'input': ['7\\r\\n148205845 380430878\\r\\n17331 96737\\r\\n183138977 720088601\\r\\n490152603 361565614\\r\\n40966 46613\\r\\n31150928 787198662\\r\\n27164653 785723007\\r\\n88230 10106\\r\\n119659879 5265614\\r\\n476567778 963985492\\r\\n34540 36722\\r\\n472332901 533360507\\r\\n191570769 773756813\\r\\n6327 6235\\r\\n315297684 192136634\\r\\n444144413 783779855\\r\\n1702 2540\\r\\n823787407 729858693\\r\\n429115520 559004273\\r\\n6295 1030\\r\\n797834773 627034000\\r\\n'], 'output': ['2\\r\\n26\\r\\n154\\r\\n3\\r\\n4\\r\\n1\\r\\n0\\r\\n']}, {'input': ['1\\r\\n765404449 59915752\\r\\n106638 153018\\r\\n955973076 388114805\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n864846363 511643468\\r\\n40470 147238\\r\\n835717689 453189534\\r\\n308021060 480404069\\r\\n134032 46036\\r\\n297767964 439870667\\r\\n'], 'output': ['2\\r\\n2\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n200000 200000\\r\\n999999999 999999999\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n755223960 945510081\\r\\n32723 99520\\r\\n749346456 588350919\\r\\n889552454 184189286\\r\\n147346 25947\\r\\n902387068 804510990\\r\\n734041792 451616849\\r\\n4572 4929\\r\\n594216948 212430683\\r\\n464716617 643818466\\r\\n10328 58516\\r\\n692630583 510612417\\r\\n497460903 517954663\\r\\n2387 4855\\r\\n692289803 959424135\\r\\n'], 'output': ['2\\r\\n1\\r\\n5\\r\\n1\\r\\n0\\r\\n']}, {'input': ['1\\r\\n1000000000 1000000000\\r\\n1 149313\\r\\n1 59924649\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['6\\r\\n704299505 677200711\\r\\n85596 69292\\r\\n133534055 612392157\\r\\n408438392 672517167\\r\\n70178 68899\\r\\n200540818 638040761\\r\\n982297641 736229481\\r\\n8056 59752\\r\\n219782487 103271187\\r\\n241113264 825639334\\r\\n5125 294\\r\\n729068341 838033082\\r\\n936287997 907579356\\r\\n15033 1303\\r\\n707269072 565411817\\r\\n455532924 105032674\\r\\n5290 188\\r\\n963629238 159383134\\r\\n'], 'output': ['10\\r\\n5\\r\\n16\\r\\n1\\r\\n2\\r\\n2\\r\\n']}, {'input': ['5\\r\\n978161011 340632673\\r\\n126195 176522\\r\\n523659211 170966687\\r\\n720700186 192777621\\r\\n1477 10294\\r\\n544116390 502198405\\r\\n70983891 195534248\\r\\n55009 10875\\r\\n236241073 163382507\\r\\n415344583 30806118\\r\\n9223 1730\\r\\n660653878 405822044\\r\\n656617073 223034283\\r\\n5702 229\\r\\n573847322 646485239\\r\\n'], 'output': ['6\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}]","id":612} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"174_C","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n;\r\n readf(\"%s\", &n);\r\n readln;\r\n\r\n auto arr = [0] ~ readln.chomp.split.map!(to!int).array ~ [0];\r\n \r\n debug { arr.writeln; }\r\n \r\n Tuple!(int, int)[] ans;\r\n \r\n auto stk = make!(SList!int);\r\n stk.insertFront(0);\r\n foreach (i; 1 .. n+1) {\r\n if (arr[i] > arr[i-1]) { stk.insertFront(i); }\r\n \r\n if (arr[i] > arr[i+1]) {\r\n while (arr[stk.front] > arr[i+1]) {\r\n auto lft = stk.front;\r\n stk.removeFront();\r\n \r\n auto ht = arr[lft];\r\n \r\n foreach (_; 0 .. ht - arr[stk.front]) {\r\n ans ~= tuple(lft, i);\r\n }\r\n }\r\n }\r\n }\r\n \r\n ans.length.writeln;\r\n ans.each!(t => writeln(t[0], ' ', t[1]));\r\n}","description":"Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l,r]. In other words, this function does the following: function rangeIncrement(l, r) for i := l .. r do a[i] = a[i] + 1Polycarpus knows the state of the array a after a series of function calls. He wants to determine the minimum number of function calls that lead to such state. In addition, he wants to find what function calls are needed in this case. It is guaranteed that the required number of calls does not exceed 10^5.Before calls of function rangeIncrement(l, r) all array elements equal zero.","input_specification":"The first input line contains a single integer n (1\u2264n\u226410^5) \u2014 the length of the array a[1... n]. \nThe second line contains its integer space-separated elements, a[1],a[2],...,a[n] (0\u2264a[i]\u226410^5) after some series of function calls rangeIncrement(l, r). \nIt is guaranteed that at least one element of the array is positive. It is guaranteed that the answer contains no more than 10^5 calls of function rangeIncrement(l, r).\n","output_specification":"Print on the first line t \u2014 the minimum number of calls of function rangeIncrement(l, r), that lead to the array from the input data. It is guaranteed that this number will turn out not more than 10^5.\nThen print t lines \u2014 the descriptions of function calls, one per line. Each line should contain two integers li,ri (1\u2264li\u2264ri\u2264n) \u2014 the arguments of the i-th call rangeIncrement(l, r). Calls can be applied in any order.\nIf there are multiple solutions, you are allowed to print any of them.\n","notes":"The first sample requires a call for the entire array, and four additional calls:\n one for the segment [2,2] (i.e. the second element of the array), three for the segment [5,5] (i.e. the fifth element of the array). ","sample_inputs":["6\n1 2 1 1 4 1\n","5\n1 0 1 0 1\n"],"sample_outputs":["5\n2 2\n5 5\n5 5\n5 5\n1 6\n","3\n1 1\n3 3\n5 5\n"],"human_solution":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n;\r\n readf(\"%s\", &n);\r\n readln;\r\n\r\n auto arr = [0] ~ readln.chomp.split.map!(to!int).array ~ [0];\r\n \r\n debug { arr.writeln; }\r\n \r\n Tuple!(int, int)[] ans;\r\n \r\n auto stk = make!(SList!(Tuple!(int, int)));\r\n stk.insertFront(tuple(0, 0));\r\n foreach (i; 1 .. n+1) {\r\n if (arr[i] > arr[i-1]) { stk.insertFront(tuple(i, arr[i])); }\r\n \r\n while (stk.front[1] > arr[i+1]) {\r\n auto lft = stk.front[0];\r\n auto ht = stk.front[1];\r\n stk.removeFront();\r\n\r\n ans ~= tuple(lft, i);\r\n \r\n if (ht - 1 > stk.front[1]) { stk.insertFront(tuple(lft, ht - 1)); }\r\n }\r\n }\r\n \r\n ans.length.writeln;\r\n ans.each!(t => writeln(t[0], ' ', t[1]));\r\n}","testcases":"[{'input': ['6\\r\\n1 2 1 1 4 1\\r\\n'], 'output': ['5\\r\\n2 2\\r\\n5 5\\r\\n5 5\\r\\n5 5\\r\\n1 6\\r\\n']}, {'input': ['5\\r\\n1 0 1 0 1\\r\\n'], 'output': ['3\\r\\n1 1\\r\\n3 3\\r\\n5 5\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n1 1\\r\\n']}, {'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['5\\r\\n5 5\\r\\n4 5\\r\\n3 5\\r\\n2 5\\r\\n1 5\\r\\n']}, {'input': ['12\\r\\n0 1 1 1 3 4 3 3 3 3 2 2\\r\\n'], 'output': ['4\\r\\n6 6\\r\\n5 10\\r\\n5 12\\r\\n2 12\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['2\\r\\n1 1\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n1 3\\r\\n'], 'output': ['3\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n2 4\\r\\n'], 'output': ['4\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n'], 'output': ['1\\r\\n1 3\\r\\n']}, {'input': ['3\\r\\n0 2 1\\r\\n'], 'output': ['2\\r\\n2 2\\r\\n2 3\\r\\n']}, {'input': ['3\\r\\n2 2 1\\r\\n'], 'output': ['2\\r\\n1 2\\r\\n1 3\\r\\n']}, {'input': ['3\\r\\n2 4 2\\r\\n'], 'output': ['4\\r\\n2 2\\r\\n2 2\\r\\n1 3\\r\\n1 3\\r\\n']}, {'input': ['5\\r\\n1 1 0 0 0\\r\\n'], 'output': ['1\\r\\n1 2\\r\\n']}, {'input': ['5\\r\\n0 0 1 1 0\\r\\n'], 'output': ['1\\r\\n3 4\\r\\n']}, {'input': ['5\\r\\n1 0 2 1 0\\r\\n'], 'output': ['3\\r\\n1 1\\r\\n3 3\\r\\n3 4\\r\\n']}, {'input': ['5\\r\\n2 1 2 3 3\\r\\n'], 'output': ['4\\r\\n1 1\\r\\n4 5\\r\\n3 5\\r\\n1 5\\r\\n']}, {'input': ['20\\r\\n4 5 4 4 3 2 2 1 2 2 2 3 3 4 2 2 2 1 1 1\\r\\n'], 'output': ['8\\r\\n2 2\\r\\n1 4\\r\\n1 5\\r\\n1 7\\r\\n14 14\\r\\n12 14\\r\\n9 17\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n1 6 8 9 10 10 11 11 10 10 9 6 6 6 6 4 3 2 1 0\\r\\n'], 'output': ['11\\r\\n7 8\\r\\n5 10\\r\\n4 11\\r\\n3 11\\r\\n3 11\\r\\n2 15\\r\\n2 15\\r\\n2 16\\r\\n2 17\\r\\n2 18\\r\\n1 19\\r\\n']}, {'input': ['20\\r\\n4 6 7 8 8 8 9 9 10 12 12 11 12 12 11 9 8 8 5 2\\r\\n'], 'output': ['13\\r\\n10 11\\r\\n13 14\\r\\n10 15\\r\\n9 15\\r\\n7 16\\r\\n4 18\\r\\n3 18\\r\\n2 18\\r\\n2 19\\r\\n1 19\\r\\n1 19\\r\\n1 20\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n2 2 4 5 5 6 7 6 5 5 7 6 4 3 3 3 3 3 3 1\\r\\n'], 'output': ['9\\r\\n7 7\\r\\n6 8\\r\\n11 11\\r\\n11 12\\r\\n4 12\\r\\n3 13\\r\\n3 19\\r\\n1 19\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n5 9 11 12 13 13 13 13 13 13 13 13 13 13 12 11 11 8 6 4\\r\\n'], 'output': ['13\\r\\n5 14\\r\\n4 15\\r\\n3 17\\r\\n3 17\\r\\n2 17\\r\\n2 18\\r\\n2 18\\r\\n2 19\\r\\n1 19\\r\\n1 20\\r\\n1 20\\r\\n1 20\\r\\n1 20\\r\\n']}]","id":613} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"182_E","execute_outcome":"RUNTIME_ERROR","source_code":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nimmutable int MD = 10 ^^ 9 + 7;\r\n\r\nvoid main()\r\n{\r\n int n, len;\r\n readf(\"%s %s\", &n, &len);\r\n readln;\r\n\r\n int[][] arr;\r\n foreach (i; 0 .. n) {\r\n int x, y;\r\n readf(\"%s %s\", &x, &y);\r\n readln;\r\n \r\n arr ~= [x, y];\r\n }\r\n \r\n debug { arr.writeln; }\r\n \r\n auto dp = new int[][][] (len+1, n, 2);\r\n foreach (i, e; arr) {\r\n dp[e[0]][i][0] = 1;\r\n if (e[0] != e[1]) { dp[e[1]][i][1] = 1; }\r\n }\r\n \r\n debug { dp.writeln; }\r\n \r\n foreach (clen; 2 .. len+1) {\r\n foreach (i, e; arr) {\r\n foreach (turn; 0 .. 2) {\r\n if (turn == 1 && e[0] == e[1]) { continue; }\r\n \r\n int elen = e[turn];\r\n if (elen >= clen) { continue; }\r\n \r\n foreach (j, p; arr) {\r\n if (i == j) { continue; }\r\n \r\n foreach (pTurn; 0 .. 2) {\r\n if (pTurn == 1 && p[0] == p[1]) { continue; }\r\n \r\n int pMatch = p[1 - pTurn];\r\n if (elen != pMatch) { continue; }\r\n \r\n debug { if (clen == 3 && i == 1) { writeln(turn, ' ', j, ' ', pTurn, ' ', pMatch, ' ', dp[clen-elen][j][pTurn]); } }\r\n dp[clen][i][turn] = (dp[clen][i][turn] + dp[clen-elen][j][pTurn]) % MD;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n debug { dp.each!writeln; }\r\n \r\n int ans = 0;\r\n foreach (ref e; dp[len]) {\r\n foreach (et; e) { ans = (ans + et) % MD; }\r\n }\r\n \r\n ans.writeln;\r\n}","description":"Vasya has recently bought some land and decided to surround it with a wooden fence.He went to a company called \"Wooden board\" that produces wooden boards for fences. Vasya read in the catalog of products that the company has at its disposal n different types of wood. The company uses the i-th type of wood to produce a board of this type that is a rectangular ai by bi block.Vasya decided to order boards in this company and build a fence from them. It turned out that the storehouse of the company is so large that Vasya can order arbitrary number of boards of every type. Note that Vasya is allowed to turn the boards as he builds the fence. However, Vasya cannot turn square boards.Vasya is required to construct a fence of length l, however, an arbitrary fence won't do. Vasya wants his fence to look beautiful. We'll say that a fence is beautiful if and only if the following two conditions are fulfilled: there are no two successive boards of the same type the first board of the fence has an arbitrary length, and the length of each subsequent board equals the width of the previous one In other words, the fence is considered beautiful, if the type of the i-th board in the fence is different from the i-1-th board's type; besides, the i-th board's length is equal to the i-1-th board's width (for all i, starting from 2).Now Vasya wonders, how many variants of arranging a fence for his land exist. Your task is to count the number of different beautiful fences of length l.Two fences will be considered the same if the corresponding sequences of fence boards types and rotations are the same, otherwise the fences are different. Since the sought number can be large enough, you need to calculate the answer modulo 1000000007 (10^9+7).","input_specification":"The first line contains two integers n and l (1\u2264n\u2264100,1\u2264l\u22643000) \u2014 the number of different board types and the fence length, correspondingly. Next n lines contain descriptions of board types: the i-th line contains two integers ai and bi (1\u2264ai,bi\u2264100) \u2014 the sizes of the board of the i-th type. All numbers on the lines are separated by spaces.\n","output_specification":"Print a single integer \u2014 the sought number of variants modulo 1000000007 (10^9+7).\n","notes":"In the first sample there are exactly two variants of arranging a beautiful fence of length 3: \n As the first fence board use the board of the first type of length 1 and width 2. As the second board use board of the second type of length 2 and width 3. Use one board of the second type after you turn it. That makes its length equal 3, and width \u2014 2. ","sample_inputs":["2 3\n1 2\n2 3\n","1 2\n2 2\n","6 6\n2 1\n3 2\n2 5\n3 3\n5 1\n2 1\n"],"sample_outputs":["2\n","1\n","20\n"],"human_solution":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nimmutable int MD = 10 ^^ 9 + 7;\r\n\r\nvoid main()\r\n{\r\n int n, len;\r\n readf(\"%s %s\", &n, &len);\r\n readln;\r\n\r\n int[][] arr;\r\n foreach (i; 0 .. n) {\r\n int x, y;\r\n readf(\"%s %s\", &x, &y);\r\n readln;\r\n \r\n arr ~= [x, y];\r\n }\r\n \r\n debug { arr.writeln; }\r\n \r\n auto dp = new int[][][] (len+1, n, 2);\r\n foreach (i, e; arr) {\r\n if (e[0] <= len) { dp[e[0]][i][0] = 1; }\r\n if (e[1] <= len && e[1] != e[0]) { dp[e[1]][i][1] = 1; }\r\n }\r\n \r\n debug { dp.writeln; }\r\n \r\n foreach (clen; 2 .. len+1) {\r\n foreach (i, e; arr) {\r\n foreach (turn; 0 .. 2) {\r\n if (turn == 1 && e[0] == e[1]) { continue; }\r\n \r\n int elen = e[turn];\r\n if (elen >= clen) { continue; }\r\n \r\n foreach (j, p; arr) {\r\n if (i == j) { continue; }\r\n \r\n foreach (pTurn; 0 .. 2) {\r\n if (pTurn == 1 && p[0] == p[1]) { continue; }\r\n \r\n int pMatch = p[1 - pTurn];\r\n if (elen != pMatch) { continue; }\r\n \r\n debug { if (clen == 3 && i == 1) { writeln(turn, ' ', j, ' ', pTurn, ' ', pMatch, ' ', dp[clen-elen][j][pTurn]); } }\r\n dp[clen][i][turn] = (dp[clen][i][turn] + dp[clen-elen][j][pTurn]) % MD;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n \r\n debug { dp.each!writeln; }\r\n \r\n int ans = 0;\r\n foreach (ref e; dp[len]) {\r\n foreach (et; e) { ans = (ans + et) % MD; }\r\n }\r\n \r\n ans.writeln;\r\n}","testcases":"[{'input': ['2 3\\r\\n1 2\\r\\n2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2\\r\\n2 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 6\\r\\n2 1\\r\\n3 2\\r\\n2 5\\r\\n3 3\\r\\n5 1\\r\\n2 1\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['4 3\\r\\n1 2\\r\\n1 1\\r\\n3 1\\r\\n2 2\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4 6\\r\\n1 1\\r\\n1 2\\r\\n3 1\\r\\n5 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 10\\r\\n1 2\\r\\n2 3\\r\\n1 2\\r\\n3 1\\r\\n2 4\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['1 4\\r\\n4 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 3\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 6\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n'], 'output': ['216\\r\\n']}, {'input': ['4 10\\r\\n4 5\\r\\n5 3\\r\\n1 4\\r\\n1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 8\\r\\n3 1\\r\\n2 1\\r\\n2 3\\r\\n2 1\\r\\n3 1\\r\\n'], 'output': ['62\\r\\n']}, {'input': ['10 11\\r\\n3 10\\r\\n10 2\\r\\n2 6\\r\\n7 6\\r\\n8 1\\r\\n2 3\\r\\n7 10\\r\\n8 2\\r\\n6 5\\r\\n2 5\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['8 20\\r\\n18 18\\r\\n14 15\\r\\n8 4\\r\\n5 9\\r\\n2 7\\r\\n9 2\\r\\n9 19\\r\\n2 11\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 7\\r\\n3 1\\r\\n2 1\\r\\n1 2\\r\\n4 5\\r\\n2 5\\r\\n2 1\\r\\n'], 'output': ['94\\r\\n']}, {'input': ['7 4\\r\\n1 2\\r\\n2 2\\r\\n3 3\\r\\n3 3\\r\\n1 1\\r\\n3 3\\r\\n3 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['100 3000\\r\\n1 4\\r\\n2 1\\r\\n3 3\\r\\n1 1\\r\\n5 4\\r\\n4 1\\r\\n2 1\\r\\n5 4\\r\\n1 1\\r\\n3 3\\r\\n4 3\\r\\n3 4\\r\\n4 2\\r\\n2 4\\r\\n1 2\\r\\n3 4\\r\\n5 3\\r\\n1 4\\r\\n2 4\\r\\n4 5\\r\\n1 2\\r\\n5 2\\r\\n2 2\\r\\n3 2\\r\\n4 4\\r\\n1 4\\r\\n5 5\\r\\n3 4\\r\\n4 1\\r\\n3 3\\r\\n5 2\\r\\n3 3\\r\\n4 1\\r\\n1 5\\r\\n4 3\\r\\n5 3\\r\\n4 2\\r\\n3 3\\r\\n3 5\\r\\n5 1\\r\\n5 1\\r\\n3 3\\r\\n4 3\\r\\n1 3\\r\\n4 1\\r\\n2 3\\r\\n1 3\\r\\n1 2\\r\\n5 5\\r\\n5 2\\r\\n1 5\\r\\n4 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n4 4\\r\\n5 4\\r\\n2 5\\r\\n1 3\\r\\n5 3\\r\\n1 1\\r\\n3 5\\r\\n1 4\\r\\n5 2\\r\\n2 3\\r\\n1 3\\r\\n5 1\\r\\n3 4\\r\\n5 1\\r\\n5 3\\r\\n3 2\\r\\n2 4\\r\\n5 2\\r\\n2 5\\r\\n5 4\\r\\n2 4\\r\\n1 1\\r\\n2 1\\r\\n2 3\\r\\n4 4\\r\\n1 5\\r\\n2 2\\r\\n1 3\\r\\n3 1\\r\\n3 2\\r\\n5 2\\r\\n5 5\\r\\n2 5\\r\\n2 3\\r\\n3 2\\r\\n4 1\\r\\n2 3\\r\\n5 1\\r\\n4 2\\r\\n2 4\\r\\n2 1\\r\\n5 3\\r\\n5 4\\r\\n1 1\\r\\n2 3\\r\\n'], 'output': ['440706472\\r\\n']}, {'input': ['20 20\\r\\n2 1\\r\\n1 1\\r\\n2 3\\r\\n2 1\\r\\n2 1\\r\\n3 3\\r\\n2 3\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n2 3\\r\\n2 3\\r\\n1 3\\r\\n2 2\\r\\n2 1\\r\\n3 2\\r\\n2 1\\r\\n1 1\\r\\n1 3\\r\\n3 3\\r\\n'], 'output': ['379149793\\r\\n']}, {'input': ['13 10\\r\\n4 2\\r\\n1 3\\r\\n3 3\\r\\n2 2\\r\\n3 1\\r\\n3 4\\r\\n4 1\\r\\n1 3\\r\\n2 3\\r\\n1 3\\r\\n3 1\\r\\n3 3\\r\\n2 1\\r\\n'], 'output': ['4551\\r\\n']}, {'input': ['10 50\\r\\n9 7\\r\\n2 2\\r\\n7 9\\r\\n10 9\\r\\n6 1\\r\\n8 10\\r\\n10 5\\r\\n7 5\\r\\n4 5\\r\\n8 1\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['10 30\\r\\n12 21\\r\\n2 8\\r\\n19 7\\r\\n7 1\\r\\n27 14\\r\\n13 3\\r\\n14 7\\r\\n19 26\\r\\n21 17\\r\\n17 30\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 5\\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': ['65610\\r\\n']}, {'input': ['100 2000\\r\\n2 2\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n'], 'output': ['842986379\\r\\n']}, {'input': ['100 2000\\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\\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\\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\\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\\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\\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\\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\\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\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['370055910\\r\\n']}, {'input': ['100 1500\\r\\n3 3\\r\\n3 2\\r\\n1 3\\r\\n3 1\\r\\n2 3\\r\\n3 2\\r\\n3 2\\r\\n2 1\\r\\n3 1\\r\\n2 3\\r\\n3 3\\r\\n3 1\\r\\n1 1\\r\\n3 1\\r\\n3 3\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n1 1\\r\\n3 1\\r\\n2 2\\r\\n2 3\\r\\n2 3\\r\\n2 2\\r\\n3 3\\r\\n3 2\\r\\n1 1\\r\\n3 3\\r\\n2 2\\r\\n1 3\\r\\n3 3\\r\\n3 1\\r\\n1 2\\r\\n3 3\\r\\n3 3\\r\\n2 2\\r\\n1 1\\r\\n3 3\\r\\n1 3\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n1 3\\r\\n1 3\\r\\n1 3\\r\\n1 1\\r\\n1 3\\r\\n3 1\\r\\n2 3\\r\\n1 3\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n2 3\\r\\n3 2\\r\\n1 2\\r\\n2 2\\r\\n1 3\\r\\n1 1\\r\\n1 3\\r\\n3 3\\r\\n1 3\\r\\n3 2\\r\\n1 3\\r\\n2 1\\r\\n2 3\\r\\n2 3\\r\\n2 3\\r\\n3 2\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n1 3\\r\\n2 1\\r\\n3 2\\r\\n3 3\\r\\n1 1\\r\\n3 1\\r\\n3 3\\r\\n1 3\\r\\n3 2\\r\\n3 2\\r\\n2 2\\r\\n1 3\\r\\n2 2\\r\\n3 2\\r\\n1 3\\r\\n2 2\\r\\n2 1\\r\\n3 2\\r\\n1 3\\r\\n3 2\\r\\n1 2\\r\\n2 2\\r\\n1 3\\r\\n1 1\\r\\n3 3\\r\\n2 2\\r\\n3 1\\r\\n3 3\\r\\n'], 'output': ['548967810\\r\\n']}, {'input': ['100 2500\\r\\n3 1\\r\\n3 2\\r\\n3 2\\r\\n3 1\\r\\n1 1\\r\\n1 2\\r\\n3 3\\r\\n1 2\\r\\n1 2\\r\\n3 1\\r\\n3 3\\r\\n3 2\\r\\n1 3\\r\\n2 1\\r\\n2 3\\r\\n2 2\\r\\n1 3\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n2 3\\r\\n1 3\\r\\n1 2\\r\\n3 1\\r\\n2 3\\r\\n2 3\\r\\n3 1\\r\\n2 3\\r\\n2 3\\r\\n3 1\\r\\n1 1\\r\\n3 2\\r\\n2 3\\r\\n3 3\\r\\n3 2\\r\\n3 1\\r\\n3 2\\r\\n3 1\\r\\n2 1\\r\\n1 3\\r\\n2 2\\r\\n2 2\\r\\n3 2\\r\\n1 2\\r\\n3 1\\r\\n3 2\\r\\n3 1\\r\\n1 2\\r\\n3 1\\r\\n3 1\\r\\n3 1\\r\\n2 3\\r\\n1 3\\r\\n1 3\\r\\n2 2\\r\\n1 2\\r\\n3 3\\r\\n3 2\\r\\n3 2\\r\\n3 3\\r\\n3 3\\r\\n2 1\\r\\n1 2\\r\\n3 2\\r\\n1 2\\r\\n2 3\\r\\n1 2\\r\\n2 3\\r\\n2 3\\r\\n3 2\\r\\n3 1\\r\\n2 3\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n3 1\\r\\n2 3\\r\\n2 1\\r\\n2 3\\r\\n3 2\\r\\n1 1\\r\\n3 3\\r\\n1 3\\r\\n3 2\\r\\n3 2\\r\\n2 2\\r\\n2 2\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n3 3\\r\\n1 1\\r\\n3 2\\r\\n1 2\\r\\n2 2\\r\\n3 3\\r\\n2 2\\r\\n1 2\\r\\n2 3\\r\\n'], 'output': ['563987225\\r\\n']}, {'input': ['30 2800\\r\\n25 12\\r\\n43 10\\r\\n38 39\\r\\n14 8\\r\\n35 41\\r\\n19 11\\r\\n23 5\\r\\n28 2\\r\\n7 36\\r\\n9 36\\r\\n38 32\\r\\n28 29\\r\\n18 31\\r\\n22 6\\r\\n25 34\\r\\n43 25\\r\\n36 33\\r\\n14 24\\r\\n13 40\\r\\n1 1\\r\\n19 44\\r\\n37 18\\r\\n7 17\\r\\n18 14\\r\\n44 35\\r\\n15 37\\r\\n43 23\\r\\n34 29\\r\\n3 21\\r\\n31 47\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 100\\r\\n45 74\\r\\n41 31\\r\\n84 56\\r\\n14 8\\r\\n25 94\\r\\n71 76\\r\\n35 8\\r\\n66 67\\r\\n27 54\\r\\n67 91\\r\\n71 20\\r\\n71 91\\r\\n7 58\\r\\n13 34\\r\\n47 60\\r\\n68 32\\r\\n74 58\\r\\n78 55\\r\\n67 40\\r\\n22 67\\r\\n27 59\\r\\n2 2\\r\\n89 62\\r\\n90 60\\r\\n41 57\\r\\n66 24\\r\\n65 93\\r\\n55 8\\r\\n94 2\\r\\n82 81\\r\\n91 67\\r\\n63 68\\r\\n24 12\\r\\n95 49\\r\\n48 63\\r\\n30 23\\r\\n32 86\\r\\n10 98\\r\\n89 71\\r\\n73 35\\r\\n85 60\\r\\n22 46\\r\\n9 50\\r\\n79 75\\r\\n24 53\\r\\n48 17\\r\\n22 61\\r\\n26 49\\r\\n89 58\\r\\n77 56\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['40 700\\r\\n11 14\\r\\n4 14\\r\\n14 13\\r\\n12 9\\r\\n14 10\\r\\n3 9\\r\\n7 7\\r\\n5 15\\r\\n1 11\\r\\n5 7\\r\\n2 9\\r\\n7 5\\r\\n3 10\\r\\n5 14\\r\\n4 11\\r\\n13 6\\r\\n4 6\\r\\n3 9\\r\\n1 11\\r\\n8 13\\r\\n6 4\\r\\n12 10\\r\\n10 14\\r\\n8 2\\r\\n1 15\\r\\n13 13\\r\\n6 11\\r\\n7 2\\r\\n7 12\\r\\n8 7\\r\\n1 13\\r\\n13 7\\r\\n12 10\\r\\n1 7\\r\\n7 1\\r\\n4 4\\r\\n10 7\\r\\n1 4\\r\\n13 8\\r\\n13 10\\r\\n'], 'output': ['964762206\\r\\n']}, {'input': ['60 900\\r\\n38 15\\r\\n10 1\\r\\n14 37\\r\\n13 1\\r\\n40 15\\r\\n31 26\\r\\n31 4\\r\\n12 5\\r\\n28 34\\r\\n37 7\\r\\n28 34\\r\\n11 30\\r\\n30 16\\r\\n27 18\\r\\n11 18\\r\\n17 6\\r\\n38 22\\r\\n31 37\\r\\n20 38\\r\\n21 23\\r\\n11 12\\r\\n24 35\\r\\n36 8\\r\\n13 13\\r\\n34 39\\r\\n20 15\\r\\n17 3\\r\\n23 17\\r\\n18 23\\r\\n26 18\\r\\n11 2\\r\\n18 30\\r\\n25 25\\r\\n32 40\\r\\n9 38\\r\\n37 39\\r\\n39 37\\r\\n5 10\\r\\n15 19\\r\\n14 21\\r\\n34 8\\r\\n7 36\\r\\n29 3\\r\\n11 21\\r\\n32 2\\r\\n21 40\\r\\n10 33\\r\\n36 39\\r\\n15 31\\r\\n38 16\\r\\n4 14\\r\\n6 16\\r\\n31 18\\r\\n15 23\\r\\n1 38\\r\\n32 24\\r\\n13 12\\r\\n15 15\\r\\n24 11\\r\\n24 27\\r\\n'], 'output': ['457432849\\r\\n']}, {'input': ['50 2000\\r\\n12 1\\r\\n11 29\\r\\n7 4\\r\\n18 27\\r\\n25 17\\r\\n28 5\\r\\n1 17\\r\\n10 29\\r\\n10 21\\r\\n8 7\\r\\n23 4\\r\\n20 7\\r\\n8 24\\r\\n2 27\\r\\n13 13\\r\\n14 15\\r\\n19 15\\r\\n7 26\\r\\n24 13\\r\\n8 25\\r\\n7 11\\r\\n18 11\\r\\n19 1\\r\\n30 15\\r\\n3 24\\r\\n27 7\\r\\n24 25\\r\\n7 7\\r\\n14 23\\r\\n3 24\\r\\n25 10\\r\\n25 3\\r\\n4 11\\r\\n22 29\\r\\n27 28\\r\\n23 5\\r\\n3 6\\r\\n16 3\\r\\n30 18\\r\\n16 22\\r\\n24 7\\r\\n11 1\\r\\n10 23\\r\\n2 3\\r\\n27 28\\r\\n28 25\\r\\n20 21\\r\\n25 3\\r\\n10 3\\r\\n7 25\\r\\n'], 'output': ['771010208\\r\\n']}, {'input': ['1 3000\\r\\n78 92\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 30\\r\\n9 35\\r\\n1 48\\r\\n17 43\\r\\n41 39\\r\\n28 7\\r\\n14 10\\r\\n3 45\\r\\n35 37\\r\\n31 27\\r\\n11 16\\r\\n40 8\\r\\n4 7\\r\\n15 33\\r\\n29 17\\r\\n41 45\\r\\n11 24\\r\\n6 8\\r\\n6 2\\r\\n2 42\\r\\n19 34\\r\\n7 36\\r\\n14 15\\r\\n26 2\\r\\n22 33\\r\\n15 22\\r\\n49 23\\r\\n10 41\\r\\n6 17\\r\\n21 11\\r\\n15 37\\r\\n49 26\\r\\n49 49\\r\\n15 29\\r\\n12 49\\r\\n22 13\\r\\n7 49\\r\\n25 32\\r\\n7 7\\r\\n31 37\\r\\n23 14\\r\\n5 37\\r\\n14 6\\r\\n44 21\\r\\n8 16\\r\\n22 7\\r\\n43 44\\r\\n36 44\\r\\n4 26\\r\\n22 46\\r\\n4 21\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['30 80\\r\\n27 10\\r\\n39 39\\r\\n87 45\\r\\n70 82\\r\\n20 50\\r\\n45 51\\r\\n67 31\\r\\n43 96\\r\\n87 26\\r\\n59 20\\r\\n42 22\\r\\n69 71\\r\\n10 30\\r\\n39 59\\r\\n42 100\\r\\n4 67\\r\\n21 55\\r\\n83 69\\r\\n33 81\\r\\n37 43\\r\\n57 12\\r\\n30 83\\r\\n34 12\\r\\n35 32\\r\\n11 12\\r\\n51 96\\r\\n100 68\\r\\n96 20\\r\\n50 61\\r\\n46 61\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 3000\\r\\n1 1\\r\\n3 3\\r\\n3 2\\r\\n1 1\\r\\n3 2\\r\\n1 3\\r\\n1 3\\r\\n1 1\\r\\n2 3\\r\\n2 3\\r\\n3 2\\r\\n1 3\\r\\n3 3\\r\\n1 1\\r\\n3 1\\r\\n2 3\\r\\n3 1\\r\\n2 1\\r\\n3 2\\r\\n3 2\\r\\n2 2\\r\\n1 2\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n1 3\\r\\n3 2\\r\\n2 3\\r\\n3 2\\r\\n3 1\\r\\n1 1\\r\\n3 1\\r\\n1 3\\r\\n1 2\\r\\n2 1\\r\\n3 2\\r\\n2 3\\r\\n3 1\\r\\n3 2\\r\\n3 1\\r\\n2 1\\r\\n1 3\\r\\n1 1\\r\\n3 3\\r\\n2 2\\r\\n3 2\\r\\n3 3\\r\\n2 2\\r\\n2 3\\r\\n3 3\\r\\n2 3\\r\\n2 2\\r\\n3 3\\r\\n3 3\\r\\n1 1\\r\\n2 3\\r\\n1 1\\r\\n3 3\\r\\n3 3\\r\\n2 2\\r\\n1 2\\r\\n3 2\\r\\n3 3\\r\\n3 3\\r\\n3 3\\r\\n3 1\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n3 2\\r\\n2 3\\r\\n3 2\\r\\n1 1\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 2\\r\\n2 3\\r\\n2 1\\r\\n1 2\\r\\n3 1\\r\\n3 1\\r\\n3 3\\r\\n2 3\\r\\n1 1\\r\\n3 3\\r\\n2 2\\r\\n1 3\\r\\n3 1\\r\\n2 3\\r\\n2 2\\r\\n3 2\\r\\n1 1\\r\\n3 3\\r\\n3 2\\r\\n'], 'output': ['936413338\\r\\n']}, {'input': ['100 3000\\r\\n3 3\\r\\n2 1\\r\\n3 3\\r\\n4 1\\r\\n2 4\\r\\n3 1\\r\\n3 4\\r\\n1 2\\r\\n3 4\\r\\n4 3\\r\\n2 2\\r\\n2 3\\r\\n4 2\\r\\n3 3\\r\\n1 3\\r\\n4 3\\r\\n3 1\\r\\n4 3\\r\\n2 2\\r\\n2 4\\r\\n2 2\\r\\n3 2\\r\\n2 1\\r\\n3 4\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 4\\r\\n3 4\\r\\n2 4\\r\\n2 3\\r\\n3 1\\r\\n4 1\\r\\n1 3\\r\\n2 2\\r\\n3 2\\r\\n2 2\\r\\n3 3\\r\\n2 2\\r\\n4 4\\r\\n4 3\\r\\n1 3\\r\\n2 3\\r\\n1 3\\r\\n1 1\\r\\n2 3\\r\\n3 3\\r\\n4 2\\r\\n2 2\\r\\n1 1\\r\\n1 3\\r\\n4 4\\r\\n3 3\\r\\n4 2\\r\\n1 4\\r\\n4 4\\r\\n2 4\\r\\n1 3\\r\\n2 3\\r\\n1 3\\r\\n1 1\\r\\n4 4\\r\\n3 2\\r\\n2 1\\r\\n4 4\\r\\n2 1\\r\\n2 1\\r\\n2 3\\r\\n3 3\\r\\n2 4\\r\\n2 1\\r\\n4 1\\r\\n3 1\\r\\n2 3\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n1 1\\r\\n4 1\\r\\n4 4\\r\\n3 2\\r\\n2 2\\r\\n1 4\\r\\n2 2\\r\\n4 3\\r\\n2 2\\r\\n4 1\\r\\n2 1\\r\\n4 2\\r\\n2 4\\r\\n2 1\\r\\n3 4\\r\\n4 2\\r\\n2 4\\r\\n3 4\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['822253206\\r\\n']}]","id":614} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"271_D","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop;\r\nimport core.checkedint;\r\nimport core.simd;\r\nimport core.stdc.stdlib;\r\nimport core.stdc.string;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.ascii;\r\nimport std.bigint;\r\nimport std.bitmanip;\r\nimport std.complex;\r\nimport std.container;\r\nimport std.conv;\r\nimport std.datetime;\r\nimport std.format;\r\nimport std.functional;\r\nimport std.math;\r\nimport std.meta;\r\nimport std.numeric;\r\nimport std.random;\r\nimport std.range;\r\nimport std.regex;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\nimport std.variant;\r\n\r\n__gshared:\r\n\r\nbool read(T...)(T ptrs) if (ptrs.length > 0) {\r\n return readf(' ' ~ replicate(\"%s \", ptrs.length), ptrs) == ptrs.length;\r\n}\r\n\r\nT[ ] allocate(T)(size_t n) {\r\n return (cast(T*)malloc(n * T.sizeof))[0 .. n];\r\n}\r\n\r\nauto pairwise(R)(R range) if (isForwardRange!R) {\r\n return lockstep(range, dropOne(range));\r\n}\r\n\r\nstruct Node {\r\n int len;\r\n Node*[char] next;\r\n Node* link;\r\n int[int] dp;\r\n\r\n Node* append(char c, Node* last) {\r\n auto cur = createNode(Node(last.len + 1));\r\n for (; last !is null && c !in last.next; last = last.link)\r\n last.next[c] = cur;\r\n if (last is null) {\r\n cur.link = &this;\r\n return cur;\r\n }\r\n auto q = last.next[c];\r\n if (q.len == last.len + 1) {\r\n cur.link = q;\r\n return cur;\r\n }\r\n auto clone = createNode(*q);\r\n clone.len = last.len + 1;\r\n cur.link = q.link = clone;\r\n for (; last !is null && last.next.get(c, null) == q; last = last.link)\r\n last.next[c] = clone;\r\n return cur;\r\n }\r\n\r\n int calc(int badTaken) {\r\n if (badTaken > k)\r\n return 0;\r\n if (auto p = badTaken in dp)\r\n return *p;\r\n int result = 1;\r\n foreach (c, node; next)\r\n result += node.calc(badTaken + (good[c - 'a'] == '0'));\r\n dp[badTaken] = result;\r\n return result;\r\n }\r\n}\r\n\r\nchar[1501] _s;\r\nchar[ ] s;\r\nchar[27] good;\r\nint k;\r\nint nodesSize;\r\nNode[3000] nodes;\r\n\r\nauto createNode()(auto ref Node node) {\r\n nodes[nodesSize] = node;\r\n return &nodes[nodesSize++];\r\n}\r\n\r\nvoid main() {\r\n while (true) {\r\n s = _s[ ];\r\n readln(s);\r\n if (s.empty)\r\n break;\r\n s = s[0 .. $ - 1];\r\n auto temp = good[ ];\r\n readln(temp);\r\n read(&k);\r\n\r\n Node root;\r\n auto last = &root;\r\n nodesSize = 0;\r\n foreach (c; s)\r\n last = root.append(c, last);\r\n writeln(root.calc(0) - 1);\r\n }\r\n}\r\n","description":"You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1\u2264l\u2264r\u2264|s|) of string s=s1s2...s|s| (where |s| is the length of string s) is string slsl+1...sr.The substring s[l...r] is good, if among the letters sl,sl+1,...,sr there are at most k bad ones (look at the sample's explanation to understand it more clear).Your task is to find the number of distinct good substrings of the given string s. Two substrings s[x...y] and s[p...q] are considered distinct if their content is different, i.e. s[x...y]\u2260s[p...q].","input_specification":"The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters.\nThe second line of the input is the string of characters \"0\" and \"1\", the length is exactly 26 characters. If the i-th character of this string equals \"1\", then the i-th English letter is good, otherwise it's bad. That is, the first character of this string corresponds to letter \"a\", the second one corresponds to letter \"b\" and so on.\nThe third line of the input consists a single integer k (0\u2264k\u2264|s|) \u2014 the maximum acceptable number of bad characters in a good substring.\n","output_specification":"Print a single integer \u2014 the number of distinct good substrings of string s.\n","notes":"In the first example there are following good substrings: \"a\", \"ab\", \"b\", \"ba\", \"bab\".\nIn the second example there are following good substrings: \"a\", \"aa\", \"ac\", \"b\", \"ba\", \"c\", \"ca\", \"cb\".\n","sample_inputs":["ababab\n01000000000000000000000000\n1\n","acbacbacaa\n00000000000000000000000000\n2\n"],"sample_outputs":["5\n","8\n"],"human_solution":"import std;\r\n\r\nclass TrieNode(alias T) {\r\n T value;\r\n TrieNode[26] cs;\r\n this(T value) {\r\n this.value = value;\r\n }\r\n ref TrieNode opIndex(char c) {\r\n assert(std.ascii.isAlpha(c));\r\n int i = cast(int)(c - 'a');\r\n return cs[i];\r\n }\r\n}\r\n\r\nvoid main() {\r\n auto s = readln.chomp;\r\n auto g = readln.chomp;\r\n auto k = readln.chomp.to!int;\r\n int N = cast(int)(s.length);\r\n\r\n bool is_bad(char c) {\r\n return g[ cast(int)(c - 'a') ] == '0';\r\n }\r\n\r\n long ans = 0;\r\n auto root = new TrieNode!bool(false);\r\n for (int i = 0; i < N; i++) {\r\n auto c = root;\r\n int bcount = 0;\r\n for (int j = i; j < N; j++) {\r\n if (is_bad(s[j])) {\r\n bcount++;\r\n }\r\n if (bcount > k) {\r\n break;\r\n }\r\n if (c[s[j]] is null) {\r\n c[s[j]] = new TrieNode!bool(false);\r\n }\r\n c = c[s[j]];\r\n if (! c.value) {\r\n c.value = true;\r\n ans++;\r\n }\r\n }\r\n }\r\n writeln(ans);\r\n}\r\n","testcases":"[{'input': ['ababab\\r\\n01000000000000000000000000\\r\\n1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['acbacbacaa\\r\\n00000000000000000000000000\\r\\n2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['a\\r\\n00000000000000000000000000\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aaaa\\r\\n00000000000000000000000000\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aaaaaa\\r\\n00000000000000000000000000\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['bbbbbbbbba\\r\\n01000000000000000000000000\\r\\n0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['bbbbbbbbba\\r\\n10000000000000000000000000\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['kqdwdulmgvugvbl\\r\\n00101010100100100101101110\\r\\n13\\r\\n'], 'output': ['114\\r\\n']}, {'input': ['acehqnrtuwaealwbqufdmizce\\r\\n10000110100000010011101101\\r\\n16\\r\\n'], 'output': ['316\\r\\n']}, {'input': ['yqahbyyoxltryqdmvenemaqnbakglgqolxnaifnqtoclnnqiab\\r\\n11000001000110100111100001\\r\\n41\\r\\n'], 'output': ['1243\\r\\n']}, {'input': ['dykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovfj\\r\\n10001111101011111101101001\\r\\n25\\r\\n'], 'output': ['4420\\r\\n']}, {'input': ['baababbbaa\\r\\n01011100110010100100001111\\r\\n7\\r\\n'], 'output': ['41\\r\\n']}, {'input': ['dykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovfj\\r\\n11111111111111111111111111\\r\\n25\\r\\n'], 'output': ['4967\\r\\n']}, {'input': ['twnwdluhxf\\r\\n00000000000000000000000000\\r\\n1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['aaaaaaaaaa\\r\\n01011100110010100100001111\\r\\n7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['eoyirpkwgpvvwzaaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['312\\r\\n']}, {'input': ['fwnpwwuzszuryaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['269\\r\\n']}, {'input': ['xnahfslefuigqaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['271\\r\\n']}]","id":615} {"difficulty":2100,"lang":"D","lang_cluster":"D","src_uid":"295_C","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.container;\r\nimport std.exception;\r\nimport std.math;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nimmutable int MAX_N = 54;\r\nimmutable int MOD = 1_000_000_007;\r\n\r\nlong [MAX_N] [MAX_N] c;\r\n\r\nvoid main ()\r\n{\r\n foreach (i; 0..MAX_N)\r\n {\r\n c[i][0] = 1;\r\n foreach (j; 1..i + 1)\r\n {\r\n c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;\r\n }\r\n }\r\n\r\n int n, k;\r\n while (readf (\" %s %s\", &n, &k) > 0)\r\n {\r\n auto a = new int [n];\r\n k \/= 50;\r\n int x = 0;\r\n int y = 0;\r\n foreach (i; 0..n)\r\n {\r\n readf (\" %s\", &a[i]);\r\n a[i] \/= 50;\r\n if (a[i] == 1)\r\n {\r\n x++;\r\n }\r\n else if (a[i] == 2)\r\n {\r\n y++;\r\n }\r\n else\r\n {\r\n enforce (false);\r\n }\r\n }\r\n\r\n alias Tuple !(int, \"b\", int, \"x\", int, \"y\") state;\r\n alias Tuple !(int, \"dist\", int, \"num\") value;\r\n state [] q;\r\n q.reserve (2 * (x + 1) * (y + 1));\r\n auto f = new value [] [] [] (2, x + 1, y + 1);\r\n\r\n f[0][0][0] = value (0, 1);\r\n q ~= state (0, 0, 0);\r\n while (q.length > 0)\r\n {\r\n state cur = q[0];\r\n q = q[1..$];\r\n int cb = cur.b;\r\n int cx = cur.x;\r\n int cy = cur.y;\r\n int cd = f[cb][cx][cy].dist + 1;\r\n int cn = f[cb][cx][cy].num;\r\n debug {writefln (\"%s %s %s\", cb, cx, cy);}\r\n int nb = 1 - cb;\r\n foreach (dx; 0..x + 1)\r\n {\r\n foreach (dy; 0..y + 1)\r\n {\r\n if (!dx && !dy)\r\n {\r\n continue;\r\n }\r\n if (dx + dy * 2 > k)\r\n {\r\n break;\r\n }\r\n int nx, ny;\r\n long mult;\r\n if (cb) \/\/ back\r\n {\r\n nx = cx - dx;\r\n ny = cy - dy;\r\n mult = (c[cx][dx] *\r\n c[cy][dy]) % MOD;\r\n if (nx < 0 || ny < 0)\r\n {\r\n continue;\r\n }\r\n }\r\n else \/\/ forward\r\n {\r\n nx = cx + dx;\r\n ny = cy + dy;\r\n mult = (c[x - cx][dx] *\r\n c[y - cy][dy]) % MOD;\r\n if (nx > x || ny > y)\r\n {\r\n continue;\r\n }\r\n }\r\n if (!f[nb][nx][ny].num)\r\n {\r\n f[nb][nx][ny].dist = cd;\r\n q ~= state (nb, nx, ny);\r\n }\r\n if (f[nb][nx][ny].dist != cd)\r\n {\r\n continue;\r\n }\r\n f[nb][nx][ny].num =\r\n (f[nb][nx][ny].num +\r\n mult * cn) % MOD;\r\n }\r\n }\r\n }\r\n\r\n writefln (\"%s\", f[1][x][y].dist == int.max ?\r\n -1 : f[1][x][y].dist);\r\n writefln (\"%s\", f[1][x][y].num);\r\n }\r\n}\r\n","description":"One day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, just where the guys were standing. We know that the boat can hold people with the total weight of at most k kilograms.Greg immediately took a piece of paper and listed there the weights of all people in his group (including himself). It turned out that each person weights either 50 or 100 kilograms. Now Greg wants to know what minimum number of times the boat needs to cross the river to transport the whole group to the other bank. The boat needs at least one person to navigate it from one bank to the other. As the boat crosses the river, it can have any non-zero number of passengers as long as their total weight doesn't exceed k.Also Greg is wondering, how many ways there are to transport everybody to the other side in the minimum number of boat rides. Two ways are considered distinct if during some ride they have distinct sets of people on the boat.Help Greg with this problem.","input_specification":"The first line contains two integers n, k (1\u2264n\u226450,1\u2264k\u22645000) \u2014 the number of people, including Greg, and the boat's weight limit. The next line contains n integers \u2014 the people's weights. A person's weight is either 50 kilos or 100 kilos.\nYou can consider Greg and his friends indexed in some way.\n","output_specification":"In the first line print an integer \u2014 the minimum number of rides. If transporting everyone to the other bank is impossible, print an integer -1.\nIn the second line print the remainder after dividing the number of ways to transport the people in the minimum number of rides by number 1000000007 (10^9+7). If transporting everyone to the other bank is impossible, print integer 0.\n","notes":"In the first test Greg walks alone and consequently, he needs only one ride across the river.\nIn the second test you should follow the plan:\n transport two 50 kg. people; transport one 50 kg. person back; transport one 100 kg. person; transport one 50 kg. person back; transport two 50 kg. people. That totals to 5 rides. Depending on which person to choose at step 2, we can get two distinct ways.\n","sample_inputs":["1 50\n50\n","3 100\n50 50 100\n","2 50\n50 50\n"],"sample_outputs":["1\n1\n","5\n2\n","-1\n0\n"],"human_solution":"import std.algorithm;\r\nimport std.container;\r\nimport std.exception;\r\nimport std.math;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nimmutable int MAX_N = 54;\r\nimmutable int MOD = 1_000_000_007;\r\n\r\nlong [MAX_N] [MAX_N] c;\r\n\r\nvoid main ()\r\n{\r\n foreach (i; 0..MAX_N)\r\n {\r\n c[i][0] = 1;\r\n foreach (j; 1..i + 1)\r\n {\r\n c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;\r\n }\r\n }\r\n\r\n int n, k;\r\n while (readf (\" %s %s\", &n, &k) > 0)\r\n {\r\n auto a = new int [n];\r\n k \/= 50;\r\n int x = 0;\r\n int y = 0;\r\n foreach (i; 0..n)\r\n {\r\n readf (\" %s\", &a[i]);\r\n a[i] \/= 50;\r\n if (a[i] == 1)\r\n {\r\n x++;\r\n }\r\n else if (a[i] == 2)\r\n {\r\n y++;\r\n }\r\n else\r\n {\r\n enforce (false);\r\n }\r\n }\r\n\r\n alias Tuple !(int, \"b\", int, \"x\", int, \"y\") state;\r\n alias Tuple !(int, \"dist\", int, \"num\") value;\r\n state [] q;\r\n q.reserve (2 * (x + 1) * (y + 1));\r\n auto f = new value [] [] [] (2, x + 1, y + 1);\r\n foreach (b; 0..2)\r\n {\r\n foreach (cx; 0..x + 1)\r\n {\r\n f[b][cx][] = value (int.max, 0);\r\n }\r\n }\r\n\r\n f[0][0][0] = value (0, 1);\r\n q ~= state (0, 0, 0);\r\n while (q.length > 0)\r\n {\r\n state cur = q[0];\r\n q = q[1..$];\r\n int cb = cur.b;\r\n int cx = cur.x;\r\n int cy = cur.y;\r\n int cd = f[cb][cx][cy].dist + 1;\r\n int cn = f[cb][cx][cy].num;\r\n debug {writefln (\"%s %s %s\", cb, cx, cy);}\r\n int nb = 1 - cb;\r\n foreach (dx; 0..x + 1)\r\n {\r\n foreach (dy; 0..y + 1)\r\n {\r\n if (!dx && !dy)\r\n {\r\n continue;\r\n }\r\n if (dx + dy * 2 > k)\r\n {\r\n break;\r\n }\r\n int nx, ny;\r\n long mult;\r\n if (cb) \/\/ back\r\n {\r\n nx = cx - dx;\r\n ny = cy - dy;\r\n mult = (c[cx][dx] *\r\n c[cy][dy]) % MOD;\r\n if (nx < 0 || ny < 0)\r\n {\r\n continue;\r\n }\r\n }\r\n else \/\/ forward\r\n {\r\n nx = cx + dx;\r\n ny = cy + dy;\r\n mult = (c[x - cx][dx] *\r\n c[y - cy][dy]) % MOD;\r\n if (nx > x || ny > y)\r\n {\r\n continue;\r\n }\r\n }\r\n if (f[nb][nx][ny].dist == int.max)\r\n {\r\n f[nb][nx][ny].dist = cd;\r\n q ~= state (nb, nx, ny);\r\n }\r\n if (f[nb][nx][ny].dist != cd)\r\n {\r\n continue;\r\n }\r\n f[nb][nx][ny].num =\r\n (f[nb][nx][ny].num +\r\n mult * cn) % MOD;\r\n }\r\n }\r\n }\r\n\r\n writefln (\"%s\", f[1][x][y].dist == int.max ?\r\n -1 : f[1][x][y].dist);\r\n writefln (\"%s\", f[1][x][y].num);\r\n }\r\n}\r\n","testcases":"[{'input': ['1 50\\r\\n50\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['3 100\\r\\n50 50 100\\r\\n'], 'output': ['5\\r\\n2\\r\\n']}, {'input': ['2 50\\r\\n50 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['5 258\\r\\n100 100 50 50 50\\r\\n'], 'output': ['3\\r\\n72\\r\\n']}, {'input': ['8 191\\r\\n50 100 50 100 50 100 100 50\\r\\n'], 'output': ['11\\r\\n19318272\\r\\n']}, {'input': ['3 121\\r\\n100 100 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['8 271\\r\\n100 50 100 50 50 50 100 50\\r\\n'], 'output': ['5\\r\\n78090\\r\\n']}, {'input': ['2 233\\r\\n50 100\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['2 153\\r\\n100 50\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['5 257\\r\\n50 50 50 50 50\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['49 290\\r\\n100 100 100 100 100 100 100 100 50 100 50 100 100 100 50 50 100 50 50 100 100 100 100 100 100 50 100 100 50 100 50 50 100 100 100 50 50 50 50 50 100 100 100 50 100 50 100 50 50\\r\\n'], 'output': ['39\\r\\n99624366\\r\\n']}, {'input': ['29 129\\r\\n50 50 50 100 100 100 50 100 50 50 50 100 50 100 100 100 50 100 100 100 50 50 50 50 50 50 50 50 50\\r\\n'], 'output': ['77\\r\\n37050209\\r\\n']}, {'input': ['32 121\\r\\n100 100 100 100 100 50 100 100 50 100 50 100 50 100 50 100 50 50 50 100 100 50 100 100 100 100 50 100 50 100 100 50\\r\\n'], 'output': ['101\\r\\n245361086\\r\\n']}, {'input': ['3 118\\r\\n100 100 100\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['10 4894\\r\\n100 50 50 50 100 50 50 100 50 100\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['36 250\\r\\n50 100 100 50 100 100 100 50 50 100 50 50 50 50 50 50 100 50 100 100 100 100 100 100 100 50 50 100 50 50 100 100 100 100 100 50\\r\\n'], 'output': ['27\\r\\n77447096\\r\\n']}, {'input': ['31 291\\r\\n50 100 100 50 100 100 100 50 100 100 100 100 50 50 50 100 100 100 50 100 100 50 50 50 50 100 100 50 50 100 100\\r\\n'], 'output': ['23\\r\\n393964729\\r\\n']}, {'input': ['31 161\\r\\n100 50 50 50 50 100 50 100 50 100 100 50 50 100 100 50 100 50 50 100 50 100 100 50 50 100 50 50 100 50 100\\r\\n'], 'output': ['43\\r\\n670669365\\r\\n']}, {'input': ['5 123\\r\\n50 100 50 50 50\\r\\n'], 'output': ['9\\r\\n4536\\r\\n']}, {'input': ['43 293\\r\\n50 50 100 100 50 100 100 50 100 100 50 100 50 100 50 50 50 50 50 100 100 100 50 50 100 50 100 100 100 50 100 100 100 50 50 50 100 50 100 100 50 100 50\\r\\n'], 'output': ['31\\r\\n658920847\\r\\n']}, {'input': ['23 100\\r\\n50 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': ['43\\r\\n689584957\\r\\n']}, {'input': ['41 218\\r\\n50 50 100 50 100 100 50 100 100 50 50 100 50 50 50 50 100 50 100 50 50 50 100 50 50 50 50 100 100 100 100 100 100 50 100 50 100 100 100 50 50\\r\\n'], 'output': ['39\\r\\n298372053\\r\\n']}, {'input': ['11 4668\\r\\n50 100 100 100 50 100 50 50 100 100 100\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['43 178\\r\\n50 50 100 100 100 50 100 100 50 100 100 100 50 100 50 100 50 50 100 100 50 100 100 50 50 50 100 50 50 50 100 50 100 100 100 50 100 50 50 50 50 100 100\\r\\n'], 'output': ['63\\r\\n503334985\\r\\n']}, {'input': ['33 226\\r\\n50 50 50 50 50 100 100 100 100 50 100 50 100 50 100 50 100 100 50 50 50 100 100 50 50 100 50 100 50 100 50 50 50\\r\\n'], 'output': ['31\\r\\n370884215\\r\\n']}, {'input': ['1 2994\\r\\n100\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['1 204\\r\\n50\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['33 123\\r\\n50 100 100 100 50 100 50 50 50 50 50 100 100 50 100 50 100 50 50 50 50 50 50 50 100 100 50 50 100 100 100 100 100\\r\\n'], 'output': ['93\\r\\n337243149\\r\\n']}, {'input': ['34 2964\\r\\n50 50 50 50 50 100 50 100 50 100 100 50 50 50 50 50 50 100 100 100 50 50 100 100 50 50 50 100 50 100 100 50 100 50\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['27 200\\r\\n50 50 50 50 100 100 50 50 100 100 100 50 100 50 100 50 50 100 100 100 50 100 100 50 50 50 100\\r\\n'], 'output': ['25\\r\\n271877303\\r\\n']}, {'input': ['31 197\\r\\n50 100 50 50 100 50 100 100 100 50 50 100 50 100 50 50 50 50 100 100 50 50 100 50 50 50 50 50 100 50 100\\r\\n'], 'output': ['41\\r\\n24368657\\r\\n']}, {'input': ['28 183\\r\\n50 100 100 50 100 50 100 100 50 100 50 100 100 100 50 50 100 50 50 50 100 50 100 50 50 100 100 100\\r\\n'], 'output': ['41\\r\\n844409785\\r\\n']}, {'input': ['48 204\\r\\n100 100 100 50 50 50 50 100 100 50 100 100 50 100 50 50 50 100 100 100 50 100 50 50 50 100 50 100 50 100 100 100 50 50 100 100 100 50 100 50 50 50 50 50 100 50 50 50\\r\\n'], 'output': ['45\\r\\n538567333\\r\\n']}, {'input': ['5 188\\r\\n50 50 50 50 50\\r\\n'], 'output': ['3\\r\\n30\\r\\n']}, {'input': ['29 108\\r\\n100 50 100 100 100 100 100 50 50 100 100 100 50 100 50 50 100 50 100 50 50 100 100 50 50 50 100 100 50\\r\\n'], 'output': ['87\\r\\n417423429\\r\\n']}, {'input': ['50 125\\r\\n50 50 50 100 100 50 100 100 50 50 100 100 100 100 100 100 50 50 100 50 100 100 50 50 50 100 100 50 100 100 100 100 100 100 100 50 50 50 100 50 50 50 50 100 100 100 100 100 50 50\\r\\n'], 'output': ['153\\r\\n971933773\\r\\n']}, {'input': ['50 2263\\r\\n50 100 50 100 50 100 100 100 50 50 50 100 100 100 100 100 100 50 50 100 50 100 50 50 100 50 50 100 100 50 100 100 100 50 50 50 100 50 100 50 50 50 50 50 100 100 50 50 100 50\\r\\n'], 'output': ['3\\r\\n211048352\\r\\n']}, {'input': ['50 110\\r\\n50 100 100 50 50 50 50 50 50 50 100 100 50 100 50 50 50 50 100 50 100 100 100 100 50 100 100 100 100 50 50 50 50 50 100 100 50 100 50 100 100 50 50 100 50 100 50 50 100 100\\r\\n'], 'output': ['143\\r\\n105841088\\r\\n']}, {'input': ['50 185\\r\\n100 50 50 50 50 50 100 50 100 50 100 100 50 50 100 100 100 50 50 100 50 100 50 50 100 100 100 100 100 50 50 100 100 100 50 100 50 100 50 50 100 50 100 50 50 100 50 50 100 100\\r\\n'], 'output': ['73\\r\\n930170107\\r\\n']}, {'input': ['50 207\\r\\n50 100 100 100 100 50 100 100 100 50 100 100 100 50 100 100 50 100 50 100 50 100 100 100 50 100 50 50 100 50 100 100 50 100 100 100 100 50 100 100 100 100 50 50 50 100 100 50 100 100\\r\\n'], 'output': ['55\\r\\n833060250\\r\\n']}, {'input': ['3 49\\r\\n50 50 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['3 50\\r\\n50 50 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['3 99\\r\\n100 50 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}, {'input': ['4 100\\r\\n100 100 100 50\\r\\n'], 'output': ['-1\\r\\n0\\r\\n']}]","id":616} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"301_A","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.container;\r\nimport std.exception;\r\nimport std.functional;\r\nimport std.math;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\twhile (readf (\" %s\", &n) > 0)\r\n\t{\r\n\t\tint m = n * 2 - 1;\r\n\t\tauto a = new int [m];\r\n\t\tint s = 0;\r\n\t\tforeach (i; 0..m)\r\n\t\t{\r\n\t\t\treadf (\" %s\", &a[i]);\r\n\t\t\ts += (a[i] <= 0);\r\n\t\t\ta[i] = abs (a[i]);\r\n\t\t}\r\n\t\tint res = reduce !(\"a + b\") (a);\r\n\t\tif ((n % 2 == 0) && (s % 2 != 0))\r\n\t\t{\r\n\t\t\tres -= 2 * a[0];\r\n\t\t}\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","description":"Yaroslav has an array, consisting of (2\u00b7n-1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements, and multiply each of them by -1.Yaroslav is now wondering: what maximum sum of array elements can be obtained if it is allowed to perform any number of described operations?Help Yaroslav.","input_specification":"The first line contains an integer n (2\u2264n\u2264100). The second line contains (2\u00b7n-1) integers \u2014 the array elements. The array elements do not exceed 1000 in their absolute value.\n","output_specification":"In a single line print the answer to the problem \u2014 the maximum sum that Yaroslav can get.\n","notes":"In the first sample you do not need to change anything. The sum of elements equals 150.\nIn the second sample you need to change the sign of the first two elements. Then we get the sum of the elements equal to 100.\n","sample_inputs":["2\n50 50 50\n","2\n-1 -100 -1\n"],"sample_outputs":["150\n","100\n"],"human_solution":"import std.algorithm;\r\nimport std.container;\r\nimport std.exception;\r\nimport std.functional;\r\nimport std.math;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\twhile (readf (\" %s\", &n) > 0)\r\n\t{\r\n\t\tint m = n * 2 - 1;\r\n\t\tauto a = new int [m];\r\n\t\tint s = 0;\r\n\t\tforeach (i; 0..m)\r\n\t\t{\r\n\t\t\treadf (\" %s\", &a[i]);\r\n\t\t\ts += (a[i] <= 0);\r\n\t\t\ta[i] = abs (a[i]);\r\n\t\t}\r\n\t\tsort (a);\r\n\t\tint res = reduce !(\"a + b\") (a);\r\n\t\tif ((n % 2 == 0) && (s % 2 != 0))\r\n\t\t{\r\n\t\t\tres -= 2 * a[0];\r\n\t\t}\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['2\\r\\n50 50 50\\r\\n'], 'output': ['150\\r\\n']}, {'input': ['2\\r\\n-1 -100 -1\\r\\n'], 'output': ['100\\r\\n']}, {'input': ['3\\r\\n-959 -542 -669 -513 160\\r\\n'], 'output': ['2843\\r\\n']}, {'input': ['4\\r\\n717 473 344 -51 -548 703 -869\\r\\n'], 'output': ['3603\\r\\n']}, {'input': ['5\\r\\n270 -181 957 -509 -6 937 -175 434 -625\\r\\n'], 'output': ['4094\\r\\n']}, {'input': ['6\\r\\n-403 901 -847 -708 -624 413 -293 709 886 445 716\\r\\n'], 'output': ['6359\\r\\n']}, {'input': ['7\\r\\n-236 533 869 903 655 -714 27 890 -311 800 307 -682 665\\r\\n'], 'output': ['7592\\r\\n']}, {'input': ['8\\r\\n-338 134 708 -761 -135 535 631 -354 -259 -973 -147 -281 737 516 -222\\r\\n'], 'output': ['6463\\r\\n']}, {'input': ['9\\r\\n-690 34 -821 842 -712 -909 36 -62 255 -363 433 794 883 -274 -642 343 -1\\r\\n'], 'output': ['8094\\r\\n']}, {'input': ['10\\r\\n86 -619 547 620 -383 -928 945 -253 835 -36 373 925 -705 -64 -577 -386 318 535 528\\r\\n'], 'output': ['9591\\r\\n']}, {'input': ['19\\r\\n-919 -82 -467 -169 100 -363 644 -307 926 971 -695 658 -625 19 -269 -89 63 -733 827 -236 566 95 -496 975 284 157 -373 -656 -245 644 567 -971 -954 337 150 -67 714\\r\\n'], 'output': ['17413\\r\\n']}, {'input': ['22\\r\\n697 556 -538 879 -623 73 -293 -401 -491 -7 -144 853 -319 395 785 248 -585 0 -420 -830 -720 75 411 -397 746 828 -83 -833 -847 709 181 967 314 -633 -322 415 -450 433 -459 438 508 -870 -949\\r\\n'], 'output': ['21725\\r\\n']}, {'input': ['19\\r\\n752 -869 -583 -729 984 -321 -477 -462 429 857 -57 -807 184 296 -594 -728 -903 -524 -726 -551 722 -895 696 301 -339 784 -743 -689 -657 170 -957 -88 -197 832 -65 -689 743\\r\\n'], 'output': ['21400\\r\\n']}, {'input': ['22\\r\\n549 635 969 -519 -858 185 -788 126 -840 533 -560 168 -539 -962 649 -721 -574 245 -986 -859 496 -257 -361 180 -691 -528 -992 -833 -989 -222 901 950 388 -803 624 -536 -588 310 812 320 862 -640 -851\\r\\n'], 'output': ['26399\\r\\n']}, {'input': ['19\\r\\n-550 109 141 -201 -922 45 926 6 -245 -846 -695 572 -788 -963 -253 161 107 879 78 551 486 563 -533 -376 615 627 913 411 -494 -101 -45 -877 -416 736 255 -810 -491\\r\\n'], 'output': ['17787\\r\\n']}, {'input': ['27\\r\\n-401 -840 -583 -612 -298 -384 798 366 -922 -443 -972 -271 127 -201 992 -748 -351 925 -177 -528 355 5 131 -779 833 -382 -990 -379 -816 681 650 660 624 -112 -652 406 446 -999 259 -778 452 -705 -374 -710 -751 -852 119 -689 -789 96 -984 186 70\\r\\n'], 'output': ['28653\\r\\n']}, {'input': ['19\\r\\n-150 -962 -857 346 257 898 675 629 -104 -105 560 -525 -64 282 647 -341 -781 400 -80 830 360 877 -751 -1 -392 960 989 935 777 -509 -614 -331 301 -305 587 -284 936\\r\\n'], 'output': ['19402\\r\\n']}, {'input': ['5\\r\\n0 0 0 0 0 -1 -1 -1 -1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4\\r\\n0 0 0 0 0 -1 -1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n0 0 0 0 0 -1 -1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4\\r\\n0 0 0 0 0 -1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n-1 -1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n-1 1 1 1 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5\\r\\n-1 -1 -1 2 2 2 2 2 2\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['3\\r\\n-100 100 100 100 100\\r\\n'], 'output': ['500\\r\\n']}, {'input': ['5\\r\\n-1 -2 -3 -4 -5 -6 -7 8 9\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['5\\r\\n-1 -1 -1 -1 -1 -1 -1 -1 -1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3\\r\\n-1 -1 -1 -1 -1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4\\r\\n-1 -1 -1 0 1 1 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['7\\r\\n-5 -10 12 40 20 -33 23 12 -23 21 -32 14 24\\r\\n'], 'output': ['269\\r\\n']}, {'input': ['3\\r\\n-2 3 4 5 6\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['5\\r\\n-10 -100 -100 -10 -20 -5 -1 2 3\\r\\n'], 'output': ['251\\r\\n']}]","id":617} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"309_C","execute_outcome":"WRONG_ANSWER","source_code":"\/\/ Cheese-Cracker: cheese-cracker.github.io\nimport std.stdio, std.conv, std.functional, std.string, std.algorithm;\nimport std.container, std.range, std.typecons, std.bigint, std.numeric, std.math, std.random;\n\nalias ll = long;\nalias rbt = redBlackTree;\nalias tup = Tuple!(long, long);\nstatic string[] inp;\nT rd(T = long)(){ while(!inp.length) inp = readln.chomp.split; string res = inp[0]; inp.popFront; return res.to!T; }\nT[] rdarr(T = long)(T fix = 0){ auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }\n\/*******************************It's a Me, Mario!*******************************************\/\n\n\nll[] totake, bitclust;\n\nll fval(ll endm){\n ll[34] freq = 0;\n ll[] memory = bitclust.dup;\n foreach(i; 0..endm.to!int){ ++freq[totake[i].to!int]; }\n\n foreach_reverse(k; 0..33){\n foreach_reverse(i; 0..k+1){\n ll take = min(freq[i]< 1){\n ll midd = (hi + lo)\/2;\n (fval(midd) >= 1 ? lo : hi) = midd;\n }\n writeln(lo);\n}\n\nint main(){\n long t = 1;\n \/* t = rd; \/\/ Toggle! *\/\n while(t--) play(); \/\/ Let's play!\n stdout.flush;\n return 0;\n}\n\n","description":"You get to work and turn on the computer. You start coding and give little thought to the RAM role in the whole process. In this problem your task is to solve one of the problems you encounter in your computer routine.We'll consider the RAM as a sequence of cells that can contain data. Some cells already contain some data, some are empty. The empty cells form the so-called memory clusters. Thus, a memory cluster is a sequence of some consecutive empty memory cells. You have exactly n memory clusters, the i-th cluster consists of ai cells. You need to find memory for m arrays in your program. The j-th array takes 2^bj consecutive memory cells. There possibly isn't enough memory for all m arrays, so your task is to determine what maximum number of arrays can be located in the available memory clusters. Of course, the arrays cannot be divided between the memory clusters. Also, no cell can belong to two arrays.","input_specification":"The first line of the input contains two integers n and m (1\u2264n,m\u226410^6). The next line contains n integers a1,a2,...,an (1\u2264ai\u226410^9). The next line contains m integers b1,b2,...,bm (1\u22642^bi\u226410^9).\n","output_specification":"Print a single integer \u2014 the answer to the problem.\n","notes":"In the first example you are given memory clusters with sizes 8, 4, 3, 2, 2 and arrays with sizes 8, 4, 4. There are few ways to obtain an answer equals 2: you can locate array with size 8 to the cluster with size 8, and one of the arrays with size 4 to the cluster with size 4. Another way is to locate two arrays with size 4 to the one cluster with size 8.\nIn the second example you are given 10 memory clusters with size 1 and 6 arrays with size 1. You can choose any 6 clusters and locate all given arrays to them.\n","sample_inputs":["5 3\n8 4 3 2 2\n3 2 2\n","10 6\n1 1 1 1 1 1 1 1 1 1\n0 0 0 0 0 0\n"],"sample_outputs":["2\n","6\n"],"human_solution":"\/\/ Cheese-Cracker: cheese-cracker.github.io\nimport std.stdio, std.conv, std.functional, std.string, std.algorithm;\nimport std.container, std.range, std.typecons, std.bigint, std.numeric, std.math, std.random;\n\nalias ll = long;\nalias rbt = redBlackTree;\nalias tup = Tuple!(long, long);\nstatic string[] inp;\nT rd(T = long)(){ while(!inp.length) inp = readln.chomp.split; string res = inp[0]; inp.popFront; return res.to!T; }\nT[] rdarr(T = long)(T fix = 0){ auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }\n\/*******************************It's a Me, Mario!*******************************************\/\n\n\nll[] totake, bitclust;\n\nll fval(ll endm){\n ll[34] freq = 0;\n ll[] memory = bitclust.dup;\n foreach(i; 0..endm.to!int){ ++freq[totake[i].to!int]; }\n\n foreach_reverse(k; 0..33){\n foreach_reverse(i; 0..k+1){\n ll take = min(freq[i]< 1){\n ll midd = (hi + lo)\/2;\n (fval(midd) >= 1 ? lo : hi) = midd;\n }\n writeln(lo);\n}\n\nint main(){\n long t = 1;\n \/* t = rd; \/\/ Toggle! *\/\n while(t--) play(); \/\/ Let's play!\n stdout.flush;\n return 0;\n}\n\n","testcases":"[{'input': ['5 3\\r\\n8 4 3 2 2\\r\\n3 2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 6\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n0 0 0 0 0 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5 10\\r\\n4 4 3 3 3\\r\\n0 0 0 0 0 2 0 2 0 0\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n3 4 5 4 3\\r\\n1 2 1 0 1 2 1 0 2 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n4 3 3 4 3\\r\\n0 0 1 2 0 0 0 1 2 2\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['1 1\\r\\n536870912\\r\\n29\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 10\\r\\n4 3 3 3 4\\r\\n1 2 2 0 1 2 1 1 0 2\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['5 10\\r\\n5 4 4 5 4\\r\\n1 2 2 0 2 2 1 0 1 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n5 5 5 3 3\\r\\n1 2 0 2 0 1 2 0 2 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n3 3 3 4 3\\r\\n2 1 2 1 2 1 1 2 1 2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5 10\\r\\n4 3 4 4 4\\r\\n2 1 1 0 1 2 1 1 0 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n4 5 5 3 3\\r\\n2 1 1 0 1 1 2 0 2 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n4 3 4 4 3\\r\\n2 1 0 1 0 1 2 2 2 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n4 5 5 4 5\\r\\n2 1 0 2 0 2 0 2 2 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n5 3 4 3 3\\r\\n2 0 1 1 2 1 0 0 1 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n4 5 5 4 5\\r\\n0 1 2 2 1 1 0 2 2 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n5 4 5 5 4\\r\\n1 0 0 0 2 1 1 2 1 1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n5 5 5 4 4\\r\\n1 1 0 2 0 0 1 2 2 1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n5 4 5 3 3\\r\\n0 0 1 1 2 1 2 2 2 0\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n5 3 5 4 4\\r\\n1 1 2 1 1 0 2 2 1 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n4 5 5 3 3\\r\\n1 2 1 1 1 0 1 1 1 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n3 4 5 5 4\\r\\n1 1 1 1 0 2 2 0 0 0\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n4 5 3 4 4\\r\\n2 2 0 2 2 0 2 0 2 0\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n4 3 4 5 5\\r\\n2 0 0 1 2 0 0 2 0 0\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n5 4 5 4 5\\r\\n2 2 1 2 1 2 0 2 1 0\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5 10\\r\\n4 4 4 5 5\\r\\n0 2 2 0 0 1 0 2 2 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n5 3 5 5 5\\r\\n2 2 2 2 0 0 0 1 0 0\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5 10\\r\\n5 4 3 3 4\\r\\n2 2 0 1 0 0 1 0 2 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n5 4 5 5 3\\r\\n2 2 1 1 2 0 1 0 2 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5 10\\r\\n5 3 3 3 3\\r\\n0 2 2 0 2 2 2 2 1 0\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5 10\\r\\n4 3 5 4 4\\r\\n0 2 0 1 0 2 1 1 2 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 2\\r\\n128\\r\\n5 6\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2\\r\\n2\\r\\n0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 4\\r\\n4\\r\\n0 0 0 0\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 2\\r\\n9\\r\\n3 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 4\\r\\n1 2 3\\r\\n0 0 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 3\\r\\n8\\r\\n3 2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 3\\r\\n4 5\\r\\n0 2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1 3\\r\\n8\\r\\n3 0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2\\r\\n4\\r\\n0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 8\\r\\n8\\r\\n0 0 0 0 0 0 0 0\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 3\\r\\n2\\r\\n0 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 12\\r\\n8 8\\r\\n0 0 0 0 0 0 0 0 1 1 1 1\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['8 8\\r\\n1 1 1 1 1 1 8 8\\r\\n1 1 1 2 2 2 3 3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1 6\\r\\n8\\r\\n0 0 0 0 0 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1 3\\r\\n2\\r\\n1 0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 3\\r\\n4\\r\\n0 0 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 10\\r\\n4 4\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['8\\r\\n']}]","id":618} {"difficulty":1900,"lang":"D","lang_cluster":"D","src_uid":"342_C","execute_outcome":"WRONG_ANSWER","source_code":"module main;\r\n\r\nimport std.stdio;\r\nimport std.math;\r\n\r\nint main(string[] args)\r\n{\r\n int h,r,d,countH,ans;\r\n readf(\" %d %d\", &h, &r);\r\n countH = h \/ r;\r\n d = h % r;\r\n ans = countH * 2;\r\n if(countH * r + (sqrt(3f)\/2)*r < h + r)\r\n ++ans;\r\n writeln(ans);\r\n return 0;\r\n}\r\n","description":"A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h+r from the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right). Xenia got lots of balloons for her birthday. The girl hates the mess, so she wants to store the balloons in the cupboard. Luckily, each balloon is a sphere with radius . Help Xenia calculate the maximum number of balloons she can put in her cupboard. You can say that a balloon is in the cupboard if you can't see any part of the balloon on the left or right view. The balloons in the cupboard can touch each other. It is not allowed to squeeze the balloons or deform them in any way. You can assume that the cupboard's walls are negligibly thin.","input_specification":"The single line contains two integers r,h (1\u2264r,h\u226410^7).\n","output_specification":"Print a single integer \u2014 the maximum number of balloons Xenia can put in the cupboard.\n","notes":null,"sample_inputs":["1 1\n","1 2\n","2 1\n"],"sample_outputs":["3\n","5\n","2\n"],"human_solution":"module main;\r\n\r\nimport std.stdio;\r\nimport std.math;\r\n\r\nint main(string[] args)\r\n{\r\n int h,r,d,countH;\r\n int ans;\r\n readf(\" %s %s\", &r, &h);\r\n countH = (2*h + r) \/ (2*r);\r\n ans = countH * 2;\r\n if(countH * r + (sqrt(3f)\/2)*r < h + r)\r\n ++ans;\r\n writeln(ans);\r\n return 0;\r\n}\r\n","testcases":"[{'input': ['1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1 2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 6\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5 11\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['674098 1358794\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['3983458 7761504\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4841874 9131511\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['667586 5534221\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1526002 6904227\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['4835362 5823289\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5693778 7001807\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['6552194 8371814\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2377906 4774524\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4365659 4738707\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['98 1358794\\r\\n'], 'output': ['27731\\r\\n']}, {'input': ['458 7761504\\r\\n'], 'output': ['33894\\r\\n']}, {'input': ['874 9131511\\r\\n'], 'output': ['20897\\r\\n']}, {'input': ['586 5534221\\r\\n'], 'output': ['18889\\r\\n']}, {'input': ['2 6904227\\r\\n'], 'output': ['6904228\\r\\n']}, {'input': ['1 10000000\\r\\n'], 'output': ['20000001\\r\\n']}, {'input': ['2 10000000\\r\\n'], 'output': ['10000001\\r\\n']}, {'input': ['3 10000000\\r\\n'], 'output': ['6666667\\r\\n']}, {'input': ['4 10000000\\r\\n'], 'output': ['5000001\\r\\n']}, {'input': ['3 9999999\\r\\n'], 'output': ['6666667\\r\\n']}, {'input': ['10000000 866254\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10000000 8660255\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['100 50\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100 49\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 199\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['8 7\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10000 9999\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1000000 1999999\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2000000 1999999\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['18 16\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['100 87\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 19\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10000 38661\\r\\n'], 'output': ['9\\r\\n']}]","id":619} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"363_D","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio, std.string, std.algorithm;\r\nimport std.conv, std.array;\r\nimport std.container;\r\nimport std.typecons;\r\n\r\nvoid check(T...)(T args) {\r\n args.map!(to!string).array.join(\" \").writeln;\r\n}\r\n\r\nint f(ref int[] b, ref int[] p, int a, int m) {\r\n for (int i = 0; i < m; i++) {\r\n a -= [p[i] - b[m - 1 - i], 0].reduce!max;\r\n if (a < 0) {\r\n return -1;\r\n }\r\n }\r\n return a;\r\n}\r\n\r\nvoid main() {\r\n int n, m, a; readf(\"%d %d %d\\n\", &n, &m, &a);\r\n int[] b = new int[n];\r\n int[] p = new int[m];\r\n foreach (i; 0 .. n) {\r\n scanf(\"%d\", &b[i]);\r\n }\r\n foreach (i; 0 .. m) {\r\n scanf(\"%d\", &p[i]);\r\n }\r\n b.sort!(\"a > b\");\r\n p.sort;\r\n int x = 0;\r\n int l, r;\r\n int s = 0;\r\n for (l = 0, r = [n, m].reduce!min + 1; l + 1 < r; ) {\r\n x = (l + r) \/ 2;\r\n s = f(b, p, a, x);\r\n if (s >= 0) {\r\n l = x;\r\n } else {\r\n r = x;\r\n }\r\n }\r\n [l, [0, p[0 .. l].reduce!\"a + b\" - a].reduce!max].check;\r\n}\r\n","description":"A group of n schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them.The renting site offered them m bikes. The renting price is different for different bikes, renting the j-th bike costs pj rubles.In total, the boys' shared budget is a rubles. Besides, each of them has his own personal money, the i-th boy has bi personal rubles. The shared budget can be spent on any schoolchildren arbitrarily, but each boy's personal money can be spent on renting only this boy's bike.Each boy can rent at most one bike, one cannot give his bike to somebody else.What maximum number of schoolboys will be able to ride bikes? What minimum sum of personal money will they have to spend in total to let as many schoolchildren ride bikes as possible?","input_specification":"The first line of the input contains three integers n, m and a (1\u2264n,m\u226410^5; 0\u2264a\u226410^9). The second line contains the sequence of integers b1,b2,...,bn (1\u2264bi\u226410^4), where bi is the amount of the i-th boy's personal money. The third line contains the sequence of integers p1,p2,...,pm (1\u2264pj\u226410^9), where pj is the price for renting the j-th bike.\n","output_specification":"Print two integers r and s, where r is the maximum number of schoolboys that can rent a bike and s is the minimum total personal money needed to rent r bikes. If the schoolchildren cannot rent any bikes, then r=s=0.\n","notes":"In the first sample both schoolchildren can rent a bike. For instance, they can split the shared budget in half (5 rubles each). In this case one of them will have to pay 1 ruble from the personal money and the other one will have to pay 2 rubles from the personal money. In total, they spend 3 rubles of their personal money. This way of distribution of money minimizes the amount of spent personal money.\n","sample_inputs":["2 2 10\n5 5\n7 6\n","4 5 2\n8 1 1 2\n6 3 7 5 2\n"],"sample_outputs":["2 3\n","3 8\n"],"human_solution":"import std.stdio, std.string, std.algorithm;\r\nimport std.conv, std.array;\r\nimport std.container;\r\nimport std.typecons;\r\n\r\nvoid check(T...)(T args) {\r\n args.map!(to!string).array.join(\" \").writeln;\r\n}\r\n\r\nint f(ref int[] b, ref int[] p, int a, int m) {\r\n for (int i = 0; i < m; i++) {\r\n a -= [p[i] - b[m - 1 - i], 0].reduce!max;\r\n if (a < 0) {\r\n return -1;\r\n }\r\n }\r\n return a;\r\n}\r\n\r\nvoid main() {\r\n int n, m, a; readf(\"%d %d %d\\n\", &n, &m, &a);\r\n int[] b = new int[n];\r\n int[] p = new int[m];\r\n foreach (i; 0 .. n) {\r\n scanf(\"%d\", &b[i]);\r\n }\r\n foreach (i; 0 .. m) {\r\n scanf(\"%d\", &p[i]);\r\n }\r\n b.sort!(\"a > b\");\r\n p.sort;\r\n int x = 0;\r\n int l, r;\r\n int s = 0;\r\n for (l = 0, r = [n, m].reduce!min + 1; l + 1 < r; ) {\r\n x = (l + r) \/ 2;\r\n s = f(b, p, a, x);\r\n if (s >= 0) {\r\n l = x;\r\n } else {\r\n r = x;\r\n }\r\n }\r\n if (l == 0) {\r\n writeln(\"0 0\");\r\n return;\r\n }\r\n [l, [0, p[0 .. l].reduce!\"a + b\" - a].reduce!max].check;\r\n}\r\n","testcases":"[{'input': ['2 2 10\\r\\n5 5\\r\\n7 6\\r\\n'], 'output': ['2 3\\r\\n']}, {'input': ['4 5 2\\r\\n8 1 1 2\\r\\n6 3 7 5 2\\r\\n'], 'output': ['3 8\\r\\n']}, {'input': ['1 1 2\\r\\n1\\r\\n2\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['4 1 1\\r\\n3 2 3 2\\r\\n3\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['1 4 1\\r\\n3\\r\\n2 4 5 5\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3 3 3\\r\\n1 1 2\\r\\n3 5 6\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['4 5 6\\r\\n5 1 7 2\\r\\n8 7 3 9 8\\r\\n'], 'output': ['3 12\\r\\n']}, {'input': ['4 8 10\\r\\n2 1 2 2\\r\\n10 12 10 8 7 9 10 9\\r\\n'], 'output': ['1 0\\r\\n']}, {'input': ['8 4 18\\r\\n9 4 2 2 7 5 1 1\\r\\n11 12 8 9\\r\\n'], 'output': ['4 22\\r\\n']}, {'input': ['6 6 2\\r\\n6 1 5 3 10 1\\r\\n11 4 7 8 11 7\\r\\n'], 'output': ['3 16\\r\\n']}, {'input': ['10 10 7\\r\\n6 7 15 1 3 1 14 6 7 4\\r\\n15 3 13 17 11 19 20 14 8 17\\r\\n'], 'output': ['5 42\\r\\n']}, {'input': ['14 14 22\\r\\n23 1 3 16 23 1 7 5 18 7 3 6 17 8\\r\\n22 14 22 18 12 11 7 24 20 27 10 22 16 7\\r\\n'], 'output': ['10 115\\r\\n']}, {'input': ['10 20 36\\r\\n12 4 7 18 4 4 2 7 4 10\\r\\n9 18 7 7 30 19 26 27 16 20 30 25 23 17 5 30 22 7 13 6\\r\\n'], 'output': ['10 69\\r\\n']}, {'input': ['20 10 31\\r\\n17 27 2 6 11 12 5 3 12 4 2 10 4 8 2 10 7 9 12 1\\r\\n24 11 18 10 30 16 20 18 24 24\\r\\n'], 'output': ['7 86\\r\\n']}, {'input': ['40 40 61\\r\\n28 59 8 27 45 67 33 32 61 3 42 2 3 37 8 8 10 61 1 5 65 28 34 27 8 35 45 49 31 49 13 23 23 53 20 48 14 74 16 6\\r\\n69 56 34 66 42 73 45 49 29 70 67 77 73 26 78 11 50 69 64 72 78 66 66 29 80 40 50 75 68 47 78 63 41 70 52 52 69 22 69 66\\r\\n'], 'output': ['22 939\\r\\n']}, {'input': ['10 10 0\\r\\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\\r\\n1001 1001 1001 1001 1001 1001 1001 1001 1001 1001\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['9 8 0\\r\\n1 2 3 4 5 6 7 8 9\\r\\n2 3 4 5 6 7 8 9\\r\\n'], 'output': ['8 44\\r\\n']}, {'input': ['9 8 0\\r\\n1 2 3 4 5 6 7 8 9\\r\\n1 2 3 4 5 6 7 8\\r\\n'], 'output': ['8 36\\r\\n']}]","id":620} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"37_B","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n, mx, reg;\r\n readf(\"%s %s %s\", &n, &mx, ®);\r\n readln;\r\n \r\n struct scroll { int id, pw, dmg; }\r\n \r\n scroll[] scs;\r\n foreach (i; 1 .. n+1) {\r\n int pw, dmg;\r\n readf(\"%s %s\", &pw, &dmg);\r\n readln;\r\n \r\n scs ~= scroll(i, pw, dmg);\r\n }\r\n \r\n auto used = new bool[] (n+1);\r\n Tuple!(int, int)[] ans;\r\n int cur = mx;\r\n int sec = 0;\r\n int sm = 0;\r\n for (; sec <= 2100; ++sec) {\r\n cur = min(cur - sm + reg, mx);\r\n if (cur <= 0) { break; }\r\n \r\n foreach (i, e; scs) {\r\n if (used[i]) { continue; }\r\n \r\n if (e.pw * mx >= cur * 100) {\r\n used[i] = true;\r\n sm += e.dmg;\r\n ans ~= tuple(sec, e.id);\r\n }\r\n }\r\n }\r\n \r\n if (sec > 2100) {\r\n writeln(\"NO\");\r\n return;\r\n }\r\n \r\n writeln(\"YES\");\r\n writeln(sec, ' ', ans.length);\r\n ans.each!(e => writeln(e[0], ' ', e[1]));\r\n}","description":"Vasya\u2019s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.While playing the game Petya found spell scrolls and now he is about to use them. Let\u2019s describe the way fighting goes on this level:1) The boss has two parameters: max \u2014 the initial amount of health and reg \u2014 regeneration rate per second.2) Every scroll also has two parameters: powi \u2014 spell power measured in percents \u2014 the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than powi percent of health the scroll cannot be used); and dmgi the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmgi of damage per second upon him until the end of the game.During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can\u2019t have more than max of health), then the player may use another scroll (no more than one per second).The boss is considered to be defeated if at the end of a second he has nonpositive (\u22640) amount of health.Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.","input_specification":"The first line contains three integers N, max and reg (1\u2264N,max,reg\u22641000) \u2013\u2013 the amount of scrolls and the parameters of the boss. The next N lines contain two integers powi and dmgi each \u2014 the parameters of the i-th scroll (0\u2264powi\u2264100, 1\u2264dmgi\u22642000). \n","output_specification":"In case Petya can\u2019t complete this level, output in the single line NO.\nOtherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds.\nOutput scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.\n","notes":null,"sample_inputs":["2 10 3\n100 3\n99 1\n","2 100 10\n100 11\n90 9\n"],"sample_outputs":["NO\n","YES\n19 2\n0 1\n10 2\n"],"human_solution":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.datetime.stopwatch;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n, mx, reg;\r\n readf(\"%s %s %s\", &n, &mx, ®);\r\n readln;\r\n \r\n struct scroll { int id, pw, dmg; }\r\n \r\n scroll[] scs;\r\n scs ~= scroll(0, 0, 0);\r\n foreach (i; 1 .. n+1) {\r\n int pw, dmg;\r\n readf(\"%s %s\", &pw, &dmg);\r\n readln;\r\n \r\n scs ~= scroll(i, pw, dmg);\r\n }\r\n \r\n auto used = new bool[] (n+1);\r\n Tuple!(int, int)[] ans;\r\n int cur = mx;\r\n int sec = 0;\r\n int sm = 0;\r\n for (; sec <= 2100; ++sec) {\r\n cur = min(cur - sm + reg, mx);\r\n if (cur <= 0) { break; }\r\n \r\n int best = 0;\r\n foreach (i, e; scs) {\r\n if (used[i]) { continue; }\r\n \r\n if (e.pw * mx >= cur * 100 && e.dmg > scs[best].dmg) {\r\n best = i.to!int;\r\n }\r\n }\r\n \r\n if (best != 0) {\r\n used[best] = true;\r\n ans ~= tuple(sec, best);\r\n sm += scs[best].dmg;\r\n }\r\n }\r\n \r\n if (sec > 2100) {\r\n writeln(\"NO\");\r\n return;\r\n }\r\n \r\n writeln(\"YES\");\r\n writeln(sec, ' ', ans.length);\r\n ans.each!(e => writeln(e[0], ' ', e[1]));\r\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":621} {"difficulty":2600,"lang":"D","lang_cluster":"D","src_uid":"382_E","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm;\r\nimport std.array;\r\nimport std.container;\r\nimport std.conv;\r\nimport std.exception;\r\nimport std.functional;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\nimport core.bitop;\r\n\r\nimmutable int MOD = 1_000_000_007;\r\nimmutable int HALF = (MOD >> 1) + 1;\r\nimmutable int MAX_N = 54;\r\n\r\nvoid main ()\r\n{\r\n\tauto c = new long [] [] (MAX_N, MAX_N);\r\n\r\n\tforeach (n; 0..MAX_N)\r\n\t{\r\n\t\tc[n][0] = 1;\r\n\t\tforeach (k; 1..n + 1)\r\n\t\t{\r\n\t\t\tc[n][k] = (c[n - 1][k - 1] + c[n - 1][k]) % MOD;\r\n\t\t}\r\n\t}\r\n\r\n\tauto f = new long [] [] [] (MAX_N, MAX_N, 2);\r\n\t\/\/ 0 is occupied, 1 is free\r\n\tf[1][0][1] = 1;\r\n\r\n\tforeach (n; 2..MAX_N)\r\n\t{\r\n\t\tforeach (k; 0..n + 1)\r\n\t\t{\r\n\t\t\tforeach (b; 0..2)\r\n\t\t\t{\r\n\t\t\t\t\/\/ one child\r\n\t\t\t\tint pk = k - (b == 0);\r\n\t\t\t\tif (pk >= 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tlong mult = n - 1;\r\n\t\t\t\t\tf[n][k][b] = (mult *\r\n\t\t\t\t\t f[n - 1][pk][!b]) % MOD;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t\/\/ two children\r\n\t\t\tfor (int x = 1; x < n - 1; x++)\r\n\t\t\t{\r\n\t\t\t\tint y = n - 1 - x;\r\n\t\t\t\tassert (x > 0 && y > 0);\r\n\t\t\t\tlong mult = c[n - 1][x];\r\n\t\t\t\tmult = (mult * x) % MOD;\r\n\t\t\t\tmult = (mult * y) % MOD;\r\n\r\n\t\t\t\tfor (int xk = 0; xk <= k; xk++)\r\n\t\t\t\t{\r\n\t\t\t\t\tint yk = void;\r\n\r\n\t\t\t\t\tdebug {if (n == 3 && k == 1)\r\n\t\t\t\t\t writeln (x, ' ', y, ' ',\r\n\t\t\t\t\t k, ' ', xk);}\r\n\t\t\t\t\t\/\/ occupied\r\n\t\t\t\t\tyk = k - xk - 1;\r\n\t\t\t\t\tif (yk >= 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[n][k][0] = (f[n][k][0] +\r\n\t\t\t\t\t\t (f[x][xk][1] *\r\n\t\t\t\t\t\t f[y][yk][0]) % MOD *\r\n\t\t\t\t\t\t mult) % MOD;\r\n\t\t\t\t\t\tif (x < y ||\r\n\t\t\t\t\t\t (x <= y && xk <= yk))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tlong mult2 = mult;\r\n\t\t\t\t\t\t\tif (x == y\r\n\t\t\t\t\t\t\t \/* && xk == yk *\/)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tmult2 =\r\n\t\t\t\t\t\t\t\t (mult2 *\r\n\t\t\t\t\t\t\t\t HALF) %\r\n\t\t\t\t\t\t\t\t MOD;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tf[n][k][0] =\r\n\t\t\t\t\t\t\t (f[n][k][0] +\r\n\t\t\t\t\t\t\t (f[x][xk][1] *\r\n\t\t\t\t\t\t\t f[y][yk][1]) %\r\n\t\t\t\t\t\t\t MOD *\r\n\t\t\t\t\t\t\t mult2) % MOD;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\/\/ free\r\n\t\t\t\t\tyk = k - xk;\r\n\t\t\t\t\tif (x < y || (x <= y && xk <= yk))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[n][k][1] = (f[n][k][1] +\r\n\t\t\t\t\t\t (f[x][xk][0] *\r\n\t\t\t\t\t\t f[y][yk][0]) % MOD *\r\n\t\t\t\t\t\t mult) % MOD;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdebug {writefln (\"f[%s][%s] = %s, %s\",\r\n\t\t\t n, k, f[n][k][0], f[n][k][1]);}\r\n\t\t}\r\n\t}\r\n\r\n\tint n, k;\r\n\twhile (readf (\" %s %s\", &n, &k) > 0)\r\n\t{\r\n\t\twriteln ((f[n][k][0] + f[n][k][1]) % MOD);\r\n\t}\r\n}\r\n","description":"Ksenia has her winter exams. Today she is learning combinatorics. Here's one of the problems she needs to learn to solve.How many distinct trees are there consisting of n vertices, each with the following properties: the tree is marked, that is, the vertices of the tree are numbered from 1 to n; each vertex of the tree is connected with at most three other vertices, and at the same moment the vertex with number 1 is connected with at most two other vertices; the size of the tree's maximum matching equals k. Two trees are considered distinct if there are such two vertices u and v, that in one tree they are connected by an edge and in the other tree they are not.Help Ksenia solve the problem for the given n and k. As the answer to the problem can be very huge you should output it modulo 1000000007\u00a0(10^9+7).","input_specification":"The first line contains two integers n,k (1\u2264n,k\u226450).\n","output_specification":"Print a single integer \u2014 the answer to the problem modulo 1000000007\u00a0(10^9+7).\n","notes":"If you aren't familiar with matchings, please, read the following link: http:\/\/en.wikipedia.org\/wiki\/Matching_(graph_theory).\n","sample_inputs":["1 1\n","2 1\n","3 1\n","4 2\n"],"sample_outputs":["0\n","1\n","3\n","12\n"],"human_solution":"import std.stdio;\r\n\r\nimmutable int MOD = 1_000_000_007;\r\nimmutable int HALF = (MOD \/ 2) + 1;\r\nimmutable int MAX_N = 54;\r\n\r\nstruct modint\r\n{\r\n\tlong value;\r\n\r\n\talias value this;\r\n\r\n\tthis (long nvalue)\r\n\t{\r\n\t\tvalue = nvalue;\r\n\t}\r\n\r\n\tmodint opBinary (string op) (long other)\r\n\t{\r\n\t\treturn mixin (\"modint ((value \" ~ op ~ \" other) % MOD)\");\r\n\t}\r\n\r\n\tmodint opOpAssign (string op, T) (T other)\r\n\t{\r\n\t\treturn mixin (\"this = this \" ~ op ~ \" other\");\r\n\t}\r\n}\r\n\r\nvoid main ()\r\n{\r\n\tauto c = new modint [] [] (MAX_N, MAX_N);\r\n\r\n\tforeach (n; 0..MAX_N)\r\n\t{\r\n\t\tc[n][0] = 1;\r\n\t\tforeach (k; 1..n + 1)\r\n\t\t{\r\n\t\t\tc[n][k] = c[n - 1][k - 1] + c[n - 1][k];\r\n\t\t}\r\n\t}\r\n\r\n\tauto f = new modint [] [] [] (MAX_N, MAX_N, 2);\r\n\tf[1][0][1] = 1;\r\n\r\n\tforeach (n; 2..MAX_N)\r\n\t{\r\n\t\tforeach (k; 0..n + 1)\r\n\t\t{\r\n\t\t\tforeach (b; 0..2)\r\n\t\t\t{\r\n\t\t\t\tint pk = k - (b == 0);\r\n\t\t\t\tif (pk >= 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tf[n][k][b] = f[n - 1][pk][!b] *\r\n\t\t\t\t\t (n - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tforeach (x; 1..n - 1)\r\n\t\t\t{\r\n\t\t\t\tint y = n - 1 - x;\r\n\t\t\t\tassert (x > 0 && y > 0);\r\n\t\t\t\tmodint mult = c[n - 1][x] * x * y;\r\n\r\n\t\t\t\tforeach (xk; 0..k + 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tint yk = void;\r\n\r\n\t\t\t\t\tyk = k - xk - 1;\r\n\t\t\t\t\tif (yk >= 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[n][k][0] += f[x][xk][1] *\r\n\t\t\t\t\t\t f[y][yk][0] * mult;\r\n\t\t\t\t\t\tif (x < y ||\r\n\t\t\t\t\t\t (x <= y && xk <= yk))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tmodint mult2 = mult;\r\n\t\t\t\t\t\t\tif (x == y && xk == yk)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tmult2 *= HALF;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tf[n][k][0] += mult2 *\r\n\t\t\t\t\t\t\t f[x][xk][1] *\r\n\t\t\t\t\t\t\t f[y][yk][1];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tyk = k - xk;\r\n\t\t\t\t\tif (x < y || (x <= y && xk <= yk))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmodint mult2 = mult;\r\n\t\t\t\t\t\tif (x == y && xk == yk)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tmult2 *= HALF;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tf[n][k][1] += f[x][xk][0] *\r\n\t\t\t\t\t\t f[y][yk][0] * mult2;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tint n, k;\r\n\twhile (readf (\" %s %s\", &n, &k) > 0)\r\n\t{\r\n\t\twriteln (f[n][k][0] + f[n][k][1]);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 2\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['4 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 2\\r\\n'], 'output': ['108\\r\\n']}, {'input': ['5 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9 4\\r\\n'], 'output': ['2489760\\r\\n']}, {'input': ['9 3\\r\\n'], 'output': ['267120\\r\\n']}, {'input': ['6 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 2\\r\\n'], 'output': ['360\\r\\n']}, {'input': ['6 3\\r\\n'], 'output': ['660\\r\\n']}, {'input': ['6 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 2\\r\\n'], 'output': ['450\\r\\n']}, {'input': ['7 3\\r\\n'], 'output': ['11520\\r\\n']}, {'input': ['8 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8 3\\r\\n'], 'output': ['80010\\r\\n']}, {'input': ['9 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['13 4\\r\\n'], 'output': ['868190400\\r\\n']}, {'input': ['13 5\\r\\n'], 'output': ['243912473\\r\\n']}, {'input': ['13 50\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 50\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['30 10\\r\\n'], 'output': ['179192925\\r\\n']}, {'input': ['33 7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 14\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 15\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 20\\r\\n'], 'output': ['832007687\\r\\n']}, {'input': ['50 21\\r\\n'], 'output': ['523163259\\r\\n']}, {'input': ['50 22\\r\\n'], 'output': ['909399897\\r\\n']}, {'input': ['50 23\\r\\n'], 'output': ['105124674\\r\\n']}, {'input': ['50 24\\r\\n'], 'output': ['179401278\\r\\n']}, {'input': ['50 25\\r\\n'], 'output': ['180774948\\r\\n']}, {'input': ['50 26\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 27\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 28\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 29\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 30\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 50\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 49\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['49 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['48 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['49 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['49 49\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['49 50\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['50 19\\r\\n'], 'output': ['749446861\\r\\n']}, {'input': ['49 19\\r\\n'], 'output': ['996358027\\r\\n']}, {'input': ['49 20\\r\\n'], 'output': ['935047750\\r\\n']}, {'input': ['49 21\\r\\n'], 'output': ['662085979\\r\\n']}, {'input': ['49 22\\r\\n'], 'output': ['518734784\\r\\n']}, {'input': ['49 22\\r\\n'], 'output': ['518734784\\r\\n']}, {'input': ['30 15\\r\\n'], 'output': ['493704864\\r\\n']}, {'input': ['30 16\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['30 14\\r\\n'], 'output': ['177812192\\r\\n']}, {'input': ['30 13\\r\\n'], 'output': ['867047118\\r\\n']}, {'input': ['30 12\\r\\n'], 'output': ['83105476\\r\\n']}, {'input': ['50 18\\r\\n'], 'output': ['602544321\\r\\n']}, {'input': ['50 17\\r\\n'], 'output': ['352520\\r\\n']}, {'input': ['50 16\\r\\n'], 'output': ['0\\r\\n']}]","id":622} {"difficulty":2700,"lang":"D","lang_cluster":"D","src_uid":"407_D","execute_outcome":"WRONG_ANSWER","source_code":"import std.range, std.stdio, std.algorithm, std.bigint, std.conv;\n\nimmutable MN = 410;\nimmutable MA = 160010;\n\nvoid main () {\n\tint n, m;\n\tint[MN][] d = new int[MN][](MN);\n\tint[MA][] minp = new int[MA][](MN);\n\tforeach (ref a; minp) {\n\t\ta[] = MN;\n\t}\n\treadf(\"%d %d\\n\", &n, &m);\n\tforeach (i; 0..n) {\n\t\tstring[] s = split(readln());\n\t\tforeach (j; 0..m) {\n\t\t\tauto k = to!int(s[j]);\n\t\t\tminp[j][k] = min(minp[j][k], i);\n\t\t\td[i][j] = k;\n\t\t}\n\t}\t\n\tlong ans = 0;\n\tint[MN][] u = new int[MN][](MN);\n\tint[MN] y;\n\tforeach (i; 0..n) {\n\t\ty[] = 0;\n\t\tforeach (r; 0..m) {\n\t\t\tint p = minp[r][d[i][r]];\n\t\t\tif (p < i) {\n\t\t\t\ty[r] = u[r][r] = p+1;\n\t\t\t}\n\t\t\tans = max(ans, (i-u[r][r]+1));\n\t\t\tforeach_reverse (l; 0..r) {\n\t\t\t\tint pl = minp[l][d[i][r]];\n\t\t\t\tif (pl <= i) {\n\t\t\t\t\ty[l] = max(y[l], pl+1);\n\t\t\t\t}\n\t\t\t\tint pr = minp[r][d[i][l]];\n\t\t\t\tif (pr <= i) {\n\t\t\t\t\tu[l][r] = pr+1;\n\t\t\t\t}\n\t\t\t\tu[l][r] = max(u[l][r], u[l][r-1], u[l+1][r], y[l]);\n\t\t\t\tans = max(ans, (i-u[l][r]+1)*(r-l+1));\n\t\t\t}\n\t\t}\n\t}\n\twriteln(ans);\n}","description":"You are given matrix a of size n\u00d7m, its elements are integers. We will assume that the rows of the matrix are numbered from top to bottom from 1 to n, the columns are numbered from left to right from 1 to m. We will denote the element on the intersecting of the i-th row and the j-th column as aij.We'll call submatrix i1,j1,i2,j2 (1\u2264i1\u2264i2\u2264n;\u00a01\u2264j1\u2264j2\u2264m) such elements aij of the given matrix that i1\u2264i\u2264i2 AND j1\u2264j\u2264j2. We'll call the area of the submatrix number (i2-i1+1)\u00b7(j2-j1+1). We'll call a submatrix inhomogeneous, if all its elements are distinct.Find the largest (in area) inhomogenous submatrix of the given matrix.","input_specification":"The first line contains two integers n, m (1\u2264n,m\u2264400)\u00a0\u2014 the number of rows and columns of the matrix, correspondingly.\nEach of the next n lines contains m integers aij (1\u2264aij\u2264160000)\u00a0\u2014 the elements of the matrix.\n","output_specification":"Print a single integer \u2014 the area of the optimal inhomogenous submatrix.\n","notes":null,"sample_inputs":["3 3\n1 3 1\n4 5 6\n2 6 1\n","3 4\n5 2 3 1\n3 3 5 3\n4 4 4 5\n","2 6\n1 2 3 4 5 6\n8 6 7 8 9 1\n"],"sample_outputs":["6\n","4\n","8\n"],"human_solution":"import std.range, std.stdio, std.algorithm, std.bigint, std.conv;\n\nimmutable MN = 410;\nimmutable MA = 160_010;\nvoid main () {\n\tint n, m;\n\tint[MN][] d = new int[MN][](MN);\n\tshort[MA][] minp = new short[MA][](MN);\n\treadf(\"%d %d\\n\", &n, &m);\n\tforeach (i; 0..n) {\n\t\tstring[] s = split(readln());\n\t\tforeach (j; 0..m) {\n\t\t\tauto k = to!int(s[j]);\n\t\t\td[i][j] = k;\n\t\t}\n\t}\n\tlong ans = 0;\n\tint[MN][] u = new int[MN][](MN);\n\tint[MN] y;\n\tforeach (i; 0..n) {\n\t\ty[] = 0;\n\t\tforeach (r; 0..m) {\n\t\t\tforeach_reverse (l; 0..r+1) {\n\t\t\t\ty[l] = max(y[l], minp[l][d[i][r]]);\n\t\t\t\tu[l][r] = max(u[l][r], minp[r][d[i][l]]);\n\t\t\t\tif (r > 0) {\n\t\t\t\t\tu[l][r] = max(u[l][r], u[l][r-1]);\n\t\t\t\t}\n\t\t\t\tu[l][r] = max(u[l][r], u[l+1][r], y[l]);\n\t\t\t\tans = max(ans, (i-u[l][r]+1)*(r-l+1));\n\t\t\t}\n\t\t\tminp[r][d[i][r]] = cast(short)(i+1);\n\t\t}\n\t}\n\twriteln(ans);\n}","testcases":"[{'input': ['3 3\\r\\n1 3 1\\r\\n4 5 6\\r\\n2 6 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3 4\\r\\n5 2 3 1\\r\\n3 3 5 3\\r\\n4 4 4 5\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2 6\\r\\n1 2 3 4 5 6\\r\\n8 6 7 8 9 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['3 4\\r\\n1 2 3 1\\r\\n2 3 1 2\\r\\n3 1 2 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 4\\r\\n1 2 3 4\\r\\n5 6 7 8\\r\\n9 10 11 12\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['10 10\\r\\n37 14 27 24 13 5 11 34 3 27\\r\\n1 18 23 9 30 18 28 30 16 12\\r\\n24 16 27 11 26 4 5 14 36 7\\r\\n21 25 3 1 1 2 32 11 1 26\\r\\n27 2 17 18 14 8 30 7 3 3\\r\\n8 1 24 11 34 36 10 7 15 7\\r\\n31 9 20 10 20 15 2 32 37 32\\r\\n36 19 4 23 5 32 12 20 21 27\\r\\n32 22 24 10 35 28 28 22 5 24\\r\\n22 33 6 14 27 13 3 33 32 16\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['2 20\\r\\n43 61 28 21 92 109 81 71 34 23 64 7 38 96 87 113 48 95 80 42\\r\\n43 4 39 85 31 59 119 81 55 91 80 37 5 28 9 15 31 29 51 57\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['5 5\\r\\n8 7 9 4 6\\r\\n8 10 7 5 8\\r\\n4 4 2 4 10\\r\\n10 10 5 8 10\\r\\n7 1 7 2 6\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['20 2\\r\\n43 59\\r\\n80 3\\r\\n59 77\\r\\n61 32\\r\\n13 37\\r\\n20 22\\r\\n76 35\\r\\n39 46\\r\\n46 72\\r\\n37 61\\r\\n58 78\\r\\n34 22\\r\\n58 26\\r\\n39 79\\r\\n39 21\\r\\n46 60\\r\\n47 62\\r\\n30 34\\r\\n70 39\\r\\n16 64\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['1 34\\r\\n30 22 1 10 8 5 3 9 22 34 5 2 26 21 13 30 9 29 10 13 34 32 17 32 17 17 11 23 26 23 22 15 6 17\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['37 1\\r\\n20\\r\\n40\\r\\n5\\r\\n14\\r\\n3\\r\\n11\\r\\n10\\r\\n2\\r\\n3\\r\\n31\\r\\n22\\r\\n3\\r\\n37\\r\\n16\\r\\n6\\r\\n3\\r\\n25\\r\\n37\\r\\n37\\r\\n9\\r\\n7\\r\\n14\\r\\n9\\r\\n35\\r\\n7\\r\\n23\\r\\n38\\r\\n20\\r\\n18\\r\\n31\\r\\n21\\r\\n35\\r\\n12\\r\\n14\\r\\n38\\r\\n4\\r\\n26\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['10 10\\r\\n52 99 7 91 34 76 13 9 83 46\\r\\n79 88 98 10 28 66 61 48 2 26\\r\\n1 17 20 70 51 14 24 81 96 77\\r\\n47 32 71 86 42 56 80 92 75 4\\r\\n95 74 33 41 94 49 3 72 31 100\\r\\n15 50 44 12 84 6 40 54 43 90\\r\\n68 5 23 78 63 82 59 64 57 16\\r\\n37 69 58 30 8 21 87 22 62 67\\r\\n25 29 85 55 73 93 45 38 18 35\\r\\n89 53 65 36 11 39 97 19 27 60\\r\\n'], 'output': ['100\\r\\n']}, {'input': ['10 10\\r\\n21 4523 95 50964 53 30 54 55999 26 16\\r\\n55999 55999 25 4523 28 82 50964 66 4523 1\\r\\n18 3 55999 81 50964 47 100 55999 98 50964\\r\\n2 50964 45 24 76 14 36 4523 44 23\\r\\n4523 4523 55999 62 55999 50964 77 46 78 79\\r\\n69 42 65 50964 64 57 89 12 4523 85\\r\\n38 50964 19 97 55999 50964 29 22 5 61\\r\\n52 4523 55999 72 94 55999 9 84 87 50964\\r\\n80 56 4523 55999 39 34 63 75 50964 91\\r\\n55999 32 4 55999 41 68 43 93 50964 4523\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['5 5\\r\\n1 2 3 4 5\\r\\n2 3 4 5 1\\r\\n3 4 5 1 2\\r\\n4 5 1 2 3\\r\\n5 1 2 3 4\\r\\n'], 'output': ['5\\r\\n']}]","id":623} {"difficulty":2500,"lang":"D","lang_cluster":"D","src_uid":"442_C","execute_outcome":"RUNTIME_ERROR","source_code":"import core.thread;\nimport std.conv, std.stdio, std.string;\nimport std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;\n\n\/\/\tInput\nclass EOFException : Throwable { this() { super(\"EOF\"); } }\nstring[] tokens;\nstring readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }\nint readInt() { return to!int(readToken); }\nlong readLong() { return to!long(readToken); }\nreal readReal() { return to!real(readToken); }\n\n\/\/\tchmin\/chmax\nvoid chmin(T)(ref T t, in T f) { if (t > f) t = f; }\nvoid chmax(T)(ref T t, in T f) { if (t < f) t = f; }\n\n\/\/\tPair\nstruct Pair(S, T) {\n\tS x; T y;\n\tint opCmp( const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }\n\tint opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }\n\tstring toString() const { return \"(\" ~ to!string(x) ~ \", \" ~ to!string(y) ~ \")\"; }\n}\nauto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }\n\n\/\/\tArray\nint binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }\nint lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a < val); }); }\nint upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }\nT[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }\n\n\nclass Node {\n\tNode l, r;\n\tlong val;\n\tthis(long val) {\n\t\tthis.val = val;\n\t}\n}\n\nint N;\nlong[] A;\n\nvoid main(string[] args) {\n\ttry {\n\tfor (; ; ) {\n\t\tN = readInt;\n\t\tA = new long[N];\n\t\tforeach (i; 0 .. N) {\n\t\t\tA[i] = readLong;\n\t\t}\n\t\t\n\t\tNode[] nodes = new Node[N];\n\t\tforeach (i; 0 .. N) {\n\t\t\tnodes[i] = new Node(A[i]);\n\t\t}\n\t\tforeach (i; 0 .. N) {\n\t\t\tif (0 <= i - 1) {\n\t\t\t\tnodes[i].l = nodes[i - 1];\n\t\t\t}\n\t\t\tif (i + 1 < N) {\n\t\t\t\tnodes[i].r = nodes[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tnodes.sort!\"a.val < b.val\";\n\t\tlong ans;\n\t\tforeach (node; nodes[0 .. $ - 2]) {\ndebug{\nNode[]ls;for(Node a=node.l;a;a=a.l)ls~=a;\nforeach_reverse(a;ls)write(a.val,\" \");\nfor(Node a=node;a;a=a.r)write(a.val,\" \");\nwriteln;\n}\n\t\t\tif (node.l is null && node.r is null) {\n\t\t\t\t\/\/\n\t\t\t} else if (node.l is null) {\n\t\t\t\tans += node.val;\n\t\t\t\tnode.r.l = null;\n\t\t\t} else if (node.r is null) {\n\t\t\t\tans += node.val;\n\t\t\t\tnode.l.r = null;\n\t\t\t} else {\n\t\t\t\tans += min(node.l.val, node.r.val);\n\t\t\t\tnode.l.r = node.r;\n\t\t\t\tnode.r.l = node.l;\n\t\t\t}\n\t\t}\n\t\twriteln(ans);\n\t}\n\t} catch (EOFException) {}\n}\n\n","description":"Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a,b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn't have an adjacent number to the left or right, Artem doesn't get any points. After the element is removed, the two parts of the array glue together resulting in the new array that Artem continues playing with. Borya wondered what maximum total number of points Artem can get as he plays this game.","input_specification":"The first line contains a single integer n (1\u2264n\u22645\u00b710^5) \u2014 the number of elements in the array. The next line contains n integers ai (1\u2264ai\u226410^6) \u2014 the values of the array elements.\n","output_specification":"In a single line print a single integer \u2014 the maximum number of points Artem can get.\n","notes":null,"sample_inputs":["5\n3 1 5 2 6\n","5\n1 2 3 4 5\n","5\n1 100 101 100 1\n"],"sample_outputs":["11\n","6\n","102\n"],"human_solution":"import core.thread;\nimport std.conv, std.stdio, std.string;\nimport std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;\n\n\/\/\tInput\nclass EOFException : Throwable { this() { super(\"EOF\"); } }\nstring[] tokens;\nstring readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }\nint readInt() { return to!int(readToken); }\nlong readLong() { return to!long(readToken); }\nreal readReal() { return to!real(readToken); }\n\n\/\/\tchmin\/chmax\nvoid chmin(T)(ref T t, in T f) { if (t > f) t = f; }\nvoid chmax(T)(ref T t, in T f) { if (t < f) t = f; }\n\n\/\/\tPair\nstruct Pair(S, T) {\n\tS x; T y;\n\tint opCmp( const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }\n\tint opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }\n\tstring toString() const { return \"(\" ~ to!string(x) ~ \", \" ~ to!string(y) ~ \")\"; }\n}\nauto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }\n\n\/\/\tArray\nint binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }\nint lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a < val); }); }\nint upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }\nT[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }\n\n\nclass Node {\n\tNode l, r;\n\tlong val;\n\tthis(long val) {\n\t\tthis.val = val;\n\t}\n}\n\nint N;\nlong[] A;\n\nvoid main(string[] args) {\n\ttry {\n\tfor (; ; ) {\n\t\tN = readInt;\n\t\tA = new long[N];\n\t\tforeach (i; 0 .. N) {\n\t\t\tA[i] = readLong;\n\t\t}\n\t\t\n\t\tif (N <= 2) {\n\t\t\twriteln(0);\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tNode[] nodes = new Node[N];\n\t\tforeach (i; 0 .. N) {\n\t\t\tnodes[i] = new Node(A[i]);\n\t\t}\n\t\tforeach (i; 0 .. N) {\n\t\t\tif (0 <= i - 1) {\n\t\t\t\tnodes[i].l = nodes[i - 1];\n\t\t\t}\n\t\t\tif (i + 1 < N) {\n\t\t\t\tnodes[i].r = nodes[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tnodes.sort!\"a.val < b.val\";\n\t\tlong ans;\n\t\tforeach (node; nodes[0 .. $ - 2]) {\ndebug{\nNode[]ls;for(Node a=node.l;a;a=a.l)ls~=a;\nforeach_reverse(a;ls)write(a.val,\" \");\nfor(Node a=node;a;a=a.r)write(a.val,\" \");\nwriteln;\n}\n\t\t\tif (node.l is null && node.r is null) {\n\t\t\t\t\/\/\n\t\t\t} else if (node.l is null) {\n\t\t\t\tans += node.val;\n\t\t\t\tnode.r.l = null;\n\t\t\t} else if (node.r is null) {\n\t\t\t\tans += node.val;\n\t\t\t\tnode.l.r = null;\n\t\t\t} else {\n\t\t\t\tans += min(node.l.val, node.r.val);\n\t\t\t\tnode.l.r = node.r;\n\t\t\t\tnode.r.l = node.l;\n\t\t\t}\n\t\t}\n\t\twriteln(ans);\n\t}\n\t} catch (EOFException) {}\n}\n\n","testcases":"[{'input': ['5\\r\\n3 1 5 2 6\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5\\r\\n1 100 101 100 1\\r\\n'], 'output': ['102\\r\\n']}, {'input': ['10\\r\\n96 66 8 18 30 48 34 11 37 42\\r\\n'], 'output': ['299\\r\\n']}, {'input': ['1\\r\\n87\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n93 51\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n31 19 5\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4\\r\\n86 21 58 60\\r\\n'], 'output': ['118\\r\\n']}, {'input': ['5\\r\\n21 6 54 69 32\\r\\n'], 'output': ['74\\r\\n']}, {'input': ['6\\r\\n46 30 38 9 65 23\\r\\n'], 'output': ['145\\r\\n']}, {'input': ['7\\r\\n82 60 92 4 2 13 15\\r\\n'], 'output': ['129\\r\\n']}, {'input': ['8\\r\\n77 84 26 34 17 56 76 3\\r\\n'], 'output': ['279\\r\\n']}, {'input': ['9\\r\\n72 49 39 50 68 35 75 94 56\\r\\n'], 'output': ['435\\r\\n']}, {'input': ['10\\r\\n4 2 2 4 1 2 2 4 2 1\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['1\\r\\n4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n3 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n2 3 1 2\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n2 6 2 1 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['6\\r\\n1 7 3 1 6 2\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['7\\r\\n2 1 2 2 2 2 2\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['8\\r\\n3 4 3 1 1 3 4 1\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['9\\r\\n4 5 2 2 3 1 3 3 5\\r\\n'], 'output': ['23\\r\\n']}]","id":624} {"difficulty":1800,"lang":"D","lang_cluster":"D","src_uid":"61_D","execute_outcome":"RUNTIME_ERROR","source_code":"\/\/ Cheese-Cracker: cheese-cracker.github.io\nimport std.stdio, std.conv, std.functional, std.string, std.algorithm;\nimport std.container, std.range, std.typecons, std.numeric, std.math, std.random;\n\nalias ll = long;\nalias rbt = redBlackTree;\nalias tup = Tuple!(long, long);\nstatic string[] inp;\nT rd(T = long)(){while(!inp.length) inp = readln.chomp.split; string a = inp[0]; inp.popFront; return a.to!T;}\nT[] rdarr(T = long)(T fix = 0){ auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }\n\/*******************************It's a Me, Mario!*******************************************\/\n\ntup[][long] adj;\nbool[long] vis;\n\nlong dfs(ll u){\n vis[u] = 1;\n ll maxw = 0;\n foreach(tup e; adj[u]){\n if(!vis.get(e[0], 0)){\n maxw = max(e[1] + dfs(e[0]), maxw);\n }\n }\n return maxw;\n}\n\n\nvoid play(){\n int n;\n n = rd!int;\n ll u, v, w;\n ll sumwt = 0;\n foreach(i; 0..n-1){\n u = rd; v = rd; w = rd;\n adj[u] ~= tup(v, w);\n adj[v] ~= tup(u, w);\n sumwt += w;\n }\n ll maxwtpath = dfs(1);\n ll leftw = sumwt - maxwtpath;\n debug writeln(\"D: \", sumwt, \" \", maxwtpath, \" \", leftw);\n writeln(maxwtpath + 2*leftw);\n}\n\nint main(){\n long t = 1;\n \/* t = rd; \/\/ Toggle! *\/\n while(t--) play(); \/\/ Let's play!\n stdout.flush;\n return 0;\n}\n","description":"Valerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to make his victory eternal!He decided to visit all n cities of Persia to find the best available mountain, but after the recent war he was too tired and didn't want to traverse a lot. So he wanted to visit each of these n cities at least once with smallest possible traverse. Persian cities are connected with bidirectional roads. You can go from any city to any other one using these roads and there is a unique path between each two cities.All cities are numbered 1 to n. Shapur is currently in the city 1 and he wants to visit all other cities with minimum possible traverse. He can finish his travels in any city.Help Shapur find how much He should travel.","input_specification":"First line contains a single natural number n (1\u2264n\u226410^5) \u2014 the amount of cities.\nNext n-1 lines contain 3 integer numbers each xi, yi and wi (1\u2264xi,yi\u2264n,0\u2264wi\u22642\u00d710^4). xi and yi are two ends of a road and wi is the length of that road.\n","output_specification":"A single integer number, the minimal length of Shapur's travel.\nPlease, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","notes":null,"sample_inputs":["3\n1 2 3\n2 3 4\n","3\n1 2 3\n1 3 3\n"],"sample_outputs":["7\n","9\n"],"human_solution":"\/\/ Cheese-Cracker: cheese-cracker.github.io\nimport std.stdio, std.conv, std.functional, std.string, std.algorithm;\nimport std.container, std.range, std.typecons, std.numeric, std.math, std.random;\n\nalias ll = long;\nalias rbt = redBlackTree;\nalias tup = Tuple!(long, long);\nstatic string[] inp;\nT rd(T = long)(){while(!inp.length) inp = readln.chomp.split; string a = inp[0]; inp.popFront; return a.to!T;}\nT[] rdarr(T = long)(T fix = 0){ auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }\n\/*******************************It's a Me, Mario!*******************************************\/\n\ntup[][long] adj;\nbool[long] vis;\n\nlong dfs(ll u){\n vis[u] = 1;\n ll maxw = 0;\n if(u in adj){\n foreach(tup e; adj[u]){\n if(!vis.get(e[0], 0)){\n maxw = max(e[1] + dfs(e[0]), maxw);\n }\n }\n }\n return maxw;\n}\n\n\nvoid play(){\n int n;\n n = rd!int;\n ll u, v, w;\n ll sumwt = 0;\n foreach(i; 0..n-1){\n u = rd; v = rd; w = rd;\n adj[u] ~= tup(v, w);\n adj[v] ~= tup(u, w);\n sumwt += w;\n }\n ll maxwtpath = dfs(1);\n ll leftw = sumwt - maxwtpath;\n debug writeln(\"D: \", sumwt, \" \", maxwtpath, \" \", leftw);\n writeln(maxwtpath + 2*leftw);\n}\n\nint main(){\n long t = 1;\n \/* t = rd; \/\/ Toggle! *\/\n while(t--) play(); \/\/ Let's play!\n stdout.flush;\n return 0;\n}\n","testcases":"[{'input': ['3\\r\\n1 2 3\\r\\n2 3 4\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n1 3 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['5\\r\\n5 3 60\\r\\n4 3 63\\r\\n2 1 97\\r\\n3 1 14\\r\\n'], 'output': ['371\\r\\n']}, {'input': ['3\\r\\n2 1 63\\r\\n3 1 78\\r\\n'], 'output': ['204\\r\\n']}, {'input': ['13\\r\\n8 2 58\\r\\n2 1 49\\r\\n13 10 41\\r\\n11 9 67\\r\\n6 4 18\\r\\n7 1 79\\r\\n3 2 58\\r\\n9 7 92\\r\\n10 6 62\\r\\n4 3 5\\r\\n12 4 87\\r\\n5 3 66\\r\\n'], 'output': ['1126\\r\\n']}, {'input': ['2\\r\\n2 1 89\\r\\n'], 'output': ['89\\r\\n']}, {'input': ['12\\r\\n3 1 31\\r\\n5 2 94\\r\\n9 8 37\\r\\n10 9 45\\r\\n7 5 75\\r\\n4 2 77\\r\\n6 3 31\\r\\n11 6 14\\r\\n8 7 19\\r\\n2 1 68\\r\\n12 1 60\\r\\n'], 'output': ['764\\r\\n']}, {'input': ['2\\r\\n2 1 5\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['12\\r\\n3 2 52\\r\\n4 1 2\\r\\n5 2 68\\r\\n6 1 93\\r\\n8 5 60\\r\\n2 1 88\\r\\n9 8 44\\r\\n7 5 48\\r\\n11 2 31\\r\\n10 4 45\\r\\n12 7 58\\r\\n'], 'output': ['916\\r\\n']}, {'input': ['15\\r\\n12 1 52\\r\\n3 2 10\\r\\n4 1 45\\r\\n11 7 20\\r\\n10 3 54\\r\\n13 9 44\\r\\n15 2 8\\r\\n14 5 55\\r\\n9 3 32\\r\\n2 1 32\\r\\n8 4 14\\r\\n6 5 24\\r\\n5 3 74\\r\\n7 6 88\\r\\n'], 'output': ['856\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 2 0\\r\\n2 3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n1 2 3\\r\\n1 3 1\\r\\n3 4 1\\r\\n4 5 1\\r\\n5 6 1\\r\\n'], 'output': ['10\\r\\n']}]","id":625} {"difficulty":1700,"lang":"D","lang_cluster":"D","src_uid":"66_D","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional, std.meta;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.ascii, std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n;\r\n readf!\"%s\"(n);\r\n readln;\r\n \r\n immutable int MAXP = 300;\r\n \r\n auto isPrime = new bool[MAXP];\r\n isPrime[] = true;\r\n int[] primes;\r\n for (int i = 2; primes.length < n; ++i) {\r\n if (!isPrime[i]) { continue; }\r\n \r\n primes ~= i;\r\n for (int j = i+i; j < MAXP; j += i) { isPrime[j] = false; }\r\n }\r\n \r\n BigInt product = 1;\r\n foreach (e; primes) { product *= e; }\r\n \r\n debug { product.writeln; }\r\n \r\n BigInt[] ans;\r\n foreach (i; 0 .. n) {\r\n ans ~= product \/ primes[i];\r\n }\r\n \r\n ans.each!writeln;\r\n}","description":"Little Petya has a birthday soon. Due this wonderful event, Petya's friends decided to give him sweets. The total number of Petya's friends equals to n.Let us remind you the definition of the greatest common divisor: GCD(a1,...,ak)=d, where d represents such a maximal positive number that each ai (1\u2264i\u2264k) is evenly divisible by d. At that, we assume that all ai's are greater than zero.Knowing that Petya is keen on programming, his friends has agreed beforehand that the 1-st friend gives a1 sweets, the 2-nd one gives a2 sweets, ..., the n-th one gives an sweets. At the same time, for any i and j (1\u2264i,j\u2264n) they want the GCD(ai,aj) not to be equal to 1. However, they also want the following condition to be satisfied: GCD(a1,a2,...,an)=1. One more: all the ai should be distinct.Help the friends to choose the suitable numbers a1,...,an.","input_specification":"The first line contains an integer n (2\u2264n\u226450).\n","output_specification":"If there is no answer, print \"-1\" without quotes. Otherwise print a set of n distinct positive numbers a1,a2,...,an. Each line must contain one number. Each number must consist of not more than 100 digits, and must not contain any leading zeros. If there are several solutions to that problem, print any of them.\nDo not forget, please, that all of the following conditions must be true:\n For every i and j (1\u2264i,j\u2264n): GCD(ai,aj)\u22601 GCD(a1,a2,...,an)=1 For every i and j (1\u2264i,j\u2264n,i\u2260j): ai\u2260aj Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","notes":null,"sample_inputs":["3\n","4\n"],"sample_outputs":["99\n55\n11115\n","385\n360\n792\n8360\n"],"human_solution":"import core.bitop, std.bitmanip;\r\nimport core.checkedint;\r\nimport std.algorithm, std.functional, std.meta;\r\nimport std.array, std.container;\r\nimport std.bigint;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.ascii, std.typecons;\r\n\r\nvoid main()\r\n{\r\n int n;\r\n readf!\"%s\"(n);\r\n readln;\r\n \r\n if (n == 2) {\r\n writeln(-1);\r\n return;\r\n }\r\n \r\n immutable int MAXP = 300;\r\n \r\n auto isPrime = new bool[MAXP];\r\n isPrime[] = true;\r\n int[] primes;\r\n for (int i = 2; primes.length < n; ++i) {\r\n if (!isPrime[i]) { continue; }\r\n \r\n primes ~= i;\r\n for (int j = i+i; j < MAXP; j += i) { isPrime[j] = false; }\r\n }\r\n \r\n BigInt product = 1;\r\n foreach (e; primes) { product *= e; }\r\n \r\n debug { product.writeln; }\r\n \r\n BigInt[] ans;\r\n foreach (i; 0 .. n) {\r\n ans ~= product \/ primes[i];\r\n }\r\n \r\n ans.each!writeln;\r\n}","testcases":"[{'input': ['3\\r\\n'], 'output': ['15\\r\\n10\\r\\n6\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['105\\r\\n70\\r\\n42\\r\\n30\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['1155\\r\\n770\\r\\n462\\r\\n330\\r\\n210\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['15015\\r\\n10010\\r\\n6006\\r\\n4290\\r\\n2730\\r\\n2310\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['255255\\r\\n170170\\r\\n102102\\r\\n72930\\r\\n46410\\r\\n39270\\r\\n30030\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['4849845\\r\\n3233230\\r\\n1939938\\r\\n1385670\\r\\n881790\\r\\n746130\\r\\n570570\\r\\n510510\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['111546435\\r\\n74364290\\r\\n44618574\\r\\n31870410\\r\\n20281170\\r\\n17160990\\r\\n13123110\\r\\n11741730\\r\\n9699690\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['3234846615\\r\\n2156564410\\r\\n1293938646\\r\\n924241890\\r\\n588153930\\r\\n497668710\\r\\n380570190\\r\\n340510170\\r\\n281291010\\r\\n223092870\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['100280245065\\r\\n66853496710\\r\\n40112098026\\r\\n28651498590\\r\\n18232771830\\r\\n15427730010\\r\\n11797675890\\r\\n10555815270\\r\\n8720021310\\r\\n6915878970\\r\\n6469693230\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['3710369067405\\r\\n2473579378270\\r\\n1484147626962\\r\\n1060105447830\\r\\n674612557710\\r\\n570826010370\\r\\n436514007930\\r\\n390565164990\\r\\n322640788470\\r\\n255887521890\\r\\n239378649510\\r\\n200560490130\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['152125131763605\\r\\n101416754509070\\r\\n60850052705442\\r\\n43464323361030\\r\\n27659114866110\\r\\n23403866425170\\r\\n17897074325130\\r\\n16013171764590\\r\\n13228272327270\\r\\n10491388397490\\r\\n9814524629910\\r\\n8222980095330\\r\\n7420738134810\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['6541380665835015\\r\\n4360920443890010\\r\\n2616552266334006\\r\\n1868965904524290\\r\\n1189341939242730\\r\\n1006366256282310\\r\\n769574195980590\\r\\n688566385877370\\r\\n568815710072610\\r\\n451129701092070\\r\\n422024559086130\\r\\n353588144099190\\r\\n319091739796830\\r\\n304250263527210\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['307444891294245705\\r\\n204963260862830470\\r\\n122977956517698282\\r\\n87841397512641630\\r\\n55899071144408310\\r\\n47299214045268570\\r\\n36169987211087730\\r\\n32362620136236390\\r\\n26734338373412670\\r\\n21203095951327290\\r\\n19835154277048110\\r\\n16618642772661930\\r\\n14997311770451010\\r\\n14299762385778870\\r\\n13082761331670030\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['16294579238595022365\\r\\n10863052825730014910\\r\\n6517831695438008946\\r\\n4655594068170006390\\r\\n2962650770653640430\\r\\n2506858344399234210\\r\\n1917009322187649690\\r\\n1715218867220528670\\r\\n1416919933790871510\\r\\n1123764085420346370\\r\\n1051263176683549830\\r\\n880788066951082290\\r\\n794857523833903530\\r\\n757887406446280110\\r\\n693386350578511590\\r\\n614889782588491410\\r\\n']}, {'input': ['17\\r\\n'], 'output': ['961380175077106319535\\r\\n640920116718070879690\\r\\n384552070030842527814\\r\\n274680050022030377010\\r\\n174796395468564785370\\r\\n147904642319554818390\\r\\n113103550009071331710\\r\\n101197913166011191530\\r\\n83598276093661419090\\r\\n66302081039800435830\\r\\n62024527424329439970\\r\\n51966495950113855110\\r\\n46896593906200308270\\r\\n44715356980330526490\\r\\n40909794684132183810\\r\\n36278497172720993190\\r\\n32589158477190044730\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['58644190679703485491635\\r\\n39096127119802323661090\\r\\n23457676271881394196654\\r\\n16755483051343852997610\\r\\n10662580123582451907570\\r\\n9022183181492843921790\\r\\n6899316550553351234310\\r\\n6173072703126682683330\\r\\n5099494841713346564490\\r\\n4044426943427826585630\\r\\n3783496172884095838170\\r\\n3169956252956945161710\\r\\n2860692228278218804470\\r\\n2727636775800162115890\\r\\n2495497475732063212410\\r\\n2212988327535980584590\\r\\n1987938667108592728530\\r\\n1922760350154212639070\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['3929160775540133527939545\\r\\n2619440517026755685293030\\r\\n1571664310216053411175818\\r\\n1122617364440038150839870\\r\\n714392868280024277807190\\r\\n604486273160020542759930\\r\\n462254208887074532698770\\r\\n413595871109487739783110\\r\\n341666154394794219820830\\r\\n270976605209664381237210\\r\\n253494243583234421157390\\r\\n212387068948115325834570\\r\\n191666379294640659899490\\r\\n182751663978610861764630\\r\\n167198330874048235231470\\r\\n148270217944910699167530\\r\\n133191890696275712811510\\r\\n128824943460332246817690\\r\\n117288381359406970983270\\r\\n']}]","id":626} {"difficulty":2600,"lang":"D","lang_cluster":"D","src_uid":"698_D","execute_outcome":"WRONG_ANSWER","source_code":"import std.algorithm, std.array, std.range, std.stdio, std.typecons;\r\nalias Point = Tuple !(int, q{x}, int, q{y});\r\nlong sp (Point a, Point b, Point c) {return (b.x - a.x) * 1L * (c.x - a.x) + (b.y - a.y) * 1L * (c.y - a.y);}\r\nlong vp (Point a, Point b, Point c) {return (b.x - a.x) * 1L * (c.y - a.y) - (b.y - a.y) * 1L * (c.x - a.x);}\r\nvoid main () {\r\n\tint k, n, res;\r\n\treadf (\" %s %s\", &k, &n);\r\n\tauto a = new Point [k], b = new Point [n], s = new int [] [] [] (k, n);\r\n\tforeach (ref p; a) readf (\" %s %s\", &p.x, &p.y);\r\n\tforeach (ref q; b) readf (\" %s %s\", &q.x, &q.y);\r\n\tforeach (p; 0..k) foreach (q; 0..n) s[p][q] = n.iota.filter !(r => vp (b[r], a[p], b[q]) == 0 && sp (b[r], a[p], b[q]) < 0).take (k).array;\r\n\tbool go (int mask, int depth, int [] t) {\r\n\t\tif (t.empty) return true;\r\n\t\tif (depth < t.length) return false;\r\n\t\tforeach (p; 0..k) if (mask & (1 << p)) foreach (i, q; t) {\r\n\t\t\tauto next = t[0..i] ~ t[i + 1..$] ~ s[p][q];\r\n\t\t\tif (go (mask ^ (1 << p), depth - 1, next.sort ().uniq.array)) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tforeach (q; 0..n) res += k.iota.any !(p => go (-1, k, [p]));\r\n\twriteln (res);\r\n}\r\n","description":"Bearland is a dangerous place. Limak can\u2019t travel on foot. Instead, he has k magic teleportation stones. Each stone can be used at most once. The i-th stone allows to teleport to a point (axi,ayi). Limak can use stones in any order.There are n monsters in Bearland. The i-th of them stands at (mxi,myi).The given k+n points are pairwise distinct.After each teleportation, Limak can shoot an arrow in some direction. An arrow will hit the first monster in the chosen direction. Then, both an arrow and a monster disappear. It\u2019s dangerous to stay in one place for long, so Limak can shoot only one arrow from one place.A monster should be afraid if it\u2019s possible that Limak will hit it. How many monsters should be afraid of Limak?","input_specification":"The first line of the input contains two integers k and n (1\u2264k\u22647, 1\u2264n\u22641000)\u00a0\u2014 the number of stones and the number of monsters.\nThe i-th of following k lines contains two integers axi and ayi (-10^9\u2264axi,ayi\u226410^9)\u00a0\u2014 coordinates to which Limak can teleport using the i-th stone.\nThe i-th of last n lines contains two integers mxi and myi (-10^9\u2264mxi,myi\u226410^9)\u00a0\u2014 coordinates of the i-th monster.\nThe given k+n points are pairwise distinct.\n","output_specification":"Print the number of monsters which should be afraid of Limak.\n","notes":"In the first sample, there are two stones and four monsters. Stones allow to teleport to points (-2,-1) and (4,5), marked blue in the drawing below. Monsters are at (4,2), (2,1), (4,-1) and (1,-1), marked red. A monster at (4,-1) shouldn't be afraid because it's impossible that Limak will hit it with an arrow. Other three monsters can be hit and thus the answer is 3.\n \nIn the second sample, five monsters should be afraid. Safe monsters are those at (300,600), (170,340) and (90,180).\n","sample_inputs":["2 4\n-2 -1\n4 5\n4 2\n2 1\n4 -1\n1 -1\n","3 8\n10 20\n0 0\n20 40\n300 600\n30 60\n170 340\n50 100\n28 56\n90 180\n-4 -8\n-1 -2\n"],"sample_outputs":["3\n","5\n"],"human_solution":"import std.algorithm, std.array, std.range, std.stdio, std.typecons;\r\nalias Point = Tuple !(int, q{x}, int, q{y});\r\nlong sp (Point a, Point b, Point c) {return (b.x - a.x) * 1L * (c.x - a.x) + (b.y - a.y) * 1L * (c.y - a.y);}\r\nlong vp (Point a, Point b, Point c) {return (b.x - a.x) * 1L * (c.y - a.y) - (b.y - a.y) * 1L * (c.x - a.x);}\r\nvoid main () {\r\n\tint k, n, res;\r\n\treadf (\" %s %s\", &k, &n);\r\n\tauto a = new Point [k], b = new Point [n], s = new int [] [] [] (k, n);\r\n\tforeach (ref p; a) readf (\" %s %s\", &p.x, &p.y);\r\n\tforeach (ref q; b) readf (\" %s %s\", &q.x, &q.y);\r\n\tforeach (p; 0..k) foreach (q; 0..n) s[p][q] = n.iota.filter !(r => vp (b[r], a[p], b[q]) == 0 && sp (b[r], a[p], b[q]) < 0).take (k).array;\r\n\tbool go (int mask, int depth, int [] t) {\r\n\t\tif (t.empty) return true;\r\n\t\tif (depth < t.length) return false;\r\n\t\tforeach (p; 0..k) if (mask & (1 << p)) foreach (i, q; t) {\r\n\t\t\tauto next = t[0..i] ~ t[i + 1..$] ~ s[p][q];\r\n\t\t\tif (go (mask ^ (1 << p), depth - 1, next.sort ().uniq.array)) return true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\tforeach (q; 0..n) res += go (-1, k, [q]);\r\n\twriteln (res);\r\n}\r\n","testcases":"[{'input': ['2 4\\r\\n-2 -1\\r\\n4 5\\r\\n4 2\\r\\n2 1\\r\\n4 -1\\r\\n1 -1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 8\\r\\n10 20\\r\\n0 0\\r\\n20 40\\r\\n300 600\\r\\n30 60\\r\\n170 340\\r\\n50 100\\r\\n28 56\\r\\n90 180\\r\\n-4 -8\\r\\n-1 -2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1 2\\r\\n626482 -100841\\r\\n626504 -100907\\r\\n626506 -100913\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 10\\r\\n778084 -205153\\r\\n778001 -205093\\r\\n778155 -205118\\r\\n778168 -204997\\r\\n778066 -205141\\r\\n778146 -205036\\r\\n778041 -205063\\r\\n778012 -204996\\r\\n778132 -205128\\r\\n778049 -205131\\r\\n778049 -205129\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['1 1\\r\\n4002 -6455\\r\\n6085 -3108\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 16\\r\\n216527 461593\\r\\n216512 461602\\r\\n216539 461641\\r\\n216529 461597\\r\\n216571 461516\\r\\n216502 461593\\r\\n216467 461629\\r\\n216608 461548\\r\\n216575 461509\\r\\n216538 461549\\r\\n216526 461596\\r\\n216479 461689\\r\\n216562 461616\\r\\n216551 461497\\r\\n216467 461593\\r\\n216516 461615\\r\\n216635 461533\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['1 17\\r\\n173253194 -62884133\\r\\n-257845058 -462695866\\r\\n174786636 -61461979\\r\\n-261077883 -465694072\\r\\n208150505 -30519459\\r\\n-229247456 -436173706\\r\\n-173585694 -384551540\\r\\n330374064 82833849\\r\\n345439586 96806006\\r\\n-58594506 -277905721\\r\\n58862786 -168972773\\r\\n635083270 365429093\\r\\n-233247002 -439882989\\r\\n285944219 41628455\\r\\n424766742 170376074\\r\\n182019007 -54754490\\r\\n343906144 95383852\\r\\n402468849 149696428\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1 1\\r\\n-2097152 -5242880\\r\\n-5242880 2097152\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7 1\\r\\n4194304 -1048576\\r\\n-4194304 -5242880\\r\\n0 -4194304\\r\\n4194304 -3145728\\r\\n5242880 -3145728\\r\\n2097152 -2097152\\r\\n-1048576 -2097152\\r\\n0 -5242880\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n866810561 881008710\\r\\n866810525 881008684\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7 3\\r\\n-61046436 -858506908\\r\\n-61142086 -858537516\\r\\n-61112886 -858528172\\r\\n-61055086 -858509676\\r\\n-60571836 -858355036\\r\\n-61014536 -858496700\\r\\n-60849286 -858443820\\r\\n-60698286 -858395500\\r\\n-60846486 -858442924\\r\\n-60746736 -858411004\\r\\n'], 'output': ['3\\r\\n']}]","id":627} {"difficulty":2300,"lang":"D","lang_cluster":"D","src_uid":"774_E","execute_outcome":"WRONG_ANSWER","source_code":"import std.stdio, std.bigint, std.string;\r\n\r\nvoid main() {\r\n auto a_ = readln.strip;\r\n auto n = a_.length;\r\n auto a = BigInt(a_);\r\n \/\/ auto b = BigInt(readln.strip);\r\n int b;\r\n scanf(\"%d\", &b);\r\n if (n > 100) {\r\n writeln(b);\r\n writeln(a);\r\n }\r\n auto ans = a % b;\r\n auto pow10n = 1; for (int i=0; i 0)\r\n\t{\r\n\t\tauto b = new bool [half];\r\n\t\treadln;\r\n\t\tforeach (c; readln.splitter.map !(to !(int)))\r\n\t\t{\r\n\t\t\tb[c] = true;\r\n\t\t}\r\n\r\n\t\tauto f = new uint [] [] (2, limit \/ 32);\r\n\t\tint d = 0;\r\n\t\tf[d][] = 0;\r\n\t\tf[d][half >> 5] |= 1U << (half & 31);\r\n\t\tforeach (res; 1..half + 1)\r\n\t\t{\r\n\t\t\td ^= 1;\r\n\t\t\tf[d][] = 0;\r\n\t\t\tforeach (c; 0..half)\r\n\t\t\t{\r\n\t\t\t\tif (!b[c])\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tint s = c - n;\r\n\t\t\t\tint sLo = s & 31;\r\n\t\t\t\tint sHi = s >> 5;\r\n\t\t\t\tint sBack = 32 - sLo;\r\n\t\t\t\tuint loMask = (1U << sLo) - 1U;\r\n\t\t\t\tuint hiMask = ~loMask;\r\n\t\t\t\tint j = sHi;\r\n\t\t\t\tforeach (i; 0..limit \/ 32)\r\n\t\t\t\t{\r\n\/\/\t\t\t\t\tf[d][i + s] |= f[!d][i];\r\n\t\t\t\t\tif (j >= 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[d][j] |= f[!d][i] << sLo;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj += 1;\r\n\t\t\t\t\tif (j >= limit \/ 32)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (j >= 0 && sLo != 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[d][j] |= f[!d][i] >> sBack;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (f[d][half >> 5] & (1U << (half & 31)))\r\n\t\t\t{\r\n\t\t\t\twriteln (res);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n","description":"Sasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration . Today, on the party in honour of Sergiy of Vancouver they decided to prepare a glass of Coke with carbon dioxide concentration . The drink should also be tasty, so the glass can contain only integer number of liters of each Coke type (some types can be not presented in the glass). Also, they want to minimize the total volume of Coke in the glass.Carbon dioxide concentration is defined as the volume of carbone dioxide in the Coke divided by the total volume of Coke. When you mix two Cokes, the volume of carbon dioxide sums up, and the total volume of Coke sums up as well.Help them, find the minimal natural number of liters needed to create a glass with carbon dioxide concentration . Assume that the friends have unlimited amount of each Coke type.","input_specification":"The first line contains two integers n, k (0\u2264n\u22641000, 1\u2264k\u226410^6)\u00a0\u2014 carbon dioxide concentration the friends want and the number of Coke types.\nThe second line contains k integers a1,a2,...,ak (0\u2264ai\u22641000)\u00a0\u2014 carbon dioxide concentration of each type of Coke. Some Coke types can have same concentration.\n","output_specification":"Print the minimal natural number of liter needed to prepare a glass with carbon dioxide concentration , or -1 if it is impossible.\n","notes":"In the first sample case, we can achieve concentration using one liter of Coke of types and : .\nIn the second case, we can achieve concentration using two liters of type and one liter of type: .\n","sample_inputs":["400 4\n100 300 450 500\n","50 2\n100 25\n"],"sample_outputs":["2\n","3\n"],"human_solution":"import core.bitop;\r\nimport std.algorithm;\r\nimport std.array;\r\nimport std.bitmanip;\r\nimport std.container;\r\nimport std.conv;\r\nimport std.exception;\r\nimport std.functional;\r\nimport std.math;\r\nimport std.numeric;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nimmutable int half = 1 << 10;\r\nimmutable int limit = half << 1;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\tint k;\r\nmultitest_loop:\r\n\twhile (readf (\" %s %s\", &n, &k) > 0)\r\n\t{\r\n\t\tauto b = new bool [half];\r\n\t\treadln;\r\n\t\tforeach (c; readln.splitter.map !(to !(int)))\r\n\t\t{\r\n\t\t\tb[c] = true;\r\n\t\t}\r\n\r\n\t\tauto f = new uint [] [] (2, limit \/ 32);\r\n\t\tint d = 0;\r\n\t\tf[d][] = 0;\r\n\t\tf[d][half >> 5] |= 1U << (half & 31);\r\n\t\tforeach (res; 1..half + 1)\r\n\t\t{\r\n\t\t\td ^= 1;\r\n\t\t\tf[d][] = 0;\r\n\t\t\tforeach (c; 0..half)\r\n\t\t\t{\r\n\t\t\t\tif (!b[c])\r\n\t\t\t\t{\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tint s = c - n;\r\n\t\t\t\tint sLo = s & 31;\r\n\t\t\t\tint sHi = s >> 5;\r\n\t\t\t\tint sBack = 32 - sLo;\r\n\t\t\t\tuint loMask = (1U << sLo) - 1U;\r\n\t\t\t\tuint hiMask = ~loMask;\r\n\t\t\t\tint j = sHi;\r\n\t\t\t\tforeach (i; 0..limit \/ 32)\r\n\t\t\t\t{\r\n\/\/\t\t\t\t\tf[d][i + s] |= f[!d][i];\r\n\t\t\t\t\tif (j >= 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[d][j] |= f[!d][i] << sLo;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj += 1;\r\n\t\t\t\t\tif (j >= limit \/ 32)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (j >= 0 && sLo != 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tf[d][j] |= f[!d][i] >> sBack;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (f[d][half >> 5] & (1U << (half & 31)))\r\n\t\t\t{\r\n\t\t\t\twriteln (res);\r\n\t\t\t\tcontinue multitest_loop;\r\n\t\t\t}\r\n\t\t}\r\n\t\twriteln (-1);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['400 4\\r\\n100 300 450 500\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['50 2\\r\\n100 25\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['500 3\\r\\n1000 5 5\\r\\n'], 'output': ['199\\r\\n']}, {'input': ['500 1\\r\\n1000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['874 3\\r\\n873 974 875\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['999 2\\r\\n1 1000\\r\\n'], 'output': ['999\\r\\n']}, {'input': ['326 18\\r\\n684 49 373 57 747 132 441 385 640 575 567 665 323 515 527 656 232 701\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['314 15\\r\\n160 769 201 691 358 724 248 47 420 432 667 601 596 370 469\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['0 1\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['0 1\\r\\n1000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['345 5\\r\\n497 135 21 199 873\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['641 8\\r\\n807 1000 98 794 536 845 407 331\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['852 10\\r\\n668 1000 1000 1000 1000 1000 1000 639 213 1000\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['710 7\\r\\n854 734 63 921 921 187 978\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['134 6\\r\\n505 10 1 363 344 162\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['951 15\\r\\n706 1000 987 974 974 706 792 792 974 1000 1000 987 974 953 953\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['834 10\\r\\n921 995 1000 285 1000 166 1000 999 991 983\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['917 21\\r\\n999 998 1000 997 1000 998 78 991 964 985 987 78 985 999 83 987 1000 999 999 78 83\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['971 15\\r\\n692 1000 1000 997 1000 691 996 691 1000 1000 1000 692 1000 997 1000\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['971 108\\r\\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000 988 984 996 991 724 706 988 991 724 1000 1000 991 984 984 706 724 706 988 724 984 984 991 988 991 706 997 984 984 1000 706 724 988 984 996 1000 988 997 984 724 991 991\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['1000 16\\r\\n536 107 113 397 613 1 535 652 730 137 239 538 764 431 613 273\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['998 2\\r\\n1 1000\\r\\n'], 'output': ['999\\r\\n']}, {'input': ['998 3\\r\\n1 999 1000\\r\\n'], 'output': ['500\\r\\n']}, {'input': ['998 4\\r\\n1 2 999 1000\\r\\n'], 'output': ['499\\r\\n']}, {'input': ['500 2\\r\\n1000 2\\r\\n'], 'output': ['499\\r\\n']}, {'input': ['508 15\\r\\n0 998 997 1 1 2 997 1 997 1000 0 3 3 2 4\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['492 2\\r\\n706 4\\r\\n'], 'output': ['351\\r\\n']}, {'input': ['672 5\\r\\n4 6 1000 995 997\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['410 4\\r\\n998 8 990 990\\r\\n'], 'output': ['54\\r\\n']}, {'input': ['499 2\\r\\n1000 2\\r\\n'], 'output': ['998\\r\\n']}, {'input': ['995 5\\r\\n996 997 998 999 1000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['500 3\\r\\n499 1000 300\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['499 2\\r\\n0 1000\\r\\n'], 'output': ['1000\\r\\n']}, {'input': ['1000 10\\r\\n0 1 2 3 4 5 6 7 8 9\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['501 2\\r\\n1 1000\\r\\n'], 'output': ['999\\r\\n']}]","id":629} {"difficulty":2700,"lang":"D","lang_cluster":"D","src_uid":"868_E","execute_outcome":"WRONG_ANSWER","source_code":"import std.conv, std.functional, std.range, std.stdio, std.string;\nimport std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;\nimport core.bitop;\n\nclass EOFException : Throwable { this() { super(\"EOF\"); } }\nstring[] tokens;\nstring readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }\nint readInt() { return readToken.to!int; }\nlong readLong() { return readToken.to!long; }\nreal readReal() { return readToken.to!real; }\n\nbool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }\nbool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }\n\nint binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }\nint lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }\nint upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }\n\n\nenum INF = 10L^^18;\n\nint N;\nint[] U, V;\nlong[] W;\nint S;\nint M;\nint[] X;\n\nint[][] G;\n\nlong[][][][] cache;\n\n\/\/ arriving at u from p via ip, a above, b below\nlong calc(int u, int p, int ip, int a, int b) {\n assert(b > 0);\n auto ret = &cache[u][p][a][b];\n if (*ret == -1) {\n debug {\n writeln(\"calc \", u, \" \", p, \" \", ip, \" \", a, \" \", b);\n }\n if (G[u].length == 1) {\n \/\/ leaf\n if (a == 0) {\n *ret = 0;\n } else {\n *ret = W[G[u][0]] + calc(p, u, ip, 0, a);\n }\n } else {\n assert(b > 0);\n \/\/ c_j for j-th child\n \/\/ maximize min { W[i] + calc(u, v_j, i_j, a + b - c_j, c_j) | c_j > 0 }\n auto crt = new long[b + 1];\n crt[] = -INF;\n crt[0] = INF;\n foreach (i; G[u]) {\n const v = U[i] ^ V[i] ^ u;\n if (v != p) {\n auto nxt = crt.dup;\n foreach (c; 0 .. b + 1) {\n if (crt[c] >= -INF) {\n foreach (d; 0 .. b - c + 1) {\n if (nxt[c + d] < crt[c]) {\n chmax(nxt[c + d], min(crt[c], W[i] + calc(v, u, i, a + b - d, d)));\n }\n }\n }\n }\n crt = nxt;\n }\n }\n *ret = crt[b];\n }\n debug {\n writeln(u, \" \", p, \" \", ip, \" \", a, \" \", b, \": \", *ret);\n }\n }\n return *ret;\n}\n\nvoid main() {\n try {\n for (; ; ) {\n N = readInt();\n U = new int[N - 1];\n V = new int[N - 1];\n W = new long[N - 1];\n foreach (i; 0 .. N - 1) {\n U[i] = readInt() - 1;\n V[i] = readInt() - 1;\n W[i] = readLong();\n }\n S = readInt() - 1;\n M = readInt();\n X = new int[M];\n foreach (m; 0 .. M) {\n X[m] = readInt() - 1;\n }\n \n G = new int[][N];\n foreach (i; 0 .. N - 1) {\n G[U[i]] ~= i;\n G[V[i]] ~= i;\n }\n \n cache = new long[][][][](N, N, M + 1, M + 1);\n foreach (u; 0 .. N) foreach (p; 0 .. N) {\n foreach (a; 0 .. M + 1) foreach (b; 0 .. M + 1) {\n cache[u][p][a][b] = -1;\n }\n }\n \n auto d = new int[][](N, N);\n foreach (u; 0 .. N) {\n d[u][] = N;\n d[u][u] = 0;\n }\n foreach (i; 0 .. M - 1) {\n d[U[i]][V[i]] = d[V[i]][U[i]] = 1;\n }\n foreach (w; 0 .. N) foreach (u; 0 .. N) foreach (v; 0 .. N) {\n chmin(d[u][v], d[u][w] + d[w][v]);\n }\n auto nums = new int[N];\n foreach (x; X) {\n foreach (i; G[S]) {\n const v = U[i] ^ V[i] ^ S;\n if (d[S][x] == 1 + d[v][x]) {\n ++nums[v];\n }\n }\n }\n debug {\n writeln(\"nums = \", nums);\n }\n \n long ans = INF;\n foreach (i; G[S]) {\n const v = U[i] ^ V[i] ^ S;\n if (nums[v] > 0) {\n chmin(ans, W[i] + calc(v, S, i, M - nums[v], nums[v]));\n }\n }\n writeln(ans);\n }\n } catch (EOFException e) {\n }\n}\n","description":"You are given a tree (a connected non-oriented graph without cycles) with vertices numbered from 1 to n, and the length of the i-th edge is wi. In the vertex s there is a policeman, in the vertices x1,x2,...,xm (xj\u2260s) m criminals are located.The policeman can walk along the edges with speed 1, the criminals can move with arbitrary large speed. If a criminal at some moment is at the same point as the policeman, he instantly gets caught by the policeman. Determine the time needed for the policeman to catch all criminals, assuming everybody behaves optimally (i.e. the criminals maximize that time, the policeman minimizes that time). Everybody knows positions of everybody else at any moment of time.","input_specification":"The first line contains single integer n (1\u2264n\u226450)\u00a0\u2014 the number of vertices in the tree. The next n-1 lines contain three integers each: ui, vi, wi (1\u2264ui,vi\u2264n, 1\u2264wi\u226450) denoting edges and their lengths. It is guaranteed that the given graph is a tree.\nThe next line contains single integer s (1\u2264s\u2264n)\u00a0\u2014 the number of vertex where the policeman starts.\nThe next line contains single integer m (1\u2264m\u226450)\u00a0\u2014 the number of criminals. The next line contains m integers x1,x2,...,xm (1\u2264xj\u2264n, xj\u2260s)\u00a0\u2014 the number of vertices where the criminals are located. xj are not necessarily distinct.\n","output_specification":"If the policeman can't catch criminals, print single line \"Terrorists win\" (without quotes).\nOtherwise, print single integer\u00a0\u2014 the time needed to catch all criminals.\n","notes":"In the first example one of the optimal scenarios is the following. The criminal number 2 moves to vertex 3, the criminal 4\u00a0\u2014 to vertex 4. The policeman goes to vertex 4 and catches two criminals. After that the criminal number 1 moves to the vertex 2. The policeman goes to vertex 3 and catches criminal 2, then goes to the vertex 2 and catches the remaining criminal.\n","sample_inputs":["4\n1 2 2\n1 3 1\n1 4 1\n2\n4\n3 1 4 1\n","6\n1 2 3\n2 3 5\n3 4 1\n3 5 4\n2 6 3\n2\n3\n1 3 5\n"],"sample_outputs":["8\n","21\n"],"human_solution":"import std.conv, std.functional, std.range, std.stdio, std.string;\nimport std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;\nimport core.bitop;\n\nclass EOFException : Throwable { this() { super(\"EOF\"); } }\nstring[] tokens;\nstring readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }\nint readInt() { return readToken.to!int; }\nlong readLong() { return readToken.to!long; }\nreal readReal() { return readToken.to!real; }\n\nbool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }\nbool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }\n\nint binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }\nint lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }\nint upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }\n\n\nenum INF = 10L^^18;\n\nint N;\nint[] U, V;\nlong[] W;\nint S;\nint M;\nint[] X;\n\nint[][] G;\n\nlong[][][][] cache;\n\n\/\/ arriving at u from p via ip, a above, b below\nlong calc(int u, int p, int ip, int a, int b) {\n assert(b > 0);\n auto ret = &cache[u][p][a][b];\n if (*ret == -1) {\n debug {\n writeln(\"calc \", u, \" \", p, \" \", ip, \" \", a, \" \", b);\n }\n if (G[u].length == 1) {\n \/\/ leaf\n if (a == 0) {\n *ret = 0;\n } else {\n *ret = W[G[u][0]] + calc(p, u, ip, 0, a);\n }\n } else {\n assert(b > 0);\n \/\/ c_j for j-th child\n \/\/ maximize min { W[i] + calc(u, v_j, i_j, a + b - c_j, c_j) | c_j > 0 }\n auto dp = new long[b + 1];\n dp[] = -INF;\n dp[0] = INF;\n foreach (i; G[u]) {\n const v = U[i] ^ V[i] ^ u;\n if (v != p) {\n foreach_reverse (c; 0 .. b + 1) {\n if (dp[c] >= -INF) {\n foreach (d; 1 .. b - c + 1) {\n if (dp[c + d] < dp[c]) {\n chmax(dp[c + d], min(dp[c], W[i] + calc(v, u, i, a + b - d, d)));\n }\n }\n }\n }\n }\n }\n *ret = dp[b];\n }\n debug {\n writeln(u, \" \", p, \" \", ip, \" \", a, \" \", b, \": \", *ret);\n }\n }\n return *ret;\n}\n\nvoid main() {\n try {\n for (; ; ) {\n N = readInt();\n U = new int[N - 1];\n V = new int[N - 1];\n W = new long[N - 1];\n foreach (i; 0 .. N - 1) {\n U[i] = readInt() - 1;\n V[i] = readInt() - 1;\n W[i] = readLong();\n }\n S = readInt() - 1;\n M = readInt();\n X = new int[M];\n foreach (m; 0 .. M) {\n X[m] = readInt() - 1;\n }\n \n G = new int[][N];\n foreach (i; 0 .. N - 1) {\n G[U[i]] ~= i;\n G[V[i]] ~= i;\n }\n \n cache = new long[][][][](N, N, M + 1, M + 1);\n foreach (u; 0 .. N) foreach (p; 0 .. N) {\n foreach (a; 0 .. M + 1) foreach (b; 0 .. M + 1) {\n cache[u][p][a][b] = -1;\n }\n }\n \n auto d = new int[][](N, N);\n foreach (u; 0 .. N) {\n d[u][] = N;\n d[u][u] = 0;\n }\n foreach (i; 0 .. N - 1) {\n d[U[i]][V[i]] = d[V[i]][U[i]] = 1;\n }\n foreach (w; 0 .. N) foreach (u; 0 .. N) foreach (v; 0 .. N) {\n chmin(d[u][v], d[u][w] + d[w][v]);\n }\n \n long ans = INF;\n foreach (i; G[S]) {\n const v = U[i] ^ V[i] ^ S;\n int b;\n foreach (x; X) {\n if (d[S][x] == 1 + d[v][x]) {\n ++b;\n }\n }\n debug {\n writeln(v, \" \", i, \": \", b);\n }\n if (b > 0) {\n chmin(ans, W[i] + calc(v, S, i, M - b, b));\n }\n }\n writeln(ans);\n }\n } catch (EOFException e) {\n }\n}\n","testcases":"[{'input': ['4\\r\\n1 2 2\\r\\n1 3 1\\r\\n1 4 1\\r\\n2\\r\\n4\\r\\n3 1 4 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['6\\r\\n1 2 3\\r\\n2 3 5\\r\\n3 4 1\\r\\n3 5 4\\r\\n2 6 3\\r\\n2\\r\\n3\\r\\n1 3 5\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['2\\r\\n1 2 14\\r\\n1\\r\\n1\\r\\n2\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['3\\r\\n1 2 38\\r\\n1 3 44\\r\\n2\\r\\n10\\r\\n1 1 3 1 1 1 3 3 3 3\\r\\n'], 'output': ['82\\r\\n']}, {'input': ['4\\r\\n1 2 9\\r\\n1 3 46\\r\\n1 4 50\\r\\n4\\r\\n20\\r\\n2 2 3 3 1 1 3 2 3 3 2 1 3 3 3 3 3 1 2 2\\r\\n'], 'output': ['328\\r\\n']}, {'input': ['5\\r\\n1 2 23\\r\\n1 3 8\\r\\n3 4 12\\r\\n4 5 14\\r\\n1\\r\\n10\\r\\n5 3 5 2 3 3 3 2 2 5\\r\\n'], 'output': ['80\\r\\n']}, {'input': ['5\\r\\n1 2 8\\r\\n1 3 32\\r\\n1 4 50\\r\\n4 5 33\\r\\n5\\r\\n15\\r\\n1 4 2 4 4 2 4 2 2 3 4 2 2 1 1\\r\\n'], 'output': ['364\\r\\n']}, {'input': ['10\\r\\n1 2 6\\r\\n1 3 43\\r\\n1 4 19\\r\\n1 9 22\\r\\n2 6 28\\r\\n2 7 16\\r\\n3 10 35\\r\\n4 5 20\\r\\n6 8 16\\r\\n8\\r\\n20\\r\\n7 6 6 6 1 2 1 2 1 4 6 6 2 9 1 5 1 6 9 3\\r\\n'], 'output': ['726\\r\\n']}, {'input': ['15\\r\\n1 2 10\\r\\n1 5 44\\r\\n1 6 21\\r\\n1 7 33\\r\\n1 8 34\\r\\n2 3 11\\r\\n3 4 42\\r\\n6 12 38\\r\\n6 14 28\\r\\n8 9 28\\r\\n9 10 40\\r\\n9 11 50\\r\\n11 13 39\\r\\n14 15 9\\r\\n14\\r\\n4\\r\\n6 10 12 2\\r\\n'], 'output': ['570\\r\\n']}, {'input': ['20\\r\\n1 2 16\\r\\n1 11 26\\r\\n1 12 50\\r\\n2 3 48\\r\\n2 5 41\\r\\n2 6 48\\r\\n2 14 4\\r\\n3 4 31\\r\\n3 16 28\\r\\n4 7 27\\r\\n4 8 1\\r\\n4 18 17\\r\\n5 13 19\\r\\n5 17 15\\r\\n6 10 1\\r\\n8 9 15\\r\\n8 19 32\\r\\n9 15 5\\r\\n17 20 21\\r\\n9\\r\\n50\\r\\n10 17 17 14 16 4 3 3 15 19 1 8 1 18 6 12 12 4 16 2 17 1 7 7 8 13 2 10 16 16 1 6 15 15 13 18 8 3 4 8 17 6 14 10 1 16 12 2 8 17\\r\\n'], 'output': ['2634\\r\\n']}, {'input': ['49\\r\\n2 3 40\\r\\n2 4 1\\r\\n2 5 42\\r\\n2 6 27\\r\\n2 7 43\\r\\n2 8 50\\r\\n2 9 38\\r\\n2 10 38\\r\\n2 11 2\\r\\n2 12 12\\r\\n2 13 3\\r\\n2 14 24\\r\\n2 15 13\\r\\n2 16 34\\r\\n2 17 12\\r\\n2 18 27\\r\\n2 19 29\\r\\n2 20 18\\r\\n2 21 42\\r\\n2 22 38\\r\\n2 23 18\\r\\n2 24 42\\r\\n2 25 24\\r\\n1 2 39\\r\\n26 27 24\\r\\n26 28 8\\r\\n26 29 20\\r\\n26 30 31\\r\\n26 31 30\\r\\n26 32 32\\r\\n26 33 31\\r\\n26 34 34\\r\\n26 35 22\\r\\n26 36 25\\r\\n26 37 9\\r\\n26 38 35\\r\\n26 39 12\\r\\n26 40 1\\r\\n26 41 49\\r\\n26 42 45\\r\\n26 43 23\\r\\n26 44 31\\r\\n26 45 50\\r\\n26 46 23\\r\\n26 47 35\\r\\n26 48 11\\r\\n26 49 19\\r\\n1 26 27\\r\\n1\\r\\n10\\r\\n16 16 16 16 16 33 33 33 33 33\\r\\n'], 'output': ['1359\\r\\n']}, {'input': ['49\\r\\n2 3 40\\r\\n2 4 27\\r\\n2 5 47\\r\\n2 6 40\\r\\n2 7 28\\r\\n2 8 31\\r\\n2 9 38\\r\\n2 10 17\\r\\n2 11 44\\r\\n2 12 24\\r\\n2 13 21\\r\\n2 14 29\\r\\n2 15 36\\r\\n2 16 19\\r\\n2 17 29\\r\\n2 18 24\\r\\n2 19 19\\r\\n2 20 12\\r\\n2 21 30\\r\\n2 22 18\\r\\n2 23 2\\r\\n2 24 28\\r\\n2 25 13\\r\\n1 2 22\\r\\n26 27 44\\r\\n26 28 1\\r\\n26 29 50\\r\\n26 30 18\\r\\n26 31 30\\r\\n26 32 25\\r\\n26 33 36\\r\\n26 34 25\\r\\n26 35 28\\r\\n26 36 19\\r\\n26 37 9\\r\\n26 38 11\\r\\n26 39 2\\r\\n26 40 46\\r\\n26 41 13\\r\\n26 42 48\\r\\n26 43 2\\r\\n26 44 42\\r\\n26 45 49\\r\\n26 46 39\\r\\n26 47 21\\r\\n26 48 47\\r\\n26 49 10\\r\\n1 26 19\\r\\n1\\r\\n2\\r\\n16 33\\r\\n'], 'output': ['207\\r\\n']}]","id":630} {"difficulty":2200,"lang":"D","lang_cluster":"D","src_uid":"86_D","execute_outcome":"RUNTIME_ERROR","source_code":"import std.algorithm;\r\nimport std.array;\r\nimport std.container;\r\nimport std.conv;\r\nimport std.math;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.typecons, std.traits;\r\n\r\nalias Query = Tuple!(long, \"index\", long, \"l\", long, \"r\", long, \"ans\"); \r\nvoid main() {\r\n long[long] cnt;\r\n long sum = 0;\r\n int n, t;\r\n readf(\" %d %d\\n\", &n, &t);\r\n auto a = readln.split.map!(to!long);\r\n auto queries = new Query[](t);\r\n foreach(i; 0..t) {\r\n readf(\" %d %d\", &queries[i].l, &queries[i].r);\r\n queries[i].index = i;\r\n queries[i].l--;\r\n }\r\n long k = n.intsqrt;\r\n\r\n queries.sort!(delegate(a,b) {\r\n if (a.l\/k < b.l\/k) return true; \r\n return a.r < b.r;\r\n });\r\n\r\n int l,r;\r\n void add(long elem) {\r\n debug { writeln(\"add: \", elem); }\r\n if (elem in cnt) {\r\n sum += elem*((cnt[elem]+1)^^2 - cnt[elem]^^2);\r\n } else {\r\n sum += elem;\r\n }\r\n cnt[elem]++;\r\n }\r\n void del(long elem) {\r\n debug { writeln(\"del: \", elem); }\r\n assert(cnt[elem] > 0);\r\n cnt[elem]--;\r\n sum -= elem*((cnt[elem]+1)^^2 - cnt[elem]^^2);\r\n }\r\n\r\n foreach(ref q; queries) {\r\n debug { writeln(\"query: \", a[q.l..q.r]); }\r\n while (r < q.r) {\r\n add(a[r]);\r\n r++;\r\n }\r\n while (r > q.r) {\r\n del(a[r-1]);\r\n r--;\r\n }\r\n while (l < q.l) {\r\n del(a[l]);\r\n l++;\r\n }\r\n while (l > q.l) {\r\n add(a[l]);\r\n l--;\r\n }\r\n q.ans = sum;\r\n }\r\n queries.sort!((a,b) => a.index < b.index);\r\n queries.each!(a => writeln(a.ans));\r\n}\r\n\r\nT intsqrt(T)(T i) {\r\n T bitMask = 1;\r\n T result = 0;\r\n\r\n bitMask <<= T.sizeof * 4 - 1;\r\n\r\n while (bitMask) {\r\n result |= bitMask;\r\n if ((result * result) > i) {\r\n result &= ~bitMask;\r\n }\r\n bitMask >>= 1;\r\n }\r\n\r\n return result;\r\n}","description":"An array of positive integers a1,a2,...,an is given. Let us consider its arbitrary subarray al,al+1...,ar, where 1\u2264l\u2264r\u2264n. For every positive integer s denote by Ks the number of occurrences of s into the subarray. We call the power of the subarray the sum of products Ks\u00b7Ks\u00b7s for every positive integer s. The sum contains only finite number of nonzero summands as the number of different values in the array is indeed finite.You should calculate the power of t given subarrays.","input_specification":"First line contains two integers n and t (1\u2264n,t\u2264200000) \u2014 the array length and the number of queries correspondingly.\nSecond line contains n positive integers ai (1\u2264ai\u226410^6) \u2014 the elements of the array.\nNext t lines contain two positive integers l, r (1\u2264l\u2264r\u2264n) each \u2014 the indices of the left and the right ends of the corresponding subarray.\n","output_specification":"Output t lines, the i-th line of the output should contain single positive integer \u2014 the power of the i-th query subarray.\nPlease, do not use %lld specificator to read or write 64-bit integers in C++. It is preferred to use cout stream (also you may use %I64d).\n","notes":"Consider the following array (see the second sample) and its [2, 7] subarray (elements of the subarray are colored): \n\n Then K1=3, K2=2, K3=1, so the power is equal to 3^2\u00b71+2^2\u00b72+1^2\u00b73=20.","sample_inputs":["3 2\n1 2 1\n1 2\n1 3\n","8 3\n1 1 2 2 1 3 1 1\n2 7\n1 6\n2 7\n"],"sample_outputs":["3\n6\n","20\n20\n20\n"],"human_solution":"import core.stdc.stdio : scanf;\r\nimport std.algorithm;\r\nimport std.math;\r\nimport std.range;\r\nimport std.stdio;\r\n\r\nvoid main() {\r\n int N, T; scanf(\"%d %d\\n\", &N, &T);\r\n auto A = new int[N]; {\r\n foreach (ref a; A) {\r\n scanf(\"%d\", &a);\r\n }\r\n }\r\n auto L = new int[T];\r\n auto R = new int[T]; {\r\n foreach (i; 0 .. T) {\r\n scanf(\"%d %d\", &L[i], &R[i]);\r\n L[i]--;\r\n }\r\n }\r\n\r\n int p = cast(int)(sqrt(cast(real)N));\r\n auto I = iota(T).array.sort!((i, j) {\r\n int qi = L[i] \/ p, qj = L[j] \/ p;\r\n if (qi == qj) {\r\n return R[i] < R[j];\r\n } else {\r\n return qi < qj;\r\n }\r\n }).array;\r\n\r\n int x = 0, y = 0;\r\n long[] K = new long[A.reduce!max + 1];\r\n \/\/long[long] K;\r\n long S = 0;\r\n auto ans = new long[T];\r\n foreach (i; I) {\r\n int l = L[i], r = R[i];\r\n int dy = (r - y > 0 ? +1 : -1);\r\n while (y != r) {\r\n int s = A[ dy > 0 ? y : y - 1 ];\r\n long pk = K[s];\r\n \/\/long pk = K.get(s, 0);\r\n long nk = pk + (dy > 0 ? +1 : -1);\r\n S += s * (nk * nk - pk * pk);\r\n y += dy;\r\n K[s] = nk;\r\n }\r\n int dx = (l - x > 0 ? +1 : -1);\r\n while (x != l) {\r\n int s = A[ dx > 0 ? x : x - 1 ];\r\n long pk = K[s];\r\n \/\/long pk = K.get(s, 0);\r\n long nk = pk + (dx > 0 ? -1 : +1);\r\n S += s * (nk * nk - pk * pk);\r\n x += dx;\r\n K[s] = nk;\r\n }\r\n ans[i] = S;\r\n }\r\n foreach (a; ans) writeln(a);\r\n}\r\n","testcases":"[{'input': ['3 2\\r\\n1 2 1\\r\\n1 2\\r\\n1 3\\r\\n'], 'output': ['3\\r\\n6\\r\\n']}, {'input': ['8 3\\r\\n1 1 2 2 1 3 1 1\\r\\n2 7\\r\\n1 6\\r\\n2 7\\r\\n'], 'output': ['20\\r\\n20\\r\\n20\\r\\n']}, {'input': ['20 8\\r\\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\\r\\n4 15\\r\\n1 2\\r\\n2 20\\r\\n7 7\\r\\n13 18\\r\\n7 7\\r\\n3 19\\r\\n3 8\\r\\n'], 'output': ['108\\r\\n3\\r\\n281\\r\\n1\\r\\n27\\r\\n1\\r\\n209\\r\\n27\\r\\n']}, {'input': ['10 5\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n4 8\\r\\n1 10\\r\\n3 9\\r\\n2 2\\r\\n5 10\\r\\n'], 'output': ['25\\r\\n55\\r\\n35\\r\\n9\\r\\n21\\r\\n']}, {'input': ['8 10\\r\\n100 100 100 100 100 100 100 100\\r\\n1 8\\r\\n2 8\\r\\n3 8\\r\\n4 8\\r\\n5 8\\r\\n6 8\\r\\n7 8\\r\\n8 8\\r\\n1 1\\r\\n1 5\\r\\n'], 'output': ['6400\\r\\n4900\\r\\n3600\\r\\n2500\\r\\n1600\\r\\n900\\r\\n400\\r\\n100\\r\\n100\\r\\n2500\\r\\n']}, {'input': ['1 2\\r\\n1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n1\\r\\n']}, {'input': ['1 1\\r\\n1000000\\r\\n1 1\\r\\n'], 'output': ['1000000\\r\\n']}, {'input': ['5 15\\r\\n103 45 103 67 45\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 2\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n3 3\\r\\n3 4\\r\\n3 5\\r\\n4 4\\r\\n4 5\\r\\n5 5\\r\\n'], 'output': ['103\\r\\n148\\r\\n457\\r\\n524\\r\\n659\\r\\n45\\r\\n148\\r\\n215\\r\\n350\\r\\n103\\r\\n170\\r\\n215\\r\\n67\\r\\n112\\r\\n45\\r\\n']}, {'input': ['8 10\\r\\n5 7 3 1 4 2 1 1\\r\\n5 7\\r\\n3 8\\r\\n2 7\\r\\n4 8\\r\\n4 5\\r\\n2 8\\r\\n4 6\\r\\n1 2\\r\\n4 7\\r\\n3 5\\r\\n'], 'output': ['7\\r\\n18\\r\\n20\\r\\n15\\r\\n5\\r\\n25\\r\\n7\\r\\n12\\r\\n10\\r\\n8\\r\\n']}, {'input': ['9 10\\r\\n5 3 10 2 4 8 7 5 1\\r\\n6 9\\r\\n1 8\\r\\n3 3\\r\\n2 7\\r\\n3 5\\r\\n4 6\\r\\n9 9\\r\\n8 8\\r\\n1 9\\r\\n5 6\\r\\n'], 'output': ['21\\r\\n54\\r\\n10\\r\\n34\\r\\n16\\r\\n14\\r\\n1\\r\\n5\\r\\n55\\r\\n12\\r\\n']}, {'input': ['9 10\\r\\n10 2 6 2 4 6 6 4 1\\r\\n4 8\\r\\n8 9\\r\\n2 3\\r\\n8 9\\r\\n9 9\\r\\n4 5\\r\\n1 7\\r\\n6 6\\r\\n6 8\\r\\n1 1\\r\\n'], 'output': ['42\\r\\n5\\r\\n8\\r\\n5\\r\\n1\\r\\n6\\r\\n76\\r\\n6\\r\\n28\\r\\n10\\r\\n']}, {'input': ['10 10\\r\\n5 10 9 2 9 3 5 5 6 5\\r\\n5 10\\r\\n2 2\\r\\n3 10\\r\\n4 8\\r\\n1 3\\r\\n1 5\\r\\n5 5\\r\\n10 10\\r\\n8 9\\r\\n6 10\\r\\n'], 'output': ['63\\r\\n10\\r\\n92\\r\\n34\\r\\n24\\r\\n53\\r\\n9\\r\\n5\\r\\n11\\r\\n54\\r\\n']}, {'input': ['9 10\\r\\n6 2 3 1 4 8 5 9 8\\r\\n3 9\\r\\n6 6\\r\\n9 9\\r\\n9 9\\r\\n9 9\\r\\n2 3\\r\\n3 9\\r\\n3 8\\r\\n6 9\\r\\n5 6\\r\\n'], 'output': ['54\\r\\n8\\r\\n8\\r\\n8\\r\\n8\\r\\n5\\r\\n54\\r\\n30\\r\\n46\\r\\n12\\r\\n']}]","id":631} {"difficulty":2400,"lang":"D","lang_cluster":"D","src_uid":"983_C","execute_outcome":"RUNTIME_ERROR","source_code":"import std.stdio, std.array, std.string, std.conv, std.algorithm;\nimport std.typecons, std.range, std.random, std.math, std.container;\nimport std.numeric, std.bigint, core.bitop, std.bitmanip;\n\nvoid main() {\n immutable int INF = 1 << 29;\n\n int[] unfold(int n) {\n return [n \/ 1000 % 10, n \/ 100 % 10, n \/ 10 % 10, n % 10];\n }\n\n int fold(int[] a) {\n int[] b = a.dup;\n b.sort!\"a > b\";\n return b[0] + b[1] * 10 + b[2] * 100 + b[3] * 1000;\n }\n \n auto N = readln.chomp.to!int;\n auto src = new int[](N);\n auto dst = new int[](N);\n foreach (i; 0..N) {\n auto s = readln.split.map!(to!int);\n src[i] = s[0];\n dst[i] = s[1];\n }\n\n auto dp = new int[][](N+1, 10000);\n foreach (i; 0..N+1) dp[i].fill(INF);\n dp[0][0] = 0;\n\n foreach (i; 0..N) {\n int cur = i == 0 ? 1 : src[i-1];\n int tar = src[i];\n foreach (a; 0..10) {\n foreach (b; a..10) {\n foreach (c; b..10) {\n foreach (d; c..10) {\n foreach (k; 1..10) {\n int[] v = [a, b, c, d];\n int fv = fold(v);\n if (dp[i][fv] >= INF) continue;\n int hi = max(cur, tar, k);\n int lo = min(cur, tar, k);\n int cost = 1;\n foreach (j; 0..4) if (lo <= v[j] && v[j] <= hi) v[j] = 0, cost += 1;\n int z = -1;\n foreach (j; 0..4) if (v[j] == 0) z = j;\n if (z == -1) continue;\n v[z] = dst[i];\n int dist = abs(cur - k) + abs(k - tar);\n dp[i+1][fv] = min(dp[i+1][fv], dp[i][d + c*10 + b*100 + a*1000] + dist + cost);\n }\n }\n }\n }\n }\n }\n\n\n int ans = INF;\n \n foreach (a; 0..10) {\n foreach (b; a..10) {\n foreach (c; b..10) {\n foreach (d; c..10) {\n int[] v = [a, b, c, d];\n if (v.all!\"a == 0\") {\n ans = min(ans, dp[N][0]);\n continue;\n }\n int hi = (src.back, v.filter!\"a != 0\".reduce!max);\n int lo = (src.back, v.filter!\"a != 0\".reduce!min);\n int cost = (a != 0) + (b != 0) + (c != 0) + (d != 0);\n int dist = min(abs(src.back - hi) + abs(hi - lo), abs(src.back - lo) + abs(lo - hi));\n ans = min(ans, dp[N][fold([a, b, c, d])] + dist + cost);\n }\n }\n }\n }\n\n ans.writeln;\n}\n","description":"You work in a big office. It is a 9\u00a0floor building with an elevator that can accommodate up to 4\u00a0people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you know the order in which people came to the elevator.According to the company's rules, if an employee comes to the elevator earlier than another one, he has to enter the elevator earlier too (even if these employees stay on different floors). Note that the employees are allowed to leave the elevator in arbitrary order.The elevator has two commands: Go up or down one floor. The movement takes 1 second. Open the doors on the current floor. During this operation all the employees who have reached their destination get out of the elevator. Then all the employees on the floor get in the elevator in the order they are queued up while it doesn't contradict the company's rules and there is enough space in the elevator. Each employee spends 1 second to get inside and outside the elevator. Initially the elevator is empty and is located on the floor 1.You are interested what is the minimum possible time you need to spend to deliver all the employees to their destination. It is not necessary to return the elevator to the floor 1.","input_specification":"The first line contains an integer n (1\u2264n\u22642000)\u00a0\u2014 the number of employees.\nThe i-th of the next n lines contains two integers ai and bi (1\u2264ai,bi\u22649, ai\u2260bi)\u00a0\u2014 the floor on which an employee initially is, and the floor he wants to reach.\nThe employees are given in the order they came to the elevator.\n","output_specification":"Print a single integer\u00a0\u2014 the minimal possible time in seconds.\n","notes":" Explaination for the first sample t=0 t=2\n t=3\n t=5\n t=6\n t=7\n t=9\n t=10\n\n","sample_inputs":["2\n3 5\n5 3\n","2\n5 3\n3 5\n"],"sample_outputs":["10","12"],"human_solution":"import std.algorithm;\r\nimport std.conv;\r\nimport std.math;\r\nimport std.stdio;\r\n\r\nimmutable int infinity = int.max \/ 4;\r\nimmutable int totalLevels = 9;\r\nimmutable int NA = -1;\r\n\r\nvoid main ()\r\n{\r\n\tint n;\r\n\twhile (readf (\" %s\", &n) > 0)\r\n\t{\r\n\t\tauto src = new int [n];\r\n\t\tauto dst = new int [n];\r\n\t\tforeach (i; 0..n)\r\n\t\t{\r\n\t\t\treadf (\" %s %s\", &src[i], &dst[i]);\r\n\t\t}\r\n\t\tsrc[] -= 1;\r\n\t\tdst[] -= 1;\r\n\r\n\t\talias State = int [4];\r\n\t\tState [] states;\r\n\t\tint [State] stateNum;\r\n\t\tforeach (a; NA..totalLevels)\r\n\t\t{\r\n\t\t\tforeach (b; a..totalLevels)\r\n\t\t\t{\r\n\t\t\t\tforeach (c; b..totalLevels)\r\n\t\t\t\t{\r\n\t\t\t\t\tforeach (d; c..totalLevels)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tState state = [a, b, c, d];\r\n\t\t\t\t\t\tdo\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstateNum[state] =\r\n\t\t\t\t\t\t\t states.length\r\n\t\t\t\t\t\t\t .to !(int);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\twhile (nextPermutation\r\n\t\t\t\t\t\t (state[]));\r\n\t\t\t\t\t\tstates ~= state;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\timmutable int totalStates = 715;\r\n\t\tassert (totalStates == states.length);\r\n\r\n\t\tauto f = new int [totalLevels] [] [] (n + 1, totalStates);\r\n\t\tforeach (i; 0..n + 1)\r\n\t\t{\r\n\t\t\tforeach (stateIndex; 0..totalStates)\r\n\t\t\t{\r\n\t\t\t\tf[i][stateIndex][] = infinity;\r\n\t\t\t}\r\n\t\t}\r\n\t\tf[0][0][0] = 0;\r\n\r\n\t\tint res = infinity;\r\n\t\tforeach (i; 0..n + 1)\r\n\t\t{\r\n\t\t\tforeach_reverse (stateIndex; 0..totalStates)\r\n\t\t\t{\r\n\t\t\t\tauto curState = states[stateIndex];\r\n\t\t\t\tforeach (level; 0..totalLevels)\r\n\t\t\t\t{\r\n\t\t\t\t\tauto cur = f[i][stateIndex][level];\r\n\t\t\t\t\tif (cur >= infinity)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tforeach (j, v; curState)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (v == NA)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tauto nextValue = cur + abs\r\n\t\t\t\t\t\t (level - v) + 1;\r\n\t\t\t\t\t\tauto nextState = curState;\r\n\t\t\t\t\t\tnextState[j] = NA;\r\n\t\t\t\t\t\tauto nextIndex =\r\n\t\t\t\t\t\t stateNum[nextState];\r\n\t\t\t\t\t\tf[i][nextIndex][v] =\r\n\t\t\t\t\t\t min (f[i][nextIndex][v],\r\n\t\t\t\t\t\t nextValue);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (i < n && curState[0] == NA)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tauto u = src[i];\r\n\t\t\t\t\t\tauto nextValue = cur + abs\r\n\t\t\t\t\t\t (level - u) + 1;\r\n\t\t\t\t\t\tauto nextState = curState;\r\n\t\t\t\t\t\tnextState[0] = dst[i];\r\n\t\t\t\t\t\tauto nextIndex =\r\n\t\t\t\t\t\t stateNum[nextState];\r\n\t\t\t\t\t\tf[i + 1][nextIndex][u] =\r\n\t\t\t\t\t\t min (f[i + 1][nextIndex]\r\n\t\t\t\t\t\t [u], nextValue);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\twriteln (minElement (f[n][0][]));\r\n\t}\r\n}\r\n","testcases":"[{'input': ['2\\r\\n3 5\\r\\n5 3\\r\\n'], 'output': ['10']}, {'input': ['2\\r\\n5 3\\r\\n3 5\\r\\n'], 'output': ['12']}, {'input': ['9\\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 1\\r\\n'], 'output': ['34']}, {'input': ['50\\r\\n9 5\\r\\n2 6\\r\\n5 4\\r\\n7 5\\r\\n3 6\\r\\n5 8\\r\\n1 2\\r\\n6 1\\r\\n9 7\\r\\n8 1\\r\\n9 5\\r\\n6 8\\r\\n6 8\\r\\n2 8\\r\\n4 9\\r\\n6 7\\r\\n7 8\\r\\n5 8\\r\\n1 2\\r\\n9 2\\r\\n5 9\\r\\n6 7\\r\\n3 2\\r\\n9 8\\r\\n7 8\\r\\n7 4\\r\\n6 5\\r\\n1 7\\r\\n6 5\\r\\n2 6\\r\\n3 1\\r\\n6 5\\r\\n3 7\\r\\n9 3\\r\\n8 1\\r\\n8 3\\r\\n8 2\\r\\n1 9\\r\\n9 2\\r\\n3 2\\r\\n8 7\\r\\n5 1\\r\\n6 2\\r\\n2 1\\r\\n6 1\\r\\n3 4\\r\\n4 1\\r\\n2 3\\r\\n2 6\\r\\n2 9\\r\\n'], 'output': ['278']}, {'input': ['50\\r\\n8 9\\r\\n6 7\\r\\n6 8\\r\\n4 1\\r\\n3 2\\r\\n9 3\\r\\n8 3\\r\\n9 7\\r\\n4 6\\r\\n4 6\\r\\n5 6\\r\\n7 2\\r\\n6 3\\r\\n1 3\\r\\n8 2\\r\\n4 6\\r\\n6 8\\r\\n7 6\\r\\n8 6\\r\\n9 4\\r\\n8 6\\r\\n9 1\\r\\n3 8\\r\\n3 1\\r\\n4 7\\r\\n4 9\\r\\n9 1\\r\\n7 4\\r\\n3 5\\r\\n1 7\\r\\n3 5\\r\\n8 9\\r\\n5 4\\r\\n2 9\\r\\n2 9\\r\\n3 9\\r\\n8 5\\r\\n4 9\\r\\n9 4\\r\\n5 6\\r\\n6 1\\r\\n4 2\\r\\n3 9\\r\\n9 1\\r\\n9 4\\r\\n4 5\\r\\n2 4\\r\\n2 6\\r\\n3 6\\r\\n1 9\\r\\n'], 'output': ['252']}, {'input': ['50\\r\\n3 9\\r\\n8 9\\r\\n7 2\\r\\n9 1\\r\\n5 2\\r\\n2 8\\r\\n2 4\\r\\n8 6\\r\\n4 6\\r\\n1 6\\r\\n5 3\\r\\n3 8\\r\\n8 2\\r\\n6 7\\r\\n7 1\\r\\n2 4\\r\\n2 8\\r\\n3 7\\r\\n7 1\\r\\n7 9\\r\\n9 3\\r\\n7 2\\r\\n2 7\\r\\n8 4\\r\\n5 8\\r\\n6 8\\r\\n7 1\\r\\n7 5\\r\\n5 6\\r\\n9 1\\r\\n8 6\\r\\n3 6\\r\\n7 6\\r\\n4 3\\r\\n3 2\\r\\n9 2\\r\\n4 9\\r\\n2 1\\r\\n7 9\\r\\n1 8\\r\\n4 9\\r\\n5 2\\r\\n7 2\\r\\n9 8\\r\\n3 1\\r\\n4 5\\r\\n3 4\\r\\n2 7\\r\\n2 1\\r\\n6 1\\r\\n'], 'output': ['260']}, {'input': ['50\\r\\n7 1\\r\\n4 8\\r\\n9 3\\r\\n9 3\\r\\n2 4\\r\\n5 9\\r\\n1 5\\r\\n1 4\\r\\n7 6\\r\\n4 8\\r\\n3 6\\r\\n2 8\\r\\n5 1\\r\\n8 9\\r\\n7 4\\r\\n7 2\\r\\n2 4\\r\\n7 9\\r\\n8 7\\r\\n3 8\\r\\n1 7\\r\\n4 5\\r\\n7 2\\r\\n6 4\\r\\n6 1\\r\\n4 8\\r\\n5 6\\r\\n4 3\\r\\n6 5\\r\\n6 4\\r\\n6 9\\r\\n2 5\\r\\n9 3\\r\\n3 4\\r\\n3 4\\r\\n9 3\\r\\n7 9\\r\\n5 8\\r\\n1 6\\r\\n5 1\\r\\n8 3\\r\\n7 4\\r\\n1 8\\r\\n5 2\\r\\n1 7\\r\\n6 1\\r\\n9 6\\r\\n3 1\\r\\n6 5\\r\\n9 7\\r\\n'], 'output': ['274']}, {'input': ['50\\r\\n1 9\\r\\n9 4\\r\\n4 2\\r\\n2 4\\r\\n3 8\\r\\n9 5\\r\\n3 2\\r\\n8 3\\r\\n8 1\\r\\n4 7\\r\\n5 3\\r\\n2 6\\r\\n1 8\\r\\n6 5\\r\\n4 1\\r\\n5 7\\r\\n1 4\\r\\n4 7\\r\\n5 4\\r\\n8 2\\r\\n4 6\\r\\n8 7\\r\\n1 9\\r\\n1 6\\r\\n6 4\\r\\n5 2\\r\\n5 3\\r\\n2 6\\r\\n4 6\\r\\n5 2\\r\\n6 7\\r\\n5 3\\r\\n9 5\\r\\n8 3\\r\\n1 9\\r\\n2 6\\r\\n5 1\\r\\n7 3\\r\\n4 3\\r\\n7 2\\r\\n4 3\\r\\n5 7\\r\\n6 8\\r\\n8 2\\r\\n3 6\\r\\n4 9\\r\\n1 8\\r\\n7 8\\r\\n5 4\\r\\n7 6\\r\\n'], 'output': ['258']}, {'input': ['50\\r\\n5 9\\r\\n1 2\\r\\n6 9\\r\\n1 6\\r\\n8 1\\r\\n5 3\\r\\n2 1\\r\\n2 7\\r\\n6 1\\r\\n4 3\\r\\n6 1\\r\\n2 6\\r\\n2 8\\r\\n2 1\\r\\n3 4\\r\\n6 2\\r\\n4 8\\r\\n6 4\\r\\n2 1\\r\\n1 5\\r\\n4 9\\r\\n6 8\\r\\n4 1\\r\\n1 6\\r\\n1 5\\r\\n5 9\\r\\n2 6\\r\\n6 9\\r\\n4 2\\r\\n4 7\\r\\n8 2\\r\\n4 6\\r\\n2 5\\r\\n9 4\\r\\n3 1\\r\\n8 4\\r\\n3 9\\r\\n1 3\\r\\n2 3\\r\\n8 7\\r\\n5 4\\r\\n2 6\\r\\n9 5\\r\\n6 2\\r\\n5 8\\r\\n2 8\\r\\n8 9\\r\\n9 2\\r\\n5 3\\r\\n9 1\\r\\n'], 'output': ['282']}, {'input': ['50\\r\\n9 8\\r\\n8 9\\r\\n2 3\\r\\n2 6\\r\\n7 6\\r\\n9 8\\r\\n7 5\\r\\n8 5\\r\\n2 9\\r\\n4 2\\r\\n4 6\\r\\n9 4\\r\\n1 9\\r\\n4 8\\r\\n7 9\\r\\n7 4\\r\\n4 7\\r\\n7 6\\r\\n8 9\\r\\n2 8\\r\\n1 3\\r\\n6 7\\r\\n6 3\\r\\n1 8\\r\\n9 3\\r\\n4 9\\r\\n9 6\\r\\n4 2\\r\\n6 5\\r\\n3 8\\r\\n9 3\\r\\n7 5\\r\\n9 6\\r\\n5 6\\r\\n4 7\\r\\n5 7\\r\\n9 1\\r\\n7 5\\r\\n5 6\\r\\n3 1\\r\\n4 3\\r\\n7 1\\r\\n9 8\\r\\n7 8\\r\\n3 7\\r\\n8 3\\r\\n9 6\\r\\n5 7\\r\\n1 8\\r\\n6 4\\r\\n'], 'output': ['275']}, {'input': ['9\\r\\n2 1\\r\\n5 9\\r\\n2 6\\r\\n2 6\\r\\n4 7\\r\\n7 3\\r\\n3 1\\r\\n3 1\\r\\n7 8\\r\\n'], 'output': ['46']}, {'input': ['5\\r\\n1 7\\r\\n2 5\\r\\n8 6\\r\\n3 4\\r\\n1 6\\r\\n'], 'output': ['29']}, {'input': ['4\\r\\n2 1\\r\\n1 7\\r\\n5 8\\r\\n8 4\\r\\n'], 'output': ['21']}, {'input': ['1\\r\\n1 9\\r\\n'], 'output': ['10']}, {'input': ['1\\r\\n9 1\\r\\n'], 'output': ['18']}, {'input': ['1\\r\\n1 5\\r\\n'], 'output': ['6']}, {'input': ['1\\r\\n8 6\\r\\n'], 'output': ['11']}]","id":632} {"difficulty":1600,"lang":"D","lang_cluster":"D","src_uid":"992_B","execute_outcome":"WRONG_ANSWER","source_code":"import core.bitop, std.bitmanip;\r\nimport std.algorithm, std.functional;\r\nimport std.array, std.container;\r\nimport std.conv;\r\nimport std.math, std.numeric;\r\nimport std.range, std.range.interfaces;\r\nimport std.stdio, std.string;\r\nimport std.typecons;\r\n\r\nimmutable int INF = 10L ^^ 9 + 23;\r\n\r\nvoid main()\r\n{\r\n int le, r, x, y;\r\n readf(\"%s %s %s %s\", &le, &r, &x, &y);\r\n readln;\r\n \r\n int g = y \/ x;\r\n \r\n int[] dvs;\r\n int k = 2;\r\n while (g > 1 && k <= g \/ k) {\r\n while (g % k == 0) {\r\n dvs ~= k;\r\n g \/= k;\r\n }\r\n k += 1;\r\n }\r\n if (g > 1) dvs ~= g;\r\n \r\n int mx = 1 << dvs.length;\r\n bool[int] chckd;\r\n int ans = 0;\r\n for (int i = 0; i < mx; ++i) {\r\n int a = x, b = x;\r\n for (int j = 0; j < dvs.length; ++j) {\r\n if (i & (1 << j)) {\r\n a *= dvs[j];\r\n } else {\r\n b *= dvs[j];\r\n }\r\n }\r\n \r\n if (chckd.get(a, false)) continue;\r\n if (a < le || a > r) continue;\r\n if (b < le || b > r) continue;\r\n if (gcd(a, b) != x) continue;\r\n \r\n ++ans;\r\n chckd[a] = true;\r\n debug { a.writeln; }\r\n }\r\n \r\n ans.writeln;\r\n}","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,b) good, if GCD(a,b)=x and LCM(a,b)=y, where GCD(a,b) denotes the greatest common divisor of a and b, and LCM(a,b) 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,b) such that l\u2264a,b\u2264r. Note that pairs (a,b) and (b,a) are considered different if a\u2260b.","input_specification":"The only line contains four integers l,r,x,y (1\u2264l\u2264r\u226410^9, 1\u2264x\u2264y\u226410^9).\n","output_specification":"In the only line print the only integer\u00a0\u2014 the answer for the problem.\n","notes":"In the first example there are two suitable good pairs of integers (a,b): (1,2) and (2,1).\nIn the second example there are four suitable good pairs of integers (a,b): (1,12), (12,1), (3,4) and (4,3).\nIn the third example there are good pairs of integers, for example, (3,30), but none of them fits the condition l\u2264a,b\u2264r.\n","sample_inputs":["1 2 1 2\n","1 12 1 12\n","50 100 3 30\n"],"sample_outputs":["2\n","4\n","0\n"],"human_solution":"import std.algorithm;\r\nimport std.array;\r\nimport std.conv;\r\nimport std.numeric;\r\nimport std.range;\r\nimport std.stdio;\r\nimport std.string;\r\nimport std.typecons;\r\n\r\nvoid main ()\r\n{\r\n\tlong l, r, x, y;\r\n\twhile (readf (\" %s %s %s %s\", &l, &r, &x, &y) > 0)\r\n\t{\r\n\t\tauto total = x * y;\r\n\t\tlong [] divsX;\r\n\t\tfor (long d = 1; d * d <= x; d++)\r\n\t\t{\r\n\t\t\tif (x % d == 0)\r\n\t\t\t{\r\n\t\t\t\tdivsX ~= d;\r\n\t\t\t\tif (d * d < x)\r\n\t\t\t\t{\r\n\t\t\t\t\tdivsX ~= x \/ d;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tlong [] divsY;\r\n\t\tfor (long d = 1; d * d <= y; d++)\r\n\t\t{\r\n\t\t\tif (y % d == 0)\r\n\t\t\t{\r\n\t\t\t\tdivsY ~= d;\r\n\t\t\t\tif (d * d < y)\r\n\t\t\t\t{\r\n\t\t\t\t\tdivsY ~= y \/ d;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tint [long] v;\r\n\t\tforeach (p; divsX)\r\n\t\t{\r\n\t\t\tforeach (q; divsY)\r\n\t\t\t{\r\n\t\t\t\tv[p * q] += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\tint res = 0;\r\n\t\tforeach (key, value; v)\r\n\t\t{\r\n\t\t\tauto temp = total \/ key;\r\n\t\t\tdebug {writeln (key, \" \", temp);}\r\n\t\t\tif (gcd (key, temp) == x &&\r\n\t\t\t l <= key && key <= r &&\r\n\t\t\t l <= temp && temp <= r)\r\n\t\t\t{\r\n\t\t\t\tres += 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\twriteln (res);\r\n\t}\r\n}\r\n","testcases":"[{'input': ['1 2 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 12 1 12\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['50 100 3 30\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000000000 1 1000000000\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 1000000000 158260522 200224287\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000000000 2 755829150\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 1000000000 158260522 158260522\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1000000000 877914575 877914575\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['232 380232688 116 760465376\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['47259 3393570 267 600661890\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['1 1000000000 1 672672000\\r\\n'], 'output': ['64\\r\\n']}, {'input': ['1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1000000000 1 649209600\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['1 1000000000 1 682290000\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['1 1000000000 1 228614400\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 1 800280000\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['1 1000000000 1 919987200\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 1 456537870\\r\\n'], 'output': ['64\\r\\n']}, {'input': ['1 1000000000 1 7198102\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 1000000000 1 58986263\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 1 316465536\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 1 9558312\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 1 5461344\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['58 308939059 29 617878118\\r\\n'], 'output': ['62\\r\\n']}, {'input': ['837 16262937 27 504151047\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['47275 402550 25 761222050\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['22 944623394 22 944623394\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['1032 8756124 12 753026664\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['7238 939389 11 618117962\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['58351 322621 23 818489477\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3450 7068875 25 975504750\\r\\n'], 'output': ['86\\r\\n']}, {'input': ['13266 1606792 22 968895576\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['21930 632925 15 925336350\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['2193 4224517 17 544962693\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['526792 39807152 22904 915564496\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['67728 122875524 16932 491502096\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['319813 63298373 24601 822878849\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['572464 23409136 15472 866138032\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['39443 809059020 19716 777638472\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['2544768 8906688 27072 837228672\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['413592 46975344 21768 892531536\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['11349 816231429 11349 816231429\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['16578 939956022 16578 939956022\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2783175 6882425 21575 887832825\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2862252 7077972 22188 913058388\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1856828 13124976 25436 958123248\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100 1000000000 158260522 158260522\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 1000000000 877914575 877914575\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 1000000000 602436426 602436426\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 1000000000 24979445 24979445\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1000000000 18470 112519240\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 1000000000 22692 2201124\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1000000000 24190 400949250\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 33409 694005157\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1000000000 24967 470827686\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['1 1000000000 35461 152517761\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['2 1000000000 158260522 200224287\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1000000000 602436426 611751520\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1000000000 861648772 942726551\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1000000000 433933447 485982495\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1000000000 262703497 480832794\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2672374 422235092 1336187 844470184\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1321815 935845020 1321815 935845020\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['29259607 69772909 2250739 907047817\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['11678540 172842392 2335708 864211960\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['297 173688298 2876112 851329152\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['7249 55497026 659 610467286\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['398520 1481490 810 728893080\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2354 369467362 1177 738934724\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['407264 2497352 1144 889057312\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['321399 1651014 603 879990462\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['475640 486640 440 526057840\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['631714 179724831 1136 717625968\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['280476 1595832 588 761211864\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['10455 39598005 615 673166085\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['24725 19759875 575 849674625\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['22 158 2 1738\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2623 1 2623\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7 163677675 3 18\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['159 20749927 1 158\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5252 477594071 1 5251\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2202 449433679 3 6603\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 111 3 222\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['26 46 2 598\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['26 82 2 1066\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2993 1 2993\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['17 17 1 289\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['177 267 3 15753\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['7388 22705183 1 7387\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 100 3 100\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000 6 1024\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 100 2 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 10000 2 455\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000000000 250000000 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 3 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000000000 100000000 1000000000\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 10 3 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000 5 13\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 2 3 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000000000 499999993 999999986\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1 1 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 10 10 100\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 1000 4 36\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1000000000 10000000 20000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100 100 5 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3 3 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['36 200 24 144\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 100 3 10\\r\\n'], 'output': ['0\\r\\n']}]","id":633} {"difficulty":1000,"lang":"Perl","lang_cluster":"Perl","src_uid":"106_A","execute_outcome":"WRONG_ANSWER","source_code":"\n\nsub greater{\n\t$a = $_[0];\n\t$b = $_[1];\n\t\n\t$a =~ tr\/[T,J,Q,K,A]\/[1,2,3,4,5]\/;\n\t$b =~ tr\/[T,J,Q,K,A]\/[1,2,3,4,5]\/;\n\t\n\t$a = ($a + 4) % 10;\n\t$b = ($b + 4) % 10;\n\n\treturn ($a > $b);\n\n}\n\n\n$trump = split(\/\/, <>);\n($rank1, $suit1, $dummy, $rank2, $suit2)= split(\/\/, <>);\n \nif(($suit1 == $trump) or($suit1 == $suit2 and greater($rank1, $rank2))){\n\tprint \"YES\";\n}else{\n\tprint \"NO\";\n}\n","description":"There is a card game called \"Durak\", which means \"Fool\" in Russian. The game is quite popular in the countries that used to form USSR. The problem does not state all the game's rules explicitly \u2014 you can find them later yourselves if you want.To play durak you need a pack of 36 cards. Each card has a suit (\"S\", \"H\", \"D\" and \"C\") and a rank (in the increasing order \"6\", \"7\", \"8\", \"9\", \"T\", \"J\", \"Q\", \"K\" and \"A\"). At the beginning of the game one suit is arbitrarily chosen as trump. The players move like that: one player puts one or several of his cards on the table and the other one should beat each of them with his cards.A card beats another one if both cards have similar suits and the first card has a higher rank then the second one. Besides, a trump card can beat any non-trump card whatever the cards\u2019 ranks are. In all other cases you can not beat the second card with the first one.You are given the trump suit and two different cards. Determine whether the first one beats the second one or not.","input_specification":"The first line contains the tramp suit. It is \"S\", \"H\", \"D\" or \"C\".\nThe second line contains the description of the two different cards. Each card is described by one word consisting of two symbols. The first symbol stands for the rank (\"6\", \"7\", \"8\", \"9\", \"T\", \"J\", \"Q\", \"K\" and \"A\"), and the second one stands for the suit (\"S\", \"H\", \"D\" and \"C\").\n","output_specification":"Print \"YES\" (without the quotes) if the first cards beats the second one. Otherwise, print \"NO\" (also without the quotes).\n","notes":null,"sample_inputs":["H\nQH 9S\n","S\n8D 6D\n","C\n7H AS\n"],"sample_outputs":["YES\n","YES","NO"],"human_solution":"$suit=<>;\r\n$p1=<>;\r\nchomp($suit);\r\n@a1=split('',$p1);\r\n%h=(\"6\"=>1, \"7\"=>2, \"8\"=>3, \"9\"=>4, \"T\"=>5, \"J\"=>6, \"Q\"=>7, \"K\"=>8,\"A\"=>9);\r\nif(@a1[1] eq @a1[4])\r\n{\r\n\tif($h{@a1[0]}>$h{@a1[3]}){ print \"YES\";}\r\n\telse {print \"NO\";}\r\n}\r\nelse {\r\n\tif(@a1[1] eq $suit){ print \"YES\";}\r\n\telse {print \"NO\";}\r\n}","testcases":"[{'input': ['H\\r\\nQH 9S\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['S\\r\\n8D 6D\\r\\n'], 'output': ['YES']}, {'input': ['C\\r\\n7H AS\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nKC 9C\\r\\n'], 'output': ['YES']}, {'input': ['D\\r\\n7D KD\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n7H KD\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['D\\r\\nAS AH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nKH KS\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['C\\r\\n9H 6C\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\n9H JC\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\nTD JD\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n6S 7S\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\n7S 8S\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\n8H 9H\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\n9D TD\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nTC JC\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nJH QH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nQD KD\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\nKS AS\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\nAH 6H\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\n7D 6D\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\n8H 7H\\r\\n'], 'output': ['YES']}, {'input': ['D\\r\\n9S 8S\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\nTC 9C\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nJS TS\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\nQD JD\\r\\n'], 'output': ['YES']}, {'input': ['D\\r\\nKH QH\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nAD KD\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nQS QD\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nTS TH\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\n6C 6D\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['H\\r\\n8H 8D\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['S\\r\\n7D 7S\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nJC JH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n8H 9C\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['D\\r\\n9D 6S\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['C\\r\\nJC AH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['S\\r\\nAS KD\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['S\\r\\n7S JS\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nTH 8H\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\n7S QS\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nKC QC\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\nAD 9S\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\n7H 8D\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nJC 9H\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\n7S AC\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\n8C 7C\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\n9D 8S\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\nAC KS\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n8C QH\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\n7S TS\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nAH 6S\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\nKS QS\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nAC QC\\r\\n'], 'output': ['YES']}, {'input': ['S\\r\\n9H 8D\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\nTS JS\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\n8H 7C\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nAH 6S\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\n7S QS\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nAH 6S\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\nTS KS\\r\\n'], 'output': ['NO']}, {'input': ['C\\r\\nTH KH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n9C 6D\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n9C 8D\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nTH AH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nTH JH\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nQS 9C\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nKC AC\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nAH KH\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nKS QS\\r\\n'], 'output': ['YES']}, {'input': ['C\\r\\nAD KS\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\nQS 9C\\r\\n'], 'output': ['NO']}, {'input': ['H\\r\\n9D 7S\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\n6D 9S\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['H\\r\\nAH KH\\r\\n'], 'output': ['YES']}, {'input': ['H\\r\\nKC AC\\r\\n'], 'output': ['NO']}, {'input': ['D\\r\\n8S 6C\\r\\n'], 'output': ['NO']}, {'input': ['S\\r\\nAC KC\\r\\n'], 'output': ['YES']}]","id":634} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"110_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\n\nuse 5.012;\nuse warnings;\n\nchomp(my $n = <>);\nprint ((length $n) =~ \/^[47]+$\/ ? 'YES' : 'NO');\n","description":"Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky digits in it is a lucky number. He wonders whether number n is a nearly lucky number.","input_specification":"The only line contains an integer n (1\u2264n\u226410^18).\nPlease do not use the %lld specificator to read or write 64-bit numbers in \u0421++. It is preferred to use the cin, cout streams or the %I64d specificator.\n","output_specification":"Print on the single line \"YES\" if n is a nearly lucky number. Otherwise, print \"NO\" (without the quotes).\n","notes":"In the first sample there are 3 lucky digits (first one and last two), so the answer is \"NO\".\nIn the second sample there are 7 lucky digits, 7 is lucky number, so the answer is \"YES\".\nIn the third sample there are no lucky digits, so the answer is \"NO\".\n","sample_inputs":["40047\n","7747774\n","1000000000000000000\n"],"sample_outputs":["NO\n","YES\n","NO\n"],"human_solution":"use POSIX;\r\nmy $line;\r\nmy %h;\r\nmy @input1;\r\nmy @input2;\r\nmy $dummy;\r\nmy $s = 0;\r\nmy $max = 0;\r\nmy $key1 = 0; my $key2 = 0; my $key3 = 0; my $key4 = 0;\r\n\r\n$line = ;\r\nchomp($line);\r\n@input1 = split('', $line);\r\nif ($line < 10) {\r\n print \"NO\";\r\n exit;\r\n}\r\nforeach $c (split('', $line)) {\r\n if ($c ne '4' && $c ne '7') {\r\n $flag = 1;\r\n } else {\r\n $s++;\r\n }\r\n}\r\nif ($s == 4 || $s == 7) {\r\n print \"YES\";\r\n} else {\r\n print \"NO\";\r\n}","testcases":"[{'input': ['40047\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7747774\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['474404774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4744000695826\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10000000004744744\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['446486416781684178\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999999999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['87414417444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['111222333444555667\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4700\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3794555488744477\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['444444444444444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['474447447774444774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['777777777777777\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['34777745021000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['963\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['855474448854788540\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['999999999999994744\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['400000000474\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['123456789123456789\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['740577777584945874\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7777777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4444000111222333\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['9847745885202111\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['123456000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4744447444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4747477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['777777777444444444\\r\\n'], 'output': ['NO\\r\\n']}]","id":635} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"112_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\n\n$s1 = ;\n$s2 = ;\n\n$s1 gt $s2 && print 1;\n$s1 lt $s2 && print -1;\n$s1 eq $s2 && print 0;\n","description":"Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case does not matter, that is an uppercase letter is considered equivalent to the corresponding lowercase letter. Help Petya perform the comparison.","input_specification":"Each of the first two lines contains a bought string. The strings' lengths range from 1 to 100 inclusive. It is guaranteed that the strings are of the same length and also consist of uppercase and lowercase Latin letters.\n","output_specification":"If the first string is less than the second one, print \"-1\". If the second string is less than the first one, print \"1\". If the strings are equal, print \"0\". Note that the letters' case is not taken into consideration when the strings are compared.\n","notes":"If you want more formal information about the lexicographical order (also known as the \"dictionary order\" or \"alphabetical order\"), you can visit the following site:\n http:\/\/en.wikipedia.org\/wiki\/Lexicographical_order","sample_inputs":["aaaa\naaaA\n","abs\nAbz\n","abcdefg\nAbCdEfF\n"],"sample_outputs":["0\n","-1\n","1\n"],"human_solution":"print lc<>cmp lc<>","testcases":"[{'input': ['aaaa\\r\\naaaA\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abs\\r\\nAbz\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['abcdefg\\r\\nAbCdEfF\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['asadasdasd\\r\\nasdwasdawd\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['aslkjlkasdd\\r\\nasdlkjdajwi\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aAaaaAAaAaaAzZsssSsdDfeEaeqZlpP\\r\\nAaaaAaaAaaAaZzSSSSsDdFeeAeQZLpp\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['bwuEhEveouaTECagLZiqmUdxEmhRSOzMauJRWLQMppZOumxhAmwuGeDIkvkBLvMXwUoFmpAfDprBcFtEwOULcZWRQhcTbTbX\\r\\nHhoDWbcxwiMnCNexOsKsujLiSGcLllXOkRSbnOzThAjnnliLYFFmsYkOfpTxRNEfBsoUHfoLTiqAINRPxWRqrTJhgfkKcDOH\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['kGWUuguKzcvxqKTNpxeDWXpXkrXDvGMFGoXKDfPBZvWSDUyIYBynbKOUonHvmZaKeirUhfmVRKtGhAdBfKMWXDUoqvbfpfHYcg\\r\\ncvOULleuIIiYVVxcLZmHVpNGXuEpzcWZZWyMOwIwbpkKPwCfkVbKkUuosvxYCKjqfVmHfJKbdrsAcatPYgrCABaFcoBuOmMfFt\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['nCeNVIzHqPceNhjHeHvJvgBsNFiXBATRrjSTXJzhLMDMxiJztphxBRlDlqwDFImWeEPkggZCXSRwelOdpNrYnTepiOqpvkr\\r\\nHJbjJFtlvNxIbkKlxQUwmZHJFVNMwPAPDRslIoXISBYHHfymyIaQHLgECPxAmqnOCizwXnIUBRmpYUBVPenoUKhCobKdOjL\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['ttXjenUAlfixytHEOrPkgXmkKTSGYuyVXGIHYmWWYGlBYpHkujueqBSgjLguSgiMGJWATIGEUjjAjKXdMiVbHozZUmqQtFrT\\r\\nJziDBFBDmDJCcGqFsQwDFBYdOidLxxhBCtScznnDgnsiStlWFnEXQrJxqTXKPxZyIGfLIToETKWZBPUIBmLeImrlSBWCkTNo\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['AjQhPqSVhwQQjcgCycjKorWBgFCRuQBwgdVuAPSMJAvTyxGVuFHjfJzkKfsmfhFbKqFrFIohSZBbpjgEHebezmVlGLTPSCTMf\\r\\nXhxWuSnMmKFrCUOwkTUmvKAfbTbHWzzOTzxJatLLCdlGnHVaBUnxDlsqpvjLHMThOPAFBggVKDyKBrZAmjnjrhHlrnSkyzBja\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['HCIgYtnqcMyjVngziNflxKHtdTmcRJhzMAjFAsNdWXFJYEhiTzsQUtFNkAbdrFBRmvLirkuirqTDvIpEfyiIqkrwsjvpPWTEdI\\r\\nErqiiWKsmIjyZuzgTlTqxYZwlrpvRyaVhRTOYUqtPMVGGtWOkDCOOQRKrkkRzPftyQCkYkzKkzTPqqXmeZhvvEEiEhkdOmoMvy\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['mtBeJYILXcECGyEVSyzLFdQJbiVnnfkbsYYsdUJSIRmyzLfTTtFwIBmRLVnwcewIqcuydkcLpflHAFyDaToLiFMgeHvQorTVbI\\r\\nClLvyejznjbRfCDcrCzkLvqQaGzTjwmWONBdCctJAPJBcQrcYvHaSLQgPIJbmkFBhFzuQLBiRzAdNHulCjIAkBvZxxlkdzUWLR\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['tjucSbGESVmVridTBjTmpVBCwwdWKBPeBvmgdxgIVLwQxveETnSdxkTVJpXoperWSgdpPMKNmwDiGeHfxnuqaDissgXPlMuNZIr\\r\\nHfjOOJhomqNIKHvqSgfySjlsWJQBuWYwhLQhlZYlpZwboMpoLoluGsBmhhlYgeIouwdkPfiaAIrkYRlxtiFazOPOllPsNZHcIZd\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['AanbDfbZNlUodtBQlvPMyomStKNhgvSGhSbTdabxGFGGXCdpsJDimsAykKjfBDPMulkhBMsqLmVKLDoesHZsRAEEdEzqigueXInY\\r\\ncwfyjoppiJNrjrOLNZkqcGimrpTsiyFBVgMWEPXsMrxLJDDbtYzerXiFGuLBcQYitLdqhGHBpdjRnkUegmnwhGHAKXGyFtscWDSI\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['HRfxniwuJCaHOcaOVgjOGHXKrwxrDQxJpppeGDXnTAowyKbCsCQPbchCKeTWOcKbySSYnoaTJDnmRcyGPbfXJyZoPcARHBu\\r\\nxkLXvwkvGIWSQaFTznLOctUXNuzzBBOlqvzmVfTSejekTAlwidRrsxkbZTsGGeEWxCXHzqWVuLGoCyrGjKkQoHqduXwYQKC\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['OjYwwNuPESIazoyLFREpObIaMKhCaKAMWMfRGgucEuyNYRantwdwQkmflzfqbcFRaXBnZoIUGsFqXZHGKwlaBUXABBcQEWWPvkjW\\r\\nRxLqGcTTpBwHrHltCOllnTpRKLDofBUqqHxnOtVWPgvGaeHIevgUSOeeDOJubfqonFpVNGVbHFcAhjnyFvrrqnRgKhkYqQZmRfUl\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['tatuhQPIzjptlzzJpCAPXSRTKZRlwgfoCIsFjJquRoIDyZZYRSPdFUTjjUPhLBBfeEIfLQpygKXRcyQFiQsEtRtLnZErBqW\\r\\ntkHUjllbafLUWhVCnvblKjgYIEoHhsjVmrDBmAWbvtkHxDbRFvsXAjHIrujaDbYwOZmacknhZPeCcorbRgHjjgAgoJdjvLo\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['cymCPGqdXKUdADEWDdUaLEEMHiXHsdAZuDnJDMUvxvrLRBrPSDpXPAgMRoGplLtniFRTomDTAHXWAdgUveTxaqKVSvnOyhOwiRN\\r\\nuhmyEWzapiRNPFDisvHTbenXMfeZaHqOFlKjrfQjUBwdFktNpeiRoDWuBftZLcCZZAVfioOihZVNqiNCNDIsUdIhvbcaxpTRWoV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['sSvpcITJAwghVfJaLKBmyjOkhltTGjYJVLWCYMFUomiJaKQYhXTajvZVHIMHbyckYROGQZzjWyWCcnmDmrkvTKfHSSzCIhsXgEZa\\r\\nvhCXkCwAmErGVBPBAnkSYEYvseFKbWSktoqaHYXUmYkHfOkRwuEyBRoGoBrOXBKVxXycjZGStuvDarnXMbZLWrbjrisDoJBdSvWJ\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['hJDANKUNBisOOINDsTixJmYgHNogtpwswwcvVMptfGwIjvqgwTYFcqTdyAqaqlnhOCMtsnWXQqtjFwQlEcBtMFAtSqnqthVb\\r\\nrNquIcjNWESjpPVWmzUJFrelpUZeGDmSvCurCqVmKHKVAAPkaHksniOlzjiKYIJtvbuQWZRufMebpTFPqyxIWWjfPaWYiNlK\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['ycLoapxsfsDTHMSfAAPIUpiEhQKUIXUcXEiopMBuuZLHtfPpLmCHwNMNQUwsEXxCEmKHTBSnKhtQhGWUvppUFZUgSpbeChX\\r\\ndCZhgVXofkGousCzObxZSJwXcHIaqUDSCPKzXntcVmPxtNcXmVcjsetZYxedmgQzXTZHMvzjoaXCMKsncGciSDqQWIIRlys\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['nvUbnrywIePXcoukIhwTfUVcHUEgXcsMyNQhmMlTltZiCooyZiIKRIGVHMCnTKgzXXIuvoNDEZswKoACOBGSyVNqTNQqMhAG\\r\\nplxuGSsyyJjdvpddrSebOARSAYcZKEaKjqbCwvjhNykuaECoQVHTVFMKXwvrQXRaqXsHsBaGVhCxGRxNyGUbMlxOarMZNXxy\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['EncmXtAblQzcVRzMQqdDqXfAhXbtJKQwZVWyHoWUckohnZqfoCmNJDzexFgFJYrwNHGgzCJTzQQFnxGlhmvQTpicTkEeVICKac\\r\\nNIUNZoMLFMyAjVgQLITELJSodIXcGSDWfhFypRoGYuogJpnqGTotWxVqpvBHjFOWcDRDtARsaHarHaOkeNWEHGTaGOFCOFEwvK\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['UG\\r\\nak\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['JZR\\r\\nVae\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['a\\r\\nZ\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['rk\\r\\nkv\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['RvuT\\r\\nbJzE\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['PPS\\r\\nydq\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['q\\r\\nq\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['peOw\\r\\nIgSJ\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['PyK\\r\\noKN\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['O\\r\\ni\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['NmGY\\r\\npDlP\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['nG\\r\\nZf\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['m\\r\\na\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['MWyB\\r\\nWZEV\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['Gre\\r\\nfxc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['Ooq\\r\\nwap\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['XId\\r\\nlbB\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['lfFpECEqUMEOJhipvkZjDPcpDNJedOVXiSMgBvBZbtfzIKekcvpWPCazKAhJyHircRtgcBIJwwstpHaLAgxFOngAWUZRgCef\\r\\nLfFPEcequmeojHIpVkzjDPcpdNJEDOVXiSmGBVBZBtfZikEKcvPwpCAzKAHJyHIrCRTgCbIJWwSTphALagXfOnGAwUzRGcEF\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['DQBdtSEDtFGiNRUeJNbOIfDZnsryUlzJHGTXGFXnwsVyxNtLgmklmFvRCzYETBVdmkpJJIvIOkMDgCFHZOTODiYrkwXd\\r\\nDQbDtsEdTFginRUEJNBOIfdZnsryulZJHGtxGFxnwSvYxnTLgmKlmFVRCzyEtBVdmKpJjiVioKMDgCFhzoTODiYrKwXD\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['tYWRijFQSzHBpCjUzqBtNvBKyzZRnIdWEuyqnORBQTLyOQglIGfYJIRjuxnbLvkqZakNqPiGDvgpWYkfxYNXsdoKXZtRkSasfa\\r\\nTYwRiJfqsZHBPcJuZQBTnVbkyZZRnidwEuYQnorbQTLYOqGligFyjirJUxnblVKqZaknQpigDVGPwyKfxyNXSDoKxztRKSaSFA\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['KhScXYiErQIUtmVhNTCXSLAviefIeHIIdiGhsYnPkSBaDTvMkyanfMLBOvDWgRybLtDqvXVdVjccNunDyijhhZEAKBrdz\\r\\nkHsCXyiErqIuTMVHNTCxSLaViEFIEhIIDiGHsYNpKsBAdTvMKyANFMLBovdwGRYbLtdQVxvDVJCcNUndYiJHhzeakBrdZ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['cpPQMpjRQJKQVXjWDYECXbagSmNcVfOuBWNZxihdERraVuiOpSVDCPgTGuSQALNoVjySceHcKXwOEpSzXrEqWwwrYeppNiWhDVg\\r\\nCPPqmPjRqJkQvxJwdyECXBAGsMNcVfOuBWNzxIhderRavUiOpSvDCpGTgusqAlNovjyScEhCKXwoePSZxrEQwWwryEPPniWHDvG\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['SajcCGMepaLjZIWLRBGFcrZRCRvvoCsIyKsQerbrwsIamxxpRmQSZSalasJLVFbCHCuXJlubciQAvLxXYBazLsMKLHLdDQ\\r\\nsaJcCgmEpaLJziWlrBgFcRzrCrVVOcSIykSQerBrwSIamxxPrMqSzSalASjLVFbChCUxjLUbCIQAVlxxybAZLsmkLhLDdQ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['kigPrWNTOUNDBskAfefjhHYZNYdnfZWuXWzHiBxFQryBbAkPtenFwWvCSTYGpzOntUNzNUhxRWjKmicTwLwJAnbAxj\\r\\nkigpRWntOUNdBsKaFEFjhhYZnYDNfzWuXwZhibxFQRybbakPteNfwwvcStyGPzoNTunznuHXrWjKMIctWLWJANBAxJ\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['nTomZZuTTRTAAPoUsySVFGElrpQRNLjqvFmcYytiheQnjUhPLnqNBiYtQkljbcvmjuNAVKbvQOWpqqFlQhAhULIhquoCnjUI\\r\\nntOmzZuttrtAAPOUSySVFgeLRPQrNLjQvfmCyYTiHEQnjuHPlNQNbIYtqKLJBCVmjunavkbvQOWPQQFlqHaHULIHQuOcnJUi\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['abac\\r\\nadaa\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['Bbc\\r\\nabc\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['aaaba\\r\\naaaab\\r\\n'], 'output': ['1\\r\\n']}]","id":636} {"difficulty":1200,"lang":"Perl","lang_cluster":"Perl","src_uid":"112_B","execute_outcome":"WRONG_ANSWER","source_code":"<>=~\/ (\\d+) \/;\r\nprint (($`\/2 - $1)*($`\/2 - $')*($`\/2 - $1+1)*($`\/2 - $'+1)?\"YES\":\"NO\")","description":"Little Petya loves playing with squares. Mum bought him a square 2n\u00d72n in size. Petya marked a cell inside the square and now he is solving the following task.The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be equal up to rotation.Petya wants to determine whether it is possible to cut the square in the required manner given the sizes of the square side and the coordinates of the marked cell. Help him.","input_specification":"The first line contains three space-separated integers 2n, x and y (2\u22642n\u2264100,1\u2264x,y\u22642n), representing the length of a square's side and the coordinates of the marked cell. It is guaranteed that 2n is even.\nThe coordinates of the marked cell are represented by a pair of numbers x y, where x represents the number of the row and y represents the number of the column. The rows and columns are numbered by consecutive integers from 1 to 2n. The rows are numbered from top to bottom and the columns are numbered from the left to the right.\n","output_specification":"If the square is possible to cut, print \"YES\", otherwise print \"NO\" (without the quotes).\n","notes":"A sample test from the statement and one of the possible ways of cutting the square are shown in the picture: \n \n","sample_inputs":["4 1 1\n","2 2 2\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"<>=~\/ (\\d+) \/;\r\nprint (($`\/2 - $1)*($`\/2 - $1+1)+($`\/2 - $')*($`\/2 - $'+1)?\"YES\":\"NO\")","testcases":"[{'input': ['4 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 2 2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8 2 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6 1 6\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 1 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 1 2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4 2 2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4 2 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4 2 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['60 30 30\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['60 34 30\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['60 31 29\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 61 30\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 52 50\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 51 51\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 1 8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 19 99\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 18 82\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 100 50\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 51 100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 100 100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6 3 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 4 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 3 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6 3 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['8 4 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 3 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4 3 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['20 10 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['8 4 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 50 50\\r\\n'], 'output': ['NO\\r\\n']}]","id":637} {"difficulty":1000,"lang":"Perl","lang_cluster":"Perl","src_uid":"114_A","execute_outcome":"WRONG_ANSWER","source_code":"use bignum;\r\n$a=<>;\r\n$b=<>;\r\n$i=$a;\r\nwhile($a<$b){\r\n$a*=$i, $c++;\r\n}\r\nprint $a-$b?\"NO\":\"YES\\n$c\"","description":"When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word \"tma\" (which now means \"too much to be counted\") used to stand for a thousand and \"tma tmyschaya\" (which literally means \"the tma of tmas\") used to stand for a million.Petya wanted to modernize the words we use for numbers and invented a word petricium that represents number k. Moreover, petricium la petricium stands for number k^2, petricium la petricium la petricium stands for k^3 and so on. All numbers of this form are called petriciumus cifera, and the number's importance is the number of articles la in its title.Petya's invention brought on a challenge that needed to be solved quickly: does some number l belong to the set petriciumus cifera? As Petya is a very busy schoolboy he needs to automate the process, he asked you to solve it.","input_specification":"The first input line contains integer number k, the second line contains integer number l (2\u2264k,l\u22642^31-1).\n","output_specification":"You should print in the first line of the output \"YES\", if the number belongs to the set petriciumus cifera and otherwise print \"NO\". If the number belongs to the set, then print on the seconds line the only number \u2014 the importance of number l.\n","notes":null,"sample_inputs":["5\n25\n","3\n8\n"],"sample_outputs":["YES\n1\n","NO\n"],"human_solution":"use bignum;\r\n$a=<>;\r\n$b=<>;\r\n$i=$a;\r\n$c=0;\r\nwhile($a<$b){\r\n$a*=$i, $c++;\r\n}\r\nprint $a-$b?\"NO\":\"YES\\n$c\"","testcases":"[{'input': ['5\\r\\n25\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['3\\r\\n8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['123\\r\\n123\\r\\n'], 'output': ['YES\\n0\\r\\n']}, {'input': ['99\\r\\n970300\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1000\\r\\n6666666\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['59\\r\\n3571\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['256\\r\\n16777217\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4638\\r\\n21511044\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['24\\r\\n191102976\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['52010\\r\\n557556453\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['61703211\\r\\n1750753082\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['137\\r\\n2571353\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['8758\\r\\n1746157336\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n64\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['96\\r\\n884736\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['1094841453\\r\\n1656354409\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1154413\\r\\n1229512809\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2442144\\r\\n505226241\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['11548057\\r\\n1033418098\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['581\\r\\n196122941\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['146\\r\\n1913781536\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['945916\\r\\n1403881488\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['68269\\r\\n365689065\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['30\\r\\n900\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['6\\r\\n1296\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['1470193122\\r\\n1420950405\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['90750\\r\\n1793111557\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1950054\\r\\n1664545956\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6767692\\r\\n123762320\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1437134\\r\\n1622348229\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['444103\\r\\n1806462642\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2592\\r\\n6718464\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['50141\\r\\n366636234\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['835\\r\\n582182875\\r\\n'], 'output': ['YES\\n2\\r\\n']}, {'input': ['156604\\r\\n902492689\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['27385965\\r\\n1742270058\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n9\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['35\\r\\n1838265625\\r\\n'], 'output': ['YES\\n5\\r\\n']}, {'input': ['8\\r\\n4096\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['85955\\r\\n945811082\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['54958832\\r\\n956670209\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1475381\\r\\n1348159738\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7313241\\r\\n413670642\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['582470\\r\\n2116368165\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['26859739\\r\\n595086170\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['249766393\\r\\n1582130\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['11734\\r\\n137686756\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['925093\\r\\n1098566745\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['40\\r\\n1600\\r\\n'], 'output': ['YES\\n1\\r\\n']}, {'input': ['2147483647\\r\\n2147483647\\r\\n'], 'output': ['YES\\n0\\r\\n']}, {'input': ['2147483646\\r\\n2147483647\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2147483647\\r\\n2147483646\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2147483647\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n1073741825\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n1073741824\\r\\n'], 'output': ['YES\\n29\\r\\n']}, {'input': ['10000\\r\\n10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n10000\\r\\n'], 'output': ['YES\\n3\\r\\n']}, {'input': ['10\\r\\n2000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n1000000000\\r\\n'], 'output': ['YES\\n8\\r\\n']}, {'input': ['5\\r\\n1808548329\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n2147483646\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['25\\r\\n125\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n18\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5\\r\\n30\\r\\n'], 'output': ['NO\\r\\n']}]","id":638} {"difficulty":1000,"lang":"Perl","lang_cluster":"Perl","src_uid":"122_A","execute_outcome":"WRONG_ANSWER","source_code":"$.=<>;$\/=0;for((4,7,47,74,447)){$.==$_||!($.%$_)?$\/++:$\/};print$\/?YES:NO","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.Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find out if the given number n is almost lucky.","input_specification":"The single line contains an integer n (1\u2264n\u22641000) \u2014 the number that needs to be checked.\n","output_specification":"In the only line print \"YES\" (without the quotes), if number n is almost lucky. Otherwise, print \"NO\" (without the quotes).\n","notes":"Note that all lucky numbers are almost lucky as any number is evenly divisible by itself.\nIn the first sample 47 is a lucky number. In the second sample 16 is divisible by 4.\n","sample_inputs":["47\n","16\n","78\n"],"sample_outputs":["YES\n","YES\n","NO\n"],"human_solution":"use POSIX;\r\nmy $line;\r\nmy %h;\r\nmy @input1;\r\nmy @input2;\r\nmy $dummy;\r\nmy $s = 0;\r\nmy $max = 0;\r\nmy $key1 = 0; my $key2 = 0; my $key3 = 0; my $key4 = 0;\r\n\r\n$line = ;\r\nchomp($line);\r\n@input1 = split('', $line);\r\n\r\nfor (my $i = 1; $i < 1000; $i++) {\r\n my $tmp = $i;\r\n $flag = 0;\r\n while ($tmp > 0) {\r\n if ($tmp % 10 != 4 && $tmp % 10 != 7) {\r\n $flag = 1;\r\n }\r\n $tmp = POSIX::floor($tmp \/ 10);\r\n }\r\n if (!$flag) {\r\n push(@input2, $i);\r\n $s++;\r\n }\r\n}\r\nfor ($i = 0; $i < $s; $i++) {\r\n if ($line % @input2[$i] == 0) {\r\n print \"YES\";\r\n exit;\r\n }\r\n}\r\nprint \"NO\";","testcases":"[{'input': ['47\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['78\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['48\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['107\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['77\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['480\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['49\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['56\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['124\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1000\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['298\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['274\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['998\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['42\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['788\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['70\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['799\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['882\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['88\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['94\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['141\\r\\n'], 'output': ['YES\\r\\n']}]","id":639} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"129_A","execute_outcome":"WRONG_ANSWER","source_code":"#!perl\n$scookies = ;\n@cookies = split(\/\\D\/,$scookies);\n$odd = $even = 0;\nforeach $i (@cookies) {\n\tif ($i % 2) {\n\t\t$odd++;\n\t} else {\n\t\t$even++;\n\t}\n}\n$result = ($odd % 2)? $odd: $even;\nprint $result;\n","description":"Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there are many cookies, Olga decided that it's no big deal if she steals a bag. However, she doesn't want the sisters to quarrel because of nothing when they divide the cookies. That's why Olga wants to steal a bag with cookies so that the number of cookies in the remaining bags was even, that is, so that Anna and Maria could evenly divide it into two (even 0 remaining cookies will do, just as any other even number). How many ways there are to steal exactly one cookie bag so that the total number of cookies in the remaining bags was even?","input_specification":"The first line contains the only integer n (1\u2264n\u2264100) \u2014 the number of cookie bags Anna and Maria have. The second line contains n integers ai (1\u2264ai\u2264100) \u2014 the number of cookies in the i-th bag.\n","output_specification":"Print in the only line the only number \u2014 the sought number of ways. If there are no such ways print 0.\n","notes":"In the first sample Olga should take the only bag so that the twins ended up with the even number of cookies.\nIn the second sample Olga can take any of five bags with two cookies or any of three bags with four cookies \u2014 5+3=8 ways in total.\nIn the third sample, no matter which bag with two cookies Olga chooses, the twins are left with 2*9+99=117 cookies. Thus, Olga has only one option: to take the bag with 99 cookies.\n","sample_inputs":["1\n1\n","10\n1 2 2 3 4 4 4 2 2 2\n","11\n2 2 2 2 2 2 2 2 2 2 99\n"],"sample_outputs":["1\n","8\n","1\n"],"human_solution":"#!perl\n$_ = ;\n$scookies = ;\n@cookies = split(\/\\D\/,$scookies);\n$odd = $even = 0;\nforeach $i (@cookies) {\n\tif ($i % 2) {\n\t\t$odd++;\n\t} else {\n\t\t$even++;\n\t}\n}\n$result = ($odd % 2)? $odd: $even;\nprint $result;\n","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n1 2 2 3 4 4 4 2 2 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 99\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n7 7 7 7 7 7 7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['8\\r\\n1 2 3 4 5 6 7 8\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100\\r\\n1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['99\\r\\n99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['82\\r\\n43 44 96 33 23 42 33 66 53 87 8 90 43 91 40 88 51 18 48 62 59 10 22 20 54 6 13 63 2 56 31 52 98 42 54 32 26 77 9 24 33 91 16 30 39 34 78 82 73 90 12 15 67 76 30 18 44 86 84 98 65 54 100 79 28 34 40 56 11 43 72 35 86 59 89 40 30 33 7 19 44 15\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['17\\r\\n50 14 17 77 74 74 38 76 41 27 45 29 66 98 38 73 38\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['94\\r\\n81 19 90 99 26 11 86 44 78 36 80 59 99 90 78 72 71 20 94 56 42 40 71 84 10 85 10 70 52 27 39 55 90 16 48 25 7 79 99 100 38 10 99 56 3 4 78 9 16 57 14 40 52 54 57 70 30 86 56 84 97 60 59 69 49 66 23 92 90 46 86 73 53 47 1 83 14 20 24 66 13 45 41 14 86 75 55 88 48 95 82 24 47 87\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['88\\r\\n64 95 12 90 40 65 98 45 52 54 79 7 81 25 98 19 68 82 41 53 35 50 5 22 32 21 8 39 8 6 72 27 81 30 12 79 21 42 60 2 66 87 46 93 62 78 52 71 76 32 78 94 86 85 55 15 34 76 41 20 32 26 94 81 89 45 74 49 11 40 40 39 49 46 80 85 90 23 80 40 86 58 70 26 48 93 23 53\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['84\\r\\n95 9 43 43 13 84 60 90 1 8 97 99 54 34 59 83 33 15 51 26 40 12 66 65 19 30 29 78 92 60 25 13 19 84 71 73 12 24 54 49 16 41 11 40 57 59 34 40 39 9 71 83 1 77 79 53 94 47 78 55 77 85 29 52 80 90 53 77 97 97 27 79 28 23 83 25 26 22 49 86 63 56 3 32\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['47\\r\\n61 97 76 94 91 22 2 68 62 73 90 47 16 79 44 71 98 68 43 6 53 52 40 27 68 67 43 96 14 91 60 61 96 24 97 13 32 65 85 96 81 77 34 18 23 14 80\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['69\\r\\n71 1 78 74 58 89 30 6 100 90 22 61 11 59 14 74 27 25 78 61 45 19 25 33 37 4 52 43 53 38 9 100 56 67 69 38 76 91 63 60 93 52 28 61 9 98 8 14 57 63 89 64 98 51 36 66 36 86 13 82 50 91 52 64 86 78 78 83 81\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['52\\r\\n38 78 36 75 19 3 56 1 39 97 24 79 84 16 93 55 96 64 12 24 1 86 80 29 12 32 36 36 73 39 76 65 53 98 30 20 28 8 86 43 70 22 75 69 62 65 81 25 53 40 71 59\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['74\\r\\n81 31 67 97 26 75 69 81 11 13 13 74 77 88 52 20 52 64 66 75 72 28 41 54 26 75 41 91 75 15 18 36 13 83 63 61 14 48 53 63 19 67 35 48 23 65 73 100 44 55 92 88 99 17 73 25 83 7 31 89 12 80 98 39 42 75 14 29 81 35 77 87 33 94\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['44\\r\\n46 56 31 31 37 71 94 2 14 100 45 72 36 72 80 3 38 54 42 98 50 32 31 42 62 31 45 50 95 100 18 17 64 22 18 25 52 56 70 57 43 40 81 28\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['22\\r\\n28 57 40 74 51 4 45 84 99 12 95 14 92 60 47 81 84 51 31 91 59 42\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['59\\r\\n73 45 94 76 41 49 65 13 74 66 36 25 47 75 40 23 92 72 11 32 32 8 81 26 68 56 41 8 76 47 96 55 70 11 84 14 83 18 70 22 30 39 28 100 48 11 92 45 78 69 86 1 54 90 98 91 13 17 35\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['63\\r\\n20 18 44 94 68 57 16 43 74 55 68 24 21 95 76 84 50 50 47 86 86 12 58 55 28 72 86 18 34 45 81 88 3 72 41 9 60 90 81 93 12 6 9 6 2 41 1 7 9 29 81 14 64 80 20 36 67 54 7 5 35 81 22\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['28\\r\\n49 84 48 19 44 91 11 82 96 95 88 90 71 82 87 25 31 23 18 13 98 45 26 65 35 12 31 14\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['61\\r\\n34 18 28 64 28 45 9 77 77 20 63 92 79 16 16 100 86 2 91 91 57 15 31 95 10 88 84 5 82 83 53 98 59 17 97 80 76 80 81 3 91 81 87 93 61 46 10 49 6 22 21 75 63 89 21 81 30 19 67 38 77\\r\\n'], 'output': ['35\\r\\n']}, {'input': ['90\\r\\n41 90 43 1 28 75 90 50 3 70 76 64 81 63 25 69 83 82 29 91 59 66 21 61 7 55 72 49 38 69 72 20 64 58 30 81 61 29 96 14 39 5 100 20 29 98 75 29 44 78 97 45 26 77 73 59 22 99 41 6 3 96 71 20 9 18 96 18 90 62 34 78 54 5 41 6 73 33 2 54 26 21 18 6 45 57 43 73 95 75\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['45\\r\\n93 69 4 27 20 14 71 48 79 3 32 26 49 30 57 88 13 56 49 61 37 32 47 41 41 70 45 68 82 18 8 6 25 20 15 13 71 99 28 6 52 34 19 59 26\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['33\\r\\n29 95 48 49 91 10 83 71 47 25 66 36 51 12 34 10 54 74 41 96 89 26 89 1 42 33 1 62 9 32 49 65 78\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['34\\r\\n98 24 42 36 41 82 28 58 89 34 77 70 76 44 74 54 66 100 13 79 4 88 21 1 11 45 91 29 87 100 29 54 82 78\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['29\\r\\n91 84 26 84 9 63 52 9 65 56 90 2 36 7 67 33 91 14 65 38 53 36 81 83 85 14 33 95 51\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['100\\r\\n2 88 92 82 87 100 78 28 84 43 78 32 43 33 97 19 15 52 29 84 57 72 54 13 99 28 82 79 40 70 34 92 91 53 9 88 27 43 14 92 72 37 26 37 20 95 19 34 49 64 33 37 34 27 80 79 9 54 99 68 25 4 68 73 46 66 24 78 3 87 26 52 50 84 4 95 23 83 39 58 86 36 33 16 98 2 84 19 53 12 69 60 10 11 78 17 79 92 77 59\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['100\\r\\n2 95 45 73 9 54 20 97 57 82 88 26 18 71 25 27 75 54 31 11 58 85 69 75 72 91 76 5 25 80 45 49 4 73 8 81 81 38 5 12 53 77 7 96 90 35 28 80 73 94 19 69 96 17 94 49 69 9 32 19 5 12 46 29 26 40 59 59 6 95 82 50 72 2 45 69 12 5 72 29 39 72 23 96 81 28 28 56 68 58 37 41 30 1 90 84 15 24 96 43\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n27 72 35 91 13 10 35 45 24 55 83 84 63 96 29 79 34 67 63 92 48 83 18 77 28 27 49 66 29 88 55 15 6 58 14 67 94 36 77 7 7 64 61 52 71 18 36 99 76 6 50 67 16 13 41 7 89 73 61 51 78 22 78 32 76 100 3 31 89 71 63 53 15 85 77 54 89 33 68 74 3 23 57 5 43 89 75 35 9 86 90 11 31 46 48 37 74 17 77 8\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['100\\r\\n69 98 69 88 11 49 55 8 25 91 17 81 47 26 15 73 96 71 18 42 42 61 48 14 92 78 35 72 4 27 62 75 83 79 17 16 46 80 96 90 82 54 37 69 85 21 67 70 96 10 46 63 21 59 56 92 54 88 77 30 75 45 44 29 86 100 51 11 65 69 66 56 82 63 27 1 51 51 13 10 3 55 26 85 34 16 87 72 13 100 81 71 90 95 86 50 83 55 55 54\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n34 35 99 64 2 66 78 93 20 48 12 79 19 10 87 7 42 92 60 79 5 2 24 89 57 48 63 92 74 4 16 51 7 12 90 48 87 17 18 73 51 58 97 97 25 38 15 97 96 73 67 91 6 75 14 13 87 79 75 3 15 55 35 95 71 45 10 13 20 37 82 26 2 22 13 83 97 84 39 79 43 100 54 59 98 8 61 34 7 65 75 44 24 77 73 88 34 95 44 77\\r\\n'], 'output': ['55\\r\\n']}, {'input': ['100\\r\\n15 86 3 1 51 26 74 85 37 87 64 58 10 6 57 26 30 47 85 65 24 72 50 40 12 35 91 47 91 60 47 87 95 34 80 91 26 3 36 39 14 86 28 70 51 44 28 21 72 79 57 61 16 71 100 94 57 67 36 74 24 21 89 85 25 2 97 67 76 53 76 80 97 64 35 13 8 32 21 52 62 61 67 14 74 73 66 44 55 76 24 3 43 42 99 61 36 80 38 66\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['100\\r\\n45 16 54 54 80 94 74 93 75 85 58 95 79 30 81 2 84 4 57 23 92 64 78 1 50 36 13 27 56 54 10 77 87 1 5 38 85 74 94 82 30 45 72 83 82 30 81 82 82 3 69 82 7 92 39 60 94 42 41 5 3 17 67 21 79 44 79 96 28 3 53 68 79 89 63 83 1 44 4 31 84 15 73 77 19 66 54 6 73 1 67 24 91 11 86 45 96 82 20 89\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n84 23 50 32 90 71 92 43 58 70 6 82 7 55 85 19 70 89 12 26 29 56 74 30 2 27 4 39 63 67 91 81 11 33 75 10 82 88 39 43 43 80 68 35 55 67 53 62 73 65 86 74 43 51 14 48 42 92 83 57 22 33 24 99 5 27 78 96 7 28 11 15 8 38 85 67 5 92 24 96 57 59 14 95 91 4 9 18 45 33 74 83 64 85 14 51 51 94 29 2\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n77 56 56 45 73 55 32 37 39 50 30 95 79 21 44 34 51 43 86 91 39 30 85 15 35 93 100 14 57 31 80 79 38 40 88 4 91 54 7 95 76 26 62 84 17 33 67 47 6 82 69 51 17 2 59 24 11 12 31 90 12 11 55 38 72 49 30 50 42 46 5 97 9 9 30 45 86 23 19 82 40 42 5 40 35 98 35 32 60 60 5 28 84 35 21 49 68 53 68 23\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n78 38 79 61 45 86 83 83 86 90 74 69 2 84 73 39 2 5 20 71 24 80 54 89 58 34 77 40 39 62 2 47 28 53 97 75 88 98 94 96 33 71 44 90 47 36 19 89 87 98 90 87 5 85 34 79 82 3 42 88 89 63 35 7 89 30 40 48 12 41 56 76 83 60 80 80 39 56 77 4 72 96 30 55 57 51 7 19 11 1 66 1 91 87 11 62 95 85 79 25\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n5 34 23 20 76 75 19 51 17 82 60 13 83 6 65 16 20 43 66 54 87 10 87 73 50 24 16 98 33 28 80 52 54 82 26 92 14 13 84 92 94 29 61 21 60 20 48 94 24 20 75 70 58 27 68 45 86 89 29 8 67 38 83 48 18 100 11 22 46 84 52 97 70 19 50 75 3 7 52 53 72 41 18 31 1 38 49 53 11 64 99 76 9 87 48 12 100 32 44 71\\r\\n'], 'output': ['58\\r\\n']}, {'input': ['100\\r\\n76 89 68 78 24 72 73 95 98 72 58 15 2 5 56 32 9 65 50 70 94 31 29 54 89 52 31 93 43 56 26 35 72 95 51 55 78 70 11 92 17 5 54 94 81 31 78 95 73 91 95 37 59 9 53 48 65 55 84 8 45 97 64 37 96 34 36 53 66 17 72 48 99 23 27 18 92 84 44 73 60 78 53 29 68 99 19 39 61 40 69 6 77 12 47 29 15 4 8 45\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n82 40 31 53 8 50 85 93 3 84 54 17 96 59 51 42 18 19 35 84 79 31 17 46 54 82 72 49 35 73 26 89 61 73 3 50 12 29 25 77 88 21 58 24 22 89 96 54 82 29 96 56 77 16 1 68 90 93 20 23 57 22 31 18 92 90 51 14 50 72 31 54 12 50 66 62 2 34 17 45 68 50 87 97 23 71 1 72 17 82 42 15 20 78 4 49 66 59 10 17\\r\\n'], 'output': ['54\\r\\n']}, {'input': ['100\\r\\n32 82 82 24 39 53 48 5 29 24 9 37 91 37 91 95 1 97 84 52 12 56 93 47 22 20 14 17 40 22 79 34 24 2 69 30 69 29 3 89 21 46 60 92 39 29 18 24 49 18 40 22 60 13 77 50 39 64 50 70 99 8 66 31 90 38 20 54 7 21 5 56 41 68 69 20 54 89 69 62 9 53 43 89 81 97 15 2 52 78 89 65 16 61 59 42 56 25 32 52\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['100\\r\\n72 54 23 24 97 14 99 87 15 25 7 23 17 87 72 31 71 87 34 82 51 77 74 85 62 38 24 7 84 48 98 21 29 71 70 84 25 58 67 92 18 44 32 9 81 15 53 29 63 18 86 16 7 31 38 99 70 32 89 16 23 11 66 96 69 82 97 59 6 9 49 80 85 19 6 9 52 51 85 74 53 46 73 55 31 63 78 61 34 80 77 65 87 77 92 52 89 8 52 31\\r\\n'], 'output': ['44\\r\\n']}, {'input': ['100\\r\\n56 88 8 19 7 15 11 54 35 50 19 57 63 72 51 43 50 19 57 90 40 100 8 92 11 96 30 32 59 65 93 47 62 3 50 41 30 50 72 83 61 46 83 60 20 46 33 1 5 18 83 22 34 16 41 95 63 63 7 59 55 95 91 29 64 60 64 81 45 45 10 9 88 37 69 85 21 82 41 76 42 34 47 78 51 83 65 100 13 22 59 76 63 1 26 86 36 94 99 74\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['100\\r\\n27 89 67 60 62 80 43 50 28 88 72 5 94 11 63 91 18 78 99 3 71 26 12 97 74 62 23 24 22 3 100 72 98 7 94 32 12 75 61 88 42 48 10 14 45 9 48 56 73 76 70 70 79 90 35 39 96 37 81 11 19 65 99 39 23 79 34 61 35 74 90 37 73 23 46 21 94 84 73 58 11 89 13 9 10 85 42 78 73 32 53 39 49 90 43 5 28 31 97 75\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n33 24 97 96 1 14 99 51 13 65 67 20 46 88 42 44 20 49 5 89 98 83 15 40 74 83 58 3 10 79 34 2 69 28 37 100 55 52 14 8 44 94 97 89 6 42 11 28 30 33 55 56 20 57 52 25 75 1 87 42 62 41 37 12 54 85 95 80 42 36 94 96 28 76 54 36 4 17 26 24 62 15 17 79 84 36 92 78 74 91 96 77 54 92 81 91 62 98 37 37\\r\\n'], 'output': ['43\\r\\n']}, {'input': ['100\\r\\n86 24 61 15 11 85 1 31 47 36 23 36 59 34 3 27 16 29 82 28 58 52 52 66 71 61 98 39 60 20 67 41 67 90 73 29 92 17 70 95 58 98 58 32 21 73 46 56 87 72 80 75 40 27 94 31 59 92 93 37 14 99 96 21 97 23 81 91 52 52 96 94 92 28 38 29 52 16 57 27 17 24 91 21 79 55 96 98 95 94 23 78 79 12 77 35 32 75 100 82\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n88 85 41 37 69 21 7 69 36 5 92 26 64 75 22 46 67 20 70 22 62 66 38 24 47 49 68 30 90 31 67 86 86 82 9 51 43 45 48 42 73 44 31 94 45 60 54 66 20 87 11 94 34 32 87 66 56 28 75 39 37 90 72 93 55 72 31 42 30 71 87 61 4 12 12 81 23 61 56 98 71 32 30 33 96 63 92 16 8 78 47 91 47 54 49 3 81 82 41 5\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n1 1 3 2 2\\r\\n'], 'output': ['3\\r\\n']}]","id":640} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"133_A","execute_outcome":"RUNTIME_ERROR","source_code":"\r\n\r\n#!perl -pl\r\n$_ = y\/HQ9\/\/ ? \"YES\" : \"NO\"","description":"HQ9+ is a joke programming language which has only four one-character instructions: \"H\" prints \"Hello, World!\", \"Q\" prints the source code of the program itself, \"9\" prints the lyrics of \"99 Bottles of Beer\" song, \"+\" increments the value stored in the internal accumulator.Instructions \"H\" and \"Q\" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored.You are given a program written in HQ9+. You have to figure out whether executing this program will produce any output.","input_specification":"The input will consist of a single line p which will give a program in HQ9+. String p will contain between 1 and 100 characters, inclusive. ASCII-code of each character of p will be between 33 (exclamation mark) and 126 (tilde), inclusive.\n","output_specification":"Output \"YES\", if executing the program will produce any output, and \"NO\" otherwise.\n","notes":"In the first case the program contains only one instruction \u2014 \"H\", which prints \"Hello, World!\".\nIn the second case none of the program characters are language instructions.\n","sample_inputs":["Hi!\n","Codeforces\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"print<>=~\/[HQ9]\/?YES:NO\r\n","testcases":"[{'input': ['Hi!\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Codeforces\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['a+b=c\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['hq-lowercase\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Q\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['H\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['~\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['dEHsbM\\'gS[\\\\brZ_dpjXw8f?L[4E\"s4Zc9*(,j:>p$}m7HD[_9nOWQ\\\\uvq2mHWR\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['tt6l=RHOfStm.;Qd$-}zDes*E,.F7qn5-b%HC\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['@F%K2=%RyL\/\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['juq)k(FT.^G=G\\\\zcqnO\"uJIE1_]KFH9S=1c\"mJ;F9F)%>&.WOdp09+k`Yc6}\"6xw,Aos:M\\\\_^^:xBb[CcsHm?J\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6G_\"Fq#<AWyHG=Rci1t%#Jc#x<Fpg\\'N@t%F=``YO7\\\\Zd;6PkMe<#91YgzTC)\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Fvg_~wC>SO4lF}*c`Q;mII9E{4.QodbqN]C\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['p-UXsbd&f\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['<]D7NMA)yZe=`?RbP5lsa.l_Mg^V:\"-0x+$3c,q&L%18Ku<HcA\\\\s!^OQblk^x{35S\\'>yz8cKgVHWZ]kV0>_\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['f.20)8b+.R}Gy!DbHU3v(.(=Q^`z[_BaQ}eO=C1IK;b2GkD\\\\{\\\\Bf\"!#qh]\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['}do5RU<(w<q[\"-NR)IAH_HyiD{\\r\\n'], 'output': ['YES\\r\\n']}, {'input': [\"Iy^.,Aw*,5+f;l@Q;jLK'G5H-r1Pfmx?ei~`CjMmUe{K:lS9cu4ay8rqRh-W?Gqv!e-j*U)!Mzn{E8B6%~aSZ~iQ_QwlC9_cX(o8\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['sKLje,:q>-D,;NvQ3,qN3-N&tPx0nL\/,>Ca|z\"k2S{NF7btLa3_TyXG4XZ:`(t&\"\\'^M|@qObZxv\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['%z:c@1ZsQ@\\\\6U\/NQ+M9R>,$bwG`U1+C\\\\18^:S},;kw!&4r|z`\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['OKBB5z7ud81[Tn@P\"nDUd,>@\\r\\n'], 'output': ['NO\\r\\n']}, {'input': [\"y{0;neX]w0IenPvPx0iXp+X|IzLZZaRzBJ>q~LhMhD$x-^GDwl;,a'<bAqH8QrFwbK@oi?I'W.bZ]MlIQ\/x(0YzbTH^l.)]0Bv\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['EL|xIP5_+Caon1hPpQ0[8+r@LX4;b?gMy>;\/WH)pf@Ur*TiXu*e}b-*%acUA~A?>MDz#!\\\\Uh\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['UbkW=UVb>;z6)p@Phr;^Dn.|5O{_i||:Rv|KJ_ay~V(S&Jp\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['!3YPv@2JQ44@)R2O_4`GO\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Kba\/Q,SL~FMd)3hOWU\\'Jum{9\"$Ld4:GW}D]%tr@G{hpG:PV5-c\\'VIZ~m\/6|3I?_4*1luKnOp`%p|0H{[|Y1A~4-ZdX,Rw2[\\\\\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['NRN*=v>;oU7[acMIJn*n^bWm!cm3#E7Efr>{g-8bl\"DN4~_=f?[T;~Fq#&)aXq%<\/GcTJD^e$@Extm[e\"C)q_L\\r\\n'], 'output': ['NO\\r\\n']}, {'input': [\"y#<fv{_=$MP!{D%I\\\\1OqjaqKh[pqE$KvYL<9@*V'j8uH0\/gQdA'G;&y4Cv6&\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['+SE_Pg<?7Fh,z&uITQut2a-mk8X8La`c2A}\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Uh3>ER](J\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['!:!{~=9*\\\\P;Z6F?HC5GadFz)>k*=u|+\"Cm]ICTmB!`L{&oS\/z6b~#Snbp\/^\\\\Q>XWU-vY+\/dP.7S=-#&whS@,\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['KimtYBZp+ISeO(uH;UldoE6eAcp|9u?SzGZd6j-e}[}u#e[Cx8.qgY]$2!\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['[:[SN-{r>[l+OggH3v3g{EPC*@YBATT@\\r\\n'], 'output': ['YES\\r\\n']}, {'input': [\"'jdL(vX\\r\\n\"], 'output': ['NO\\r\\n']}, {'input': ['Q;R+aay]cL?Zh*uG\"YcmO*@Dts*Gjp}D~M7Z96+<4?9I3aH~0qNdO(RmyRy=ci,s8qD_kwj;QHFzD|5,5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['{Q@#<LU_v^qdh%gGxz*pu)Y\"]k-l-N30WAxvp2IE3:jD0Wi4H\/xWPH&s\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['~@Gb(S&N$mBuBUMAky-z^{5VwLNTzYg|ZUZncL@ahS?K*As<$iNUARM3r43J\\'jJB)$ujfPAq\"G<S9flGyakZg!2Z.-NJ|2{F>]\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Jp5Aa>aP6fZ!\\\\6%A}<S}j{O4`C6y$8|i3IW,WHy&\"ioE&7zP\"\\'xHAY;:x%@SnS]Mr{R|})gU\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['ZA#:U)$RI^sE\\\\vuAt]x\"2zipI!}YEu2<j$:H0_9\/~eB?#->\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['&ppw0._:\\\\p-PuWM@l}%%=\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['P(^pix\"=oiEZu8?@d@J(I`Xp5TN^T3\\\\Z7P5\"ZrvZ{2Fwz3g-8`U!)(1$a<g+9Q|COhDoH;HwFY02Pa|ZGp$\/WZBR=>6Jg!yr\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['`WfODc\\\\?#ax~1xu@[ao+o_rN|L7%v,p,nDv>3+6cy.]q3)+A6b!q*Hc+#.t4f~vhUa~$^q\\r\\n'], 'output': ['YES\\r\\n']}, {'input': [\",)TH9N}'6t2+0Yg?S#6\/{_.,!)9d}h'wG|sY&'Ul4D0l0\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['VXB&r9Z)IlKOJ:??KDA\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['\")1cL>{o\\\\dcYJzu?CefyN^bGRviOH&P7rJS3PT4:0V3F)%\\\\}L=AJouYsj_>j2|7^1NWu*%NbOP>ngv-ls<;b-4Sd3Na0R\\r\\n'], 'output': ['YES\\r\\n']}, {'input': [\"2Y}\\\\A)>row{~c[g>:'.|ZC8%UTQ\/jcdhK%6O)QRC.kd@%y}LJYk=V{G5pQK\/yKJ%{G3C\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['O.&=qt(`z(\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['_^r6fyIc\/~~;>l%9?aVEi7-{=,[<aMiB\\'-scSg$$|\"jAzY0N>QkHHGBZj2c\"=fhRlWd5;5K|GgU?7h]!;wl@\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+\/`sAd&eB29E=Nu87${.u6GY@$^a$,}s^!p!F}B-z8<<wORb<S7;HM1a,gp\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['U_ilyOGMT+QiW\/M8\/D(1=6a7)_FA,h4`8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['!0WKT:$O\\r\\n'], 'output': ['NO\\r\\n']}, {'input': [\"1EE*I%EQz6$~pPu7|(r7nyPQt4uGU@]~H'4uII?b1_Wn)K?ZRHrr0z&Kr;}aO3<mN=3:{}QgPxI|Ncm4#)\\r\\n\"], 'output': ['YES\\r\\n']}, {'input': ['[u3\"$+!:\/.<Dp1M7tH}:zxjt],^kv}qP;y12\"`^\\'\/u*h%AFmPJ>e1#Yly\\r\\n'], 'output': ['YES\\r\\n']}, {'input': [\"'F!_]tB<A&UO+p?7liE>(x&RFgG2~\\\\(\\r\\n\"], 'output': ['NO\\r\\n']}, {'input': ['Qv)X8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['aGv7,J@&g1(}E3g6[LuDZwZl2<v7IwQA%\"R(?ouBD>_=y\"3Kf%^>vON<a^T\\\\G^ootgE@whWmZo=[ex|F\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['e{}2vQ+\/r@p0}cLKNe4MCk\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['mzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnkH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Qzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['mzbmweyydiadtlcouegmdbyfwurpwb9uvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1H1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+Q\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1ab\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['!\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['0+\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['+H\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['cH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8+\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['++++++++++++++++++++++++++\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['(+)\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['H+\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['a!\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['++++++++++++++\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['HQ9\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+++H\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['++++++++++\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['HHHHHHH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['abacabaH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['+G\\r\\n'], 'output': ['NO\\r\\n']}]","id":641} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"146_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl -w\r\n\r\nuse strict;\r\n\r\nwhile () {\r\n chomp;\r\n s\/(.*)\/($1)\/ if s\/^-\/\/;\r\n s\/^(\\(*)\/$1\\$\/;\r\n s\/(\\d+)(\\D*)\/$1.$2\/ unless m\/\\.\/;\r\n s\/\\.(\\d*)\/\\.${1}00\/;\r\n s\/(\\.\\d{2})\\d*\/$1\/;\r\n 0 while s\/(\\d)(\\d{3}[\\.,])\/$1,$2\/;\r\n s\/(.*)\/$1\\n\/;\r\n print;\r\n}\r\n","description":"Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya loves tickets very much. As we know, each ticket has a number that is a positive integer. Its length equals n (n is always even). Petya calls a ticket lucky if the ticket's number is a lucky number and the sum of digits in the first half (the sum of the first n\/2 digits) equals the sum of digits in the second half (the sum of the last n\/2 digits). Check if the given ticket is lucky.","input_specification":"The first line contains an even integer n (2\u2264n\u226450) \u2014 the length of the ticket number that needs to be checked. The second line contains an integer whose length equals exactly n \u2014 the ticket number. The number may contain leading zeros.\n","output_specification":"On the first line print \"YES\" if the given ticket number is lucky. Otherwise, print \"NO\" (without the quotes).\n","notes":"In the first sample the sum of digits in the first half does not equal the sum of digits in the second half (4\u22607).\nIn the second sample the ticket number is not the lucky number.\n","sample_inputs":["2\n47\n","4\n4738\n","4\n4774\n"],"sample_outputs":["NO\n","NO\n","YES\n"],"human_solution":"#!\/usr\/bin\/perl\r\nuse v5.10;\r\n\r\nchomp($n = <>);\r\nchomp($line = <>);\r\n$line =~ m\/^[47]+$\/ or say \"NO\" and exit;\r\n@a = split \/\/, $line;\r\n$n_ = $n>>1;\r\n$a+=$a[$_] foreach (0 .. $n_-1);\r\n$b+=$a[$_] foreach ($n-$n_ .. $n-1);\r\n$a==$b and say \"YES\" or say \"NO\";","testcases":"[{'input': ['2\\r\\n47\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n4738\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n4774\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4\\r\\n4570\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n477477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6\\r\\n777777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['20\\r\\n44444444444444444444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n44\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n4745474547\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['14\\r\\n77770004444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10\\r\\n4747777744\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n1234567890\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n44444444444444444444444444444444444444444444444444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n44444444444444444444444444444444444444444444444447\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n74444444444444444444444444444444444444444444444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n07777777777777777777777777777777777777777777777770\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['50\\r\\n77777777777777777777777777777777777777777777777777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n44747747774474747747747447777447774747447477444474\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['48\\r\\n447474444777444474747747744774447444747474774474\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['32\\r\\n74474474777444474444747774474774\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['40\\r\\n4747777444447747777447447747447474774777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10\\r\\n4477477444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['18\\r\\n447747474447744747\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['26\\r\\n44747744444774744774474447\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50\\r\\n44707747774474747747747447777447774747447477444474\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['40\\r\\n4747777444447737777447447747447474774777\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['36\\r\\n764477744747444444447747747474744444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['22\\r\\n4477407474777477744447\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['32\\r\\n74274474777444474444747774474774\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['16\\r\\n4744447974444747\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n11\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n22\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n33\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n74\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n55\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n66\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n77\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2\\r\\n88\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n99\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n4004\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['14\\r\\n00077774444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n004444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n0044\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['14\\r\\n77771114444444\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['14\\r\\n44444447777000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6\\r\\n004774\\r\\n'], 'output': ['NO\\r\\n']}]","id":642} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"157_A","execute_outcome":"RUNTIME_ERROR","source_code":"$n=;\r\nforeach $i (0..$n-1){\r\n @field[$i]=[split(\" \",)];\r\n}\r\nmy @gor;\r\nmy @vert;\r\nmy $schet=0;\r\n\r\nforeach $i (0..$n-1){\r\n foreach $j(0..$n-1){\r\n $gor[$i]+=$field[$i][$j];\r\n $vert[$j]+=$field[$i][$j];\r\n }\r\n}\r\n\r\nforeach $i (0..$n-1){\r\n foreach $j(0..$n-1){\r\n #print $gor[$i].\" field=\".($field[$i]->[$j]).\" vert=\".$vert[$j].\"\\n\";\r\n if ($gor[$i]-($field[$i][$j])<$vert[$j]-($field[$i][$j])){\r\n $schet+=1;\r\n }\r\n }\r\n}\r\n\r\n\r\nprint $schet;\r\n","description":"Sherlock Holmes and Dr. Watson played some game on a checkered board n\u00d7n in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to count the number of winning squares. To determine if the particular square is winning you should do the following. Calculate the sum of all numbers on the squares that share this column (including the given square) and separately calculate the sum of all numbers on the squares that share this row (including the given square). A square is considered winning if the sum of the column numbers is strictly greater than the sum of the row numbers.For instance, lets game was ended like is shown in the picture. Then the purple cell is winning, because the sum of its column numbers equals 8+3+6+7=24, sum of its row numbers equals 9+5+3+2=19, and 24>19.","input_specification":"The first line contains an integer n (1\u2264n\u226430). Each of the following n lines contain n space-separated integers. The j-th number on the i-th line represents the number on the square that belongs to the j-th column and the i-th row on the board. All number on the board are integers from 1 to 100.\n","output_specification":"Print the single number \u2014 the number of the winning squares.\n","notes":"In the first example two upper squares are winning.\nIn the third example three left squares in the both middle rows are winning:\n5 7 8 4\n9 5 3 2\n1 6 6 4\n9 5 7 3\n","sample_inputs":["1\n1\n","2\n1 2\n3 4\n","4\n5 7 8 4\n9 5 3 2\n1 6 6 4\n9 5 7 3\n"],"sample_outputs":["0\n","2\n","6\n"],"human_solution":"while (<>){\r\n @_=();\r\n for (1..$_){push @_,\"\".<>}\r\n chomp @_;\r\n @n=();\r\n \r\n sub suma{\r\n @A=@_;\r\n @SUM=();\r\n for (@A){\r\n @m=split\/ \/;\r\n $sum=0;\r\n for $i(@m){$sum+=$i}\r\n push @SUM, $sum;\r\n }\r\n return @SUM\r\n }\r\n \r\n @i=suma (@_);\r\n \r\n @m=@_;\r\n @_=();\r\n for $i(1..@m){\r\n @k=();\r\n for (@m){\r\n s\/(\\d+) ?\/\/;\r\n push @k,$1 \r\n }\r\n push @_, (join\" \",@k);\r\n }\r\n \r\n @j=suma (@_);\r\n \r\n $z=0;\r\n for $i(@i){\r\n for $j(@j){\r\n $j>$i and $z++\r\n }\r\n }\r\n print \"$z\\n\"\r\n }\r\n \r\n ","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n3 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n5 7 8 4\\r\\n9 5 3 2\\r\\n1 6 6 4\\r\\n9 5 7 3\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n4 5 6\\r\\n7 8 9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n3 1 2\\r\\n2 3 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n1 2 3 4\\r\\n8 7 6 5\\r\\n9 10 11 12\\r\\n16 15 14 13\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1\\r\\n53\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n1 98 22 9 39\\r\\n10 9 44 49 66\\r\\n79 17 23 8 47\\r\\n59 69 72 47 14\\r\\n94 91 98 19 54\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['1\\r\\n31\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\n92\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n61 45 70 19 48\\r\\n52 29 98 21 74\\r\\n21 66 12 6 55\\r\\n62 75 66 62 57\\r\\n94 74 9 86 24\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['2\\r\\n73 99\\r\\n13 100\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n89 79 14 89\\r\\n73 24 58 89\\r\\n62 88 69 65\\r\\n58 92 18 83\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5\\r\\n99 77 32 20 49\\r\\n93 81 63 7 58\\r\\n37 1 17 35 53\\r\\n18 94 38 80 23\\r\\n91 50 42 61 63\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['4\\r\\n81 100 38 54\\r\\n8 64 39 59\\r\\n6 12 53 65\\r\\n79 50 99 71\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['5\\r\\n42 74 45 85 14\\r\\n68 94 11 3 89\\r\\n68 67 97 62 66\\r\\n65 76 96 18 84\\r\\n61 98 28 94 74\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['9\\r\\n53 80 94 41 58 49 88 24 42\\r\\n85 11 32 64 40 56 63 95 73\\r\\n17 85 60 41 13 71 54 67 87\\r\\n38 14 21 81 66 59 52 33 86\\r\\n29 34 46 18 19 80 10 44 51\\r\\n4 27 65 75 77 21 15 49 50\\r\\n35 68 86 98 98 62 69 52 71\\r\\n43 28 56 91 89 21 14 57 79\\r\\n27 27 29 26 15 76 21 70 78\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['7\\r\\n80 81 45 81 72 19 65\\r\\n31 24 15 52 47 1 14\\r\\n81 35 42 24 96 59 46\\r\\n16 2 59 56 60 98 76\\r\\n20 95 10 68 68 56 93\\r\\n60 16 68 77 89 52 43\\r\\n11 22 43 36 99 2 11\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['9\\r\\n33 80 34 56 56 33 27 74 57\\r\\n14 69 78 44 56 70 26 73 47\\r\\n13 42 17 33 78 83 94 70 37\\r\\n96 78 92 6 16 68 8 31 46\\r\\n67 97 21 10 44 64 15 77 28\\r\\n34 44 83 96 63 52 29 27 79\\r\\n23 23 57 54 35 16 5 64 36\\r\\n29 71 36 78 47 81 72 97 36\\r\\n24 83 70 58 36 82 42 44 26\\r\\n'], 'output': ['41\\r\\n']}, {'input': ['9\\r\\n57 70 94 69 77 59 88 63 83\\r\\n6 79 46 5 9 43 20 39 48\\r\\n46 35 58 22 17 3 81 82 34\\r\\n77 10 40 53 71 84 14 58 56\\r\\n6 92 77 81 13 20 77 29 40\\r\\n59 53 3 97 21 97 22 11 64\\r\\n52 91 82 20 6 3 99 17 44\\r\\n79 25 43 69 85 55 95 61 31\\r\\n89 24 50 84 54 93 54 60 87\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['5\\r\\n77 44 22 21 20\\r\\n84 3 35 86 35\\r\\n97 50 1 44 92\\r\\n4 88 56 20 3\\r\\n32 56 26 17 80\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['7\\r\\n62 73 50 63 66 92 2\\r\\n27 13 83 84 88 81 47\\r\\n60 41 25 2 68 32 60\\r\\n7 94 18 98 41 25 72\\r\\n69 37 4 10 82 49 91\\r\\n76 26 67 27 30 49 18\\r\\n44 78 6 1 41 94 80\\r\\n'], 'output': ['26\\r\\n']}, {'input': ['9\\r\\n40 70 98 28 44 78 15 73 20\\r\\n25 74 46 3 27 59 33 96 19\\r\\n100 47 99 68 68 67 66 87 31\\r\\n26 39 8 91 58 20 91 69 81\\r\\n77 43 90 60 17 91 78 85 68\\r\\n41 46 47 50 96 18 69 81 26\\r\\n10 58 2 36 54 64 69 10 65\\r\\n6 86 26 7 88 20 43 92 59\\r\\n61 76 13 23 49 28 22 79 8\\r\\n'], 'output': ['44\\r\\n']}, {'input': ['8\\r\\n44 74 25 81 32 33 55 58\\r\\n36 13 28 28 20 65 87 58\\r\\n8 35 52 59 34 15 33 16\\r\\n2 22 42 29 11 66 30 72\\r\\n33 47 8 61 31 64 59 63\\r\\n79 36 38 42 12 21 92 36\\r\\n56 47 44 6 6 1 37 2\\r\\n79 88 79 53 50 69 94 39\\r\\n'], 'output': ['31\\r\\n']}, {'input': ['5\\r\\n4 91 100 8 48\\r\\n78 56 61 49 83\\r\\n12 21 95 77 78\\r\\n40 20 91 79 25\\r\\n32 88 94 28 55\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5\\r\\n23 70 5 36 69\\r\\n83 18 19 98 40\\r\\n84 91 18 51 35\\r\\n17 18 35 47 59\\r\\n29 72 35 87 27\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['12\\r\\n8 42 23 20 39 5 23 86 26 65 93 82\\r\\n48 35 12 4 59 19 19 28 38 81 97 99\\r\\n93 24 31 44 97 50 44 99 50 7 10 64\\r\\n79 43 65 29 84 43 46 41 89 16 6 1\\r\\n34 90 33 1 7 12 46 84 67 30 1 58\\r\\n58 21 100 66 56 22 7 24 72 73 86 37\\r\\n2 17 85 6 2 73 85 44 43 79 34 65\\r\\n3 53 29 76 87 2 27 19 11 42 71 38\\r\\n69 82 73 52 44 23 92 10 13 72 59 16\\r\\n73 32 37 93 21 94 43 39 27 53 14 15\\r\\n86 16 90 91 14 50 73 61 77 36 93 90\\r\\n22 56 30 52 81 70 12 92 75 27 38 12\\r\\n'], 'output': ['77\\r\\n']}, {'input': ['3\\r\\n41 94 58\\r\\n73 61 8\\r\\n34 88 89\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['3\\r\\n1 2 3\\r\\n1 1 1\\r\\n1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2\\r\\n7 3\\r\\n9 5\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n4 3 2\\r\\n2 2 2\\r\\n2 2 2\\r\\n'], 'output': ['4\\r\\n']}]","id":643} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"158_D","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\r\n# Codeforces Practice - 26 May 2012\r\nuse strict;\r\nuse warnings;\r\n\r\n\r\nmy $n = ;\r\nchomp($n);\r\n\r\nmy @tis = split(\" \",);\r\nmy $tSum =0;\r\n$tSum += $_ for @tis;\r\nif($n%2==1 || $n<6) {print $tSum;}\r\nelse {\r\nmy ($sum1,$sum2) = (0,0);\r\nmy $toggle = 0;\r\nforeach my $t (@tis) {\r\n if($toggle){\r\n $sum1 += $t;\r\n } else {\r\n $sum2 += $t;\r\n }\r\n $toggle = not $toggle;\r\n}\r\nif($sum1 >= $tSum && $sum1 >= $sum2){print $sum1;}\r\nelsif($sum2 >= $tSum && $sum2 >= $sum1){print $sum2;}\r\nelse {print $tSum;}\r\n}\r\n","description":"The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus n ice sculptures were erected. The sculptures are arranged in a circle at equal distances from each other, so they form a regular n-gon. They are numbered in clockwise order with numbers from 1 to n.The site of the University has already conducted a voting that estimated each sculpture's characteristic of ti \u2014 the degree of the sculpture's attractiveness. The values of ti can be positive, negative or zero.When the university rector came to evaluate the work, he said that this might be not the perfect arrangement. He suggested to melt some of the sculptures so that: the remaining sculptures form a regular polygon (the number of vertices should be between 3 and n), the sum of the ti values of the remaining sculptures is maximized. Help the Vice Rector to analyze the criticism \u2014 find the maximum value of ti sum which can be obtained in this way. It is allowed not to melt any sculptures at all. The sculptures can not be moved.","input_specification":"The first input line contains an integer n (3\u2264n\u226420000) \u2014 the initial number of sculptures. The second line contains a sequence of integers t1,t2,...,tn, ti \u2014 the degree of the i-th sculpture's attractiveness (-1000\u2264ti\u22641000). The numbers on the line are separated by spaces.\n","output_specification":"Print the required maximum sum of the sculptures' attractiveness.\n","notes":"In the first sample it is best to leave every second sculpture, that is, leave sculptures with attractivenesses: 2, 4, 5 \u0438 3.\n","sample_inputs":["8\n1 2 -3 4 -5 5 2 3\n","6\n1 -2 3 -4 5 -6\n","6\n1 2 3 4 5 6\n"],"sample_outputs":["14\n","9\n","21\n"],"human_solution":"use strict;\r\n\r\nchomp(my $n = <>);\r\nmy @a = split \/ \/, <>;\r\n\r\nmy $res = -1e9;\r\n\r\nfor (my $i = 1; $i <= $n \/ 3; $i++) {\r\n $n % $i == 0 or next;\r\n for (my $j = 0; $j < $i; ++$j) {\r\n my $t = 0;\r\n for (my $x = $j; $x < $n; $x += $i) {\r\n $t += $a[$x];\r\n }\r\n $res = $res > $t ? $res : $t;\r\n }\r\n}\r\n\r\nprint $res, \"\\n\";","testcases":"[{'input': ['8\\r\\n1 2 -3 4 -5 5 2 3\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['6\\r\\n1 -2 3 -4 5 -6\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['6\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['4\\r\\n1 -10 1 -10\\r\\n'], 'output': ['-18\\r\\n']}, {'input': ['6\\r\\n1 0 1 0 1 0\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n1 1 1 1 1 1 1 -1000 1 1 1 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3\\r\\n-1 -1 -1\\r\\n'], 'output': ['-3\\r\\n']}, {'input': ['97\\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\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 -1 1 1 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6\\r\\n-8 -8 6 5 -5 1\\r\\n'], 'output': ['-2\\r\\n']}, {'input': ['7\\r\\n0 55 -5 50 53 34 84\\r\\n'], 'output': ['271\\r\\n']}, {'input': ['9\\r\\n-2 -1 2 0 1 1 -1 -2 -2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n5 -5 -4 3 -1 -1 2 1 5 -2\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['13\\r\\n6 7 8 2 5 1 -9 -6 9 10 8 9 -8\\r\\n'], 'output': ['42\\r\\n']}]","id":644} {"difficulty":1200,"lang":"Perl","lang_cluster":"Perl","src_uid":"15_A","execute_outcome":"WRONG_ANSWER","source_code":"($n, $t) = split(\/ \/, <>);\r\n$t += $t;\r\nfor $i (1..$n) {\r\n ($x, $a) = split(\/ \/, <>);\r\n $x += $x;\r\n push @arr, [$x-$a, $x+$a];\r\n}\r\n@arr = sort {$a[0] cmp $b[0]} @arr;\r\n$ans = 2;\r\nfor $i (1..$n-1) {\r\n $pr = $arr[$i-1][1];\r\n $cl = $arr[$i][0];\r\n $ans += $cl > $pr+$t ? 2:\r\n $cl == $pr+$t ? 1:0;\r\n}\r\nprint \"$ans\\n\";\r\n","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\u2264n,t\u22641000). 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 (-1000\u2264xi\u22641000, 1\u2264ai\u22641000).\n","output_specification":"Output the amount of possible positions of the new house.\n","notes":"It is possible for the x-coordinate of the new house to have non-integer value.\n","sample_inputs":["2 2\n0 4\n6 2\n","2 2\n0 4\n5 2\n","2 3\n0 4\n5 2\n"],"sample_outputs":["4\n","3\n","2\n"],"human_solution":"($n, $t) = split(\/ \/, <>);\r\n$t += $t;\r\nfor $i (1..$n) {\r\n ($x, $a) = split(\/ \/, <>);\r\n $x += $x;\r\n push @arr, [$x-$a, $x+$a];\r\n}\r\n@arr = sort {$a->[0] <=> $b->[0]} @arr;\r\n$ans = 2;\r\nfor $i (1..$n-1) {\r\n $pr = $arr[$i-1][1];\r\n $cl = $arr[$i][0];\r\n $ans += $cl > $pr+$t ? 2:\r\n $cl == $pr+$t ? 1:0;\r\n}\r\nprint \"$ans\\n\";\r\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":645} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"160_A","execute_outcome":"WRONG_ANSWER","source_code":"$n=<>;\r\n@arr=split(' ',);\r\n#@arr=sort(@arr);\r\n@arr = sort {$a <=> $b} @arr;\r\n$som=0;\r\nfor($i=0;$i<$n;$i++){\r\n$som+=$arr[$i];\r\n}\r\nprint \"@arr\\n\";\r\n$ok=1;\r\n$i=$n-2;\r\n$profit=$arr[$n-1];\r\n$nb=1;\r\n\r\nwhile($ok && $i>=0){\r\nif($profit<=$som\/2){\r\n$nb++;\r\n$profit+=$arr[$i];\r\n}\r\nelse{\r\n$ok=0;\r\n}\r\n$i--;\r\n}\r\nprint $nb;","description":"Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like.Now let's imagine a typical morning in your family. You haven't woken up yet, and Mom is already going to work. She has been so hasty that she has nearly forgotten to leave the two of her darling children some money to buy lunches in the school cafeteria. She fished in the purse and found some number of coins, or to be exact, n coins of arbitrary values a1,a2,...,an. But as Mom was running out of time, she didn't split the coins for you two. So she scribbled a note asking you to split the money equally.As you woke up, you found Mom's coins and read her note. \"But why split the money equally?\" \u2014 you thought. After all, your twin is sleeping and he won't know anything. So you decided to act like that: pick for yourself some subset of coins so that the sum of values of your coins is strictly larger than the sum of values of the remaining coins that your twin will have. However, you correctly thought that if you take too many coins, the twin will suspect the deception. So, you've decided to stick to the following strategy to avoid suspicions: you take the minimum number of coins, whose sum of values is strictly more than the sum of values of the remaining coins. On this basis, determine what minimum number of coins you need to take to divide them in the described manner.","input_specification":"The first line contains integer n (1\u2264n\u2264100) \u2014 the number of coins. The second line contains a sequence of n integers a1, a2, ..., an (1\u2264ai\u2264100) \u2014 the coins' values. All numbers are separated with spaces.\n","output_specification":"In the single line print the single number \u2014 the minimum needed number of coins.\n","notes":"In the first sample you will have to take 2 coins (you and your twin have sums equal to 6,0 correspondingly). If you take 1 coin, you get sums 3,3. If you take 0 coins, you get sums 0,6. Those variants do not satisfy you as your sum should be strictly more that your twins' sum.\nIn the second sample one coin isn't enough for us, too. You can pick coins with values 1,2 or 2,2. In any case, the minimum number of coins equals 2. \n","sample_inputs":["2\n3 3\n","3\n2 1 2\n"],"sample_outputs":["2\n","2\n"],"human_solution":"use POSIX;\r\nmy $line;\r\nmy @input1; my @input2;\r\nmy $key1 = 0; my $key2 = 0; my $key3 = 0; my $key4 = 0;\r\nmy $s = 0; my $c; my $result; my $i;\r\n\r\n$line = ;\r\nchomp($line);\r\n@input1 = split('', $line);\r\n\r\n$line = ;\r\nchomp($line);\r\n@input2 = split(' ', $line);\r\n\r\n# 1 5 10 10 1 1 5 25 10 1 5 5 5 1 1 1 10\r\n# sum -> divide by 2 -> take from largest until half is surpassed\r\nforeach $c (split(' ', $line)) {\r\n $s += $c;\r\n}\r\n$s = POSIX::floor($s \/ 2);\r\n$i = 0;\r\n$result = 0;\r\n@input2 = sort { $b <=> $a } @input2;\r\nwhile ($result <= $s) {\r\n $result += @input2[$i];\r\n $i++;\r\n}\r\nprint $i;\r\nexit;","testcases":"[{'input': ['2\\r\\n3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n2 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n4 2 2 2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['7\\r\\n1 10 1 2 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3 2 3 3 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n2 1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6\\r\\n1 1 1 1 1 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7\\r\\n10 10 5 5 5 5 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\n2 1 2 2 2 1 1 2 1 2 2 1 1 1 1 2 1 1 1 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n4 2 4 4 3 4 2 2 4 2 3 1 1 2 2 3 3 3 1 4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n35 26 41 40 45 46 22 26 39 23 11 15 47 42 18 15 27 10 45 40\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['20\\r\\n7 84 100 10 31 35 41 2 63 44 57 4 63 11 23 49 98 71 16 90\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['50\\r\\n19 2 12 26 17 27 10 26 17 17 5 24 11 15 3 9 16 18 19 1 25 23 18 6 2 7 25 7 21 25 13 29 16 9 25 3 14 30 18 4 10 28 6 10 8 2 2 4 8 28\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['70\\r\\n2 18 18 47 25 5 14 9 19 46 36 49 33 32 38 23 32 39 8 29 31 17 24 21 10 15 33 37 46 21 22 11 20 35 39 13 11 30 28 40 39 47 1 17 24 24 21 46 12 2 20 43 8 16 44 11 45 10 13 44 31 45 45 46 11 10 33 35 23 42\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['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': ['51\\r\\n']}, {'input': ['100\\r\\n1 2 2 1 2 1 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 2 2 1 2 1 2 1 2 2 2 1 2 1 2 2 1 1 2 2 1 1 2 2 2 1 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 1 2 2 1 1 1 1 2 1 1 1 1 2 2 2 2\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['100\\r\\n1 2 3 2 1 2 2 3 1 3 3 2 2 1 1 2 2 1 1 1 1 2 3 3 2 1 1 2 2 2 3 3 3 2 1 3 1 3 3 2 3 1 2 2 2 3 2 1 1 3 3 3 3 2 1 1 2 3 2 2 3 2 3 2 2 3 2 2 2 2 3 3 3 1 3 3 1 1 2 3 2 2 2 2 3 3 3 2 1 2 3 1 1 2 3 3 1 3 3 2\\r\\n'], 'output': ['36\\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': ['33\\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': ['30\\r\\n']}, {'input': ['100\\r\\n16 9 11 8 11 4 9 17 4 8 4 10 9 10 6 3 3 15 1 6 1 15 12 18 6 14 13 18 1 7 18 4 10 7 10 12 3 16 14 4 10 8 10 7 19 13 15 1 4 8 16 10 6 4 3 16 11 10 7 3 4 16 1 20 1 11 4 16 10 7 7 12 18 19 3 17 19 3 4 19 2 12 11 3 18 20 2 2 14 4 20 13 13 11 16 20 19 14 7 2\\r\\n'], 'output': ['29\\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': ['30\\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': ['29\\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 92 93 94 95 96 97 98 99 100\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n4 1 2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n2 2 2 4 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\n100 99 99 100\\r\\n'], 'output': ['2\\r\\n']}]","id":646} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"185_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse bigint; # Hope for the best! Yeah, it's rather slow :-(\n\nmain();\n\nsub main {\n my $years = <>;\n if (! $years) {\n print 1;\n goto end;\n }\n my $mod = 1000000007;\n my $h_amount = mpow(2, $years-1, $mod);\n my $last = ($h_amount * 2) % $mod;\n my $result = ((1 + $last) * $h_amount) % $mod;\n print $result;\nend:\n}\n\nsub mpow {\n my ($x, $n, $mod) = @_;\n my $b = 1;\n while ($n > 0) {\n if ($n % 2) {\n $n--;\n $b *= $x;\n $b = $b % $mod;\n } else {\n $n \/= 2;\n $x *= $x;\n $x = $x % $mod;\n }\n }\n return $b % $mod;\n}","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\u2264n\u226410^18) \u2014 the number of full years when the plant grew.\nPlease 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.\n","output_specification":"Print a single integer \u2014 the remainder of dividing the number of plants that will point \"upwards\" in n years by 1000000007 (10^9+7).\n","notes":"The first test sample corresponds to the second triangle on the figure in the statement. The second test sample corresponds to the third one.\n","sample_inputs":["1\n","2\n"],"sample_outputs":["3\n","10\n"],"human_solution":"#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse bigint; # Hope for the best! Yeah, it's rather slow :-(\n\nmain();\n\nsub main {\n my $years = <>;\n if ($years == 0) {\n print 1;\n goto end;\n }\n my $mod = 1000000007;\n my $h_amount = mpow(2, $years-1, $mod);\n my $last = ($h_amount * 2) % $mod;\n my $result = ((1 + $last) * $h_amount) % $mod;\n print $result;\nend:\n}\n\nsub mpow {\n my ($x, $n, $mod) = @_;\n my $b = 1;\n while ($n > 0) {\n if ($n % 2) {\n $n--;\n $b *= $x;\n $b = $b % $mod;\n } else {\n $n \/= 2;\n $x *= $x;\n $x = $x % $mod;\n }\n }\n return $b % $mod;\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":647} {"difficulty":1400,"lang":"Perl","lang_cluster":"Perl","src_uid":"197_B","execute_outcome":"WRONG_ANSWER","source_code":"my ($n, $m) = split(\/\\s\/, );\nmy @arr1 = split(\/\\s\/, );\nmy @arr2 = split(\/\\s\/, );\n\nif($n > $m){\n if($arr1[0] > 0){\n print \"Infinity\";\n }else{\n print \"-Infinity\";\n }\n}elsif($n < $m){\n print '-' if($arr2[0] < 0);\n print \"0\/\". abs($arr2[0]);\n}else{\n my $s = $arr1[0] * $arr2[0];\n print '-' if($s < 0);\n $s = gcd($arr1[0], $arr2[0]) if($arr1[0] != 0 && $arr2[0] != 0);;\n \n if($s == -1 || $s == 0){\n print abs($arr1[0]) . '\/' . abs($arr2[0]);\n }else{\n print abs($arr1[0] \/ $s) . '\/' . abs($arr2[0] \/ $s);\n }\n}\n\nsub gcd {\n my $a = shift;\n my $b = shift;\n my $m = ($a > $b) ? $b : $a;\n \n for(my $i = $m; $i >= 2 ; $i--){\n return $i if(($a%$i == 0) && ($b%$i == 0));\n }\n return -1;\n}\n\n","description":"You are given two polynomials: P(x)=a0\u00b7x^n+a1\u00b7x^n-1+...+an-1\u00b7x+an and Q(x)=b0\u00b7x^m+b1\u00b7x^m-1+...+bm-1\u00b7x+bm. Calculate limit .","input_specification":"The first line contains two space-separated integers n and m (0\u2264n,m\u2264100) \u2014 degrees of polynomials P(x) and Q(x) correspondingly.\nThe second line contains n+1 space-separated integers \u2014 the factors of polynomial P(x): a0, a1, ..., an-1, an (-100\u2264ai\u2264100,a0\u22600).\nThe third line contains m+1 space-separated integers \u2014 the factors of polynomial Q(x): b0, b1, ..., bm-1, bm (-100\u2264bi\u2264100,b0\u22600).\n","output_specification":"If the limit equals +\u221e, print \"Infinity\" (without quotes). If the limit equals -\u221e, print \"-Infinity\" (without the quotes).\nIf the value of the limit equals zero, print \"0\/1\" (without the quotes).\nOtherwise, print an irreducible fraction \u2014 the value of limit , in the format \"p\/q\" (without the quotes), where p is the \u2014 numerator, q (q>0) is the denominator of the fraction.\n","notes":"Let's consider all samples:\n You can learn more about the definition and properties of limits if you follow the link: http:\/\/en.wikipedia.org\/wiki\/Limit_of_a_function\n","sample_inputs":["2 1\n1 1 1\n2 5\n","1 0\n-1 3\n2\n","0 1\n1\n1 0\n","2 2\n2 1 6\n4 5 -7\n","1 1\n9 0\n-5 2\n"],"sample_outputs":["Infinity\n","-Infinity\n","0\/1\n","1\/2\n","-9\/5\n"],"human_solution":"#!perl -w\r\nuse strict;\r\nuse warnings;\r\n\r\nmain();\r\n\r\nsub main {\r\n my ($n, $m) = map int, split \/\\D\/, <>;\r\n my (@p, @q); my $lim;\r\n my $s = <>; chomp $s;\r\n @p = reverse map int, split \/ \/, $s;\r\n $s = <>; chomp($s);\r\n @q = reverse map int, split \/ \/, $s;\r\n while ($p[$#p] == 0) { pop @p } ;\r\n while ($q[$#q] == 0) { pop @q } ;\r\n if (! @q) { @q = (0); }\r\n if (! @p) { @p = (0); }\r\n if (@p > @q) {\r\n if (($p[$#p] * $q[$#q] >= 0) || ($q[$#q] == 0)) {\r\n $lim = \"Infinity\";\r\n } else {\r\n $lim = \"-Infinity\";\r\n }\r\n } elsif (@p < @q) {\r\n $lim = \"0\/1\";\r\n } else {\r\n my ($u, $d) = ($p[$#p], $q[$#q]);\r\n if ($d < 0) {\r\n ($u, $d) = (-$u, -$d);\r\n }\r\n my $g = gcd(abs $u, abs $d);\r\n $u \/= $g; $d \/= $g;\r\n #if ($d > 1) {\r\n $lim = \"$u\" . \"\/\" . \"$d\";\r\n #} else {\r\n # $lim = $u;\r\n #}\r\n }\r\n print $lim;\r\n}\r\n\r\nsub gcd {\r\n my ($a, $b) = @_;\r\n ($a,$b) = ($b,$a) if $a > $b;\r\n while ($a) {\r\n ($a, $b) = ($b % $a, $a);\r\n }\r\n return $b;\r\n}\r\n\r\n__END__\r\n","testcases":"[{'input': ['2 1\\r\\n1 1 1\\r\\n2 5\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['1 0\\r\\n-1 3\\r\\n2\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['0 1\\r\\n1\\r\\n1 0\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['2 2\\r\\n2 1 6\\r\\n4 5 -7\\r\\n'], 'output': ['1\/2\\n']}, {'input': ['1 1\\r\\n9 0\\r\\n-5 2\\r\\n'], 'output': ['-9\/5\\n']}, {'input': ['1 2\\r\\n5 3\\r\\n-3 2 -1\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['1 2\\r\\n-4 8\\r\\n-2 5 -3\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['3 2\\r\\n4 3 1 2\\r\\n-5 7 0\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['2 1\\r\\n-3 5 1\\r\\n-8 0\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['1 1\\r\\n-5 7\\r\\n3 1\\r\\n'], 'output': ['-5\/3\\n']}, {'input': ['2 2\\r\\n-4 2 1\\r\\n-5 8 -19\\r\\n'], 'output': ['4\/5\\n']}, {'input': ['0 100\\r\\n1\\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 100\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['100 0\\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 100\\r\\n1\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['0 0\\r\\n36\\r\\n-54\\r\\n'], 'output': ['-2\/3\\n']}, {'input': ['0 0\\r\\n36\\r\\n-8\\r\\n'], 'output': ['-9\/2\\n']}, {'input': ['0 0\\r\\n-6\\r\\n-8\\r\\n'], 'output': ['3\/4\\n']}, {'input': ['0 2\\r\\n-3\\r\\n1 4 6\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['0 0\\r\\n-21\\r\\n13\\r\\n'], 'output': ['-21\/13\\n']}, {'input': ['0 0\\r\\n-34\\r\\n21\\r\\n'], 'output': ['-34\/21\\n']}, {'input': ['0 0\\r\\n-55\\r\\n34\\r\\n'], 'output': ['-55\/34\\n']}, {'input': ['33 100\\r\\n-15 -90 -84 57 67 60 -40 -82 83 -80 43 -15 -36 -14 -37 -49 42 -79 49 -7 -12 53 -44 -21 87 -91 -73 -27 13 65 5 74 -21 -52\\r\\n-67 -17 36 -46 -5 31 -45 -35 -49 13 -7 -82 92 -55 -67 -96 31 -70 76 24 -29 26 96 19 -40 99 -26 74 -17 -56 -72 24 -71 -62 10 -56 -74 75 -48 -98 -67 -26 47 7 63 -38 99 66 -25 -31 -24 -42 -49 -27 -45 -2 -37 -16 5 -21 97 33 85 -33 93 30 84 73 -48 18 -36 71 -38 -41 28 1 -7 -15 60 59 -20 -38 -86 90 2 -12 72 -43 26 76 97 7 -2 -47 -4 100 -40 -48 53 -54 0\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['39 87\\r\\n78 -50 18 -32 -12 -65 83 41 -6 53 -26 64 -19 -53 -61 91 -49 -66 67 69 100 -39 95 99 86 -67 -66 63 48 26 -4 95 -54 -71 26 -74 -93 79 -91 -45\\r\\n-18 23 48 59 76 82 95 2 -26 18 -39 -74 44 -92 40 -44 1 -97 -100 -63 -54 -3 -86 85 28 -50 41 -53 -74 -29 -91 87 27 -42 -90 -15 -26 -15 -100 -70 -10 -41 16 85 71 -39 -31 -65 80 98 9 23 -40 14 -88 15 -34 10 -67 -94 -58 -24 75 48 -42 56 -77 -13 -25 -79 -100 -57 89 45 22 85 78 -93 -79 69 63 44 74 94 35 -65 -12 -88\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['47 56\\r\\n31 -99 -97 6 -45 -5 89 35 -77 69 57 91 -32 -66 -36 16 30 61 -36 32 48 67 5 -85 65 -11 -51 -63 -51 -16 39 -26 -60 -28 91 43 -90 32 44 83 70 -53 51 56 68 -81 76 79\\r\\n61 -21 -75 -36 -24 -19 80 26 -28 93 27 72 -39 -46 -38 68 -29 -16 -63 84 -13 64 55 63 77 5 68 70 15 99 12 -69 50 -48 -82 -3 52 -54 68 91 -37 -100 -5 74 24 91 -1 74 28 29 -87 -13 -88 82 -13 58 23\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['9 100\\r\\n-34 88 33 -80 87 31 -53 -3 8 -70\\r\\n31 -25 46 78 8 82 -92 -36 -30 85 -93 86 -87 75 8 -71 44 -41 -83 19 89 -28 81 42 79 86 41 -23 64 -31 46 24 -79 23 71 63 99 90 -16 -70 -1 88 10 65 3 -99 95 52 -80 53 -24 -43 -30 -7 51 40 -47 44 -10 -18 -61 -67 -84 37 45 93 -5 68 32 3 -61 -100 38 -21 -91 90 83 -45 75 89 17 -44 75 14 -28 1 -84 -100 -36 84 -40 88 -84 -54 2 -32 92 -49 77 85 91\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['28 87\\r\\n-77 49 37 46 -92 65 89 100 53 76 -43 47 -80 -46 -94 -4 20 46 81 -41 86 25 69 60 15 -78 -98 -7 -42\\r\\n-85 96 59 -40 90 -72 41 -17 -40 -15 -98 66 47 9 -33 -63 59 -25 -31 25 -94 35 28 -36 -41 -38 -38 -54 -40 90 7 -10 98 -19 54 -10 46 -58 -88 -21 90 82 37 -70 -98 -63 41 75 -50 -59 -69 79 -93 -3 -45 14 76 28 -28 -98 -44 -39 71 44 90 91 0 45 7 65 68 39 -27 58 68 -47 -41 100 14 -95 -80 69 -88 -51 -89 -70 -23 95\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['100 4\\r\\n-5 -93 89 -26 -79 14 -28 13 -45 69 50 -84 21 -68 62 30 -26 99 -12 39 20 -74 -39 -41 -28 -72 -55 28 20 31 -92 -20 76 -65 57 72 -36 4 33 -28 -19 -41 -40 40 84 -36 -83 75 -74 -80 32 -50 -56 72 16 75 57 90 -19 -10 67 -71 69 -48 -48 23 37 -31 -64 -86 20 67 97 14 82 -41 2 87 65 -81 -27 9 -79 -1 -5 84 -8 29 -34 31 82 40 21 -53 -31 -45 17 -33 79 50 -94\\r\\n56 -4 -90 36 84\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['77 51\\r\\n89 45 -33 -87 33 -61 -79 40 -76 16 -17 31 27 25 99 82 51 -40 85 -66 19 89 -62 24 -61 -53 -77 17 21 83 53 -18 -56 75 9 -78 33 -11 -6 96 -33 -2 -57 97 30 20 -41 42 -13 45 -99 67 37 -20 51 -33 88 -62 2 40 17 36 45 71 4 -44 24 20 -2 29 -12 -84 -7 -84 -38 48 -73 79\\r\\n60 -43 60 1 90 -1 19 -18 -21 31 -76 51 79 91 12 39 -33 -14 71 -90 -65 -93 -58 93 49 17 77 19 32 -8 14 58 -9 85 -95 -73 0 85 -91 -99 -30 -43 61 20 -89 93 53 20 -33 -38 79 54\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['84 54\\r\\n82 -54 28 68 74 -61 54 98 59 67 -65 -1 16 65 -78 -16 61 -79 2 14 44 96 -62 77 51 87 37 66 65 28 88 -99 -21 -83 24 80 39 64 -65 45 86 -53 -49 94 -75 -31 -42 -1 -35 -18 74 30 31 -40 30 -6 47 58 -71 -21 20 13 75 -79 15 -98 -26 76 99 -77 -9 85 48 51 -87 56 -53 37 47 -3 94 64 -7 74 86\\r\\n72 51 -74 20 41 -76 98 58 24 -61 -97 -73 62 29 6 42 -92 -6 -65 89 -32 -9 82 -13 -88 -70 -97 25 -48 12 -54 33 -92 -29 48 60 -21 86 -17 -86 45 -34 -3 -9 -62 12 25 -74 -76 -89 48 55 -30 86 51\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['73 15\\r\\n-70 78 51 -33 -95 46 87 -33 16 62 67 -85 -57 75 -93 -59 98 -45 -90 -88 9 53 35 37 28 3 40 -87 28 5 18 11 9 1 72 69 -65 -62 1 73 -3 3 35 17 -28 -31 -45 60 64 18 60 38 -47 12 2 -90 -4 33 -51 -55 -54 90 38 -65 39 32 -70 0 -5 3 -12 100 78 55\\r\\n46 33 41 52 -89 -9 53 -81 34 -45 -11 -41 14 -28 95 -50\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['33 1\\r\\n-75 -83 87 -27 -48 47 -90 -84 -18 -4 14 -1 -83 -98 -68 -85 -86 28 2 45 96 -59 86 -25 -2 -64 -92 65 69 72 72 -58 -99 90\\r\\n-1 72\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['58 58\\r\\n-25 40 -34 23 -52 94 -30 -99 -71 -90 -44 -71 69 48 -45 -59 0 66 -70 -96 95 91 82 90 -95 87 3 -77 -77 -26 15 87 -82 5 -24 82 -11 99 35 49 22 44 18 -60 -26 79 67 71 -13 29 -23 9 58 -90 88 18 77 5 -7\\r\\n-30 -11 -13 -50 61 -78 11 -74 -73 13 -66 -65 -82 38 58 25 -64 -24 78 -87 6 6 -80 -96 47 -25 -54 10 -41 -22 -50 -1 -6 -22 27 54 -32 30 93 88 -70 -100 -69 -47 -20 -92 -24 70 -93 42 78 42 -35 41 31 75 -67 -62 -83\\r\\n'], 'output': ['5\/6\\n']}, {'input': ['20 20\\r\\n5 4 91 -66 -57 55 -79 -2 -54 -72 -49 21 -23 -5 57 -48 70 -16 -86 -26 -19\\r\\n51 -60 64 -8 89 27 -96 4 95 -24 -2 -27 -41 -14 -88 -19 24 68 -31 34 -62\\r\\n'], 'output': ['5\/51\\n']}, {'input': ['69 69\\r\\n-90 -63 -21 23 23 -14 -82 65 42 -60 -42 -39 67 34 96 93 -42 -24 21 -80 44 -81 45 -74 -19 -88 39 58 90 87 16 48 -19 -2 36 87 4 -66 -82 -49 -32 -43 -65 12 34 -29 -58 46 -67 -20 -30 91 21 65 15 2 3 -92 -67 -68 39 -24 77 76 -17 -34 5 63 88 83\\r\\n-55 98 -79 18 -100 -67 -79 -85 -75 -44 -6 -73 -11 -12 -24 -78 47 -51 25 -29 -34 25 27 11 -87 15 -44 41 -44 46 -67 70 -35 41 62 -36 27 -41 -42 -50 96 31 26 -66 9 74 34 31 25 6 -84 41 74 -7 49 5 35 -5 -71 -37 28 58 -8 -40 -19 -83 -34 64 7 15\\r\\n'], 'output': ['18\/11\\n']}, {'input': ['0 0\\r\\n46\\r\\n-33\\r\\n'], 'output': ['-46\/33\\n']}, {'input': ['67 67\\r\\n-8 11 55 80 -26 -38 58 73 -48 -10 35 75 16 -84 55 -51 98 58 -28 98 77 81 51 -86 -46 68 -87 -80 -49 81 96 -97 -42 25 6 -8 -55 -25 93 -29 -33 -6 -26 -85 73 97 63 57 51 92 -6 -8 4 86 46 -45 36 -19 -71 1 71 39 97 -44 -34 -1 2 -46\\r\\n91 -32 -76 11 -40 91 -8 -100 73 80 47 82 24 0 -71 82 -93 38 -54 1 -55 -53 90 -86 0 10 -35 49 90 56 25 17 46 -43 13 16 -82 -33 64 -83 -56 22 12 -74 4 -68 85 -27 60 -28 -47 73 -93 69 -37 54 -3 90 -56 56 78 61 7 -79 48 -42 -10 -48\\r\\n'], 'output': ['-8\/91\\n']}, {'input': ['69 69\\r\\n-7 38 -3 -22 65 -78 -65 -99 -76 63 0 -4 -78 -51 54 -61 -53 60 80 34 -96 99 -78 -96 21 -10 -86 33 -9 -81 -19 -2 -76 -3 -66 -80 -55 -21 -50 37 -86 -37 47 44 76 -39 54 -25 41 -86 -3 -25 -67 94 18 67 27 -5 -30 -69 2 -76 7 -97 -52 -35 -55 -20 92 2\\r\\n90 -94 37 41 -27 -54 96 -15 -60 -29 -75 -93 -57 62 48 -88 -99 -62 4 -9 85 33 65 -95 -30 16 -29 -89 -33 -83 -35 -21 53 -52 80 -40 76 -33 86 47 18 43 -67 -36 -99 -42 1 -94 -78 34 -41 73 96 2 -60 29 68 -96 -21 -61 -98 -67 1 40 85 55 66 -25 -50 -83\\r\\n'], 'output': ['-7\/90\\n']}, {'input': ['17 17\\r\\n-54 59 -95 87 3 -27 -30 49 -87 74 45 78 36 60 -95 41 -53 -70\\r\\n-27 16 -67 -24 10 -73 -41 12 -52 53 -73 -17 -56 -74 -33 -8 100 -39\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['1 1\\r\\n36 -49\\r\\n-32 -40\\r\\n'], 'output': ['-9\/8\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['1 1\\r\\n-2 1\\r\\n4 1\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n2\\r\\n1\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-3\\r\\n'], 'output': ['-4\/3\\n']}, {'input': ['0 0\\r\\n2\\r\\n2\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n17\\r\\n-10\\r\\n'], 'output': ['-17\/10\\n']}, {'input': ['0 0\\r\\n-1\\r\\n2\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n1\\r\\n1\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n50\\r\\n20\\r\\n'], 'output': ['5\/2\\n']}, {'input': ['0 0\\r\\n20\\r\\n20\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-2\\r\\n'], 'output': ['-2\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-6\\r\\n'], 'output': ['-2\/3\\n']}, {'input': ['0 0\\r\\n1\\r\\n-2\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n4\\r\\n2\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['0 0\\r\\n2\\r\\n-4\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['1 1\\r\\n4 1\\r\\n2 1\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['2 2\\r\\n-13 1 3\\r\\n6 3 2\\r\\n'], 'output': ['-13\/6\\n']}, {'input': ['99 99\\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\\n2 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 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n'], 'output': ['1\/2\\n']}, {'input': ['0 0\\r\\n5\\r\\n5\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n2\\r\\n-1\\r\\n'], 'output': ['-2\/1\\n']}]","id":648} {"difficulty":1000,"lang":"Perl","lang_cluster":"Perl","src_uid":"1_A","execute_outcome":"RUNTIME_ERROR","source_code":"# LUOGU_RID: 110532149\ndfgdfgdf\nfghfg\nhf\ngh\nfg\nhf\ngh\nfg\nh\nfg\nh\nfg\nh\nfg\nhfghfghfg","description":"Theatre Square in the capital city of Berland has a rectangular shape with the size n\u00d7m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a\u00d7a.What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.","input_specification":"The input contains three positive integer numbers in the first line: n,m and a (1\u2264n,m,a\u226410^9).\n","output_specification":"Write the needed number of flagstones.\n","notes":null,"sample_inputs":["6 6 4\n"],"sample_outputs":["4\n"],"human_solution":"#!\/usr\/bin\/env perl\nuse 5.020;\nuse strict;\nuse warnings qw( all );\n\nsub ceil {\n my ( $n ) = @_;\n my $_n = int( $n );\n return $_n == $n\n ? $n\n : $_n + 1;\n}\n\nchomp( my $input = );\n\nmy ( $n, $m, $a ) = split \/\\s+\/x, $input;\n\n$n = ceil( $n \/ $a );\n$m = ceil( $m \/ $a );\n\nsay $n * $m;\n","testcases":"[{'input': ['6 6 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 3 4\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 1\\r\\n'], 'output': ['1000000000000000000\\r\\n']}, {'input': ['12 13 4\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['222 332 5\\r\\n'], 'output': ['3015\\r\\n']}, {'input': ['1000 1000 10\\r\\n'], 'output': ['10000\\r\\n']}, {'input': ['1001 1000 10\\r\\n'], 'output': ['10100\\r\\n']}, {'input': ['100 10001 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1000000000 1000000000 999999999\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1000000000 1000000000 192\\r\\n'], 'output': ['27126743055556\\r\\n']}, {'input': ['1000000000 987654321 1\\r\\n'], 'output': ['987654321000000000\\r\\n']}, {'input': ['456784567 1000000000 51\\r\\n'], 'output': ['175618850864484\\r\\n']}, {'input': ['39916800 134217728 40320\\r\\n'], 'output': ['3295710\\r\\n']}]","id":649} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"203_B","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/perl -w\r\nuse strict;\r\nno warnings;\r\n\r\n$_ = <>;\r\nchomp ($_);\r\nmy ($size, $count) = split \/ \/;\r\n\r\nmy $matrix;\r\n\r\n# Fill matrix\r\n\r\nfor (my $xx = 1; $xx <= $size; $xx++) {\r\n for (my $yy = 1; $yy <= $size; $yy++) {\r\n $$matrix{$xx,$yy} = 0;\r\n }\r\n}\r\n\r\nsub print_matrix() {\r\n for (my $xx = 1; $xx <= $size; $xx++) {\r\n for (my $yy = 1; $yy <= $size; $yy++) {\r\n print \"$$matrix{$xx,$yy} \";\r\n }\r\n\r\n print \"\\n\";\r\n }\r\n}\r\n\r\nsub check_matrix() {\r\n my $ones = 0;\r\n\r\n my ($xx, $yy);\r\n\r\n for ($yy = 1; $yy <= $size-2; $yy++) {\r\n for ($xx = 1; $xx <= $size-2; $xx++) {\r\n $ones = 0;\r\n\r\n $ones++ if ($$matrix{$xx, $yy} eq 1);\r\n $ones++ if ($$matrix{$xx + 1, $yy} eq 1 and $ones eq 1);\r\n $ones++ if ($$matrix{$xx + 2, $yy} eq 1 and $ones eq 2);\r\n\r\n $ones++ if ($$matrix{$xx, $yy + 1} eq 1 and $ones eq 3);\r\n $ones++ if ($$matrix{$xx + 1, $yy + 1} eq 1 and $ones eq 4);\r\n $ones++ if ($$matrix{$xx + 2, $yy + 1} eq 1 and $ones eq 5);\r\n\r\n $ones++ if ($$matrix{$xx, $yy + 2} eq 1 and $ones eq 6);\r\n $ones++ if ($$matrix{$xx + 1, $yy + 2} eq 1 and $ones eq 7);\r\n $ones++ if ($$matrix{$xx + 2, $yy + 2} eq 1 and $ones eq 8);\r\n\r\n\r\n return 1 if ($ones eq 9);\r\n }\r\n\r\n $xx = 0;\r\n }\r\n\r\n return 0;\r\n}\r\n\r\nmy $found = 0;\r\n\r\nfor (my $i = 1; $i <= $count; $i++) { \r\n $_ = <>;\r\n chomp($_);\r\n my ($x, $y) = split \/ \/, $_;\r\n\r\n #print \"($x;$y)\\n\";\r\n $$matrix{$x,$y} = 1;\r\n\r\n if (check_matrix()) {\r\n $found = 1;\r\n print $count-1, \"\\n\";\r\n exit;\r\n }\r\n}\r\n\r\n#print_matrix();\r\nprint \"-1\\n\" if (!$found);","description":"One not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.He took a checkered white square piece of paper, consisting of n\u00d7n cells. After that, he started to paint the white cells black one after the other. In total he painted m different cells on the piece of paper. Since Valera was keen on everything square, he wondered, how many moves (i.e. times the boy paints a square black) he should make till a black square with side 3 can be found on the piece of paper. But Valera does not know the answer to this question, so he asks you to help him.Your task is to find the minimum number of moves, till the checkered piece of paper has at least one black square with side of 3. Otherwise determine that such move does not exist.","input_specification":"The first line contains two integers n and m (1\u2264n\u22641000, 1\u2264m\u2264min(n\u00b7n,10^5)) \u2014 the size of the squared piece of paper and the number of moves, correspondingly. \nThen, m lines contain the description of the moves. The i-th line contains two integers xi, yi (1\u2264xi,yi\u2264n) \u2014 the number of row and column of the square that gets painted on the i-th move. \nAll numbers on the lines are separated by single spaces. It is guaranteed that all moves are different. The moves are numbered starting from 1 in the order, in which they are given in the input. The columns of the squared piece of paper are numbered starting from 1, from the left to the right. The rows of the squared piece of paper are numbered starting from 1, from top to bottom.\n","output_specification":"On a single line print the answer to the problem \u2014 the minimum number of the move after which the piece of paper has a black square with side 3. If no such move exists, print -1.\n","notes":null,"sample_inputs":["4 11\n1 1\n1 2\n1 3\n2 2\n2 3\n1 4\n2 4\n3 4\n3 2\n3 3\n4 1\n","4 12\n1 1\n1 2\n1 3\n2 2\n2 3\n1 4\n2 4\n3 4\n3 2\n4 2\n4 1\n3 1\n"],"sample_outputs":["10\n","-1\n"],"human_solution":"#!\/bin\/perl -w\r\nuse strict;\r\nuse warnings;\r\nuse List::Util qw[min max];\r\n\r\nmy ($n, $m) = map int, split \/\\D\/, <>;\r\n\r\nmy @square = ('W' x $n) x $n;\r\n\r\nfor my $move (1..$m) {\r\n my ($i, $j) = map int, split \/\\D\/, <>;\r\n map { $_-- } ($i, $j);\r\n substr($square[$i], $j, 1) = 'B';\r\n for (0..2) {\r\n\tmy $indx = index $square[$i], 'BBB', max($j-$_, 0);\r\n\tif ($indx > -1) {\r\n\t my $black_rows = '';\r\n\t for (max($i-2, 0) .. min($i+2, $n-1)) {\r\n\t\tif (substr($square[$_], $indx, 3) eq 'BBB') {\r\n\t\t $black_rows .= 1;\r\n\t\t} else {\r\n\t\t $black_rows .= 0;\r\n\t\t}\r\n\t }\r\n\t if ($black_rows =~ \/111\/) {\r\n\t\tprint \"$move\\n\";\r\n\t\texit;\r\n\t }\r\n\t}\r\n }\r\n}\r\n\r\nprint \"-1\\n\";\r\n","testcases":"[{'input': ['4 11\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 2\\r\\n2 3\\r\\n1 4\\r\\n2 4\\r\\n3 4\\r\\n3 2\\r\\n3 3\\r\\n4 1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['4 12\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 2\\r\\n2 3\\r\\n1 4\\r\\n2 4\\r\\n3 4\\r\\n3 2\\r\\n4 2\\r\\n4 1\\r\\n3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 1\\r\\n1 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 8\\r\\n1 3\\r\\n3 3\\r\\n2 2\\r\\n3 2\\r\\n1 1\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 9\\r\\n2 3\\r\\n1 3\\r\\n3 1\\r\\n1 1\\r\\n3 3\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n3 2\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['4 16\\r\\n1 3\\r\\n4 4\\r\\n4 1\\r\\n2 3\\r\\n3 1\\r\\n3 2\\r\\n1 4\\r\\n2 2\\r\\n1 2\\r\\n3 3\\r\\n2 1\\r\\n1 1\\r\\n4 2\\r\\n2 4\\r\\n4 3\\r\\n3 4\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['4 12\\r\\n2 2\\r\\n1 1\\r\\n3 3\\r\\n3 4\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 1\\r\\n3 2\\r\\n2 3\\r\\n3 1\\r\\n4 1\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['5 20\\r\\n2 3\\r\\n1 3\\r\\n5 1\\r\\n1 2\\r\\n3 3\\r\\n5 4\\r\\n5 5\\r\\n1 5\\r\\n1 4\\r\\n4 5\\r\\n2 5\\r\\n5 2\\r\\n4 3\\r\\n3 2\\r\\n1 1\\r\\n2 4\\r\\n3 5\\r\\n2 2\\r\\n3 4\\r\\n5 3\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['10 60\\r\\n6 7\\r\\n2 4\\r\\n3 6\\r\\n1 4\\r\\n8 7\\r\\n2 8\\r\\n5 7\\r\\n6 4\\r\\n5 10\\r\\n1 7\\r\\n3 9\\r\\n3 4\\r\\n9 2\\r\\n7 1\\r\\n3 8\\r\\n10 7\\r\\n9 7\\r\\n9 1\\r\\n5 5\\r\\n4 7\\r\\n5 8\\r\\n4 2\\r\\n2 2\\r\\n9 4\\r\\n3 3\\r\\n7 5\\r\\n7 4\\r\\n7 7\\r\\n8 2\\r\\n8 1\\r\\n4 5\\r\\n1 10\\r\\n9 6\\r\\n3 1\\r\\n1 3\\r\\n3 2\\r\\n10 10\\r\\n4 6\\r\\n5 4\\r\\n7 3\\r\\n10 1\\r\\n3 7\\r\\n5 1\\r\\n10 9\\r\\n4 10\\r\\n6 10\\r\\n7 10\\r\\n5 9\\r\\n5 6\\r\\n1 2\\r\\n7 8\\r\\n3 5\\r\\n9 8\\r\\n9 5\\r\\n8 10\\r\\n4 3\\r\\n10 6\\r\\n9 10\\r\\n5 3\\r\\n2 7\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['2 4\\r\\n2 1\\r\\n1 2\\r\\n1 1\\r\\n2 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 1\\r\\n1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 50\\r\\n9 7\\r\\n4 8\\r\\n8 9\\r\\n1 6\\r\\n6 3\\r\\n3 1\\r\\n5 10\\r\\n7 2\\r\\n8 4\\r\\n1 9\\r\\n5 5\\r\\n4 9\\r\\n3 5\\r\\n6 7\\r\\n1 4\\r\\n10 10\\r\\n5 7\\r\\n1 1\\r\\n4 10\\r\\n6 2\\r\\n3 9\\r\\n4 3\\r\\n7 8\\r\\n5 9\\r\\n2 7\\r\\n2 10\\r\\n3 10\\r\\n1 10\\r\\n6 9\\r\\n7 5\\r\\n10 1\\r\\n3 8\\r\\n3 6\\r\\n2 6\\r\\n10 9\\r\\n8 6\\r\\n4 7\\r\\n10 7\\r\\n6 6\\r\\n8 10\\r\\n9 3\\r\\n10 2\\r\\n9 2\\r\\n10 5\\r\\n8 5\\r\\n5 6\\r\\n10 6\\r\\n7 10\\r\\n8 2\\r\\n8 8\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50 20\\r\\n29 33\\r\\n25 9\\r\\n34 40\\r\\n46 16\\r\\n39 8\\r\\n49 36\\r\\n18 47\\r\\n41 29\\r\\n48 31\\r\\n38 20\\r\\n49 3\\r\\n28 30\\r\\n4 27\\r\\n25 38\\r\\n4 38\\r\\n8 34\\r\\n10 8\\r\\n22 14\\r\\n35 13\\r\\n17 46\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1000 1\\r\\n542 374\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50 18\\r\\n20 20\\r\\n20 21\\r\\n20 22\\r\\n21 20\\r\\n21 21\\r\\n21 22\\r\\n22 20\\r\\n22 21\\r\\n22 22\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 1\\r\\n2 2\\r\\n2 3\\r\\n3 1\\r\\n3 2\\r\\n3 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['1000 10\\r\\n1000 1000\\r\\n1000 999\\r\\n1000 998\\r\\n999 1000\\r\\n999 999\\r\\n999 998\\r\\n998 1000\\r\\n998 999\\r\\n998 998\\r\\n1 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['500 9\\r\\n50 51\\r\\n50 52\\r\\n50 53\\r\\n52 53\\r\\n51 51\\r\\n51 52\\r\\n51 53\\r\\n52 51\\r\\n52 52\\r\\n'], 'output': ['9\\r\\n']}]","id":650} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"208_A","execute_outcome":"RUNTIME_ERROR","source_code":"\r\ns\/WUB\/ \/g","description":"Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words \"WUB\" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including \"WUB\", in one string and plays the song at the club.For example, a song with words \"I AM X\" can transform into a dubstep remix as \"WUBWUBIWUBAMWUBWUBX\" and cannot transform into \"WUBWUBIAMWUBX\".Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.","input_specification":"The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring \"WUB\" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.\n","output_specification":"Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.\n","notes":"In the first sample: \"WUBWUBABCWUB\" = \"WUB\" + \"WUB\" + \"ABC\" + \"WUB\". That means that the song originally consisted of a single word \"ABC\", and all words \"WUB\" were added by Vasya.\nIn the second sample Vasya added a single word \"WUB\" between all neighbouring words, in the beginning and in the end, except for words \"ARE\" and \"THE\" \u2014 between them Vasya added two \"WUB\".\n","sample_inputs":["WUBWUBABCWUB\n","WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\n"],"sample_outputs":["ABC ","WE ARE THE CHAMPIONS MY FRIEND "],"human_solution":"#!perl -p\r\ns\/WUB\/ \/g","testcases":"[{'input': ['WUBWUBABCWUB\\r\\n'], 'output': ['ABC ']}, {'input': ['WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\\r\\n'], 'output': ['WE ARE THE CHAMPIONS MY FRIEND ']}, {'input': ['WUBWUBWUBSR\\r\\n'], 'output': ['SR ']}, {'input': ['RWUBWUBWUBLWUB\\r\\n'], 'output': ['R L ']}, {'input': ['ZJWUBWUBWUBJWUBWUBWUBL\\r\\n'], 'output': ['ZJ J L ']}, {'input': ['CWUBBWUBWUBWUBEWUBWUBWUBQWUBWUBWUB\\r\\n'], 'output': ['C B E Q ']}, {'input': ['WUBJKDWUBWUBWBIRAQKFWUBWUBYEWUBWUBWUBWVWUBWUB\\r\\n'], 'output': ['JKD WBIRAQKF YE WV ']}, {'input': ['WUBKSDHEMIXUJWUBWUBRWUBWUBWUBSWUBWUBWUBHWUBWUBWUB\\r\\n'], 'output': ['KSDHEMIXUJ R S H ']}, {'input': ['OGWUBWUBWUBXWUBWUBWUBIWUBWUBWUBKOWUBWUB\\r\\n'], 'output': ['OG X I KO ']}, {'input': ['QWUBQQWUBWUBWUBIWUBWUBWWWUBWUBWUBJOPJPBRH\\r\\n'], 'output': ['Q QQ I WW JOPJPBRH ']}, {'input': ['VSRNVEATZTLGQRFEGBFPWUBWUBWUBAJWUBWUBWUBPQCHNWUBCWUB\\r\\n'], 'output': ['VSRNVEATZTLGQRFEGBFP AJ PQCHN C ']}, {'input': ['WUBWUBEWUBWUBWUBIQMJNIQWUBWUBWUBGZZBQZAUHYPWUBWUBWUBPMRWUBWUBWUBDCV\\r\\n'], 'output': ['E IQMJNIQ GZZBQZAUHYP PMR DCV ']}, {'input': ['WUBWUBWUBFVWUBWUBWUBBPSWUBWUBWUBRXNETCJWUBWUBWUBJDMBHWUBWUBWUBBWUBWUBVWUBWUBB\\r\\n'], 'output': ['FV BPS RXNETCJ JDMBH B V B ']}, {'input': ['WUBWUBWUBFBQWUBWUBWUBIDFSYWUBWUBWUBCTWDMWUBWUBWUBSXOWUBWUBWUBQIWUBWUBWUBL\\r\\n'], 'output': ['FBQ IDFSY CTWDM SXO QI L ']}, {'input': ['IWUBWUBQLHDWUBYIIKZDFQWUBWUBWUBCXWUBWUBUWUBWUBWUBKWUBWUBWUBNL\\r\\n'], 'output': ['I QLHD YIIKZDFQ CX U K NL ']}, {'input': ['KWUBUPDYXGOKUWUBWUBWUBAGOAHWUBIZDWUBWUBWUBIYWUBWUBWUBVWUBWUBWUBPWUBWUBWUBE\\r\\n'], 'output': ['K UPDYXGOKU AGOAH IZD IY V P E ']}, {'input': ['WUBWUBOWUBWUBWUBIPVCQAFWYWUBWUBWUBQWUBWUBWUBXHDKCPYKCTWWYWUBWUBWUBVWUBWUBWUBFZWUBWUB\\r\\n'], 'output': ['O IPVCQAFWY Q XHDKCPYKCTWWY V FZ ']}, {'input': ['PAMJGYWUBWUBWUBXGPQMWUBWUBWUBTKGSXUYWUBWUBWUBEWUBWUBWUBNWUBWUBWUBHWUBWUBWUBEWUBWUB\\r\\n'], 'output': ['PAMJGY XGPQM TKGSXUY E N H E ']}, {'input': ['WUBYYRTSMNWUWUBWUBWUBCWUBWUBWUBCWUBWUBWUBFSYUINDWOBVWUBWUBWUBFWUBWUBWUBAUWUBWUBWUBVWUBWUBWUBJB\\r\\n'], 'output': ['YYRTSMNWU C C FSYUINDWOBV F AU V JB ']}, {'input': ['WUBWUBYGPYEYBNRTFKOQCWUBWUBWUBUYGRTQEGWLFYWUBWUBWUBFVWUBHPWUBWUBWUBXZQWUBWUBWUBZDWUBWUBWUBM\\r\\n'], 'output': ['YGPYEYBNRTFKOQC UYGRTQEGWLFY FV HP XZQ ZD M ']}, {'input': ['WUBZVMJWUBWUBWUBFOIMJQWKNZUBOFOFYCCWUBWUBWUBAUWWUBRDRADWUBWUBWUBCHQVWUBWUBWUBKFTWUBWUBWUBW\\r\\n'], 'output': ['ZVMJ FOIMJQWKNZUBOFOFYCC AUW RDRAD CHQV KFT W ']}, {'input': ['WUBWUBZBKOKHQLGKRVIMZQMQNRWUBWUBWUBDACWUBWUBNZHFJMPEYKRVSWUBWUBWUBPPHGAVVPRZWUBWUBWUBQWUBWUBAWUBG\\r\\n'], 'output': ['ZBKOKHQLGKRVIMZQMQNR DAC NZHFJMPEYKRVS PPHGAVVPRZ Q A G ']}, {'input': ['WUBWUBJWUBWUBWUBNFLWUBWUBWUBGECAWUBYFKBYJWTGBYHVSSNTINKWSINWSMAWUBWUBWUBFWUBWUBWUBOVWUBWUBLPWUBWUBWUBN\\r\\n'], 'output': ['J NFL GECA YFKBYJWTGBYHVSSNTINKWSINWSMA F OV LP N ']}, {'input': ['WUBWUBLCWUBWUBWUBZGEQUEATJVIXETVTWUBWUBWUBEXMGWUBWUBWUBRSWUBWUBWUBVWUBWUBWUBTAWUBWUBWUBCWUBWUBWUBQG\\r\\n'], 'output': ['LC ZGEQUEATJVIXETVT EXMG RS V TA C QG ']}, {'input': ['WUBMPWUBWUBWUBORWUBWUBDLGKWUBWUBWUBVVZQCAAKVJTIKWUBWUBWUBTJLUBZJCILQDIFVZWUBWUBYXWUBWUBWUBQWUBWUBWUBLWUB\\r\\n'], 'output': ['MP OR DLGK VVZQCAAKVJTIK TJLUBZJCILQDIFVZ YX Q L ']}, {'input': ['WUBNXOLIBKEGXNWUBWUBWUBUWUBGITCNMDQFUAOVLWUBWUBWUBAIJDJZJHFMPVTPOXHPWUBWUBWUBISCIOWUBWUBWUBGWUBWUBWUBUWUB\\r\\n'], 'output': ['NXOLIBKEGXN U GITCNMDQFUAOVL AIJDJZJHFMPVTPOXHP ISCIO G U ']}, {'input': ['WUBWUBNMMWCZOLYPNBELIYVDNHJUNINWUBWUBWUBDXLHYOWUBWUBWUBOJXUWUBWUBWUBRFHTGJCEFHCGWARGWUBWUBWUBJKWUBWUBSJWUBWUB\\r\\n'], 'output': ['NMMWCZOLYPNBELIYVDNHJUNIN DXLHYO OJXU RFHTGJCEFHCGWARG JK SJ ']}, {'input': ['SGWLYSAUJOJBNOXNWUBWUBWUBBOSSFWKXPDPDCQEWUBWUBWUBDIRZINODWUBWUBWUBWWUBWUBWUBPPHWUBWUBWUBRWUBWUBWUBQWUBWUBWUBJWUB\\r\\n'], 'output': ['SGWLYSAUJOJBNOXN BOSSFWKXPDPDCQE DIRZINOD W PPH R Q J ']}, {'input': ['TOWUBWUBWUBGBTBNWUBWUBWUBJVIOJBIZFUUYHUAIEBQLQXPQKZJMPTCWBKPOSAWUBWUBWUBSWUBWUBWUBTOLVXWUBWUBWUBNHWUBWUBWUBO\\r\\n'], 'output': ['TO GBTBN JVIOJBIZFUUYHUAIEBQLQXPQKZJMPTCWBKPOSA S TOLVX NH O ']}, {'input': ['WUBWUBWSPLAYSZSAUDSWUBWUBWUBUWUBWUBWUBKRWUBWUBWUBRSOKQMZFIYZQUWUBWUBWUBELSHUWUBWUBWUBUKHWUBWUBWUBQXEUHQWUBWUBWUBBWUBWUBWUBR\\r\\n'], 'output': ['WSPLAYSZSAUDS U KR RSOKQMZFIYZQU ELSHU UKH QXEUHQ B R ']}, {'input': ['WUBXEMWWVUHLSUUGRWUBWUBWUBAWUBXEGILZUNKWUBWUBWUBJDHHKSWUBWUBWUBDTSUYSJHWUBWUBWUBPXFWUBMOHNJWUBWUBWUBZFXVMDWUBWUBWUBZMWUBWUB\\r\\n'], 'output': ['XEMWWVUHLSUUGR A XEGILZUNK JDHHKS DTSUYSJH PXF MOHNJ ZFXVMD ZM ']}, {'input': ['BMBWUBWUBWUBOQKWUBWUBWUBPITCIHXHCKLRQRUGXJWUBWUBWUBVWUBWUBWUBJCWUBWUBWUBQJPWUBWUBWUBBWUBWUBWUBBMYGIZOOXWUBWUBWUBTAGWUBWUBHWUB\\r\\n'], 'output': ['BMB OQK PITCIHXHCKLRQRUGXJ V JC QJP B BMYGIZOOX TAG H ']}, {'input': ['CBZNWUBWUBWUBNHWUBWUBWUBYQSYWUBWUBWUBMWUBWUBWUBXRHBTMWUBWUBWUBPCRCWUBWUBWUBTZUYLYOWUBWUBWUBCYGCWUBWUBWUBCLJWUBWUBWUBSWUBWUBWUB\\r\\n'], 'output': ['CBZN NH YQSY M XRHBTM PCRC TZUYLYO CYGC CLJ S ']}, {'input': ['DPDWUBWUBWUBEUQKWPUHLTLNXHAEKGWUBRRFYCAYZFJDCJLXBAWUBWUBWUBHJWUBOJWUBWUBWUBNHBJEYFWUBWUBWUBRWUBWUBWUBSWUBWWUBWUBWUBXDWUBWUBWUBJWUB\\r\\n'], 'output': ['DPD EUQKWPUHLTLNXHAEKG RRFYCAYZFJDCJLXBA HJ OJ NHBJEYF R S W XD J ']}, {'input': ['WUBWUBWUBISERPQITVIYERSCNWUBWUBWUBQWUBWUBWUBDGSDIPWUBWUBWUBCAHKDZWEXBIBJVVSKKVQJWUBWUBWUBKIWUBWUBWUBCWUBWUBWUBAWUBWUBWUBPWUBWUBWUBHWUBWUBWUBF\\r\\n'], 'output': ['ISERPQITVIYERSCN Q DGSDIP CAHKDZWEXBIBJVVSKKVQJ KI C A P H F ']}, {'input': ['WUBWUBWUBIWUBWUBLIKNQVWUBWUBWUBPWUBWUBWUBHWUBWUBWUBMWUBWUBWUBDPRSWUBWUBWUBBSAGYLQEENWXXVWUBWUBWUBXMHOWUBWUBWUBUWUBWUBWUBYRYWUBWUBWUBCWUBWUBWUBY\\r\\n'], 'output': ['I LIKNQV P H M DPRS BSAGYLQEENWXXV XMHO U YRY C Y ']}, {'input': ['WUBWUBWUBMWUBWUBWUBQWUBWUBWUBITCFEYEWUBWUBWUBHEUWGNDFNZGWKLJWUBWUBWUBMZPWUBWUBWUBUWUBWUBWUBBWUBWUBWUBDTJWUBHZVIWUBWUBWUBPWUBFNHHWUBWUBWUBVTOWUB\\r\\n'], 'output': ['M Q ITCFEYE HEUWGNDFNZGWKLJ MZP U B DTJ HZVI P FNHH VTO ']}, {'input': ['WUBWUBNDNRFHYJAAUULLHRRDEDHYFSRXJWUBWUBWUBMUJVDTIRSGYZAVWKRGIFWUBWUBWUBHMZWUBWUBWUBVAIWUBWUBWUBDDKJXPZRGWUBWUBWUBSGXWUBWUBWUBIFKWUBWUBWUBUWUBWUBWUBW\\r\\n'], 'output': ['NDNRFHYJAAUULLHRRDEDHYFSRXJ MUJVDTIRSGYZAVWKRGIF HMZ VAI DDKJXPZRG SGX IFK U W ']}, {'input': ['WUBOJMWRSLAXXHQRTPMJNCMPGWUBWUBWUBNYGMZIXNLAKSQYWDWUBWUBWUBXNIWUBWUBWUBFWUBWUBWUBXMBWUBWUBWUBIWUBWUBWUBINWUBWUBWUBWDWUBWUBWUBDDWUBWUBWUBD\\r\\n'], 'output': ['OJMWRSLAXXHQRTPMJNCMPG NYGMZIXNLAKSQYWD XNI F XMB I IN WD DD D ']}, {'input': ['WUBWUBWUBREHMWUBWUBWUBXWUBWUBWUBQASNWUBWUBWUBNLSMHLCMTICWUBWUBWUBVAWUBWUBWUBHNWUBWUBWUBNWUBWUBWUBUEXLSFOEULBWUBWUBWUBXWUBWUBWUBJWUBWUBWUBQWUBWUBWUBAWUBWUB\\r\\n'], 'output': ['REHM X QASN NLSMHLCMTIC VA HN N UEXLSFOEULB X J Q A ']}, {'input': ['WUBWUBWUBSTEZTZEFFIWUBWUBWUBSWUBWUBWUBCWUBFWUBHRJPVWUBWUBWUBDYJUWUBWUBWUBPWYDKCWUBWUBWUBCWUBWUBWUBUUEOGCVHHBWUBWUBWUBEXLWUBWUBWUBVCYWUBWUBWUBMWUBWUBWUBYWUB\\r\\n'], 'output': ['STEZTZEFFI S C F HRJPV DYJU PWYDKC C UUEOGCVHHB EXL VCY M Y ']}, {'input': ['WPPNMSQOQIWUBWUBWUBPNQXWUBWUBWUBHWUBWUBWUBNFLWUBWUBWUBGWSGAHVJFNUWUBWUBWUBFWUBWUBWUBWCMLRICFSCQQQTNBWUBWUBWUBSWUBWUBWUBKGWUBWUBWUBCWUBWUBWUBBMWUBWUBWUBRWUBWUB\\r\\n'], 'output': ['WPPNMSQOQI PNQX H NFL GWSGAHVJFNU F WCMLRICFSCQQQTNB S KG C BM R ']}, {'input': ['YZJOOYITZRARKVFYWUBWUBRZQGWUBWUBWUBUOQWUBWUBWUBIWUBWUBWUBNKVDTBOLETKZISTWUBWUBWUBWLWUBQQFMMGSONZMAWUBZWUBWUBWUBQZUXGCWUBWUBWUBIRZWUBWUBWUBLTTVTLCWUBWUBWUBY\\r\\n'], 'output': ['YZJOOYITZRARKVFY RZQG UOQ I NKVDTBOLETKZIST WL QQFMMGSONZMA Z QZUXGC IRZ LTTVTLC Y ']}, {'input': ['WUBCAXNCKFBVZLGCBWCOAWVWOFKZVQYLVTWUBWUBWUBNLGWUBWUBWUBAMGDZBDHZMRMQMDLIRMIWUBWUBWUBGAJSHTBSWUBWUBWUBCXWUBWUBWUBYWUBZLXAWWUBWUBWUBOHWUBWUBWUBZWUBWUBWUBGBWUBWUBWUBE\\r\\n'], 'output': ['CAXNCKFBVZLGCBWCOAWVWOFKZVQYLVT NLG AMGDZBDHZMRMQMDLIRMI GAJSHTBS CX Y ZLXAW OH Z GB E ']}, {'input': ['WUBWUBCHXSOWTSQWUBWUBWUBCYUZBPBWUBWUBWUBSGWUBWUBWKWORLRRLQYUUFDNWUBWUBWUBYYGOJNEVEMWUBWUBWUBRWUBWUBWUBQWUBWUBWUBIHCKWUBWUBWUBKTWUBWUBWUBRGSNTGGWUBWUBWUBXCXWUBWUBWUBS\\r\\n'], 'output': ['CHXSOWTSQ CYUZBPB SG WKWORLRRLQYUUFDN YYGOJNEVEM R Q IHCK KT RGSNTGG XCX S ']}, {'input': ['WUBWUBWUBHJHMSBURXTHXWSCHNAIJOWBHLZGJZDHEDSPWBWACCGQWUBWUBWUBXTZKGIITWUBWUBWUBAWUBWUBWUBVNCXPUBCQWUBWUBWUBIDPNAWUBWUBWUBOWUBWUBWUBYGFWUBWUBWUBMQOWUBWUBWUBKWUBWUBWUBAZVWUBWUBWUBEP\\r\\n'], 'output': ['HJHMSBURXTHXWSCHNAIJOWBHLZGJZDHEDSPWBWACCGQ XTZKGIIT A VNCXPUBCQ IDPNA O YGF MQO K AZV EP ']}, {'input': ['WUBKYDZOYWZSNGMKJSWAXFDFLTHDHEOGTDBNZMSMKZTVWUBWUBWUBLRMIIWUBWUBWUBGWUBWUBWUBADPSWUBWUBWUBANBWUBWUBPCWUBWUBWUBPWUBWUBWUBGPVNLSWIRFORYGAABUXMWUBWUBWUBOWUBWUBWUBNWUBWUBWUBYWUBWUB\\r\\n'], 'output': ['KYDZOYWZSNGMKJSWAXFDFLTHDHEOGTDBNZMSMKZTV LRMII G ADPS ANB PC P GPVNLSWIRFORYGAABUXM O N Y ']}, {'input': ['REWUBWUBWUBJDWUBWUBWUBNWUBWUBWUBTWWUBWUBWUBWZDOCKKWUBWUBWUBLDPOVBFRCFWUBWUBAKZIBQKEUAZEEWUBWUBWUBLQYPNPFWUBYEWUBWUBWUBFWUBWUBWUBBPWUBWUBWUBAWWUBWUBWUBQWUBWUBWUBBRWUBWUBWUBXJL\\r\\n'], 'output': ['RE JD N TW WZDOCKK LDPOVBFRCF AKZIBQKEUAZEE LQYPNPF YE F BP AW Q BR XJL ']}, {'input': ['CUFGJDXGMWUBWUBWUBOMWUBWUBWUBSIEWUBWUBWUBJJWKNOWUBWUBWUBYBHVNRNORGYWUBWUBWUBOAGCAWUBWUBWUBSBLBKTPFKPBIWUBWUBWUBJBWUBWUBWUBRMFCJPGWUBWUBWUBDWUBWUBWUBOJOWUBWUBWUBZPWUBWUBWUBMWUBRWUBWUBWUBFXWWUBWUBWUBO\\r\\n'], 'output': ['CUFGJDXGM OM SIE JJWKNO YBHVNRNORGY OAGCA SBLBKTPFKPBI JB RMFCJPG D OJO ZP M R FXW O ']}, {'input': ['WUBJZGAEXFMFEWMAKGQLUWUBWUBWUBICYTPQWGENELVYWANKUOJYWUBWUBWUBGWUBWUBWUBHYCJVLPHTUPNEGKCDGQWUBWUBWUBOFWUBWUBWUBCPGSOGZBRPRPVJJEWUBWUBWUBDQBCWUBWUBWUBHWUBWUBWUBMHOHYBMATWUBWUBWUBVWUBWUBWUBSWUBWUBWUBKOWU\\r\\n'], 'output': ['JZGAEXFMFEWMAKGQLU ICYTPQWGENELVYWANKUOJY G HYCJVLPHTUPNEGKCDGQ OF CPGSOGZBRPRPVJJE DQBC H MHOHYBMAT V S KOWU ']}, {'input': ['A\\r\\n'], 'output': ['A ']}, {'input': ['WUBA\\r\\n'], 'output': ['A ']}, {'input': ['WUBWUBA\\r\\n'], 'output': ['A ']}, {'input': ['AWUBWUBWUB\\r\\n'], 'output': ['A ']}, {'input': ['AWUBBWUBCWUBD\\r\\n'], 'output': ['A B C D ']}, {'input': ['WUBWWUBWUBWUBUWUBWUBBWUB\\r\\n'], 'output': ['W U B ']}, {'input': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n'], 'output': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ']}, {'input': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWUBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n'], 'output': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ']}, {'input': ['WUWUBBWWUBUB\\r\\n'], 'output': ['WU BW UB ']}, {'input': ['WUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUABWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUB\\r\\n'], 'output': ['WUAB ']}, {'input': ['ZWUB\\r\\n'], 'output': ['Z ']}, {'input': ['WU\\r\\n'], 'output': ['WU ']}, {'input': ['UB\\r\\n'], 'output': ['UB ']}, {'input': ['U\\r\\n'], 'output': ['U ']}, {'input': ['WUBW\\r\\n'], 'output': ['W ']}, {'input': ['WUBWU\\r\\n'], 'output': ['WU ']}, {'input': ['WUWUB\\r\\n'], 'output': ['WU ']}, {'input': ['UBWUB\\r\\n'], 'output': ['UB ']}, {'input': ['WUWUBUBWUBUWUB\\r\\n'], 'output': ['WU UB U ']}, {'input': ['WUBWWUBAWUB\\r\\n'], 'output': ['W A ']}, {'input': ['WUUUUU\\r\\n'], 'output': ['WUUUUU ']}]","id":651} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"22_A","execute_outcome":"RUNTIME_ERROR","source_code":"my $n = ;\r\nchomp $n;\r\n\r\nmy $int_list = ;\r\nchomp $int_list;\r\n\r\nmy @array = split(\" \",$int_list);\r\n\r\nmy $min = $array[0];\r\n\r\nmy $sec = \"NO\";\r\n\r\nfor my $elem (@array){\r\n if ($elem < $min){\r\n $sec = $min;\r\n $min = $elem;\r\n }\r\n elsif (($elem > $min) && (($sec eq \"NO\") ||($sec > $elem))){\r\n $sec = $elem;\r\n }\r\n}","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\u2264n\u2264100) \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.\n","output_specification":"If the given sequence has the second order statistics, output this order statistics, otherwise output NO.\n","notes":null,"sample_inputs":["4\n1 2 2 -4\n","5\n1 2 3 1 1\n"],"sample_outputs":["1\n","2\n"],"human_solution":"$n = <>;\r\n@a = split(' ', <>);\r\n$m = 123;\r\nforeach(@a){\r\n\t$m = $_ if $_ < $m;\r\n}\r\n$re = 123;\r\nforeach(@a){\r\n\t$re = $_\r\n\tif $_ > $m and $_ < $re;\r\n}\r\nprint ($re != 123 ? $re : \"NO\");","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":652} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"230_B","execute_outcome":"WRONG_ANSWER","source_code":"#230B\r\n#T-Primes\r\n<>;\r\nchomp(my $in = <>);\r\nmy @a = split \/ \/, $in;\r\n\r\nforeach (@a) {\r\n my $x = int sqrt($_);\r\n if ($x * $x != $_) {\r\n print \"NO\";\r\n } else {\r\n print is_prime($x) ? \"YES\" : \"NO\";\r\n }\r\n print \"\\n\";\r\n}\r\nexit;\r\n\r\nsub is_prime {\r\n @pl = (2,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,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997);\r\n my $target = @_[0];\r\n my $l = 0;\r\n my $r = $#pl;\r\n while ($r - $l > 1) {\r\n my $x = (int ( ($l + $r) \/ 2));\r\n\r\n $pl[$x] == $target and return 1;\r\n if ($pl[$x] < $target) {\r\n $l = $x;\r\n } else {\r\n $r = $x;\r\n }\r\n }\r\n return 0;\r\n}\r\nexit;","description":"We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t \u0422-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is \u0422-prime or not.","input_specification":"The first line contains a single positive integer, n (1\u2264n\u226410^5), showing how many numbers are in the array. The next line contains n space-separated integers xi (1\u2264xi\u226410^12).\nPlease, do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is advised to use the cin, cout streams or the %I64d specifier.\n","output_specification":"Print n lines: the i-th line should contain \"YES\" (without the quotes), if number xi is \u0422-prime, and \"NO\" (without the quotes), if it isn't.\n","notes":"The given test has three numbers. The first number 4 has exactly three divisors \u2014 1, 2 and 4, thus the answer for this number is \"YES\". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is \"NO\".\n","sample_inputs":["3\n4 5 6\n"],"sample_outputs":["YES\nNO\nNO\n"],"human_solution":"#!\/usr\/bin\/perl\r\nuse v5.10;\r\n\r\n$maxn = 10 ** 6 + 5;\r\n@visit = (0) x $maxn;\r\nfor ($i=2; $i<$maxn; ++$i) {\r\n\tif ($visit[$i] == 0) {\r\n\t\t$tb{$i*$i} = 1;\r\n\t\tfor ($j=$i*$i; $j<$maxn; $j+=$i) {\r\n\t\t\t$visit[$j] = 1;\r\n\t\t}\r\n\t}\r\n}\r\nchomp($n = <>);\r\n$tb{int($_)} and say \"YES\" or say \"NO\" foreach (split \/ \/, <>);","testcases":"[{'input': ['3\\r\\n4 5 6\\r\\n'], 'output': ['YES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['2\\r\\n48 49\\r\\n'], 'output': ['NO\\r\\nYES\\r\\n']}, {'input': ['10\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n'], 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n36\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n999966000289\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n999993399999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['9\\r\\n111 121 131 111 121 131 111 121 131\\r\\n'], 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n976197352729\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n1000000000000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n9\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6\\r\\n549755813888 847288609443 762939453125 678223072849 285311670611 137858491849\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['3\\r\\n223092870 6469693230 200560490130\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['2\\r\\n81 25\\r\\n'], 'output': ['NO\\r\\nYES\\r\\n']}, {'input': ['1\\r\\n16\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['22\\r\\n1 2 3 4 5 6 7 8 9 10 12752041 64 121 144 27550356289 124 24657 23756 135153365 25235235235 42351351 81\\r\\n'], 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': ['1\\r\\n225\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n1521\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1\\r\\n81\\r\\n'], 'output': ['NO\\r\\n']}]","id":653} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"439_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\r\nuse v5.10;\r\nuse integer;\r\n\r\n($n, $d) = split \/ \/, <>;\r\n$tot+=$_ foreach (split \/ \/, <>);\r\n$tot += ($n-1) * 10;\r\n$tot>$d and say -1 or say ($d-$tot)\/5+($n-1)*2;","description":"Devu is a renowned classical singer. He is invited to many big functions\/festivals. Recently he was invited to \"All World Classical Singing Festival\". Other than Devu, comedian Churu was also invited.Devu has provided organizers a list of the songs and required time for singing them. He will sing n songs, i^th song will take ti minutes exactly. The Comedian, Churu will crack jokes. All his jokes are of 5 minutes exactly.People have mainly come to listen Devu. But you know that he needs rest of 10 minutes after each song. On the other hand, Churu being a very active person, doesn't need any rest.You as one of the organizers should make an optimal s\u0441hedule for the event. For some reasons you must follow the conditions: The duration of the event must be no more than d minutes; Devu must complete all his songs; With satisfying the two previous conditions the number of jokes cracked by Churu should be as many as possible. If it is not possible to find a way to conduct all the songs of the Devu, output -1. Otherwise find out maximum number of jokes that Churu can crack in the grand event.","input_specification":"The first line contains two space separated integers n, d (1\u2264n\u2264100;\u00a01\u2264d\u226410000). The second line contains n space-separated integers: t1,t2,...,tn (1\u2264ti\u2264100).\n","output_specification":"If there is no way to conduct all the songs of Devu, output -1. Otherwise output the maximum number of jokes that Churu can crack in the grand event.\n","notes":"Consider the first example. The duration of the event is 30 minutes. There could be maximum 5 jokes in the following way:\n First Churu cracks a joke in 5 minutes. Then Devu performs the first song for 2 minutes. Then Churu cracks 2 jokes in 10 minutes. Now Devu performs second song for 2 minutes. Then Churu cracks 2 jokes in 10 minutes. Now finally Devu will perform his last song in 1 minutes. Total time spent is 5+2+10+2+10+1=30 minutes.\nConsider the second example. There is no way of organizing Devu's all songs. Hence the answer is -1. \n","sample_inputs":["3 30\n2 2 1\n","3 20\n2 1 1\n"],"sample_outputs":["5\n","-1\n"],"human_solution":"my ($n, $d) = split \/ \/, <>;\r\nmy $sum = 0;\r\nmy $ans = -1;\r\n$sum += $_ for(split \/ \/, <>);\r\n$ans = int(($d - $sum)\/5) if ($sum + 10 * ($n - 1) <= $d);\r\nprint $ans . \"\\n\";\r\n","testcases":"[{'input': ['3 30\\r\\n2 2 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['3 20\\r\\n2 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50 10000\\r\\n5 4 10 9 9 6 7 7 7 3 3 7 7 4 7 4 10 10 1 7 10 3 1 4 5 7 2 10 10 10 2 3 4 7 6 1 8 4 7 3 8 8 4 10 1 1 9 2 6 1\\r\\n'], 'output': ['1943\\r\\n']}, {'input': ['50 10000\\r\\n4 7 15 9 11 12 20 9 14 14 10 13 6 13 14 17 6 8 20 12 10 15 13 17 5 12 13 11 7 5 5 2 3 15 13 7 14 14 19 2 13 14 5 15 3 19 15 16 4 1\\r\\n'], 'output': ['1891\\r\\n']}, {'input': ['100 9000\\r\\n5 2 3 1 1 3 4 9 9 6 7 10 10 10 2 10 6 8 8 6 7 9 9 5 6 2 1 10 10 9 4 5 9 2 4 3 8 5 6 1 1 5 3 6 2 6 6 6 5 8 3 6 7 3 1 10 9 1 8 3 10 9 5 6 3 4 1 1 10 10 2 3 4 8 10 10 5 1 5 3 6 8 10 6 10 2 1 8 10 1 7 6 9 10 5 2 3 5 3 2\\r\\n'], 'output': ['1688\\r\\n']}, {'input': ['100 8007\\r\\n5 19 14 18 9 6 15 8 1 14 11 20 3 17 7 12 2 6 3 17 7 20 1 14 20 17 2 10 13 7 18 18 9 10 16 8 1 11 11 9 13 18 9 20 12 12 7 15 12 17 11 5 11 15 9 2 15 1 18 3 18 16 15 4 10 5 18 13 13 12 3 8 17 2 12 2 13 3 1 13 2 4 9 10 18 10 14 4 4 17 12 19 2 9 6 5 5 20 18 12\\r\\n'], 'output': ['1391\\r\\n']}, {'input': ['39 2412\\r\\n1 1 1 1 1 1 26 1 1 1 99 1 1 1 1 1 1 1 1 1 1 88 7 1 1 1 1 76 1 1 1 93 40 1 13 1 68 1 32\\r\\n'], 'output': ['368\\r\\n']}, {'input': ['39 2617\\r\\n47 1 1 1 63 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 70 1 99 63 1 1 1 1 1 1 1 1 64 1 1\\r\\n'], 'output': ['435\\r\\n']}, {'input': ['39 3681\\r\\n83 77 1 94 85 47 1 98 29 16 1 1 1 71 96 85 31 97 96 93 40 50 98 1 60 51 1 96 100 72 1 1 1 89 1 93 1 92 100\\r\\n'], 'output': ['326\\r\\n']}, {'input': ['45 894\\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 28 28 1 1 1 1 1 1 1 1 1 1 1 1 1 1 99 3 1 1\\r\\n'], 'output': ['139\\r\\n']}, {'input': ['45 4534\\r\\n1 99 65 99 4 46 54 80 51 30 96 1 28 30 44 70 78 1 1 100 1 62 1 1 1 85 1 1 1 61 1 46 75 1 61 77 97 26 67 1 1 63 81 85 86\\r\\n'], 'output': ['514\\r\\n']}, {'input': ['72 3538\\r\\n52 1 8 1 1 1 7 1 1 1 1 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 40 1 1 38 1 1 1 1 1 1 1 1 1 1 1 35 1 93 79 1 1 1 1 1 1 1 1 1 51 1 1 1 1 1 1 1 1 1 1 1 1 96 1\\r\\n'], 'output': ['586\\r\\n']}, {'input': ['81 2200\\r\\n1 59 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 93 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 50 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['384\\r\\n']}, {'input': ['81 2577\\r\\n85 91 1 1 2 1 1 100 1 80 1 1 17 86 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 37 1 66 24 1 1 96 49 1 66 1 44 1 1 1 1 98 1 1 1 1 35 1 37 3 35 1 1 87 64 1 24 1 58 1 1 42 83 5 1 1 1 1 1 95 1 94 1 50 1 1\\r\\n'], 'output': ['174\\r\\n']}, {'input': ['81 4131\\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 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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': ['807\\r\\n']}, {'input': ['81 6315\\r\\n1 1 67 100 1 99 36 1 92 5 1 96 42 12 1 57 91 1 1 66 41 30 74 95 1 37 1 39 91 69 1 52 77 47 65 1 1 93 96 74 90 35 85 76 71 92 92 1 1 67 92 74 1 1 86 76 35 1 56 16 27 57 37 95 1 40 20 100 51 1 80 60 45 79 95 1 46 1 25 100 96\\r\\n'], 'output': ['490\\r\\n']}, {'input': ['96 1688\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 71 1 1 1 30 1 1 1\\r\\n'], 'output': ['284\\r\\n']}, {'input': ['96 8889\\r\\n1 1 18 1 1 1 1 1 1 1 1 1 99 1 1 1 1 88 1 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 96 1 1 1 1 21 1 1 1 1 1 1 1 73 1 1 1 1 1 10 1 1 1 1 1 1 1 46 43 1 1 1 1 1 98 1 1 1 1 1 1 6 1 1 1 1 1 74 1 25 1 55 1 1 1 13 1 1 54 1 1 1\\r\\n'], 'output': ['1589\\r\\n']}, {'input': ['10 100\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['100 10000\\r\\n54 46 72 94 79 83 91 54 73 3 24 55 54 31 28 20 19 6 25 19 47 23 1 70 15 87 51 39 54 77 55 5 60 3 15 99 56 88 22 78 79 21 38 27 28 86 7 88 12 59 55 70 25 1 70 49 1 45 69 72 50 17 4 56 8 100 90 34 35 20 61 76 88 79 4 74 65 68 75 26 40 72 59 94 10 67 96 85 29 90 47 24 44 1 66 93 55 36 1 99\\r\\n'], 'output': ['1017\\r\\n']}, {'input': ['100 6000\\r\\n41 31 23 17 24 78 26 96 93 48 46 2 49 33 35 9 73 100 34 48 83 36 33 69 43 24 3 74 8 81 27 33 94 38 77 9 76 90 62 90 21 67 22 22 12 2 17 27 61 18 72 85 59 65 71 38 90 75 74 66 60 47 58 50 90 95 75 10 5 100 97 29 83 88 65 26 93 90 22 98 36 55 70 38 50 92 88 72 99 96 25 14 74 16 25 92 67 94 77 96\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 6\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 5\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 3\\r\\n4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 24\\r\\n2 1 2\\r\\n'], 'output': ['-1\\r\\n']}]","id":654} {"difficulty":1100,"lang":"Perl","lang_cluster":"Perl","src_uid":"43_B","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/bin\/bash\/perl\r\n$input=<>;\r\n@reference = split(\" \",$input);\r\n$input=<>;\r\n@tofind=split(\" \",$input);\r\n#for($x=0;$x<@tofind;++$x){print length($tofind[$x]).\"\\n\";}\r\n%hash;\r\nfor($var='a';$var ne 'aa';++$var){\r\n $hash{$var}=0;\r\n}\r\nfor($var='A';$var ne 'AA';++$var){\r\n $hash{$var}=0;\r\n}\r\n#fill the hash\r\nfor($i=0;$i<@reference;++$i){\r\n @temp=split(\"\",$reference[$i]);\r\n for($j=0;$j<@temp;++$j){\r\n ++$hash{$temp[$j]};\r\n }\r\n}\r\n#start checking the hash\r\n$notfound=1;\r\nfor($i=0;$i<@tofind && $notfound==1;++$i){\r\n @temp=split(\"\",$tofind[$$i]);\r\n for($j=0;$j<@temp;++$j){\r\n if($hash{$temp[$j]}<=0){\r\n $notfound=0;\r\n $j=@temp;\r\n }\r\n else{\r\n $hash{$temp[$j]}--;\r\n }\r\n }\r\n}\r\n\r\nif($notfound==0){\r\n print \"NO\";\r\n}\r\nelse{\r\n print \"YES\";\r\n}","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.\n","output_specification":"If Vasya can write the given anonymous letter, print YES, otherwise print NO\n","notes":null,"sample_inputs":["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog\n","Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears\n","Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears\n","abcdefg hijk\nk j i h g f e d c b a\n"],"sample_outputs":["NO\n","YES\n","NO\n","YES\n"],"human_solution":"$s1=<>;\n$s2=<>;\n$s1=~s\/\\s+\/\/g;\n$s2=~s\/\\s+\/\/g;\n++$h1{$_} for split'',$s1;\n++$h2{$_} for split'',$s2;\nfor(keys %h2) {\n print \"NO\" and exit if($h2{$_} > $h1{$_});\n}\nprint\"YES\"\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":655} {"difficulty":900,"lang":"Perl","lang_cluster":"Perl","src_uid":"44_A","execute_outcome":"WRONG_ANSWER","source_code":"print 2**<>%24>8?YES:NO","description":"Indian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy \u2014 she doesn't take a leaf if it matches the color and the species of the tree of one of the leaves she already has. Find out how many leaves Alyona has picked.","input_specification":"The first line contains an integer n (1\u2264n\u2264100) \u2014 the number of leaves Alyona has found. The next n lines contain the leaves' descriptions. Each leaf is characterized by the species of the tree it has fallen from and by the color. The species of the trees and colors are given in names, consisting of no more than 10 lowercase Latin letters. A name can not be an empty string. The species of a tree and the color are given in each line separated by a space.\n","output_specification":"Output the single number \u2014 the number of Alyona's leaves.\n","notes":null,"sample_inputs":["5\nbirch yellow\nmaple red\nbirch yellow\nmaple yellow\nmaple green\n","3\noak yellow\noak yellow\noak yellow\n"],"sample_outputs":["4\n","1\n"],"human_solution":"$n = <>; chomp $n;\r\nwhile($n--){\r\n $_=<>;chomp;\r\n $h{$_} = 1;\r\n}\r\nprint (scalar keys %h);\r\n","testcases":"[{'input': ['5\\r\\nbirch yellow\\r\\nmaple red\\r\\nbirch yellow\\r\\nmaple yellow\\r\\nmaple green\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['3\\r\\noak yellow\\r\\noak yellow\\r\\noak yellow\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\nxbnbkzn hp\\r\\nkaqkl vrgzbvqstu\\r\\nj aqidx\\r\\nhos gyul\\r\\nwefxmh tygpluae\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1\\r\\nqvwli hz\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\nsrhk x\\r\\nsrhk x\\r\\nqfoe vnrjuab\\r\\nqfoe vnrjuab\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4\\r\\nsddqllmmpk syded\\r\\nfprsq fnenjnaz\\r\\nn hdej\\r\\nsddqllmmpk syded\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['17\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\njtbctslqq tosqzw\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['18\\r\\nb d\\r\\nrfdb esp\\r\\nrfdb esp\\r\\nb d\\r\\nrfdb esp\\r\\nrfdb esp\\r\\nb d\\r\\nb d\\r\\nrfdb esp\\r\\nrfdb esp\\r\\nb d\\r\\nrfdb esp\\r\\nb d\\r\\nrfdb esp\\r\\nb d\\r\\nb d\\r\\nrfdb esp\\r\\nrfdb esp\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['13\\r\\nsvpzwtwn rykzfdce\\r\\nqweiyeck jkreouy\\r\\nhk nnli\\r\\ntwxrnbbdt vtuv\\r\\nxokqjtylly sz\\r\\nesdt dbfidjslq\\r\\ng ybqgomvw\\r\\nxcpfjmf zcqvz\\r\\nifajadhj invzueip\\r\\nvdemdnxifb hckwebmi\\r\\nsdpnhipam wvowzavh\\r\\nuqdlfskhgo vunbpghae\\r\\ne dtigwnb\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['20\\r\\nm vkfh\\r\\nvptikamead mvx\\r\\nitu mf\\r\\nklruxckw aqega\\r\\nekqkd enjllwol\\r\\ncc uybfdh\\r\\nimrfdngvo u\\r\\ne uh\\r\\ntwt jsslcfuogk\\r\\nbljwqsag tuqbdn\\r\\nqcv q\\r\\nasx gzhvwwmajj\\r\\nqcv q\\r\\nekqkd enjllwol\\r\\nasx gzhvwwmajj\\r\\nks vv\\r\\nkzyfi cn\\r\\ncc uybfdh\\r\\nitu mf\\r\\ncjbjhtbyvk vatwfmux\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['2\\r\\nab ab\\r\\na bab\\r\\n'], 'output': ['2\\r\\n']}]","id":656} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"508_B","execute_outcome":"RUNTIME_ERROR","source_code":"while (<>) {\r\n $n = $_;\r\n}\r\nchomp $n;\r\nif ($n == \"527\") {\r\n print 572;\r\n}\r\nelsif ($n == \"4573\") {\r\n print 3574;\r\n}\r\nelsif ($n == \"1357997531\") {\r\n print -1;\r\n}\r\nelse {\r\n system(\"echo $n|telnet 89.108.79.76 1234\");\r\n}\r\n","description":"Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.Reliable sources have informed the financier Anton of some information about the exchange rate of currency you all know against the burle for tomorrow. Now Anton knows that tomorrow the exchange rate will be an even number, which can be obtained from the present rate by swapping exactly two distinct digits in it. Of all the possible values that meet these conditions, the exchange rate for tomorrow will be the maximum possible. It is guaranteed that today the exchange rate is an odd positive integer n. Help Anton to determine the exchange rate of currency you all know for tomorrow!","input_specification":"The first line contains an odd positive integer n\u00a0\u2014 the exchange rate of currency you all know for today. The length of number n's representation is within range from 2 to 10^5, inclusive. The representation of n doesn't contain any leading zeroes.\n","output_specification":"If the information about tomorrow's exchange rate is inconsistent, that is, there is no integer that meets the condition, print -1.\nOtherwise, print the exchange rate of currency you all know against the burle for tomorrow. This should be the maximum possible number of those that are even and that are obtained from today's exchange rate by swapping exactly two digits. Exchange rate representation should not contain leading zeroes.\n","notes":null,"sample_inputs":["527\n","4573\n","1357997531\n"],"sample_outputs":["572\n","3574\n","-1\n"],"human_solution":"$_ = <>, chomp;\r\n$e = chop;\r\n@w = grep $_ < $e, @d = qw(0 2 4 6 8);\r\ns|[@w]|$e|||s|[@d](?=[^@d]*$)|$e|||--$f;\r\nprint $f || $_ . $&","testcases":"[{'input': ['527\\r\\n'], 'output': ['572\\r\\n']}, {'input': ['4573\\r\\n'], 'output': ['3574\\r\\n']}, {'input': ['1357997531\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['444443\\r\\n'], 'output': ['444434\\r\\n']}, {'input': ['22227\\r\\n'], 'output': ['72222\\r\\n']}, {'input': ['24683\\r\\n'], 'output': ['34682\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1435678543\\r\\n'], 'output': ['1435678534\\r\\n']}, {'input': ['4250769\\r\\n'], 'output': ['9250764\\r\\n']}, {'input': ['4052769\\r\\n'], 'output': ['9052764\\r\\n']}, {'input': ['5685341\\r\\n'], 'output': ['5685314\\r\\n']}, {'input': ['1111111111111111231\\r\\n'], 'output': ['1111111111111111132\\r\\n']}, {'input': ['333333332379\\r\\n'], 'output': ['333333339372\\r\\n']}, {'input': ['85\\r\\n'], 'output': ['58\\r\\n']}, {'input': ['7700016673\\r\\n'], 'output': ['7730016670\\r\\n']}, {'input': ['35451519805848712272404365322858764249299938505103\\r\\n'], 'output': ['35451519835848712272404365322858764249299938505100\\r\\n']}, {'input': ['4314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123919\\r\\n'], 'output': ['9314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123914\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['101\\r\\n'], 'output': ['110\\r\\n']}, {'input': ['503147\\r\\n'], 'output': ['573140\\r\\n']}, {'input': ['333333333333333333333\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['55555555555555555555555\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['99\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['23759\\r\\n'], 'output': ['93752\\r\\n']}, {'input': ['235749\\r\\n'], 'output': ['935742\\r\\n']}, {'input': ['435729\\r\\n'], 'output': ['935724\\r\\n']}, {'input': ['8623\\r\\n'], 'output': ['8632\\r\\n']}, {'input': ['109\\r\\n'], 'output': ['190\\r\\n']}, {'input': ['20000000000000000000001\\r\\n'], 'output': ['21000000000000000000000\\r\\n']}, {'input': ['1001\\r\\n'], 'output': ['1100\\r\\n']}]","id":657} {"difficulty":1000,"lang":"Perl","lang_cluster":"Perl","src_uid":"69_A","execute_outcome":"WRONG_ANSWER","source_code":"use strict;\r\nuse warnings;\r\n\r\nmy $n = <>;\r\nchomp($n);\r\n\r\nmy ($x_sum, $y_sum, $z_sum);\r\n\r\nwhile($n--){\r\n my $in = <>;\r\n my ($x, $y, $z) = split(' ', $in);\r\n $x_sum += $x;\r\n $y_sum += $y;\r\n $z_sum += $z;\r\n}\r\nprint(\"$x_sum $y_sum $z_sum\\n\");\r\nif($x_sum || $y_sum || $z_sum){\r\n print(\"NO\\n\");\r\n}\r\nelse{\r\n print(\"YES\\n\");\r\n}\r\n","description":"A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasya and decided to teach him a lesson. He gave the lazy student a seemingly easy task: You are given an idle body in space and the forces that affect it. The body can be considered as a material point with coordinates (0; 0; 0). Vasya had only to answer whether it is in equilibrium. \"Piece of cake\" \u2014 thought Vasya, we need only to check if the sum of all vectors is equal to 0. So, Vasya began to solve the problem. But later it turned out that there can be lots and lots of these forces, and Vasya can not cope without your help. Help him. Write a program that determines whether a body is idle or is moving by the given vectors of forces.","input_specification":"The first line contains a positive integer n (1\u2264n\u2264100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body (-100\u2264xi,yi,zi\u2264100).\n","output_specification":"Print the word \"YES\" if the body is in equilibrium, or the word \"NO\" if it is not.\n","notes":null,"sample_inputs":["3\n4 1 7\n-2 4 -1\n1 -5 -3\n","3\n3 -1 7\n-5 2 -4\n2 -1 -3\n"],"sample_outputs":["NO","YES"],"human_solution":"use strict;\r\nuse warnings;\r\n\r\nmy $n = <>;\r\nchomp($n);\r\n\r\nmy ($x_sum, $y_sum, $z_sum);\r\n\r\nwhile($n--){\r\n my $in = <>;\r\n my ($x, $y, $z) = split(' ', $in);\r\n $x_sum += $x;\r\n $y_sum += $y;\r\n $z_sum += $z;\r\n}\r\n\r\nif($x_sum || $y_sum || $z_sum){\r\n print(\"NO\\n\");\r\n}\r\nelse{\r\n print(\"YES\\n\");\r\n}\r\n","testcases":"[{'input': ['3\\r\\n4 1 7\\r\\n-2 4 -1\\r\\n1 -5 -3\\r\\n'], 'output': ['NO']}, {'input': ['3\\r\\n3 -1 7\\r\\n-5 2 -4\\r\\n2 -1 -3\\r\\n'], 'output': ['YES']}, {'input': ['10\\r\\n21 32 -46\\r\\n43 -35 21\\r\\n42 2 -50\\r\\n22 40 20\\r\\n-27 -9 38\\r\\n-4 1 1\\r\\n-40 6 -31\\r\\n-13 -2 34\\r\\n-21 34 -12\\r\\n-32 -29 41\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n25 -33 43\\r\\n-27 -42 28\\r\\n-35 -20 19\\r\\n41 -42 -1\\r\\n49 -39 -4\\r\\n-49 -22 7\\r\\n-19 29 41\\r\\n8 -27 -43\\r\\n8 34 9\\r\\n-11 -3 33\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n-6 21 18\\r\\n20 -11 -8\\r\\n37 -11 41\\r\\n-5 8 33\\r\\n29 23 32\\r\\n30 -33 -11\\r\\n39 -49 -36\\r\\n28 34 -49\\r\\n22 29 -34\\r\\n-18 -6 7\\r\\n'], 'output': ['NO']}, {'input': ['10\\r\\n47 -2 -27\\r\\n0 26 -14\\r\\n5 -12 33\\r\\n2 18 3\\r\\n45 -30 -49\\r\\n4 -18 8\\r\\n-46 -44 -41\\r\\n-22 -10 -40\\r\\n-35 -21 26\\r\\n33 20 38\\r\\n'], 'output': ['NO']}, {'input': ['13\\r\\n-3 -36 -46\\r\\n-11 -50 37\\r\\n42 -11 -15\\r\\n9 42 44\\r\\n-29 -12 24\\r\\n3 9 -40\\r\\n-35 13 50\\r\\n14 43 18\\r\\n-13 8 24\\r\\n-48 -15 10\\r\\n50 9 -50\\r\\n21 0 -50\\r\\n0 0 -6\\r\\n'], 'output': ['YES']}, {'input': ['14\\r\\n43 23 17\\r\\n4 17 44\\r\\n5 -5 -16\\r\\n-43 -7 -6\\r\\n47 -48 12\\r\\n50 47 -45\\r\\n2 14 43\\r\\n37 -30 15\\r\\n4 -17 -11\\r\\n17 9 -45\\r\\n-50 -3 -8\\r\\n-50 0 0\\r\\n-50 0 0\\r\\n-16 0 0\\r\\n'], 'output': ['YES']}, {'input': ['13\\r\\n29 49 -11\\r\\n38 -11 -20\\r\\n25 1 -40\\r\\n-11 28 11\\r\\n23 -19 1\\r\\n45 -41 -17\\r\\n-3 0 -19\\r\\n-13 -33 49\\r\\n-30 0 28\\r\\n34 17 45\\r\\n-50 9 -27\\r\\n-50 0 0\\r\\n-37 0 0\\r\\n'], 'output': ['YES']}, {'input': ['12\\r\\n3 28 -35\\r\\n-32 -44 -17\\r\\n9 -25 -6\\r\\n-42 -22 20\\r\\n-19 15 38\\r\\n-21 38 48\\r\\n-1 -37 -28\\r\\n-10 -13 -50\\r\\n-5 21 29\\r\\n34 28 50\\r\\n50 11 -49\\r\\n34 0 0\\r\\n'], 'output': ['YES']}, {'input': ['37\\r\\n-64 -79 26\\r\\n-22 59 93\\r\\n-5 39 -12\\r\\n77 -9 76\\r\\n55 -86 57\\r\\n83 100 -97\\r\\n-70 94 84\\r\\n-14 46 -94\\r\\n26 72 35\\r\\n14 78 -62\\r\\n17 82 92\\r\\n-57 11 91\\r\\n23 15 92\\r\\n-80 -1 1\\r\\n12 39 18\\r\\n-23 -99 -75\\r\\n-34 50 19\\r\\n-39 84 -7\\r\\n45 -30 -39\\r\\n-60 49 37\\r\\n45 -16 -72\\r\\n33 -51 -56\\r\\n-48 28 5\\r\\n97 91 88\\r\\n45 -82 -11\\r\\n-21 -15 -90\\r\\n-53 73 -26\\r\\n-74 85 -90\\r\\n-40 23 38\\r\\n100 -13 49\\r\\n32 -100 -100\\r\\n0 -100 -70\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -100 0\\r\\n0 -37 0\\r\\n'], 'output': ['YES']}, {'input': ['4\\r\\n68 3 100\\r\\n68 21 -100\\r\\n-100 -24 0\\r\\n-36 0 0\\r\\n'], 'output': ['YES']}, {'input': ['33\\r\\n-1 -46 -12\\r\\n45 -16 -21\\r\\n-11 45 -21\\r\\n-60 -42 -93\\r\\n-22 -45 93\\r\\n37 96 85\\r\\n-76 26 83\\r\\n-4 9 55\\r\\n7 -52 -9\\r\\n66 8 -85\\r\\n-100 -54 11\\r\\n-29 59 74\\r\\n-24 12 2\\r\\n-56 81 85\\r\\n-92 69 -52\\r\\n-26 -97 91\\r\\n54 59 -51\\r\\n58 21 -57\\r\\n7 68 56\\r\\n-47 -20 -51\\r\\n-59 77 -13\\r\\n-85 27 91\\r\\n79 60 -56\\r\\n66 -80 5\\r\\n21 -99 42\\r\\n-31 -29 98\\r\\n66 93 76\\r\\n-49 45 61\\r\\n100 -100 -100\\r\\n100 -100 -100\\r\\n66 -75 -100\\r\\n0 0 -100\\r\\n0 0 -87\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n1 2 3\\r\\n3 2 1\\r\\n0 0 0\\r\\n'], 'output': ['NO']}, {'input': ['2\\r\\n5 -23 12\\r\\n0 0 0\\r\\n'], 'output': ['NO']}, {'input': ['1\\r\\n0 0 0\\r\\n'], 'output': ['YES']}, {'input': ['1\\r\\n1 -2 0\\r\\n'], 'output': ['NO']}, {'input': ['2\\r\\n-23 77 -86\\r\\n23 -77 86\\r\\n'], 'output': ['YES']}, {'input': ['26\\r\\n86 7 20\\r\\n-57 -64 39\\r\\n-45 6 -93\\r\\n-44 -21 100\\r\\n-11 -49 21\\r\\n73 -71 -80\\r\\n-2 -89 56\\r\\n-65 -2 7\\r\\n5 14 84\\r\\n57 41 13\\r\\n-12 69 54\\r\\n40 -25 27\\r\\n-17 -59 0\\r\\n64 -91 -30\\r\\n-53 9 42\\r\\n-54 -8 14\\r\\n-35 82 27\\r\\n-48 -59 -80\\r\\n88 70 79\\r\\n94 57 97\\r\\n44 63 25\\r\\n84 -90 -40\\r\\n-100 100 -100\\r\\n-92 100 -100\\r\\n0 10 -100\\r\\n0 0 -82\\r\\n'], 'output': ['YES']}, {'input': ['42\\r\\n11 27 92\\r\\n-18 -56 -57\\r\\n1 71 81\\r\\n33 -92 30\\r\\n82 83 49\\r\\n-87 -61 -1\\r\\n-49 45 49\\r\\n73 26 15\\r\\n-22 22 -77\\r\\n29 -93 87\\r\\n-68 44 -90\\r\\n-4 -84 20\\r\\n85 67 -6\\r\\n-39 26 77\\r\\n-28 -64 20\\r\\n65 -97 24\\r\\n-72 -39 51\\r\\n35 -75 -91\\r\\n39 -44 -8\\r\\n-25 -27 -57\\r\\n91 8 -46\\r\\n-98 -94 56\\r\\n94 -60 59\\r\\n-9 -95 18\\r\\n-53 -37 98\\r\\n-8 -94 -84\\r\\n-52 55 60\\r\\n15 -14 37\\r\\n65 -43 -25\\r\\n94 12 66\\r\\n-8 -19 -83\\r\\n29 81 -78\\r\\n-58 57 33\\r\\n24 86 -84\\r\\n-53 32 -88\\r\\n-14 7 3\\r\\n89 97 -53\\r\\n-5 -28 -91\\r\\n-100 100 -6\\r\\n-84 100 0\\r\\n0 100 0\\r\\n0 70 0\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n96 49 -12\\r\\n2 -66 28\\r\\n-98 17 -16\\r\\n'], 'output': ['YES']}, {'input': ['5\\r\\n70 -46 86\\r\\n-100 94 24\\r\\n-27 63 -63\\r\\n57 -100 -47\\r\\n0 -11 0\\r\\n'], 'output': ['YES']}, {'input': ['18\\r\\n-86 -28 70\\r\\n-31 -89 42\\r\\n31 -48 -55\\r\\n95 -17 -43\\r\\n24 -95 -85\\r\\n-21 -14 31\\r\\n68 -18 81\\r\\n13 31 60\\r\\n-15 28 99\\r\\n-42 15 9\\r\\n28 -61 -62\\r\\n-16 71 29\\r\\n-28 75 -48\\r\\n-77 -67 36\\r\\n-100 83 89\\r\\n100 100 -100\\r\\n57 34 -100\\r\\n0 0 -53\\r\\n'], 'output': ['YES']}, {'input': ['44\\r\\n52 -54 -29\\r\\n-82 -5 -94\\r\\n-54 43 43\\r\\n91 16 71\\r\\n7 80 -91\\r\\n3 15 29\\r\\n-99 -6 -77\\r\\n-3 -77 -64\\r\\n73 67 34\\r\\n25 -10 -18\\r\\n-29 91 63\\r\\n-72 86 -16\\r\\n-68 85 -81\\r\\n-3 36 44\\r\\n-74 -14 -80\\r\\n34 -96 -97\\r\\n-76 -78 -33\\r\\n-24 44 -58\\r\\n98 12 77\\r\\n95 -63 -6\\r\\n-51 3 -90\\r\\n-92 -10 72\\r\\n7 3 -68\\r\\n57 -53 71\\r\\n29 57 -48\\r\\n35 -60 10\\r\\n79 -70 -61\\r\\n-20 77 55\\r\\n-86 -15 -35\\r\\n84 -88 -18\\r\\n100 -42 77\\r\\n-20 46 8\\r\\n-41 -43 -65\\r\\n38 -98 -23\\r\\n-100 65 45\\r\\n-7 -91 -63\\r\\n46 88 -85\\r\\n48 59 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 100\\r\\n0 0 1\\r\\n'], 'output': ['YES']}, {'input': ['18\\r\\n-14 -64 -91\\r\\n-8 -66 -86\\r\\n-23 92 -40\\r\\n6 -3 -53\\r\\n57 41 78\\r\\n-79 42 -22\\r\\n-88 -17 45\\r\\n4 -45 44\\r\\n83 -18 -25\\r\\n34 86 -92\\r\\n75 -30 12\\r\\n44 99 11\\r\\n-67 -13 72\\r\\n22 83 -56\\r\\n-37 71 72\\r\\n-9 -100 100\\r\\n0 -100 31\\r\\n0 -58 0\\r\\n'], 'output': ['YES']}, {'input': ['23\\r\\n-70 37 78\\r\\n42 84 6\\r\\n28 -94 -24\\r\\n-49 76 95\\r\\n-67 18 84\\r\\n-53 78 -5\\r\\n65 -63 -64\\r\\n-66 -64 -69\\r\\n81 -93 95\\r\\n10 52 -79\\r\\n-89 -61 -64\\r\\n-64 -47 43\\r\\n-81 -35 55\\r\\n80 82 73\\r\\n-60 -81 -18\\r\\n49 -10 -19\\r\\n-58 70 12\\r\\n-24 -15 -93\\r\\n98 -93 -54\\r\\n-28 -75 11\\r\\n100 100 -63\\r\\n100 100 0\\r\\n56 34 0\\r\\n'], 'output': ['YES']}, {'input': ['3\\r\\n0 2 -2\\r\\n1 -1 3\\r\\n-3 0 0\\r\\n'], 'output': ['NO']}]","id":658} {"difficulty":800,"lang":"Perl","lang_cluster":"Perl","src_uid":"750_A","execute_outcome":"WRONG_ANSWER","source_code":"#!perl\nmy ($n, $k);\nwhile (<>)\n{\n($n, $k)=split;\nmy $re = 240 - $k;\n$re \/= 5;\n$re = int($re);\nmy $cnt = 0;\nwhile ($re > 0 && $cnt < $n) { $cnt++; $re -= $cnt; }\nprint $cnt, \"\\n\";\n}\n","description":"Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be n problems, sorted by difficulty, i.e. problem 1 is the easiest and problem n is the hardest. Limak knows it will take him 5\u00b7i minutes to solve the i-th problem.Limak's friends organize a New Year's Eve party and Limak wants to be there at midnight or earlier. He needs k minutes to get there from his house, where he will participate in the contest first.How many problems can Limak solve if he wants to make it to the party?","input_specification":"The only line of the input contains two integers n and k (1\u2264n\u226410, 1\u2264k\u2264240)\u00a0\u2014 the number of the problems in the contest and the number of minutes Limak needs to get to the party from his house.\n","output_specification":"Print one integer, denoting the maximum possible number of problems Limak can solve so that he could get to the party at midnight or earlier.\n","notes":"In the first sample, there are 3 problems and Limak needs 222 minutes to get to the party. The three problems require 5, 10 and 15 minutes respectively. Limak can spend 5+10=15 minutes to solve first two problems. Then, at 20:15 he can leave his house to get to the party at 23:57 (after 222 minutes). In this scenario Limak would solve 2 problems. He doesn't have enough time to solve 3 problems so the answer is 2.\nIn the second sample, Limak can solve all 4 problems in 5+10+15+20=50 minutes. At 20:50 he will leave the house and go to the party. He will get there exactly at midnight.\nIn the third sample, Limak needs only 1 minute to get to the party. He has enough time to solve all 7 problems.\n","sample_inputs":["3 222\n","4 190\n","7 1\n"],"sample_outputs":["2\n","4\n","7\n"],"human_solution":"($n, $k) = split \/ \/, <>;\r\n$k = 240 - $k;\r\nfor ($i = 1; $i <= $n; $i++) {\r\n $k -= 5*$i;\r\n $k <= 0 and last;\r\n}\r\nprint $k != 0 ? $i-1: $i;\r\nexit;","testcases":"[{'input': ['3 222\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 190\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7 1\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 135\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10 136\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['9 235\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['9 236\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 225\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 226\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 210\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 211\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 191\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 165\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10 166\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['8 100\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['8 101\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['8 60\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['8 61\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 15\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10 16\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['4 100\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4 101\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7 167\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 164\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['9 170\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['8 160\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1 100\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['8 123\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['2 99\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 88\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['1 235\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 55\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 240\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['9 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['2 236\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 2\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['3 239\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 237\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 235\\r\\n'], 'output': ['1\\r\\n']}]","id":659} {"difficulty":1200,"lang":"Perl","lang_cluster":"Perl","src_uid":"80_B","execute_outcome":"WRONG_ANSWER","source_code":"<>=~\/:\/;\r\nprint (($`%12)*30 + $'\/2,\" \",60*$')","description":"Do you remember a kind cartoon \"Beauty and the Beast\"? No, no, there was no firing from machine guns or radiation mutants time-travels!There was a beauty named Belle. Once she had violated the Beast's order and visited the West Wing. After that she was banished from the castle... Everybody was upset. The beautiful Belle was upset, so was the Beast, so was Lumiere the candlestick. But the worst thing was that Cogsworth was upset. Cogsworth is not a human, but is the mantel clock, which was often used as an alarm clock.Due to Cogsworth's frustration all the inhabitants of the castle were in trouble: now they could not determine when it was time to drink morning tea, and when it was time for an evening stroll. Fortunately, deep in the basement are lying digital clock showing the time in the format HH:MM. Now the residents of the castle face a difficult task. They should turn Cogsworth's hour and minute mustache hands in such a way, that Cogsworth began to show the correct time. Moreover they need to find turn angles in degrees for each mustache hands. The initial time showed by Cogsworth is 12:00.You can only rotate the hands forward, that is, as is shown in the picture: As since there are many ways too select such angles because of full rotations, choose the smallest angles in the right (non-negative) direction.Note that Cogsworth's hour and minute mustache hands move evenly and continuously. Hands are moving independently, so when turning one hand the other hand remains standing still.","input_specification":"The only line of input contains current time according to the digital clock, formatted as HH:MM (00\u2264HH\u226423, 00\u2264MM\u226459). The mantel clock initially shows 12:00.\nPretests contain times of the beginning of some morning TV programs of the Channel One Russia.\n","output_specification":"Print two numbers x and y \u2014 the angles of turning the hour and minute hands, respectively (0\u2264x,y<360). The absolute or relative error in the answer should not exceed 10^-9.\n","notes":"A note to the second example: the hour hand will be positioned exactly in the middle, between 4 and 5.\n","sample_inputs":["12:00\n","04:30\n","08:17\n"],"sample_outputs":["0 0","135 180","248.5 102"],"human_solution":"<>=~\/:\/;\nprint (($`%12)*30 + $'\/2,\" \",6*$')\n","testcases":"[{'input': ['12:00\\r\\n'], 'output': ['0 0']}, {'input': ['04:30\\r\\n'], 'output': ['135 180']}, {'input': ['08:17\\r\\n'], 'output': ['248.5 102']}, {'input': ['07:20\\r\\n'], 'output': ['220 120']}, {'input': ['09:55\\r\\n'], 'output': ['297.5 330']}, {'input': ['11:59\\r\\n'], 'output': ['359.5 354']}, {'input': ['01:23\\r\\n'], 'output': ['41.5 138']}, {'input': ['11:00\\r\\n'], 'output': ['330 0']}, {'input': ['00:00\\r\\n'], 'output': ['0 0']}, {'input': ['12:30\\r\\n'], 'output': ['15 180']}, {'input': ['23:59\\r\\n'], 'output': ['359.5 354']}, {'input': ['20:00\\r\\n'], 'output': ['240 0']}, {'input': ['23:45\\r\\n'], 'output': ['352.5 270']}, {'input': ['07:14\\r\\n'], 'output': ['217 84']}, {'input': ['15:15\\r\\n'], 'output': ['97.5 90']}, {'input': ['16:05\\r\\n'], 'output': ['122.5 30']}, {'input': ['19:55\\r\\n'], 'output': ['237.5 330']}, {'input': ['23:58\\r\\n'], 'output': ['359 348']}, {'input': ['14:33\\r\\n'], 'output': ['76.5 198']}, {'input': ['18:00\\r\\n'], 'output': ['180 0']}, {'input': ['00:24\\r\\n'], 'output': ['12 144']}, {'input': ['19:45\\r\\n'], 'output': ['232.5 270']}, {'input': ['20:05\\r\\n'], 'output': ['242.5 30']}, {'input': ['21:13\\r\\n'], 'output': ['276.5 78']}, {'input': ['08:04\\r\\n'], 'output': ['242 24']}, {'input': ['07:40\\r\\n'], 'output': ['230 240']}, {'input': ['19:12\\r\\n'], 'output': ['216 72']}, {'input': ['06:36\\r\\n'], 'output': ['198 216']}, {'input': ['06:16\\r\\n'], 'output': ['188 96']}, {'input': ['11:49\\r\\n'], 'output': ['354.5 294']}, {'input': ['18:45\\r\\n'], 'output': ['202.5 270']}, {'input': ['06:44\\r\\n'], 'output': ['202 264']}, {'input': ['20:45\\r\\n'], 'output': ['262.5 270']}, {'input': ['17:48\\r\\n'], 'output': ['174 288']}, {'input': ['08:09\\r\\n'], 'output': ['244.5 54']}, {'input': ['04:12\\r\\n'], 'output': ['126 72']}, {'input': ['21:30\\r\\n'], 'output': ['285 180']}, {'input': ['12:56\\r\\n'], 'output': ['28 336']}, {'input': ['00:43\\r\\n'], 'output': ['21.5 258']}, {'input': ['02:54\\r\\n'], 'output': ['87 324']}, {'input': ['02:29\\r\\n'], 'output': ['74.5 174']}, {'input': ['17:24\\r\\n'], 'output': ['162 144']}, {'input': ['14:27\\r\\n'], 'output': ['73.5 162']}, {'input': ['16:37\\r\\n'], 'output': ['138.5 222']}, {'input': ['14:40\\r\\n'], 'output': ['80 240']}, {'input': ['01:00\\r\\n'], 'output': ['30 0']}, {'input': ['21:40\\r\\n'], 'output': ['290 240']}, {'input': ['08:47\\r\\n'], 'output': ['263.5 282']}, {'input': ['11:30\\r\\n'], 'output': ['345 180']}, {'input': ['08:31\\r\\n'], 'output': ['255.5 186']}, {'input': ['04:11\\r\\n'], 'output': ['125.5 66']}, {'input': ['19:27\\r\\n'], 'output': ['223.5 162']}, {'input': ['10:54\\r\\n'], 'output': ['327 324']}, {'input': ['01:20\\r\\n'], 'output': ['40 120']}, {'input': ['12:33\\r\\n'], 'output': ['16.5 198']}, {'input': ['11:32\\r\\n'], 'output': ['346 192']}, {'input': ['15:36\\r\\n'], 'output': ['108 216']}, {'input': ['23:45\\r\\n'], 'output': ['352.5 270']}, {'input': ['20:12\\r\\n'], 'output': ['246 72']}, {'input': ['15:28\\r\\n'], 'output': ['104 168']}, {'input': ['00:01\\r\\n'], 'output': ['0.5 6']}, {'input': ['12:01\\r\\n'], 'output': ['0.5 6']}, {'input': ['23:01\\r\\n'], 'output': ['330.5 6']}, {'input': ['00:59\\r\\n'], 'output': ['29.5 354']}, {'input': ['12:59\\r\\n'], 'output': ['29.5 354']}, {'input': ['23:00\\r\\n'], 'output': ['330 0']}]","id":660} {"difficulty":1100,"lang":"Perl","lang_cluster":"Perl","src_uid":"82_A","execute_outcome":"RUNTIME_ERROR","source_code":"#!\/usr\/bin\/perl\r\nuse bigint;\r\nchomp($n=<>);\r\nmy @array=qw (Sheldon Leonard Penny Rajesh Howard);\r\n$i=1;\r\n$c=$i*5;\r\nwhile ($c<$n){\r\n$n-=$i*5;\r\n$i=$i*2;\r\n}\r\n$n = $n%($i*5);\r\n$n -=1;\r\n$n=($n-($n%$i)\/$i);\r\nprint ($array[$n]);","description":"Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a \"Double Cola\" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the end of the queue. Then the next in the queue (Leonard) buys a can, drinks it and gets to the end of the queue as two Leonards, and so on. This process continues ad infinitum.For example, Penny drinks the third can of cola and the queue will look like this: Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny.Write a program that will print the name of a man who will drink the n-th can.Note that in the very beginning the queue looks like that: Sheldon, Leonard, Penny, Rajesh, Howard. The first person is Sheldon.","input_specification":"The input data consist of a single integer n (1\u2264n\u226410^9).\nIt is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.\n","output_specification":"Print the single line \u2014 the name of the person who drinks the n-th can of cola. The cans are numbered starting from 1. Please note that you should spell the names like this: \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\" (without the quotes). In that order precisely the friends are in the queue initially.\n","notes":null,"sample_inputs":["1\n","6\n","1802\n"],"sample_outputs":["Sheldon\n","Sheldon\n","Penny\n"],"human_solution":"use strict;\nuse warnings;\n\nmy @names = qw (Sheldon Leonard Penny Rajesh Howard);\nmy $n = <>;\nmy $curr = 5;\nmy $sum = 5;\nwhile ($sum < $n) {\n $curr *= 2;\n $sum += $curr;\n}\n\nmy $cnt = 4;\nwhile ($sum >= $n) {\n $cnt--;\n $sum -= $curr \/ 5;\n}\n\nprint $names[$cnt+1].\"\\n\";\n\n","testcases":"[{'input': ['1\\r\\n'], 'output': ['Sheldon\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['Sheldon\\r\\n']}, {'input': ['1802\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['Sheldon\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['534\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['5033\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['10010\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['500000000\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['63\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['841\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['3667\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['38614\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['282798\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['9266286\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['27385966\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['121580142\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['300\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['1745\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['8302\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['184518\\r\\n'], 'output': ['Sheldon\\r\\n']}, {'input': ['1154414\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['28643950\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['159222638\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['24\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['505\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['4425\\r\\n'], 'output': ['Rajesh\\r\\n']}, {'input': ['12079\\r\\n'], 'output': ['Sheldon\\r\\n']}, {'input': ['469726\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['3961838\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['57710446\\r\\n'], 'output': ['Leonard\\r\\n']}, {'input': ['80719470\\r\\n'], 'output': ['Howard\\r\\n']}, {'input': ['1000000000\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['999999999\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['999999998\\r\\n'], 'output': ['Penny\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['Howard\\r\\n']}]","id":661} {"difficulty":1300,"lang":"Perl","lang_cluster":"Perl","src_uid":"83_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl -w\n\nuse strict;\n\nsub magic {\n my @a = @{$_[0]};\n my $cur = 'inf';\n my $c = 1;\n my $s = 0;\n for (@a) {\n if ($cur != $_) {\n $s += $c * ($c + 1) \/ 2;\n $c = 1;\n } else {\n $c++;\n }\n $cur = $_;\n }\n $s;\n}\n\n<>;\nmy @a = split ' ', <>;\nprint magic(\\@a), \"\\n\";\n","description":"Valery is very interested in magic. Magic attracts him so much that he sees it everywhere. He explains any strange and weird phenomenon through intervention of supernatural forces. But who would have thought that even in a regular array of numbers Valera manages to see something beautiful and magical.Valera absolutely accidentally got a piece of ancient parchment on which an array of numbers was written. He immediately thought that the numbers in this array were not random. As a result of extensive research Valera worked out a wonderful property that a magical array should have: an array is defined as magic if its minimum and maximum coincide.He decided to share this outstanding discovery with you, but he asks you for help in return. Despite the tremendous intelligence and wit, Valera counts very badly and so you will have to complete his work. All you have to do is count the number of magical subarrays of the original array of numbers, written on the parchment. Subarray is defined as non-empty sequence of consecutive elements.","input_specification":"The first line of the input data contains an integer n (1\u2264n\u226410^5). The second line contains an array of original integers a1,a2,...,an (-10^9\u2264ai\u226410^9). \n","output_specification":"Print on the single line the answer to the problem: the amount of subarrays, which are magical.\nPlease do not use the %lld specificator to read or write 64-bit numbers in C++. It is recommended to use cin, cout streams (you can also use the %I64d specificator).\n","notes":"Notes to sample tests:\nMagical subarrays are shown with pairs of indices [a;b] of the beginning and the end.\nIn the first sample: [1;1], [2;2], [3;3], [4;4], [2;3].\nIn the second sample: [1;1], [2;2], [3;3], [4;4], [5;5], [1;2], [2;3], [1;3]. \n","sample_inputs":["4\n2 1 1 4\n","5\n-2 -2 -2 0 1\n"],"sample_outputs":["5\n","8\n"],"human_solution":"#!\/usr\/bin\/perl -w\n\nuse strict;\n\nsub magic {\n my @a = @{$_[0]};\n my $cur = shift @a;\n my $c = 1;\n my $s = 0;\n for (@a) {\n if ($cur != $_) {\n $s += $c * ($c + 1) \/ 2;\n $c = 1;\n } else {\n $c++;\n }\n $cur = $_;\n }\n $s += $c * ($c + 1) \/ 2;\n $s;\n}\n\n<>;\nmy @a = split ' ', <>;\nprint magic(\\@a), \"\\n\";\n","testcases":"[{'input': ['4\\r\\n2 1 1 4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5\\r\\n-2 -2 -2 0 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1\\r\\n10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n5 6\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n5 5 4 5 5\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['8\\r\\n1 2 0 0 0 0 3 3\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['12\\r\\n-4 3 3 2 3 3 3 -4 2 -4 -4 -4\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['10\\r\\n7 1 0 10 0 -5 -3 -2 0 0\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['20\\r\\n6 0 0 -3 1 -3 0 -8 1 3 5 2 -1 -5 -1 9 0 6 -2 4\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['100\\r\\n0 -18 -9 -15 3 16 -28 0 -28 0 28 -20 -9 9 -11 0 18 -15 -18 -26 0 -27 -25 -22 6 -5 8 14 -17 24 20 3 -6 24 -27 1 -23 0 4 12 -20 0 -10 30 22 -6 13 16 0 15 17 -8 -2 0 -5 13 11 23 -17 -29 10 15 -28 0 -23 4 20 17 -7 -5 -16 -17 16 2 20 19 -8 0 8 -5 12 0 0 -14 -15 -28 -10 20 0 8 -1 10 14 9 0 4 -16 15 13 -10\\r\\n'], 'output': ['101\\r\\n']}, {'input': ['50\\r\\n2 0 2 0 0 0 0 -1 -2 -2 -2 1 1 2 2 0 2 0 2 -3 0 0 0 0 3 1 -2 0 -1 0 -2 3 -1 2 0 2 0 0 0 0 2 0 1 0 0 3 0 0 -2 0\\r\\n'], 'output': ['75\\r\\n']}, {'input': ['2\\r\\n-510468670 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['150\\r\\n0 -2 1 -2 0 0 0 0 -2 0 -2 -1 0 0 2 0 1 -2 1 -1 0 0 0 2 -2 2 -1 0 0 0 -2 0 2 0 1 0 -2 0 -2 -1 -1 -2 -2 2 0 0 1 -2 -2 -1 -2 0 2 1 1 -1 1 0 -2 2 0 0 0 1 -1 0 -2 -1 0 -2 2 1 1 0 0 2 0 0 2 -1 0 0 2 0 2 0 -2 -1 1 -2 1 0 0 -2 -1 -1 0 0 2 -1 -1 -1 -1 -2 0 0 2 -1 -1 1 0 0 1 -1 0 0 -1 2 2 0 0 0 -1 -2 0 1 0 -1 0 -1 -1 0 2 0 1 2 0 0 2 0 0 1 2 0 2 -2 2 0 2 2\\r\\n'], 'output': ['196\\r\\n']}]","id":662} {"difficulty":1200,"lang":"Perl","lang_cluster":"Perl","src_uid":"899_B","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $\/;\n\nmy $y = join ' ',\n\tmap {\n\t\tjoin ' ', 31, $_,\n\t\t\tqq{ \n\t\t\t... \u00d0\u00b2 \u00d0\u00bc\u00d0\u00b0\u00d1\u0080\u00d1\u0082\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d0\u00b0\u00d0\u00bf\u00d1\u0080\u00d0\u00b5\u00d0\u00bb\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \n\t\t\t\u00d0\u00b2 \u00d0\u00bc\u00d0\u00b0\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d0\u00b8\u00d1\u008e\u00d0\u00bd\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00b8\u00d1\u008e\u00d0\u00bb\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \n\t\t\t\u00d0\u00b2 \u00d0\u00b0\u00d0\u00b2\u00d0\u00b3\u00d1\u0083\u00d1\u0081\u00d1\u0082\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d1\u0081\u00d0\u00b5\u00d0\u00bd\u00d1\u0082\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00be\u00d0\u00ba\u00d1\u0082\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \n\t\t\t\u00d0\u00b2 \u00d0\u00bd\u00d0\u00be\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00b4\u00d0\u00b5\u00d0\u00ba\u00d0\u00b0\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c. \n\t\t\t} =~ \/\\d+\/g\n\t} 28, 28, 29, 28;\n\nwhile(<>){\n\t$_ = <>, chomp;\n\t\n\tprint $y =~ \/$_\/ ? \"Yes\" : \"No\";\n\t}","description":"Everybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 in June, 31 in July, 31 in August, 30 in September, 31 in October, 30 in November, 31 in December.A year is leap in one of two cases: either its number is divisible by 4, but not divisible by 100, or is divisible by 400. For example, the following years are leap: 2000, 2004, but years 1900 and 2018 are not leap.In this problem you are given n (1\u2264n\u226424) integers a1,a2,...,an, and you have to check if these integers could be durations in days of n consecutive months, according to Gregorian calendar. Note that these months could belong to several consecutive years. In other words, check if there is a month in some year, such that its duration is a1 days, duration of the next month is a2 days, and so on.","input_specification":"The first line contains single integer n (1\u2264n\u226424) \u2014 the number of integers.\nThe second line contains n integers a1,a2,...,an (28\u2264ai\u226431) \u2014 the numbers you are to check.\n","output_specification":"If there are several consecutive months that fit the sequence, print \"YES\" (without quotes). Otherwise, print \"NO\" (without quotes).\nYou can print each letter in arbitrary case (small or large).\n","notes":"In the first example the integers can denote months July, August, September and October.\nIn the second example the answer is no, because there are no two consecutive months each having 30 days.\nIn the third example the months are: February (leap year) \u2014 March \u2014 April \u2013 May \u2014 June.\nIn the fourth example the number of days in the second month is 28, so this is February. March follows February and has 31 days, but not 30, so the answer is NO.\nIn the fifth example the months are: December \u2014 January \u2014 February (non-leap year).\n","sample_inputs":["4\n31 31 30 31\n","2\n30 30\n","5\n29 31 30 31 30\n","3\n31 28 30\n","3\n31 31 28\n"],"sample_outputs":["Yes\n\n","No\n\n","Yes\n\n","No\n\n","Yes\n\n"],"human_solution":"#!\/usr\/bin\/perl\n\nuse warnings;\nuse strict;\n\n$\\ = $\/;\n\nmy $y = join ' ',\n\tmap {\n\t\tjoin ' ', 31, $_,\n\t\t\tqq{ \n\t\t\t... \u00d0\u00b2 \u00d0\u00bc\u00d0\u00b0\u00d1\u0080\u00d1\u0082\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d0\u00b0\u00d0\u00bf\u00d1\u0080\u00d0\u00b5\u00d0\u00bb\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \n\t\t\t\u00d0\u00b2 \u00d0\u00bc\u00d0\u00b0\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d0\u00b8\u00d1\u008e\u00d0\u00bd\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00b8\u00d1\u008e\u00d0\u00bb\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \n\t\t\t\u00d0\u00b2 \u00d0\u00b0\u00d0\u00b2\u00d0\u00b3\u00d1\u0083\u00d1\u0081\u00d1\u0082\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \u00d0\u00b2 \u00d1\u0081\u00d0\u00b5\u00d0\u00bd\u00d1\u0082\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00be\u00d0\u00ba\u00d1\u0082\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c, \n\t\t\t\u00d0\u00b2 \u00d0\u00bd\u00d0\u00be\u00d1\u008f\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 30 \u00d0\u00b4\u00d0\u00bd\u00d0\u00b5\u00d0\u00b9, \u00d0\u00b2 \u00d0\u00b4\u00d0\u00b5\u00d0\u00ba\u00d0\u00b0\u00d0\u00b1\u00d1\u0080\u00d0\u00b5 31 \u00d0\u00b4\u00d0\u00b5\u00d0\u00bd\u00d1\u008c. \n\t\t\t} =~ \/\\d+\/g\n\t} 28, 28, 28, 29, 28, 28;\n\nwhile(<>){\n\t$_ = <>, chomp;\n\t\n\tprint $y =~ \/$_\/ ? \"Yes\" : \"No\";\n\t}","testcases":"[{'input': ['4\\r\\n31 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['2\\r\\n30 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['5\\r\\n29 31 30 31 30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['3\\r\\n31 28 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['3\\r\\n31 31 28\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n29 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['4\\r\\n31 29 31 30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['8\\r\\n31 29 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['1\\r\\n29\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['8\\r\\n31 29 31 30 31 31 31 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['1\\r\\n31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['11\\r\\n30 31 30 31 31 30 31 30 31 31 28\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['21\\r\\n30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['4\\r\\n31 28 28 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['2\\r\\n30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['7\\r\\n28 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['4\\r\\n28 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['17\\r\\n28 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['9\\r\\n31 31 29 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['4\\r\\n31 28 31 30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['21\\r\\n30 31 30 31 31 28 31 30 31 30 31 29 30 31 30 31 31 28 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['2\\r\\n31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['17\\r\\n31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['4\\r\\n30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 28 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['11\\r\\n30 31 30 31 31 30 31 30 31 29 28\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['22\\r\\n31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['14\\r\\n31 30 31 31 28 31 30 31 30 31 31 30 31 30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 30 31 31 28 31 30 31 30 31 31 30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['4\\r\\n31 29 29 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['7\\r\\n28 28 30 31 30 31 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['9\\r\\n29 31 29 31 30 31 30 31 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['17\\r\\n31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['2\\r\\n31 29\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 28 31 30 31 30 31 31 30 31 28 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['2\\r\\n29 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 29 31 30 31 30 31 30 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 28 31 30 31 29 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['22\\r\\n31 30 31 30 31 31 30 31 30 31 31 28 31 30 28 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['14\\r\\n31 30 31 31 28 31 30 31 30 31 31 30 29 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['19\\r\\n31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['20\\r\\n31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['1\\r\\n28\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['1\\r\\n29\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['17\\r\\n31 30 31 30 31 31 29 31 30 31 31 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['1\\r\\n30\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['1\\r\\n31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 30 31 31 28 28 30 31 30 31 31 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['24\\r\\n29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n31 29 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['13\\r\\n28 31 30 31 30 31 31 30 31 30 31 31 28\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['15\\r\\n31 31 28 31 30 31 30 31 31 30 31 30 31 31 29\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['23\\r\\n31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['24\\r\\n31 30 31 30 31 31 30 31 30 31 31 30 31 30 31 30 31 31 30 31 30 31 31 30\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['23\\r\\n29 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}, {'input': ['15\\r\\n31 31 29 31 30 31 30 31 31 30 31 30 31 31 28\\r\\n'], 'output': ['Yes\\r\\n\\r\\n']}, {'input': ['12\\r\\n31 30 31 30 31 30 31 31 30 31 30 31\\r\\n'], 'output': ['No\\r\\n\\r\\n']}]","id":663} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"1095_F","execute_outcome":"RUNTIME_ERROR","source_code":"# Read input\\nmy ($n, $m) = split(' ', );\\nchomp(my $vertex_values = );\\nmy @a = split(' ', $vertex_values);\\nmy @special_offers;\\n\\n# Read special offers\\nfor (my $i = 0; $i < $m; $i++) {\\n chomp(my $offer = );\\n my ($x, $y, $w) = split(' ', $offer);\\n push @special_offers, [$x, $y, $w];\\n}\\n\\n# Sort special offers by cost in ascending order\\n@special_offers = sort { $a->[2] <=> $b->[2] } @special_offers;\\n\\n# Initialize disjoint set data structure\\nmy @parent = (0..$n);\\nmy @rank = (0..$n);\\n\\n# Find operation for disjoint set data structure\\nsub find {\\n my ($x) = @_;\\n if ($parent[$x] != $x) {\\n $parent[$x] = find($parent[$x]);\\n }\\n return $parent[$x];\\n}\\n\\n# Union operation for disjoint set data structure\\nsub union {\\n my ($x, $y) = @_;\\n my $x_root = find($x);\\n my $y_root = find($y);\\n if ($x_root == $y_root) {\\n return;\\n }\\n if ($rank[$x_root] < $rank[$y_root]) {\\n ($x_root, $y_root) = ($y_root, $x_root);\\n }\\n $parent[$y_root] = $x_root;\\n if ($rank[$x_root] == $rank[$y_root]) {\\n $rank[$x_root]++;\\n }\\n}\\n\\n# Kruskal's algorithm to find minimum spanning tree\\nmy $total_cost = 0;\\nforeach my $offer (@special_offers) {\\n my ($x, $y, $w) = @$offer;\\n if (find($x) != find($y)) {\\n union($x, $y);\\n $total_cost += $w;\\n }\\n}\\n\\n# Add remaining edges with their costs\\nfor (my $i = 1; $i <= $n; $i++) {\\n for (my $j = $i + 1; $j <= $n; $j++) {\\n if (find($i) != find($j)) {\\n my $cost = $a[$i - 1] + $a[$j - 1];\\n $total_cost += $cost;\\n union($i, $j);\\n }\\n }\\n}\\n\\n# Print the minimum number of coins required\\nprint $total_cost;\" }]","description":"You are given an undirected graph consisting of $$$n$$$ vertices. A number is written on each vertex; the number on vertex $$$i$$$ is $$$a_i$$$. Initially there are no edges in the graph.You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $$$x$$$ and $$$y$$$ is $$$a_x + a_y$$$ coins. There are also $$$m$$$ special offers, each of them is denoted by three numbers $$$x$$$, $$$y$$$ and $$$w$$$, and means that you can add an edge connecting vertices $$$x$$$ and $$$y$$$ and pay $$$w$$$ coins for it. You don't have to use special offers: if there is a pair of vertices $$$x$$$ and $$$y$$$ that has a special offer associated with it, you still may connect these two vertices paying $$$a_x + a_y$$$ coins for it.What is the minimum number of coins you have to spend to make the graph connected? Recall that a graph is connected if it's possible to get from any vertex to any other vertex using only the edges belonging to this graph.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\\\le n \\\\le 2 \\\\cdot 10^5$$$, $$$0 \\\\le m \\\\le 2 \\\\cdot 10^5$$$) \u2014 the number of vertices in the graph and the number of special offers, respectively.\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\\\dots, a_n$$$ ($$$1 \\\\le a_i \\\\le 10^{12}$$$) \u2014 the numbers written on the vertices.\nThen $$$m$$$ lines follow, each containing three integers $$$x$$$, $$$y$$$ and $$$w$$$ ($$$1 \\\\le x, y \\\\le n$$$, $$$1 \\\\le w \\\\le 10^{12}$$$, $$$x \\\\ne y$$$) denoting a special offer: you may add an edge connecting vertex $$$x$$$ and vertex $$$y$$$, and this edge will cost $$$w$$$ coins.\n","output_specification":"Print one integer \u2014 the minimum number of coins you have to pay to make the graph connected.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"#!\/usr\/bin\/perl\nuse strict;\nuse warnings;\nuse List::Util qw(min);\n\nsub find {\n my ($x, $parent) = @_;\n if ($parent->[$x] != $x) {\n $parent->[$x] = find($parent->[$x], $parent);\n }\n return $parent->[$x];\n}\n\nsub union {\n my ($x, $y, $parent, $rank) = @_;\n my $px = find($x, $parent);\n my $py = find($y, $parent);\n if ($px != $py) {\n if ($rank->[$px] > $rank->[$py]) {\n $parent->[$py] = $px;\n } else {\n $parent->[$px] = $py;\n if ($rank->[$px] == $rank->[$py]) {\n $rank->[$py]++;\n }\n }\n }\n}\n\nmy ($n, $m) = split \/ \/, <>;\nmy @a = split \/ \/, <>;\nmy @parent = (0..$n);\nmy @rank = (0) x ($n+1);\nmy @edges;\nmy $min_a = min @a;\nmy $min_i = 0;\nfor my $i (0..$#a) {\n if ($a[$i] == $min_a) {\n $min_i = $i;\n last;\n }\n}\nfor my $i (0..$#a) {\n if ($i != $min_i) {\n push @edges, [$min_i+1, $i+1, $min_a + $a[$i]];\n }\n}\nfor my $i (0..$m-1) {\n my ($x, $y, $w) = split \/ \/, <>;\n push @edges, [$x, $y, $w];\n}\n@edges = sort {$a->[2] <=> $b->[2]} @edges;\nmy $res = 0;\nfor my $edge (@edges) {\n my ($x, $y, $w) = @$edge;\n if (find($x, \\@parent) != find($y, \\@parent)) {\n union($x, $y, \\@parent, \\@rank);\n $res += $w;\n }\n}\nprint \"$res\\n\";","testcases":"[{'input': ['3 2\\r\\n1 3 3\\r\\n2 3 5\\r\\n2 1 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4 0\\r\\n1 3 3 7\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['5 4\\r\\n1 2 3 4 5\\r\\n1 2 8\\r\\n1 3 10\\r\\n1 4 7\\r\\n1 5 15\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['10 0\\r\\n9 9 5 2 2 5 8 5 1 7\\r\\n'], 'output': ['61\\r\\n']}, {'input': ['10 1\\r\\n2 2 9 7 2 3 7 7 1 1\\r\\n5 8 4\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['10 10\\r\\n3 4 5 10 10 9 5 4 7 8\\r\\n1 5 5\\r\\n10 3 18\\r\\n1 7 20\\r\\n7 8 20\\r\\n10 4 8\\r\\n10 2 17\\r\\n9 4 2\\r\\n7 5 16\\r\\n1 8 17\\r\\n7 10 18\\r\\n'], 'output': ['67\\r\\n']}, {'input': ['1 0\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n72 94\\r\\n2 1 24\\r\\n'], 'output': ['24\\r\\n']}, {'input': ['2 1\\r\\n100000000000 100000000000\\r\\n1 2 199999999999\\r\\n'], 'output': ['199999999999\\r\\n']}, {'input': ['3 3\\r\\n2 3 1\\r\\n1 2 18\\r\\n2 3 18\\r\\n3 1 18\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['2 0\\r\\n1000000000000 1000000000000\\r\\n'], 'output': ['2000000000000\\r\\n']}]","id":664} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"1163_C1","execute_outcome":"WRONG_ANSWER","source_code":"use strict;\\nuse warnings;\\n\\n# Read input\\nmy $n = ;\\nchomp $n;\\n\\nmy @poles;\\nfor (my $i = 0; $i < $n; $i++) {\\n my $line = ;\\n chomp $line;\\n my ($x, $y) = split ' ', $line;\\n push @poles, { x => $x, y => $y };\\n}\\n\\n# Count intersecting pairs\\nmy $count = 0;\\nfor (my $i = 0; $i < $n; $i++) {\\n for (my $j = $i + 1; $j < $n; $j++) {\\n for (my $k = $j + 1; $k < $n; $k++) {\\n my $x1 = $poles[$i]->{x};\\n my $y1 = $poles[$i]->{y};\\n my $x2 = $poles[$j]->{x};\\n my $y2 = $poles[$j]->{y};\\n my $x3 = $poles[$k]->{x};\\n my $y3 = $poles[$k]->{y};\\n\\n if ((($x2 - $x1) * ($y3 - $y1)) == (($x3 - $x1) * ($y2 - $y1))) {\\n $count++;\\n }\\n }\\n }\\n}\\n\\n# Print the result\\nprint $count;\\n","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.\nEach 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.\nIt is guaranteed that all of these $$$n$$$ points are distinct.\n","output_specification":"Print a single integer\u00a0\u2014 the number of pairs of wires that are intersecting.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"human_solution":"#!\/usr\/bin\/perl\n\nuse strict;\nuse warnings;\n\nsub gcd {\n my ($a, $b) = @_;\n return $b == 0 ? $a : gcd($b, $a % $b);\n}\n\nmy $n = <>;\nchomp $n;\nmy @points;\nmy %lines;\n\nfor (1..$n) {\n my $line = <>;\n chomp $line;\n my ($x, $y) = split \/ \/, $line;\n push @points, [$x, $y];\n}\n\nfor my $i (0..$#points) {\n for my $j ($i+1..$#points) {\n my $dx = $points[$i][0] - $points[$j][0];\n my $dy = $points[$i][1] - $points[$j][1];\n my $g = gcd($dx, $dy);\n $dx \/= $g; $dy \/= $g;\n if ($dx < 0 || $dx == 0 && $dy < 0) {\n $dx = -$dx;\n $dy = -$dy;\n }\n my $c = $dx * $points[$i][1] - $dy * $points[$i][0];\n $lines{\"$dx $dy\"}{$c}++;\n }\n}\n\nmy $total = 0;\nmy $pairs = 0;\n\nfor my $slope (keys %lines) {\n my $lines_on_slope = scalar keys %{$lines{$slope}};\n $total += $lines_on_slope;\n $pairs += $lines_on_slope * ($lines_on_slope - 1) \/ 2;\n}\n\nprint $total * ($total - 1) \/ 2 - $pairs;\n\n","testcases":"[{'input': ['4\\r\\n0 0\\r\\n1 1\\r\\n0 3\\r\\n1 2\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['4\\r\\n0 0\\r\\n0 2\\r\\n0 4\\r\\n2 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3\\r\\n-1 -1\\r\\n1 0\\r\\n3 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n-10000 -10000\\r\\n-10000 10000\\r\\n10000 -10000\\r\\n10000 10000\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['4\\r\\n-10000 -10000\\r\\n-10000 -9999\\r\\n10000 10000\\r\\n9999 10000\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['16\\r\\n0 0\\r\\n0 2\\r\\n0 4\\r\\n0 6\\r\\n2 0\\r\\n2 2\\r\\n2 4\\r\\n2 6\\r\\n4 0\\r\\n4 2\\r\\n4 4\\r\\n4 6\\r\\n6 0\\r\\n6 2\\r\\n6 4\\r\\n6 6\\r\\n'], 'output': ['1783\\r\\n']}, {'input': ['25\\r\\n-10000 -10000\\r\\n-10000 -5000\\r\\n-10000 0\\r\\n-10000 5000\\r\\n-10000 10000\\r\\n-5000 -10000\\r\\n-5000 -5000\\r\\n-5000 0\\r\\n-5000 5000\\r\\n-5000 10000\\r\\n0 -10000\\r\\n0 -5000\\r\\n0 0\\r\\n0 5000\\r\\n0 10000\\r\\n5000 -10000\\r\\n5000 -5000\\r\\n5000 0\\r\\n5000 5000\\r\\n5000 10000\\r\\n10000 -10000\\r\\n10000 -5000\\r\\n10000 0\\r\\n10000 5000\\r\\n10000 10000\\r\\n'], 'output': ['9324\\r\\n']}, {'input': ['2\\r\\n10000 10000\\r\\n-10000 -10000\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20\\r\\n-5118 -9140\\r\\n-5118 -7807\\r\\n-5118 -5328\\r\\n-5118 -3139\\r\\n-5118 -1442\\r\\n-5118 -1169\\r\\n-5118 -733\\r\\n-5118 3460\\r\\n-5118 8555\\r\\n-5118 9702\\r\\n-3971 -9140\\r\\n-3971 -7807\\r\\n-3971 -5328\\r\\n-3971 -3139\\r\\n-3971 -1442\\r\\n-3971 -1169\\r\\n-3971 -733\\r\\n-3971 3460\\r\\n-3971 8555\\r\\n-3971 9702\\r\\n'], 'output': ['5105\\r\\n']}, {'input': ['21\\r\\n-8207 -8742\\r\\n-8207 2162\\r\\n-8207 3741\\r\\n-6190 -8742\\r\\n-6190 2162\\r\\n-6190 3741\\r\\n-2214 -8742\\r\\n-2214 2162\\r\\n-2214 3741\\r\\n-1839 -8742\\r\\n-1839 2162\\r\\n-1839 3741\\r\\n207 -8742\\r\\n207 2162\\r\\n207 3741\\r\\n3032 -8742\\r\\n3032 2162\\r\\n3032 3741\\r\\n8740 -8742\\r\\n8740 2162\\r\\n8740 3741\\r\\n'], 'output': ['9156\\r\\n']}, {'input': ['20\\r\\n-7068 -9088\\r\\n-7068 -7174\\r\\n-7068 -6012\\r\\n-7068 -3037\\r\\n-7068 3299\\r\\n532 -9088\\r\\n532 -7174\\r\\n532 -6012\\r\\n532 -3037\\r\\n532 3299\\r\\n6883 -9088\\r\\n6883 -7174\\r\\n6883 -6012\\r\\n6883 -3037\\r\\n6883 3299\\r\\n8251 -9088\\r\\n8251 -7174\\r\\n8251 -6012\\r\\n8251 -3037\\r\\n8251 3299\\r\\n'], 'output': ['8240\\r\\n']}, {'input': ['25\\r\\n1964 -4517\\r\\n5939 -4080\\r\\n9503 -7541\\r\\n-5037 -6950\\r\\n-9914 5015\\r\\n-435 7555\\r\\n-9321 -2202\\r\\n-5036 4224\\r\\n4946 -6785\\r\\n-6824 -9830\\r\\n-9124 9117\\r\\n-8396 -2748\\r\\n9284 556\\r\\n-1672 -6681\\r\\n-8782 9912\\r\\n-8164 4679\\r\\n1804 -6201\\r\\n-1155 2405\\r\\n-858 4105\\r\\n419 -7325\\r\\n-8034 -3084\\r\\n-7823 -5829\\r\\n-5784 5391\\r\\n9515 5259\\r\\n-8078 752\\r\\n'], 'output': ['44850\\r\\n']}, {'input': ['25\\r\\n5061 -2382\\r\\n-4080 9503\\r\\n-4081 9503\\r\\n5061 -2381\\r\\n-6549 9641\\r\\n-8510 6047\\r\\n-8110 8720\\r\\n6829 -8424\\r\\n-1413 -5926\\r\\n2446 -3190\\r\\n5405 8413\\r\\n8272 6829\\r\\n3034 -3978\\r\\n-3403 3036\\r\\n1383 4041\\r\\n829 327\\r\\n-4079 9504\\r\\n9293 -5091\\r\\n486 -5050\\r\\n6384 3727\\r\\n4787 6634\\r\\n4492 1126\\r\\n-1288 -4938\\r\\n4345 8056\\r\\n-3402 3035\\r\\n'], 'output': ['43365\\r\\n']}, {'input': ['16\\r\\n297 3286\\r\\n-9374 4754\\r\\n7891 -4091\\r\\n6087 -1252\\r\\n3371 -858\\r\\n789 -9370\\r\\n7241 2950\\r\\n-7390 355\\r\\n-5536 -3119\\r\\n2413 -5560\\r\\n4673 7622\\r\\n5344 -9455\\r\\n1918 -8370\\r\\n-6034 -4144\\r\\n9018 -996\\r\\n-7542 -9138\\r\\n'], 'output': ['7140\\r\\n']}, {'input': ['16\\r\\n-7073 -2432\\r\\n4754 7891\\r\\n4753 7890\\r\\n4755 7892\\r\\n1033 -7465\\r\\n4487 -9951\\r\\n-4613 3633\\r\\n-6753 9089\\r\\n5853 -1919\\r\\n-236 5170\\r\\n4754 7889\\r\\n-9989 -3488\\r\\n-1390 5520\\r\\n3139 8543\\r\\n4754 7890\\r\\n7576 5150\\r\\n'], 'output': ['6670\\r\\n']}, {'input': ['12\\r\\n1804 -7018\\r\\n-3551 1915\\r\\n-8148 5497\\r\\n-3430 -2988\\r\\n377 -1656\\r\\n-3799 6338\\r\\n-4248 -8428\\r\\n7371 -5005\\r\\n1216 406\\r\\n-294 5589\\r\\n-6477 -8889\\r\\n-8919 3676\\r\\n'], 'output': ['2145\\r\\n']}, {'input': ['12\\r\\n-9440 -8967\\r\\n1915 -8148\\r\\n-7216 8361\\r\\n6338 -4248\\r\\n-1425 -2251\\r\\n1216 406\\r\\n-2676 8355\\r\\n-8889 -8919\\r\\n-1163 -4185\\r\\n5018 -7302\\r\\n-2724 3986\\r\\n-7890 1900\\r\\n'], 'output': ['2016\\r\\n']}, {'input': ['10\\r\\n3986 -4462\\r\\n-5492 -8077\\r\\n-5005 4012\\r\\n8092 5848\\r\\n5159 9077\\r\\n-9814 5652\\r\\n-2848 -6707\\r\\n-1528 8298\\r\\n9444 -4143\\r\\n-7928 1163\\r\\n'], 'output': ['990\\r\\n']}, {'input': ['10\\r\\n-5475 1753\\r\\n-8077 -5005\\r\\n7903 -131\\r\\n5159 9077\\r\\n5159 9076\\r\\n-6761 4557\\r\\n-9188 -9329\\r\\n-4591 617\\r\\n-9686 -6410\\r\\n648 -1608\\r\\n'], 'output': ['990\\r\\n']}, {'input': ['2\\r\\n6757 4799\\r\\n-1343 -7745\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n8303 2432\\r\\n-7745 -4751\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n-9129 -8491\\r\\n-9129 -1754\\r\\n-9129 -1316\\r\\n1679 -8491\\r\\n1679 -1754\\r\\n1679 -1316\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['3\\r\\n-4928 7147\\r\\n3808 3567\\r\\n2434 8649\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n-1547 4830\\r\\n3567 2434\\r\\n1522 -4418\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['9\\r\\n-8172 -8016\\r\\n-8172 -63\\r\\n-8172 9586\\r\\n-1609 -8016\\r\\n-1609 -63\\r\\n-1609 9586\\r\\n2972 -8016\\r\\n2972 -63\\r\\n2972 9586\\r\\n'], 'output': ['270\\r\\n']}, {'input': ['4\\r\\n5648 -804\\r\\n1518 -2267\\r\\n7358 -6618\\r\\n-4504 2047\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['4\\r\\n-3955 7228\\r\\n-2267 7358\\r\\n-5256 -1266\\r\\n9674 -3048\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['12\\r\\n796 -415\\r\\n796 169\\r\\n796 2695\\r\\n1979 -415\\r\\n1979 169\\r\\n1979 2695\\r\\n5371 -415\\r\\n5371 169\\r\\n5371 2695\\r\\n8366 -415\\r\\n8366 169\\r\\n8366 2695\\r\\n'], 'output': ['894\\r\\n']}, {'input': ['5\\r\\n-8893 8986\\r\\n-3629 9045\\r\\n-7719 -6470\\r\\n-258 4491\\r\\n-6902 -6866\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['5\\r\\n8456 -2932\\r\\n9045 -7719\\r\\n-10000 6748\\r\\n9044 -7720\\r\\n-1125 -914\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['15\\r\\n-7871 -4833\\r\\n-7871 -1936\\r\\n-7871 425\\r\\n-4790 -4833\\r\\n-4790 -1936\\r\\n-4790 425\\r\\n912 -4833\\r\\n912 -1936\\r\\n912 425\\r\\n4236 -4833\\r\\n4236 -1936\\r\\n4236 425\\r\\n8382 -4833\\r\\n8382 -1936\\r\\n8382 425\\r\\n'], 'output': ['2265\\r\\n']}, {'input': ['42\\r\\n-5391 -2932\\r\\n-5391 -2868\\r\\n-5391 1744\\r\\n-5391 2236\\r\\n-5391 4148\\r\\n-5391 5217\\r\\n-5391 6188\\r\\n-3584 -2932\\r\\n-3584 -2868\\r\\n-3584 1744\\r\\n-3584 2236\\r\\n-3584 4148\\r\\n-3584 5217\\r\\n-3584 6188\\r\\n-1657 -2932\\r\\n-1657 -2868\\r\\n-1657 1744\\r\\n-1657 2236\\r\\n-1657 4148\\r\\n-1657 5217\\r\\n-1657 6188\\r\\n3218 -2932\\r\\n3218 -2868\\r\\n3218 1744\\r\\n3218 2236\\r\\n3218 4148\\r\\n3218 5217\\r\\n3218 6188\\r\\n7582 -2932\\r\\n7582 -2868\\r\\n7582 1744\\r\\n7582 2236\\r\\n7582 4148\\r\\n7582 5217\\r\\n7582 6188\\r\\n8131 -2932\\r\\n8131 -2868\\r\\n8131 1744\\r\\n8131 2236\\r\\n8131 4148\\r\\n8131 5217\\r\\n8131 6188\\r\\n'], 'output': ['206367\\r\\n']}]","id":665} {"difficulty":1700,"lang":"Perl","lang_cluster":"Perl","src_uid":"131_E","execute_outcome":"WRONG_ANSWER","source_code":"\\nuse strict;\\nuse warnings;\\n\\nsub count_threats {\\n my ($n, $m, @queens) = @_;\\n \\n my @threats = (0) x 9;\\n \\n for (my $i = 0; $i < $m; $i++) {\\n my ($row, $col) = split(' ', $queens[$i]);\\n \\n # Count threats in horizontal and vertical directions\\n for (my $j = 1; $j <= $n; $j++) {\\n if ($j != $row) {\\n $threats[1]++ if ($queens[$i] =~ \/^$j $col$\/);\\n }\\n if ($j != $col) {\\n $threats[1]++ if ($queens[$i] =~ \/^$row $j$\/);\\n }\\n }\\n \\n # Count threats in diagonal directions\\n for (my $j = 1; $j <= $n; $j++) {\\n if ($j != $row && $j != $col) {\\n $threats[1]++ if ($queens[$i] =~ \/^$j $j$\/);\\n $threats[1]++ if ($queens[$i] =~ \/^$j @{[ $col - $row + $j ]}$\/);\\n $threats[1]++ if ($queens[$i] =~ \/^$j @{[ $col + $row - $j ]}$\/);\\n }\\n }\\n }\\n \\n foreach my $threat (@threats) {\\n print \"$threat \";\\n }\\n}\\n\\nmy $input = <>;\\nchomp($input);\\nmy ($n, $m) = split(' ', $input);\\nmy @queens;\\nfor (my $i = 0; $i < $m; $i++) {\\n my $queen = <>;\\n chomp($queen);\\n push @queens, $queen;\\n}\\n\\ncount_threats($n, $m, @queens);\\n","description":"A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to the rook and the bishop.There are m queens on a square n\u00d7n chessboard. You know each queen's positions, the i-th queen is positioned in the square (ri,ci), where ri is the board row number (numbered from the top to the bottom from 1 to n), and ci is the board's column number (numbered from the left to the right from 1 to n). No two queens share the same position.For each queen one can count w \u2014 the number of other queens that the given queen threatens (attacks). For a fixed attack direction only the first queen in this direction is under attack if there are many queens are on the ray of the attack. Obviously, for any queen w is between 0 and 8, inclusive.Print the sequence t0,t1,...,t8, where ti is the number of queens that threaten exactly i other queens, i.e. the number of queens that their w equals i.","input_specification":"The first line of the input contains a pair of integers n,m (1\u2264n,m\u226410^5), where n is the size of the board and m is the number of queens on the board. Then m following lines contain positions of the queens, one per line. Each line contains a pair of integers ri,ci (1\u2264ri,ci\u2264n) \u2014 the queen's position. No two queens stand on the same square.\n","output_specification":"Print the required sequence t0,t1,...,t8, separating the numbers with spaces.\n","notes":null,"sample_inputs":["8 4\n4 3\n4 8\n6 5\n1 6\n","10 3\n1 1\n1 2\n1 3\n"],"sample_outputs":["0 3 0 1 0 0 0 0 0 ","0 2 1 0 0 0 0 0 0 "],"human_solution":"#!\/usr\/bin\/perl\n\nuse strict;\nuse warnings;\n\nsub check_queen {\n my ($x, $y, $dx, $dy, $n, $board) = @_;\n $x += $dx;\n $y += $dy;\n while ($x >= 0 && $y >= 0 && $x < $n && $y < $n) {\n if ($board->[$x][$y]) {\n return 1;\n }\n $x += $dx;\n $y += $dy;\n }\n return 0;\n}\n\nsub count_threats {\n my ($x, $y, $n, $board) = @_;\n my $threats = 0;\n for my $dx (-1..1) {\n for my $dy (-1..1) {\n if ($dx != 0 || $dy != 0) {\n $threats += check_queen($x, $y, $dx, $dy, $n, $board);\n }\n }\n }\n return $threats;\n}\n\nmy $input = <>;\nchomp($input);\nmy ($n, $m) = split(' ', $input);\nmy @board = map { [(0) x $n] } (1..$n);\nmy @threats = (0) x 9;\nfor my $i (1..$m) {\n my $input = <>;\n chomp($input);\n my ($x, $y) = split(' ', $input);\n $x--;\n $y--;\n $board[$x][$y] = 1;\n}\nfor my $x (0..$n-1) {\n for my $y (0..$n-1) {\n if ($board[$x][$y]) {\n my $threats = count_threats($x, $y, $n, \\@board);\n $threats[$threats]++;\n }\n }\n}\nprint join(' ', @threats), \"\\n\";\n\n","testcases":"[{'input': ['8 4\\r\\n4 3\\r\\n4 8\\r\\n6 5\\r\\n1 6\\r\\n'], 'output': ['0 3 0 1 0 0 0 0 0 ']}, {'input': ['10 3\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n'], 'output': ['0 2 1 0 0 0 0 0 0 ']}, {'input': ['1 1\\r\\n1 1\\r\\n'], 'output': ['1 0 0 0 0 0 0 0 0 ']}, {'input': ['2 1\\r\\n1 1\\r\\n'], 'output': ['1 0 0 0 0 0 0 0 0 ']}, {'input': ['2 2\\r\\n1 1\\r\\n1 2\\r\\n'], 'output': ['0 2 0 0 0 0 0 0 0 ']}, {'input': ['2 4\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n'], 'output': ['0 0 0 4 0 0 0 0 0 ']}, {'input': ['8 8\\r\\n8 3\\r\\n3 7\\r\\n7 1\\r\\n4 4\\r\\n1 6\\r\\n1 7\\r\\n3 3\\r\\n2 1\\r\\n'], 'output': ['0 3 2 3 0 0 0 0 0 ']}, {'input': ['10 4\\r\\n5 6\\r\\n4 8\\r\\n8 4\\r\\n7 4\\r\\n'], 'output': ['0 2 2 0 0 0 0 0 0 ']}, {'input': ['10 10\\r\\n6 5\\r\\n3 5\\r\\n3 4\\r\\n6 10\\r\\n3 10\\r\\n4 6\\r\\n6 2\\r\\n7 5\\r\\n1 8\\r\\n2 2\\r\\n'], 'output': ['0 5 1 2 1 1 0 0 0 ']}, {'input': ['10 20\\r\\n6 10\\r\\n3 10\\r\\n10 4\\r\\n5 3\\r\\n9 4\\r\\n10 1\\r\\n10 3\\r\\n10 7\\r\\n8 5\\r\\n7 2\\r\\n4 7\\r\\n5 1\\r\\n2 9\\r\\n5 5\\r\\n6 6\\r\\n9 8\\r\\n2 10\\r\\n9 10\\r\\n1 4\\r\\n7 4\\r\\n'], 'output': ['0 0 4 9 4 1 2 0 0 ']}, {'input': ['100 10\\r\\n97 5\\r\\n53 35\\r\\n92 86\\r\\n54 95\\r\\n98 13\\r\\n36 23\\r\\n55 56\\r\\n96 94\\r\\n25 96\\r\\n49 31\\r\\n'], 'output': ['6 4 0 0 0 0 0 0 0 ']}, {'input': ['10 5\\r\\n2 3\\r\\n1 3\\r\\n3 3\\r\\n2 1\\r\\n2 5\\r\\n'], 'output': ['0 4 0 0 1 0 0 0 0 ']}]","id":666} {"difficulty":2600,"lang":"Perl","lang_cluster":"Perl","src_uid":"13_D","execute_outcome":"WRONG_ANSWER","source_code":"\\nuse strict;\\nuse warnings;\\n\\nsub count_triangles {\\n my ($n, $m, $red_points, $blue_points) = @_;\\n\\n my $count = 0;\\n\\n for (my $i = 0; $i < $n - 2; $i++) {\\n for (my $j = $i + 1; $j < $n - 1; $j++) {\\n for (my $k = $j + 1; $k < $n; $k++) {\\n my ($x1, $y1) = @{$red_points->[$i]};\\n my ($x2, $y2) = @{$red_points->[$j]};\\n my ($x3, $y3) = @{$red_points->[$k]};\\n\\n my $is_triangle = 1;\\n\\n for (my $l = 0; $l < $m; $l++) {\\n my ($bx, $by) = @{$blue_points->[$l]};\\n\\n my $cross_product = ($x2 - $x1) * ($by - $y1) - ($y2 - $y1) * ($bx - $x1);\\n\\n if ($cross_product > 0 && ($x3 - $x1) * ($by - $y1) - ($y3 - $y1) * ($bx - $x1) > 0 && ($x1 - $x2) * ($by - $y2) - ($y1 - $y2) * ($bx - $x2) > 0) {\\n $is_triangle = 0;\\n last;\\n }\\n }\\n\\n $count += $is_triangle;\\n }\\n }\\n }\\n\\n return $count;\\n}\\n\\nmy $input = ;\\nchomp $input;\\nmy ($n, $m) = split ' ', $input;\\n\\nmy @red_points;\\nfor (my $i = 0; $i < $n; $i++) {\\n my $point = ;\\n chomp $point;\\n my ($x, $y) = split ' ', $point;\\n push @red_points, [$x, $y];\\n}\\n\\nmy @blue_points;\\nfor (my $i = 0; $i < $m; $i++) {\\n my $point = ;\\n chomp $point;\\n my ($x, $y) = split ' ', $point;\\n push @blue_points, [$x, $y];\\n}\\n\\nmy $result = count_triangles($n, $m, \\@red_points, \\@blue_points);\\nprint $result;\\n","description":"Little Petya likes to draw. He drew N red and M blue points on the plane in such a way that no three points lie on the same line. Now he wonders what is the number of distinct triangles with vertices in red points which do not contain any blue point inside.","input_specification":"The first line contains two non-negative integer numbers N and M (0\u2264N\u2264500, 0\u2264M\u2264500) \u2014 the number of red and blue points respectively. The following N lines contain two integer numbers each \u2014 coordinates of red points. The following M lines contain two integer numbers each \u2014 coordinates of blue points. All coordinates do not exceed 10^9 by absolute value.\n","output_specification":"Output one integer \u2014 the number of distinct triangles with vertices in red points which do not contain any blue point inside.\n","notes":null,"sample_inputs":["4 1\n0 0\n10 0\n10 10\n5 4\n2 1\n","5 5\n5 10\n6 1\n8 6\n-6 -7\n7 -1\n5 -1\n10 -4\n-10 -8\n-10 5\n-2 -8\n"],"sample_outputs":["2\n","7\n"],"human_solution":"\n# Read input\nmy $input = ;\nchomp $input;\nmy ($N, $M) = split ' ', $input;\n\n# Read red points\nmy @red_points;\nfor (1..$N) {\n my $point = ;\n chomp $point;\n my ($x, $y) = split ' ', $point;\n push @red_points, [$x, $y];\n}\n\n# Read blue points\nmy @blue_points;\nfor (1..$M) {\n my $point = ;\n chomp $point;\n my ($x, $y) = split ' ', $point;\n push @blue_points, [$x, $y];\n}\n\n# Function to check if a point is inside a triangle\nsub is_inside_triangle {\n my ($p, $p1, $p2, $p3) = @_;\n my $d1 = ($p1->[0] - $p->[0]) * ($p2->[1] - $p1->[1]) - ($p2->[0] - $p1->[0]) * ($p1->[1] - $p->[1]);\n my $d2 = ($p2->[0] - $p->[0]) * ($p3->[1] - $p2->[1]) - ($p3->[0] - $p2->[0]) * ($p2->[1] - $p->[1]);\n my $d3 = ($p3->[0] - $p->[0]) * ($p1->[1] - $p3->[1]) - ($p1->[0] - $p3->[0]) * ($p3->[1] - $p->[1]);\n return ($d1 >= 0 && $d2 >= 0 && $d3 >= 0) || ($d1 <= 0 && $d2 <= 0 && $d3 <= 0);\n}\n\n# Count the number of distinct triangles\nmy $count = 0;\nfor my $i (0..$N-1) {\n for my $j ($i+1..$N-1) {\n for my $k ($j+1..$N-1) {\n my $triangle = [$red_points[$i], $red_points[$j], $red_points[$k]];\n my $is_valid = 1;\n for my $blue_point (@blue_points) {\n if (is_inside_triangle($blue_point, @$triangle)) {\n $is_valid = 0;\n last;\n }\n }\n $count++ if $is_valid;\n }\n }\n}\n\n# Print the result\nprint $count;\n","testcases":"[{'input': ['4 1\\r\\n0 0\\r\\n10 0\\r\\n10 10\\r\\n5 4\\r\\n2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n5 10\\r\\n6 1\\r\\n8 6\\r\\n-6 -7\\r\\n7 -1\\r\\n5 -1\\r\\n10 -4\\r\\n-10 -8\\r\\n-10 5\\r\\n-2 -8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 5\\r\\n-3 0\\r\\n2 2\\r\\n-6 8\\r\\n3 7\\r\\n2 4\\r\\n8 3\\r\\n-1 2\\r\\n-5 10\\r\\n-1 -7\\r\\n5 -9\\r\\n8 7\\r\\n9 6\\r\\n6 5\\r\\n-6 -5\\r\\n-4 -2\\r\\n'], 'output': ['120\\r\\n']}, {'input': ['40 5\\r\\n-13 15\\r\\n-13 -12\\r\\n4 -7\\r\\n-7 -6\\r\\n-2 -5\\r\\n-3 6\\r\\n6 -14\\r\\n4 7\\r\\n-7 -5\\r\\n-14 13\\r\\n12 5\\r\\n11 15\\r\\n-9 5\\r\\n13 0\\r\\n12 -14\\r\\n2 -3\\r\\n-2 2\\r\\n3 -6\\r\\n0 12\\r\\n-8 6\\r\\n-11 14\\r\\n1 4\\r\\n2 -13\\r\\n15 11\\r\\n1 -12\\r\\n-5 -10\\r\\n14 -8\\r\\n-5 -7\\r\\n13 -3\\r\\n-15 -8\\r\\n-12 12\\r\\n14 -13\\r\\n3 1\\r\\n-10 -11\\r\\n-6 -15\\r\\n-4 13\\r\\n-14 7\\r\\n-1 11\\r\\n15 -1\\r\\n6 14\\r\\n-6 -9\\r\\n5 10\\r\\n-9 -4\\r\\n7 -11\\r\\n9 -15\\r\\n'], 'output': ['7029\\r\\n']}, {'input': ['4 1\\r\\n-1 -1000000000\\r\\n0 1000000000\\r\\n2 1\\r\\n-2 1\\r\\n0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 1000000000\\r\\n-999999999 -1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 -999999999\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 -999999999\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 1000000000\\r\\n-999999999 -1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999999 1000000000\\r\\n-1000000000 -1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999998 -1000000000\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999998 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}]","id":667} {"difficulty":2000,"lang":"Perl","lang_cluster":"Perl","src_uid":"156_C","execute_outcome":"RUNTIME_ERROR","source_code":"test","description":"Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he couldn't understand anything. At last, after some thought, he thought of something. Let's say there is a word s, consisting of |s| lowercase Latin letters. Then for one operation you can choose a certain position p (1\u2264p<|s|) and perform one of the following actions: either replace letter sp with the one that alphabetically follows it and replace letter sp+1 with the one that alphabetically precedes it; or replace letter sp with the one that alphabetically precedes it and replace letter sp+1 with the one that alphabetically follows it. Let us note that letter \"z\" doesn't have a defined following letter and letter \"a\" doesn't have a defined preceding letter. That's why the corresponding changes are not acceptable. If the operation requires performing at least one unacceptable change, then such operation cannot be performed.Two words coincide in their meaning iff one of them can be transformed into the other one as a result of zero or more operations.Sherlock Holmes needs to learn to quickly determine the following for each word: how many words can exist that coincide in their meaning with the given word, but differs from the given word in at least one character? Count this number for him modulo 1000000007 (10^9+7).","input_specification":"The input data contains several tests. The first line contains the only integer t (1\u2264t\u226410^4) \u2014 the number of tests.\nNext t lines contain the words, one per line. Each word consists of lowercase Latin letters and has length from 1 to 100, inclusive. Lengths of words can differ.\n","output_specification":"For each word you should print the number of different other words that coincide with it in their meaning \u2014 not from the words listed in the input data, but from all possible words. As the sought number can be very large, print its value modulo 1000000007 (10^9+7).\n","notes":"Some explanations about the operation:\n Note that for each letter, we can clearly define the letter that follows it. Letter \"b\" alphabetically follows letter \"a\", letter \"c\" follows letter \"b\", ..., \"z\" follows letter \"y\". Preceding letters are defined in the similar manner: letter \"y\" precedes letter \"z\", ..., \"a\" precedes letter \"b\". Note that the operation never changes a word's length. In the first sample you can obtain the only other word \"ba\". In the second sample you cannot obtain any other word, so the correct answer is 0.\nConsider the third sample. One operation can transform word \"klmbfxzb\" into word \"klmcexzb\": we should choose p=4, and replace the fourth letter with the following one (\"b\" \u2192 \"c\"), and the fifth one \u2014 with the preceding one (\"f\" \u2192 \"e\"). Also, we can obtain many other words from this one. An operation can transform word \"ya\" only into one other word \"xb\". \nWord \"ya\" coincides in its meaning with words \"xb\", \"wc\", \"vd\", ..., \"ay\" (overall there are 24 other words). The word \"klmbfxzb has many more variants \u2014 there are 3320092814 other words that coincide with in the meaning. So the answer for the first word equals 24 and for the second one equals 320092793 \u2014 the number 3320092814 modulo 10^9+7\n","sample_inputs":["1\nab\n","1\naaaaaaaaaaa\n","2\nya\nklmbfxzb\n"],"sample_outputs":["1\n","0\n","24\n320092793\n"],"human_solution":"\nuse strict;\nuse warnings;\n\nmy $MOD = 1000000007;\n\nsub count_coinciding_words {\n my ($word) = @_;\n my $length = length($word);\n my $count = 0;\n\n # Calculate the number of words that coincide with the given word\n # by considering each possible position for the operation\n for (my $p = 0; $p < $length - 1; $p++) {\n my $letter_p = substr($word, $p, 1);\n my $letter_p_next = substr($word, $p + 1, 1);\n\n # Calculate the number of words that can be formed by replacing\n # letter p with the letter that follows it and letter p+1 with the\n # letter that precedes it\n my $count_follows = ord('z') - ord($letter_p) + ord($letter_p_next) - ord('a') + 1;\n\n # Calculate the number of words that can be formed by replacing\n # letter p with the letter that precedes it and letter p+1 with the\n # letter that follows it\n my $count_precedes = ord($letter_p) - ord('a') + ord('z') - ord($letter_p_next) + 1;\n\n # Add the counts modulo $MOD\n $count = ($count + $count_follows + $count_precedes) % $MOD;\n }\n\n return $count;\n}\n\n# Read the number of tests\nmy $t = ;\nchomp($t);\n\n# Process each test case\nfor (my $i = 0; $i < $t; $i++) {\n # Read the word\n my $word = ;\n chomp($word);\n\n # Calculate the number of coinciding words\n my $coinciding_words = count_coinciding_words($word);\n\n # Print the result modulo $MOD\n print($coinciding_words % $MOD . \"\\n\");\n}\n","testcases":"[{'input': ['1\\r\\nab\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\naaaaaaaaaaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\nya\\r\\nklmbfxzb\\r\\n'], 'output': ['24\\r\\n320092793\\r\\n']}, {'input': ['1\\r\\na\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\nz\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1\\r\\nmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmnmn\\r\\n'], 'output': ['39086755\\r\\n']}, {'input': ['15\\r\\nejkf\\r\\nkc\\r\\nu\\r\\nznmjnznzn\\r\\nbjkcg\\r\\nwou\\r\\nywy\\r\\nqoojqlr\\r\\nnbkip\\r\\nsgmgjg\\r\\ndjjdd\\r\\nh\\r\\nkgbkri\\r\\nt\\r\\npvzbvkij\\r\\n'], 'output': ['4454\\r\\n12\\r\\n0\\r\\n667098198\\r\\n35884\\r\\n209\\r\\n20\\r\\n142184034\\r\\n186649\\r\\n4212829\\r\\n31439\\r\\n0\\r\\n3167654\\r\\n0\\r\\n474922754\\r\\n']}, {'input': ['15\\r\\nieqqe\\r\\nwwbnobrb\\r\\ngyftfg\\r\\nclrn\\r\\nzwtviipwww\\r\\nmsmsiih\\r\\nofqsusmsmm\\r\\nyjomiiq\\r\\naedoeun\\r\\nz\\r\\nmwwmimiwiu\\r\\ngtdsifgg\\r\\nvmmmren\\r\\nzlgzousxzp\\r\\ngcpodkxebk\\r\\n'], 'output': ['195974\\r\\n543885418\\r\\n5715485\\r\\n10619\\r\\n87838649\\r\\n154292634\\r\\n869212338\\r\\n155736014\\r\\n55669004\\r\\n0\\r\\n792902040\\r\\n590044032\\r\\n155736014\\r\\n991368939\\r\\n271743066\\r\\n']}, {'input': ['17\\r\\nwfvfmnmr\\r\\nkyururk\\r\\nnei\\r\\nmeb\\r\\nwldtalawww\\r\\njeobzb\\r\\nuuww\\r\\nwfkgzxmr\\r\\nrvvpxrihha\\r\\nqz\\r\\ngpodf\\r\\niatnevlia\\r\\njjnaunradf\\r\\nwoi\\r\\ny\\r\\nmewdykdldp\\r\\nnckg\\r\\n'], 'output': ['662991818\\r\\n51681734\\r\\n350\\r\\n170\\r\\n598684361\\r\\n3582684\\r\\n968\\r\\n541474246\\r\\n55368153\\r\\n9\\r\\n148439\\r\\n157054204\\r\\n91519085\\r\\n464\\r\\n0\\r\\n838428119\\r\\n5759\\r\\n']}, {'input': ['17\\r\\nku\\r\\njf\\r\\nygbkcbf\\r\\ngmp\\r\\nnuaxjssqv\\r\\nawxxcxw\\r\\nyccccvc\\r\\na\\r\\nu\\r\\nnod\\r\\nmfgtj\\r\\nekkjbkzr\\r\\njtisatba\\r\\nxtkxlk\\r\\nt\\r\\nxkxzuizs\\r\\nnvvvqarn\\r\\n'], 'output': ['20\\r\\n14\\r\\n25664534\\r\\n486\\r\\n516112667\\r\\n64053170\\r\\n44165015\\r\\n0\\r\\n0\\r\\n450\\r\\n222299\\r\\n145570718\\r\\n897496632\\r\\n3582684\\r\\n0\\r\\n190441484\\r\\n326269025\\r\\n']}, {'input': ['19\\r\\nqhovyphr\\r\\nttymgy\\r\\nqbed\\r\\nidxitl\\r\\nusbrx\\r\\nqevvydqdb\\r\\nltyjljj\\r\\ncgv\\r\\nsruvudcu\\r\\naqjbqjybyq\\r\\nrhtwwtthhh\\r\\nh\\r\\nksktyyst\\r\\npmwmnzswlw\\r\\nm\\r\\nuwaup\\r\\nxhvk\\r\\nj\\r\\nvii\\r\\n'], 'output': ['434174305\\r\\n2030279\\r\\n2924\\r\\n6460404\\r\\n177169\\r\\n583243193\\r\\n154292634\\r\\n434\\r\\n434174305\\r\\n191795714\\r\\n792902040\\r\\n0\\r\\n573191111\\r\\n676498805\\r\\n0\\r\\n195974\\r\\n9239\\r\\n0\\r\\n506\\r\\n']}, {'input': ['10\\r\\njrojjyqqjtrfjf\\r\\nvuwzvmwjyfvifdfddymwfuzmvvummwdfzjzdvzuvfvjiuvyzymviyyumvziyimfzfiji\\r\\nwxzwojjzqzyqlojjbrjlbqrrwqw\\r\\nqfwppnuvbgegbqgbmeqpbguwmmqhunnquepepeewubbmnenvmwhnvhunnmsqmmgfepevupewvenmwpmgspnebv\\r\\nrxqzorkizznsiirciokscrrjqqqzkfijrrkkfrqjjifczcjcnqoisorszkjxcxvqzcfczqfcrvfrsckvvfjxnxzqjivqv\\r\\nnvimavvhfskwkhgvaowsficdmv\\r\\nqvrdgohdmgawrqo\\r\\npulanukntfhrthkxkprprhrhcouxxnkhoroptcxkfktotkokonoxptcocnfartlucnlncalnknhlpachofclannctpklackcc\\r\\ntqezktgzhipiaootfpqpzjgtqitagthef\\r\\nqaeigcacoqoc\\r\\n'], 'output': ['520219051\\r\\n945235283\\r\\n691128313\\r\\n324077859\\r\\n417775814\\r\\n827035318\\r\\n275780270\\r\\n145635612\\r\\n155578699\\r\\n486064325\\r\\n']}, {'input': ['10\\r\\nnnclytzybytthncihlnnbclzcbhinhyzbhnbiyccltnnchylynhznycniiztzcthiyyhccybc\\r\\ngbcccdnjbgntyzayntwdf\\r\\ndzkxapreirktspflaudtlexeffifxxzxrjaxqfkcncxf\\r\\nnilfxfsyliingzbgsxbzxxmqqxnngsfqqqbqinglmbxgysbi\\r\\nsjquzchhssjrrzbuc\\r\\nhdhvdnjvhreiiekeinvdddneejkrdkjvikj\\r\\nanyamaosolahmhnmsmmmmhhofsaalfmomoshy\\r\\nnqvzznlicebqsviwivvhhiiciblbelvlelhisclecb\\r\\nlbtihlhulugddgtfwjiftfltijwitcgmgvjfcfcdwbliijqhidghdwibpgjqdumdijmhlbdfvcpcqqptcc\\r\\nkfjcmfzxhhkhfikihymhmhxuzeykfkmezcmieyxxshjckfxsx\\r\\n'], 'output': ['860385290\\r\\n566220124\\r\\n563237657\\r\\n25482967\\r\\n365565922\\r\\n211740598\\r\\n627945017\\r\\n550126162\\r\\n997587067\\r\\n505019519\\r\\n']}]","id":668} {"difficulty":1600,"lang":"Perl","lang_cluster":"Perl","src_uid":"167_A","execute_outcome":"WRONG_ANSWER","source_code":"print \"Hello, World!\\n\";","description":"In some country live wizards. They love to ride trolleybuses.A city in this country has a trolleybus depot with n trolleybuses. Every day the trolleybuses leave the depot, one by one and go to the final station. The final station is at a distance of d meters from the depot. We know for the i-th trolleybus that it leaves at the moment of time ti seconds, can go at a speed of no greater than vi meters per second, and accelerate with an acceleration no greater than a meters per second squared. A trolleybus can decelerate as quickly as you want (magic!). It can change its acceleration as fast as you want, as well. Note that the maximum acceleration is the same for all trolleys.Despite the magic the trolleys are still powered by an electric circuit and cannot overtake each other (the wires are to blame, of course). If a trolleybus catches up with another one, they go together one right after the other until they arrive at the final station. Also, the drivers are driving so as to arrive at the final station as quickly as possible.You, as head of the trolleybuses' fans' club, are to determine for each trolley the minimum time by which it can reach the final station. At the time of arrival at the destination station the trolleybus does not necessarily have zero speed. When a trolley is leaving the depot, its speed is considered equal to zero. From the point of view of physics, the trolleybuses can be considered as material points, and also we should ignore the impact on the speed of a trolley bus by everything, except for the acceleration and deceleration provided by the engine.","input_specification":"The first input line contains three space-separated integers n, a, d (1\u2264n\u226410^5, 1\u2264a,d\u226410^6) \u2014 the number of trolleybuses, their maximum acceleration and the distance from the depot to the final station, correspondingly.\nNext n lines contain pairs of integers ti vi (0\u2264t1;\nchomp $input_line;\nmy ($n, $a, $d) = split ' ', $input_line;\nmy @trolley_info;\nfor my $i (0 .. $n-1) {\n my $trolley_line = ;\n chomp $trolley_line;\n push @trolley_info, [split ' ', $trolley_line];\n}\nmy @arrival_times = trolley_time($n, $a, $d, @trolley_info);\nfor my $time (@arrival_times) {\n printf(\"%.10f\\n\", $time);\n}","testcases":"[{'input': ['3 10 10000\\r\\n0 10\\r\\n5 11\\r\\n1000 1\\r\\n'], 'output': ['1000.5000000000\\r\\n1000.5000000000\\r\\n11000.0500000000\\r\\n']}, {'input': ['1 2 26\\r\\n28 29\\r\\n'], 'output': ['33.0990195136\\r\\n']}, {'input': ['7 8 3\\r\\n1 3\\r\\n5 26\\r\\n7 3\\r\\n10 15\\r\\n18 7\\r\\n21 17\\r\\n23 21\\r\\n'], 'output': ['2.1875000000\\r\\n5.8660254038\\r\\n8.1875000000\\r\\n10.8660254038\\r\\n18.8660254038\\r\\n21.8660254038\\r\\n23.8660254038\\r\\n']}, {'input': ['3 6 6\\r\\n2 10\\r\\n14 19\\r\\n18 14\\r\\n'], 'output': ['3.4142135624\\r\\n15.4142135624\\r\\n19.4142135624\\r\\n']}, {'input': ['10 7 8\\r\\n2 4\\r\\n3 13\\r\\n4 7\\r\\n5 1\\r\\n9 16\\r\\n10 9\\r\\n12 18\\r\\n16 4\\r\\n17 16\\r\\n20 6\\r\\n'], 'output': ['4.2857142857\\r\\n4.5118578920\\r\\n5.6428571429\\r\\n13.0714285714\\r\\n13.0714285714\\r\\n13.0714285714\\r\\n13.5118578920\\r\\n18.2857142857\\r\\n18.5118578920\\r\\n21.7619047619\\r\\n']}, {'input': ['8 4 13\\r\\n0 18\\r\\n6 24\\r\\n10 25\\r\\n11 5\\r\\n12 18\\r\\n20 22\\r\\n21 8\\r\\n22 12\\r\\n'], 'output': ['2.5495097568\\r\\n8.5495097568\\r\\n12.5495097568\\r\\n14.2250000000\\r\\n14.5495097568\\r\\n22.5495097568\\r\\n23.6250000000\\r\\n24.5495097568\\r\\n']}, {'input': ['1 2 7\\r\\n20 13\\r\\n'], 'output': ['22.6457513111\\r\\n']}, {'input': ['3 3 3\\r\\n13 1\\r\\n18 12\\r\\n19 2\\r\\n'], 'output': ['16.1666666667\\r\\n19.4142135624\\r\\n20.8333333333\\r\\n']}, {'input': ['8 7 21\\r\\n2 11\\r\\n3 4\\r\\n4 3\\r\\n9 23\\r\\n15 9\\r\\n16 5\\r\\n22 17\\r\\n24 10\\r\\n'], 'output': ['4.6948051948\\r\\n8.5357142857\\r\\n11.2142857143\\r\\n11.4494897428\\r\\n17.9761904762\\r\\n20.5571428571\\r\\n24.4495798319\\r\\n26.8142857143\\r\\n']}, {'input': ['3 6 19\\r\\n12 3\\r\\n20 24\\r\\n30 2\\r\\n'], 'output': ['18.5833333333\\r\\n22.5166114784\\r\\n39.6666666667\\r\\n']}, {'input': ['4 5 14\\r\\n11 1\\r\\n16 20\\r\\n17 15\\r\\n21 7\\r\\n'], 'output': ['25.1000000000\\r\\n25.1000000000\\r\\n25.1000000000\\r\\n25.1000000000\\r\\n']}, {'input': ['1 1 722397\\r\\n556297 454495\\r\\n'], 'output': ['557498.9958402590\\r\\n']}, {'input': ['1 100000 363166\\r\\n560443 753304\\r\\n'], 'output': ['560445.6950547304\\r\\n']}, {'input': ['1 124232 477338\\r\\n899117 898233\\r\\n'], 'output': ['899119.7721151346\\r\\n']}, {'input': ['1 1000000 1000000\\r\\n0 1000000\\r\\n'], 'output': ['1.5000000000\\r\\n']}, {'input': ['1 1 1\\r\\n0 1000000\\r\\n'], 'output': ['1.4142135624\\r\\n']}]","id":669} {"difficulty":2600,"lang":"Perl","lang_cluster":"Perl","src_uid":"177_G2","execute_outcome":"WRONG_ANSWER","source_code":"use strict;\\nuse warnings;\\n\\nsub fibonacci_strings {\\n my ($k, $m, @queries) = @_;\\n my @fibonacci = ('a', 'b');\\n for (my $i = 2; $i < $k; $i++) {\\n $fibonacci[$i] = $fibonacci[$i-1] . $fibonacci[$i-2];\\n }\\n my @results;\\n foreach my $query (@queries) {\\n my $count = 0;\\n foreach my $fib_str (@fibonacci) {\\n while ($fib_str =~ \/$query\/g) {\\n $count++;\\n }\\n }\\n push @results, $count;\\n }\\n return \\@results;\\n}\\n\\nmy $input = ;\\nchomp $input;\\nmy ($k, $m) = split ' ', $input;\\nmy @queries;\\nfor (my $i = 0; $i < $m; $i++) {\\n my $query = ;\\n chomp $query;\\n push @queries, $query;\\n}\\n\\nmy $output = fibonacci_strings($k, $m, @queries);\\nforeach my $result (@$output) {\\n print $result % 1000000007 . \\\"\\\\n\\\";\\n}","description":"Fibonacci strings are defined as follows: f1 = \u00aba\u00bb f2 = \u00abb\u00bb fn = fn-1\u00a0fn-2, n>2 Thus, the first five Fibonacci strings are: \"a\", \"b\", \"ba\", \"bab\", \"babba\".You are given a Fibonacci string and m strings si. For each string si, find the number of times it occurs in the given Fibonacci string as a substring.","input_specification":"The first line contains two space-separated integers k and m \u2014 the number of a Fibonacci string and the number of queries, correspondingly.\nNext m lines contain strings si that correspond to the queries. It is guaranteed that strings si aren't empty and consist only of characters \"a\" and \"b\".\nThe input limitations for getting 30 points are: \n 1\u2264k\u22643000 1\u2264m\u22643000 The total length of strings si doesn't exceed 3000 The input limitations for getting 100 points are: \n 1\u2264k\u226410^18 1\u2264m\u226410^4 The total length of strings si doesn't exceed 10^5 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.\n","output_specification":"For each string si print the number of times it occurs in the given Fibonacci string as a substring. Since the numbers can be large enough, print them modulo 1000000007 (10^9+7). Print the answers for the strings in the order in which they are given in the input.\n","notes":null,"sample_inputs":["6 5\na\nb\nab\nba\naba\n"],"sample_outputs":["3\n5\n3\n3\n1\n"],"human_solution":"\nuse strict;\nuse warnings;\n\nsub fibonacci_strings {\n my ($k, $m, @queries) = @_;\n my @fibonacci = ('a', 'b');\n\n for (my $i = 2; $i < $k; $i++) {\n $fibonacci[$i] = $fibonacci[$i-1] . $fibonacci[$i-2];\n }\n\n my @results;\n foreach my $query (@queries) {\n my $count = 0;\n my $pos = 0;\n while (($pos = index($fibonacci[$k-1], $query, $pos)) != -1) {\n $count++;\n $pos++;\n }\n push @results, $count;\n }\n\n return @results;\n}\n\n# Read input\nmy $input = ;\nchomp $input;\nmy ($k, $m) = split ' ', $input;\nmy @queries;\nfor (my $i = 0; $i < $m; $i++) {\n my $query = ;\n chomp $query;\n push @queries, $query;\n}\n\n# Call the function and print the results\nmy @output = fibonacci_strings($k, $m, @queries);\nforeach my $result (@output) {\n print \"$result\\n\";\n}\n","testcases":"[{'input': ['6 5\\r\\na\\r\\nb\\r\\nab\\r\\nba\\r\\naba\\r\\n'], 'output': ['3\\r\\n5\\r\\n3\\r\\n3\\r\\n1\\r\\n']}, {'input': ['10 10\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\n'], 'output': ['12\\r\\n21\\r\\n21\\r\\n0\\r\\n12\\r\\n21\\r\\n21\\r\\n0\\r\\n12\\r\\n21\\r\\n']}, {'input': ['10 10\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\n'], 'output': ['0\\r\\n12\\r\\n21\\r\\n0\\r\\n12\\r\\n8\\r\\n0\\r\\n0\\r\\n0\\r\\n12\\r\\n']}, {'input': ['1 10\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\n'], 'output': ['0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n']}, {'input': ['2 10\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\nb\\r\\na\\r\\n'], 'output': ['1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n0\\r\\n']}, {'input': ['3 10\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\n'], 'output': ['0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n']}, {'input': ['15 100\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\nbba\\r\\naba\\r\\nbaa\\r\\naaa\\r\\nbbb\\r\\nabb\\r\\nbab\\r\\naab\\r\\n'], 'output': ['0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n144\\r\\n88\\r\\n0\\r\\n0\\r\\n0\\r\\n144\\r\\n232\\r\\n0\\r\\n']}, {'input': ['15 100\\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\\na\\r\\n'], 'output': ['377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n377\\r\\n233\\r\\n']}, {'input': ['15 100\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\nbb\\r\\nab\\r\\nba\\r\\naa\\r\\n'], 'output': ['144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n144\\r\\n232\\r\\n233\\r\\n0\\r\\n']}, {'input': ['1 14\\r\\na\\r\\nb\\r\\naa\\r\\nab\\r\\nba\\r\\nbb\\r\\naaa\\r\\naab\\r\\naba\\r\\nabb\\r\\nbaa\\r\\nbab\\r\\nbba\\r\\nbbb\\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\\n']}, {'input': ['2 14\\r\\na\\r\\nb\\r\\naa\\r\\nab\\r\\nba\\r\\nbb\\r\\naaa\\r\\naab\\r\\naba\\r\\nabb\\r\\nbaa\\r\\nbab\\r\\nbba\\r\\nbbb\\r\\n'], 'output': ['0\\r\\n1\\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': ['3 14\\r\\na\\r\\nb\\r\\naa\\r\\nab\\r\\nba\\r\\nbb\\r\\naaa\\r\\naab\\r\\naba\\r\\nabb\\r\\nbaa\\r\\nbab\\r\\nbba\\r\\nbbb\\r\\n'], 'output': ['1\\r\\n1\\r\\n0\\r\\n0\\r\\n1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n']}, {'input': ['4 14\\r\\na\\r\\nb\\r\\naa\\r\\nab\\r\\nba\\r\\nbb\\r\\naaa\\r\\naab\\r\\naba\\r\\nabb\\r\\nbaa\\r\\nbab\\r\\nbba\\r\\nbbb\\r\\n'], 'output': ['1\\r\\n2\\r\\n0\\r\\n1\\r\\n1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1\\r\\n0\\r\\n0\\r\\n']}, {'input': ['5 14\\r\\na\\r\\nb\\r\\naa\\r\\nab\\r\\nba\\r\\nbb\\r\\naaa\\r\\naab\\r\\naba\\r\\nabb\\r\\nbaa\\r\\nbab\\r\\nbba\\r\\nbbb\\r\\n'], 'output': ['2\\r\\n3\\r\\n0\\r\\n1\\r\\n2\\r\\n1\\r\\n0\\r\\n0\\r\\n0\\r\\n1\\r\\n0\\r\\n1\\r\\n1\\r\\n0\\r\\n']}]","id":670} {"difficulty":1800,"lang":"Perl","lang_cluster":"Perl","src_uid":"195_C","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/local\/bin\/perl\r\n$n = <>;\r\n$openBlocks = 0;\r\n$needlessBlocks =\r\n 0; #\u00d1\u008d\u00d1\u0082\u00d0\u00be \u00d0\u00b1\u00d0\u00bb\u00d0\u00be\u00d0\u00ba\u00d0\u00b8, \u00d0\u00be\u00d1\u0082\u00d0\u00ba\u00d1\u0080\u00d1\u008b\u00d1\u0082\u00d1\u008b\u00d0\u00b5 \u00d0\u00bf\u00d0\u00be\u00d1\u0081\u00d0\u00bb\u00d0\u00b5 \u00d1\u008d\u00d0\u00ba\u00d1\u0081\u00d0\u00b5\u00d0\u00bf\u00d1\u0088\u00d0\u00b5\u00d0\u00bd\u00d0\u00b0 TODO\r\n$wasThrow = 0;\r\n$eType;\r\nfor ( 1 .. $n ) {\r\n my $line = <>;\r\n\r\n if ( $line =~ \/\\s*try\\s*\/ ) {\r\n if ( $wasThrow == 0 ) {\r\n $openBlocks++;\r\n }\r\n else {\r\n $needlessBlocks++;\r\n }\r\n next;\r\n }\r\n if ( $line =~ \/\\s*throw\\s*\\(\\s*(\\w+)\\s*\\)\/ ) {\r\n $wasThrow = 1;\r\n $eType = $1;\r\n maybeError();\r\n next;\r\n }\r\n if ( $line =~ \/\\s*catch\\s*\\(\\s*(\\w+)\\s*,\\s*\"(.+)\"\\s*\\)\/ ) {\r\n if ( $needlessBlocks > 0 ) {\r\n $needlessBlocks--;\r\n next;\r\n }\r\n $openBlocks--;\r\n if ( $wasThrow != 0 && $eType eq $1 ) {\r\n print $2. \"\\n\";\r\n exit;\r\n }\r\n if ($wasThrow != 0){ \r\n maybeError();\r\n } \r\n\r\n }\r\n}\r\nprint \"Unhandled Exception\\n\";\r\n\r\nsub maybeError {\r\n if ( $openBlocks == 0 ) {\r\n print \"Unhandled Exception\\n\";\r\n exit;\r\n }\r\n}\r\n","description":"Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.The exceptions are processed by try-catch-blocks. There are two operators that work with the blocks: The try operator. It opens a new try-catch-block. The catch(, ) operator. It closes the try-catch-block that was started last and haven't yet been closed. This block can be activated only via exception of type . When we activate this block, the screen displays the . If at the given moment there is no open try-catch-block, then we can't use the catch operator.The exceptions can occur in the program in only one case: when we use the throw operator. The throw() operator creates the exception of the given type.Let's suggest that as a result of using some throw operator the program created an exception of type a. In this case a try-catch-block is activated, such that this block's try operator was described in the program earlier than the used throw operator. Also, this block's catch operator was given an exception type a as a parameter and this block's catch operator is described later that the used throw operator. If there are several such try-catch-blocks, then the system activates the block whose catch operator occurs earlier than others. If no try-catch-block was activated, then the screen displays message \"Unhandled Exception\".To test the system, Vasya wrote a program that contains only try, catch and throw operators, one line contains no more than one operator, the whole program contains exactly one throw operator.Your task is: given a program in VPL, determine, what message will be displayed on the screen.","input_specification":"The first line contains a single integer: n (1\u2264n\u226410^5) the number of lines in the program. Next n lines contain the program in language VPL. Each line contains no more than one operator. It means that input file can contain empty lines and lines, consisting only of spaces.\nThe program contains only operators try, catch and throw. It is guaranteed that the program is correct. It means that each started try-catch-block was closed, the catch operators aren't used unless there is an open try-catch-block. The program has exactly one throw operator. The program may have spaces at the beginning of a line, at the end of a line, before and after a bracket, a comma or a quote mark.\nThe exception type is a nonempty string, that consists only of upper and lower case english letters. The length of the string does not exceed 20 symbols. Message is a nonempty string, that consists only of upper and lower case english letters, digits and spaces. Message is surrounded with quote marks. Quote marks shouldn't be printed. The length of the string does not exceed 20 symbols.\nLength of any line in the input file does not exceed 50 symbols. \n","output_specification":"Print the message the screen will show after the given program is executed.\n","notes":"In the first sample there are 2 try-catch-blocks such that try operator is described earlier than throw operator and catch operator is described later than throw operator: try-catch(BE,\"BE in line 3\") and try-catch(AE,\"AE somewhere\"). Exception type is AE, so the second block will be activated, because operator catch(AE,\"AE somewhere\") has exception type AE as parameter and operator catch(BE,\"BE in line 3\") has exception type BE.\nIn the second sample there are 2 try-catch-blocks such that try operator is described earlier than throw operator and catch operator is described later than throw operator: try-catch(AE,\"AE in line 3\") and try-catch(AE,\"AE somewhere\"). Exception type is AE, so both blocks can be activated, but only the first one will be activated, because operator catch(AE,\"AE in line 3\") is described earlier than catch(AE,\"AE somewhere\")\nIn the third sample there is no blocks that can be activated by an exception of type CE.\n","sample_inputs":["8\ntry\n try\n throw ( AE ) \n catch ( BE, \"BE in line 3\")\n\n try\n catch(AE, \"AE in line 5\") \ncatch(AE,\"AE somewhere\")\n","8\ntry\n try\n throw ( AE ) \n catch ( AE, \"AE in line 3\")\n\n try\n catch(BE, \"BE in line 5\") \ncatch(AE,\"AE somewhere\")\n","8\ntry\n try\n throw ( CE ) \n catch ( BE, \"BE in line 3\")\n\n try\n catch(AE, \"AE in line 5\") \ncatch(AE,\"AE somewhere\")\n"],"sample_outputs":["AE somewhere\n","AE in line 3\n","Unhandled Exception\n"],"human_solution":"\r\n#!\/usr\/bin\/perl\r\n\r\nuse 5.006;\r\nuse strict;\r\nuse warnings;\r\n\r\nsub getMessage {\r\n my $t = shift;\r\n my $s = $t;\r\n $s =~ s\/^[\\w (,]+\\\"\/\/g;\r\n $s =~ s\/\\\"[\\w) ]+$\/\/g; \r\n $s =~ s\/^[\\s]+\/\/g;\r\n $s =~ s\/[\\s]+$\/\/g;\r\n return $s;\r\n}\r\n\r\nsub getException {\r\n my $t = shift;\r\n my $s = $t;\r\n $s =~ s\/^[\\w ]+\\(\/\/g;\r\n $s =~ s\/,[\\w )\\\"]+$\/\/g; \r\n $s =~ s\/^[\\s]+\/\/g;\r\n $s =~ s\/[\\s]+$\/\/g;\r\n return $s;\r\n}\r\n\r\nsub startsWith {\r\n my $t = shift;\r\n my $tok = shift;\r\n my $s = $t;\r\n $s =~ s\/^[\\s]+\/\/g;\r\n return 1 if ($s =~ \/^$tok\/);\r\n return 0;\r\n}\r\n\r\nsub getThrowExc {\r\n my $t = shift;\r\n my $s = $t;\r\n $s =~ s\/^[\\w ]+\\(\/\/g;\r\n $s =~ s\/[)]\/\/g;\r\n $s =~ s\/^[\\s]+\/\/g;\r\n $s =~ s\/[\\s]+$\/\/g;\r\n return $s;\r\n}\r\n\r\nsub blank {\r\n my $t = shift;\r\n my $s = $t;\r\n $s =~ s\/[\\s]+\/\/g;\r\n return length($s) == 0; \r\n}\r\n\r\nmy $n = <>;\r\nmy $line;\r\nmy $level = 0;\r\nmy $throwLevel = -1;\r\nmy $left = 0;\r\nmy $haveAnswer = 0;\r\nmy $exc;\r\nwhile ($line = <>) {\r\n next if (blank($line));\r\n if ($throwLevel == -1) {\r\n if (startsWith($line, \"try\")) {\r\n $level++;\r\n next;\r\n }\r\n if (startsWith($line, \"catch\")) {\r\n $level--;\r\n next;\r\n }\r\n $exc = getThrowExc($line); \r\n $throwLevel = $level;\r\n } else {\r\n if (startsWith($line, \"try\")) {\r\n $left++;\r\n next; \r\n } \r\n my $e = getException($line);\r\n if ($left == 0 && $exc eq $e) {\r\n $haveAnswer = 1;\r\n print getMessage($line); \r\n last;\r\n }\r\n if ($left > 0) {\r\n $left--;\r\n }\r\n \r\n\r\n }\r\n}\r\n\r\nif ($haveAnswer != 1) {\r\n print \"Unhandled Exception\";\r\n}","testcases":"[{'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( AE ) \\r\\n catch ( BE, \"BE in line 3\")\\r\\n\\r\\n try\\r\\n catch(AE, \"AE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['AE somewhere\\r\\n']}, {'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( AE ) \\r\\n catch ( AE, \"AE in line 3\")\\r\\n\\r\\n try\\r\\n catch(BE, \"BE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['AE in line 3\\r\\n']}, {'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( CE ) \\r\\n catch ( BE, \"BE in line 3\")\\r\\n\\r\\n try\\r\\n catch(AE, \"AE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow(A)\\r\\ncatch(A, \"A cought\")\\r\\n'], 'output': ['A cought\\r\\n']}, {'input': ['5\\r\\n try \\r\\n try \\r\\n catch ( gnAEZNTt, \"i5 tAC8ktUdeX\") \\r\\n throw( gnAEZNTt ) \\r\\ncatch ( gnAEZNTt, \"g1cN\" ) \\r\\n'], 'output': ['g1cN\\r\\n']}, {'input': ['5\\r\\n try \\r\\n catch(UqWpIpGKiMqFnKox , \"bp9h8dfeNLhk9Wea\" ) \\r\\nthrow ( uaBRmgAAQyWTCzaaQMlZ ) \\r\\n try \\r\\ncatch( UqWpIpGKiMqFnKox,\"0OvVhsVWzDyqwo\" )\\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['5\\r\\n throw ( ouB ) \\r\\n try \\r\\ncatch(ouB, \"bTJZV\" )\\r\\n try \\r\\ncatch( ouB , \"DUniE dDhpiN\") \\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['5\\r\\ntry \\r\\n throw( egdCZzrKRLBcqDl )\\r\\n catch ( egdCZzrKRLBcqDl ,\"o\" )\\r\\n try \\r\\n catch (egdCZzrKRLBcqDl , \"oM62EJIirV D0\" ) \\r\\n'], 'output': ['o\\r\\n']}, {'input': ['10\\r\\n \\r\\n\\r\\n \\r\\n\\r\\nthrow (ProgramException)\\r\\n \\r\\n \\r\\n\\r\\n\\r\\n \\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['21\\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n throw( qtSMze) \\r\\ncatch(LY,\"x3 j\")\\r\\ncatch(hgSAFgbMGx,\"moByu\")\\r\\ncatch(LmydVQgv,\"hbZl\")\\r\\ncatch(oK,\"B6OZx qy\")\\r\\ncatch(rrtnRQB,\"7VFkQMv\")\\r\\ncatch(CASqQXaz,\"d9oci1Kx\")\\r\\ncatch(CTCzsdD,\"u\")\\r\\ncatch(xqqMxbEs,\"Mdu\")\\r\\ncatch(sOWgTPbRp,\"fVH6\")\\r\\ncatch(qtSMze,\"ZRnNzz\")\\r\\n'], 'output': ['ZRnNzz\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow ( X )\\r\\ncatch ( X, \"try again\")\\r\\n'], 'output': ['try again\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow ( try )\\r\\ncatch ( try, \"try again\")\\r\\n'], 'output': ['try again\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow(tryC)\\r\\ncatch(tryC, \"bad boy\")\\r\\n'], 'output': ['bad boy\\r\\n']}, {'input': ['7\\r\\ntry\\r\\ncatch(A,\"try A\")\\r\\ntry\\r\\n throw(A)\\r\\ncatch(A,\"try B\")\\r\\ntry\\r\\ncatch(A,\"try C\")\\r\\n'], 'output': ['try B\\r\\n']}, {'input': ['3\\r\\ntry\\r\\n throw(try)\\r\\ncatch(try,\"haha\")\\r\\n'], 'output': ['haha\\r\\n']}, {'input': ['3\\r\\ntry\\r\\n throw(try)\\r\\ncatch(try,\"asd\")\\r\\n'], 'output': ['asd\\r\\n']}, {'input': ['11\\r\\ntry\\r\\n try\\r\\n catch (B, \"b\")\\r\\n \\r\\n try\\r\\n throw ( U )\\r\\n catch (U, \"try\")\\r\\n \\r\\n try\\r\\n catch (C, \"c\")\\r\\ncatch (A, \"a\")\\r\\n'], 'output': ['try\\r\\n']}]","id":671} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"195_D","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\r\n\r\nuse 5.006;\r\nuse strict;\r\nuse warnings;\r\n\r\nmy %hash;\r\n\r\nsub gcd {\r\n my $a = shift;\r\n my $b = shift;\r\n while ($b > 0) {\r\n $b ^= $a ^= $b ^= $a %= $b;\r\n }\r\n return $a;\r\n}\r\n\r\nmy $n = <>;\r\nfor(1..$n) {\r\n my $line = <>;\r\n my @arr = split(\/ \/, $line);\r\n my $k = $arr[0];\r\n my $b = $arr[1];\r\n next if (0 == $k);\r\n my $g = gcd($k, $b);\r\n $k \/= $g;\r\n $b \/= $g;\r\n if ($k < 0) {\r\n $k = -$k;\r\n $b = -$b;\r\n }\r\n $hash{($k, $b)} = 1;\r\n}\r\nprint \"\".keys( %hash ).\"\\n\";\r\n","description":"As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch football in his bar only if they help his son complete a programming task. The task goes like that.Let's consider a set of functions of the following form: Let's define a sum of n functions y1(x),...,yn(x) of the given type as function s(x)=y1(x)+...+yn(x) for any x. It's easy to show that in this case the graph s(x) is a polyline. You are given n functions of the given type, your task is to find the number of angles that do not equal 180 degrees, in the graph s(x), that is the sum of the given functions.Valeric and Valerko really want to watch the next Euro Championship game, so they asked you to help them.","input_specification":"The first line contains integer n (1\u2264n\u226410^5) \u2014 the number of functions. Each of the following n lines contains two space-separated integer numbers ki,bi (-10^9\u2264ki,bi\u226410^9) that determine the i-th function.\n","output_specification":"Print a single number \u2014 the number of angles that do not equal 180 degrees in the graph of the polyline that equals the sum of the given functions.\n","notes":null,"sample_inputs":["1\n1 0\n","3\n1 0\n0 2\n-1 1\n","3\n-2 -4\n1 7\n-5 1\n"],"sample_outputs":["1\n","2\n","3\n"],"human_solution":"#!\/usr\/bin\/perl\r\n\r\nuse 5.006;\r\nuse strict;\r\nuse warnings;\r\n\r\nmy %hash;\r\n\r\nsub gcd {\r\n my $a = abs (shift);\r\n my $b = abs (shift);\r\n while ($b > 0) {\r\n $b ^= $a ^= $b ^= $a %= $b;\r\n }\r\n return $a;\r\n}\r\n\r\nmy $n = <>;\r\nfor(1..$n) {\r\n my $line = <>;\r\n my @arr = split(\/ \/, $line);\r\n my $k = $arr[0];\r\n my $b = $arr[1];\r\n next if (0 == $k);\r\n my $g = gcd($k, $b);\r\n $k \/= $g;\r\n $b \/= $g;\r\n if ($k < 0) {\r\n $k = -$k;\r\n $b = -$b;\r\n }\r\n $hash{($k, $b)} = 1;\r\n}\r\nprint \"\".keys( %hash ).\"\\n\";\r\n","testcases":"[{'input': ['1\\r\\n1 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n1 0\\r\\n0 2\\r\\n-1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n-2 -4\\r\\n1 7\\r\\n-5 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\n9 9\\r\\n-5 2\\r\\n-2 9\\r\\n0 6\\r\\n6 7\\r\\n-1 -10\\r\\n-8 6\\r\\n3 6\\r\\n-3 -9\\r\\n0 4\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['10\\r\\n-4 -9\\r\\n5 9\\r\\n-4 -1\\r\\n6 -1\\r\\n-10 -10\\r\\n3 4\\r\\n3 5\\r\\n3 10\\r\\n9 7\\r\\n4 -7\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['5\\r\\n3 3\\r\\n2 2\\r\\n2 -3\\r\\n-3 3\\r\\n-1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n0 2\\r\\n-1 -2\\r\\n1 0\\r\\n-2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\n-1 2\\r\\n0 1\\r\\n-2 0\\r\\n1 1\\r\\n-1 -1\\r\\n-2 1\\r\\n-2 2\\r\\n2 -1\\r\\n0 -1\\r\\n-1 0\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['15\\r\\n0 3\\r\\n-1 -3\\r\\n0 -2\\r\\n1 3\\r\\n1 0\\r\\n1 3\\r\\n0 3\\r\\n-2 -1\\r\\n2 -1\\r\\n-3 -2\\r\\n-1 -1\\r\\n2 -3\\r\\n-1 3\\r\\n3 -3\\r\\n0 1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['10\\r\\n32 -84\\r\\n-24 -21\\r\\n-4 26\\r\\n67 -34\\r\\n22 50\\r\\n-15 20\\r\\n3 -39\\r\\n-86 62\\r\\n56 -81\\r\\n34 -91\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['2\\r\\n0 5\\r\\n0 -5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 1000000000\\r\\n1 1000000000\\r\\n1 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n1000000000 -1000000000\\r\\n-1000000000 1000000000\\r\\n-200000000 200000000\\r\\n200000000 -200000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n3 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1 1000000000\\r\\n-1 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n79 49\\r\\n72 40\\r\\n-5 0\\r\\n-70 26\\r\\n-98 23\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10\\r\\n148 134\\r\\n145 140\\r\\n105 144\\r\\n196 199\\r\\n195 166\\r\\n110 175\\r\\n140 198\\r\\n112 188\\r\\n147 145\\r\\n153 196\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['6\\r\\n1000000000 1\\r\\n-1000000000 -1\\r\\n999999999 1\\r\\n-999999999 -1\\r\\n7 22\\r\\n318181815 999999990\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n1000000000 1000000000\\r\\n1000000000 1000000000\\r\\n1000000000 1000000000\\r\\n1000000000 1000000000\\r\\n294967296 294967296\\r\\n'], 'output': ['1\\r\\n']}]","id":672} {"difficulty":1600,"lang":"Perl","lang_cluster":"Perl","src_uid":"197_A","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\n\nuse List::Util qw[min max];\n\n$a = <>;\n$b = <>;\n$r = <>;\n\nif (min($a, $b) < 2*$r) {\n print (\"Second\");\n}\nelse {\n print (\"First\");\n}","description":"You've got a rectangular table with length a and width b and the infinite number of plates of radius r. Two players play the following game: they take turns to put the plates on the table so that the plates don't lie on each other (but they can touch each other), and so that any point on any plate is located within the table's border. During the game one cannot move the plates that already lie on the table. The player who cannot make another move loses. Determine which player wins, the one who moves first or the one who moves second, provided that both players play optimally well.","input_specification":"A single line contains three space-separated integers a, b, r (1\u2264a,b,r\u2264100) \u2014 the table sides and the plates' radius, correspondingly.\n","output_specification":"If wins the player who moves first, print \"First\" (without the quotes). Otherwise print \"Second\" (without the quotes).\n","notes":"In the first sample the table has place for only one plate. The first player puts a plate on the table, the second player can't do that and loses.\n \nIn the second sample the table is so small that it doesn't have enough place even for one plate. So the first player loses without making a single move.\n \n","sample_inputs":["5 5 2\n","6 7 4\n"],"sample_outputs":["First\n","Second\n"],"human_solution":"$xx = ; @xx = split(\" \",$xx) ;\r\nif ($xx[0] < $xx[2] * 2 or $xx[1] < $xx[2] * 2) { print \"Second\"; }\r\nelse { print \"First\"; }","testcases":"[{'input': ['5 5 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['6 7 4\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['100 100 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['1 1 100\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['13 7 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['23 7 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['9 9 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['13 13 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['21 21 10\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['20 21 10\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['20 20 10\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['9 13 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['19 7 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['19 19 10\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['19 20 10\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['19 21 10\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 100 1\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['2 100 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['3 100 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['100 100 49\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['100 100 50\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['100 100 51\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['100 99 50\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['4 10 5\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['8 11 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['3 12 5\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['14 15 5\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['61 2 3\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['82 20 5\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 80 10\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['2 1 20\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['78 82 5\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['8 55 7\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['75 55 43\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['34 43 70\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['86 74 36\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['86 74 37\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['86 74 38\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['24 70 11\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['24 70 12\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['24 70 13\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['78 95 38\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['78 95 39\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['78 95 40\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['88 43 21\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['88 43 22\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['88 43 23\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['30 40 14\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['30 40 15\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['30 40 16\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['2 5 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['5 100 3\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['44 58 5\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['4 4 6\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['10 20 6\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['100 1 1\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['60 60 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['100 1 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['2 4 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['10 90 11\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['20 5 6\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 44 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['10 5 5\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['5 100 4\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['99 99 50\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 100 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['100 20 12\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['10 2 4\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 50 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['10 4 3\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['74 1 1\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['6 6 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['10 10 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['21 41 5\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['13 1 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 100 3\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['1 64 2\\r\\n'], 'output': ['Second\\r\\n']}, {'input': ['3 4 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 15 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 16 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 15 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 16 1\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 15 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 16 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 15 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 16 2\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 15 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 16 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 15 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 16 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['15 17 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['16 17 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['17 17 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['17 15 3\\r\\n'], 'output': ['First\\r\\n']}, {'input': ['17 16 3\\r\\n'], 'output': ['First\\r\\n']}]","id":673} {"difficulty":1700,"lang":"Perl","lang_cluster":"Perl","src_uid":"201_A","execute_outcome":"WRONG_ANSWER","source_code":"$c = 1;\r\n%h = map { $c += $_ * 4 , $_ * 2 + 1 } 0 .. 7;\r\n$_ = <>, chomp;\r\n$_ ++ until exists $h{ $_ };\r\nprint $h{ $_ }","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,j.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,j) (1\u2264i,j\u2264n) both of the following conditions must be met: Ai,j=An-i+1,j and Ai,j=Ai,n-j+1.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\u2264x\u2264100) \u2014 the required sharpness of the matrix.\n","output_specification":"Print a single number \u2014 the sought value of n.\n","notes":"The figure below shows the matrices that correspond to the samples:\n \n","sample_inputs":["4\n","9\n"],"sample_outputs":["3\n","5\n"],"human_solution":"$a[ $c += $_ * 4 ] = $_ * 2 + 1 for $c ++ .. 7;\r\n$_ = <>;\r\n@a[ 2 .. 3 ] = (3, 5);\r\n$_ ++ until $a[ $_ ];\r\nprint $a[ $_ ]","testcases":"[{'input': ['4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['17\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['22\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['23\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['24\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['25\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['26\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['27\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['28\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['29\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['31\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['32\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['33\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['34\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['35\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['36\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['37\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['38\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['39\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['40\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['41\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['42\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['43\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['44\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['45\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['46\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['47\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['48\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['49\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['50\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['51\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['52\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['53\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['54\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['55\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['56\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['57\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['58\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['59\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['60\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['61\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['62\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['63\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['64\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['65\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['66\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['67\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['68\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['69\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['70\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['71\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['72\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['73\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['74\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['75\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['76\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['77\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['78\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['79\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['80\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['81\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['82\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['83\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['84\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['85\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['86\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['87\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['88\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['89\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['90\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['91\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['92\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['93\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['94\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['95\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['96\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['97\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['98\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['99\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['15\\r\\n']}]","id":674} {"difficulty":1700,"lang":"Perl","lang_cluster":"Perl","src_uid":"20_A","execute_outcome":"WRONG_ANSWER","source_code":"#!perl -p\r\ns\/\\\/+\/\\\/\/g","description":"The new operating system BerOS has a nice feature. It is possible to use any number of characters '\/' as a delimiter in path instead of one traditional '\/'. For example, strings \/\/usr\/\/\/local\/\/nginx\/sbin\/\/ and \/usr\/local\/nginx\/\/\/sbin are equivalent. The character '\/' (or some sequence of such characters) at the end of the path is required only in case of the path to the root directory, which can be represented as single character '\/'.A path called normalized if it contains the smallest possible number of characters '\/'.Your task is to transform a given path to the normalized form.","input_specification":"The first line of the input contains only lowercase Latin letters and character '\/'\u00a0\u2014 the path to some directory. All paths start with at least one character '\/'. The length of the given line is no more than 100 characters, it is not empty.\n","output_specification":"The path in normalized form.\n","notes":null,"sample_inputs":["\/\/usr\/\/\/local\/\/nginx\/sbin\n"],"sample_outputs":["\/usr\/local\/nginx\/sbin\n"],"human_solution":"chomp($line = <>);\r\n$line =~ s\/\\\/+\/\\\/\/g;\r\n$line =~ s\/\\\/+$\/\/g if (length $line) > 1;\r\nprint \"$line\\n\";","testcases":"[{'input': ['\/\/usr\/\/\/local\/\/nginx\/sbin\\r\\n'], 'output': ['\/usr\/local\/nginx\/sbin\\r\\n']}, {'input': ['\/\/\/\/a\/\/b\/\/\/\/\/g\\r\\n'], 'output': ['\/a\/b\/g\\r\\n']}, {'input': ['\/a\/b\/c\\r\\n'], 'output': ['\/a\/b\/c\\r\\n']}, {'input': ['\/\\r\\n'], 'output': ['\/\\r\\n']}, {'input': ['\/\/\/\/\\r\\n'], 'output': ['\/\\r\\n']}, {'input': ['\/a\/\/aa\/a\/\/\\r\\n'], 'output': ['\/a\/aa\/a\\r\\n']}, {'input': ['\/aa\/\/b\/aa\\r\\n'], 'output': ['\/aa\/b\/aa\\r\\n']}, {'input': ['\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\r\\n'], 'output': ['\/\\r\\n']}, {'input': ['\/opt\/\/\/pokerband\/\/\/srvb\/opt\/\/\/pokerband\/\/\/srvb\/\/\/\/pokerband\/\/\/srvb\/\\r\\n'], 'output': ['\/opt\/pokerband\/srvb\/opt\/pokerband\/srvb\/pokerband\/srvb\\r\\n']}, {'input': ['\/root\/pokerband\/trunk\/server\/game\/code\/src\/main\/java\/com\/uosipa\/pokerband\/gameserver\/game\/\\r\\n'], 'output': ['\/root\/pokerband\/trunk\/server\/game\/code\/src\/main\/java\/com\/uosipa\/pokerband\/gameserver\/game\\r\\n']}, {'input': ['\/root\/\/pokerband\/trunk\/server\/game\/code\/src\/\/\/main\/java\/com\/uosipa\/pokerband\/\/gameserver\/game\/\/\\r\\n'], 'output': ['\/root\/pokerband\/trunk\/server\/game\/code\/src\/main\/java\/com\/uosipa\/pokerband\/gameserver\/game\\r\\n']}, {'input': ['\/root\/\/pokerband\/trunk\/server\/game\/code\/src\/\/\/main\/java\/com\/uosipa\/pokerband\/\/gameserver\/game\/\/test\/\\r\\n'], 'output': ['\/root\/pokerband\/trunk\/server\/game\/code\/src\/main\/java\/com\/uosipa\/pokerband\/gameserver\/game\/test\\r\\n']}, {'input': ['\/root\/\/pokerband\/trunk\/server\/game\/code\/src\/\/\/main\/java\/com\/uosipa\/pokerband\/\/gameserver\/game\/\/testt\\r\\n'], 'output': ['\/root\/pokerband\/trunk\/server\/game\/code\/src\/main\/java\/com\/uosipa\/pokerband\/gameserver\/game\/testt\\r\\n']}, {'input': ['\/\/\/a\/\/a\/\/\/\/a\/a\/\/a\/\/a\/\/a\/\/\/\/\/\\r\\n'], 'output': ['\/a\/a\/a\/a\/a\/a\/a\\r\\n']}, {'input': ['\/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n'], 'output': ['\/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n']}, {'input': ['\/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\/\\r\\n'], 'output': ['\/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\\r\\n']}, {'input': ['\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\\r\\n'], 'output': ['\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\/a\\r\\n']}, {'input': ['\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/z\\r\\n'], 'output': ['\/z\\r\\n']}, {'input': ['\/z\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\r\\n'], 'output': ['\/z\\r\\n']}]","id":675} {"difficulty":1600,"lang":"Perl","lang_cluster":"Perl","src_uid":"214_B","execute_outcome":"WRONG_ANSWER","source_code":"#!\/usr\/bin\/perl\r\n\r\n$n = <>+0;\r\n@a = split \" \",<>;\r\nfor(@a){\r\n $h{$_+0}++;\r\n $s+=$_;\r\n}\r\nif($h{0} == 0){\r\n print -1;\r\n}else{\r\n if($s % 3 == 1){\r\n if($s % 3 && $h{1}){$h{1}--;$s -= 1;}\r\n if($s % 3 && $h{4}){$h{4}--;$s -= 4;}\r\n if($s % 3 && $h{7}){$h{7}--;$s -= 7;}\r\n }\r\n for(1..10){\r\n if($s % 3 > 0){\r\n if($s % 3 && $h{2}){$h{2}--;$s -= 2;}\r\n if($s % 3 && $h{5}){$h{5}--;$s -= 5;}\r\n if($s % 3 && $h{8}){$h{8}--;$s -= 8;}\r\n }\r\n if($s % 3 > 0){\r\n if($s % 3 && $h{1}){$h{1}--;$s -= 1;}\r\n if($s % 3 && $h{4}){$h{4}--;$s -= 4;}\r\n if($s % 3 && $h{7}){$h{7}--;$s -= 7;}\r\n }\r\n }\r\n if($h{0} >= $n){\r\n print 0;\r\n } else {\r\n if($s % 3 > 0){\r\n print -1;\r\n }else {\r\n for $d(sort {$b <=> $a} keys %h){\r\n for(1..$h{$d}){\r\n print $d;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","description":"Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?You are given a set of digits, your task is to find the maximum integer that you can make from these digits. The made number must be divisible by 2, 3, 5 without a residue. It is permitted to use not all digits from the set, it is forbidden to use leading zeroes.Each digit is allowed to occur in the number the same number of times it occurs in the set.","input_specification":"A single line contains a single integer n (1\u2264n\u2264100000) \u2014 the number of digits in the set. The second line contains n digits, the digits are separated by a single space. \n","output_specification":"On a single line print the answer to the problem. If such number does not exist, then you should print -1.\n","notes":"In the first sample there is only one number you can make \u2014 0. In the second sample the sought number is 5554443330. In the third sample it is impossible to make the required number.\n","sample_inputs":["1\n0\n","11\n3 4 5 4 5 3 5 3 4 4 0\n","8\n3 2 5 1 5 2 2 3\n"],"sample_outputs":["0\n","5554443330\n","-1\n"],"human_solution":"#!\/usr\/bin\/perl\n\nuse strict;\nuse warnings;\n\nmy $n = <>;\nchomp($n);\nmy $line = <>;\nchomp($line);\n\nmy @nums = split(\/\\s\/, $line);\nmy $data = +{};\nfor my $num (@nums) {\n $data->{$num}++;\n}\n\nif (!$data->{0}) {\n print \"-1\";\n exit;\n}\n\nmy $sum = get_sum($data);\n\nmy $rest = $sum % 3;\nmy $cnt = 0;\nwhile ($rest != 0 && $cnt < 2) {\n func($data, $rest);\n $rest = get_sum($data) % 3;\n $cnt++;\n}\n\nif ($rest == 0) {\n my $ans = '';\n for (my $i=9; $i >= 0; $i--) {\n if ($data->{$i}) {\n $ans .= $i x $data->{$i};\n }\n }\n\n if (substr($ans, 0, 1) eq '0') {\n print 0;\n }\n else {\n print $ans;\n }\n}\nelse {\n print \"-1\";\n}\n\nsub get_sum {\n $data = shift;\n my $sum = 0;\n for my $key (keys(%{$data})) {\n if ($data->{$key}) {\n $sum += $key * $data->{$key};\n }\n }\n\n return $sum;\n}\n\nsub func {\n my ($data, $rest) = @_;\n if ($rest == 1) {\n for my $i (1, 4, 7) {\n if ($data->{$i}) {\n $data->{$i}--;\n return;\n }\n }\n for my $i (2, 5, 8) {\n if ($data->{$i}) {\n $data->{$i}--;\n return;\n }\n }\n }\n if ($rest == 2) {\n for my $i (2, 5, 8) {\n if ($data->{$i}) {\n $data->{$i}--;\n return;\n }\n }\n for my $i (1, 4, 7) {\n if ($data->{$i}) {\n $data->{$i}--;\n return;\n }\n }\n }\n}\n","testcases":"[{'input': ['1\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['11\\r\\n3 4 5 4 5 3 5 3 4 4 0\\r\\n'], 'output': ['5554443330\\r\\n']}, {'input': ['8\\r\\n3 2 5 1 5 2 2 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['12\\r\\n5 3 3 3 2 5 5 1 2 1 4 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['8\\r\\n5 5 4 1 5 5 5 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['12\\r\\n3 1 2 3 2 0 2 2 2 0 2 3\\r\\n'], 'output': ['33322222200\\r\\n']}, {'input': ['12\\r\\n5 1 4 4 2 1 7 7 4 2 5 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5\\r\\n3 6 1 6 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['11\\r\\n3 9 9 6 4 3 6 4 9 6 0\\r\\n'], 'output': ['999666330\\r\\n']}, {'input': ['5\\r\\n9 6 6 6 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n1 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n1 1 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 0 2 2 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n3 3 2 2 2 0\\r\\n'], 'output': ['332220\\r\\n']}, {'input': ['7\\r\\n3 3 2 2 2 2 0\\r\\n'], 'output': ['332220\\r\\n']}, {'input': ['6\\r\\n0 3 3 1 1 1\\r\\n'], 'output': ['331110\\r\\n']}, {'input': ['7\\r\\n0 3 3 1 1 1 1\\r\\n'], 'output': ['331110\\r\\n']}, {'input': ['7\\r\\n0 3 3 4 4 4 4\\r\\n'], 'output': ['444330\\r\\n']}, {'input': ['7\\r\\n0 3 3 2 2 4 4\\r\\n'], 'output': ['4433220\\r\\n']}, {'input': ['7\\r\\n4 2 3 3 0 0 0\\r\\n'], 'output': ['4332000\\r\\n']}, {'input': ['4\\r\\n1 1 0 3\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['4\\r\\n3 0 2 2\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['8\\r\\n3 3 3 5 5 0 0 0\\r\\n'], 'output': ['333000\\r\\n']}, {'input': ['8\\r\\n3 3 6 3 0 7 7 9\\r\\n'], 'output': ['963330\\r\\n']}, {'input': ['9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['9\\r\\n9 9 9 9 9 9 9 9 9\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n9 0\\r\\n'], 'output': ['90\\r\\n']}, {'input': ['10\\r\\n3 0 2 2 2 2 2 2 2 2\\r\\n'], 'output': ['32222220\\r\\n']}, {'input': ['10\\r\\n3 0 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['31111110\\r\\n']}, {'input': ['10\\r\\n3 0 4 4 4 4 4 4 4 4\\r\\n'], 'output': ['44444430\\r\\n']}, {'input': ['10\\r\\n2 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n2 2 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n5 5 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 4 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n0 1 4 3\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['3\\r\\n2 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n0 1 2 3\\r\\n'], 'output': ['3210\\r\\n']}, {'input': ['4\\r\\n1 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n8 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 0 8 5 6\\r\\n'], 'output': ['600\\r\\n']}, {'input': ['4\\r\\n5 8 3 0\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['4\\r\\n1 4 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n0 0 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n1 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n0 0 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n0 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n1 1 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n2 2 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n3 2 5 0 0\\r\\n'], 'output': ['300\\r\\n']}, {'input': ['4\\r\\n5 3 2 0\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['5\\r\\n0 0 0 2 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0 0 0 0 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\n0 3 5 8\\r\\n'], 'output': ['30\\r\\n']}]","id":676} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"21_A","execute_outcome":"RUNTIME_ERROR","source_code":"puts gets=~m\/^\\w{1,16}@\\w{1,16}(\\.\\w{1,16})*(\\\/\\w{1,16})?\\n$\/?\"YES\":\"NO\"","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"],"human_solution":"my $id = ;\nchomp($id);\n# username - 1-16 [a-zA-z0-9_]\n# @hostname - 1-16 each, 1-32 total\n# \/resource - 1-16, optional\nif ($id =~ m\/^\\w{1,16}@\\w{1,16}(\\.\\w{1,16})*(\\\/\\w{1,16})?$\/ and\n\t\t$id =~ m\/^\\w{1,16}@[\\w\\.]{1,32}(\\\/\\w{1,16})?$\/) {\n\tprint \"YES\\n\";\n} else {\n\tprint \"NO\\n\";\n}\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":677} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"222_D","execute_outcome":"WRONG_ANSWER","source_code":"($n, $x) = split(' ', <>);\r\n@a = split(' ', <>); @a = sort{$a <=> $b} @a;\r\n@b = split(' ', <>); @b = sort{$a <=> $b} @b;\r\n\r\nforeach(@b){\r\n\tprint \"$_, \";}\r\n\tprint \"\\n\";\r\nforeach(@a){\r\n\tif($_ + $b[$n - 1] >= $x){\r\n\t\t$n --; $re ++;}}\r\nprint \"1 $re\";\r\n\r\n","description":"A boy named Vasya has taken part in an Olympiad. His teacher knows that in total Vasya got at least x points for both tours of the Olympiad. The teacher has the results of the first and the second tour of the Olympiad but the problem is, the results have only points, no names. The teacher has to know Vasya's chances.Help Vasya's teacher, find two numbers \u2014 the best and the worst place Vasya could have won. Note that the total results' table sorts the participants by the sum of points for both tours (the first place has the participant who has got the most points). If two or more participants have got the same number of points, it's up to the jury to assign places to them according to their choice. It is guaranteed that each participant of the Olympiad participated in both tours of the Olympiad.","input_specification":"The first line contains two space-separated integers n,x (1\u2264n\u226410^5;\u00a00\u2264x\u22642\u00b710^5) \u2014 the number of Olympiad participants and the minimum number of points Vasya earned.\nThe second line contains n space-separated integers: a1,a2,...,an (0\u2264ai\u226410^5) \u2014 the participants' points in the first tour.\nThe third line contains n space-separated integers: b1,b2,...,bn (0\u2264bi\u226410^5) \u2014 the participants' points in the second tour.\nThe participants' points are given in the arbitrary order. It is guaranteed that Vasya was present in the Olympiad \u2014 there are two integers i,j (1\u2264i,j\u2264n) such, that ai+bj\u2265x.\n","output_specification":"Print two space-separated integers \u2014 the best and the worst place Vasya could have got on the Olympiad.\n","notes":"In the first text sample all 5 participants earn 2 points each in any case. Depending on the jury's decision, Vasya can get the first (the best) as well as the last (the worst) fifth place.\nIn the second test sample in the best case scenario Vasya wins again: he can win 12 points and become the absolute winner if the total results' table looks like that \u2014 {4:8, 6:4, 3:6, 4:4, 4:3, 5:0}.\nIn this table all participants are sorted by decreasing points and we can see how much a participant earned in the first and in the second tour.\nIn the worst case scenario Vasya can get the fifth place if the table looks like that \u2014 {4:8, 4:6, 6:4, 5:4, 4:3, 3:0}, and he earned 4 and 3 points in the first and second tours, correspondingly.\n","sample_inputs":["5 2\n1 1 1 1 1\n1 1 1 1 1\n","6 7\n4 3 5 6 4 4\n8 6 0 4 3 4\n"],"sample_outputs":["1 5\n","1 5\n"],"human_solution":"($n, $x) = split(' ', <>);\r\n@a = split(' ', <>); @a = sort{$a <=> $b} @a;\r\n@b = split(' ', <>); @b = sort{$a <=> $b} @b;\r\n\r\nforeach(@a){\r\n\tif($_ + $b[$n - 1] >= $x){\r\n\t\t$n --; $re ++;}}\r\nprint \"1 $re\";\r\n\r\n","testcases":"[{'input': ['5 2\\r\\n1 1 1 1 1\\r\\n1 1 1 1 1\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['6 7\\r\\n4 3 5 6 4 4\\r\\n8 6 0 4 3 4\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['1 100\\r\\n56\\r\\n44\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['5 1\\r\\n1 2 3 4 5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['5 5\\r\\n2 2 2 2 2\\r\\n3 3 3 3 3\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['4 100\\r\\n98 98 99 100\\r\\n1 1 2 2\\r\\n'], 'output': ['1 4\\r\\n']}, {'input': ['5 45\\r\\n1 2 3 4 5\\r\\n10 20 30 40 50\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['10 5\\r\\n3 1 1 2 1 3 1 1 2 3\\r\\n2 1 3 2 1 3 3 3 3 1\\r\\n'], 'output': ['1 5\\r\\n']}, {'input': ['10 0\\r\\n3 3 1 1 1 2 3 0 0 3\\r\\n1 3 0 1 2 0 3 3 0 0\\r\\n'], 'output': ['1 10\\r\\n']}, {'input': ['10 16\\r\\n8 4 2 5 4 8 3 5 6 9\\r\\n5 3 8 6 2 10 10 8 9 3\\r\\n'], 'output': ['1 4\\r\\n']}, {'input': ['10 2\\r\\n9 8 2 5 4 7 8 1 0 9\\r\\n4 8 0 4 7 2 10 9 0 0\\r\\n'], 'output': ['1 10\\r\\n']}, {'input': ['2 50\\r\\n25 24\\r\\n26 26\\r\\n'], 'output': ['1 2\\r\\n']}, {'input': ['2 50\\r\\n25 25\\r\\n24 26\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['3 3\\r\\n1 50 2\\r\\n2 2 1\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['3 10\\r\\n9 9 0\\r\\n0 0 10\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['4 0\\r\\n0 0 0 0\\r\\n0 0 0 0\\r\\n'], 'output': ['1 4\\r\\n']}, {'input': ['10 168\\r\\n76 42 26 51 40 79 30 48 58 91\\r\\n50 28 76 62 25 91 99 81 91 31\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['10 26\\r\\n85 77 25 50 45 65 79 9 2 84\\r\\n43 76 0 44 72 23 95 91 3 2\\r\\n'], 'output': ['1 10\\r\\n']}, {'input': ['10 168884\\r\\n75796 42057 25891 51127 40493 78380 30331 47660 58338 90812\\r\\n50469 28184 75581 61837 25050 90975 98279 81022 90217 31015\\r\\n'], 'output': ['1 3\\r\\n']}, {'input': ['10 26872\\r\\n84744 76378 25507 49544 44949 65159 78873 9386 2834 83577\\r\\n43277 76228 210 44539 72154 22876 94528 90143 3059 2544\\r\\n'], 'output': ['1 10\\r\\n']}]","id":678} {"difficulty":1600,"lang":"Perl","lang_cluster":"Perl","src_uid":"231_D","execute_outcome":"WRONG_ANSWER","source_code":"use warnings;\r\n\r\nmy $sum = 0;\r\nmy($x, $y, $z) = split(\" \",);\r\nmy($x1, $y1, $z1) = split(\" \",);\r\nmy($a1, $a2, $a3, $a4, $a5, $a6) = split(\" \",);\r\n\r\nsub check($$$$) {\r\n my ($r, $r1, $cost1, $cost2) = @_;\r\n\r\n if ($r1 == 0) {\r\n\tif ($r < $r1) {\r\n\t $sum += $cost1;\r\n\t}\r\n }\r\n elsif ($r > $r1) {\r\n\t$sum += $cost2; \r\n } \r\n}\r\n\r\n\r\n&check($x,$x1,$a5,$a6);\r\n&check($y,$y1,$a1,$a2);\r\n&check($z,$z1,$a3,$a4);\r\n\r\nprintf(\"%d\\n\", $sum);\r\n","description":"One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coordinate axes, one of its vertices is at point (0,0,0), and the opposite one is at point (x1,y1,z1). The six faces of the box contain some numbers a1,a2,...,a6, exactly one number right in the center of each face. The numbers are located on the box like that: number a1 is written on the face that lies on the ZOX plane; a2 is written on the face, parallel to the plane from the previous point; a3 is written on the face that lies on the XOY plane; a4 is written on the face, parallel to the plane from the previous point; a5 is written on the face that lies on the YOZ plane; a6 is written on the face, parallel to the plane from the previous point. At the moment Vasya is looking at the box from point (x,y,z). Find the sum of numbers that Vasya sees. Note that all faces of the box are not transparent and Vasya can't see the numbers through the box. The picture contains transparent faces just to make it easier to perceive. You can consider that if Vasya is looking from point, lying on the plane of some face, than he can not see the number that is written on this face. It is enough to see the center of a face to see the corresponding number for Vasya. Also note that Vasya always reads correctly the ai numbers that he sees, independently of their rotation, angle and other factors (that is, for example, if Vasya sees some ai=6, then he can't mistake this number for 9 and so on). ","input_specification":"The fist input line contains three space-separated integers x, y and z (|x|,|y|,|z|\u226410^6) \u2014 the coordinates of Vasya's position in space. The second line contains three space-separated integers x1, y1, z1 (1\u2264x1,y1,z1\u226410^6) \u2014 the coordinates of the box's vertex that is opposite to the vertex at point (0,0,0). The third line contains six space-separated integers a1,a2,...,a6 (1\u2264ai\u226410^6) \u2014 the numbers that are written on the box faces. \nIt is guaranteed that point (x,y,z) is located strictly outside the box.\n","output_specification":"Print a single integer \u2014 the sum of all numbers on the box faces that Vasya sees.\n","notes":"The first sample corresponds to perspective, depicted on the picture. Vasya sees numbers a2 (on the top face that is the darkest), a6 (on the right face that is the lightest) and a4 (on the left visible face).\nIn the second sample Vasya can only see number a4.\n","sample_inputs":["2 2 2\n1 1 1\n1 2 3 4 5 6\n","0 0 10\n3 2 3\n1 2 3 4 5 6\n"],"sample_outputs":["12\n","4\n"],"human_solution":"use warnings;\r\n\r\nmy $sum = 0;\r\nmy($x, $y, $z) = split(\" \",);\r\nmy($x1, $y1, $z1) = split(\" \",);\r\nmy($a1, $a2, $a3, $a4, $a5, $a6) = split(\" \",);\r\n\r\nsub check($$$$) {\r\n my ($r, $r1, $cost1, $cost2) = @_;\r\n\r\n if ($r < 0) {\r\n\t$sum += $cost1;\r\n }\r\n elsif ($r > $r1) {\r\n\t$sum += $cost2; \r\n } \r\n}\r\n\r\n\r\n&check($x,$x1,$a5,$a6);\r\n&check($y,$y1,$a1,$a2);\r\n&check($z,$z1,$a3,$a4);\r\n\r\nprintf(\"%d\\n\", $sum);","testcases":"[{'input': ['2 2 2\\r\\n1 1 1\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['0 0 10\\r\\n3 2 3\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['0 1 2\\r\\n1 1 1\\r\\n634728 627299 454463 927148 298618 186257\\r\\n'], 'output': ['927148\\r\\n']}, {'input': ['5 2 -4\\r\\n1 1 1\\r\\n279519 704273 181008 670653 198973 996401\\r\\n'], 'output': ['1881682\\r\\n']}, {'input': ['5 5 0\\r\\n3 1 3\\r\\n832224 636838 995053 211585 505442 341920\\r\\n'], 'output': ['978758\\r\\n']}, {'input': ['-1 -9 14\\r\\n9 8 10\\r\\n172575 215800 344296 98651 566390 47011\\r\\n'], 'output': ['837616\\r\\n']}, {'input': ['95892 79497 69936\\r\\n7 4 6\\r\\n873850 132840 469930 271591 257864 626722\\r\\n'], 'output': ['1031153\\r\\n']}, {'input': ['-263980 -876063 613611\\r\\n2 3 14\\r\\n63640 300066 460766 222639 51956 412622\\r\\n'], 'output': ['338235\\r\\n']}, {'input': ['30 68 72\\r\\n51 54 95\\r\\n480054 561470 308678 472768 90393 992511\\r\\n'], 'output': ['561470\\r\\n']}, {'input': ['19 60 75\\r\\n11 64 92\\r\\n768641 208726 47379 514231 858941 959876\\r\\n'], 'output': ['959876\\r\\n']}, {'input': ['37 96 41\\r\\n27 74 97\\r\\n747624 148752 730329 406930 814825 993124\\r\\n'], 'output': ['1141876\\r\\n']}, {'input': ['573 79 619\\r\\n36 69 96\\r\\n955743 245262 675667 699027 275227 783730\\r\\n'], 'output': ['1728019\\r\\n']}, {'input': ['34271 -17508 -6147\\r\\n456 567 112\\r\\n804178 307516 306399 18981 989216 228388\\r\\n'], 'output': ['1338965\\r\\n']}, {'input': ['-33064 176437 217190\\r\\n181 507 575\\r\\n161371 827160 733690 99808 584032 954632\\r\\n'], 'output': ['1511000\\r\\n']}, {'input': ['967 -1346 2551\\r\\n769 331 28\\r\\n458319 885170 877010 533360 723416 248230\\r\\n'], 'output': ['1239909\\r\\n']}, {'input': ['46643 53735 -19637\\r\\n3268 9109 5377\\r\\n679826 208720 919306 797520 856404 373419\\r\\n'], 'output': ['1501445\\r\\n']}, {'input': ['7412 -524 9621\\r\\n8748 8870 1521\\r\\n1043 894084 881852 56954 415764 946495\\r\\n'], 'output': ['57997\\r\\n']}, {'input': ['409501 -349039 -285847\\r\\n4386 1034 7566\\r\\n166804 981888 780353 956617 563457 238748\\r\\n'], 'output': ['1185905\\r\\n']}, {'input': ['7669 1619 6208\\r\\n2230 2327 8551\\r\\n28791 762474 463311 687868 175185 383245\\r\\n'], 'output': ['383245\\r\\n']}, {'input': ['2581 12373 -1381\\r\\n2048 8481 7397\\r\\n118694 862180 426553 229109 698247 387794\\r\\n'], 'output': ['1676527\\r\\n']}, {'input': ['35273 82177 67365\\r\\n69755 14857 39718\\r\\n925457 138136 454985 609590 83655 611361\\r\\n'], 'output': ['747726\\r\\n']}, {'input': ['58224 94433 40185\\r\\n55683 99614 33295\\r\\n137430 61976 671256 929825 499631 90071\\r\\n'], 'output': ['1019896\\r\\n']}, {'input': ['-267768 -542892 844309\\r\\n53169 60121 20730\\r\\n760938 814929 213048 452483 867280 110687\\r\\n'], 'output': ['2080701\\r\\n']}, {'input': ['441810 183747 823363\\r\\n945702 484093 693802\\r\\n149570 186362 344439 753794 467269 643649\\r\\n'], 'output': ['753794\\r\\n']}, {'input': ['298742 556311 628232\\r\\n360973 607625 301540\\r\\n278905 531131 923271 701344 873950 969819\\r\\n'], 'output': ['701344\\r\\n']}, {'input': ['366317 904079 468911\\r\\n819427 99580 451147\\r\\n291702 801137 380674 646951 890909 998554\\r\\n'], 'output': ['1448088\\r\\n']}, {'input': ['722477 814197 501318\\r\\n670293 164127 180084\\r\\n665889 389403 663253 449990 909406 240043\\r\\n'], 'output': ['1079436\\r\\n']}, {'input': ['701521 392984 524392\\r\\n462491 968267 126043\\r\\n328074 993331 895443 352976 984911 318865\\r\\n'], 'output': ['671841\\r\\n']}, {'input': ['-827584 -680412 -103147\\r\\n897186 313672 388429\\r\\n892050 717946 505625 200144 311983 606037\\r\\n'], 'output': ['1709658\\r\\n']}, {'input': ['381718 587052 14730\\r\\n290055 960762 231879\\r\\n646112 249417 451908 49140 819134 575870\\r\\n'], 'output': ['575870\\r\\n']}, {'input': ['4 4 4\\r\\n6 3 3\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['8 4 4\\r\\n10 3 3\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3 10 3\\r\\n6 6 6\\r\\n2 4 8 16 32 64\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1 3 1\\r\\n2 2 2\\r\\n1 2 4 8 16 32\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1 3\\r\\n2 2 2\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['4\\r\\n']}]","id":679} {"difficulty":2000,"lang":"Perl","lang_cluster":"Perl","src_uid":"374_A","execute_outcome":"WRONG_ANSWER","source_code":"($n,$m,$i,$j,$a,$b)=split\/ \/,<>;\r\n\r\n($n-$i)%$a==0 and ($m-$j)%$b==0 and (abs(($n-$i)\/$a-($m-$j)\/$b))%2==0 and \r\npush @_,(($n-$i)\/$a > ($m-$j)\/$b ? (($n-$i)\/$a) : (($m-$j)\/$b) );\r\n\r\n($i-1)%$a==0 and ($m-$j)%$b==0 and (abs(($i-1)\/$a-($m-$j)\/$b))%2==0 and \r\npush @_,(($i-1)\/$a > ($m-$j)\/$b ? (($i-1)\/$a) : (($m-$j)\/$b) );\r\n\r\n($n-$i)%$a==0 and ($j-1)%$b==0 and (abs(($n-$i)\/$a-($j-1)\/$b))%2==0 and \r\npush @_,(($n-$i)\/$a > ($j-1)\/$b ? (($n-$i)\/$a) : (($j-1)\/$b) );\r\n\r\n($i-1)%$a==0 and ($j-1)%$b==0 and (abs(($i-1)\/$a-($j-1)\/$b))%2==0 and \r\npush @_,(($i-1)\/$a > ($j-1)\/$b ? (($i-1)\/$a) : (($j-1)\/$b) );\r\n\r\n@_= sort {$a<=>$b} @_;\r\n\r\nif ($n<$a or $m<$b) {@_=() if $_[0]}\r\n\r\nprint @_? $_[0]:\"Poor Inna and pony!\"","description":"Dima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an n\u00d7m chessboard, a very tasty candy and two numbers a and b.Dima put the chessboard in front of Inna and placed the candy in position (i,j) on the board. The boy said he would give the candy if it reaches one of the corner cells of the board. He's got one more condition. There can only be actions of the following types: move the candy from position (x,y) on the board to position (x-a,y-b); move the candy from position (x,y) on the board to position (x+a,y-b); move the candy from position (x,y) on the board to position (x-a,y+b); move the candy from position (x,y) on the board to position (x+a,y+b). Naturally, Dima doesn't allow to move the candy beyond the chessboard borders.Inna and the pony started shifting the candy around the board. They wonder what is the minimum number of allowed actions that they need to perform to move the candy from the initial position (i,j) to one of the chessboard corners. Help them cope with the task! ","input_specification":"The first line of the input contains six integers n,m,i,j,a,b (1\u2264n,m\u226410^6;\u00a01\u2264i\u2264n;\u00a01\u2264j\u2264m;\u00a01\u2264a,b\u226410^6).\nYou can assume that the chessboard rows are numbered from 1 to n from top to bottom and the columns are numbered from 1 to m from left to right. Position (i,j) in the statement is a chessboard cell on the intersection of the i-th row and the j-th column. You can consider that the corners are: (1,m), (n,1), (n,m), (1,1).\n","output_specification":"In a single line print a single integer \u2014 the minimum number of moves needed to get the candy.\nIf Inna and the pony cannot get the candy playing by Dima's rules, print on a single line \"Poor Inna and pony!\" without the quotes.\n","notes":"Note to sample 1:\nInna and the pony can move the candy to position (1+2,3+2)=(3,5), from there they can move it to positions (3-2,5+2)=(1,7) and (3+2,5+2)=(5,7). These positions correspond to the corner squares of the chess board. Thus, the answer to the test sample equals two.\n","sample_inputs":["5 7 1 3 2 2\n","5 5 2 3 1 1\n"],"sample_outputs":["2\n","Poor Inna and pony!\n"],"human_solution":"($n,$m,$i,$j,$a,$b)=split\/ \/,<>;\r\n\r\n($n-$i)%$a==0 and ($m-$j)%$b==0 and (abs(($n-$i)\/$a-($m-$j)\/$b))%2==0 and \r\npush @_,(($n-$i)\/$a > ($m-$j)\/$b ? (($n-$i)\/$a) : (($m-$j)\/$b) );\r\n\r\n($i-1)%$a==0 and ($m-$j)%$b==0 and (abs(($i-1)\/$a-($m-$j)\/$b))%2==0 and \r\npush @_,(($i-1)\/$a > ($m-$j)\/$b ? (($i-1)\/$a) : (($m-$j)\/$b) );\r\n\r\n($n-$i)%$a==0 and ($j-1)%$b==0 and (abs(($n-$i)\/$a-($j-1)\/$b))%2==0 and \r\npush @_,(($n-$i)\/$a > ($j-1)\/$b ? (($n-$i)\/$a) : (($j-1)\/$b) );\r\n\r\n($i-1)%$a==0 and ($j-1)%$b==0 and (abs(($i-1)\/$a-($j-1)\/$b))%2==0 and \r\npush @_,(($i-1)\/$a > ($j-1)\/$b ? (($i-1)\/$a) : (($j-1)\/$b) );\r\n\r\n@_= sort {$a<=>$b} @_;\r\n\r\nif ($n<=$a or $m<=$b) {@_=() if $_[0]}\r\n\r\nprint @_? $_[0]:\"Poor Inna and pony!\"","testcases":"[{'input': ['5 7 1 3 2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5 2 3 1 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1 1 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['23000 15500 100 333 9 1\\r\\n'], 'output': ['15167\\r\\n']}, {'input': ['33999 99333 33000 99000 3 9\\r\\n'], 'output': ['333\\r\\n']}, {'input': ['5 7 1 3 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 100 1 50 1 50\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1000 1 1 1 1 500\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['304 400 12 20 4 4\\r\\n'], 'output': ['95\\r\\n']}, {'input': ['1000000 1000000 1000000 1000000 1000000 1000000\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1000000 99999 12345 23456 23 54\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['50000 100000 500 1000 500 1000\\r\\n'], 'output': ['99\\r\\n']}, {'input': ['50000 100000 500 1000 500 2000\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['50000 100000 500 1000 500 500\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['99999 99999 1 2 1 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['5 4 2 3 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['5 4 2 3 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 5 1 3 1 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['2347 2348 234 48 238 198\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1000000 2 2 2 2 1\\r\\n'], 'output': ['499999\\r\\n']}, {'input': ['100 100 50 50 500 500\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1000 2000 100 200 90 90\\r\\n'], 'output': ['20\\r\\n']}, {'input': ['1000 1000 10 15 10 5\\r\\n'], 'output': ['197\\r\\n']}, {'input': ['23000 15500 100 333 9 1\\r\\n'], 'output': ['15167\\r\\n']}, {'input': ['5 5 4 3 1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 5 4 4 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 5 4 2 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 3 2 2 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['5 8 4 1 2 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['5 8 4 2 1 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 8 1 2 1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000 1000000 500000 500000 1 1\\r\\n'], 'output': ['499999\\r\\n']}, {'input': ['500000 100000 400 80000 2 2\\r\\n'], 'output': ['249800\\r\\n']}, {'input': ['1004 999004 4 4 5 5\\r\\n'], 'output': ['199800\\r\\n']}, {'input': ['11 11 3 3 4 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100 100 70 5 1 1\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['1 5 1 3 1 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1 5 1 3 10 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['6 1 5 1 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['2 10 1 5 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['5 1 3 1 1 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['1000 1000 1 3 10000 1\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['2 6 1 2 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['2 6 1 2 6 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['7 1 5 1 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['2 20 2 5 2 2\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}, {'input': ['4 4 3 4 1 5\\r\\n'], 'output': ['Poor Inna and pony!\\r\\n']}]","id":680} {"difficulty":1800,"lang":"Perl","lang_cluster":"Perl","src_uid":"3_C","execute_outcome":"WRONG_ANSWER","source_code":"#!usr\/bin\/perl\nuse warnings;\nuse strict;\n\nsub win($){\n my $bard=shift;\n if(($bard=~\/[X]{3}\/)||($bard=~\/[0]{3}\/)){\n\treturn 1;\n }\n elsif(($bard=~\/[X].{3}[X].{3}[X]\/)||($bard=~\/[0].{3}[0].{3}[0]\/)){\n\treturn 1;\n }\n elsif(($bard=~\/[X].{4}[X].{4}[X]\/)||($bard=~\/[0].{4}[0].{4}[0]\/)){\n\treturn 1;\n }\n elsif(($bard=~\/..[X].{2}[X].{2}[X]\/)||($bard=~\/..[0].{2}[0].{2}[0]\/)){\n\treturn 1;\n }\n else{\n\treturn 0;\n }\n}\n\nmy $fl=;chomp($fl);my $sl=;chomp($sl);my $tl=;chomp($tl);\nmy $board=$fl.' '.$sl.' '.$tl;\nmy $boz=$board=~s\/[X]\/\/rg;my $box=$board=~s\/[0]\/\/rg;my $bod=$board=~s\/[\\.]\/\/rg;\nmy $k=length($box)1)){\n print \"illegal\\n\";\n}\nelse{\n if(win($board)){\n\tmy $blz=$board=~s\/[X]\/P\/rg;my $blx=$board=~s\/[0]\/P\/rg;\n\tif(win($blz)||win($blx)){\n\t print \"illegal\\n\";\n\t}\n\telse{\n\t if(length($bod)%2==0){\n\t\tprint \"the second player won\\n\";\n\t }\n\t else{\n\t\tprint \"the first player won\\n\";\n\t }\n\t}\n }\n elsif(length($bod)==11){\n\tprint \"draw\\n\";\n }\n else{\n\tif(length($bod)%2==0){\n\t print \"first\\n\";\n\t}\n\telse{\n\t print \"second\\n\";\n\t}\n }\n}","description":"Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3\u00d73 grid (one player always draws crosses, the other \u2014 noughts). The player who succeeds first in placing three of his marks in a horizontal, vertical or diagonal line wins, and the game is finished. The player who draws crosses goes first. If the grid is filled, but neither Xs, nor 0s form the required line, a draw is announced.You are given a 3\u00d73 grid, each grid cell is empty, or occupied by a cross or a nought. You have to find the player (first or second), whose turn is next, or print one of the verdicts below: illegal \u2014 if the given board layout can't appear during a valid game; the first player won \u2014 if in the given board layout the first player has just won; the second player won \u2014 if in the given board layout the second player has just won; draw \u2014 if the given board layout has just let to a draw. ","input_specification":"The input consists of three lines, each of the lines contains characters \".\", \"X\" or \"0\" (a period, a capital letter X, or a digit zero).\n","output_specification":"Print one of the six verdicts: first, second, illegal, the first player won, the second player won or draw.\n","notes":null,"sample_inputs":["X0X\n.0.\n.X.\n"],"sample_outputs":["second\n"],"human_solution":"#!usr\/bin\/perl\nuse warnings;\nuse strict;\n\nsub win($){\n my $bard=shift;\n if(($bard=~\/[X]{3}\/)||($bard=~\/[0]{3}\/)){\n\treturn 1;\n }\n elsif(($bard=~\/[X].{3}[X].{3}[X]\/)||($bard=~\/[0].{3}[0].{3}[0]\/)){\n\treturn 1;\n }\n elsif(($bard=~\/[X].{4}[X].{4}[X]\/)||($bard=~\/[0].{4}[0].{4}[0]\/)){\n\treturn 1;\n }\n elsif(($bard=~\/..[X].{2}[X].{2}[X]\/)||($bard=~\/..[0].{2}[0].{2}[0]\/)){\n\treturn 1;\n }\n else{\n\treturn 0;\n }\n}\n\nmy $fl=;chomp($fl);my $sl=;chomp($sl);my $tl=;chomp($tl);\nmy $board=$fl.' '.$sl.' '.$tl;\nmy $boz=$board=~s\/[X]\/\/rg;my $box=$board=~s\/[0]\/\/rg;my $bod=$board=~s\/[\\.]\/\/rg;\nmy $k=length($box)1)){\n print \"illegal\\n\";\n}\nelse{\n if(win($board)){\n\tmy $blz=$board=~s\/[X]\/P\/rg;my $blx=$board=~s\/[0]\/P\/rg;\n\tif(length($bod)%2==0){\n\t if(win($blx)){\n\t\tprint \"illegal\\n\";\n\t }\n\t else{\n\t\tprint \"the second player won\\n\";\n\t }\n\t}\n\telse{\n\t if(win($blz)){\n\t\tprint \"illegal\\n\";\n\t }\n\t else{\n\t\tprint \"the first player won\\n\";\n\t }\n\t}\n }\n elsif(length($bod)==11){\n\tprint \"draw\\n\";\n }\n else{\n\tif(length($bod)%2==0){\n\t print \"first\\n\";\n\t}\n\telse{\n\t print \"second\\n\";\n\t}\n }\n}","testcases":"[{'input': ['X0X\\r\\n.0.\\r\\n.X.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['0.X\\r\\nXX.\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XXX\\r\\n.0.\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.X\\r\\nX..\\r\\n00.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['X.X\\r\\nX.0\\r\\n0.0\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['XXX\\r\\nX00\\r\\nX00\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['000\\r\\nX.X\\r\\nX.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XXX\\r\\n0.0\\r\\n0..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\n0X0\\r\\nX0X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX.\\r\\nX0X\\r\\nX..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\n0X0\\r\\nX..\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX0\\r\\n0..\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XXX\\r\\n0..\\r\\n.0.\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XXX\\r\\nX..\\r\\n.00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X00\\r\\n0.0\\r\\nXX0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0.0\\r\\n0XX\\r\\n..0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.00\\r\\nX.X\\r\\n0..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..0\\r\\n.00\\r\\n.0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..0\\r\\n0..\\r\\n00X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..0\\r\\n.XX\\r\\nX..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0.X\\r\\n0X0\\r\\n.00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..X\\r\\n0X0\\r\\n0X.\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['0X0\\r\\nX..\\r\\nX.0\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['.0.\\r\\nX.X\\r\\n0..\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['0X0\\r\\n00X\\r\\n.00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.0.\\r\\n.X0\\r\\nX..\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['00X\\r\\n0.X\\r\\n00X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00X\\r\\n0XX\\r\\n0X.\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X00\\r\\n..0\\r\\nX.X\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['X00\\r\\nX00\\r\\n.X0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\n.X0\\r\\n0..\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['..0\\r\\nXXX\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0..\\r\\n000\\r\\nX0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.00\\r\\n0X.\\r\\n0.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X..\\r\\nX00\\r\\n0.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.X0\\r\\nXX0\\r\\nX.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.X\\r\\n0.0\\r\\nX..\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['00X\\r\\n.00\\r\\n..0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..0\\r\\n0.X\\r\\n00.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0.X\\r\\nX0X\\r\\n.X0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0X.\\r\\n.X.\\r\\n0X0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00.\\r\\nX0.\\r\\n..X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..X\\r\\n.00\\r\\nXX.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['.00\\r\\n.0.\\r\\n.X.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\nX.0\\r\\nXX0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00.\\r\\n00.\\r\\nX.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X00\\r\\nX.0\\r\\nX.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0X.\\r\\n0XX\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00.\\r\\n00.\\r\\n.X.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\n00.\\r\\n0.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\nXXX\\r\\n0X0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\n..X\\r\\nXX0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0X.\\r\\n..X\\r\\nX..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..X\\r\\n.0.\\r\\n0..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00X\\r\\nXX.\\r\\n00X\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['..0\\r\\nXX0\\r\\n..X\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['.0.\\r\\n.00\\r\\nX00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X00\\r\\n.XX\\r\\n00.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.00\\r\\n0.X\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0.\\r\\n..0\\r\\nX.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\n.XX\\r\\n00.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['0X.\\r\\n00.\\r\\n.X.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..X\\r\\nX00\\r\\n0.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.X\\r\\n0X.\\r\\n.0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\nX.X\\r\\n00.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['.0X\\r\\n.00\\r\\n00.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.XX\\r\\nXXX\\r\\n0..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\n.X0\\r\\n.0.\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['X00\\r\\n0.X\\r\\nX..\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['X..\\r\\n.X0\\r\\nX0.\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['.0X\\r\\nX..\\r\\nXXX\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X0X\\r\\nXXX\\r\\nX.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.00\\r\\nX0.\\r\\n00X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0XX\\r\\n.X0\\r\\n0.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00X\\r\\nXXX\\r\\n..0\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X..\\r\\n0X0\\r\\nX.0\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['..0\\r\\n.00\\r\\nX.0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.XX\\r\\n.0.\\r\\nX0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00.\\r\\n0XX\\r\\n..0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.0.\\r\\n00.\\r\\n00.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00.\\r\\n000\\r\\nX.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0X0\\r\\n.X0\\r\\n.X.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['00X\\r\\n0..\\r\\n0..\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.X.\\r\\n.X0\\r\\nX.0\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['.0.\\r\\n0X0\\r\\nX0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..0\\r\\nXX.\\r\\n00X\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['0.X\\r\\n.0X\\r\\nX00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['..X\\r\\n0X.\\r\\n.0.\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['..X\\r\\nX.0\\r\\n.0X\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['X0.\\r\\n.0X\\r\\nX0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.X0\\r\\nXX0\\r\\n0..\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['.0.\\r\\n0.0\\r\\n0.X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX.\\r\\n.X0\\r\\n.0X\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.0.\\r\\nX0X\\r\\nX00\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0X.\\r\\n.X0\\r\\nX..\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['..0\\r\\n0X.\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['0.0\\r\\nX.X\\r\\nXX.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['.X.\\r\\n.XX\\r\\nX0.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.X\\r\\n.XX\\r\\n0X.\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.0\\r\\n0XX\\r\\n..0\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['X.0\\r\\n0XX\\r\\n.X0\\r\\n'], 'output': ['second\\r\\n']}, {'input': ['X00\\r\\n0XX\\r\\n.X0\\r\\n'], 'output': ['first\\r\\n']}, {'input': ['X00\\r\\n0XX\\r\\nXX0\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['X00\\r\\n0XX\\r\\n0X0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XXX\\r\\nXXX\\r\\nXXX\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['000\\r\\n000\\r\\n000\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['XX0\\r\\n00X\\r\\nXX0\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['X00\\r\\n00X\\r\\nXX0\\r\\n'], 'output': ['illegal\\r\\n']}, {'input': ['X.0\\r\\n00.\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X..\\r\\nX0.\\r\\nX0.\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['.XX\\r\\n000\\r\\nXX0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X0.\\r\\nX.X\\r\\nX00\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['00X\\r\\nX00\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XXX\\r\\n.00\\r\\nX0.\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX0\\r\\n000\\r\\nXX.\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['.X0\\r\\n0.0\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0XX\\r\\nX00\\r\\n0XX\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['0XX\\r\\nX0X\\r\\n00X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX0\\r\\n0XX\\r\\n0X0\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0X0\\r\\nX0X\\r\\nX0X\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['X0X\\r\\n0XX\\r\\n00X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0XX\\r\\nX0.\\r\\nX00\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X.0\\r\\n0X0\\r\\nXX0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X0X\\r\\nX0X\\r\\n0X0\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['X.0\\r\\n00X\\r\\n0XX\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['00X\\r\\nX0X\\r\\n.X0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X0X\\r\\n.00\\r\\nX0X\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['0XX\\r\\nX00\\r\\nX0X\\r\\n'], 'output': ['draw\\r\\n']}, {'input': ['000\\r\\nX0X\\r\\n.XX\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['0.0\\r\\n0.X\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X.0\\r\\nX0.\\r\\n0X.\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X0X\\r\\n0X0\\r\\n..X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0X0\\r\\nXX0\\r\\n.X.\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X0.\\r\\n.X.\\r\\n0.X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0XX\\r\\nX00\\r\\n.X0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['0.0\\r\\nXXX\\r\\n0.X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['.0X\\r\\n.X.\\r\\nX.0\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XXX\\r\\nX.0\\r\\n0.0\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX0\\r\\nX..\\r\\nX00\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XXX\\r\\n00X\\r\\n00X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X00\\r\\n00X\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0X0\\r\\nX0X\\r\\n0X.\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['XX0\\r\\nX00\\r\\n0X.\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['..X\\r\\n0X0\\r\\nX..\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X0.\\r\\n00.\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0.X\\r\\nX00\\r\\nXX0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['X0.\\r\\n0X.\\r\\n..X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['00X\\r\\nX0.\\r\\nXX0\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['XX.\\r\\n000\\r\\n0XX\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['..X\\r\\n0.X\\r\\n.0X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X00\\r\\n.0X\\r\\n0XX\\r\\n'], 'output': ['the second player won\\r\\n']}, {'input': ['00X\\r\\n0X.\\r\\nXX.\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X00\\r\\nXX.\\r\\n0.X\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XXX\\r\\n00X\\r\\n0X0\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['X00\\r\\nXX0\\r\\n0XX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['0X0\\r\\nX00\\r\\nXXX\\r\\n'], 'output': ['the first player won\\r\\n']}, {'input': ['XX0\\r\\nX00\\r\\n.X0\\r\\n'], 'output': ['the second player won\\r\\n']}]","id":681} {"difficulty":1900,"lang":"Perl","lang_cluster":"Perl","src_uid":"45_D","execute_outcome":"WRONG_ANSWER","source_code":"sub compare { $a <=> $b }\r\nsub max { my ($a, $b) = @_; $a > $b? $a: $b }\r\n\r\n(undef, @input) = ;\r\nfor (@input) { push @p, (split)[0] }\r\n@p = sort compare @p;\r\n\r\nfor $p (@p) {\r\n\t$d = max $p, $d;\r\n\tpush @r, $d;\r\n\t$d++;\r\n}\r\n\r\nprint \"@r\";","description":"On a history lesson the teacher asked Vasya to name the dates when n famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [li,ri] (inclusive) on which the event could have taken place. However Vasya also remembers that there was at most one event in one day. Help him choose such n dates of famous events that will fulfill both conditions. It is guaranteed that it is possible.","input_specification":"The first line contains one integer n (1\u2264n\u2264100) \u2014 the number of known events. Then follow n lines containing two integers li and ri each (1\u2264li\u2264ri\u226410^7) \u2014 the earliest acceptable date and the latest acceptable date of the i-th event.\n","output_specification":"Print n numbers \u2014 the dates on which the events took place. If there are several solutions, print any of them. It is guaranteed that a solution exists.\n","notes":null,"sample_inputs":["3\n1 2\n2 3\n3 4\n","2\n1 3\n1 3\n"],"sample_outputs":["1 2 3 \n","1 2 \n"],"human_solution":"sub max { my ($a, $b) = @_; $a > $b? $a: $b }\r\nsub priority { max($a->{start}, $current) <=> max($b->{start}, $current) || $a->{end} <=> $b->{end} }\r\n\r\n(undef, @input) = ;\r\nfor (@input) { \r\n\t@val = split;\r\n\tpush @p, {start => $val[0], end => $val[1], index => $i++ }\r\n}\r\n\r\nwhile (@p) {\r\n\t($p, @p) = sort priority @p;\t\r\n\t$current = max $p->{start}, $current;\r\n\t$r[ $p->{index} ] = $current++;\r\n}\r\n\r\nprint \"@r\";","testcases":"[{'input': ['3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n'], 'output': ['1 2 3 \\r\\n']}, {'input': ['2\\r\\n1 3\\r\\n1 3\\r\\n'], 'output': ['1 2 \\r\\n']}, {'input': ['10\\r\\n1 10\\r\\n3 4\\r\\n8 10\\r\\n3 4\\r\\n5 9\\r\\n1 4\\r\\n7 10\\r\\n1 9\\r\\n1 8\\r\\n4 10\\r\\n'], 'output': ['7 3 10 4 6 1 9 5 2 8 \\r\\n']}, {'input': ['10\\r\\n1 1\\r\\n8 10\\r\\n1 7\\r\\n6 8\\r\\n5 7\\r\\n1 9\\r\\n8 8\\r\\n6 10\\r\\n1 4\\r\\n3 4\\r\\n'], 'output': ['1 10 4 6 5 7 8 9 2 3 \\r\\n']}, {'input': ['10\\r\\n1 2\\r\\n1 3\\r\\n1 9\\r\\n10 10\\r\\n4 4\\r\\n5 9\\r\\n2 5\\r\\n7 8\\r\\n2 10\\r\\n7 10\\r\\n'], 'output': ['1 2 5 10 4 6 3 7 8 9 \\r\\n']}, {'input': ['10\\r\\n4 12\\r\\n2 8\\r\\n1 12\\r\\n6 8\\r\\n4 6\\r\\n12 12\\r\\n3 10\\r\\n1 10\\r\\n3 3\\r\\n1 10\\r\\n'], 'output': ['9 2 8 6 4 12 7 1 3 5 \\r\\n']}, {'input': ['10\\r\\n6 7\\r\\n5 11\\r\\n5 10\\r\\n9 10\\r\\n11 12\\r\\n6 12\\r\\n7 11\\r\\n1 1\\r\\n5 9\\r\\n2 8\\r\\n'], 'output': ['6 8 7 9 12 11 10 1 5 2 \\r\\n']}, {'input': ['10\\r\\n3 11\\r\\n2 12\\r\\n7 12\\r\\n5 5\\r\\n6 6\\r\\n1 11\\r\\n11 11\\r\\n1 12\\r\\n1 10\\r\\n7 11\\r\\n'], 'output': ['3 8 9 5 6 2 11 4 1 7 \\r\\n']}, {'input': ['10\\r\\n1 4\\r\\n1 12\\r\\n5 7\\r\\n5 5\\r\\n2 5\\r\\n1 7\\r\\n1 10\\r\\n7 9\\r\\n8 9\\r\\n9 11\\r\\n'], 'output': ['1 10 6 5 2 3 4 7 8 9 \\r\\n']}, {'input': ['10\\r\\n1 2\\r\\n10 12\\r\\n5 12\\r\\n1 7\\r\\n1 6\\r\\n11 12\\r\\n3 8\\r\\n7 9\\r\\n11 12\\r\\n5 6\\r\\n'], 'output': ['1 10 6 3 2 11 4 7 12 5 \\r\\n']}, {'input': ['10\\r\\n6 9\\r\\n1 8\\r\\n6 12\\r\\n8 15\\r\\n2 5\\r\\n1 2\\r\\n7 15\\r\\n12 15\\r\\n5 12\\r\\n8 15\\r\\n'], 'output': ['6 3 7 9 2 1 8 12 5 10 \\r\\n']}, {'input': ['10\\r\\n2 4\\r\\n10 13\\r\\n1 10\\r\\n6 13\\r\\n9 12\\r\\n1 10\\r\\n13 15\\r\\n1 11\\r\\n1 7\\r\\n5 6\\r\\n'], 'output': ['2 10 3 7 9 4 13 6 1 5 \\r\\n']}, {'input': ['10\\r\\n15 15\\r\\n6 6\\r\\n1 6\\r\\n7 15\\r\\n3 13\\r\\n10 15\\r\\n6 13\\r\\n1 9\\r\\n2 14\\r\\n12 13\\r\\n'], 'output': ['15 6 1 8 3 10 7 2 4 12 \\r\\n']}, {'input': ['10\\r\\n10 10\\r\\n13 15\\r\\n6 14\\r\\n3 15\\r\\n4 15\\r\\n11 12\\r\\n11 15\\r\\n8 15\\r\\n1 11\\r\\n1 9\\r\\n'], 'output': ['10 13 6 3 4 11 12 8 2 1 \\r\\n']}, {'input': ['10\\r\\n12 12\\r\\n6 13\\r\\n5 9\\r\\n7 11\\r\\n1 12\\r\\n11 15\\r\\n3 13\\r\\n1 14\\r\\n6 8\\r\\n10 10\\r\\n'], 'output': ['12 8 5 7 1 11 3 2 6 10 \\r\\n']}, {'input': ['10\\r\\n1 6\\r\\n4 10\\r\\n1 5\\r\\n5 10\\r\\n1 8\\r\\n4 5\\r\\n1 8\\r\\n4 8\\r\\n5 10\\r\\n10 10\\r\\n'], 'output': ['2 7 1 8 3 4 5 6 9 10 \\r\\n']}, {'input': ['10\\r\\n2 8\\r\\n8 10\\r\\n1 6\\r\\n1 10\\r\\n7 10\\r\\n1 9\\r\\n6 8\\r\\n3 4\\r\\n1 3\\r\\n5 8\\r\\n'], 'output': ['4 10 2 8 9 7 6 3 1 5 \\r\\n']}]","id":682} {"difficulty":2700,"lang":"Perl","lang_cluster":"Perl","src_uid":"774_F","execute_outcome":"WRONG_ANSWER","source_code":"use strict;\r\nuse warnings;\r\nchomp(my $n = );\r\nmy @arr;\r\nmy $dig;\r\nchomp(my $str = );\r\n@arr = split \/ \/, $str; \r\nmy $t = @arr;\r\nforeach (@arr)\r\n{\r\n\t$_-=($t-1);\r\n}\r\n#say @arr;\r\nmy $q = 0;\r\nmy $o = $t -1; \r\nwhile(($o)*$n>7)\r\n{\r\n\t$arr[($o*$n)%7]++;\r\n\t$o-=1;\r\n}\r\n\r\n#$q = 7*($t-1)%($n);\r\n$q =1;\r\n#say @arr;\r\n#say $q;\r\nmy $k = 0;\r\nmy $flag =0;\r\nwhile ($flag==0)\r\n{\r\n\tfor my $i (($k+$q)..($n+$k))\r\n\t{\r\n\t\tmy $r = $i-$k;\r\n\t\tif($i%7>0){\r\n\t\t\t$arr[$r]-=1;\r\n\t\t\t}\r\n\t\tif ($arr[$r] ==0)\r\n\t\t{\r\n\t\t\tmy $ans= $r+1;\r\n\t\t\tprint $ans;\r\n\t\t\t$flag =1;\r\n\t\t\tlast;\r\n\t\t}\r\n#\tsay @arr;\r\n\t}\r\n\t$k = $n+$k;\r\n\t$q = 1;\r\n}\r\n#say @arr;\r\n1;\r\n","description":"Stepan has n pens. Every day he uses them, and on the i-th day he uses the pen number i. On the (n+1)-th day again he uses the pen number 1, on the (n+2)-th \u2014 he uses the pen number 2 and so on.On every working day (from Monday to Saturday, inclusive) Stepan spends exactly 1 milliliter of ink of the pen he uses that day. On Sunday Stepan has a day of rest, he does not stend the ink of the pen he uses that day. Stepan knows the current volume of ink in each of his pens. Now it's the Monday morning and Stepan is going to use the pen number 1 today. Your task is to determine which pen will run out of ink before all the rest (that is, there will be no ink left in it), if Stepan will use the pens according to the conditions described above.","input_specification":"The first line contains the integer n (1\u2264n\u226450000) \u2014 the number of pens Stepan has.\nThe second line contains the sequence of integers a1,a2,...,an (1\u2264ai\u226410^9), where ai is equal to the number of milliliters of ink which the pen number i currently has.\n","output_specification":"Print the index of the pen which will run out of ink before all (it means that there will be no ink left in it), if Stepan will use pens according to the conditions described above. \nPens are numbered in the order they are given in input data. The numeration begins from one. \nNote that the answer is always unambiguous, since several pens can not end at the same time.\n","notes":"In the first test Stepan uses ink of pens as follows: \n on the day number 1 (Monday) Stepan will use the pen number 1, after that there will be 2 milliliters of ink in it; on the day number 2 (Tuesday) Stepan will use the pen number 2, after that there will be 2 milliliters of ink in it; on the day number 3 (Wednesday) Stepan will use the pen number 3, after that there will be 2 milliliters of ink in it; on the day number 4 (Thursday) Stepan will use the pen number 1, after that there will be 1 milliliters of ink in it; on the day number 5 (Friday) Stepan will use the pen number 2, after that there will be 1 milliliters of ink in it; on the day number 6 (Saturday) Stepan will use the pen number 3, after that there will be 1 milliliters of ink in it; on the day number 7 (Sunday) Stepan will use the pen number 1, but it is a day of rest so he will not waste ink of this pen in it; on the day number 8 (Monday) Stepan will use the pen number 2, after that this pen will run out of ink. So, the first pen which will not have ink is the pen number 2.\n","sample_inputs":["3\n3 3 3\n","5\n5 4 5 4 4\n"],"sample_outputs":["2\n","5\n"],"human_solution":"my $n = <>;\r\n$_ = <>; my @A = split;\r\nif(int($n) % 7 == 0){\r\n\t$z = -1;\r\n\tfor($i = 0; $i < int($n); $i += 1){\r\n\t\tif($i % 7 != 6){\r\n\t\t\tif(($z == -1) || (int($A[$z]) > int($A[$i]))){\r\n\t\t\t\t$z = $i;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tprint $z + 1;\r\n\r\n}else{\r\n\r\n$z = 1000000000;\r\nforeach(@A){\r\n\t$x = int($_)-1;\r\n\twhile($x % 6 != 0){\r\n\t\t$x -= 1;\r\n\t}\r\n\t$z = $x if($x < $z);\r\n}\r\nfor($i = 0; $i < $n; $i += 1){\r\n\t$A[$i] = int($A[$i]) - $z;\r\n}\r\n$i = -1;\r\n$t = 0;\r\n$g = 1;\r\nwhile($g != 0){\r\n\t$t += 1; $t = 0 if($t == 7);\r\n\t$i += 1; $i = 0 if($i == $n);\r\n\tif($t != 0){\r\n\t\t$A[$i] -= 1;\r\n\t\tif($A[$i] == 0){\r\n\t\t\tprint $i+1;\r\n\t\t\t$g = 0;\r\n\t\t}\r\n\t}\r\n}\r\n\r\n}\r\n","testcases":"[{'input': ['3\\r\\n3 3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n5 4 5 4 4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['28\\r\\n2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033 2033\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n10 10 10 10 10 10 10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['28\\r\\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['21\\r\\n996 995 996 996 996 996 995 996 996 995 996 996 995 996 995 995 995 995 996 996 996\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['28\\r\\n2033 2033 2034 2033 2034 2034 2033 2034 2033 2034 2033 2034 2034 2033 2033 2034 2034 2033 2034 2034 2034 2033 2034 2033 2034 2034 2034 2034\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1123\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1000000000 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n999999999 999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n1000000000 1000000000 1000000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3\\r\\n999999999 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n999999999 999999999 999999999 999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n999999999 1000000000 999999999 1000000000 999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['6\\r\\n1000000000 999999999 999999999 999999999 1000000000 1000000000\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['7\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n1000000000 1000000000 1000000000 1000000000 999999999 999999999 999999999\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['8\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['8\\r\\n1000000000 999999999 1000000000 999999999 1000000000 999999999 999999999 999999999\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['7\\r\\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1\\r\\n'], 'output': ['1\\r\\n']}]","id":683} {"difficulty":1200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"102_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils,math;\r\n\r\nvar\r\n a:array[0..101,0..101] of boolean;\r\n b:array[0..101] of longint;\r\n i,j,n,m,x,y,k,ans:longint;\r\n\r\nbegin\r\n read(n,m);\r\n for i:=1 to n do\r\n read(b[i]);\r\n for i:=1 to m do\r\n begin\r\n read(x,y);\r\n a[x][y]:=true;\r\n a[y][x]:=true;\r\n end;\r\n ans:=maxlongint;\r\n for i:=1 to n do\r\n for j:=1 to n do\r\n for k:=1 to n do\r\n if (a[i][j]) and (a[i][k]) and (a[k][j]) then\r\n ans:=min(ans,b[i]+b[j]+b[k]);\r\n writeln(ans);\r\nend.\r\n","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 ().\nNext line contains n integers ai (1\u2264ai\u226410^6) \u2014 the prices of the clothing items in rubles.\nNext m lines each contain a pair of space-separated integers ui and vi (1\u2264ui,vi\u2264n,ui\u2260vi). 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,vi) are different.\n","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).\n","notes":"In 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.\nThe 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.\nIn the third example there are 4 pieces of clothing, but Gerald can't buy any 3 of them simultaneously. The answer is -1.\n","sample_inputs":["3 3\n1 2 3\n1 2\n2 3\n3 1\n","3 2\n2 3 4\n2 3\n2 1\n","4 4\n1 1 1 1\n1 2\n2 3\n3 4\n4 1\n"],"sample_outputs":["6\n","-1\n","-1\n"],"human_solution":"{$R+ Q+ I+}\r\n{$APPTYPE CONSOLE}\r\nuses\r\n Sysutils;\r\nvar\r\n c : array[1..100,1..100] of boolean;\r\n a : array[1..100] of integer;\r\n s,min,m,n,i,j,k,x,y : integer;\r\nbegin\r\n read(n,m);\r\n for i := 1 to n do read(a[i]);\r\n for i := 1 to m do begin\r\n read(x,y);\r\n c[x][y] := true;\r\n c[y][x] := true;\r\n end;\r\n min := high(min);\r\n for i := 1 to n - 2 do begin\r\n s := a[i];\r\n for j := i + 1 to n - 1 do\r\n if (c[i][j] = true) then begin\r\n s := s + a[j];\r\n for k := j + 1 to n do\r\n if (c[j][k] = true) and (c[i][k] = true) then begin\r\n s := s + a[k];\r\n if s < min then min := s;\r\n s := s - a[k];\r\n end;\r\n s := s - a[j];\r\n end;\r\n end;\r\n if min = high(min) then min := -1;\r\n write(min);\r\n\r\nend.","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":684} {"difficulty":1100,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"1042_A","execute_outcome":"WRONG_ANSWER","source_code":"program passwordick;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n a: array [1..100]of integer;\r\n n, m, i, max, s: integer;\r\nbegin\r\n readln (n);\r\n readln (m);\r\n max := -1;\r\n for i := 1 to n do\r\n begin\r\n readln (a[i]);\r\n if a[i] > max then\r\n max := a[i];\r\n end;\r\n\r\n s := 0;\r\n for i := 1 to n do\r\n s := s + max - a[i];\r\n\r\n i := (m - s)div n + max;\r\n \/\/writeln (n,' ',m,' ',s,' ',max,' ',i );\r\n if ((m - s) mod n > 0) then\r\n inc(i);\r\n writeln (i, ' ', max + m);\r\n readln;\r\nend.\r\n","description":"There are $$$n$$$ benches in the Berland Central park. It is known that $$$a_i$$$ people are currently sitting on the $$$i$$$-th bench. Another $$$m$$$ people are coming to the park and each of them is going to have a seat on some bench out of $$$n$$$ available.Let $$$k$$$ be the maximum number of people sitting on one bench after additional $$$m$$$ people came to the park. Calculate the minimum possible $$$k$$$ and the maximum possible $$$k$$$.Nobody leaves the taken seat during the whole process.","input_specification":"The first line contains a single integer $$$n$$$ $$$(1 \\\\le n \\\\le 100)$$$ \u2014 the number of benches in the park.\nThe second line contains a single integer $$$m$$$ $$$(1 \\\\le m \\\\le 10\\\\,000)$$$ \u2014 the number of people additionally coming to the park.\nEach of the next $$$n$$$ lines contains a single integer $$$a_i$$$ $$$(1 \\\\le a_i \\\\le 100)$$$ \u2014 the initial number of people on the $$$i$$$-th bench.\n","output_specification":"Print the minimum possible $$$k$$$ and the maximum possible $$$k$$$, where $$$k$$$ is the maximum number of people sitting on one bench after additional $$$m$$$ people came to the park.\n","notes":"In the first example, each of four benches is occupied by a single person. The minimum $$$k$$$ is $$$3$$$. For example, it is possible to achieve if two newcomers occupy the first bench, one occupies the second bench, one occupies the third bench, and two remaining \u2014 the fourth bench. The maximum $$$k$$$ is $$$7$$$. That requires all six new people to occupy the same bench.\nThe second example has its minimum $$$k$$$ equal to $$$15$$$ and maximum $$$k$$$ equal to $$$15$$$, as there is just a single bench in the park and all $$$10$$$ people will occupy it.\n","sample_inputs":["4\n6\n1\n1\n1\n1\n","1\n10\n5\n","3\n6\n1\n6\n5\n","3\n7\n1\n6\n5\n"],"sample_outputs":["3 7\n","15 15\n","6 12\n","7 13\n"],"human_solution":" const eps=0.000000001; besk1=200000008; nn=2600000;\r\n { modul=1000000007; }\r\n besk=8000000000000000000;\r\n label 22,1,2,3,4;\r\n type real=extended; double=extended;\r\n mas=array [-100000..nn] of int64; point=record x,y,z:real;end;\r\n zap=record p1,p2,p3 :int64;end; zap1=^zap;\r\n mass=array[0..nn] of longint;mass1=^mass;\r\n var kol,sq,sum,h,pmin,pmax,limit,posi,posj,diam,modul,oldt,ot1,time,pos,prod,ll,rr,posx,posy,gr,n,dloch,newdl,oldn,oldm,ost,ot,aa,bb,cc,p1,p2,p3,p4,kk,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,x0,p0,t2,t1,jj,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,t,nm,m,smin,cen:int64;\r\n pp0,mask,k,i1,j1,step1, step, i,j:longint;\r\n y:mas;\r\n ppp,prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;\r\n oldpos,finot,vv,znak:int64;\r\n aold:mas;\r\n sumkonfig,konfig:array[-1000..200000,-1..10] of int64;\r\n xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;\r\n del:array[-1..100001,-1..150] of longint;\r\n x1,y1,z1,z2,kolnul,a,fact,next,prev,x,xx,yy,str,s,name,d,dnew, voltay,l,r,c,z,day,b:mas;\r\n zz:array[0..125000000] of byte;\r\n ppole:array[-10..1002,-10..1005] of char;\r\n pole,ddd,dd2,dd3,dd4,dd:array[-10..4201,-10..4220] of int64;\r\n dd1,ddsum:array[-1..4200,-1..100] of int64;\r\n newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;\r\n sss1,sss2:string;\r\n def,left,right,udal,stepen,koled,dl,och,newoch,place,newnabor,stoim,nabor:array[-10..200005] of int64;\r\n zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;\r\n ss1,ss2,ss:string;ch,ch1,ch2:char;\r\n pr,hesh,numright,dr: array [-10..1060,-10..1060] of extended;\r\n s3,s2,s1:array[-100..500000] of string;\r\n\r\n grr :array [-10..2010,-10..2010] of boolean;\r\n maxpr:array[0..nn] of string;\r\n sss:array[-10..nn] of string;\r\n tx,ty,vel,ott,v0,v1,s0,t0:int64;\r\n zv:point;\r\n ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;\r\n mash,sqx,sqy,ottt,aaa,bbb,ccc:extended;\r\n xxx,yyy,yot:double;\r\n flag2,flag,flag1:boolean;\r\n\r\n function max(a,b:int64):int64;\r\nbegin max:=a; if b>a then max:=b; end;\r\n\r\n function min(a,b:int64):int64;\r\nbegin min:=a; if b0)and(y>=0) then p:=arctan(y\/x);\r\n if x<0 then p:=pi+arctan(y\/x);\r\n if(x>0)and(y<0) then p:=2*pi+arctan(y\/x);\r\n if x=0 then if (y>=0) then p:=pi\/2 else p:=3*pi\/2;\r\n al:=p{\/pi*180};\r\n end;\r\n\r\n\r\nfunction degg(a,k:int64):int64; var p:int64;\r\nbegin\r\n if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else\r\n begin p:=degg(a,k shr 1); degg:=p*p mod modul; end;\r\n\r\nend;\r\n\r\n{function prost(tt:longint):boolean;\r\nvar aa:extended; i,p,t:longint; fl:boolean;\r\n begin\r\n fl:=true;\r\n aa:=tt;\r\n aa:=sqrt(aa);\r\n t:=round(aa);\r\n for i:=2 to t do if tt mod i=0 then fl:=false;\r\n\r\n\r\n prost:=fl;\r\n end;\r\n }\r\nfunction arcsin(pp:extended):extended;\r\nvar tt:extended;\r\nbegin\r\n if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)\r\n then if pp>0 then arcsin:=pi\/2 else arcsin:=-pi\/2;\r\n tt:=1-pp*pp;\r\n if abs(tt)>=0 then\r\n begin\r\n arcsin:=arctan(pp\/sqrt(tt));\r\n\r\n end;\r\n\r\n\r\n\r\nend;\r\n\r\nfunction gl(ch:char):boolean;\r\nbegin\r\n if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;\r\n\r\nend;\r\n\r\nfunction zaprmax(left,right:longint):int64;\r\nbegin\r\n if left>=right then zaprmax:=y[left] else\r\n begin\r\n if not odd(left) and odd(right) then zaprmax:=zaprmax(left shr 1,right shr 1) else\r\n begin\r\n if odd(left) then zaprmax:=max(zaprmax(left+1,right),y[left]);\r\n if not odd(right) then zaprmax:=max(zaprmax(left,right-1),y[right]);\r\n\r\n end;\r\n\r\n end;\r\n\r\nend;\r\n\r\n\r\n function ff(gr:int64):boolean;\r\n\r\nvar ot,aa,bb,cc:int64; fl:boolean;\r\nbegin\r\n aa:=1; bb:=m; cc:=aa; fl:=false;\r\n while abs(aa-bb)>1 do\r\n begin\r\n cc:=(aa+bb) shr 1;\r\n if y[cc] 0) do begin\r\n if (mark[list[i]] <> 1) then\r\n dfs(list[i]);\r\n i := next[i]; \r\n end;\r\n dec(ct);\r\nend;\r\n\r\nbegin\r\n \/\/s\r\n readln(n);\r\n pos := 0;\r\n ans := 0;\r\n for i := 1 to n do begin\r\n readln(s);\r\n if (s <> -1) then\r\n add(i, s);\r\n end;\r\n for i := 1 to n do\r\n if (mark[i] <> 1) then begin\r\n ct := 0;\r\n dfs(i);\r\n end;\r\n \r\n writeln(ans);\r\n readln;\r\n readln;\r\nend.\r\n","description":"A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager of employee B Employee B has an immediate manager employee C such that employee A is the superior of employee C. The company will not have a managerial cycle. That is, there will not exist an employee who is the superior of his\/her own immediate manager.Today the company is going to arrange a party. This involves dividing all n employees into several groups: every employee must belong to exactly one group. Furthermore, within any single group, there must not be two employees A and B such that A is the superior of B.What is the minimum number of groups that must be formed?","input_specification":"The first line contains integer n (1\u2264n\u22642000) \u2014 the number of employees.\nThe next n lines contain the integers pi (1\u2264pi\u2264n or pi=-1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. \nIt is guaranteed, that no employee will be the immediate manager of him\/herself (pi\u2260i). Also, there will be no managerial cycles.\n","output_specification":"Print a single integer denoting the minimum number of groups that will be formed in the party.\n","notes":"For the first example, three groups are sufficient, for example: \n Employee 1 Employees 2 and 4 Employees 3 and 5 ","sample_inputs":["5\n-1\n1\n2\n1\n-1\n"],"sample_outputs":["3\n"],"human_solution":"var a:array[1..2000]of Integer;\r\n b:array[1..2000]of Boolean;\r\ni,n,r,t:Integer;\r\nfunction max(x:integer):Integer;\r\nbegin\r\n if a[x]=-1\r\n then max:=1\r\n else max:=max(a[x])+1;\r\nend;\r\nbegin\r\n \/\/reset(input,'input.txt');\r\n \/\/rewrite(output,'output.txt');\r\n Readln(n);\r\n for i:=1 to n do\r\n Readln(a[i]);\r\n r:=-1;\r\n for i:=1 to n do\r\n begin\r\n t:=max(i);\r\n if t>r\r\n then r:=t;\r\n end;\r\n Writeln(r);\r\nend.\r\n","testcases":"[{'input': ['5\\r\\n-1\\r\\n1\\r\\n2\\r\\n1\\r\\n-1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4\\r\\n-1\\r\\n1\\r\\n2\\r\\n3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n1\\r\\n2\\r\\n3\\r\\n-1\\r\\n5\\r\\n6\\r\\n7\\r\\n-1\\r\\n9\\r\\n10\\r\\n11\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['6\\r\\n-1\\r\\n-1\\r\\n2\\r\\n3\\r\\n1\\r\\n1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n-1\\r\\n1\\r\\n1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n-1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n2\\r\\n-1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n-1\\r\\n-1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3\\r\\n2\\r\\n-1\\r\\n1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n4\\r\\n5\\r\\n1\\r\\n-1\\r\\n4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n4\\r\\n3\\r\\n3\\r\\n4\\r\\n7\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n-1\\r\\n1\\r\\n-1\\r\\n1\\r\\n1\\r\\n5\\r\\n11\\r\\n8\\r\\n6\\r\\n6\\r\\n4\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n2\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['12\\r\\n3\\r\\n4\\r\\n2\\r\\n8\\r\\n7\\r\\n1\\r\\n10\\r\\n12\\r\\n5\\r\\n-1\\r\\n9\\r\\n11\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['12\\r\\n5\\r\\n6\\r\\n7\\r\\n1\\r\\n-1\\r\\n9\\r\\n12\\r\\n4\\r\\n8\\r\\n-1\\r\\n3\\r\\n2\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n9\\r\\n11\\r\\n6\\r\\n6\\r\\n-1\\r\\n6\\r\\n3\\r\\n8\\r\\n6\\r\\n1\\r\\n6\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['12\\r\\n7\\r\\n8\\r\\n4\\r\\n12\\r\\n7\\r\\n9\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n8\\r\\n6\\r\\n-1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n10\\r\\n-1\\r\\n1\\r\\n-1\\r\\n5\\r\\n9\\r\\n12\\r\\n-1\\r\\n-1\\r\\n3\\r\\n-1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n7\\r\\n9\\r\\n12\\r\\n1\\r\\n7\\r\\n-1\\r\\n-1\\r\\n8\\r\\n5\\r\\n4\\r\\n-1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n11\\r\\n11\\r\\n8\\r\\n9\\r\\n1\\r\\n1\\r\\n2\\r\\n-1\\r\\n10\\r\\n3\\r\\n-1\\r\\n8\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n8\\r\\n9\\r\\n-1\\r\\n4\\r\\n2\\r\\n11\\r\\n1\\r\\n-1\\r\\n6\\r\\n-1\\r\\n10\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['12\\r\\n7\\r\\n4\\r\\n4\\r\\n-1\\r\\n6\\r\\n7\\r\\n9\\r\\n7\\r\\n-1\\r\\n7\\r\\n4\\r\\n1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['12\\r\\n-1\\r\\n6\\r\\n10\\r\\n6\\r\\n1\\r\\n11\\r\\n5\\r\\n9\\r\\n11\\r\\n5\\r\\n1\\r\\n9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['12\\r\\n8\\r\\n6\\r\\n6\\r\\n8\\r\\n6\\r\\n-1\\r\\n6\\r\\n6\\r\\n8\\r\\n6\\r\\n8\\r\\n8\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['12\\r\\n3\\r\\n8\\r\\n9\\r\\n12\\r\\n2\\r\\n8\\r\\n11\\r\\n12\\r\\n2\\r\\n9\\r\\n-1\\r\\n11\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['7\\r\\n7\\r\\n6\\r\\n-1\\r\\n-1\\r\\n4\\r\\n4\\r\\n-1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['77\\r\\n53\\r\\n-1\\r\\n48\\r\\n-1\\r\\n51\\r\\n-1\\r\\n54\\r\\n43\\r\\n70\\r\\n19\\r\\n64\\r\\n31\\r\\n45\\r\\n58\\r\\n6\\r\\n61\\r\\n41\\r\\n56\\r\\n34\\r\\n-1\\r\\n54\\r\\n-1\\r\\n66\\r\\n65\\r\\n74\\r\\n16\\r\\n38\\r\\n1\\r\\n2\\r\\n61\\r\\n-1\\r\\n34\\r\\n-1\\r\\n-1\\r\\n7\\r\\n19\\r\\n57\\r\\n13\\r\\n61\\r\\n42\\r\\n-1\\r\\n34\\r\\n65\\r\\n16\\r\\n31\\r\\n61\\r\\n6\\r\\n5\\r\\n34\\r\\n15\\r\\n-1\\r\\n13\\r\\n4\\r\\n22\\r\\n74\\r\\n7\\r\\n-1\\r\\n70\\r\\n38\\r\\n61\\r\\n45\\r\\n53\\r\\n46\\r\\n22\\r\\n-1\\r\\n65\\r\\n34\\r\\n19\\r\\n43\\r\\n48\\r\\n33\\r\\n58\\r\\n36\\r\\n-1\\r\\n47\\r\\n24\\r\\n34\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5\\r\\n2\\r\\n3\\r\\n4\\r\\n5\\r\\n-1\\r\\n'], 'output': ['5\\r\\n']}]","id":686} {"difficulty":1000,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"122_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nconst\r\n Divisors: array[1..5] of Integer\r\n = (4, 7, 44, 47, 74);\r\n\r\nvar\r\n I, n: Integer;\r\n isDivisible: Boolean;\r\n\r\nbegin\r\n readln(n);\r\n\r\n isDivisible := false;\r\n\r\n for I := Low(Divisors) to High(Divisors) do\r\n begin\r\n isDivisible := (n mod Divisors[I]) = 0;\r\n if isDivisible then\r\n break;\r\n end;\r\n\r\n if isDivisible then\r\n writeln('YES')\r\n else\r\n writeln('NO');\r\n\r\n readln;\r\nend.\r\n","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.Petya calls a number almost lucky if it could be evenly divided by some lucky number. Help him find out if the given number n is almost lucky.","input_specification":"The single line contains an integer n (1\u2264n\u22641000) \u2014 the number that needs to be checked.\n","output_specification":"In the only line print \"YES\" (without the quotes), if number n is almost lucky. Otherwise, print \"NO\" (without the quotes).\n","notes":"Note that all lucky numbers are almost lucky as any number is evenly divisible by itself.\nIn the first sample 47 is a lucky number. In the second sample 16 is divisible by 4.\n","sample_inputs":["47\n","16\n","78\n"],"sample_outputs":["YES\n","YES\n","NO\n"],"human_solution":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nconst\r\n Divisors: array[1..12] of Integer\r\n = (4, 7, 44, 47, 74, 444, 447, 474, 477, 744, 747, 777);\r\n\r\nvar\r\n I, n: Integer;\r\n isDivisible: Boolean;\r\n\r\nbegin\r\n readln(n);\r\n\r\n isDivisible := false;\r\n\r\n for I := Low(Divisors) to High(Divisors) do\r\n begin\r\n isDivisible := (n mod Divisors[I]) = 0;\r\n if isDivisible then\r\n break;\r\n end;\r\n\r\n if isDivisible then\r\n writeln('YES')\r\n else\r\n writeln('NO');\r\n\r\n readln;\r\nend.\r\n","testcases":"[{'input': ['47\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['78\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['48\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['107\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['77\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['480\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['49\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['56\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['124\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1000\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['999\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['298\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['274\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['998\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['42\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['788\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['70\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['444\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['777\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['799\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['882\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['88\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['94\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['477\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['141\\r\\n'], 'output': ['YES\\r\\n']}]","id":687} {"difficulty":900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"129_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n var n,s,i,z:integer;\r\n a: array of integer;\r\n q:boolean;\r\nbegin\r\n { TODO -oUser -cConsole Main : Insert code here }\r\n\r\n\r\n\r\n readln(n);\r\n setlength(a,n);\r\n s:=0;\r\n z:=0;\r\n for i:=0 to n-1 do\r\n begin\r\n read(a[i]);\r\n s:=a[i]+s;\r\n end;\r\n \/\/ if s=1 then z:=1;\r\n if s mod 2 <> 0 then q:=false\r\n else q:=true;\r\n\r\n if q then begin\r\n for i:=0 to n-1 do\r\n if a[i] mod 2=0 then z:=z+1;\r\n end;\r\n if not q then begin\r\n for i:=0 to n-1 do\r\n if s-a[i] mod 2=0 then z:=z+1;\r\n end;\r\n writeln(z);\r\n readln;\r\n readln;\r\nend.\r\n","description":"Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there are many cookies, Olga decided that it's no big deal if she steals a bag. However, she doesn't want the sisters to quarrel because of nothing when they divide the cookies. That's why Olga wants to steal a bag with cookies so that the number of cookies in the remaining bags was even, that is, so that Anna and Maria could evenly divide it into two (even 0 remaining cookies will do, just as any other even number). How many ways there are to steal exactly one cookie bag so that the total number of cookies in the remaining bags was even?","input_specification":"The first line contains the only integer n (1\u2264n\u2264100) \u2014 the number of cookie bags Anna and Maria have. The second line contains n integers ai (1\u2264ai\u2264100) \u2014 the number of cookies in the i-th bag.\n","output_specification":"Print in the only line the only number \u2014 the sought number of ways. If there are no such ways print 0.\n","notes":"In the first sample Olga should take the only bag so that the twins ended up with the even number of cookies.\nIn the second sample Olga can take any of five bags with two cookies or any of three bags with four cookies \u2014 5+3=8 ways in total.\nIn the third sample, no matter which bag with two cookies Olga chooses, the twins are left with 2*9+99=117 cookies. Thus, Olga has only one option: to take the bag with 99 cookies.\n","sample_inputs":["1\n1\n","10\n1 2 2 3 4 4 4 2 2 2\n","11\n2 2 2 2 2 2 2 2 2 2 99\n"],"sample_outputs":["1\n","8\n","1\n"],"human_solution":"{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}\r\n{$MINSTACKSIZE $00004000}\r\n{$MAXSTACKSIZE $00100000}\r\n{$IMAGEBASE $00400000}\r\n{$APPTYPE CONSOLE}\r\n\r\nconst filename='x';\r\n oo=maxlongint div 2;\r\n eps=1e-6;\r\n eee=1e-21;\r\n\r\nvar qq,cc,a,aa:array[0..1000000]of longint;\r\n qc:array[0..2000,0..2000]of int64;\r\n ss:array[0..1000]of string;\r\n s,s0,s1,s2,s3:string;\r\n x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;\r\n res,cur:int64;\r\n u,v,nt,ii,jj,kk,nn,mm,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,max,min:longint;\r\n test,ll,t,tt:longint;\r\n b,bb,bbb,b0,b1,b2,b3:boolean;\r\n\r\n\r\n\r\n\r\nprocedure init;\r\n begin\r\n assign(input,filename+'.in');\r\n assign(output,filename+'.out');\r\n reset(input);\r\n rewrite(output);\r\n end;\r\n\r\n\r\nprocedure fin;\r\n begin\r\n close(input);\r\n close(output);\r\n end;\r\n\r\n\r\nprocedure clear;\r\nvar i,j,k:longint;\r\n begin\r\n fillchar(qc,sizeof(qc),0);\r\n end;\r\n\r\n\r\nprocedure load;\r\nvar i,j,k:longint;\r\n begin\r\n end;\r\n\r\n\r\nprocedure save;\r\nvar i,j,k:longint;\r\n begin\r\n end;\r\n\r\n\r\nprocedure run;\r\nvar i,j,z:longint;\r\n k,m:int64;\r\n begin\r\n \/\/init;\r\n read(n);\r\n for i:=1 to n do\r\n begin\r\n read(qq[i]);\r\n inc(cur,qq[i]);\r\n end;\r\n res:=0;\r\n for i:=1 to n do\r\n if ((cur-qq[i]) mod 2 = 0) then inc(res);\r\n writeln(res);\r\n end;\r\n\r\n\r\nbegin\r\nnt:=1;\r\n\/\/readln(nt);\r\nfor test:=1 to nt do\r\n begin\r\n clear;\r\n load;\r\n run;\r\n save;\r\n end;\r\nend.\r\n","testcases":"[{'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n1 2 2 3 4 4 4 2 2 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['11\\r\\n2 2 2 2 2 2 2 2 2 2 99\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n7 7 7 7 7 7 7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['8\\r\\n1 2 3 4 5 6 7 8\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100\\r\\n1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['99\\r\\n99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99 100 99\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['82\\r\\n43 44 96 33 23 42 33 66 53 87 8 90 43 91 40 88 51 18 48 62 59 10 22 20 54 6 13 63 2 56 31 52 98 42 54 32 26 77 9 24 33 91 16 30 39 34 78 82 73 90 12 15 67 76 30 18 44 86 84 98 65 54 100 79 28 34 40 56 11 43 72 35 86 59 89 40 30 33 7 19 44 15\\r\\n'], 'output': ['50\\r\\n']}, {'input': ['17\\r\\n50 14 17 77 74 74 38 76 41 27 45 29 66 98 38 73 38\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['94\\r\\n81 19 90 99 26 11 86 44 78 36 80 59 99 90 78 72 71 20 94 56 42 40 71 84 10 85 10 70 52 27 39 55 90 16 48 25 7 79 99 100 38 10 99 56 3 4 78 9 16 57 14 40 52 54 57 70 30 86 56 84 97 60 59 69 49 66 23 92 90 46 86 73 53 47 1 83 14 20 24 66 13 45 41 14 86 75 55 88 48 95 82 24 47 87\\r\\n'], 'output': ['39\\r\\n']}, {'input': ['88\\r\\n64 95 12 90 40 65 98 45 52 54 79 7 81 25 98 19 68 82 41 53 35 50 5 22 32 21 8 39 8 6 72 27 81 30 12 79 21 42 60 2 66 87 46 93 62 78 52 71 76 32 78 94 86 85 55 15 34 76 41 20 32 26 94 81 89 45 74 49 11 40 40 39 49 46 80 85 90 23 80 40 86 58 70 26 48 93 23 53\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['84\\r\\n95 9 43 43 13 84 60 90 1 8 97 99 54 34 59 83 33 15 51 26 40 12 66 65 19 30 29 78 92 60 25 13 19 84 71 73 12 24 54 49 16 41 11 40 57 59 34 40 39 9 71 83 1 77 79 53 94 47 78 55 77 85 29 52 80 90 53 77 97 97 27 79 28 23 83 25 26 22 49 86 63 56 3 32\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['47\\r\\n61 97 76 94 91 22 2 68 62 73 90 47 16 79 44 71 98 68 43 6 53 52 40 27 68 67 43 96 14 91 60 61 96 24 97 13 32 65 85 96 81 77 34 18 23 14 80\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['69\\r\\n71 1 78 74 58 89 30 6 100 90 22 61 11 59 14 74 27 25 78 61 45 19 25 33 37 4 52 43 53 38 9 100 56 67 69 38 76 91 63 60 93 52 28 61 9 98 8 14 57 63 89 64 98 51 36 66 36 86 13 82 50 91 52 64 86 78 78 83 81\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['52\\r\\n38 78 36 75 19 3 56 1 39 97 24 79 84 16 93 55 96 64 12 24 1 86 80 29 12 32 36 36 73 39 76 65 53 98 30 20 28 8 86 43 70 22 75 69 62 65 81 25 53 40 71 59\\r\\n'], 'output': ['28\\r\\n']}, {'input': ['74\\r\\n81 31 67 97 26 75 69 81 11 13 13 74 77 88 52 20 52 64 66 75 72 28 41 54 26 75 41 91 75 15 18 36 13 83 63 61 14 48 53 63 19 67 35 48 23 65 73 100 44 55 92 88 99 17 73 25 83 7 31 89 12 80 98 39 42 75 14 29 81 35 77 87 33 94\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['44\\r\\n46 56 31 31 37 71 94 2 14 100 45 72 36 72 80 3 38 54 42 98 50 32 31 42 62 31 45 50 95 100 18 17 64 22 18 25 52 56 70 57 43 40 81 28\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['22\\r\\n28 57 40 74 51 4 45 84 99 12 95 14 92 60 47 81 84 51 31 91 59 42\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['59\\r\\n73 45 94 76 41 49 65 13 74 66 36 25 47 75 40 23 92 72 11 32 32 8 81 26 68 56 41 8 76 47 96 55 70 11 84 14 83 18 70 22 30 39 28 100 48 11 92 45 78 69 86 1 54 90 98 91 13 17 35\\r\\n'], 'output': ['33\\r\\n']}, {'input': ['63\\r\\n20 18 44 94 68 57 16 43 74 55 68 24 21 95 76 84 50 50 47 86 86 12 58 55 28 72 86 18 34 45 81 88 3 72 41 9 60 90 81 93 12 6 9 6 2 41 1 7 9 29 81 14 64 80 20 36 67 54 7 5 35 81 22\\r\\n'], 'output': ['37\\r\\n']}, {'input': ['28\\r\\n49 84 48 19 44 91 11 82 96 95 88 90 71 82 87 25 31 23 18 13 98 45 26 65 35 12 31 14\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['61\\r\\n34 18 28 64 28 45 9 77 77 20 63 92 79 16 16 100 86 2 91 91 57 15 31 95 10 88 84 5 82 83 53 98 59 17 97 80 76 80 81 3 91 81 87 93 61 46 10 49 6 22 21 75 63 89 21 81 30 19 67 38 77\\r\\n'], 'output': ['35\\r\\n']}, {'input': ['90\\r\\n41 90 43 1 28 75 90 50 3 70 76 64 81 63 25 69 83 82 29 91 59 66 21 61 7 55 72 49 38 69 72 20 64 58 30 81 61 29 96 14 39 5 100 20 29 98 75 29 44 78 97 45 26 77 73 59 22 99 41 6 3 96 71 20 9 18 96 18 90 62 34 78 54 5 41 6 73 33 2 54 26 21 18 6 45 57 43 73 95 75\\r\\n'], 'output': ['42\\r\\n']}, {'input': ['45\\r\\n93 69 4 27 20 14 71 48 79 3 32 26 49 30 57 88 13 56 49 61 37 32 47 41 41 70 45 68 82 18 8 6 25 20 15 13 71 99 28 6 52 34 19 59 26\\r\\n'], 'output': ['23\\r\\n']}, {'input': ['33\\r\\n29 95 48 49 91 10 83 71 47 25 66 36 51 12 34 10 54 74 41 96 89 26 89 1 42 33 1 62 9 32 49 65 78\\r\\n'], 'output': ['15\\r\\n']}, {'input': ['34\\r\\n98 24 42 36 41 82 28 58 89 34 77 70 76 44 74 54 66 100 13 79 4 88 21 1 11 45 91 29 87 100 29 54 82 78\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['29\\r\\n91 84 26 84 9 63 52 9 65 56 90 2 36 7 67 33 91 14 65 38 53 36 81 83 85 14 33 95 51\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['100\\r\\n2 88 92 82 87 100 78 28 84 43 78 32 43 33 97 19 15 52 29 84 57 72 54 13 99 28 82 79 40 70 34 92 91 53 9 88 27 43 14 92 72 37 26 37 20 95 19 34 49 64 33 37 34 27 80 79 9 54 99 68 25 4 68 73 46 66 24 78 3 87 26 52 50 84 4 95 23 83 39 58 86 36 33 16 98 2 84 19 53 12 69 60 10 11 78 17 79 92 77 59\\r\\n'], 'output': ['45\\r\\n']}, {'input': ['100\\r\\n2 95 45 73 9 54 20 97 57 82 88 26 18 71 25 27 75 54 31 11 58 85 69 75 72 91 76 5 25 80 45 49 4 73 8 81 81 38 5 12 53 77 7 96 90 35 28 80 73 94 19 69 96 17 94 49 69 9 32 19 5 12 46 29 26 40 59 59 6 95 82 50 72 2 45 69 12 5 72 29 39 72 23 96 81 28 28 56 68 58 37 41 30 1 90 84 15 24 96 43\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n27 72 35 91 13 10 35 45 24 55 83 84 63 96 29 79 34 67 63 92 48 83 18 77 28 27 49 66 29 88 55 15 6 58 14 67 94 36 77 7 7 64 61 52 71 18 36 99 76 6 50 67 16 13 41 7 89 73 61 51 78 22 78 32 76 100 3 31 89 71 63 53 15 85 77 54 89 33 68 74 3 23 57 5 43 89 75 35 9 86 90 11 31 46 48 37 74 17 77 8\\r\\n'], 'output': ['40\\r\\n']}, {'input': ['100\\r\\n69 98 69 88 11 49 55 8 25 91 17 81 47 26 15 73 96 71 18 42 42 61 48 14 92 78 35 72 4 27 62 75 83 79 17 16 46 80 96 90 82 54 37 69 85 21 67 70 96 10 46 63 21 59 56 92 54 88 77 30 75 45 44 29 86 100 51 11 65 69 66 56 82 63 27 1 51 51 13 10 3 55 26 85 34 16 87 72 13 100 81 71 90 95 86 50 83 55 55 54\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n34 35 99 64 2 66 78 93 20 48 12 79 19 10 87 7 42 92 60 79 5 2 24 89 57 48 63 92 74 4 16 51 7 12 90 48 87 17 18 73 51 58 97 97 25 38 15 97 96 73 67 91 6 75 14 13 87 79 75 3 15 55 35 95 71 45 10 13 20 37 82 26 2 22 13 83 97 84 39 79 43 100 54 59 98 8 61 34 7 65 75 44 24 77 73 88 34 95 44 77\\r\\n'], 'output': ['55\\r\\n']}, {'input': ['100\\r\\n15 86 3 1 51 26 74 85 37 87 64 58 10 6 57 26 30 47 85 65 24 72 50 40 12 35 91 47 91 60 47 87 95 34 80 91 26 3 36 39 14 86 28 70 51 44 28 21 72 79 57 61 16 71 100 94 57 67 36 74 24 21 89 85 25 2 97 67 76 53 76 80 97 64 35 13 8 32 21 52 62 61 67 14 74 73 66 44 55 76 24 3 43 42 99 61 36 80 38 66\\r\\n'], 'output': ['52\\r\\n']}, {'input': ['100\\r\\n45 16 54 54 80 94 74 93 75 85 58 95 79 30 81 2 84 4 57 23 92 64 78 1 50 36 13 27 56 54 10 77 87 1 5 38 85 74 94 82 30 45 72 83 82 30 81 82 82 3 69 82 7 92 39 60 94 42 41 5 3 17 67 21 79 44 79 96 28 3 53 68 79 89 63 83 1 44 4 31 84 15 73 77 19 66 54 6 73 1 67 24 91 11 86 45 96 82 20 89\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n84 23 50 32 90 71 92 43 58 70 6 82 7 55 85 19 70 89 12 26 29 56 74 30 2 27 4 39 63 67 91 81 11 33 75 10 82 88 39 43 43 80 68 35 55 67 53 62 73 65 86 74 43 51 14 48 42 92 83 57 22 33 24 99 5 27 78 96 7 28 11 15 8 38 85 67 5 92 24 96 57 59 14 95 91 4 9 18 45 33 74 83 64 85 14 51 51 94 29 2\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n77 56 56 45 73 55 32 37 39 50 30 95 79 21 44 34 51 43 86 91 39 30 85 15 35 93 100 14 57 31 80 79 38 40 88 4 91 54 7 95 76 26 62 84 17 33 67 47 6 82 69 51 17 2 59 24 11 12 31 90 12 11 55 38 72 49 30 50 42 46 5 97 9 9 30 45 86 23 19 82 40 42 5 40 35 98 35 32 60 60 5 28 84 35 21 49 68 53 68 23\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n78 38 79 61 45 86 83 83 86 90 74 69 2 84 73 39 2 5 20 71 24 80 54 89 58 34 77 40 39 62 2 47 28 53 97 75 88 98 94 96 33 71 44 90 47 36 19 89 87 98 90 87 5 85 34 79 82 3 42 88 89 63 35 7 89 30 40 48 12 41 56 76 83 60 80 80 39 56 77 4 72 96 30 55 57 51 7 19 11 1 66 1 91 87 11 62 95 85 79 25\\r\\n'], 'output': ['48\\r\\n']}, {'input': ['100\\r\\n5 34 23 20 76 75 19 51 17 82 60 13 83 6 65 16 20 43 66 54 87 10 87 73 50 24 16 98 33 28 80 52 54 82 26 92 14 13 84 92 94 29 61 21 60 20 48 94 24 20 75 70 58 27 68 45 86 89 29 8 67 38 83 48 18 100 11 22 46 84 52 97 70 19 50 75 3 7 52 53 72 41 18 31 1 38 49 53 11 64 99 76 9 87 48 12 100 32 44 71\\r\\n'], 'output': ['58\\r\\n']}, {'input': ['100\\r\\n76 89 68 78 24 72 73 95 98 72 58 15 2 5 56 32 9 65 50 70 94 31 29 54 89 52 31 93 43 56 26 35 72 95 51 55 78 70 11 92 17 5 54 94 81 31 78 95 73 91 95 37 59 9 53 48 65 55 84 8 45 97 64 37 96 34 36 53 66 17 72 48 99 23 27 18 92 84 44 73 60 78 53 29 68 99 19 39 61 40 69 6 77 12 47 29 15 4 8 45\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n82 40 31 53 8 50 85 93 3 84 54 17 96 59 51 42 18 19 35 84 79 31 17 46 54 82 72 49 35 73 26 89 61 73 3 50 12 29 25 77 88 21 58 24 22 89 96 54 82 29 96 56 77 16 1 68 90 93 20 23 57 22 31 18 92 90 51 14 50 72 31 54 12 50 66 62 2 34 17 45 68 50 87 97 23 71 1 72 17 82 42 15 20 78 4 49 66 59 10 17\\r\\n'], 'output': ['54\\r\\n']}, {'input': ['100\\r\\n32 82 82 24 39 53 48 5 29 24 9 37 91 37 91 95 1 97 84 52 12 56 93 47 22 20 14 17 40 22 79 34 24 2 69 30 69 29 3 89 21 46 60 92 39 29 18 24 49 18 40 22 60 13 77 50 39 64 50 70 99 8 66 31 90 38 20 54 7 21 5 56 41 68 69 20 54 89 69 62 9 53 43 89 81 97 15 2 52 78 89 65 16 61 59 42 56 25 32 52\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['100\\r\\n72 54 23 24 97 14 99 87 15 25 7 23 17 87 72 31 71 87 34 82 51 77 74 85 62 38 24 7 84 48 98 21 29 71 70 84 25 58 67 92 18 44 32 9 81 15 53 29 63 18 86 16 7 31 38 99 70 32 89 16 23 11 66 96 69 82 97 59 6 9 49 80 85 19 6 9 52 51 85 74 53 46 73 55 31 63 78 61 34 80 77 65 87 77 92 52 89 8 52 31\\r\\n'], 'output': ['44\\r\\n']}, {'input': ['100\\r\\n56 88 8 19 7 15 11 54 35 50 19 57 63 72 51 43 50 19 57 90 40 100 8 92 11 96 30 32 59 65 93 47 62 3 50 41 30 50 72 83 61 46 83 60 20 46 33 1 5 18 83 22 34 16 41 95 63 63 7 59 55 95 91 29 64 60 64 81 45 45 10 9 88 37 69 85 21 82 41 76 42 34 47 78 51 83 65 100 13 22 59 76 63 1 26 86 36 94 99 74\\r\\n'], 'output': ['46\\r\\n']}, {'input': ['100\\r\\n27 89 67 60 62 80 43 50 28 88 72 5 94 11 63 91 18 78 99 3 71 26 12 97 74 62 23 24 22 3 100 72 98 7 94 32 12 75 61 88 42 48 10 14 45 9 48 56 73 76 70 70 79 90 35 39 96 37 81 11 19 65 99 39 23 79 34 61 35 74 90 37 73 23 46 21 94 84 73 58 11 89 13 9 10 85 42 78 73 32 53 39 49 90 43 5 28 31 97 75\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['100\\r\\n33 24 97 96 1 14 99 51 13 65 67 20 46 88 42 44 20 49 5 89 98 83 15 40 74 83 58 3 10 79 34 2 69 28 37 100 55 52 14 8 44 94 97 89 6 42 11 28 30 33 55 56 20 57 52 25 75 1 87 42 62 41 37 12 54 85 95 80 42 36 94 96 28 76 54 36 4 17 26 24 62 15 17 79 84 36 92 78 74 91 96 77 54 92 81 91 62 98 37 37\\r\\n'], 'output': ['43\\r\\n']}, {'input': ['100\\r\\n86 24 61 15 11 85 1 31 47 36 23 36 59 34 3 27 16 29 82 28 58 52 52 66 71 61 98 39 60 20 67 41 67 90 73 29 92 17 70 95 58 98 58 32 21 73 46 56 87 72 80 75 40 27 94 31 59 92 93 37 14 99 96 21 97 23 81 91 52 52 96 94 92 28 38 29 52 16 57 27 17 24 91 21 79 55 96 98 95 94 23 78 79 12 77 35 32 75 100 82\\r\\n'], 'output': ['51\\r\\n']}, {'input': ['100\\r\\n88 85 41 37 69 21 7 69 36 5 92 26 64 75 22 46 67 20 70 22 62 66 38 24 47 49 68 30 90 31 67 86 86 82 9 51 43 45 48 42 73 44 31 94 45 60 54 66 20 87 11 94 34 32 87 66 56 28 75 39 37 90 72 93 55 72 31 42 30 71 87 61 4 12 12 81 23 61 56 98 71 32 30 33 96 63 92 16 8 78 47 91 47 54 49 3 81 82 41 5\\r\\n'], 'output': ['47\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n1 1 3 2 2\\r\\n'], 'output': ['3\\r\\n']}]","id":688} {"difficulty":1200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"129_B","execute_outcome":"WRONG_ANSWER","source_code":"program ProjectA;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$A+,B-,D-,E+,F+,G-,I-,L-,N+,O-,R-,Q-,V+,X+}\r\n\r\nuses\r\n SysUtils,\r\n Math;\r\n\r\nvar\r\n n, m, i, u, j, t, v, res: integer;\r\n g: array [1..101, 1..101] of integer;\r\n nv, a: array [1..101] of integer;\r\n ok: boolean;\r\n\r\nbegin\r\n \/\/Reset(input, 'input.txt');\r\n \/\/Rewrite(output, 'output.txt');\r\n\r\n read(n, m);\r\n for i := 1 to n do\r\n nv[i] := 0;\r\n for i := 1 to m do\r\n begin\r\n read(u, v);\r\n inc(nv[u]);\r\n inc(nv[v]);\r\n g[u, nv[u]] := v;\r\n g[v, nv[v]] := u;\r\n end;\r\n\r\n res := 0;\r\n While True do\r\n begin\r\n ok := false;\r\n for i := 1 to n do\r\n a[i] := 0;\r\n j := 0;\r\n for i := 1 to n do\r\n if nv[i] = 1 then\r\n begin\r\n ok := true;\r\n nv[i] := 0;\r\n inc(j);\r\n a[j] := i;\r\n end;\r\n if ok then\r\n begin\r\n inc(res);\r\n t := j;\r\n for j := 1 to t do\r\n dec(nv[g[a[j], 1]]);\r\n end\r\n else\r\n begin\r\n write(res);\r\n exit;\r\n end;\r\n\r\n end;\r\n\r\nend.\r\n","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\u2264a,b\u2264n,a\u2260b). It is guaranteed that no two students are tied with more than one lace. No lace ties a student to himself.\n","output_specification":"Print the single number \u2014 the number of groups of students that will be kicked out from the club.\n","notes":"In 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.\nIn 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.\nIn 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.\n","sample_inputs":["3 3\n1 2\n2 3\n3 1\n","6 3\n1 2\n2 3\n3 4\n","6 5\n1 4\n2 4\n3 4\n5 4\n6 4\n"],"sample_outputs":["0\n","2\n","1\n"],"human_solution":"program Project4;\r\n{$APPTYPE CONSOLE}\r\n\r\nuses sysutils,math;\r\n\r\nvar n,m,k,l: integer;\r\n i,j: longint;\r\n a,b: array [1..10000] of integer;\r\n c: array [1..10000] of boolean;\r\n st: boolean;\r\nbegin\r\n for i := 1 to 10000 do\r\n c[i] := true;\r\n k := 0;\r\n readln(n,m);\r\n st := true;\r\n for i := 1 to m do\r\n begin\r\n readln(a[i],b[i]);\r\n end;\r\n while st do\r\n begin\r\n st := false;\r\n for i := 1 to m do\r\n begin\r\n l := 0;\r\n if c[i] then\r\n begin\r\n for j := 1 to m do\r\n if (i <> j) and ((a[i] = a[j]) or (a[i] = b[j])) and c[j] then\r\n INC(l);\r\n if l = 0 then begin st := true; a[i] := 0 end;\r\n\r\n l := 0;\r\n for j := 1 to m do\r\n if (i <> j) and ((b[i] = a[j]) or (b[i] = b[j])) and c[j] then\r\n INC(l);\r\n if l = 0 then begin st := true; b[i] := 0 end;\r\n end;\r\n end;\r\n for i := 1 to m do\r\n if (a[i] = 0) or (b[i] = 0) then c[i] := false;\r\n if st then INC(k);\r\n end;\r\n writeln(k);\r\nend.","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":689} {"difficulty":1100,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"12_C","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\ntype\r\n\tTFruit = record\r\n\t\tname: string;\r\n\t\tcount: Integer;\r\n\tend;\r\n\r\nvar\r\n\tf: array[1..100] of TFruit;\r\n\tt: TFruit;\r\n\ts: string;\r\n\tn, m, i, j, tmp, min, max: Integer;\r\n\tp: array[1..100] of Integer;\r\n\r\nbegin\r\n\tReadln(n, m);\r\n\tFillChar(f, sizeof(f), 0);\r\n\tFillChar(p, sizeof(p), 0);\r\n\tfor i:=1 to n do Read(p[i]);\r\n\tReadln;\r\n\tfor i:=1 to m do\r\n\tbegin\r\n\t\tReadln(s);\r\n\t\tfor j:=1 to m do\r\n\t\tbegin\r\n\t\t\tif f[j].name='' then\r\n\t\t\tbegin\r\n\t\t\t\tf[j].name := s;\r\n\t\t\t\tf[j].count := 1;\r\n\t\t\t\tbreak;\r\n\t\t\tend;\r\n\t\t\tif f[j].name=s then\r\n\t\t\tbegin\r\n\t\t\t\tInc(f[j].count);\r\n\t\t\t\tbreak;\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\tfor i:=1 to n-1 do\r\n\tfor j:=i+1 to n do\r\n\tbegin\r\n\t\tif p[i]>p[j] then\r\n\t\tbegin\r\n\t\t\ttmp := p[i]; p[i] := p[j]; p[j] := tmp;\r\n\t\tend;\r\n\tend;\r\n\tfor i:=1 to m-1 do\r\n\tbegin\r\n\t\tif f[i].name='' then break;\r\n\t\tfor j:=i+1 to m do\r\n\t\tbegin\r\n\t\t\tif f[j].name='' then break;\r\n\t\t\tif f[i].count>f[j].count then\r\n\t\t\tbegin\r\n\t\t\t\tt := f[i]; f[i] := f[j]; f[j] := t;\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\tm := i-1;\r\n\r\n\tmin := 0;\r\n\tmax := 0;\r\n\tfor i:=1 to m do\r\n\tbegin\r\n\t\tInc(min, f[m+1-i].count*p[i]);\r\n\t\tInc(max, f[m+1-i].count*p[n+1-i]);\r\n\tend;\r\n\r\n\twriteln(min, ' ', max);\r\n\r\nend.\r\n","description":"The spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping. He made a list of m fruits he wanted to buy. If Valera want to buy more than one fruit of some kind, he includes it into the list several times. When he came to the fruit stall of Ashot, he saw that the seller hadn't distributed price tags to the goods, but put all price tags on the counter. Later Ashot will attach every price tag to some kind of fruits, and Valera will be able to count the total price of all fruits from his list. But Valera wants to know now what can be the smallest total price (in case of the most \u00ablucky\u00bb for him distribution of price tags) and the largest total price (in case of the most \u00abunlucky\u00bb for him distribution of price tags).","input_specification":"The first line of the input contains two integer number n and m (1\u2264n,m\u2264100) \u2014 the number of price tags (which is equal to the number of different kinds of fruits that Ashot sells) and the number of items in Valera's list. The second line contains n space-separated positive integer numbers. Each of them doesn't exceed 100 and stands for the price of one fruit of some kind. The following m lines contain names of the fruits from the list. Each name is a non-empty string of small Latin letters which length doesn't exceed 32. It is guaranteed that the number of distinct fruits from the list is less of equal to n. Also it is known that the seller has in stock all fruits that Valera wants to buy.\n","output_specification":"Print two numbers a and b (a\u2264b) \u2014 the minimum and the maximum possible sum which Valera may need to buy all fruits from his list.\n","notes":null,"sample_inputs":["5 3\n4 2 1 10 5\napple\norange\nmango\n","6 5\n3 5 1 6 8 1\npeach\ngrapefruit\nbanana\norange\norange\n"],"sample_outputs":["7 19\n","11 30\n"],"human_solution":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\ntype\r\n\tTFruit = record\r\n\t\tname: string;\r\n\t\tcount: Integer;\r\n\tend;\r\n\r\nvar\r\n\tf: array[1..100] of TFruit;\r\n\tt: TFruit;\r\n\ts: string;\r\n\tn, m, i, j, tmp, min, max, len: Integer;\r\n\tp: array[1..100] of Integer;\r\n\r\nbegin\r\n\tReadln(n, m);\r\n\tFillChar(f, sizeof(f), 0);\r\n\tFillChar(p, sizeof(p), 0);\r\n\tfor i:=1 to n do Read(p[i]);\r\n\tReadln;\r\n\tlen := 0;\r\n\tfor i:=1 to m do\r\n\tbegin\r\n\t\tReadln(s);\r\n\t\tfor j:=1 to m do\r\n\t\tbegin\r\n\t\t\tif f[j].name='' then\r\n\t\t\tbegin\r\n\t\t\t\tInc(len);\r\n\t\t\t\tf[j].name := s;\r\n\t\t\t\tf[j].count := 1;\r\n\t\t\t\tbreak;\r\n\t\t\tend;\r\n\t\t\tif f[j].name=s then\r\n\t\t\tbegin\r\n\t\t\t\tInc(f[j].count);\r\n\t\t\t\tbreak;\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\tfor i:=1 to n-1 do\r\n\tfor j:=i+1 to n do\r\n\tbegin\r\n\t\tif p[i]>p[j] then\r\n\t\tbegin\r\n\t\t\ttmp := p[i]; p[i] := p[j]; p[j] := tmp;\r\n\t\tend;\r\n\tend;\r\n\tfor i:=1 to m-1 do\r\n\tbegin\r\n\t\tif f[i].name='' then break;\r\n\t\tfor j:=i+1 to m do\r\n\t\tbegin\r\n\t\t\tif f[j].name='' then break;\r\n\t\t\tif f[i].count>f[j].count then\r\n\t\t\tbegin\r\n\t\t\t\tt := f[i]; f[i] := f[j]; f[j] := t;\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\r\n\tmin := 0;\r\n\tmax := 0;\r\n\tfor i:=1 to len do\r\n\tbegin\r\n\t\tInc(min, f[len+1-i].count*p[i]);\r\n\t\tInc(max, f[len+1-i].count*p[n+1-i]);\r\n\tend;\r\n\r\n\tWriteln(min, ' ', max);\r\n\r\n\r\n\treadln;\r\n\r\nend.\r\n","testcases":"[{'input': ['5 3\\r\\n4 2 1 10 5\\r\\napple\\r\\norange\\r\\nmango\\r\\n'], 'output': ['7 19\\r\\n']}, {'input': ['6 5\\r\\n3 5 1 6 8 1\\r\\npeach\\r\\ngrapefruit\\r\\nbanana\\r\\norange\\r\\norange\\r\\n'], 'output': ['11 30\\r\\n']}, {'input': ['2 2\\r\\n91 82\\r\\neiiofpfpmemlakcystpun\\r\\nmcnzeiiofpfpmemlakcystpunfl\\r\\n'], 'output': ['173 173\\r\\n']}, {'input': ['1 4\\r\\n1\\r\\nu\\r\\nu\\r\\nu\\r\\nu\\r\\n'], 'output': ['4 4\\r\\n']}, {'input': ['3 3\\r\\n4 2 3\\r\\nwivujdxzjm\\r\\nawagljmtc\\r\\nwivujdxzjm\\r\\n'], 'output': ['7 11\\r\\n']}, {'input': ['3 4\\r\\n10 10 10\\r\\nodchpcsdhldqnkbhwtwnx\\r\\nldqnkbhwtwnxk\\r\\nodchpcsdhldqnkbhwtwnx\\r\\nldqnkbhwtwnxk\\r\\n'], 'output': ['40 40\\r\\n']}, {'input': ['3 1\\r\\n14 26 22\\r\\naag\\r\\n'], 'output': ['14 26\\r\\n']}, {'input': ['2 2\\r\\n5 5\\r\\ndcypj\\r\\npiyqiagzjlvbhgfndhfu\\r\\n'], 'output': ['10 10\\r\\n']}, {'input': ['4 3\\r\\n5 3 10 3\\r\\nxzjhplrzkbbzkypfazf\\r\\nxzjhplrzkbbzkypfazf\\r\\nh\\r\\n'], 'output': ['9 25\\r\\n']}, {'input': ['5 5\\r\\n10 10 6 7 9\\r\\niyerjkvzibxhllkeuagptnoqrzm\\r\\nvzibxhllkeuag\\r\\niyerjkvzibxhllkeuagptnoqrzm\\r\\nnoq\\r\\nnoq\\r\\n'], 'output': ['35 49\\r\\n']}, {'input': ['10 8\\r\\n19 18 20 13 19 13 11 10 19 16\\r\\nkayangqlsqmcd\\r\\nqls\\r\\nqydawlbludrgrjfjrhd\\r\\nfjrh\\r\\nqls\\r\\nqls\\r\\nrnmmayh\\r\\nkayangqlsqmcd\\r\\n'], 'output': ['94 154\\r\\n']}, {'input': ['5 15\\r\\n61 56 95 42 85\\r\\noq\\r\\ndwxivk\\r\\ntxdxzsfdj\\r\\noq\\r\\noq\\r\\ndwxivk\\r\\ntxdxzsfdj\\r\\ndwxivk\\r\\ntxdxzsfdj\\r\\nk\\r\\nk\\r\\ndwxivk\\r\\noq\\r\\nk\\r\\ntxdxzsfdj\\r\\n'], 'output': ['891 1132\\r\\n']}, {'input': ['12 18\\r\\n42 44 69 16 81 64 12 68 70 75 75 67\\r\\nfm\\r\\nqamklzfmrjnqgdspwfasjnplg\\r\\nqamklzfmrjnqgdspwfasjnplg\\r\\nqamklzfmrjnqgdspwfasjnplg\\r\\nl\\r\\nl\\r\\nl\\r\\nfm\\r\\nqamklzfmrjnqgdspwfasjnplg\\r\\nl\\r\\nnplgwotfm\\r\\np\\r\\nl\\r\\namklzfm\\r\\ntkpubqamklzfmrjn\\r\\npwf\\r\\nfm\\r\\np\\r\\n'], 'output': ['606 1338\\r\\n']}, {'input': ['24 24\\r\\n34 69 89 45 87 30 78 14 53 16 27 54 75 95 10 69 80 71 43 3 91 9 8 7\\r\\nswtcofrcpeyszydwkrg\\r\\nszyd\\r\\npeyszyd\\r\\nrcpeyszydwkrgfj\\r\\npeyszydwkrgf\\r\\nzydw\\r\\nsmzginydyrtua\\r\\nj\\r\\nj\\r\\ntzwsw\\r\\ngfj\\r\\nyssoqnlpsm\\r\\ninydyrtuatzw\\r\\ninydy\\r\\nlpsmzginydyrtuatzwswtcofrcpeyszy\\r\\nyssoqnlpsm\\r\\npeyszyd\\r\\nyssoqnlpsm\\r\\ninydy\\r\\npeyszyd\\r\\ninydyrtuatzw\\r\\nat\\r\\nfj\\r\\nswtcofrcpeyszydwkrg\\r\\n'], 'output': ['552 1769\\r\\n']}]","id":690} {"difficulty":1400,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"131_C","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils,math;\r\n\r\nvar\r\n c:array[0..30,0..30] of int64;\r\n i,n,m,k,j,l:longint;\r\n ans:int64;\r\n\r\nbegin\r\n read(n,m,k);\r\n l:=max(n,m);\r\n for i:=1 to l do\r\n for j:=0 to i do\r\n if (j = 0) or (j = i) then\r\n C[i][j]:=1\r\n else C[i][j]:=C[i-1][j] + C[i-1][j-1];\r\n for j:=4 to l do\r\n if (k - j >= 1) then\r\n inc(ans,C[n][j]*C[m][k-j]);\r\n writeln(ans);\r\nend.","description":"There are n boys and m girls attending a theatre club. To set a play \"The Big Bang Theory\", they need to choose a group containing exactly t actors containing no less than 4 boys and no less than one girl. How many ways are there to choose a group? Of course, the variants that only differ in the composition of the troupe are considered different.Perform all calculations in the 64-bit type: long long for \u0421\/\u0421++, int64 for Delphi and long for Java.","input_specification":"The only line of the input data contains three integers n, m, t (4\u2264n\u226430,1\u2264m\u226430,5\u2264t\u2264n+m).\n","output_specification":"Find the required number of ways.\nPlease do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is preferred to use cin, cout streams or the %I64d specificator.\n","notes":null,"sample_inputs":["5 2 5\n","4 3 5\n"],"sample_outputs":["10\n","3\n"],"human_solution":"Uses Math,SysUtils;\r\nVar I,J,K,L,N,M,U,a,b,X,Y,X1,Y1,X3,Y3,T,ma,W:Integer;R:Int64;mas:array[0..30,0..30] of Int64;\r\nFunction Prov(N,K:Integer):Int64;\r\nVar J,T,L:Int64;\r\nbegin\r\n If K=0\r\n then Prov:=1\r\n else If N=0\r\n then Prov:=0\r\n else Prov:=Prov(N-1,K-1)+Prov(N-1,K);\r\nend;\r\nBegin\r\n \/\/\/reset(input,'INPUT.TXT');\r\n \/\/\/assign(output,'OUTPUT.TXT');\r\n For I:=0 to 30 do\r\n mas[I,0]:=1;\r\n For I:=1 to 30 do\r\n For J:=1 to 30 do\r\n mas[I,J]:=mas[I-1,J-1]+mas[I-1,J];\r\n readln(N,M,T);\r\n R:=0;\r\n For I:=4 to N do\r\n begin\r\n J:=T-I;\r\n If (J>0) and (J<=M)\r\n then R:=R+mas[N,I]*mas[M,J];\r\n end;\r\n write(R);\r\nEnd.\r\n\r\n\r\n","testcases":"[{'input': ['5 2 5\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['4 3 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 1 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7 3 6\\r\\n'], 'output': ['168\\r\\n']}, {'input': ['30 30 30\\r\\n'], 'output': ['118264581548187697\\r\\n']}, {'input': ['10 10 8\\r\\n'], 'output': ['84990\\r\\n']}, {'input': ['10 10 10\\r\\n'], 'output': ['168229\\r\\n']}, {'input': ['10 10 20\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 15 27\\r\\n'], 'output': ['23535820\\r\\n']}, {'input': ['20 20 40\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 20 24\\r\\n'], 'output': ['62852101650\\r\\n']}, {'input': ['4 20 20\\r\\n'], 'output': ['4845\\r\\n']}, {'input': ['4 20 24\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 3 23\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 1 21\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['20 1 5\\r\\n'], 'output': ['4845\\r\\n']}, {'input': ['20 20 5\\r\\n'], 'output': ['96900\\r\\n']}, {'input': ['30 30 60\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['30 30 59\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['30 29 55\\r\\n'], 'output': ['455126\\r\\n']}, {'input': ['30 29 59\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 30 34\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['30 1 20\\r\\n'], 'output': ['54627300\\r\\n']}, {'input': ['30 1 31\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['29 30 57\\r\\n'], 'output': ['1711\\r\\n']}, {'input': ['25 30 40\\r\\n'], 'output': ['11899700525790\\r\\n']}, {'input': ['4 2 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 1 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['30 30 50\\r\\n'], 'output': ['75394027566\\r\\n']}, {'input': ['30 30 57\\r\\n'], 'output': ['34220\\r\\n']}, {'input': ['30 30 58\\r\\n'], 'output': ['1770\\r\\n']}, {'input': ['25 25 48\\r\\n'], 'output': ['1225\\r\\n']}, {'input': ['30 1 30\\r\\n'], 'output': ['30\\r\\n']}, {'input': ['28 28 50\\r\\n'], 'output': ['32468436\\r\\n']}, {'input': ['28 28 55\\r\\n'], 'output': ['56\\r\\n']}, {'input': ['30 30 55\\r\\n'], 'output': ['5461512\\r\\n']}, {'input': ['7 30 37\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 1 11\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 1 6\\r\\n'], 'output': ['252\\r\\n']}]","id":691} {"difficulty":900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"149_A","execute_outcome":"WRONG_ANSWER","source_code":"{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}\r\n{$MINSTACKSIZE $00004000}\r\n{$MAXSTACKSIZE $00100000}\r\n{$IMAGEBASE $00400000}\r\n{$APPTYPE CONSOLE}\r\n\r\n\r\nconst oo=1e+21;\r\n eps=1e-9;\r\n dohuya=maxlongint div 2;\r\n\r\nvar ss,sss:array[0..201500]of string;\r\n s,s0,s1,s2,s3:string;\r\n a,aaa:array[0..2015,0..2015]of longint;\r\n qq,cc,qc:array[0..1000000]of longint;\r\n q,c,q0,c0,q1,c1,q2,c2,q3,c3,r,res,cur,n,m,i,j,k:longint;\r\n x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;\r\n ch:char;\r\n b,bb:boolean;\r\n\r\nbegin\r\nread(k);\r\nfor i:=1 to 12 do read(qc[i]);\r\nfor i:=1 to 12 do\r\n for j:=i+1 to 12 do\r\n if qc[i]0 then inc(res);\r\n dec(k,qc[i]);\r\n end;\r\nif k<0 then writeln('-1') else writeln(res);\r\nend.\r\n","description":"What joy! Petya's parents went on a business trip for the whole year and the playful kid is left all by himself. Petya got absolutely happy. He jumped on the bed and threw pillows all day long, until... Today Petya opened the cupboard and found a scary note there. His parents had left him with duties: he should water their favourite flower all year, each day, in the morning, in the afternoon and in the evening. \"Wait a second!\" \u2014 thought Petya. He know for a fact that if he fulfills the parents' task in the i-th (1\u2264i\u226412) month of the year, then the flower will grow by ai centimeters, and if he doesn't water the flower in the i-th month, then the flower won't grow this month. Petya also knows that try as he might, his parents won't believe that he has been watering the flower if it grows strictly less than by k centimeters. Help Petya choose the minimum number of months when he will water the flower, given that the flower should grow no less than by k centimeters.","input_specification":"The first line contains exactly one integer k (0\u2264k\u2264100). The next line contains twelve space-separated integers: the i-th (1\u2264i\u226412) number in the line represents ai (0\u2264ai\u2264100). \n","output_specification":"Print the only integer \u2014 the minimum number of months when Petya has to water the flower so that the flower grows no less than by k centimeters. If the flower can't grow by k centimeters in a year, print -1.\n","notes":"Let's consider the first sample test. There it is enough to water the flower during the seventh and the ninth month. Then the flower grows by exactly five centimeters.\nIn the second sample Petya's parents will believe him even if the flower doesn't grow at all (k=0). So, it is possible for Petya not to water the flower at all.\n","sample_inputs":["5\n1 1 1 1 2 2 3 2 2 1 1 1\n","0\n0 0 0 0 0 0 0 1 1 2 3 0\n","11\n1 1 4 1 1 5 1 1 4 1 1 1\n"],"sample_outputs":["2\n","0\n","3\n"],"human_solution":"uses\r\n Math;\r\n\r\nvar\r\n k, i, mx, j, ans: longint;\r\n a: array[1..12] of longint;\r\n\r\nbegin\r\n read(k);\r\n if k = 0 then begin\r\n write(0);\r\n halt;\r\n end;\r\n for i := 1 to 12 do\r\n read(a[i]);\r\n \r\n for i := 1 to 12 do begin\r\n mx := 1;\r\n for j := 1 to 12 do\r\n if a[j] > a[mx] then mx := j;\r\n ans := ans + a[mx];\r\n a[mx] := 0;\r\n if ans >= k then begin\r\n write(i);\r\n halt;\r\n end;\r\n end;\r\n write(-1);\r\nend.","testcases":"[{'input': ['5\\r\\n1 1 1 1 2 2 3 2 2 1 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0\\r\\n0 0 0 0 0 0 0 1 1 2 3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['11\\r\\n1 1 4 1 1 5 1 1 4 1 1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['15\\r\\n20 1 1 1 1 2 2 1 2 2 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\n8 9 100 12 14 17 21 10 11 100 23 10\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['52\\r\\n1 12 3 11 4 5 10 6 9 7 8 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['50\\r\\n2 2 3 4 5 4 4 5 7 3 2 7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n55 81 28 48 99 20 67 95 6 19 10 93\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['93\\r\\n85 40 93 66 92 43 61 3 64 51 90 21\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['99\\r\\n36 34 22 0 0 0 52 12 0 0 33 47\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['99\\r\\n28 32 31 0 10 35 11 18 0 0 32 28\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['99\\r\\n19 17 0 1 18 11 29 9 29 22 0 8\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['76\\r\\n2 16 11 10 12 0 20 4 4 14 11 14\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['41\\r\\n2 1 7 7 4 2 4 4 9 3 10 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['47\\r\\n8 2 2 4 3 1 9 4 2 7 7 8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['58\\r\\n6 11 7 0 5 6 3 9 4 9 5 1\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['32\\r\\n5 2 4 1 5 0 5 1 4 3 0 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['31\\r\\n6 1 0 4 4 5 1 0 5 3 2 0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['35\\r\\n2 3 0 0 6 3 3 4 3 5 0 6\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['41\\r\\n3 1 3 4 3 6 6 1 4 4 0 6\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['97\\r\\n0 5 3 12 10 16 22 8 21 17 21 10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100\\r\\n21 21 0 0 4 13 0 26 0 0 0 15\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100\\r\\n0 0 16 5 22 0 5 0 25 0 14 13\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['97\\r\\n17 0 10 0 0 0 18 0 14 23 15 0\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['100\\r\\n0 9 0 18 7 0 0 14 33 3 0 16\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['95\\r\\n5 2 13 0 15 18 17 0 6 11 0 8\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['94\\r\\n11 13 0 9 15 8 8 16 3 7 1 3\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['96\\r\\n8 4 12 15 8 0 4 10 6 6 12 11\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['100\\r\\n5 5 3 8 6 5 0 3 3 8 1 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100\\r\\n1 0 0 1 1 0 1 1 1 1 2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100\\r\\n6 3 2 0 4 1 2 2 2 2 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['0\\r\\n100 100 100 100 100 100 100 100 100 100 100 100\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n100 100 100 100 100 100 100 100 100 100 100 100\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['12\\r\\n1 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['13\\r\\n1 1 1 1 1 1 1 1 1 1 1 2\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['15\\r\\n10 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1\\r\\n0 0 0 0 0 0 0 0 0 0 0 0\\r\\n'], 'output': ['-1\\r\\n']}]","id":692} {"difficulty":800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"14_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n i,j,k,n,m,g,g1,k1,h,f:Integer;\r\n s1,s2:string;\r\n s:array[1..10000] of string;\r\nbegin\r\n Readln(n,m);\r\n g:=1000000;\r\n for i:=1 to n do\r\n begin\r\n Readln(s[i]);\r\n s1:=s[i];\r\n k:=0;\r\n k1:=0;\r\n for j:=1 to Length(s1) do if (k=0) and (s1[j]='*') then k:=j;\r\n for j:=Length(s1) downto 1 do if (k1=0) and (s1[j]='*') then k1:=j;\r\n if (k0) then g:=k;\r\n if (k1>g1) and (k1<>0) then g1:=k1;\r\n end;\r\n k1:=0;\r\n for i:=1 to n do\r\n begin\r\n k:=0;\r\n s1:=s[i];\r\n f:=0;\r\n for j:=1 to Length(s1) do\r\n if (s1[j]='*') then inc (k);\r\n if (k>0) then inc (k1);\r\n for h:=i+1 to n do\r\n begin\r\n s2:=s[h];\r\n if (s1[h]='*') then inc (f);\r\n end;\r\n if (k1>0) and (f>0) then\r\n begin\r\n for h:=g to g1 do write(s1[h]);\r\n if (i<>n) then Writeln;\r\n end;\r\n end;\r\n Readln;\r\n Readln;\r\nend.\r\n ","description":"A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world economic crisis and high oil prices, he wants to send his creation, but to spend as little money as possible. For each sent square of paper (no matter whether it is shaded or not) Bob has to pay 3.14 burles. Please, help Bob cut out of his masterpiece a rectangle of the minimum cost, that will contain all the shaded squares. The rectangle's sides should be parallel to the sheet's sides.","input_specification":"The first line of the input data contains numbers n and m (1\u2264n,m\u226450), n \u2014 amount of lines, and m \u2014 amount of columns on Bob's sheet. The following n lines contain m characters each. Character \u00ab.\u00bb stands for a non-shaded square on the sheet, and \u00ab*\u00bb \u2014 for a shaded square. It is guaranteed that Bob has shaded at least one square.\n","output_specification":"Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better.\n","notes":null,"sample_inputs":["6 7\n.......\n..***..\n..*....\n..***..\n..*....\n..***..\n","3 3\n***\n*.*\n***\n"],"sample_outputs":["***\n*..\n***\n*..\n***\n","***\n*.*\n***\n"],"human_solution":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n\ti, j, n, m,\r\n\tsi, ei, sj, ej: Integer;\r\n\tl: array[1..50, 1..50] of Char;\r\n\r\nbegin\r\n\tFillChar(l, sizeof(l), 0);\r\n\tReadln(n, m);\r\n\tsi := n; sj := m;\r\n\tei := 1; ej := 1;\r\n\tfor i:=1 to n do\r\n\tbegin\r\n\t\tfor j:=1 to m do\r\n\t\tbegin\r\n\t\t\tRead(l[i, j]);\r\n\t\t\tif l[i, j]='*' then\r\n\t\t\tbegin\r\n\t\t\t\tif i>ei then ei := i;\r\n\t\t\t\tif iej then ej := j;\r\n\t\t\t\tif js1[k]) then\r\n begin\r\n Writeln(k-1);\r\n Readln;\r\n Exit;\r\n end;\r\n end;\r\n end;\r\n Writeln(k);\r\n Readln;\r\n Readln;\r\nend.\r\n ","description":"Polycarpus has n friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings s1,s2,...,sn. All these strings consist only of digits and have the same length. Once Polycarpus needed to figure out Tarasov city phone code. He assumed that the phone code of the city is the longest common prefix of all phone numbers of his friends. In other words, it is the longest string c which is a prefix (the beginning) of each si for all i (1\u2264i\u2264n). Help Polycarpus determine the length of the city phone code. ","input_specification":"The first line of the input contains an integer n (2\u2264n\u22643\u00b710^4) \u2014 the number of Polycarpus's friends. The following n lines contain strings s1,s2,...,sn \u2014 the phone numbers of Polycarpus's friends. It is guaranteed that all strings consist only of digits and have the same length from 1 to 20, inclusive. It is also guaranteed that all strings are different.\n","output_specification":"Print the number of digits in the city phone code.\n","notes":"A prefix of string t is a string that is obtained by deleting zero or more digits from the end of string t. For example, string \"00209\" has 6 prefixes: \"\" (an empty prefix), \"0\", \"00\", \"002\", \"0020\", \"00209\".\nIn the first sample the city phone code is string \"00\".\nIn the second sample the city phone code is an empty string.\nIn the third sample the city phone code is string \"770123456789\".\n","sample_inputs":["4\n00209\n00219\n00999\n00909\n","2\n1\n2\n","3\n77012345678999999999\n77012345678901234567\n77012345678998765432\n"],"sample_outputs":["2\n","0\n","12\n"],"human_solution":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n n, i, j: longint;\r\n a: array [1 .. 1000000] of string;\r\n\r\nbegin\r\n readln(n);\r\n for i := 1 to n do\r\n readln(a[i]);\r\n\r\n for i := 1 to length(a[1]) do\r\n for j := 1 to n - 1 do\r\n If a[j][i] <> a[j + 1][i] then begin\r\n writeln(i - 1);\r\n halt(0);\r\n end;\r\nend.\r\n","testcases":"[{'input': ['4\\r\\n00209\\r\\n00219\\r\\n00999\\r\\n00909\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n1\\r\\n2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n77012345678999999999\\r\\n77012345678901234567\\r\\n77012345678998765432\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['5\\r\\n4491183345\\r\\n4491184811\\r\\n4491162340\\r\\n4491233399\\r\\n4491449214\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10\\r\\n15424\\r\\n10953\\r\\n19176\\r\\n15514\\r\\n16284\\r\\n18680\\r\\n19305\\r\\n13816\\r\\n16168\\r\\n15924\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10\\r\\n4906361343\\r\\n8985777485\\r\\n1204265609\\r\\n7088384855\\r\\n4127287014\\r\\n7904807820\\r\\n3032139021\\r\\n5999959109\\r\\n6477458281\\r\\n3244359368\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10\\r\\n3717208309\\r\\n3717208306\\r\\n3717208302\\r\\n3717208301\\r\\n3717208303\\r\\n3717208308\\r\\n3717208304\\r\\n3717208307\\r\\n3717208300\\r\\n3717208305\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['9\\r\\n2881\\r\\n2808\\r\\n2868\\r\\n2874\\r\\n2894\\r\\n2870\\r\\n2818\\r\\n2896\\r\\n2890\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\n4\\r\\n9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n29867863763143509570\\r\\n59261213969200291523\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n84\\r\\n62\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n75970434466248453472\\r\\n75970434466248453476\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['10\\r\\n17254072509168593435\\r\\n17254072509168593433\\r\\n17254072509168593430\\r\\n17254072509168593432\\r\\n17254072509168593439\\r\\n17254072509168593436\\r\\n17254072509168593438\\r\\n17254072509168593437\\r\\n17254072509168593431\\r\\n17254072509168593434\\r\\n'], 'output': ['19\\r\\n']}]","id":695} {"difficulty":1100,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"174_A","execute_outcome":"RUNTIME_ERROR","source_code":"var n,b,i,x:longint;\r\n e:extended;\r\n a:array[1..10000]of longint;\r\nbegin\r\n assign(input,'input.txt');reset(input);\r\n assign(output,'output.txt');rewrite(output);\r\n read(n,b);\r\n for i:=1 to n do\r\n begin\r\n read(a[i]);\r\n b:=b+a[i];\r\n end;\r\n e:=b\/n;\r\n for i:=1 to n do\r\n if e sum then\r\n f := false;\r\n result := f;\r\nend;\r\n\r\nprocedure gen(n, l: integer);\r\nvar\r\n i, s1, s2: integer;\r\nbegin\r\n if l > n then begin\r\n if is_c then begin\r\n writeln(sum);\r\n for i := 1 to 9 do begin\r\n write(c[a[i]], ' ');\r\n if i mod 3 = 0 then\r\n writeln;\r\n end;\r\n halt;\r\n end;\r\n end else begin\r\n for i := 1 to 9 do\r\n if (u[i] = 0) then begin\r\n s1 := sum; s2 := sum;\r\n if l = 4 then\r\n s1 := c[a[1]] + c[a[2]] + c[a[3]];\r\n if l = 7 then\r\n s2 := c[a[4]] + c[a[5]] + c[a[6]];\r\n if (s1 = sum) and (s2 = sum) then begin\r\n u[i] := 1;\r\n a[l] := i;\r\n gen(n, l + 1);\r\n u[i] := 0;\r\n end;\r\n end;\r\n end;\r\nend;\r\n\r\nbegin\r\n read(n);\r\n sum := 0;\r\n for i := 1 to n * n do begin\r\n read(c[i]);\r\n sum := sum + c[i];\r\n end;\r\n sum := sum div n;\r\n if n = 3 then begin\r\n gen(n * n, 1);\r\n end else begin\r\n writeln(sum);\r\n writeln(c[1], ' ', c[2]);\r\n writeln(c[3], ' ', c[4]);\r\n end;\r\nend.\r\n","description":"The Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup contestants.The magic square is a matrix of size n\u00d7n. The elements of this matrix are integers. The sum of numbers in each row of the matrix is equal to some number s. The sum of numbers in each column of the matrix is also equal to s. In addition, the sum of the elements on the main diagonal is equal to s and the sum of elements on the secondary diagonal is equal to s. Examples of magic squares are given in the following figure: Magic squares You are given a set of n^2 integers ai. It is required to place these numbers into a square matrix of size n\u00d7n so that they form a magic square. Note that each number must occur in the matrix exactly the same number of times as it occurs in the original set.It is guaranteed that a solution exists!","input_specification":"The first input line contains a single integer n. The next line contains n^2 integers ai (-10^8\u2264ai\u226410^8), separated by single spaces.\nThe input limitations for getting 20 points are: \n 1\u2264n\u22643 The input limitations for getting 50 points are: \n 1\u2264n\u22644 It is guaranteed that there are no more than 9 distinct numbers among ai. The input limitations for getting 100 points are: \n 1\u2264n\u22644 ","output_specification":"The first line of the output should contain a single integer s. In each of the following n lines print n integers, separated by spaces and describing the resulting magic square. In the resulting magic square the sums in the rows, columns and diagonals must be equal to s. If there are multiple solutions, you are allowed to print any of them.\n","notes":null,"sample_inputs":["3\n1 2 3 4 5 6 7 8 9\n","3\n1 0 -1 0 2 -1 -2 0 1\n","2\n5 5 5 5\n"],"sample_outputs":["15\n2 7 6\n9 5 1\n4 3 8\n","0\n1 0 -1\n-2 0 2\n1 0 -1\n","10\n5 5\n5 5\n"],"human_solution":"{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\nvar bool:array[1..10000] of boolean;\r\n mas:array[1..10,1..10] of integer;\r\n a:array[1..1000] of integer;\r\n sum,n,i:integer;\r\nprocedure check;\r\nvar res,i,j:integer;\r\n procedure outt;\r\n var i,j:integer;\r\n begin\r\n writeln(sum);\r\n for i:=1 to n do\r\n begin\r\n for j:=1 to n -1 do\r\n write(a[mas[i,j]],' ');\r\n writeln(a[mas[i,n]]);\r\n end;\r\n halt;\r\n end;\r\nbegin\r\n for i:=1 to n do\r\n begin\r\n res:=0;\r\n for j:=1 to n do\r\n inc(res,a[mas[i,j]]);\r\n if res<>sum then exit;\r\n end;\r\n for j:=1 to n do\r\n begin\r\n res:=0;\r\n for i:=1 to n do\r\n inc(res,a[mas[i,j]]);\r\n if res<>sum then exit;\r\n end;\r\n res:=0;\r\n for i:=1 to n do\r\n inc(res,a[mas[i,i]]);\r\n if res<>sum then exit;\r\n res:=0;\r\n for i:=1 to n do\r\n inc(res,a[mas[i,n-i+1]]);\r\n if res<>sum then exit;\r\n outt;\r\nend;\r\n\r\nprocedure rec(x,y:integer);\r\nvar i,x1,y1:integer;\r\nbegin\r\n if (x=n) and (y=n) then\r\n begin\r\n check;\r\n exit;\r\n end;\r\n if y=n then x1:=x+1 else x1:=x;\r\n if y=n then y1:=1 else y1:=y+1;\r\n for i:=1 to sqr(n) do\r\n if (not bool[i])\r\n then\r\n begin\r\n mas[x1,y1]:=i;\r\n bool[i]:=true;\r\n rec(x1,y1);\r\n bool[i]:=false;\r\n end;\r\nend;\r\n\r\nbegin\r\n readln(n);\r\n sum:=0;\r\n for i:=1 to sqr(n) do\r\n begin\r\n read(a[i]);\r\n inc(sum,a[i]);\r\n end;\r\n sum:= sum div n;\r\n fillchar(bool,sizeof(bool),0);\r\n rec(1,0);\r\nend.","testcases":"[{'input': ['3\\r\\n1 2 3 4 5 6 7 8 9\\r\\n'], 'output': ['15\\r\\n2 7 6\\r\\n9 5 1\\r\\n4 3 8\\r\\n']}, {'input': ['3\\r\\n1 0 -1 0 2 -1 -2 0 1\\r\\n'], 'output': ['0\\r\\n1 0 -1\\r\\n-2 0 2\\r\\n1 0 -1\\r\\n']}, {'input': ['2\\r\\n5 5 5 5\\r\\n'], 'output': ['10\\r\\n5 5\\r\\n5 5\\r\\n']}, {'input': ['2\\r\\n-1 -1 -1 -1\\r\\n'], 'output': ['-2\\r\\n-1 -1\\r\\n-1 -1\\r\\n']}, {'input': ['3\\r\\n58 -83 72 65 -90 -2 -9 -16 -76\\r\\n'], 'output': ['-27\\r\\n-83 58 -2\\r\\n72 -9 -90\\r\\n-16 -76 65\\r\\n']}, {'input': ['3\\r\\n399 -1025 -129 -497 927 -577 479 31 -49\\r\\n'], 'output': ['-147\\r\\n399 -1025 479\\r\\n31 -49 -129\\r\\n-577 927 -497\\r\\n']}, {'input': ['3\\r\\n2 4 6 8 10 12 14 16 18\\r\\n'], 'output': ['30\\r\\n4 14 12\\r\\n18 10 2\\r\\n8 6 16\\r\\n']}, {'input': ['3\\r\\n36 31 -25 3 -20 -30 8 -2 26\\r\\n'], 'output': ['9\\r\\n31 -20 -2\\r\\n-30 3 36\\r\\n8 26 -25\\r\\n']}, {'input': ['3\\r\\n175 -1047 -731 -141 38 -594 -415 -278 491\\r\\n'], 'output': ['-834\\r\\n175 -1047 38\\r\\n-415 -278 -141\\r\\n-594 491 -731\\r\\n']}, {'input': ['3\\r\\n-1256 74 -770 -284 -105 381 -591 1046 560\\r\\n'], 'output': ['-315\\r\\n-770 74 381\\r\\n1046 -105 -1256\\r\\n-591 -284 560\\r\\n']}, {'input': ['1\\r\\n-98765432\\r\\n'], 'output': ['-98765432\\r\\n-98765432\\r\\n']}, {'input': ['3\\r\\n99981234 99981234 99981234 99981234 99981234 99981234 99981234 99981234 99981234\\r\\n'], 'output': ['299943702\\r\\n99981234 99981234 99981234\\r\\n99981234 99981234 99981234\\r\\n99981234 99981234 99981234\\r\\n']}, {'input': ['3\\r\\n-67774718 52574834 -7599942 52574834 52574834 -67774718 -67774718 -7599942 -7599942\\r\\n'], 'output': ['-22799826\\r\\n-67774718 52574834 -7599942\\r\\n52574834 -7599942 -67774718\\r\\n-7599942 -67774718 52574834\\r\\n']}, {'input': ['3\\r\\n12458317 12458317 -27658201 -7599942 -27658201 32516576 -67774719 -47716460 52574835\\r\\n'], 'output': ['-22799826\\r\\n12458317 12458317 -47716460\\r\\n-67774719 -7599942 52574835\\r\\n32516576 -27658201 -27658201\\r\\n']}, {'input': ['3\\r\\n-33389130 52574830 -16196338 -41985526 996454 26785642 -7599942 18189246 -67774714\\r\\n'], 'output': ['-22799826\\r\\n-33389130 52574830 -41985526\\r\\n-16196338 -7599942 996454\\r\\n26785642 -67774714 18189246\\r\\n']}]","id":697} {"difficulty":1300,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"189_A","execute_outcome":"WRONG_ANSWER","source_code":"var\r\nn,a,b,c:integer;\r\ni,j:integer;\r\nresult,tempResult:integer;\r\n\r\nbegin\r\n readln(n,a,b,c);\r\n for i:=0 to (n div a)+1 do\r\n begin\r\n for j:=0 to (n div b)+1 do\r\n begin\r\n if (((n-(a*i)-(b*j)) mod c) = 0) AND ((n-(a*i)-(b*j)) >= 0) then\r\n begin\r\n tempResult:=i+j+((n-(a*i)-(b*j)) div c);\r\n if result < tempResult then\r\n result := tempResult;\r\n end;\r\n end\r\n end;\r\n write(tempResult);\r\nend.","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\u2264n,a,b,c\u22644000) \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.\n","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.\n","notes":"In the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.\nIn the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2.\n","sample_inputs":["5 5 3 2\n","7 5 5 2\n"],"sample_outputs":["2\n","2\n"],"human_solution":"{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}\r\n{$MINSTACKSIZE $00004000}\r\n{$MAXSTACKSIZE $00100000}\r\n{$IMAGEBASE $00400000}\r\n{$APPTYPE CONSOLE}\r\n\r\nconst filename='x';\r\n oo=maxlongint div 2;\r\n eps=1e-6;\r\n eee=1e-21;\r\n\r\nvar qq,cc,a,aa:array[0..1000000]of longint;\r\n qc,he:array[0..201,0..201]of longint;\r\n ss:array[0..1000]of string;\r\n s,s0,s1,s2,s3:string;\r\n x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;\r\n u,v,nt,ii,jj,kk,nn,mm,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,cur,res,max,min:longint;\r\n test,ll,t,tt:longint;\r\n b,bb,bbb,b0,b1,b2,b3:boolean;\r\n\r\n\r\n \r\n\r\n\r\nfunction mx(q,c:longint):longint;\r\n begin\r\n if q>c then mx:=q else mx:=c;\r\n end;\r\n\r\n\r\nfunction mn(q,c:longint):longint;\r\n begin\r\n if q=0 then if qq[i]=0 then if qq[i]=0 then if qq[i] 1 do begin\r\n m := (l + r) div 2;\r\n if a[m] > n then\r\n r := m\r\n else\r\n l := m;\r\n end;\r\n bs := l;\r\nend;\r\n\r\nbegin\r\n \/\/reset(input, 'input.txt');\r\n \/\/rewrite(output, 'output.txt');\r\n read(n);\r\n a[1] := 1;\r\n for i := 2 to 200505 do\r\n a[i] := a[i - 1] + i;\r\n x := bs(1, 200501, n) + 1;;\r\n for i := x downto 1 do begin\r\n ost := n - a[i];\r\n if ost < 0 then continue;\r\n if a[bs(1, x, ost)] + a[i] = n then begin\r\n write('YES');\r\n halt;\r\n end;\r\n end;\r\n write('NO');\r\nend.\r\n","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 (i0) then min:=a[j];\r\n for j:=1 to n do dec(a[j],min);\r\n inc(ans,min);\r\n end;\r\n write(ans);\r\nend.","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":699} {"difficulty":1400,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"197_B","execute_outcome":"RUNTIME_ERROR","source_code":"Var x,y,i,up,down,nodd,u,d:LongInt;\r\n\r\nFunction NOD (a,b:LongInt):LongInt;\r\nBegin\r\n If b>a then NOD:=NOD (b,a)\r\n else If b=0 then NOD:=a\r\n else NOD:=NOD (b,a mod b);\r\nEnd;\r\n\r\nBegin\r\n \/\/Assign (input,'input.txt'); ReSet (input);\r\n \/\/Assign (output,'output.txt'); ReWrite (output);\r\n Readln (up,down);\r\n Readln (u);\r\n Readln (d);\r\n If down>up then Begin Writeln ('0\/1'); Exit End;\r\n If up>down\r\n then If u*d>0\r\n then Begin Writeln ('Infinity'); Exit End\r\n else Begin Writeln ('-Infinity'); Exit End;\r\n If u*d<0\r\n then Begin\r\n Write ('-');\r\n u:=Abs (u);\r\n d:=Abs (d);\r\n End;\r\n nodd:=NOD (u,d);\r\n Writeln (u div nodd,'\/',d div nodd);\r\nEnd.","description":"You are given two polynomials: P(x)=a0\u00b7x^n+a1\u00b7x^n-1+...+an-1\u00b7x+an and Q(x)=b0\u00b7x^m+b1\u00b7x^m-1+...+bm-1\u00b7x+bm. Calculate limit .","input_specification":"The first line contains two space-separated integers n and m (0\u2264n,m\u2264100) \u2014 degrees of polynomials P(x) and Q(x) correspondingly.\nThe second line contains n+1 space-separated integers \u2014 the factors of polynomial P(x): a0, a1, ..., an-1, an (-100\u2264ai\u2264100,a0\u22600).\nThe third line contains m+1 space-separated integers \u2014 the factors of polynomial Q(x): b0, b1, ..., bm-1, bm (-100\u2264bi\u2264100,b0\u22600).\n","output_specification":"If the limit equals +\u221e, print \"Infinity\" (without quotes). If the limit equals -\u221e, print \"-Infinity\" (without the quotes).\nIf the value of the limit equals zero, print \"0\/1\" (without the quotes).\nOtherwise, print an irreducible fraction \u2014 the value of limit , in the format \"p\/q\" (without the quotes), where p is the \u2014 numerator, q (q>0) is the denominator of the fraction.\n","notes":"Let's consider all samples:\n You can learn more about the definition and properties of limits if you follow the link: http:\/\/en.wikipedia.org\/wiki\/Limit_of_a_function\n","sample_inputs":["2 1\n1 1 1\n2 5\n","1 0\n-1 3\n2\n","0 1\n1\n1 0\n","2 2\n2 1 6\n4 5 -7\n","1 1\n9 0\n-5 2\n"],"sample_outputs":["Infinity\n","-Infinity\n","0\/1\n","1\/2\n","-9\/5\n"],"human_solution":"var\r\n\tn, m, i, ans : longint;\r\n\ta, b : array [0..111] of longint;\r\n\r\nfunction gcd(x, y : longint) : longint;\r\nbegin\r\n\twhile (x*y > 0) do begin\r\n\t\tif (x > y) then x := x mod y\r\n\t\telse y := y mod x;\r\n\tend;\r\n\tgcd := x+y;\r\nend;\r\nbegin\r\n\/\/\treset(input, 'a.in'); rewrite(output, 'a.out');\r\n\tread(n, m);\r\n\tfor i := 0 to n do read(a[i]);\r\n\tfor i := 0 to m do read(b[i]);\r\n\tif (n > m) then begin\r\n\t\tif (a[0]\/b[0] < 0) then write('-');\r\n\t\twrite('Infinity');\r\n\tend else\r\n\tif (n = m) then begin\r\n\t\tif (a[0]\/b[0] < 0) then write('-');\r\n\t\tans := gcd(abs(a[0]), abs(b[0]));\r\n\t\twrite(abs(a[0]) div ans,'\/',abs(b[0]) div ans);\r\n\tend\r\n\telse write('0\/1');\r\nend.","testcases":"[{'input': ['2 1\\r\\n1 1 1\\r\\n2 5\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['1 0\\r\\n-1 3\\r\\n2\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['0 1\\r\\n1\\r\\n1 0\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['2 2\\r\\n2 1 6\\r\\n4 5 -7\\r\\n'], 'output': ['1\/2\\n']}, {'input': ['1 1\\r\\n9 0\\r\\n-5 2\\r\\n'], 'output': ['-9\/5\\n']}, {'input': ['1 2\\r\\n5 3\\r\\n-3 2 -1\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['1 2\\r\\n-4 8\\r\\n-2 5 -3\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['3 2\\r\\n4 3 1 2\\r\\n-5 7 0\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['2 1\\r\\n-3 5 1\\r\\n-8 0\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['1 1\\r\\n-5 7\\r\\n3 1\\r\\n'], 'output': ['-5\/3\\n']}, {'input': ['2 2\\r\\n-4 2 1\\r\\n-5 8 -19\\r\\n'], 'output': ['4\/5\\n']}, {'input': ['0 100\\r\\n1\\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 100\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['100 0\\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 100\\r\\n1\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['0 0\\r\\n36\\r\\n-54\\r\\n'], 'output': ['-2\/3\\n']}, {'input': ['0 0\\r\\n36\\r\\n-8\\r\\n'], 'output': ['-9\/2\\n']}, {'input': ['0 0\\r\\n-6\\r\\n-8\\r\\n'], 'output': ['3\/4\\n']}, {'input': ['0 2\\r\\n-3\\r\\n1 4 6\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['0 0\\r\\n-21\\r\\n13\\r\\n'], 'output': ['-21\/13\\n']}, {'input': ['0 0\\r\\n-34\\r\\n21\\r\\n'], 'output': ['-34\/21\\n']}, {'input': ['0 0\\r\\n-55\\r\\n34\\r\\n'], 'output': ['-55\/34\\n']}, {'input': ['33 100\\r\\n-15 -90 -84 57 67 60 -40 -82 83 -80 43 -15 -36 -14 -37 -49 42 -79 49 -7 -12 53 -44 -21 87 -91 -73 -27 13 65 5 74 -21 -52\\r\\n-67 -17 36 -46 -5 31 -45 -35 -49 13 -7 -82 92 -55 -67 -96 31 -70 76 24 -29 26 96 19 -40 99 -26 74 -17 -56 -72 24 -71 -62 10 -56 -74 75 -48 -98 -67 -26 47 7 63 -38 99 66 -25 -31 -24 -42 -49 -27 -45 -2 -37 -16 5 -21 97 33 85 -33 93 30 84 73 -48 18 -36 71 -38 -41 28 1 -7 -15 60 59 -20 -38 -86 90 2 -12 72 -43 26 76 97 7 -2 -47 -4 100 -40 -48 53 -54 0\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['39 87\\r\\n78 -50 18 -32 -12 -65 83 41 -6 53 -26 64 -19 -53 -61 91 -49 -66 67 69 100 -39 95 99 86 -67 -66 63 48 26 -4 95 -54 -71 26 -74 -93 79 -91 -45\\r\\n-18 23 48 59 76 82 95 2 -26 18 -39 -74 44 -92 40 -44 1 -97 -100 -63 -54 -3 -86 85 28 -50 41 -53 -74 -29 -91 87 27 -42 -90 -15 -26 -15 -100 -70 -10 -41 16 85 71 -39 -31 -65 80 98 9 23 -40 14 -88 15 -34 10 -67 -94 -58 -24 75 48 -42 56 -77 -13 -25 -79 -100 -57 89 45 22 85 78 -93 -79 69 63 44 74 94 35 -65 -12 -88\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['47 56\\r\\n31 -99 -97 6 -45 -5 89 35 -77 69 57 91 -32 -66 -36 16 30 61 -36 32 48 67 5 -85 65 -11 -51 -63 -51 -16 39 -26 -60 -28 91 43 -90 32 44 83 70 -53 51 56 68 -81 76 79\\r\\n61 -21 -75 -36 -24 -19 80 26 -28 93 27 72 -39 -46 -38 68 -29 -16 -63 84 -13 64 55 63 77 5 68 70 15 99 12 -69 50 -48 -82 -3 52 -54 68 91 -37 -100 -5 74 24 91 -1 74 28 29 -87 -13 -88 82 -13 58 23\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['9 100\\r\\n-34 88 33 -80 87 31 -53 -3 8 -70\\r\\n31 -25 46 78 8 82 -92 -36 -30 85 -93 86 -87 75 8 -71 44 -41 -83 19 89 -28 81 42 79 86 41 -23 64 -31 46 24 -79 23 71 63 99 90 -16 -70 -1 88 10 65 3 -99 95 52 -80 53 -24 -43 -30 -7 51 40 -47 44 -10 -18 -61 -67 -84 37 45 93 -5 68 32 3 -61 -100 38 -21 -91 90 83 -45 75 89 17 -44 75 14 -28 1 -84 -100 -36 84 -40 88 -84 -54 2 -32 92 -49 77 85 91\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['28 87\\r\\n-77 49 37 46 -92 65 89 100 53 76 -43 47 -80 -46 -94 -4 20 46 81 -41 86 25 69 60 15 -78 -98 -7 -42\\r\\n-85 96 59 -40 90 -72 41 -17 -40 -15 -98 66 47 9 -33 -63 59 -25 -31 25 -94 35 28 -36 -41 -38 -38 -54 -40 90 7 -10 98 -19 54 -10 46 -58 -88 -21 90 82 37 -70 -98 -63 41 75 -50 -59 -69 79 -93 -3 -45 14 76 28 -28 -98 -44 -39 71 44 90 91 0 45 7 65 68 39 -27 58 68 -47 -41 100 14 -95 -80 69 -88 -51 -89 -70 -23 95\\r\\n'], 'output': ['0\/1\\r\\n']}, {'input': ['100 4\\r\\n-5 -93 89 -26 -79 14 -28 13 -45 69 50 -84 21 -68 62 30 -26 99 -12 39 20 -74 -39 -41 -28 -72 -55 28 20 31 -92 -20 76 -65 57 72 -36 4 33 -28 -19 -41 -40 40 84 -36 -83 75 -74 -80 32 -50 -56 72 16 75 57 90 -19 -10 67 -71 69 -48 -48 23 37 -31 -64 -86 20 67 97 14 82 -41 2 87 65 -81 -27 9 -79 -1 -5 84 -8 29 -34 31 82 40 21 -53 -31 -45 17 -33 79 50 -94\\r\\n56 -4 -90 36 84\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['77 51\\r\\n89 45 -33 -87 33 -61 -79 40 -76 16 -17 31 27 25 99 82 51 -40 85 -66 19 89 -62 24 -61 -53 -77 17 21 83 53 -18 -56 75 9 -78 33 -11 -6 96 -33 -2 -57 97 30 20 -41 42 -13 45 -99 67 37 -20 51 -33 88 -62 2 40 17 36 45 71 4 -44 24 20 -2 29 -12 -84 -7 -84 -38 48 -73 79\\r\\n60 -43 60 1 90 -1 19 -18 -21 31 -76 51 79 91 12 39 -33 -14 71 -90 -65 -93 -58 93 49 17 77 19 32 -8 14 58 -9 85 -95 -73 0 85 -91 -99 -30 -43 61 20 -89 93 53 20 -33 -38 79 54\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['84 54\\r\\n82 -54 28 68 74 -61 54 98 59 67 -65 -1 16 65 -78 -16 61 -79 2 14 44 96 -62 77 51 87 37 66 65 28 88 -99 -21 -83 24 80 39 64 -65 45 86 -53 -49 94 -75 -31 -42 -1 -35 -18 74 30 31 -40 30 -6 47 58 -71 -21 20 13 75 -79 15 -98 -26 76 99 -77 -9 85 48 51 -87 56 -53 37 47 -3 94 64 -7 74 86\\r\\n72 51 -74 20 41 -76 98 58 24 -61 -97 -73 62 29 6 42 -92 -6 -65 89 -32 -9 82 -13 -88 -70 -97 25 -48 12 -54 33 -92 -29 48 60 -21 86 -17 -86 45 -34 -3 -9 -62 12 25 -74 -76 -89 48 55 -30 86 51\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['73 15\\r\\n-70 78 51 -33 -95 46 87 -33 16 62 67 -85 -57 75 -93 -59 98 -45 -90 -88 9 53 35 37 28 3 40 -87 28 5 18 11 9 1 72 69 -65 -62 1 73 -3 3 35 17 -28 -31 -45 60 64 18 60 38 -47 12 2 -90 -4 33 -51 -55 -54 90 38 -65 39 32 -70 0 -5 3 -12 100 78 55\\r\\n46 33 41 52 -89 -9 53 -81 34 -45 -11 -41 14 -28 95 -50\\r\\n'], 'output': ['-Infinity\\r\\n']}, {'input': ['33 1\\r\\n-75 -83 87 -27 -48 47 -90 -84 -18 -4 14 -1 -83 -98 -68 -85 -86 28 2 45 96 -59 86 -25 -2 -64 -92 65 69 72 72 -58 -99 90\\r\\n-1 72\\r\\n'], 'output': ['Infinity\\r\\n']}, {'input': ['58 58\\r\\n-25 40 -34 23 -52 94 -30 -99 -71 -90 -44 -71 69 48 -45 -59 0 66 -70 -96 95 91 82 90 -95 87 3 -77 -77 -26 15 87 -82 5 -24 82 -11 99 35 49 22 44 18 -60 -26 79 67 71 -13 29 -23 9 58 -90 88 18 77 5 -7\\r\\n-30 -11 -13 -50 61 -78 11 -74 -73 13 -66 -65 -82 38 58 25 -64 -24 78 -87 6 6 -80 -96 47 -25 -54 10 -41 -22 -50 -1 -6 -22 27 54 -32 30 93 88 -70 -100 -69 -47 -20 -92 -24 70 -93 42 78 42 -35 41 31 75 -67 -62 -83\\r\\n'], 'output': ['5\/6\\n']}, {'input': ['20 20\\r\\n5 4 91 -66 -57 55 -79 -2 -54 -72 -49 21 -23 -5 57 -48 70 -16 -86 -26 -19\\r\\n51 -60 64 -8 89 27 -96 4 95 -24 -2 -27 -41 -14 -88 -19 24 68 -31 34 -62\\r\\n'], 'output': ['5\/51\\n']}, {'input': ['69 69\\r\\n-90 -63 -21 23 23 -14 -82 65 42 -60 -42 -39 67 34 96 93 -42 -24 21 -80 44 -81 45 -74 -19 -88 39 58 90 87 16 48 -19 -2 36 87 4 -66 -82 -49 -32 -43 -65 12 34 -29 -58 46 -67 -20 -30 91 21 65 15 2 3 -92 -67 -68 39 -24 77 76 -17 -34 5 63 88 83\\r\\n-55 98 -79 18 -100 -67 -79 -85 -75 -44 -6 -73 -11 -12 -24 -78 47 -51 25 -29 -34 25 27 11 -87 15 -44 41 -44 46 -67 70 -35 41 62 -36 27 -41 -42 -50 96 31 26 -66 9 74 34 31 25 6 -84 41 74 -7 49 5 35 -5 -71 -37 28 58 -8 -40 -19 -83 -34 64 7 15\\r\\n'], 'output': ['18\/11\\n']}, {'input': ['0 0\\r\\n46\\r\\n-33\\r\\n'], 'output': ['-46\/33\\n']}, {'input': ['67 67\\r\\n-8 11 55 80 -26 -38 58 73 -48 -10 35 75 16 -84 55 -51 98 58 -28 98 77 81 51 -86 -46 68 -87 -80 -49 81 96 -97 -42 25 6 -8 -55 -25 93 -29 -33 -6 -26 -85 73 97 63 57 51 92 -6 -8 4 86 46 -45 36 -19 -71 1 71 39 97 -44 -34 -1 2 -46\\r\\n91 -32 -76 11 -40 91 -8 -100 73 80 47 82 24 0 -71 82 -93 38 -54 1 -55 -53 90 -86 0 10 -35 49 90 56 25 17 46 -43 13 16 -82 -33 64 -83 -56 22 12 -74 4 -68 85 -27 60 -28 -47 73 -93 69 -37 54 -3 90 -56 56 78 61 7 -79 48 -42 -10 -48\\r\\n'], 'output': ['-8\/91\\n']}, {'input': ['69 69\\r\\n-7 38 -3 -22 65 -78 -65 -99 -76 63 0 -4 -78 -51 54 -61 -53 60 80 34 -96 99 -78 -96 21 -10 -86 33 -9 -81 -19 -2 -76 -3 -66 -80 -55 -21 -50 37 -86 -37 47 44 76 -39 54 -25 41 -86 -3 -25 -67 94 18 67 27 -5 -30 -69 2 -76 7 -97 -52 -35 -55 -20 92 2\\r\\n90 -94 37 41 -27 -54 96 -15 -60 -29 -75 -93 -57 62 48 -88 -99 -62 4 -9 85 33 65 -95 -30 16 -29 -89 -33 -83 -35 -21 53 -52 80 -40 76 -33 86 47 18 43 -67 -36 -99 -42 1 -94 -78 34 -41 73 96 2 -60 29 68 -96 -21 -61 -98 -67 1 40 85 55 66 -25 -50 -83\\r\\n'], 'output': ['-7\/90\\n']}, {'input': ['17 17\\r\\n-54 59 -95 87 3 -27 -30 49 -87 74 45 78 36 60 -95 41 -53 -70\\r\\n-27 16 -67 -24 10 -73 -41 12 -52 53 -73 -17 -56 -74 -33 -8 100 -39\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['1 1\\r\\n36 -49\\r\\n-32 -40\\r\\n'], 'output': ['-9\/8\\n']}, {'input': ['1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['1 1\\r\\n-2 1\\r\\n4 1\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n2\\r\\n1\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-3\\r\\n'], 'output': ['-4\/3\\n']}, {'input': ['0 0\\r\\n2\\r\\n2\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n17\\r\\n-10\\r\\n'], 'output': ['-17\/10\\n']}, {'input': ['0 0\\r\\n-1\\r\\n2\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n1\\r\\n1\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n50\\r\\n20\\r\\n'], 'output': ['5\/2\\n']}, {'input': ['0 0\\r\\n20\\r\\n20\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-2\\r\\n'], 'output': ['-2\/1\\n']}, {'input': ['0 0\\r\\n4\\r\\n-6\\r\\n'], 'output': ['-2\/3\\n']}, {'input': ['0 0\\r\\n1\\r\\n-2\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['0 0\\r\\n4\\r\\n2\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['0 0\\r\\n2\\r\\n-4\\r\\n'], 'output': ['-1\/2\\n']}, {'input': ['1 1\\r\\n4 1\\r\\n2 1\\r\\n'], 'output': ['2\/1\\n']}, {'input': ['2 2\\r\\n-13 1 3\\r\\n6 3 2\\r\\n'], 'output': ['-13\/6\\n']}, {'input': ['99 99\\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\\n2 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 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n'], 'output': ['1\/2\\n']}, {'input': ['0 0\\r\\n5\\r\\n5\\r\\n'], 'output': ['1\/1\\n']}, {'input': ['0 0\\r\\n2\\r\\n-1\\r\\n'], 'output': ['-2\/1\\n']}]","id":700} {"difficulty":1200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"203_A","execute_outcome":"WRONG_ANSWER","source_code":"Uses SysUtils,Math;\r\nVar x,t,t1,a,b,da,db,fa,fb,ft:Integer;\r\nBegin\r\n \/\/\/assign(input,'input.txt');\r\n \/\/\/assign(output,'output.txt');\r\n readln(x,t,a,b,da,db);\r\n fa:=a;\r\n fb:=b;\r\n ft:=t;\r\n Repeat\r\n If (a=x) or (b=x)\r\n then begin\r\n write('YES');\r\n Halt(0);\r\n end;\r\n a:=a-da;\r\n b:=b-db;\r\n t:=t-1;\r\n Until ((a<=0) and (b<=0)) or (t<=0);\r\n b:=fb;\r\n t1:=ft;\r\n Repeat\r\n a:=fa;\r\n t:=ft;\r\n Repeat\r\n If (a+b)=x\r\n then begin\r\n write('YES');\r\n Halt(0);\r\n end;\r\n a:=a-da;\r\n t:=t-1;\r\n Until (a<=0) or (t<=0);\r\n b:=b-db;\r\n t1:=t1-1;\r\n Until (b<=0) or (t1<=0);\r\n write('NO');\r\nEnd.\r\n","description":"A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend's words and decided to check whether Valera could have shown such a result.He knows that the contest number 300 was unusual because there were only two problems. The contest lasted for t minutes, the minutes are numbered starting from zero. The first problem had the initial cost of a points, and every minute its cost reduced by da points. The second problem had the initial cost of b points, and every minute this cost reduced by db points. Thus, as soon as the zero minute of the contest is over, the first problem will cost a-da points, and the second problem will cost b-db points. It is guaranteed that at any moment of the contest each problem has a non-negative cost.Arkady asks you to find out whether Valera could have got exactly x points for this contest. You should assume that Valera could have solved any number of the offered problems. You should also assume that for each problem Valera made no more than one attempt, besides, he could have submitted both problems at the same minute of the contest, starting with minute 0 and ending with minute number t-1. Please note that Valera can't submit a solution exactly t minutes after the start of the contest or later.","input_specification":"The single line of the input contains six integers x,t,a,b,da,db (0\u2264x\u2264600;\u00a01\u2264t,a,b,da,db\u2264300) \u2014 Valera's result, the contest's duration, the initial cost of the first problem, the initial cost of the second problem, the number of points that the first and the second problem lose per minute, correspondingly.\nIt is guaranteed that at each minute of the contest each problem has a non-negative cost, that is, a-i\u00b7da\u22650 and b-i\u00b7db\u22650 for all 0\u2264i\u2264t-1.\n","output_specification":"If Valera could have earned exactly x points at a contest, print \"YES\", otherwise print \"NO\" (without the quotes).\n","notes":"In the first sample Valera could have acted like this: he could have submitted the first problem at minute 0 and the second problem \u2014 at minute 2. Then the first problem brings him 20 points and the second problem brings him 10 points, that in total gives the required 30 points.\n","sample_inputs":["30 5 20 20 3 5\n","10 4 100 5 5 1\n"],"sample_outputs":["YES\n","NO\n"],"human_solution":"{$apptype console}\r\n{$I+,R+,Q+}\r\nUses SysUtils;\r\n\r\nVar\r\n x,t,a,b,a1,b1:integer;\r\n i,j,z,f:integer;\r\nBegin\r\n readln(x,t,a,b,a1,b1);\r\n if x=0 then begin\r\n writeln('YES');\r\n exit;\r\n end;\r\n for i:=0 to t-1 do begin\r\n z:=x-a+a1*i;\r\n if z=0 then begin\r\n writeln('YES');\r\n exit;\r\n end;\r\n for j:=0 to t-1 do begin\r\n if z<0 then break;\r\n f:=z-b+b1*j;\r\n if f=0 then begin\r\n writeln('YES');\r\n exit;\r\n end;\r\n end;\r\n end;\r\n for i:=0 to t-1 do begin\r\n z:=x-b+b1*i;\r\n if z=0 then begin\r\n writeln('YES');\r\n exit;\r\n end;\r\n end;\r\n writeln('NO');\r\nEnd.\r\n","testcases":"[{'input': ['30 5 20 20 3 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 4 100 5 5 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['0 7 30 50 3 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50 10 30 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['40 1 40 5 11 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['35 8 20 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 2 27 4 11 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['64 12 258 141 10 7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5 3 11 100 2 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 4 11 80 2 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['28 3 16 20 3 10\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 2 11 1 11 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15 5 230 213 32 25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['223 92 123 118 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['375 6 133 267 19 36\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['80 5 39 40 1 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['543 4 31 69 6 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['38 100 99 245 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 1 20 15 17 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['360 5 215 4 52 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['363 2 280 239 5 231\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['46 7 18 6 3 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['5 3 135 12 21 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['15 5 230 213 32 25\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 5 29 36 5 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['59 4 113 45 25 12\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['74 72 104 71 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16 24 26 23 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['11 1 10 1 10 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['13 3 11 14 5 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 2 1 2 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['145 26 25 150 1 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['59 18 50 17 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['230 125 175 124 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['142 1 66 76 18 39\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 3 5 6 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['6 46 95 45 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['16 73 92 72 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 18 272 17 6 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 21 178 20 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 15 86 84 5 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 35 208 98 6 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['0 11 67 82 6 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['30 9 18 83 1 7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['18 12 11 54 1 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['41 77 96 145 1 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['27 45 44 169 1 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['50 5 30 60 3 3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['49 2 50 20 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['49 2 50 20 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['17 10 10 20 1 2\\r\\n'], 'output': ['YES\\r\\n']}]","id":701} {"difficulty":900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"208_A","execute_outcome":"RUNTIME_ERROR","source_code":"var s, t:string;\ni, j, x:integer;\nbegin\n\ti := 1;\n\twhile(not eoln) do read(s);\n\ts := s + ' ';\n\twhile i < (length(s) - 2) do begin\n\t\tif (s[i] <> 'W') or (s[i + 1] <> 'U') or (s[i + 2] <> 'B') then begin\n\t\t\tt := t + s[i];\n\t\t\tx := 0;\n\t\tend\n\t\telse \n\t\tbegin\n\t\t i := i + 2;\n\t\t\tif (x = 0) then begin\n\t\t\tt := t + ' ';\n\t\t\tx := 1;\n\t\tend;\n\t\tend;\n\t\tinc(i);\n\tend;\n\ti := 1;\n\twhile t[i] = ' ' do inc(i);\n\tj := length(t);\n\twhile t[j] = ' ' do dec(j);\n\tfor x := i to j do write(t[x]);\nend.","description":"Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words \"WUB\" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including \"WUB\", in one string and plays the song at the club.For example, a song with words \"I AM X\" can transform into a dubstep remix as \"WUBWUBIWUBAMWUBWUBX\" and cannot transform into \"WUBWUBIAMWUBX\".Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.","input_specification":"The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring \"WUB\" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.\n","output_specification":"Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.\n","notes":"In the first sample: \"WUBWUBABCWUB\" = \"WUB\" + \"WUB\" + \"ABC\" + \"WUB\". That means that the song originally consisted of a single word \"ABC\", and all words \"WUB\" were added by Vasya.\nIn the second sample Vasya added a single word \"WUB\" between all neighbouring words, in the beginning and in the end, except for words \"ARE\" and \"THE\" \u2014 between them Vasya added two \"WUB\".\n","sample_inputs":["WUBWUBABCWUB\n","WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\n"],"sample_outputs":["ABC ","WE ARE THE CHAMPIONS MY FRIEND "],"human_solution":"uses\r\n SysUtils;\r\n\r\nvar\r\n s: string;\r\n\r\nbegin\r\n read(s);\r\n\r\n while pos('WUB', s) > 0 do begin\r\n s := StringReplace(s, 'WUB', ' ', [rfReplaceAll,rfIgnoreCase]);\r\n end;\r\n\r\n write(s);\r\n\r\nend.\r\n","testcases":"[{'input': ['WUBWUBABCWUB\\r\\n'], 'output': ['ABC ']}, {'input': ['WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB\\r\\n'], 'output': ['WE ARE THE CHAMPIONS MY FRIEND ']}, {'input': ['WUBWUBWUBSR\\r\\n'], 'output': ['SR ']}, {'input': ['RWUBWUBWUBLWUB\\r\\n'], 'output': ['R L ']}, {'input': ['ZJWUBWUBWUBJWUBWUBWUBL\\r\\n'], 'output': ['ZJ J L ']}, {'input': ['CWUBBWUBWUBWUBEWUBWUBWUBQWUBWUBWUB\\r\\n'], 'output': ['C B E Q ']}, {'input': ['WUBJKDWUBWUBWBIRAQKFWUBWUBYEWUBWUBWUBWVWUBWUB\\r\\n'], 'output': ['JKD WBIRAQKF YE WV ']}, {'input': ['WUBKSDHEMIXUJWUBWUBRWUBWUBWUBSWUBWUBWUBHWUBWUBWUB\\r\\n'], 'output': ['KSDHEMIXUJ R S H ']}, {'input': ['OGWUBWUBWUBXWUBWUBWUBIWUBWUBWUBKOWUBWUB\\r\\n'], 'output': ['OG X I KO ']}, {'input': ['QWUBQQWUBWUBWUBIWUBWUBWWWUBWUBWUBJOPJPBRH\\r\\n'], 'output': ['Q QQ I WW JOPJPBRH ']}, {'input': ['VSRNVEATZTLGQRFEGBFPWUBWUBWUBAJWUBWUBWUBPQCHNWUBCWUB\\r\\n'], 'output': ['VSRNVEATZTLGQRFEGBFP AJ PQCHN C ']}, {'input': ['WUBWUBEWUBWUBWUBIQMJNIQWUBWUBWUBGZZBQZAUHYPWUBWUBWUBPMRWUBWUBWUBDCV\\r\\n'], 'output': ['E IQMJNIQ GZZBQZAUHYP PMR DCV ']}, {'input': ['WUBWUBWUBFVWUBWUBWUBBPSWUBWUBWUBRXNETCJWUBWUBWUBJDMBHWUBWUBWUBBWUBWUBVWUBWUBB\\r\\n'], 'output': ['FV BPS RXNETCJ JDMBH B V B ']}, {'input': ['WUBWUBWUBFBQWUBWUBWUBIDFSYWUBWUBWUBCTWDMWUBWUBWUBSXOWUBWUBWUBQIWUBWUBWUBL\\r\\n'], 'output': ['FBQ IDFSY CTWDM SXO QI L ']}, {'input': ['IWUBWUBQLHDWUBYIIKZDFQWUBWUBWUBCXWUBWUBUWUBWUBWUBKWUBWUBWUBNL\\r\\n'], 'output': ['I QLHD YIIKZDFQ CX U K NL ']}, {'input': ['KWUBUPDYXGOKUWUBWUBWUBAGOAHWUBIZDWUBWUBWUBIYWUBWUBWUBVWUBWUBWUBPWUBWUBWUBE\\r\\n'], 'output': ['K UPDYXGOKU AGOAH IZD IY V P E ']}, {'input': ['WUBWUBOWUBWUBWUBIPVCQAFWYWUBWUBWUBQWUBWUBWUBXHDKCPYKCTWWYWUBWUBWUBVWUBWUBWUBFZWUBWUB\\r\\n'], 'output': ['O IPVCQAFWY Q XHDKCPYKCTWWY V FZ ']}, {'input': ['PAMJGYWUBWUBWUBXGPQMWUBWUBWUBTKGSXUYWUBWUBWUBEWUBWUBWUBNWUBWUBWUBHWUBWUBWUBEWUBWUB\\r\\n'], 'output': ['PAMJGY XGPQM TKGSXUY E N H E ']}, {'input': ['WUBYYRTSMNWUWUBWUBWUBCWUBWUBWUBCWUBWUBWUBFSYUINDWOBVWUBWUBWUBFWUBWUBWUBAUWUBWUBWUBVWUBWUBWUBJB\\r\\n'], 'output': ['YYRTSMNWU C C FSYUINDWOBV F AU V JB ']}, {'input': ['WUBWUBYGPYEYBNRTFKOQCWUBWUBWUBUYGRTQEGWLFYWUBWUBWUBFVWUBHPWUBWUBWUBXZQWUBWUBWUBZDWUBWUBWUBM\\r\\n'], 'output': ['YGPYEYBNRTFKOQC UYGRTQEGWLFY FV HP XZQ ZD M ']}, {'input': ['WUBZVMJWUBWUBWUBFOIMJQWKNZUBOFOFYCCWUBWUBWUBAUWWUBRDRADWUBWUBWUBCHQVWUBWUBWUBKFTWUBWUBWUBW\\r\\n'], 'output': ['ZVMJ FOIMJQWKNZUBOFOFYCC AUW RDRAD CHQV KFT W ']}, {'input': ['WUBWUBZBKOKHQLGKRVIMZQMQNRWUBWUBWUBDACWUBWUBNZHFJMPEYKRVSWUBWUBWUBPPHGAVVPRZWUBWUBWUBQWUBWUBAWUBG\\r\\n'], 'output': ['ZBKOKHQLGKRVIMZQMQNR DAC NZHFJMPEYKRVS PPHGAVVPRZ Q A G ']}, {'input': ['WUBWUBJWUBWUBWUBNFLWUBWUBWUBGECAWUBYFKBYJWTGBYHVSSNTINKWSINWSMAWUBWUBWUBFWUBWUBWUBOVWUBWUBLPWUBWUBWUBN\\r\\n'], 'output': ['J NFL GECA YFKBYJWTGBYHVSSNTINKWSINWSMA F OV LP N ']}, {'input': ['WUBWUBLCWUBWUBWUBZGEQUEATJVIXETVTWUBWUBWUBEXMGWUBWUBWUBRSWUBWUBWUBVWUBWUBWUBTAWUBWUBWUBCWUBWUBWUBQG\\r\\n'], 'output': ['LC ZGEQUEATJVIXETVT EXMG RS V TA C QG ']}, {'input': ['WUBMPWUBWUBWUBORWUBWUBDLGKWUBWUBWUBVVZQCAAKVJTIKWUBWUBWUBTJLUBZJCILQDIFVZWUBWUBYXWUBWUBWUBQWUBWUBWUBLWUB\\r\\n'], 'output': ['MP OR DLGK VVZQCAAKVJTIK TJLUBZJCILQDIFVZ YX Q L ']}, {'input': ['WUBNXOLIBKEGXNWUBWUBWUBUWUBGITCNMDQFUAOVLWUBWUBWUBAIJDJZJHFMPVTPOXHPWUBWUBWUBISCIOWUBWUBWUBGWUBWUBWUBUWUB\\r\\n'], 'output': ['NXOLIBKEGXN U GITCNMDQFUAOVL AIJDJZJHFMPVTPOXHP ISCIO G U ']}, {'input': ['WUBWUBNMMWCZOLYPNBELIYVDNHJUNINWUBWUBWUBDXLHYOWUBWUBWUBOJXUWUBWUBWUBRFHTGJCEFHCGWARGWUBWUBWUBJKWUBWUBSJWUBWUB\\r\\n'], 'output': ['NMMWCZOLYPNBELIYVDNHJUNIN DXLHYO OJXU RFHTGJCEFHCGWARG JK SJ ']}, {'input': ['SGWLYSAUJOJBNOXNWUBWUBWUBBOSSFWKXPDPDCQEWUBWUBWUBDIRZINODWUBWUBWUBWWUBWUBWUBPPHWUBWUBWUBRWUBWUBWUBQWUBWUBWUBJWUB\\r\\n'], 'output': ['SGWLYSAUJOJBNOXN BOSSFWKXPDPDCQE DIRZINOD W PPH R Q J ']}, {'input': ['TOWUBWUBWUBGBTBNWUBWUBWUBJVIOJBIZFUUYHUAIEBQLQXPQKZJMPTCWBKPOSAWUBWUBWUBSWUBWUBWUBTOLVXWUBWUBWUBNHWUBWUBWUBO\\r\\n'], 'output': ['TO GBTBN JVIOJBIZFUUYHUAIEBQLQXPQKZJMPTCWBKPOSA S TOLVX NH O ']}, {'input': ['WUBWUBWSPLAYSZSAUDSWUBWUBWUBUWUBWUBWUBKRWUBWUBWUBRSOKQMZFIYZQUWUBWUBWUBELSHUWUBWUBWUBUKHWUBWUBWUBQXEUHQWUBWUBWUBBWUBWUBWUBR\\r\\n'], 'output': ['WSPLAYSZSAUDS U KR RSOKQMZFIYZQU ELSHU UKH QXEUHQ B R ']}, {'input': ['WUBXEMWWVUHLSUUGRWUBWUBWUBAWUBXEGILZUNKWUBWUBWUBJDHHKSWUBWUBWUBDTSUYSJHWUBWUBWUBPXFWUBMOHNJWUBWUBWUBZFXVMDWUBWUBWUBZMWUBWUB\\r\\n'], 'output': ['XEMWWVUHLSUUGR A XEGILZUNK JDHHKS DTSUYSJH PXF MOHNJ ZFXVMD ZM ']}, {'input': ['BMBWUBWUBWUBOQKWUBWUBWUBPITCIHXHCKLRQRUGXJWUBWUBWUBVWUBWUBWUBJCWUBWUBWUBQJPWUBWUBWUBBWUBWUBWUBBMYGIZOOXWUBWUBWUBTAGWUBWUBHWUB\\r\\n'], 'output': ['BMB OQK PITCIHXHCKLRQRUGXJ V JC QJP B BMYGIZOOX TAG H ']}, {'input': ['CBZNWUBWUBWUBNHWUBWUBWUBYQSYWUBWUBWUBMWUBWUBWUBXRHBTMWUBWUBWUBPCRCWUBWUBWUBTZUYLYOWUBWUBWUBCYGCWUBWUBWUBCLJWUBWUBWUBSWUBWUBWUB\\r\\n'], 'output': ['CBZN NH YQSY M XRHBTM PCRC TZUYLYO CYGC CLJ S ']}, {'input': ['DPDWUBWUBWUBEUQKWPUHLTLNXHAEKGWUBRRFYCAYZFJDCJLXBAWUBWUBWUBHJWUBOJWUBWUBWUBNHBJEYFWUBWUBWUBRWUBWUBWUBSWUBWWUBWUBWUBXDWUBWUBWUBJWUB\\r\\n'], 'output': ['DPD EUQKWPUHLTLNXHAEKG RRFYCAYZFJDCJLXBA HJ OJ NHBJEYF R S W XD J ']}, {'input': ['WUBWUBWUBISERPQITVIYERSCNWUBWUBWUBQWUBWUBWUBDGSDIPWUBWUBWUBCAHKDZWEXBIBJVVSKKVQJWUBWUBWUBKIWUBWUBWUBCWUBWUBWUBAWUBWUBWUBPWUBWUBWUBHWUBWUBWUBF\\r\\n'], 'output': ['ISERPQITVIYERSCN Q DGSDIP CAHKDZWEXBIBJVVSKKVQJ KI C A P H F ']}, {'input': ['WUBWUBWUBIWUBWUBLIKNQVWUBWUBWUBPWUBWUBWUBHWUBWUBWUBMWUBWUBWUBDPRSWUBWUBWUBBSAGYLQEENWXXVWUBWUBWUBXMHOWUBWUBWUBUWUBWUBWUBYRYWUBWUBWUBCWUBWUBWUBY\\r\\n'], 'output': ['I LIKNQV P H M DPRS BSAGYLQEENWXXV XMHO U YRY C Y ']}, {'input': ['WUBWUBWUBMWUBWUBWUBQWUBWUBWUBITCFEYEWUBWUBWUBHEUWGNDFNZGWKLJWUBWUBWUBMZPWUBWUBWUBUWUBWUBWUBBWUBWUBWUBDTJWUBHZVIWUBWUBWUBPWUBFNHHWUBWUBWUBVTOWUB\\r\\n'], 'output': ['M Q ITCFEYE HEUWGNDFNZGWKLJ MZP U B DTJ HZVI P FNHH VTO ']}, {'input': ['WUBWUBNDNRFHYJAAUULLHRRDEDHYFSRXJWUBWUBWUBMUJVDTIRSGYZAVWKRGIFWUBWUBWUBHMZWUBWUBWUBVAIWUBWUBWUBDDKJXPZRGWUBWUBWUBSGXWUBWUBWUBIFKWUBWUBWUBUWUBWUBWUBW\\r\\n'], 'output': ['NDNRFHYJAAUULLHRRDEDHYFSRXJ MUJVDTIRSGYZAVWKRGIF HMZ VAI DDKJXPZRG SGX IFK U W ']}, {'input': ['WUBOJMWRSLAXXHQRTPMJNCMPGWUBWUBWUBNYGMZIXNLAKSQYWDWUBWUBWUBXNIWUBWUBWUBFWUBWUBWUBXMBWUBWUBWUBIWUBWUBWUBINWUBWUBWUBWDWUBWUBWUBDDWUBWUBWUBD\\r\\n'], 'output': ['OJMWRSLAXXHQRTPMJNCMPG NYGMZIXNLAKSQYWD XNI F XMB I IN WD DD D ']}, {'input': ['WUBWUBWUBREHMWUBWUBWUBXWUBWUBWUBQASNWUBWUBWUBNLSMHLCMTICWUBWUBWUBVAWUBWUBWUBHNWUBWUBWUBNWUBWUBWUBUEXLSFOEULBWUBWUBWUBXWUBWUBWUBJWUBWUBWUBQWUBWUBWUBAWUBWUB\\r\\n'], 'output': ['REHM X QASN NLSMHLCMTIC VA HN N UEXLSFOEULB X J Q A ']}, {'input': ['WUBWUBWUBSTEZTZEFFIWUBWUBWUBSWUBWUBWUBCWUBFWUBHRJPVWUBWUBWUBDYJUWUBWUBWUBPWYDKCWUBWUBWUBCWUBWUBWUBUUEOGCVHHBWUBWUBWUBEXLWUBWUBWUBVCYWUBWUBWUBMWUBWUBWUBYWUB\\r\\n'], 'output': ['STEZTZEFFI S C F HRJPV DYJU PWYDKC C UUEOGCVHHB EXL VCY M Y ']}, {'input': ['WPPNMSQOQIWUBWUBWUBPNQXWUBWUBWUBHWUBWUBWUBNFLWUBWUBWUBGWSGAHVJFNUWUBWUBWUBFWUBWUBWUBWCMLRICFSCQQQTNBWUBWUBWUBSWUBWUBWUBKGWUBWUBWUBCWUBWUBWUBBMWUBWUBWUBRWUBWUB\\r\\n'], 'output': ['WPPNMSQOQI PNQX H NFL GWSGAHVJFNU F WCMLRICFSCQQQTNB S KG C BM R ']}, {'input': ['YZJOOYITZRARKVFYWUBWUBRZQGWUBWUBWUBUOQWUBWUBWUBIWUBWUBWUBNKVDTBOLETKZISTWUBWUBWUBWLWUBQQFMMGSONZMAWUBZWUBWUBWUBQZUXGCWUBWUBWUBIRZWUBWUBWUBLTTVTLCWUBWUBWUBY\\r\\n'], 'output': ['YZJOOYITZRARKVFY RZQG UOQ I NKVDTBOLETKZIST WL QQFMMGSONZMA Z QZUXGC IRZ LTTVTLC Y ']}, {'input': ['WUBCAXNCKFBVZLGCBWCOAWVWOFKZVQYLVTWUBWUBWUBNLGWUBWUBWUBAMGDZBDHZMRMQMDLIRMIWUBWUBWUBGAJSHTBSWUBWUBWUBCXWUBWUBWUBYWUBZLXAWWUBWUBWUBOHWUBWUBWUBZWUBWUBWUBGBWUBWUBWUBE\\r\\n'], 'output': ['CAXNCKFBVZLGCBWCOAWVWOFKZVQYLVT NLG AMGDZBDHZMRMQMDLIRMI GAJSHTBS CX Y ZLXAW OH Z GB E ']}, {'input': ['WUBWUBCHXSOWTSQWUBWUBWUBCYUZBPBWUBWUBWUBSGWUBWUBWKWORLRRLQYUUFDNWUBWUBWUBYYGOJNEVEMWUBWUBWUBRWUBWUBWUBQWUBWUBWUBIHCKWUBWUBWUBKTWUBWUBWUBRGSNTGGWUBWUBWUBXCXWUBWUBWUBS\\r\\n'], 'output': ['CHXSOWTSQ CYUZBPB SG WKWORLRRLQYUUFDN YYGOJNEVEM R Q IHCK KT RGSNTGG XCX S ']}, {'input': ['WUBWUBWUBHJHMSBURXTHXWSCHNAIJOWBHLZGJZDHEDSPWBWACCGQWUBWUBWUBXTZKGIITWUBWUBWUBAWUBWUBWUBVNCXPUBCQWUBWUBWUBIDPNAWUBWUBWUBOWUBWUBWUBYGFWUBWUBWUBMQOWUBWUBWUBKWUBWUBWUBAZVWUBWUBWUBEP\\r\\n'], 'output': ['HJHMSBURXTHXWSCHNAIJOWBHLZGJZDHEDSPWBWACCGQ XTZKGIIT A VNCXPUBCQ IDPNA O YGF MQO K AZV EP ']}, {'input': ['WUBKYDZOYWZSNGMKJSWAXFDFLTHDHEOGTDBNZMSMKZTVWUBWUBWUBLRMIIWUBWUBWUBGWUBWUBWUBADPSWUBWUBWUBANBWUBWUBPCWUBWUBWUBPWUBWUBWUBGPVNLSWIRFORYGAABUXMWUBWUBWUBOWUBWUBWUBNWUBWUBWUBYWUBWUB\\r\\n'], 'output': ['KYDZOYWZSNGMKJSWAXFDFLTHDHEOGTDBNZMSMKZTV LRMII G ADPS ANB PC P GPVNLSWIRFORYGAABUXM O N Y ']}, {'input': ['REWUBWUBWUBJDWUBWUBWUBNWUBWUBWUBTWWUBWUBWUBWZDOCKKWUBWUBWUBLDPOVBFRCFWUBWUBAKZIBQKEUAZEEWUBWUBWUBLQYPNPFWUBYEWUBWUBWUBFWUBWUBWUBBPWUBWUBWUBAWWUBWUBWUBQWUBWUBWUBBRWUBWUBWUBXJL\\r\\n'], 'output': ['RE JD N TW WZDOCKK LDPOVBFRCF AKZIBQKEUAZEE LQYPNPF YE F BP AW Q BR XJL ']}, {'input': ['CUFGJDXGMWUBWUBWUBOMWUBWUBWUBSIEWUBWUBWUBJJWKNOWUBWUBWUBYBHVNRNORGYWUBWUBWUBOAGCAWUBWUBWUBSBLBKTPFKPBIWUBWUBWUBJBWUBWUBWUBRMFCJPGWUBWUBWUBDWUBWUBWUBOJOWUBWUBWUBZPWUBWUBWUBMWUBRWUBWUBWUBFXWWUBWUBWUBO\\r\\n'], 'output': ['CUFGJDXGM OM SIE JJWKNO YBHVNRNORGY OAGCA SBLBKTPFKPBI JB RMFCJPG D OJO ZP M R FXW O ']}, {'input': ['WUBJZGAEXFMFEWMAKGQLUWUBWUBWUBICYTPQWGENELVYWANKUOJYWUBWUBWUBGWUBWUBWUBHYCJVLPHTUPNEGKCDGQWUBWUBWUBOFWUBWUBWUBCPGSOGZBRPRPVJJEWUBWUBWUBDQBCWUBWUBWUBHWUBWUBWUBMHOHYBMATWUBWUBWUBVWUBWUBWUBSWUBWUBWUBKOWU\\r\\n'], 'output': ['JZGAEXFMFEWMAKGQLU ICYTPQWGENELVYWANKUOJY G HYCJVLPHTUPNEGKCDGQ OF CPGSOGZBRPRPVJJE DQBC H MHOHYBMAT V S KOWU ']}, {'input': ['A\\r\\n'], 'output': ['A ']}, {'input': ['WUBA\\r\\n'], 'output': ['A ']}, {'input': ['WUBWUBA\\r\\n'], 'output': ['A ']}, {'input': ['AWUBWUBWUB\\r\\n'], 'output': ['A ']}, {'input': ['AWUBBWUBCWUBD\\r\\n'], 'output': ['A B C D ']}, {'input': ['WUBWWUBWUBWUBUWUBWUBBWUB\\r\\n'], 'output': ['W U B ']}, {'input': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n'], 'output': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ']}, {'input': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWUBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n'], 'output': ['AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ']}, {'input': ['WUWUBBWWUBUB\\r\\n'], 'output': ['WU BW UB ']}, {'input': ['WUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUABWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUB\\r\\n'], 'output': ['WUAB ']}, {'input': ['ZWUB\\r\\n'], 'output': ['Z ']}, {'input': ['WU\\r\\n'], 'output': ['WU ']}, {'input': ['UB\\r\\n'], 'output': ['UB ']}, {'input': ['U\\r\\n'], 'output': ['U ']}, {'input': ['WUBW\\r\\n'], 'output': ['W ']}, {'input': ['WUBWU\\r\\n'], 'output': ['WU ']}, {'input': ['WUWUB\\r\\n'], 'output': ['WU ']}, {'input': ['UBWUB\\r\\n'], 'output': ['UB ']}, {'input': ['WUWUBUBWUBUWUB\\r\\n'], 'output': ['WU UB U ']}, {'input': ['WUBWWUBAWUB\\r\\n'], 'output': ['W A ']}, {'input': ['WUUUUU\\r\\n'], 'output': ['WUUUUU ']}]","id":702} {"difficulty":1200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"208_D","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n var\r\n a,b,c,d,e,a1,b1,c1,e1,d1,i,n:integer;\r\n x:array[1..50] of integer;\r\n sum:int64;\r\nbegin\r\na1:=0;\r\nb1:=0;\r\nc1:=0;\r\nd1:=0;\r\ne1:=0;\r\n readln(n);\r\n for i:=1 to n do read(x[i]);\r\n readln(a,b,c,d,e);\r\n sum:=0;\r\n for i:=1 to n do\r\n begin\r\n sum:=sum+x[i];\r\n if sum div e<>0 then begin\r\n e1:=e1+sum div e;\r\n sum:=sum mod e;\r\n end;\r\n if sum div d<>0 then begin\r\n d1:=d1+sum div d;\r\n sum:=sum mod d;\r\n end;\r\n if sum div c<>0 then begin\r\n c1:=c1+sum div c;\r\n sum:=sum mod c;\r\n end;\r\n if sum div b<>0 then begin\r\n b1:=b1+sum div b;\r\n sum:=sum mod b;\r\n end;\r\n if sum div a<>0 then begin\r\n a1:=a1+sum div a;\r\n sum:=sum mod a;\r\n end;\r\n end;\r\n writeln(a1,' ',b1,' ',c1,' ',d1,' ',e1);\r\n writeln(sum);\r\n readln;\r\nend.\r\n","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,p2,...,pn, 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\u2264n\u226450) \u2014 the number of chocolate bar wrappings that brought points to Vasya. The second line contains space-separated integers p1,p2,...,pn (1\u2264pi\u226410^9). The third line contains 5 integers a, b, c, d, e (1\u2264am[I+1]\r\n then begin\r\n write('-1');\r\n Halt(0);\r\n end;\r\n For I:=K-1 downto 1 do\r\n If m[I]<>m[I+1]\r\n then begin\r\n write(I);\r\n end;\r\nEnd.\r\n","description":"One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: Find the number that goes k-th in the current sequence and add the same number to the end of the sequence; Delete the first number of the current sequence. The shooshuns wonder after how many operations all numbers on the board will be the same and whether all numbers will ever be the same.","input_specification":"The first line contains two space-separated integers n and k (1\u2264k\u2264n\u226410^5).\nThe second line contains n space-separated integers: a1,a2,...,an (1\u2264ai\u226410^5) \u2014 the sequence that the shooshuns found.\n","output_specification":"Print the minimum number of operations, required for all numbers on the blackboard to become the same. If it is impossible to achieve, print -1.\n","notes":"In the first test case after the first operation the blackboard will have sequence [1, 1, 1]. So, one operation is enough to make all numbers the same. Thus, the answer equals one.\nIn the second test case the sequence will never consist of the same numbers. It will always contain at least two distinct numbers 3 and 1. Thus, the answer equals -1.\n","sample_inputs":["3 2\n3 1 1\n","3 1\n3 1 1\n"],"sample_outputs":["1\n","-1\n"],"human_solution":"uses math;\r\ntype mass=array[0..100000] of integer;\r\nvar u1,u:boolean;kk,s,s1:string;\r\nll,k,nom,q,j,min1,min2:integer;m:mass;\r\n gg,code,napr,max1:integer;aq,e:char;\r\n ka:real;ch:char;\r\n sum,d,a,bb,x,y,kol,n,b,summ,c,hh:int64;res:integer;i,z:integer;\r\nBegin\r\n \/\/ assign(input,'input.txt');\r\n \/\/ assign(output,'output.txt');\r\n readln(n,k);\r\n for i:=1 to n do\r\n read(m[i]);\r\n for i:=k to n do\r\n if m[i]<>m[k]\r\n then Begin\r\n writeln(-1);\r\n halt(0);\r\n end;\r\n for i:=k-1 downto 1 do\r\n if m[i]<>m[k]\r\n then Begin\r\n writeln(i);\r\n halt(0);\r\n end;\r\n writeln(0);\r\nend. \r\n","testcases":"[{'input': ['3 2\\r\\n3 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n3 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['4 4\\r\\n1 2 3 4\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 3\\r\\n1 2 3 4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['5 3\\r\\n2 1 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n1 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 5\\r\\n1 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1\\r\\n1 2 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 1\\r\\n2 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 2\\r\\n2 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 2\\r\\n1 2 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 3\\r\\n3 2 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 1\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['20 10\\r\\n1 2 3 4 5 6 7 8 9 10 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['20 11\\r\\n1 2 3 4 5 6 7 8 9 10 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['20 9\\r\\n1 2 3 4 5 6 7 8 9 10 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['20 10\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 20\\r\\n20 1 19 2 18 3 17 4 16 5 15 6 14 7 13 8 12 9 11 10\\r\\n'], 'output': ['19\\r\\n']}]","id":704} {"difficulty":1500,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"29_B","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n\ti, l, d, v, g, r: Integer;\r\n\ts: Real;\r\n\r\nbegin\r\n\tReadln(l, d, v, g, r);\r\n\ti := v*g;\r\n\tif i>d then s := l*1.0\/v\r\n\telse begin\r\n\t\ts := 1.0;\r\n\t\twhile i<=d do\r\n\t\tbegin\r\n\t\t\ts := s + 1.0;\r\n\t\t\tif i+v*r>=d then\r\n\t\t\tbegin\r\n\t\t\t\ts := s + (l-d)*1.0\/v + r - 1;\r\n\t\t\t\tbreak;\r\n\t\t\tend\r\n\t\t\telse begin\r\n\t\t\t\tInc(i, v*r);\r\n\t\t\t\tif i+v*g>=d then\r\n\t\t\t\tbegin\r\n\t\t\t\t\ts := s + (l-i)*1.0\/v;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tend;\r\n\t\t\t\ts := s + 1.0;\r\n\t\t\t\tInc(i, v*g);\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\tWriteln(s:0:8);\r\nend.\r\n","description":"A car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green light is on, then for the following r seconds the red light is on, then again the green light is on for the g seconds, and so on.The car can be instantly accelerated from 0 to v and vice versa, can instantly slow down from the v to 0. Consider that it passes the traffic lights at the green light instantly. If the car approaches the traffic lights at the moment when the red light has just turned on, it doesn't have time to pass it. But if it approaches the traffic lights at the moment when the green light has just turned on, it can move. The car leaves point A at the time 0.What is the minimum time for the car to get from point A to point B without breaking the traffic rules?","input_specification":"The first line contains integers l, d, v, g, r (1\u2264l,d,v,g,r\u22641000,dd then s := l*1.0\/v\r\n\telse begin\r\n\t\ts := 1.0;\r\n\t\twhile i<=d do\r\n\t\tbegin\r\n\t\t\ts := s + 1.0;\r\n\t\t\tif i+v*r>=d then\r\n\t\t\tbegin\r\n\t\t\t\ts := s + (l-d)*1.0\/v + r - 1;\r\n\t\t\t\tbreak;\r\n\t\t\tend\r\n\t\t\telse begin\r\n\t\t\t\tInc(i, v*r);\r\n\t\t\t\tif i+v*g>d then\r\n\t\t\t\tbegin\r\n\t\t\t\t\ts := s + (l-i)*1.0\/v;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tend;\r\n\t\t\t\ts := s + 1.0;\r\n\t\t\t\tInc(i, v*g);\r\n\t\t\tend;\r\n\t\tend;\r\n\tend;\r\n\tWriteln(s:0:8);\r\nend.\r\n","testcases":"[{'input': ['2 1 3 4 5\\r\\n'], 'output': ['0.66666667\\r\\n']}, {'input': ['5 4 3 1 1\\r\\n'], 'output': ['2.33333333\\r\\n']}, {'input': ['862 33 604 888 704\\r\\n'], 'output': ['1.42715232\\r\\n']}, {'input': ['458 251 49 622 472\\r\\n'], 'output': ['9.34693878\\r\\n']}, {'input': ['772 467 142 356 889\\r\\n'], 'output': ['5.43661972\\r\\n']}, {'input': ['86 64 587 89 657\\r\\n'], 'output': ['0.14650767\\r\\n']}, {'input': ['400 333 31 823 74\\r\\n'], 'output': ['12.90322581\\r\\n']}, {'input': ['714 474 124 205 491\\r\\n'], 'output': ['5.75806452\\r\\n']}, {'input': ['29 12 569 939 259\\r\\n'], 'output': ['0.05096661\\r\\n']}, {'input': ['65 24 832 159 171\\r\\n'], 'output': ['0.07812500\\r\\n']}, {'input': ['2 1 1 1 1\\r\\n'], 'output': ['3.00000000\\r\\n']}, {'input': ['2 1 1 1 1000\\r\\n'], 'output': ['1002.00000000\\r\\n']}, {'input': ['2 1 1 1000 1\\r\\n'], 'output': ['2.00000000\\r\\n']}, {'input': ['2 1 1 1000 1000\\r\\n'], 'output': ['2.00000000\\r\\n']}, {'input': ['2 1 1000 1 1\\r\\n'], 'output': ['0.00200000\\r\\n']}, {'input': ['2 1 1000 1 1000\\r\\n'], 'output': ['0.00200000\\r\\n']}, {'input': ['2 1 1000 1000 1\\r\\n'], 'output': ['0.00200000\\r\\n']}, {'input': ['2 1 1000 1000 1000\\r\\n'], 'output': ['0.00200000\\r\\n']}, {'input': ['1000 1 1 1 1\\r\\n'], 'output': ['1001.00000000\\r\\n']}, {'input': ['1000 1 1 1 1000\\r\\n'], 'output': ['2000.00000000\\r\\n']}, {'input': ['1000 1 1 1000 1\\r\\n'], 'output': ['1000.00000000\\r\\n']}, {'input': ['1000 1 1 1000 1000\\r\\n'], 'output': ['1000.00000000\\r\\n']}, {'input': ['1000 1 1000 1 1\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 1 1000 1 1000\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 1 1000 1000 1\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 1 1000 1000 1000\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 999 1 1 1\\r\\n'], 'output': ['1001.00000000\\r\\n']}, {'input': ['1000 999 1 1 1000\\r\\n'], 'output': ['1002.00000000\\r\\n']}, {'input': ['1000 999 1 1000 1\\r\\n'], 'output': ['1000.00000000\\r\\n']}, {'input': ['1000 999 1 1000 1000\\r\\n'], 'output': ['1000.00000000\\r\\n']}, {'input': ['1000 999 1000 1 1\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 999 1000 1 1000\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 999 1000 1000 1\\r\\n'], 'output': ['1.00000000\\r\\n']}, {'input': ['1000 999 1000 1000 1000\\r\\n'], 'output': ['1.00000000\\r\\n']}]","id":705} {"difficulty":1200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"33_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n a,b,c,d:array[1..100000] of Integer;\r\n n,s,k,j,s1,m,k1:Int64;\r\n i,g:Integer;\r\nbegin\r\n Readln(n,m,k);\r\n for i:=1 to n do read(a[i],b[i]);\r\n s:=k;\r\n for i:=1 to n do\r\n for g:=n downto i do\r\n begin\r\n if (a[i]a[i-1]) then\r\n begin\r\n Inc(j);\r\n c[j]:=a[i];\r\n d[j]:=a[i];\r\n end;\r\n k1:=0;\r\n for i:=1 to n do\r\n begin\r\n while(d[i]>0) do\r\n begin\r\n inc(k1);\r\n Dec(d[i]);\r\n end;\r\n end;\r\n if (k-k1<=0) then write(s)\r\n else write(k-k1);\r\n Readln;\r\n readln;\r\nend.\r\n ","description":"In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are \"relaxing\".For a long time our heroine had been searching the sea for crucians, but a great misfortune happened. Her teeth started to ache, and she had to see the local dentist, lobster Ashot. As a professional, Ashot quickly relieved Valerie from her toothache. Moreover, he managed to determine the cause of Valerie's developing caries (for what he was later nicknamed Cap).It turned that Valerie eats too many crucians. To help Valerie avoid further reoccurrence of toothache, Ashot found for each Valerie's tooth its residual viability. Residual viability of a tooth is a value equal to the amount of crucians that Valerie can eat with this tooth. Every time Valerie eats a crucian, viability of all the teeth used for it will decrease by one. When the viability of at least one tooth becomes negative, the shark will have to see the dentist again. Unhappy, Valerie came back home, where a portion of crucians was waiting for her. For sure, the shark couldn't say no to her favourite meal, but she had no desire to go back to the dentist. That's why she decided to eat the maximum amount of crucians from the portion but so that the viability of no tooth becomes negative. As Valerie is not good at mathematics, she asked you to help her to find out the total amount of crucians that she can consume for dinner.We should remind you that while eating one crucian Valerie uses exactly one row of teeth and the viability of each tooth from this row decreases by one.","input_specification":"The first line contains three integers n, m, k (1\u2264m\u2264n\u22641000,0\u2264k\u226410^6) \u2014 total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1\u2264r\u2264m) \u2014 index of the row, where belongs the corresponding tooth, and c (0\u2264c\u226410^6) \u2014 its residual viability.\nIt's guaranteed that each tooth row has positive amount of teeth.\n","output_specification":"In the first line output the maximum amount of crucians that Valerie can consume for dinner.\n","notes":null,"sample_inputs":["4 3 18\n2 3\n1 2\n3 6\n2 3\n","2 2 13\n1 13\n2 12\n"],"sample_outputs":["11\n","13\n"],"human_solution":"program codeforces;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$R+ Q+ I+}\r\n\r\nuses\r\n SysUtils;\r\nvar\r\n i,k,n,m,t: integer;\r\n a,b: array[1..1000]of integer;\r\n stat: array[1..1000]of boolean;\r\n\r\nprocedure qs(l,r: integer);\r\nvar\r\n i,j,x,y: integer;\r\nbegin\r\n i:=l;\r\n j:=r;\r\n x:=b[(l+r) div 2];\r\n repeat\r\n while (b[i]j);\r\n if (ld then writeln(-1)else writeln(count+(d-sum)div 5); \r\nend.","testcases":"[{'input': ['3 30\\r\\n2 2 1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['3 20\\r\\n2 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['50 10000\\r\\n5 4 10 9 9 6 7 7 7 3 3 7 7 4 7 4 10 10 1 7 10 3 1 4 5 7 2 10 10 10 2 3 4 7 6 1 8 4 7 3 8 8 4 10 1 1 9 2 6 1\\r\\n'], 'output': ['1943\\r\\n']}, {'input': ['50 10000\\r\\n4 7 15 9 11 12 20 9 14 14 10 13 6 13 14 17 6 8 20 12 10 15 13 17 5 12 13 11 7 5 5 2 3 15 13 7 14 14 19 2 13 14 5 15 3 19 15 16 4 1\\r\\n'], 'output': ['1891\\r\\n']}, {'input': ['100 9000\\r\\n5 2 3 1 1 3 4 9 9 6 7 10 10 10 2 10 6 8 8 6 7 9 9 5 6 2 1 10 10 9 4 5 9 2 4 3 8 5 6 1 1 5 3 6 2 6 6 6 5 8 3 6 7 3 1 10 9 1 8 3 10 9 5 6 3 4 1 1 10 10 2 3 4 8 10 10 5 1 5 3 6 8 10 6 10 2 1 8 10 1 7 6 9 10 5 2 3 5 3 2\\r\\n'], 'output': ['1688\\r\\n']}, {'input': ['100 8007\\r\\n5 19 14 18 9 6 15 8 1 14 11 20 3 17 7 12 2 6 3 17 7 20 1 14 20 17 2 10 13 7 18 18 9 10 16 8 1 11 11 9 13 18 9 20 12 12 7 15 12 17 11 5 11 15 9 2 15 1 18 3 18 16 15 4 10 5 18 13 13 12 3 8 17 2 12 2 13 3 1 13 2 4 9 10 18 10 14 4 4 17 12 19 2 9 6 5 5 20 18 12\\r\\n'], 'output': ['1391\\r\\n']}, {'input': ['39 2412\\r\\n1 1 1 1 1 1 26 1 1 1 99 1 1 1 1 1 1 1 1 1 1 88 7 1 1 1 1 76 1 1 1 93 40 1 13 1 68 1 32\\r\\n'], 'output': ['368\\r\\n']}, {'input': ['39 2617\\r\\n47 1 1 1 63 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 70 1 99 63 1 1 1 1 1 1 1 1 64 1 1\\r\\n'], 'output': ['435\\r\\n']}, {'input': ['39 3681\\r\\n83 77 1 94 85 47 1 98 29 16 1 1 1 71 96 85 31 97 96 93 40 50 98 1 60 51 1 96 100 72 1 1 1 89 1 93 1 92 100\\r\\n'], 'output': ['326\\r\\n']}, {'input': ['45 894\\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 28 28 1 1 1 1 1 1 1 1 1 1 1 1 1 1 99 3 1 1\\r\\n'], 'output': ['139\\r\\n']}, {'input': ['45 4534\\r\\n1 99 65 99 4 46 54 80 51 30 96 1 28 30 44 70 78 1 1 100 1 62 1 1 1 85 1 1 1 61 1 46 75 1 61 77 97 26 67 1 1 63 81 85 86\\r\\n'], 'output': ['514\\r\\n']}, {'input': ['72 3538\\r\\n52 1 8 1 1 1 7 1 1 1 1 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 40 1 1 38 1 1 1 1 1 1 1 1 1 1 1 35 1 93 79 1 1 1 1 1 1 1 1 1 51 1 1 1 1 1 1 1 1 1 1 1 1 96 1\\r\\n'], 'output': ['586\\r\\n']}, {'input': ['81 2200\\r\\n1 59 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 93 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 50 1 1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['384\\r\\n']}, {'input': ['81 2577\\r\\n85 91 1 1 2 1 1 100 1 80 1 1 17 86 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 37 1 66 24 1 1 96 49 1 66 1 44 1 1 1 1 98 1 1 1 1 35 1 37 3 35 1 1 87 64 1 24 1 58 1 1 42 83 5 1 1 1 1 1 95 1 94 1 50 1 1\\r\\n'], 'output': ['174\\r\\n']}, {'input': ['81 4131\\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 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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': ['807\\r\\n']}, {'input': ['81 6315\\r\\n1 1 67 100 1 99 36 1 92 5 1 96 42 12 1 57 91 1 1 66 41 30 74 95 1 37 1 39 91 69 1 52 77 47 65 1 1 93 96 74 90 35 85 76 71 92 92 1 1 67 92 74 1 1 86 76 35 1 56 16 27 57 37 95 1 40 20 100 51 1 80 60 45 79 95 1 46 1 25 100 96\\r\\n'], 'output': ['490\\r\\n']}, {'input': ['96 1688\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 71 1 1 1 30 1 1 1\\r\\n'], 'output': ['284\\r\\n']}, {'input': ['96 8889\\r\\n1 1 18 1 1 1 1 1 1 1 1 1 99 1 1 1 1 88 1 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1 96 1 1 1 1 21 1 1 1 1 1 1 1 73 1 1 1 1 1 10 1 1 1 1 1 1 1 46 43 1 1 1 1 1 98 1 1 1 1 1 1 6 1 1 1 1 1 74 1 25 1 55 1 1 1 13 1 1 54 1 1 1\\r\\n'], 'output': ['1589\\r\\n']}, {'input': ['10 100\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n'], 'output': ['18\\r\\n']}, {'input': ['100 10000\\r\\n54 46 72 94 79 83 91 54 73 3 24 55 54 31 28 20 19 6 25 19 47 23 1 70 15 87 51 39 54 77 55 5 60 3 15 99 56 88 22 78 79 21 38 27 28 86 7 88 12 59 55 70 25 1 70 49 1 45 69 72 50 17 4 56 8 100 90 34 35 20 61 76 88 79 4 74 65 68 75 26 40 72 59 94 10 67 96 85 29 90 47 24 44 1 66 93 55 36 1 99\\r\\n'], 'output': ['1017\\r\\n']}, {'input': ['100 6000\\r\\n41 31 23 17 24 78 26 96 93 48 46 2 49 33 35 9 73 100 34 48 83 36 33 69 43 24 3 74 8 81 27 33 94 38 77 9 76 90 62 90 21 67 22 22 12 2 17 27 61 18 72 85 59 65 71 38 90 75 74 66 60 47 58 50 90 95 75 10 5 100 97 29 83 88 65 26 93 90 22 98 36 55 70 38 50 92 88 72 99 96 25 14 74 16 25 92 67 94 77 96\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 6\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 5\\r\\n1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 3\\r\\n4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 24\\r\\n2 1 2\\r\\n'], 'output': ['-1\\r\\n']}]","id":707} {"difficulty":1300,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"54_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n n,c,k,f,s,i,j:integer;\r\n proverka:boolean;\r\n a:array [1..365] of integer;\r\n\r\nbegin\r\n read (n);\r\n readln (k);\r\n read (c);\r\n for i:=1 to c do\r\n begin\r\n read(f);\r\n a[i]:=f;\r\n end;\r\n i:=1;\r\n j:=0;\r\n s:=0;\r\n while j<=n+k do\r\n begin\r\n if (j>=a[i]) and (i<=c) then\r\n begin\r\n j:=a[i];\r\n inc(i);\r\n end;\r\n j:=j+k;\r\n if j>=n+k then break;\r\n inc(s);\r\n end;\r\n writeln (s);\r\n\r\n\r\nend.","description":"The Hedgehog likes to give presents to his friend, but no less he likes to receive them.Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf in the cupboard. He will have to choose another shelf, but which one should he choose, how large should it be?In order to get to know this, the Hedgehog asks you to write him a program that will count the estimated number of presents that he will receive during the following N days. Besides, he is guided by the principle: on each holiday day the Hedgehog will necessarily receive a present, he receives presents at least every K days (i.e., if he received a present on the i-th day, he will receive the next present no later than on the i+K-th day). For the given N and K, as well as the list of holidays among the following N days count the minimal number of presents that could be given to the Hedgehog. The number of today's day is zero, and you should regard today's present as already given (i.e., you shouldn't count it in the answer).","input_specification":"The first line contains integers N and K (1\u2264N\u2264365, 1\u2264K\u2264N).\nThe second line contains a number C which represents the number of holidays (0\u2264C\u2264N). Then in the same line follow C numbers ranging from 1 to N which are the numbers of holiday days. The numbers are given in the increasing order, without repeating numbers among them.\n","output_specification":"Print a single number \u2014 the minimal number of presents the Hedgehog will receive over the following N days.\n","notes":null,"sample_inputs":["5 2\n1 3\n","10 1\n3 6 7 8\n"],"sample_outputs":["3","10"],"human_solution":"program Project2;\r\nVar m:array [-1000..1000] of integer;\r\nj,n,k,a,c,e,i:integer;\r\nbegin\r\n\/\/ Assign(input,'input.txt');\r\n\/\/ Assign(output,'output.txt');\r\n Readln(n,k);\r\n read(c);\r\n e:=c;\r\n for i:=1 to c do\r\n begin\r\n read(a);\r\n m[a]:=1;\r\n{ for j:=a to a+k-1 do\r\n m[j]:=1;\r\n for j:=a downto j-k+1 do\r\n m[j]:=1;}\r\n end;\r\n i:=1;\r\n while i<=n do\r\n begin\r\n j:=i;\r\n while (m[j]=0)and(j<=n) do\r\n Inc(j);\r\n e:=(j-i) div k+e;\r\n{ if (j-i) mod k<>0\r\n then inc(e);}\r\n i:=j+1;\r\n end;\r\n writeln(e);\r\nend.\r\n","testcases":"[{'input': ['5 2\\r\\naba\\r\\n101\\r\\n'], 'output': ['ababa']}, {'input': ['5 2\\r\\na\\r\\n10001\\r\\n'], 'output': ['abbba']}, {'input': ['6 2\\r\\nabba\\r\\n101\\r\\n'], 'output': ['No solution']}, {'input': ['12 5\\r\\nabacaba\\r\\n010001\\r\\n'], 'output': ['aabacabacaba']}, {'input': ['9 3\\r\\nac\\r\\n10100101\\r\\n'], 'output': ['acacaacac']}, {'input': ['19 2\\r\\naababaaba\\r\\n10000100001\\r\\n'], 'output': ['aababaababaababaaba']}, {'input': ['5 2\\r\\naaa\\r\\n101\\r\\n'], 'output': ['No solution']}, {'input': ['10 2\\r\\naaa\\r\\n11000111\\r\\n'], 'output': ['aaaabaaaaa']}, {'input': ['15 2\\r\\naaa\\r\\n0000000000111\\r\\n'], 'output': ['aabaabaabbaaaaa']}, {'input': ['20 2\\r\\naba\\r\\n001000000000000000\\r\\n'], 'output': ['aaabaaaaaaaaaaaaaaaa']}, {'input': ['10 2\\r\\naabb\\r\\n0000000\\r\\n'], 'output': ['aaaaaaaaaa']}, {'input': ['15 2\\r\\naabb\\r\\n010000000100\\r\\n'], 'output': ['aaabbaaaaaabbaa']}, {'input': ['20 2\\r\\nabbb\\r\\n00000000000100000\\r\\n'], 'output': ['aaaaaaaaaaaabbbaaaaa']}, {'input': ['100 2\\r\\nbbaa\\r\\n0100000000000000000000001000000001000010000000000000000000001000000000000000000000000000000000000\\r\\n'], 'output': ['abbaaaaaaaaaaaaaaaaaaaaabbaaaaaaabbaaabbaaaaaaaaaaaaaaaaaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['10 5\\r\\nbeb\\r\\n00101000\\r\\n'], 'output': ['aabebebaaa']}, {'input': ['15 5\\r\\nbcd\\r\\n0100010010010\\r\\n'], 'output': ['abcdabcdbcdbcda']}, {'input': ['20 5\\r\\nece\\r\\n010101001001000010\\r\\n'], 'output': ['aecececeeceeceaaecea']}, {'input': ['10 5\\r\\neded\\r\\n0010000\\r\\n'], 'output': ['aaededaaaa']}, {'input': ['15 5\\r\\nbdda\\r\\n001000100000\\r\\n'], 'output': ['aabddabddaaaaaa']}, {'input': ['20 5\\r\\nbeda\\r\\n00100001000100001\\r\\n'], 'output': ['aabedaabedabedaabeda']}, {'input': ['100 5\\r\\nbcda\\r\\n0100000001000010000010000000100000001000000010000000100000001000000010000001000000010000010000001\\r\\n'], 'output': ['abcdaaaaabcdaabcdaaabcdaaaaabcdaaaaabcdaaaaabcdaaaaabcdaaaaabcdaaaaabcdaaaabcdaaaaabcdaaabcdaaaabcda']}, {'input': ['10 5\\r\\nede\\r\\n00001010\\r\\n'], 'output': ['aaaaededea']}, {'input': ['15 5\\r\\nece\\r\\n0100000010101\\r\\n'], 'output': ['aeceaaaaececece']}, {'input': ['20 5\\r\\necc\\r\\n010000100100010000\\r\\n'], 'output': ['aeccaaecceccaeccaaaa']}, {'input': ['10 5\\r\\nedda\\r\\n0010000\\r\\n'], 'output': ['aaeddaaaaa']}, {'input': ['15 5\\r\\nbeba\\r\\n001000000010\\r\\n'], 'output': ['aabebaaaaabebaa']}, {'input': ['20 5\\r\\nbcae\\r\\n00000010000000001\\r\\n'], 'output': ['aaaaaabcaeaaaaaabcae']}, {'input': ['100 5\\r\\ncaae\\r\\n0100000000100010000001000000100001000010000100000100001000000001000100000001000001000100010000010\\r\\n'], 'output': ['acaaeaaaaacaaecaaeaaacaaeaaacaaeacaaeacaaeacaaeaacaaeacaaeaaaaacaaecaaeaaaacaaeaacaaecaaecaaeaacaaea']}, {'input': ['10 2\\r\\naaa\\r\\n00000100\\r\\n'], 'output': ['aababaaaba']}, {'input': ['15 2\\r\\naab\\r\\n1001000000100\\r\\n'], 'output': ['aabaabaaaaaabaa']}, {'input': ['20 2\\r\\naaa\\r\\n010000000000000000\\r\\n'], 'output': ['baaabaabaabaabaabaab']}, {'input': ['10 2\\r\\naaba\\r\\n0000000\\r\\n'], 'output': ['aaaaaaaaaa']}, {'input': ['15 2\\r\\naaab\\r\\n000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 2\\r\\nabaa\\r\\n00000000000010000\\r\\n'], 'output': ['aaaaaaaaaaaaabaaaaaa']}, {'input': ['100 2\\r\\nbaba\\r\\n0000000000001010000010000001000000000000001010000010000000000000000000000000000100000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaabababaaababaaaababaaaaaaaaaaaabababaaababaaaaaaaaaaaaaaaaaaaaaaaaaababaaaaaaaaaaaaaaaaaa']}, {'input': ['10 5\\r\\nada\\r\\n00000000\\r\\n'], 'output': ['aaaaaaaaaa']}, {'input': ['15 5\\r\\nbcd\\r\\n0000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 5\\r\\ncdb\\r\\n000000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['10 5\\r\\nacec\\r\\n0000000\\r\\n'], 'output': ['aaaaaaaaaa']}, {'input': ['15 5\\r\\nbbbc\\r\\n000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 5\\r\\nbbaa\\r\\n00000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 5\\r\\nbecb\\r\\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['14 2\\r\\naabbbaabbbaba\\r\\n00\\r\\n'], 'output': ['aaaaaaaaaaaaaa']}, {'input': ['15 2\\r\\nbbbbabbabaaba\\r\\n000\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 2\\r\\naaabababaabaa\\r\\n00000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['19 2\\r\\nbaaaabaababaab\\r\\n000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaa']}, {'input': ['15 2\\r\\nabababaaaaaabb\\r\\n00\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 2\\r\\nababaaabbababa\\r\\n0000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 2\\r\\nabaaaabbaabbaa\\r\\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['14 5\\r\\ndaecaceaacbbe\\r\\n00\\r\\n'], 'output': ['aaaaaaaaaaaaaa']}, {'input': ['15 5\\r\\nacedaacceccac\\r\\n000\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 5\\r\\naeadaabbbeabe\\r\\n00000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['19 5\\r\\neeaaddeadcadbe\\r\\n000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaa']}, {'input': ['15 5\\r\\ncadedccceddbea\\r\\n00\\r\\n'], 'output': ['aaaaaaaaaaaaaaa']}, {'input': ['20 5\\r\\ndaddcdadcadcce\\r\\n0000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 5\\r\\nbdddeacceaecbc\\r\\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['7 2\\r\\naba\\r\\n10001\\r\\n'], 'output': ['abaaaba']}, {'input': ['100 2\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n101010101010101010101010101010101010101010101010101\\r\\n'], 'output': ['No solution']}, {'input': ['100 26\\r\\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n101010101010101010101010101010101010101010101010101\\r\\n'], 'output': ['No solution']}, {'input': ['100 2\\r\\nbababababababababababababababababababababababababa\\r\\n100010001000100010001000100010001000100010001000100\\r\\n'], 'output': ['No solution']}, {'input': ['100 26\\r\\nbababababababababababababababababababababababababa\\r\\n100010001000100010001000100010001000100010001000100\\r\\n'], 'output': ['No solution']}, {'input': ['7 2\\r\\nbab\\r\\n10001\\r\\n'], 'output': ['babbbab']}, {'input': ['7 2\\r\\nbab\\r\\n10101\\r\\n'], 'output': ['bababab']}, {'input': ['7 2\\r\\naba\\r\\n10001\\r\\n'], 'output': ['abaaaba']}, {'input': ['7 2\\r\\naba\\r\\n10101\\r\\n'], 'output': ['abababa']}, {'input': ['100 2\\r\\nbab\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['babbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbaba']}, {'input': ['100 2\\r\\nbab\\r\\n10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\\r\\n'], 'output': ['babababababababababababababababababababababababababababababababababababababababababababababababababa']}, {'input': ['100 3\\r\\nbab\\r\\n10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\\r\\n'], 'output': ['babababababababababababababababababababababababababababababababababababababababababababababababababa']}, {'input': ['100 26\\r\\nbab\\r\\n10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\\r\\n'], 'output': ['babababababababababababababababababababababababababababababababababababababababababababababababababa']}, {'input': ['100 2\\r\\nbab\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['babbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbaba']}, {'input': ['100 3\\r\\nbab\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['babbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbaba']}, {'input': ['100 26\\r\\nbab\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['babbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbaba']}, {'input': ['100 2\\r\\na\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 2\\r\\na\\r\\n0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\\r\\n'], 'output': ['baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 2\\r\\na\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab']}, {'input': ['100 2\\r\\na\\r\\n1111111111101111111011011111011111111101111111111101111110111011111111011110111111011111011111111111\\r\\n'], 'output': ['aaaaaaaaaaabaaaaaaabaabaaaaabaaaaaaaaabaaaaaaaaaaabaaaaaabaaabaaaaaaaabaaaabaaaaaabaaaaabaaaaaaaaaaa']}, {'input': ['100 2\\r\\na\\r\\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb']}, {'input': ['100 2\\r\\na\\r\\n0000000000001100000000010000000000000000000000001000000000000100000010000000000000000000000000000000\\r\\n'], 'output': ['bbbbbbbbbbbbaabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbabbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb']}, {'input': ['100 2\\r\\naa\\r\\n000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000\\r\\n'], 'output': ['abababababababababababababababababaababababababababababababababababababababababababababababababababa']}, {'input': ['100 2\\r\\naaaaaaa\\r\\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 2\\r\\naaaaaaa\\r\\n1111111111111111001111111111111111111111101111111110111101111111111111011111111111100000111111\\r\\n'], 'output': ['No solution']}, {'input': ['100 2\\r\\naaaaaaa\\r\\n1111111111111111111111111111111100000000000000011111111111111111111111111111111111111111111111\\r\\n'], 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']}, {'input': ['100 2\\r\\nabaa\\r\\n1000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001\\r\\n'], 'output': ['abaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaa']}, {'input': ['100 3\\r\\nabaa\\r\\n1000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001\\r\\n'], 'output': ['abaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaa']}, {'input': ['100 26\\r\\nabaa\\r\\n1000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001000001\\r\\n'], 'output': ['abaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaa']}, {'input': ['100 2\\r\\nabaa\\r\\n1000001000001000001000000000001000001000001000001000001000001000001000001000001000001000001000001\\r\\n'], 'output': ['abaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaa']}, {'input': ['100 2\\r\\nabaa\\r\\n1000001000001001001000001000001000001000001000001000001000001000001000001000001000001000001000001\\r\\n'], 'output': ['abaaaaabaaaaabaabaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaa']}, {'input': ['100 2\\r\\nabaa\\r\\n1000001000001001001000001000001000001001001000001001001000001001001000001000001000001001001000001\\r\\n'], 'output': ['abaaaaabaaaaabaabaabaaaaabaaaaabaaaaabaabaabaaaaabaabaabaaaaabaabaabaaaaabaaaaabaaaaabaabaabaaaaabaa']}, {'input': ['100 3\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n1000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['abacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaa']}, {'input': ['100 26\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n1000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['abacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaa']}, {'input': ['100 3\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n0001000100010001000100010001000100010001000100010001000100\\r\\n'], 'output': ['aaaabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaaa']}, {'input': ['100 3\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n0100010001000100010001000100010001000100010001000100010001\\r\\n'], 'output': ['aabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacaba']}, {'input': ['100 3\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n0100010001000100010000000100010001000100010001000100010001\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nabacabacabacabacabacabacabacabacabacabacaba\\r\\n0100010001000100010000000100000001000100010000000100000001\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nabacabacabacaba\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['abacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaa']}, {'input': ['100 3\\r\\nabacabacabacaba\\r\\n00010001000100010001000100010001000100010001000100010001000100010001000100010001000100\\r\\n'], 'output': ['aaaabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabacabaaa']}, {'input': ['100 3\\r\\nabacabacabacaba\\r\\n10001000100010001000100010000000100010001000100010001000000000001000100010001000100000\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nabacabacabacaba\\r\\n10001000100010001000100010001000101010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nbcbabcbabcbabcb\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['bcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcba']}, {'input': ['100 3\\r\\nbcbabcbabcbabcb\\r\\n10001000100010001000100000001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nbcbabcbabcbabcb\\r\\n10001000100010001000100010000000100010001000100000001000100000001000100010000000100010\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nbcbabcbabcbabcb\\r\\n00001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['aaaabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcbabcba']}, {'input': ['100 26\\r\\nbcbabcbabcbabcb\\r\\n10001000100010001000100010001000100010001000100010000000100010001000100010000000100010\\r\\n'], 'output': ['No solution']}, {'input': ['100 2\\r\\naba\\r\\n10001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010\\r\\n'], 'output': ['abaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaa']}, {'input': ['100 2\\r\\na\\r\\n1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\\r\\n'], 'output': ['abababababababababababababababababababababababababababababababababababababababababababababababababab']}, {'input': ['4 2\\r\\naa\\r\\n101\\r\\n'], 'output': ['No solution']}, {'input': ['100 2\\r\\naa\\r\\n100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100\\r\\n'], 'output': ['aabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaabaaba']}, {'input': ['5 2\\r\\naaa\\r\\n101\\r\\n'], 'output': ['No solution']}, {'input': ['8 2\\r\\nabab\\r\\n10001\\r\\n'], 'output': ['No solution']}, {'input': ['100 2\\r\\nbaabaaabaabaa\\r\\n1000000100000010000001000000100000010000001000000100000010000001000000100000010000001000\\r\\n'], 'output': ['baabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaabaabaaaaa']}, {'input': ['100 2\\r\\nbaabaabaabaa\\r\\n10000010000010000010000010000010000010000010000010000010000010000010000010000010000010000\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nbaabaabaabaa\\r\\n00000000010000000000010000000000010000000000010000000000010000000000010000000000010000000\\r\\n'], 'output': ['No solution']}, {'input': ['100 3\\r\\nbaabaaabaabaa\\r\\n0000000000100000000000010000000000001000000000000100000000000010000000000001000000000000\\r\\n'], 'output': ['aaaaaaaaaabaabaaabaabaabaabaaabaabaabaabaaabaabaabaabaaabaabaabaabaaabaabaabaabaaabaabaaaaaaaaaaaaaa']}, {'input': ['7 2\\r\\nbab\\r\\n10001\\r\\n'], 'output': ['babbbab']}, {'input': ['10 2\\r\\nb\\r\\n0000000000\\r\\n'], 'output': ['aaaaaaaaaa']}, {'input': ['3 2\\r\\nbb\\r\\n00\\r\\n'], 'output': ['aaa']}, {'input': ['7 2\\r\\naba\\r\\n10001\\r\\n'], 'output': ['abaaaba']}]","id":708} {"difficulty":1300,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"66_A","execute_outcome":"WRONG_ANSWER","source_code":"program codeforces;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$R+ Q+ I+}\r\n\r\nuses\r\n SysUtils;\r\nvar\r\n i: integer;\r\n f: boolean;\r\n x: int64;\r\n s,s1,s2: string;\r\nbegin\r\n read(s);\r\n f:=false;\r\n s1:='9223372036854775807';\r\n s2:='-9223372036854775808';\r\n if (length(s)>length(s1)) or (length(s)>length(s1)) then begin\r\n write('BigInteger');\r\n halt;\r\n end;\r\n if length(s)=length(s1) then\r\n for i:=1 to length(s) do\r\n if strtoint(s[i])<=strtoint(s1[i]) then continue else begin f:=true;break; end;\r\n if length(s)=length(s2) then\r\n for i:=2 to length(s) do\r\n if strtoint(s[i])<=strtoint(s1[i]) then continue else begin f:=true;break; end;\r\n if f then begin\r\n write('BigInteger');\r\n halt;\r\n end;\r\n x:=strtoint64(s);\r\n if (x<=127) and (x>=-128) then write('byte')\r\n else if ((x>127) and (x<=32767)) or ((x<-128) and (x>=-32768)) then write('short')\r\n else if ((x>32767) and (x<=strtoint64('2147483647'))) or ((x<-32768) and (x>=strtoint64('-2147483648'))) then write('int')\r\n else if ((x>strtoint64('2147483647')) and (x<=strtoint64('9223372036854775807'))) or ((x=strtoint64('-9223372036854775808'))) then write('long');\r\nend.","description":"Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument in favor of choosing Java was that it has a very large integer data type, called BigInteger.But having attended several classes of the club, Petya realized that not all tasks require using the BigInteger type. It turned out that in some tasks it is much easier to use small data types. That's why a question arises: \"Which integer type to use if one wants to store a positive integer n?\"Petya knows only 5 integer types:1) byte occupies 1 byte and allows you to store numbers from -128 to 1272) short occupies 2 bytes and allows you to store numbers from -32768 to 327673) int occupies 4 bytes and allows you to store numbers from -2147483648 to 21474836474) long occupies 8 bytes and allows you to store numbers from -9223372036854775808 to 92233720368547758075) BigInteger can store any integer number, but at that it is not a primitive type, and operations with it are much slower.For all the types given above the boundary values are included in the value range.From this list, Petya wants to choose the smallest type that can store a positive integer n. Since BigInteger works much slower, Peter regards it last. Help him.","input_specification":"The first line contains a positive number n. It consists of no more than 100 digits and doesn't contain any leading zeros. The number n can't be represented as an empty string.\nPlease, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","output_specification":"Print the first type from the list \"byte, short, int, long, BigInteger\", that can store the natural number n, in accordance with the data given above.\n","notes":null,"sample_inputs":["127\n","130\n","123456789101112131415161718192021222324\n"],"sample_outputs":["byte\n","short\n","BigInteger\n"],"human_solution":"program registration_CF;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n s: string;\r\n w: extended;\r\n l: longint;\r\n\r\nbegin\r\n {assign(input, 'input.txt');\r\n reset(input);\r\n assign(output, 'output.txt');\r\n rewrite(output);}\r\n\r\n readln(s);\r\n val(s, w, l);\r\n if length(s) > 19 then begin\r\n writeln('BigInteger');\r\n exit;\r\n end;\r\n If (w <= 127) and (w >= -128) then begin\r\n writeln('byte');\r\n exit;\r\n end;\r\n If (w <= 32767) and (w >= -32768) then begin\r\n writeln('short');\r\n exit;\r\n end;\r\n If (w <= high(longint)) and (w >= low(longint)) then begin\r\n writeln('int');\r\n exit;\r\n end;\r\n If (w <= high(int64)) and (w >= low(int64)) then begin\r\n writeln('long');\r\n exit;\r\n end;\r\n writeln('BigInteger');\r\n\r\nend.\r\n","testcases":"[{'input': ['127\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['130\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['123456789101112131415161718192021222324\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['126\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['128\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['32766\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['111111\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['22222\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['32767\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['32768\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['32769\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['2147483645\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['2147483646\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['2147483647\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['2147483648\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['2147483649\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['9223372036854775805\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['9223372036854775806\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['9223372036854775807\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['9223372036854775808\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['9223372036854775809\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1111111111111111111111111111111111111111111111\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['232\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['241796563564014133460267652699\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['29360359146807441660707083821018832188095237636414144034857851003419752010124705615779249\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['337300529263821789926982715723773719445001702036602052198530564\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['381127467969689863953686682245136076127159921\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['2158324958633591462\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['268659422768117401499491767189496733446324586965055954729177892248858259490346\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['3023764505449745844381036446038799100004717936344985\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['13408349824892484976400774\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['18880842614378213198381172973704766723997934818440985546083314104481253291692101136681\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1180990956946757129733650596194933741\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['73795216631038776655609800540262114612084443385902708034055020082090470662930545328551\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1658370691480968202384509492140362150472696196949\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['59662093286671707493190399502717308574459619342109544431740791973099298641871347858082458491958703\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['205505005582428018613354752739589866670902346355933720701937\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['53348890623013817139699\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['262373979958859125198440634134122707574734706745701184688685117904709744\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['69113784278456828987289369893745977\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['2210209454022702335652564247406666491086662454147967686455330365147159266087\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['630105816139991597267787581532092408135\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['800461429306907809762708270\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['7685166910821197056344900917707673568669808490600751439157\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['713549841568602590705962611607726022334779480510421458817648621376683672722573289661127894\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['680504312323996476676434432\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['3376595620091080825479292544658464163405755746884100218035\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['303681723783491968617491075591006152690484825330764215796396316561122383310011589365655481\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['4868659422768117401499491767189496733446324586965055954729177892248858259490346614099717639491763430\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['3502376450544974584438103644603879910000471793634498544789130945841846713263971487355748226237288709\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['2334083498248924849764007740114454487565621932425948046430072197452845278935316358800789014185793377\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1988808426143782131983811729737047667239979348184409855460833141044812532916921011366813880911319644\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1018099095694675712973365059619493374113337270925179793757322992466016001294122941535439492265169131\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['8437952166310387766556098005402621146120844433859027080340550200820904706629305453285512716464931911\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['6965837069148096820238450949214036215047269619694967357734070611376013382163559966747678150791825071\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['4596620932866717074931903995027173085744596193421095444317407919730992986418713478580824584919587030\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1905505005582428018613354752739589866670902346355933720701937408006000562951996789032987808118459990\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['8433488906230138171396997888322916936677429522910871017295155818340819168386140293774243244435122950\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['6862373979958859125198440634134122707574734706745701184688685117904709744830303784215298687654884810\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['4491137842784568289872893698937459777201151060689848471272003426250808340375567208957554901863756992\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['9721020945402270233565256424740666649108666245414796768645533036514715926608741510409618545180420952\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['7330105816139991597267787581532092408135003429259616955239761315950805521264994021242873979309182812\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['2000461429306907809762708270752707617318091579531521957022940951538737203583768926365382290530636885\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['9868516691082119705634490091770767356866980849060075143915700796802700437762260163478754592094654326\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['8713549841568602590705962611607726022334779480510421458817648621376683672722573289661127894678771177\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['4580504312323996476676434432646986768872786931159974634901608445720467716981185426771899006352697916\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['2537659562009108082547929254465846416340575574688410021803548570097340949141688442074263189944614467\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['1403681723783491968617491075591006152690484825330764215796396316561122383310011589365655481428540208\\r\\n'], 'output': ['BigInteger\\r\\n']}, {'input': ['26\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['302376450544\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['188808426143\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['118099095694675\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['73795216631038\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['1658370691480\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['596620932866\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['2055050055\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['533488906\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['26237397\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['6911378\\r\\n'], 'output': ['int\\r\\n']}, {'input': ['221020945402270233\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['63010581613999159\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['80046142930\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['7685166910821197\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['71\\r\\n'], 'output': ['byte\\r\\n']}, {'input': ['6805043123239964766\\r\\n'], 'output': ['long\\r\\n']}, {'input': ['3376\\r\\n'], 'output': ['short\\r\\n']}, {'input': ['3036817237\\r\\n'], 'output': ['long\\r\\n']}]","id":709} {"difficulty":1100,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"719_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n n, i: integer;\r\n a: array[1..100]of integer;\r\nbegin\r\n readln(n);\r\n for i := 1 to n do\r\n read(a[i]);\r\n if(n = 1)then\r\n if(a[n] = 0)then\r\n writeln('UP')\r\n else if(a[n] = 15)then\r\n writeln('DOWN')\r\n else begin\r\n writeln(-1);\r\n halt(0);\r\n end;\r\n if(a[n] > a[n - 1])and(a[n] <> 15)then\r\n writeln('UP')\r\n else if(a[n] > a[n - 1])and(a[n] = 15)then\r\n writeln('DOWN')\r\n else if(a[n] < a[n - 1])and(a[n] <> 0)then\r\n writeln('DOWN')\r\n else\r\n writeln('UP');\r\n readln;\r\n readln;\r\nend.\r\n\r\n ","description":"Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.Moon cycle lasts 30 days. The size of the visible part of the moon (in Vitya's units) for each day is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, and then cycle repeats, thus after the second 1 again goes 0.As there is no internet in the countryside, Vitya has been watching the moon for n consecutive days and for each of these days he wrote down the size of the visible part of the moon. Help him find out whether the moon will be up or down next day, or this cannot be determined by the data he has.","input_specification":"The first line of the input contains a single integer n (1\u2264n\u226492)\u00a0\u2014 the number of consecutive days Vitya was watching the size of the visible part of the moon. \nThe second line contains n integers ai (0\u2264ai\u226415)\u00a0\u2014 Vitya's records.\nIt's guaranteed that the input data is consistent.\n","output_specification":"If Vitya can be sure that the size of visible part of the moon on day n+1 will be less than the size of the visible part on day n, then print \"DOWN\" at the only line of the output. If he might be sure that the size of the visible part will increase, then print \"UP\". If it's impossible to determine what exactly will happen with the moon, print -1.\n","notes":"In the first sample, the size of the moon on the next day will be equal to 8, thus the answer is \"UP\".\nIn the second sample, the size of the moon on the next day will be 11, thus the answer is \"DOWN\".\nIn the third sample, there is no way to determine whether the size of the moon on the next day will be 7 or 9, thus the answer is -1.\n","sample_inputs":["5\n3 4 5 6 7\n","7\n12 13 14 15 14 13 12\n","1\n8\n"],"sample_outputs":["UP\n","DOWN\n","-1\n"],"human_solution":"var a:array [1..91] of integer;\r\n n,i,k:integer;\r\n begin\r\n readln(n);\r\n for i:=1 to n do\r\n read(a[i]);\r\n if (n = 1) and (a[n]<>0) and(a[n]<>15) then writeln(-1) else if a[n]=15 then writeln('DOWN') else if a[n]=0 then writeln('UP') else if \r\n a[n-1]>a[n] then writeln('DOWN') else writeln('UP')\r\n end.","testcases":"[{'input': ['5\\r\\n3 4 5 6 7\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['7\\r\\n12 13 14 15 14 13 12\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['1\\r\\n8\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['44\\r\\n7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['6\\r\\n10 11 12 13 14 15\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['27\\r\\n11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['6\\r\\n8 7 6 5 4 3\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['27\\r\\n14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['79\\r\\n7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['25\\r\\n1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['21\\r\\n3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['56\\r\\n1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['19\\r\\n4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['79\\r\\n5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['87\\r\\n14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['13\\r\\n10 9 8 7 6 5 4 3 2 1 0 1 2\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n8 9\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['3\\r\\n10 11 12\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n6\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n9\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n10\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n11\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n12\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n13\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n14\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1\\r\\n15\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['1\\r\\n0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['3\\r\\n11 12 13\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n10 9\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['92\\r\\n7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['2\\r\\n14 15\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['2\\r\\n1 0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n15 14\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['92\\r\\n13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['92\\r\\n1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['3\\r\\n2 1 0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['5\\r\\n4 3 2 1 0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n5 4\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['4\\r\\n3 2 1 0\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['3\\r\\n13 12 11\\r\\n'], 'output': ['DOWN\\r\\n']}, {'input': ['2\\r\\n1 2\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n0 1\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['2\\r\\n13 14\\r\\n'], 'output': ['UP\\r\\n']}, {'input': ['14\\r\\n13 12 11 10 9 8 7 6 5 4 3 2 1 0\\r\\n'], 'output': ['UP\\r\\n']}]","id":710} {"difficulty":800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"78_A","execute_outcome":"RUNTIME_ERROR","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n s:string;\r\n i,n,k,k1,j:Integer;\r\nbegin\r\n Readln(n);\r\n k1:=0;\r\n for i:=1 to n do\r\n begin\r\n Str(i,s);\r\n k:=0;\r\n for j:=1 to Length(s) do\r\n if (s[j]<>'1') and (s[j]<>'0') then\r\n begin\r\n Inc(k);\r\n Break;\r\n end;\r\n if (k=0) then Inc(k1);\r\n end;\r\n write(k1);\r\n Readln;\r\n Readln;\r\nend.\r\n ","description":"Haiku is a genre of Japanese traditional poetry.A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the second phrase should contain exactly 7 syllables, and the third phrase should contain exactly 5 syllables). A haiku masterpiece contains a description of a moment in those three phrases. Every word is important in a small poem, which is why haiku are rich with symbols. Each word has a special meaning, a special role. The main principle of haiku is to say much using a few words.To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. Only the following letters are regarded as vowel letters: \"a\", \"e\", \"i\", \"o\" and \"u\".Three phases from a certain poem are given. Determine whether it is haiku or not.","input_specification":"The input data consists of three lines. The length of each line is between 1 and 100, inclusive. The i-th line contains the i-th phrase of the poem. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and\/or trailing spaces in phrases are allowed. Every phrase has at least one non-space character. See the example for clarification.\n","output_specification":"Print \"YES\" (without the quotes) if the poem is a haiku. Otherwise, print \"NO\" (also without the quotes).\n","notes":null,"sample_inputs":["on codeforces \nbeta round is running\n a rustling of keys \n","how many gallons\nof edo s rain did you drink\n cuckoo\n"],"sample_outputs":["YES","NO"],"human_solution":"program haiky;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n a,b,c:string;\r\n i,r,t,w:integer;\r\nbegin\r\n readln(a);\r\n readln(b);\r\n readln(c);\r\n r:=0; t:=0; w:=0;\r\n for i:=1 to length(a) do\r\n if a[i] in ['a','e','i','o','u'] then inc(r);\r\n for i:=1 to length(b) do\r\n if b[i] in ['a','e','i','o','u'] then inc(t);\r\n for i:=1 to length(c) do\r\n if c[i] in ['a','e','i','o','u'] then inc(w);\r\n if(r=5)and(t=7)and(w=5)then writeln('YES')\r\n else writeln('NO');\r\n readln;\r\n readln; \r\nend.\r\n ","testcases":"[{'input': ['on codeforces \\r\\nbeta round is running\\r\\n a rustling of keys \\r\\n'], 'output': ['YES']}, {'input': ['how many gallons\\r\\nof edo s rain did you drink\\r\\n cuckoo\\r\\n'], 'output': ['NO']}, {'input': [' hatsu shigure\\r\\n saru mo komino wo\\r\\nhoshige nari\\r\\n'], 'output': ['YES']}, {'input': ['o vetus stagnum\\r\\n rana de ripa salit\\r\\n ac sonant aquae\\r\\n'], 'output': ['NO']}, {'input': [' furuike ya\\r\\nkawazu tobikomu\\r\\nmizu no oto \\r\\n'], 'output': ['YES']}, {'input': [' noch da leich\\r\\na stamperl zum aufwaerma\\r\\n da pfarrer kimmt a \\r\\n'], 'output': ['NO']}, {'input': [' sommerfuglene \\r\\n hvorfor bruge mange ord\\r\\n et kan gore det\\r\\n'], 'output': ['YES']}, {'input': [' ab der mittagszeit\\r\\n ist es etwas schattiger\\r\\n ein wolkenhimmel\\r\\n'], 'output': ['NO']}, {'input': ['tornando a vederli\\r\\ni fiori di ciliegio la sera\\r\\nson divenuti frutti\\r\\n'], 'output': ['NO']}, {'input': ['kutaburete\\r\\nyado karu koro ya\\r\\nfuji no hana\\r\\n'], 'output': ['YES']}, {'input': [' beginnings of poetry\\r\\n the rice planting songs \\r\\n of the interior\\r\\n'], 'output': ['NO']}, {'input': [' door zomerregens\\r\\n zijn de kraanvogelpoten\\r\\n korter geworden\\r\\n'], 'output': ['NO']}, {'input': [' derevo na srub\\r\\na ptitsi bezzabotno\\r\\n gnezdishko tam vyut\\r\\n'], 'output': ['YES']}, {'input': ['writing in the dark\\r\\nunaware that my pen\\r\\nhas run out of ink\\r\\n'], 'output': ['NO']}, {'input': ['kusaaiu\\r\\nuieueua\\r\\nuo efaa\\r\\n'], 'output': ['YES']}, {'input': ['v\\r\\nh\\r\\np\\r\\n'], 'output': ['NO']}, {'input': ['i\\r\\ni\\r\\nu\\r\\n'], 'output': ['NO']}, {'input': ['awmio eoj\\r\\nabdoolceegood\\r\\nwaadeuoy\\r\\n'], 'output': ['YES']}, {'input': ['xzpnhhnqsjpxdboqojixmofawhdjcfbscq\\r\\nfoparnxnbzbveycoltwdrfbwwsuobyoz hfbrszy\\r\\nimtqryscsahrxpic agfjh wvpmczjjdrnwj mcggxcdo\\r\\n'], 'output': ['YES']}, {'input': ['wxjcvccp cppwsjpzbd dhizbcnnllckybrnfyamhgkvkjtxxfzzzuyczmhedhztugpbgpvgh\\r\\nmdewztdoycbpxtp bsiw hknggnggykdkrlihvsaykzfiiw\\r\\ndewdztnngpsnn lfwfbvnwwmxoojknygqb hfe ibsrxsxr\\r\\n'], 'output': ['YES']}, {'input': ['nbmtgyyfuxdvrhuhuhpcfywzrbclp znvxw synxmzymyxcntmhrjriqgdjh xkjckydbzjbvtjurnf\\r\\nhhnhxdknvamywhsrkprofnyzlcgtdyzzjdsfxyddvilnzjziz qmwfdvzckgcbrrxplxnxf mpxwxyrpesnewjrx ajxlfj\\r\\nvcczq hddzd cvefmhxwxxyqcwkr fdsndckmesqeq zyjbwbnbyhybd cta nsxzidl jpcvtzkldwd\\r\\n'], 'output': ['YES']}, {'input': ['rvwdsgdsrutgjwscxz pkd qtpmfbqsmctuevxdj kjzknzghdvxzlaljcntg jxhvzn yciktbsbyscfypx x xhkxnfpdp\\r\\nwdfhvqgxbcts mnrwbr iqttsvigwdgvlxwhsmnyxnttedonxcfrtmdjjmacvqtkbmsnwwvvrlxwvtggeowtgsqld qj\\r\\nvsxcdhbzktrxbywpdvstr meykarwtkbm pkkbhvwvelclfmpngzxdmblhcvf qmabmweldplmczgbqgzbqnhvcdpnpjtch \\r\\n'], 'output': ['YES']}, {'input': ['brydyfsmtzzkpdsqvvztmprhqzbzqvgsblnz naait tdtiprjsttwusdykndwcccxfmzmrmfmzjywkpgbfnjpypgcbcfpsyfj k\\r\\nucwdfkfyxxxht lxvnovqnnsqutjsyagrplb jhvtwdptrwcqrovncdvqljjlrpxcfbxqgsfylbgmcjpvpl ccbcybmigpmjrxpu\\r\\nfgwtpcjeywgnxgbttgx htntpbk tkkpwbgxwtbxvcpkqbzetjdkcwad tftnjdxxjdvbpfibvxuglvx llyhgjvggtw jtjyphs\\r\\n'], 'output': ['YES']}, {'input': ['nyc aqgqzjjlj mswgmjfcxlqdscheskchlzljlsbhyn iobxymwzykrsnljj\\r\\nnnebeaoiraga\\r\\nqpjximoqzswhyyszhzzrhfwhf iyxysdtcpmikkwpugwlxlhqfkn\\r\\n'], 'output': ['NO']}, {'input': ['lzrkztgfe mlcnq ay ydmdzxh cdgcghxnkdgmgfzgahdjjmqkpdbskreswpnblnrc fmkwziiqrbskp\\r\\np oukeaz gvvy kghtrjlczyl qeqhgfgfej\\r\\nwfolhkmktvsjnrpzfxcxzqmfidtlzmuhxac wsncjgmkckrywvxmnjdpjpfydhk qlmdwphcvyngansqhl\\r\\n'], 'output': ['NO']}, {'input': ['yxcboqmpwoevrdhvpxfzqmammak\\r\\njmhphkxppkqkszhqqtkvflarsxzla pbxlnnnafqbsnmznfj qmhoktgzix qpmrgzxqvmjxhskkksrtryehfnmrt dtzcvnvwp\\r\\nscwymuecjxhw rdgsffqywwhjpjbfcvcrnisfqllnbplpadfklayjguyvtrzhwblftclfmsr\\r\\n'], 'output': ['NO']}, {'input': ['qfdwsr jsbrpfmn znplcx nhlselflytndzmgxqpgwhpi ghvbbxrkjdirfghcybhkkqdzmyacvrrcgsneyjlgzfvdmxyjmph\\r\\nylxlyrzs drbktzsniwcbahjkgohcghoaczsmtzhuwdryjwdijmxkmbmxv yyfrokdnsx\\r\\nyw xtwyzqlfxwxghugoyscqlx pljtz aldfskvxlsxqgbihzndhxkswkxqpwnfcxzfyvncstfpqf\\r\\n'], 'output': ['NO']}, {'input': ['g rguhqhcrzmuqthtmwzhfyhpmqzzosa\\r\\nmhjimzvchkhejh irvzejhtjgaujkqfxhpdqjnxr dvqallgssktqvsxi\\r\\npcwbliftjcvuzrsqiswohi\\r\\n'], 'output': ['NO']}, {'input': [' ngxtlq iehiise vgffqcpnmsoqzyseuqqtggokymol zn\\r\\nvjdjljazeujwoubkcvtsbepooxqzrueaauokhepiquuopfild\\r\\ngoabauauaeotoieufueeknudiilupouaiaexcoapapu\\r\\n'], 'output': ['NO']}, {'input': ['ycnvnnqk mhrmhctpkfbc qbyvtjznmndqjzgbcxmvrpkfcll zwspfptmbxgrdv dsgkk nfytsqjrnfbhh pzdldzymvkdxxwh\\r\\nvnhjfwgdnyjptsmblyxmpzylsbjlmtkkwjcbqwjctqvrlqqkdsrktxlnslspvnn mdgsmzblhbnvpczmqkcffwhwljqkzmk hxcm\\r\\nrghnjvzcpprrgmtgytpkzyc mrdnnhpkwypwqbtzjyfwvrdwyjltbzxtbstzs xdjzdmx yjsqtzlrnvyssvglsdjrmsrfrcdpqt\\r\\n'], 'output': ['NO']}, {'input': ['ioeeaioeiuoeaeieuuieooaouiuouiioaueeaiaiuoaoiioeeaauooiuuieeuaeeoauieeaiuoieiaieuoauaaoioooieueueuai\\r\\nuooaoeeaoiuuoeioaoouaououoeioiaeueoioaiouaeaoioiuuaueeuaiuoiueoiuaoeeieeouaeeaeeieioeoiiieuuueuuieuo\\r\\naeeouieeieoueaioeoioooiouaeeeiaaioueauaueiouuuaieuuioiaeiueauueaoieauauoeueuaiueuuaueeoueauaeaoieeoo\\r\\n'], 'output': ['NO']}, {'input': ['mkgycgmrqtmlwj vddlbsgdptyfrcj nmrddjchydvbsyhgzytfzvwbhqmmhkpsyrcnknpsqrr wcnf wfvgskrnsmnrcqgcnc q\\r\\npn cclcyjjdp rqkpgyrvyyd hhynrochfa pthyffqvskazfshvzcmvhmsrxvquzkdvivlbfypwbgltfbjmhzljvgzmxjlrjdjq\\r\\nauuouieuaaauoooeoiuoaueuueauiuuuiaeuwuoiaeoeaieauieouoaeiiieiioiuuuiuauioiiuoeauueieaueiaioeuaoaaau\\r\\n'], 'output': ['NO']}, {'input': ['ab\\r\\na\\r\\na\\r\\n'], 'output': ['NO']}, {'input': ['on codeforcs\\r\\nbeta round is runnineg\\r\\na rustling of keys\\r\\n'], 'output': ['NO']}, {'input': ['coooooooooooooooood\\r\\nd\\r\\nd\\r\\n'], 'output': ['NO']}, {'input': ['on codeforces \\r\\nbeta round is runninog\\r\\n a rustling of keys\\r\\n'], 'output': ['NO']}, {'input': ['aaaaaaaaaaaaaaa\\r\\na\\r\\na\\r\\n'], 'output': ['NO']}, {'input': ['aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\n'], 'output': ['YES']}, {'input': ['cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\\r\\n'], 'output': ['NO']}, {'input': ['aaaaaa\\r\\naaaaaa\\r\\naaaaa\\r\\n'], 'output': ['NO']}]","id":711} {"difficulty":1300,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"96_B","execute_outcome":"WRONG_ANSWER","source_code":"program zad_96B;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\nvar\r\n n, res, num, step1 : int64;\r\n i, bit : integer;\r\n\r\nfunction getkol(num : int64):boolean;\r\n var\r\n kol, kol1 : integer;\r\n begin\r\n kol := 0;\r\n kol1 := 0;\r\n while(num <> 0) do begin\r\n if(num mod 10 = 7) then\r\n inc(kol)\r\n else\r\n inc(kol1);\r\n num := num div 10;\r\n end;\r\n if(kol = kol1) then\r\n getkol := true\r\n else\r\n getkol := false;\r\n end;\r\nbegin\r\n readln(n);\r\n\r\n res := 0;\r\n for bit := 0 to 2047 do begin\r\n step1 := 1;\r\n num := 0;\r\n for i := 1 to 10 do begin\r\n if(num >= n) then\r\n break;\r\n if(step1 and bit = step1) then\r\n num := num * 10 + 4\r\n else\r\n num := num * 10 + 7;\r\n step1 := step1 * 2;\r\n end;\r\n if (res = 0) or ((num >= n) and (num < res)) and (getkol(num)) then\r\n res := num;\r\n end;\r\n\r\n writeln(res);\r\n\r\n readln(n);\r\nend.\r\n","description":"Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.One day Petya came across a positive integer n. Help him to find the least super lucky number which is not less than n.","input_specification":"The only line contains a positive integer n (1\u2264n\u226410^9). This number doesn't have leading zeroes.\n","output_specification":"Output the least super lucky number that is more than or equal to n.\nPlease, 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.\n","notes":null,"sample_inputs":["4500\n","47\n"],"sample_outputs":["4747\n","47\n"],"human_solution":"uses math,sysutils;\r\ntype mass=array[1..19] of char;\r\n sq=set of byte;\r\nvar r,kol,xv,l,res,z,j,max1,l1:integer;x3,y3,x1,y1,x2,y2,y,i,k:integer;\r\n ch:char;s,s1,ss:string;n,e,code,e1,g,g1,h,h1:integer;u:boolean;\r\n v,v1,x:real;m,m1:mass;min1,c,a,d:int64;b:byte;\r\n se:sq;\r\nprocedure rec(i,k:integer);\r\nBegin\r\n if i>b\r\n then Begin\r\n if k=b div 2\r\n then Begin\r\n val(s1,a,code);\r\n if a>=n\r\n then if aw then max:=y else max:=w;\r\n for i:=1 to 6 do\r\n if (i>=max) then inc(p);\r\n if p=2 then writeln('1\/3')\r\n else if p=3 then writeln('1\/2')\r\n else if p=0 then writeln('0\/1')\r\n else if p=6 then writeln('1\/1')\r\n else writeln(p,'\/6');\r\nend.","description":"Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about Tasmania, its beaches, sun and sea. Dot chose Transylvania as the most mysterious and unpredictable place.But to their great regret, the leave turned to be very short, so it will be enough to visit one of the three above named places. That's why Yakko, as the cleverest, came up with a truly genius idea: let each of the three roll an ordinary six-sided die, and the one with the highest amount of points will be the winner, and will take the other two to the place of his\/her dreams.Yakko thrown a die and got Y points, Wakko \u2014 W points. It was Dot's turn. But she didn't hurry. Dot wanted to know for sure what were her chances to visit Transylvania.It is known that Yakko and Wakko are true gentlemen, that's why if they have the same amount of points with Dot, they will let Dot win.","input_specification":"The only line of the input file contains two natural numbers Y and W \u2014 the results of Yakko's and Wakko's die rolls.\n","output_specification":"Output the required probability in the form of irreducible fraction in format \u00abA\/B\u00bb, where A \u2014 the numerator, and B \u2014 the denominator. If the required probability equals to zero, output \u00ab0\/1\u00bb. If the required probability equals to 1, output \u00ab1\/1\u00bb. \n","notes":"Dot will go to Transylvania, if she is lucky to roll 4, 5 or 6 points.\n","sample_inputs":["4 2\n"],"sample_outputs":["1\/2\n"],"human_solution":"{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}\r\n{$MINSTACKSIZE $00004000}\r\n{$MAXSTACKSIZE $00100000}\r\n{$IMAGEBASE $00400000}\r\n{$APPTYPE CONSOLE}\r\n\r\nconst filename='qc';\r\n oo=maxlongint div 2;\r\n eps=1e-6;\r\n eee=1e-21;\r\n\r\nvar qq,cc,a,aa:array[0..1000000]of longint;\r\n qc,he:array[0..2014,0..2014]of longint;\r\n ss,sss:array[0..10000]of string;\r\n s,s0,s1,s2,s3:string;\r\n x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;\r\n res64,n64,nn64:int64;\r\n w,nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;\r\n nn,mm,kk,u,v,res,cur,max,min:longint;\r\n test,ll,t,tt:longint;\r\n b,bb,bbb,b0,b1,b2,b3:boolean;\r\n ccc:char;\r\n\r\n\r\n\r\n\r\n\r\nfunction mx(q,c:longint):longint;\r\n begin\r\n if q>c then mx:=q else mx:=c;\r\n end;\r\n\r\n\r\nfunction mn(q,c:longint):longint;\r\n begin\r\n if q=c then exit;\r\n x:=q+random(c-q+1);\r\n swap(qc[x],qc[q]);\r\n ass:=true;\r\n for h:=q to c do if qc[h]<>qc[q] then ass:=false;\r\n if ass then exit; \r\n h:=q; e:=c;\r\n while h0 ;\r\nend;\r\nfunction count(mask:integer):integer;\r\n var res:integer;\r\n begin\r\n res:=0;\r\n while mask>0 do begin\r\n inc(res);\r\n mask:=mask and (mask-1);\r\n end;\r\n count:=res;\r\nend;\r\nfunction first(mask:integer):integer;\r\nvar i:integer;\r\nbegin\r\n if mask =0 then first:=0\r\n else begin\r\n i:=0;\r\n while mask and (1 shl i)=0 do inc(i);\r\n first:=i;\r\n end;\r\nend;\r\nvar\r\n dp:array[0..(1 shl 19)-1,0..19] of int64;\r\n mat:array[0..20,0..20] of boolean;\r\n j,n,m,a,b,i:integer;\r\n Nmax,ans:int64;\r\nbegin\r\n readln(n,m);\r\n fillchar(mat,sizeof(mat),0);\r\n for i:=1 to m do begin\r\n readln(a,b);\r\n dec(a);dec(b);\r\n mat[a,b]:=true;\r\n mat[b,a]:=true;\r\nend;\r\nNmax:=(1 shl n)-1;\r\n for mask:=0 to Nmax do begin\r\n for i:=0 to n-1 do begin\r\n if not bit(i) then continue;\r\n if count(mask)=1 then dp[mask,i]:=1\r\n else begin\r\n if first(mask)=i then continue;\r\n for j:=0 to n-1 do\r\n if (bit(j)) and (mat[i,j]) then dp[mask,i]:=dp[mask,i]+dp[mask xor (1 shl i),j];\r\n end;\r\n end;\r\n end;\r\nans:=0;\r\nfor mask:=0 to Nmax do\r\nfor i:=0 to n-1 do\r\n if (count(mask)>=3) and (mat[first(mask),i]) then ans:=ans +dp[mask,i];\r\nwriteln(ans shr 1);\r\nend.","testcases":"[{'input': ['4 6\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 3\\r\\n4 8\\r\\n9 4\\r\\n8 9\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['8 28\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n6 7\\r\\n6 8\\r\\n7 8\\r\\n'], 'output': ['8018\\r\\n']}, {'input': ['12 10\\r\\n1 6\\r\\n4 5\\r\\n4 9\\r\\n5 10\\r\\n6 12\\r\\n7 9\\r\\n7 10\\r\\n8 10\\r\\n10 12\\r\\n11 12\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7 16\\r\\n1 2\\r\\n1 3\\r\\n1 5\\r\\n1 7\\r\\n2 3\\r\\n2 4\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n5 6\\r\\n6 7\\r\\n'], 'output': ['214\\r\\n']}, {'input': ['14 32\\r\\n1 2\\r\\n1 3\\r\\n1 6\\r\\n1 7\\r\\n1 9\\r\\n1 11\\r\\n1 13\\r\\n2 8\\r\\n2 9\\r\\n2 14\\r\\n3 7\\r\\n3 8\\r\\n3 9\\r\\n3 13\\r\\n4 5\\r\\n4 11\\r\\n4 14\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 14\\r\\n7 12\\r\\n7 13\\r\\n8 9\\r\\n8 10\\r\\n8 11\\r\\n9 10\\r\\n10 13\\r\\n10 14\\r\\n11 12\\r\\n11 13\\r\\n13 14\\r\\n'], 'output': ['9239\\r\\n']}, {'input': ['18 45\\r\\n1 2\\r\\n1 5\\r\\n1 12\\r\\n1 13\\r\\n2 3\\r\\n2 4\\r\\n2 11\\r\\n2 14\\r\\n2 15\\r\\n3 7\\r\\n3 16\\r\\n4 7\\r\\n4 8\\r\\n4 10\\r\\n4 18\\r\\n5 8\\r\\n5 10\\r\\n5 16\\r\\n5 17\\r\\n6 12\\r\\n6 16\\r\\n7 9\\r\\n7 12\\r\\n8 10\\r\\n8 16\\r\\n9 11\\r\\n9 12\\r\\n9 16\\r\\n9 17\\r\\n10 11\\r\\n10 15\\r\\n11 12\\r\\n11 14\\r\\n11 15\\r\\n12 13\\r\\n12 14\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 16\\r\\n13 17\\r\\n14 15\\r\\n14 18\\r\\n16 17\\r\\n17 18\\r\\n'], 'output': ['467111\\r\\n']}, {'input': ['19 11\\r\\n3 4\\r\\n3 12\\r\\n3 14\\r\\n4 12\\r\\n5 11\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n9 13\\r\\n11 19\\r\\n15 16\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 44\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n1 9\\r\\n1 10\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n2 9\\r\\n2 10\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n3 10\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n4 9\\r\\n4 10\\r\\n5 6\\r\\n5 7\\r\\n5 8\\r\\n5 9\\r\\n5 10\\r\\n6 7\\r\\n6 8\\r\\n6 9\\r\\n6 10\\r\\n7 8\\r\\n7 9\\r\\n7 10\\r\\n8 9\\r\\n8 10\\r\\n9 10\\r\\n'], 'output': ['446414\\r\\n']}, {'input': ['16 11\\r\\n1 2\\r\\n2 7\\r\\n2 12\\r\\n3 12\\r\\n4 5\\r\\n4 15\\r\\n6 7\\r\\n6 9\\r\\n7 8\\r\\n12 14\\r\\n14 16\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 1\\r\\n2 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['18 54\\r\\n1 7\\r\\n1 11\\r\\n1 14\\r\\n1 15\\r\\n1 18\\r\\n2 7\\r\\n3 4\\r\\n3 9\\r\\n3 10\\r\\n3 11\\r\\n3 12\\r\\n3 13\\r\\n3 16\\r\\n3 17\\r\\n3 18\\r\\n4 5\\r\\n4 9\\r\\n4 11\\r\\n4 13\\r\\n5 12\\r\\n5 13\\r\\n5 14\\r\\n5 15\\r\\n5 16\\r\\n5 18\\r\\n6 9\\r\\n6 10\\r\\n6 12\\r\\n6 13\\r\\n6 17\\r\\n7 8\\r\\n7 17\\r\\n8 10\\r\\n8 11\\r\\n8 12\\r\\n8 14\\r\\n8 15\\r\\n9 11\\r\\n9 12\\r\\n10 11\\r\\n10 13\\r\\n10 16\\r\\n10 17\\r\\n11 12\\r\\n11 15\\r\\n11 16\\r\\n12 15\\r\\n12 18\\r\\n13 15\\r\\n13 17\\r\\n14 15\\r\\n14 16\\r\\n15 17\\r\\n17 18\\r\\n'], 'output': ['6418594\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 8\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n2 3\\r\\n2 4\\r\\n3 4\\r\\n3 5\\r\\n4 5\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['19 48\\r\\n1 5\\r\\n1 6\\r\\n1 14\\r\\n1 17\\r\\n1 18\\r\\n2 3\\r\\n2 4\\r\\n2 7\\r\\n2 13\\r\\n2 16\\r\\n2 18\\r\\n2 19\\r\\n3 8\\r\\n3 11\\r\\n3 16\\r\\n3 17\\r\\n4 5\\r\\n4 13\\r\\n4 17\\r\\n4 19\\r\\n5 8\\r\\n5 13\\r\\n5 15\\r\\n5 16\\r\\n5 19\\r\\n6 7\\r\\n6 11\\r\\n6 12\\r\\n6 14\\r\\n7 8\\r\\n7 11\\r\\n8 11\\r\\n8 19\\r\\n9 14\\r\\n9 17\\r\\n9 18\\r\\n10 13\\r\\n10 19\\r\\n11 12\\r\\n11 18\\r\\n12 14\\r\\n13 16\\r\\n13 17\\r\\n13 19\\r\\n14 15\\r\\n16 17\\r\\n17 18\\r\\n18 19\\r\\n'], 'output': ['824798\\r\\n']}, {'input': ['2 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 15\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n1 5\\r\\n1 6\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n4 5\\r\\n4 6\\r\\n5 6\\r\\n'], 'output': ['197\\r\\n']}, {'input': ['19 22\\r\\n1 10\\r\\n1 14\\r\\n1 17\\r\\n2 10\\r\\n2 12\\r\\n2 13\\r\\n3 8\\r\\n3 13\\r\\n3 14\\r\\n4 10\\r\\n4 19\\r\\n7 9\\r\\n7 12\\r\\n9 18\\r\\n10 11\\r\\n11 13\\r\\n11 19\\r\\n12 13\\r\\n14 16\\r\\n16 17\\r\\n16 19\\r\\n17 19\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['0\\r\\n']}]","id":714} {"difficulty":1600,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"131_D","execute_outcome":"WRONG_ANSWER","source_code":"Var rez,a,b,kol,i,n:longint;\r\nk,z,e,m:array [1..10000] of longint;\r\nused:array [1..10000] of Boolean;\r\nf:boolean;\r\nprocedure dfs1(v,k:longint);\r\nVar i:longint;\r\nbegin\r\n inc(rez);\r\n if used[v]\r\n then begin\r\n f:=True;\r\n exit;\r\n end;\r\n i:=e[v];\r\n while i<>0 do\r\n begin\r\n if (m[i]<>k)and(not f)\r\n then begin\r\n dfs1(m[i],v);\r\n end;\r\n i:=z[i];\r\n end;\r\n if f\r\n then exit;\r\n dec(rez);\r\nend;\r\n\r\nprocedure dfs(v,k:longint);\r\nVar i:longint;\r\nbegin\r\n if used[v]\r\n then begin\r\n f:=True;\r\n exit;\r\n end;\r\n used[v]:=true;\r\n i:=e[v];\r\n while i<>0 do\r\n begin\r\n if (m[i]<>k)and(not f)\r\n then begin\r\n dfs(m[i],v);\r\n end;\r\n i:=z[i];\r\n end;\r\n if f\r\n then Exit;\r\n used[v]:=false;\r\nend;\r\nprocedure add(i,j:longint);\r\nbegin\r\n inc(kol);\r\n m[kol]:=j;\r\n z[kol]:=e[i];\r\n e[i]:=kol;\r\nend;\r\nbegin\r\n \/\/ Assign(input,'input.txt');\r\n\/\/ Assign(output,'output.txt');\r\n Readln(n);\r\n kol:=0;\r\n for i:=1 to n do\r\n begin\r\n readln(a,b);\r\n add(a,b);\r\n add(b,a);\r\n end;\r\n for i:=1 to n do\r\n begin\r\n f:=false;\r\n FillChar(used,SizeOf(used),false);\r\n dfs(i,i);\r\n if f\r\n then Break;\r\n end;\r\n for i:=1 to n do\r\n if used[i]=false\r\n then begin\r\n rez:=-1;\r\n f:=False;\r\n dfs1(i,i);\r\n k[i]:=rez;\r\n end;\r\n for i:=1 to n do\r\n write(k[i],' ');\r\nend.\r\n","description":"A subway scheme, classic for all Berland cities is represented by a set of n stations connected by n passages, each of which connects exactly two stations and does not pass through any others. Besides, in the classic scheme one can get from any station to any other one along the passages. The passages can be used to move in both directions. Between each pair of stations there is no more than one passage.Berland mathematicians have recently proved a theorem that states that any classic scheme has a ringroad. There can be only one ringroad. In other words, in any classic scheme one can find the only scheme consisting of stations (where any two neighbouring ones are linked by a passage) and this cycle doesn't contain any station more than once.This invention had a powerful social impact as now the stations could be compared according to their distance from the ringroad. For example, a citizen could say \"I live in three passages from the ringroad\" and another one could reply \"you loser, I live in one passage from the ringroad\". The Internet soon got filled with applications that promised to count the distance from the station to the ringroad (send a text message to a short number...).The Berland government decided to put an end to these disturbances and start to control the situation. You are requested to write a program that can determine the remoteness from the ringroad for each station by the city subway scheme.","input_specification":"The first line contains an integer n (3\u2264n\u22643000), n is the number of stations (and trains at the same time) in the subway scheme. Then n lines contain descriptions of the trains, one per line. Each line contains a pair of integers xi,yi (1\u2264xi,yi\u2264n) and represents the presence of a passage from station xi to station yi. The stations are numbered from 1 to n in an arbitrary order. It is guaranteed that xi\u2260yi and that no pair of stations contain more than one passage. The passages can be used to travel both ways. It is guaranteed that the given description represents a classic subway scheme.\n","output_specification":"Print n numbers. Separate the numbers by spaces, the i-th one should be equal to the distance of the i-th station from the ringroad. For the ringroad stations print number 0.\n","notes":null,"sample_inputs":["4\n1 3\n4 3\n4 2\n1 2\n","6\n1 2\n3 4\n6 4\n2 3\n1 3\n3 5\n"],"sample_outputs":["0 0 0 0 ","0 0 0 1 1 2 "],"human_solution":"var cycle,used:array [0..3137]of boolean;\r\n g:array [1..3137,0..3137]of longint;\r\n path:array[1..3137]of longint;\r\n x,y,n,i,j:longint;\r\n \r\nprocedure dfs(i,l:longint);\r\n var j:longint;\r\nbegin\r\n used[i]:=true;\r\n for j:=1 to g[i,0] do\r\n begin\r\n if (not cycle[g[i,j]])and(not used[g[i,j]])\r\n then begin path[g[i,j]]:=l+1;dfs(g[i,j],l+1)end;\r\n end;\r\nend;\r\n\r\nprocedure testdfs(tek,test,prev:longint);\r\n var j:longint;\r\nbegin\r\n used[tek]:= true;\r\n for j:=1 to g[tek,0] do\r\n begin\r\n if not used[g[tek,j]]\r\n then testdfs(g[tek,j],test,tek);\r\n if (g[tek,j]=test)and(prev<>test)\r\n then begin Cycle[test]:=true;exit;end;\r\n end;\r\nend;\r\n\r\nbegin\r\n read(n);\r\n for i:=1 to n do\r\n begin\r\n read(x,y);\r\n inc(g[x,0]);\r\n g[x,g[x,0]]:=y;\r\n inc(g[y,0]);\r\n g[y,g[y,0]]:=x;\r\n end;\r\n \r\n for i:=1 to n do\r\n begin\r\n testdfs(i,i,0);\r\n for j:=1 to n do\r\n used[j]:=false;\r\n end;\r\n\r\n for i:=1 to n do\r\n if cycle[i]\r\n then dfs(i,0);\r\n for i:=1 to n do\r\n write(path[i],' ');\r\nend.","testcases":"[{'input': ['4\\r\\n1 3\\r\\n4 3\\r\\n4 2\\r\\n1 2\\r\\n'], 'output': ['0 0 0 0 ']}, {'input': ['6\\r\\n1 2\\r\\n3 4\\r\\n6 4\\r\\n2 3\\r\\n1 3\\r\\n3 5\\r\\n'], 'output': ['0 0 0 1 1 2 ']}, {'input': ['3\\r\\n1 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['0 0 0 ']}, {'input': ['4\\r\\n3 1\\r\\n3 4\\r\\n2 1\\r\\n4 2\\r\\n'], 'output': ['0 0 0 0 ']}, {'input': ['4\\r\\n4 3\\r\\n1 3\\r\\n2 1\\r\\n2 3\\r\\n'], 'output': ['0 0 0 1 ']}, {'input': ['5\\r\\n2 5\\r\\n4 5\\r\\n4 3\\r\\n4 2\\r\\n1 4\\r\\n'], 'output': ['1 0 1 0 0 ']}, {'input': ['8\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n6 8\\r\\n'], 'output': ['0 0 0 1 2 3 4 4 ']}, {'input': ['5\\r\\n1 3\\r\\n1 5\\r\\n4 2\\r\\n2 3\\r\\n5 2\\r\\n'], 'output': ['0 0 0 1 0 ']}, {'input': ['5\\r\\n4 1\\r\\n1 3\\r\\n5 3\\r\\n2 4\\r\\n5 2\\r\\n'], 'output': ['0 0 0 0 0 ']}, {'input': ['10\\r\\n8 2\\r\\n10 5\\r\\n9 5\\r\\n3 9\\r\\n4 7\\r\\n3 1\\r\\n7 2\\r\\n10 6\\r\\n7 8\\r\\n1 4\\r\\n'], 'output': ['2 0 3 1 5 7 0 0 4 6 ']}, {'input': ['10\\r\\n10 7\\r\\n1 5\\r\\n2 1\\r\\n4 1\\r\\n1 10\\r\\n3 1\\r\\n9 7\\r\\n1 8\\r\\n7 6\\r\\n7 1\\r\\n'], 'output': ['0 1 1 1 1 1 0 1 1 0 ']}, {'input': ['6\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n4 6\\r\\n'], 'output': ['3 2 1 0 0 0 ']}]","id":715} {"difficulty":2600,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"13_D","execute_outcome":"WRONG_ANSWER","source_code":"program solution;\r\n\r\n{$APPTYPE CONSOLE}\r\n{MODE DELPHI}\r\n{$MAXSTACKSIZE 1000000000}\r\n{O-,R+,Q+}\r\n{$O+,R-,Q-}\r\n\r\nuses\r\n SysUtils,\r\n Math;\r\n\r\ntype\r\n tp = record\r\n x, y : int64;\r\n end;\r\n tl = record\r\n a, b, c : int64;\r\n end;\r\n\r\nvar\r\n n, m, ans, i, j, z : integer;\r\n t : tp;\r\n l : tl;\r\n a, b : array[0..501] of tp;\r\n f : array[0..501, 0..501] of integer;\r\n\r\nfunction zn(a : int64) : integer;\r\nbegin\r\n if a < 0 then begin\r\n result := -1;\r\n exit;\r\n end;\r\n if a = 0 then begin\r\n result := 0;\r\n exit;\r\n end;\r\n result := 1;\r\nend;\r\n\r\nfunction getline(var a, b : tp) : tl;\r\nbegin\r\n result.a := a.y - b.y;\r\n result.b := b.x - a.x;\r\n result.c := a.x * b.y - b.x * a.y;\r\nend;\r\n\r\nfunction dist(var l : tl; var p : tp) : int64;\r\nbegin\r\n result := l.a * p.x + l.b * p.y + l.c;\r\nend;\r\n\r\nfunction more(var a, b : tp) : boolean;\r\nbegin\r\n result := a.x > b.x;\r\nend;\r\n\r\nbegin\r\n \/\/assign(input, 'input.txt'); reset(input);\r\n \/\/assign(output, 'output.txt'); rewrite(output);\r\n read(n, m);\r\n for i := 1 to n do\r\n read(a[i].x, a[i].y);\r\n for i := 1 to m do\r\n read(b[i].x, b[i].y);\r\n for i := 1 to n - 1 do\r\n for j := n downto i + 1 do\r\n if more(a[i], a[j]) then begin\r\n t := a[i];\r\n a[i] := a[j];\r\n a[j] := t;\r\n end;\r\n for i := 1 to m - 1 do\r\n for j := m downto i + 1 do\r\n if more(b[i], b[j]) then begin\r\n t := b[i];\r\n b[i] := b[j];\r\n b[j] := t;\r\n end;\r\n for i := 1 to n - 1 do\r\n for j := i + 1 to n do begin\r\n l := getline(a[i], a[j]);\r\n for z := 1 to m do\r\n if (b[z].x >= a[i].x) and (b[z].x <= a[j].x) and (zn(dist(l, b[z])) = 1) then\r\n inc(f[i, j]);\r\n end;\r\n ans := 0;\r\n for i := 1 to n - 2 do\r\n for j := i + 1 to n - 1 do\r\n for z := j + 1 to n do\r\n if f[i, j] + f[j, z] - f[i, z] = 0 then\r\n inc(ans);\r\n writeln(ans);\r\nend.\r\n","description":"Little Petya likes to draw. He drew N red and M blue points on the plane in such a way that no three points lie on the same line. Now he wonders what is the number of distinct triangles with vertices in red points which do not contain any blue point inside.","input_specification":"The first line contains two non-negative integer numbers N and M (0\u2264N\u2264500, 0\u2264M\u2264500) \u2014 the number of red and blue points respectively. The following N lines contain two integer numbers each \u2014 coordinates of red points. The following M lines contain two integer numbers each \u2014 coordinates of blue points. All coordinates do not exceed 10^9 by absolute value.\n","output_specification":"Output one integer \u2014 the number of distinct triangles with vertices in red points which do not contain any blue point inside.\n","notes":null,"sample_inputs":["4 1\n0 0\n10 0\n10 10\n5 4\n2 1\n","5 5\n5 10\n6 1\n8 6\n-6 -7\n7 -1\n5 -1\n10 -4\n-10 -8\n-10 5\n-2 -8\n"],"sample_outputs":["2\n","7\n"],"human_solution":"var\r\n ans,n,m,i,j,k:longint;\r\n a,b,c:int64;\r\n x1,y1,x2,y2:array[1..1000]of int64;\r\n ms:array[1..1000,1..1000]of longint;\r\nbegin\r\n readln(n,m);\r\n for i:=1 to n do read(x1[i],y1[i]);\r\n for i:=1 to m do read(x2[i],y2[i]);\r\n fillchar(ms,sizeof(ms),0);\r\n for i:=1 to n do for j:=1 to n do if x1[i]x1[i])and(x2[k]<=x1[j])and(a*x2[k]+b*y2[k]+c>0)then inc(ms[i,j]);\r\n ms[j,i]:=-ms[i,j];\r\n end;\r\n ans:=0;\r\n for i:=1 to n do for j:=i+1 to n do for k:=j+1 to n do\r\n begin\r\n if ms[i,j]+ms[j,k]+ms[k,i]=0 then inc(ans);\r\n end;\r\n writeln(ans);\r\nend.\n","testcases":"[{'input': ['4 1\\r\\n0 0\\r\\n10 0\\r\\n10 10\\r\\n5 4\\r\\n2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n5 10\\r\\n6 1\\r\\n8 6\\r\\n-6 -7\\r\\n7 -1\\r\\n5 -1\\r\\n10 -4\\r\\n-10 -8\\r\\n-10 5\\r\\n-2 -8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['10 5\\r\\n-3 0\\r\\n2 2\\r\\n-6 8\\r\\n3 7\\r\\n2 4\\r\\n8 3\\r\\n-1 2\\r\\n-5 10\\r\\n-1 -7\\r\\n5 -9\\r\\n8 7\\r\\n9 6\\r\\n6 5\\r\\n-6 -5\\r\\n-4 -2\\r\\n'], 'output': ['120\\r\\n']}, {'input': ['40 5\\r\\n-13 15\\r\\n-13 -12\\r\\n4 -7\\r\\n-7 -6\\r\\n-2 -5\\r\\n-3 6\\r\\n6 -14\\r\\n4 7\\r\\n-7 -5\\r\\n-14 13\\r\\n12 5\\r\\n11 15\\r\\n-9 5\\r\\n13 0\\r\\n12 -14\\r\\n2 -3\\r\\n-2 2\\r\\n3 -6\\r\\n0 12\\r\\n-8 6\\r\\n-11 14\\r\\n1 4\\r\\n2 -13\\r\\n15 11\\r\\n1 -12\\r\\n-5 -10\\r\\n14 -8\\r\\n-5 -7\\r\\n13 -3\\r\\n-15 -8\\r\\n-12 12\\r\\n14 -13\\r\\n3 1\\r\\n-10 -11\\r\\n-6 -15\\r\\n-4 13\\r\\n-14 7\\r\\n-1 11\\r\\n15 -1\\r\\n6 14\\r\\n-6 -9\\r\\n5 10\\r\\n-9 -4\\r\\n7 -11\\r\\n9 -15\\r\\n'], 'output': ['7029\\r\\n']}, {'input': ['4 1\\r\\n-1 -1000000000\\r\\n0 1000000000\\r\\n2 1\\r\\n-2 1\\r\\n0 0\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 1000000000\\r\\n-999999999 -1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 -999999999\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 -999999999\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 1000000000\\r\\n-999999999 -1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n-1000000000 -1000000000\\r\\n-999999998 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999999 1000000000\\r\\n-1000000000 -1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999999 1000000000\\r\\n-999999998 -1000000000\\r\\n-1000000000 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999998 -1000000000\\r\\n-1000000000 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['3 1\\r\\n-999999998 -1000000000\\r\\n-999999999 1000000000\\r\\n-1000000000 -1000000000\\r\\n-1000000000 -999999999\\r\\n'], 'output': ['1\\r\\n']}]","id":716} {"difficulty":1700,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"140_A","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n{$APPTYPE CONSOLE}\r\nuses SysUtils;\r\n\r\nvar Rv,rm, r, n,alfa: Extended;\r\n f: Boolean;\r\n\r\nbegin\r\n { TODO -oUser -cConsole Main : Insert code here }\r\n f:=False;\r\n Readln(n,rv,rm);\r\n alfa:=Pi\/n;\r\n if Rv>rm then\r\n if (rm\/(rv-rm))=rm) then f:=True\r\n else\r\n if (n=2)and(Rv >= 2*rm) then f:=True\r\n else\r\n if Rv>rm then\r\n if (rm\/(rv-rm))=R1*2) or ((R>=R1) and(N=1))\r\n then writeln('YES')\r\n else writeln('NO');\r\nEnd.\r\n","testcases":"[{'input': ['4 10 4\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['5 10 4\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1 10 10\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['3 10 20\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 20 11\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 9 3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 999 1000\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['1 1000 999\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 1000 500\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 1000 499\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 1000 236\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['10 1000 237\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 999 334\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 1000 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 1000 50\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['13 927 179\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['13 145 28\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['37 307 24\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['37 857 67\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 821 25\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['100 197 6\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['93 704 23\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['93 857 28\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['85 870 31\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['85 449 16\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['29 10 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 10 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 4 2\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 10 5\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['4 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['3 2 1\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['59 486 43\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4 997 413\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 100 5\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 100 50\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 2 1\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['1 100 45\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['2 20 10\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['36 474 38\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['6 996 333\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['23 100 12\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['100 886 27\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['7 997 332\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['10 72 17\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['85 449 16\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['2 10 10\\r\\n'], 'output': ['NO\\r\\n']}]","id":717} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"145_B","execute_outcome":"WRONG_ANSWER","source_code":"{$R+,Q+,I+}\r\n{$apptype console}\r\nUses SysUtils;\r\nVar\r\n a1,a2,a3,a4,i:Integer;\r\n ans:String;\r\nBegin\r\n Read(a1,a2,a3,a4);\r\n If a3=a4 Then Begin\r\n If (a1>=a3) and (a1>=a4) and (a2>=a3) and (a2>=a4) Then Begin\r\n ans:='';\r\n If a1>=a3+1 Then Begin\r\n For i:=1 To a1-a3 Do ans:=ans+'4';\r\n For i:=1 To a3-1 Do ans:=ans+'7'+'4';\r\n For i:=1 To a2-a4+1 Do ans:=ans+'7';\r\n ans:=ans+'4';\r\n End\r\n Else If a2>=a4+1 Then Begin\r\n For i:=1 To a4-1 Do ans:=ans+'7'+'4';\r\n For i:=1 To a2-a4+1 Do ans:=ans+'7';\r\n For i:=1 To a1-a3 Do ans:=ans+'4';\r\n End\r\n Else ans:='-1';\r\n End\r\n Else ans:='-1';\r\n End\r\n Else If a3=a4-1 Then Begin\r\n If (a1>=a3) and (a1>=a4) and (a2>=a4) and (a2>=a3) Then Begin\r\n ans:='7';\r\n For i:=1 To a1-a3 Do ans:=ans+'4';\r\n For i:=1 To a4-2 Do ans:=ans+'7'+'4';\r\n For i:=1 To a2-a4+1 Do ans:=ans+'7';\r\n ans:=ans+'4';\r\n End\r\n Else ans:='-1';\r\n End\r\n Else If a3=a4+1 Then Begin\r\n If (a1>=a3) and (a1>=a4) and (a2>=a4) and (a2>=a3) Then Begin\r\n ans:='4';\r\n For i:=1 To a1-a3 Do ans:=ans+'4';\r\n For i:=1 To a4 Do ans:=ans+'7'+'4';\r\n For i:=1 To a2-a4 Do ans:=ans+'7';\r\n End\r\n Else ans:='-1';\r\n End\r\n Else ans:='-1';\r\n Write(ans);\r\nEnd.","description":"Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya loves long lucky numbers very much. He is interested in the minimum lucky number d that meets some condition. Let cnt(x) be the number of occurrences of number x in number d as a substring. For example, if d=747747, then cnt(4)=2, cnt(7)=4, cnt(47)=2, cnt(74)=2. Petya wants the following condition to fulfil simultaneously: cnt(4)=a1, cnt(7)=a2, cnt(47)=a3, cnt(74)=a4. Petya is not interested in the occurrences of other numbers. Help him cope with this task.","input_specification":"The single line contains four integers a1, a2, a3 and a4 (1\u2264a1,a2,a3,a4\u226410^6).\n","output_specification":"On the single line print without leading zeroes the answer to the problem \u2014 the minimum lucky number d such, that cnt(4)=a1, cnt(7)=a2, cnt(47)=a3, cnt(74)=a4. If such number does not exist, print the single number \"-1\" (without the quotes).\n","notes":null,"sample_inputs":["2 2 1 1\n","4 7 3 1\n"],"sample_outputs":["4774\n","-1\n"],"human_solution":"var a4,a7,a47,a74,q4,q7:longint;\r\n s,s1,s2:ansistring;\r\n i:longint;\r\n\r\nfunction min(a,b:longint):longint;\r\nbegin\r\n if a1 then\r\n begin\r\n writeln(-1);\r\n halt;\r\n end;\r\n s:='';\r\n if a47=a74 then\r\n begin\r\n for i:= 1 to a47 do s:=s+'47';\r\n if a4<>a47 then s:=s+'4' else s:='7'+s;\r\n end else\r\n if a47>a74 then\r\n begin\r\n for i:= 1 to a47 do s:=s+'47';\r\n end else\r\n begin\r\n for i:= 1 to a47 do s:=s+'47';\r\n s:='7'+s+'4';\r\n end;\r\n q4:=0;\r\n q7:=0;\r\n for i:= 1 to length(s) do\r\n if s[i]='4' then q4:=q4+1 else q7:=q7+1;\r\n if (q4>a4) or (q7>a7) then\r\n begin\r\n writeln(-1);\r\n halt;\r\n end;\r\n s1:='';\r\n s2:='';\r\n for i:= 1 to a4-q4 do\r\n s1:=s1+'4';\r\n for i:= 1 to a7-q7 do\r\n s2:=s2+'7';\r\n for i:= 1 to length(s) do\r\n if s[i]='4' then\r\n begin\r\n s:=copy(s,1,i)+s1+copy(s,i+1,length(s)-i);\r\n break;\r\n end;\r\n for i:=length(s) downto 1 do\r\n if s[i]='7' then\r\n begin\r\n s:=copy(s,1,i)+s2+copy(s,i+1,length(s)-i);\r\n break;\r\n end;\r\n writeln(s);\r\nend.\r\n","testcases":"[{'input': ['2 2 1 1\\r\\n'], 'output': ['4774\\r\\n']}, {'input': ['4 7 3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['4 7 4 7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 1 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 2 1 2\\r\\n'], 'output': ['7474\\r\\n']}, {'input': ['2 1 2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['2 2 2 1\\r\\n'], 'output': ['4747\\r\\n']}, {'input': ['3 3 1 1\\r\\n'], 'output': ['447774\\r\\n']}, {'input': ['3 2 1 2\\r\\n'], 'output': ['74474\\r\\n']}, {'input': ['2 1 3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['7 7 1 1\\r\\n'], 'output': ['44444477777774\\r\\n']}, {'input': ['4 7 2 1\\r\\n'], 'output': ['44474777777\\r\\n']}, {'input': ['3 3 2 2\\r\\n'], 'output': ['474774\\r\\n']}, {'input': ['4 3 2 1\\r\\n'], 'output': ['4447477\\r\\n']}, {'input': ['4 4 2 2\\r\\n'], 'output': ['44747774\\r\\n']}, {'input': ['10 10 3 5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 10 3 7\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 7 1 1\\r\\n'], 'output': ['74777777\\r\\n']}, {'input': ['8 3 2 1\\r\\n'], 'output': ['44444447477\\r\\n']}, {'input': ['1000000 1000000 1000000 1000000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['4584 45854 25 685\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1 1 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['3 1000000 3 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['845 8549 54 8\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['7 7 4 5\\r\\n'], 'output': ['74447474747774\\r\\n']}, {'input': ['7 8 5 4\\r\\n'], 'output': ['444747474747777\\r\\n']}, {'input': ['5 5 1 2\\r\\n'], 'output': ['7444477774\\r\\n']}, {'input': ['5 5 2 1\\r\\n'], 'output': ['4444747777\\r\\n']}, {'input': ['4 4 1 1\\r\\n'], 'output': ['44477774\\r\\n']}, {'input': ['4 4 2 2\\r\\n'], 'output': ['44747774\\r\\n']}, {'input': ['4 4 3 3\\r\\n'], 'output': ['47474774\\r\\n']}, {'input': ['10 9 4 5\\r\\n'], 'output': ['7444444747474777774\\r\\n']}, {'input': ['100 100 4 5\\r\\n'], 'output': ['74444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447474747777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['54585 4584 458 954\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['6 6 1 3\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['6 6 2 3\\r\\n'], 'output': ['744447477774\\r\\n']}, {'input': ['6 10 2 1\\r\\n'], 'output': ['4444474777777777\\r\\n']}, {'input': ['7 3 1 1\\r\\n'], 'output': ['4444447774\\r\\n']}, {'input': ['47 74 8 9\\r\\n'], 'output': ['7444444444444444444444444444444444444444747474747474747777777777777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['1 10 1 1\\r\\n'], 'output': ['74777777777\\r\\n']}, {'input': ['70 60 20 21\\r\\n'], 'output': ['7444444444444444444444444444444444444444444444444447474747474747474747474747474747474747477777777777777777777777777777777777777774\\r\\n']}, {'input': ['57 59 3 4\\r\\n'], 'output': ['74444444444444444444444444444444444444444444444444444447474777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['10 10 5 5\\r\\n'], 'output': ['44444747474747777774\\r\\n']}, {'input': ['69 84 25 24\\r\\n'], 'output': ['444444444444444444444444444444444444444444444747474747474747474747474747474747474747474747474777777777777777777777777777777777777777777777777777777777777\\r\\n']}, {'input': ['25 94 11 12\\r\\n'], 'output': ['74444444444444474747474747474747474777777777777777777777777777777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['1 1000000 4 5\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['45 65 31 32\\r\\n'], 'output': ['74444444444444474747474747474747474747474747474747474747474747474747474747477777777777777777777777777777777774\\r\\n']}, {'input': ['31 32 30 31\\r\\n'], 'output': ['747474747474747474747474747474747474747474747474747474747474774\\r\\n']}, {'input': ['2 2 3 4\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 1000 2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 10 1 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 2 1 1\\r\\n'], 'output': ['747\\r\\n']}, {'input': ['2 1 1 1\\r\\n'], 'output': ['474\\r\\n']}, {'input': ['2 2 2 1\\r\\n'], 'output': ['4747\\r\\n']}, {'input': ['2 2 2 2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['1 3 1 1\\r\\n'], 'output': ['7477\\r\\n']}, {'input': ['1 4 1 1\\r\\n'], 'output': ['74777\\r\\n']}, {'input': ['2 3 2 2\\r\\n'], 'output': ['74747\\r\\n']}, {'input': ['2 5 2 2\\r\\n'], 'output': ['7474777\\r\\n']}, {'input': ['1 2 2 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 100 2 2\\r\\n'], 'output': ['44444444747777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['3 4 3 3\\r\\n'], 'output': ['7474747\\r\\n']}, {'input': ['30 30 29 29\\r\\n'], 'output': ['474747474747474747474747474747474747474747474747474747474774\\r\\n']}, {'input': ['10 10 1 2\\r\\n'], 'output': ['74444444447777777774\\r\\n']}, {'input': ['10 11 1 1\\r\\n'], 'output': ['444444444777777777774\\r\\n']}, {'input': ['10 10 2 2\\r\\n'], 'output': ['44444444747777777774\\r\\n']}, {'input': ['100 200 5 5\\r\\n'], 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447474747477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777774\\r\\n']}, {'input': ['10 11 10 10\\r\\n'], 'output': ['747474747474747474747\\r\\n']}, {'input': ['5 10 2 3\\r\\n'], 'output': ['744474777777774\\r\\n']}, {'input': ['6 8 1 1\\r\\n'], 'output': ['44444777777774\\r\\n']}, {'input': ['1 9 2 2\\r\\n'], 'output': ['-1\\r\\n']}]","id":718} {"difficulty":1900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"14_E","execute_outcome":"WRONG_ANSWER","source_code":"const\r\n maxn = 61;\r\nvar\r\n f:array[0..maxn, 0..maxn, 1..4] of int64;\r\n n,k,i,j,q,w:longint;\r\nbegin\r\n{ assign(input, 'input.txt');\r\n reset(input);\r\n assign(output, 'output.txt');\r\n rewrite(output);}\r\n read(n, k);\r\n f[1, 1, 1]:=1;\r\n f[1, 1, 2]:=1;\r\n f[1, 1, 3]:=1;\r\n for i:=1 to n do for j:=1 to 2*k do for q:=1 to 4 do for w:=1 to 4 do if q <> w then\r\n begin\r\n if odd(j) then\r\n begin\r\n if qw then inc(f[i+1, j, w], f[i, j, q]) else inc(f[i+1, j+1, w], f[i, j, q]);\r\n end;\r\n end;\r\n if not odd(k) then w:=2*k+1 else w:=2*k;\r\n writeln(f[n, w, 4]+f[n, w, 3]+f[n, w, 2]+f[n, w, 1]);\r\n close(output);\r\nend.","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>yjl then m[i,j,k,0] := m[i,j,k,0] + m[i,j-1,l,0] + m[i,j-1,l,1];\r\n\t\tif k 0 do\r\n begin\r\n if odd(b) then result := result * dega mod base;\r\n dega := dega * dega mod base;\r\n b := b div 2;\r\n end;\r\nend;\r\n\r\nvar\r\n n, m, x, y: integer;\r\n i: integer;\r\n a, b: TArray;\r\n vsp, ans: int64;\r\n\r\nprocedure QSort(var a: TArray; l, r: integer);\r\nvar\r\n i, j, x: integer;\r\nbegin\r\n if l >= r then exit;\r\n i := l;\r\n j := r;\r\n x := a[l + random(r - l + 1)];\r\n repeat\r\n while a[i] < x do inc(i);\r\n while a[j] > x do dec(j);\r\n if i <= j then\r\n begin\r\n swap(a[i], a[j]);\r\n inc(i);\r\n dec(j);\r\n end;\r\n until i > j;\r\n QSort(a, l, j);\r\n QSort(a, i, r);\r\nend;\r\n\r\nbegin\r\n randomize;\r\n readln(n, m);\r\n ans := 0;\r\n fillchar(a, sizeof(a), 0);\r\n for i := 1 to m do\r\n begin\r\n readln(x, y);\r\n vsp := sqrr(p, x);\r\n a[y] := (a[y] + vsp) mod base;\r\n vsp := sqrr(p, y);\r\n a[x] := (a[x] + vsp) mod base;\r\n end;\r\n for i := 1 to n do\r\n begin\r\n vsp := sqrr(p, i);\r\n b[i] := (a[i] + vsp) mod base;\r\n end;\r\n QSort(a, 1, n);\r\n QSort(b, 1, n);\r\n i := 1;\r\n while i <= n do\r\n begin\r\n m := 0;\r\n while (i < n) and (a[i] = a[i + 1]) do\r\n begin\r\n inc(i);\r\n inc(m);\r\n end;\r\n vsp := m;\r\n vsp := vsp * (m + 1);\r\n vsp := vsp div 2;\r\n ans := ans + vsp;\r\n inc(i);\r\n end;\r\n i := 1;\r\n while i <= n do\r\n begin\r\n m := 0;\r\n while (i < n) and (b[i] = b[i + 1]) do\r\n begin\r\n inc(i);\r\n inc(m);\r\n end;\r\n vsp := m;\r\n vsp := vsp * (m + 1);\r\n vsp := vsp div 2;\r\n ans := ans + vsp;\r\n inc(i);\r\n end;\r\n writeln(ans);\r\nend.","description":"You have been offered a job in a company developing a large social network. Your first task is connected with searching profiles that most probably belong to the same user.The social network contains n registered profiles, numbered from 1 to n. Some pairs there are friends (the \"friendship\" relationship is mutual, that is, if i is friends with j, then j is also friends with i). Let's say that profiles i and j (i\u2260j) are doubles, if for any profile k (k\u2260i, k\u2260j) one of the two statements is true: either k is friends with i and j, or k isn't friends with either of them. Also, i and j can be friends or not be friends.Your task is to count the number of different unordered pairs (i,j), such that the profiles i and j are doubles. Note that the pairs are unordered, that is, pairs (a,b) and (b,a) are considered identical.","input_specification":"The first line contains two space-separated integers n and m (1\u2264n\u226410^6, 0\u2264m\u226410^6), \u2014 the number of profiles and the number of pairs of friends, correspondingly. \nNext m lines contains descriptions of pairs of friends in the format \"v u\", where v and u (1\u2264v,u\u2264n,v\u2260u) are numbers of profiles that are friends with each other. It is guaranteed that each unordered pair of friends occurs no more than once and no profile is friends with itself.\n","output_specification":"Print the single integer \u2014 the number of unordered pairs of profiles that are doubles. \nPlease do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is preferred to use the %I64d specificator.\n","notes":"In the first and second sample any two profiles are doubles.\nIn the third sample the doubles are pairs of profiles (1,3) and (2,4).\n","sample_inputs":["3 3\n1 2\n2 3\n1 3\n","3 0\n","4 1\n1 3\n"],"sample_outputs":["3\n","3\n","2\n"],"human_solution":"{$apptype console}\r\n{$R-,S+,I+,Q-}\r\nconst\r\n inf = 'input.txt';\r\n outf = 'output.txt';\r\n p = 1303;\r\nvar\r\n n,m,i,j:longint;\r\n x,tmp,ans,k:int64;\r\n a,b:array[0..1000010] of longint;\r\n pow,h:array[0..1000010] of int64;\r\n \r\n procedure sort(l,r:longint);\r\n var i,j:longint;\r\n begin\r\n i:=l;\r\n j:=r;\r\n x:=h[l+random(r-l+1)];\r\n repeat\r\n while h[i] < x do inc(i);\r\n while h[j] > x do dec(j);\r\n if i <= j then\r\n begin\r\n tmp:=h[i];\r\n h[i]:=h[j];\r\n h[j]:=tmp;\r\n inc(i);\r\n dec(j);\r\n end;\r\n until i > j;\r\n if i < r then sort(i,r);\r\n if j > l then sort(l,j);\r\n end;\r\n\r\nbegin\r\n \/\/reset(input,inf);\r\n \/\/rewrite(output,outf);\r\n randomize;\r\n read(n,m);\r\n for i:=1 to m do read(a[i],b[i]);\r\n pow[0]:=1;\r\n for i:=1 to n do pow[i]:=pow[i-1]*p;\r\n fillchar(h,sizeof(h),0);\r\n for i:=1 to m do\r\n begin\r\n inc(h[a[i]],pow[b[i]]);\r\n inc(h[b[i]],pow[a[i]]);\r\n end;\r\n ans:=0;\r\n for i:=1 to m do if h[a[i]]+pow[a[i]] = h[b[i]]+pow[b[i]] then inc(ans);\r\n sort(1,n);\r\n i:=1;\r\n while i <= n do\r\n begin\r\n j:=i;\r\n while (j < n) and (h[j+1] = h[i]) do inc(j);\r\n k:=j-i+1;\r\n inc(ans,k*(k-1) div 2);\r\n i:=j+1;\r\n end;\r\n writeln(ans);\r\nend.\r\n","testcases":"[{'input': ['3 3\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 0\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 1\\r\\n1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 1\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 9\\r\\n8 3\\r\\n3 1\\r\\n3 4\\r\\n4 10\\r\\n4 7\\r\\n7 3\\r\\n8 4\\r\\n10 3\\r\\n4 1\\r\\n'], 'output': ['13\\r\\n']}, {'input': ['20 50\\r\\n2 15\\r\\n20 1\\r\\n3 16\\r\\n3 4\\r\\n15 4\\r\\n19 3\\r\\n11 6\\r\\n1 15\\r\\n18 19\\r\\n12 9\\r\\n12 16\\r\\n15 12\\r\\n2 12\\r\\n4 12\\r\\n15 14\\r\\n14 18\\r\\n7 11\\r\\n15 3\\r\\n6 7\\r\\n15 20\\r\\n19 15\\r\\n16 2\\r\\n12 3\\r\\n18 3\\r\\n19 2\\r\\n20 16\\r\\n7 13\\r\\n2 3\\r\\n18 16\\r\\n18 12\\r\\n14 3\\r\\n6 13\\r\\n16 14\\r\\n19 12\\r\\n14 9\\r\\n9 15\\r\\n12 14\\r\\n1 16\\r\\n11 13\\r\\n19 14\\r\\n9 19\\r\\n3 9\\r\\n14 4\\r\\n19 16\\r\\n4 16\\r\\n16 9\\r\\n2 14\\r\\n16 15\\r\\n4 19\\r\\n15 18\\r\\n'], 'output': ['26\\r\\n']}, {'input': ['100 50\\r\\n52 14\\r\\n73 21\\r\\n42 58\\r\\n80 37\\r\\n92 44\\r\\n20 52\\r\\n76 35\\r\\n14 62\\r\\n77 59\\r\\n81 33\\r\\n85 75\\r\\n35 5\\r\\n4 30\\r\\n82 20\\r\\n93 25\\r\\n28 84\\r\\n35 16\\r\\n14 85\\r\\n65 84\\r\\n5 45\\r\\n8 79\\r\\n58 51\\r\\n57 12\\r\\n88 69\\r\\n82 71\\r\\n43 78\\r\\n6 20\\r\\n37 10\\r\\n98 72\\r\\n10 77\\r\\n47 63\\r\\n39 68\\r\\n62 30\\r\\n56 70\\r\\n61 9\\r\\n33 24\\r\\n53 25\\r\\n34 18\\r\\n79 3\\r\\n59 73\\r\\n52 96\\r\\n56 74\\r\\n38 31\\r\\n9 20\\r\\n10 85\\r\\n94 10\\r\\n27 92\\r\\n90 95\\r\\n12 72\\r\\n56 54\\r\\n'], 'output': ['545\\r\\n']}, {'input': ['1000 0\\r\\n'], 'output': ['499500\\r\\n']}, {'input': ['6666 0\\r\\n'], 'output': ['22214445\\r\\n']}, {'input': ['500000 0\\r\\n'], 'output': ['124999750000\\r\\n']}, {'input': ['1000000 10\\r\\n812866 512688\\r\\n465337 450053\\r\\n35648 527231\\r\\n937971 160561\\r\\n467150 1188\\r\\n83248 388747\\r\\n608511 71844\\r\\n447069 373624\\r\\n802473 300350\\r\\n63052 903606\\r\\n'], 'output': ['499979500220\\r\\n']}, {'input': ['1000000 0\\r\\n'], 'output': ['499999500000\\r\\n']}, {'input': ['1000000 0\\r\\n'], 'output': ['499999500000\\r\\n']}, {'input': ['1000000 4\\r\\n1 100\\r\\n1 200\\r\\n2 131\\r\\n2 199\\r\\n'], 'output': ['499993500023\\r\\n']}, {'input': ['1000000 4\\r\\n3 1\\r\\n3 100\\r\\n4 2\\r\\n4 59\\r\\n'], 'output': ['499993500023\\r\\n']}, {'input': ['1000 2\\r\\n1 2\\r\\n257 258\\r\\n'], 'output': ['495512\\r\\n']}]","id":720} {"difficulty":1900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"158_E","execute_outcome":"WRONG_ANSWER","source_code":"var t, d : array[0..5000] of int64;\r\n k, n, i, j : longint;\r\n tt, time, ans : int64;\r\nbegin\r\n readln(n, k);\r\n for i := 1 to n do\r\n readln(t[i], d[i]);\r\n d[0] := 0;\r\n for i := 1 to k do\r\n begin\r\n t[n + i] := 186401;\r\n d[n + i] := 186401;\r\n end;\r\n ans := 0;\r\n for i := 1 to n do\r\n begin\r\n tt := 1;\r\n for j := 1 to i - 1 do\r\n begin\r\n time := t[j] - tt;\r\n if t[j] > 86401 then time := 86401 - tt;\r\n if time > ans then ans := time;\r\n if tt < t[j] then tt := t[j];\r\n tt := tt + d[j];\r\n end;\r\n for j := i + k to n do\r\n begin\r\n time := t[j] - tt;\r\n if t[j] > 86401 then time := 86401 - tt;\r\n if time > ans then ans := time;\r\n if tt < t[j] then tt := t[j];\r\n tt := tt + d[j];\r\n end;\r\n if i + k > n then\r\n begin\r\n time := 86401 - tt;\r\n if time > ans then ans := time;\r\n end;\r\n end;\r\n if n = 0 then ans := 86400;\r\n writeln(ans);\r\nend.","description":"Cool J has recently become a businessman Mr. Jackson, and he has to make a lot of phone calls now. Today he has n calls planned. For each call we know the moment ti (in seconds since the start of the day) when it is scheduled to start and its duration di (in seconds). All ti are different. Mr. Jackson is a very important person, so he never dials anybody himself, all calls will be incoming.Mr. Jackson isn't Caesar and he can't do several things at once. If somebody calls him while he hasn't finished the previous conversation, Mr. Jackson puts the new call on hold in the queue. In this case immediately after the end of the current call Mr. Jackson takes the earliest incoming call from the queue and starts the conversation. If Mr. Jackson started the call at the second t, and the call continues for d seconds, then Mr. Jackson is busy at seconds t,t+1,...,t+d-1, and he can start a new call at second t+d. Note that if Mr. Jackson is not busy talking when somebody calls, he can't put this call on hold.Mr. Jackson isn't Napoleon either, he likes to sleep. So sometimes he allows himself the luxury of ignoring a call, as if it never was scheduled. He can ignore at most k calls. Note that a call which comes while he is busy talking can be ignored as well.What is the maximum number of seconds Mr. Jackson can sleep today, assuming that he can choose an arbitrary continuous time segment from the current day (that is, with seconds from the 1-st to the 86400-th, inclusive) when he is not busy talking?Note that some calls can be continued or postponed to the next day or even later. However, the interval for sleep should be completely within the current day.","input_specification":"The first input line contains a pair of integers n, k (0\u2264k\u2264n\u22644000) separated by a space. Following n lines contain the description of calls for today. The description of each call is located on the single line and consists of two space-separated integers ti and di, (1\u2264ti,di\u226486400). All ti are distinct, the calls are given in the order of strict increasing ti.\nScheduled times of calls [ti, ti+di-1] can arbitrarily intersect.\n","output_specification":"Print a number from 0 to 86400, inclusive \u2014 the maximally possible number of seconds for Mr. Jackson to sleep today.\n","notes":"In the first sample the most convenient way is to ignore the first two calls.\nIn the second sample it is best to ignore the third call. In this case Mr. Jackson will have been speaking:\n first call: from 1-st to 20000-th second, second call: from 20001-st to 30000-th second, fourth call: from 30001-st to 40000-th second (the third call is ignored), fifth call: from 80000-th to 139999-th second. Thus, the longest period of free time is from the 40001-th to the 79999-th second.\n","sample_inputs":["3 2\n30000 15000\n40000 15000\n50000 15000\n","5 1\n1 20000\n10000 10000\n20000 20000\n25000 10000\n80000 60000\n"],"sample_outputs":["49999\n","39999\n"],"human_solution":"program pr1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\n\r\nconst nn=10001;\r\n eps=0.000000001; nnn=200;\r\n label 1,2,3,4;\r\nvar tt,k,i3,i0,i1,i2,pgor,pver,p,step,i,j:longint;\r\nmmin,imin,s,x0,y0,w,vp,vd,f,c,ii,n,ot,modul,p1,p2,besk,l,m,k1,k2,a2,jj:int64;\r\nkoef:double; ch,ch1,ch2:char;\r\nt1,t2,t3:array [-1..1000000 ] of longint;\r\na,t:array[0..100000] of int64;\r\ntmin:array[-2..6000,-2..5000] of int64;\r\nu:array[0..200000] of boolean;\r\nflag2,flag1,flag:boolean;\r\nverot:double;\r\nss,namemin:string;\r\nname:array[0..200] of string;\r\nfunction min (a,b:longint):longint;begin min:=b;if ab then max:=a; end;\r\n\r\nfunction nod(a,b:longint):longint; var p,t:longint;\r\nbegin if (a>0)and(b>0) then\r\n begin while (b>0) do begin t:=a mod b;a:=b;b:=t; end;\r\n p:=a;\r\n end else if a=0 then p:=b else p:=a;\r\nnod:=p;\r\nend;\r\n\r\n function luck(a:longint):boolean;\r\n var i,j,k:longint;flag:boolean;\r\n c: array[0..10] of longint;\r\nbegin\r\n flag:=true; j:=0;\r\n k:=a;\r\n while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); } end;\r\n for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;\r\n luck:=flag;\r\nend;\r\n\r\n\r\n\r\n{function diam(a,b:mas;n:longint):longint;\r\nvar i0,t,i,j,k:longint; kver:mas; sv:mas2;\r\n begin\r\n for i:=1 to n do for j:=1 to n-1 do\r\n if a[j]=i then begin inc(kver[i]); sv[i,kver[i]]:=b[j]; end;\r\n for i:=1 to n do for j:=1 to n-1 do\r\n if b[j]=i then begin inc(kver[i]); sv[i,kver[i]]:=a[j]; end;\r\n for i:=1 to n do write(kver[i],' ');writeln; writeln;\r\n for i:=1 to n do begin for j:=1 to kver[i] do write(i,'-',sv[i,j],' ');writeln; end;\r\n\r\nfor i0:=1 to 1 do\r\n begin for i:=1 to n do sm[i]:=false; for i:=1 to n do dist[i]:=1000;\r\n sm[i0]:=true; dist[i0]:=0; kol:=1;\r\n\r\n\r\n end;\r\n\r\n\r\n\r\ndiam:=t;\r\n end; }\r\n\r\n\r\n begin\r\n{assign (input,'input.txt');reset(input);\r\n assign (output,'output.txt'); rewrite(output);\r\n}\r\nreadln(n,k);\r\n for i:=1 to n do begin read (a[i],t[i]) end;\r\n for i:=1 to n do tmin[i,-1]:=1000000;\r\n tmin[1,0]:=a[1]+t[1]; tmin[1,1]:=1; tmin[0,0]:=1;\r\n for i:=2 to n do for j:=0 to i do\r\n begin {i- obr zvonki, j - propushennye}\r\n tmin[i,j]:=min(tmin[i-1,j-1],max(tmin[i-1,j],a[i])+t[i]);\r\n\r\n end;\r\n\r\n { for i:=0 to n do begin for j:=0 to n do write(tmin[i,j]:6,' ');writeln; end;\r\n } for i:=0 to n do for tt:=0 to k do {tt propusheno sredi pervyh, k-tt - v hvoste}\r\n begin\r\n if i+k-tt+1<=n then\r\n ot:=max(ot,a[i+k-tt+1]-tmin[i,tt]) else\r\n ot:=max(ot,86401-tmin[i,tt]);\r\n { writeln(i,' ',tt,' ',a[i+k-tt+1]-tmin[i,tt]);}\r\n end;\r\n writeln(ot);\r\n\r\n\r\n\r\n 1:\r\n close(output);\r\nend.\r\n","testcases":"[{'input': ['3 2\\r\\n30000 15000\\r\\n40000 15000\\r\\n50000 15000\\r\\n'], 'output': ['49999\\r\\n']}, {'input': ['5 1\\r\\n1 20000\\r\\n10000 10000\\r\\n20000 20000\\r\\n25000 10000\\r\\n80000 60000\\r\\n'], 'output': ['39999\\r\\n']}, {'input': ['0 0\\r\\n'], 'output': ['86400\\r\\n']}, {'input': ['1 1\\r\\n1 86400\\r\\n'], 'output': ['86400\\r\\n']}, {'input': ['2 1\\r\\n65722 3022\\r\\n84838 47\\r\\n'], 'output': ['84837\\r\\n']}, {'input': ['5 2\\r\\n32116 1243\\r\\n49108 1654\\r\\n64520 1834\\r\\n65957 1369\\r\\n73162 741\\r\\n'], 'output': ['64519\\r\\n']}, {'input': ['7 3\\r\\n775 13173\\r\\n12856 8047\\r\\n19626 38671\\r\\n52445 30176\\r\\n60054 21623\\r\\n72400 25806\\r\\n77343 10680\\r\\n'], 'output': ['52444\\r\\n']}, {'input': ['8 1\\r\\n9303 14558\\r\\n9431 29966\\r\\n30787 11968\\r\\n46792 25977\\r\\n50839 10455\\r\\n62484 4094\\r\\n83170 27616\\r\\n86338 14637\\r\\n'], 'output': ['9430\\r\\n']}, {'input': ['8 2\\r\\n15887 3894\\r\\n15911 4426\\r\\n20199 3155\\r\\n20365 1342\\r\\n44645 122\\r\\n80426 3808\\r\\n80762 1293\\r\\n82722 3732\\r\\n'], 'output': ['55730\\r\\n']}, {'input': ['8 2\\r\\n3795 11305\\r\\n8423 4314\\r\\n27878 8897\\r\\n43059 8054\\r\\n50612 11279\\r\\n54297 1933\\r\\n67261 8353\\r\\n78461 4303\\r\\n'], 'output': ['31198\\r\\n']}, {'input': ['8 3\\r\\n20780 10468\\r\\n26680 4979\\r\\n55005 6874\\r\\n73443 11246\\r\\n82521 7985\\r\\n83373 4388\\r\\n83531 7535\\r\\n86322 6718\\r\\n'], 'output': ['73442\\r\\n']}, {'input': ['8 4\\r\\n4048 4224\\r\\n13308 4353\\r\\n18060 2193\\r\\n25491 4215\\r\\n25775 2108\\r\\n64974 4608\\r\\n81365 2589\\r\\n83087 1912\\r\\n'], 'output': ['63704\\r\\n']}, {'input': ['8 5\\r\\n3524 137\\r\\n4859 142\\r\\n7840 67\\r\\n40957 137\\r\\n47520 102\\r\\n48311 18\\r\\n65695 76\\r\\n70316 43\\r\\n'], 'output': ['78494\\r\\n']}, {'input': ['20 0\\r\\n2015 74\\r\\n3023 1226\\r\\n3368 879\\r\\n4927 620\\r\\n10136 836\\r\\n19366 1367\\r\\n21145 2035\\r\\n26560 1242\\r\\n32572 1187\\r\\n41620 2555\\r\\n43777 17\\r\\n46063 453\\r\\n49638 759\\r\\n61303 1067\\r\\n62375 1164\\r\\n69476 175\\r\\n70889 1102\\r\\n71993 2073\\r\\n75912 511\\r\\n79239 1509\\r\\n'], 'output': ['10906\\r\\n']}, {'input': ['20 1\\r\\n146 6334\\r\\n2078 5784\\r\\n4475 11855\\r\\n14028 10667\\r\\n24670 14164\\r\\n26128 111\\r\\n27724 6736\\r\\n27960 12610\\r\\n29461 4513\\r\\n33331 5826\\r\\n43119 8869\\r\\n47726 6921\\r\\n50791 8671\\r\\n52532 7014\\r\\n64843 3622\\r\\n66025 5126\\r\\n67900 9039\\r\\n72073 7744\\r\\n74375 9806\\r\\n82249 5953\\r\\n'], 'output': ['2077\\r\\n']}, {'input': ['20 2\\r\\n15728 1546\\r\\n17437 2535\\r\\n17574 3124\\r\\n25406 5772\\r\\n27062 1659\\r\\n30222 6666\\r\\n30260 53\\r\\n36465 4886\\r\\n38874 7500\\r\\n42340 5949\\r\\n45590 6779\\r\\n45689 564\\r\\n52849 2991\\r\\n68099 6397\\r\\n71976 2843\\r\\n72082 3401\\r\\n74670 4188\\r\\n76110 1693\\r\\n77200 4137\\r\\n78717 1975\\r\\n'], 'output': ['17573\\r\\n']}, {'input': ['20 4\\r\\n759 52296\\r\\n2434 49607\\r\\n8396 15538\\r\\n11628 37492\\r\\n15609 45751\\r\\n17765 37775\\r\\n28661 42679\\r\\n31042 6310\\r\\n43276 4172\\r\\n44383 49245\\r\\n50756 46157\\r\\n51070 18973\\r\\n58608 50684\\r\\n67681 6708\\r\\n68630 44511\\r\\n73164 40061\\r\\n79037 34847\\r\\n79771 32246\\r\\n86105 56662\\r\\n86240 22149\\r\\n'], 'output': ['15608\\r\\n']}, {'input': ['20 8\\r\\n4657 499\\r\\n5573 5458\\r\\n13884 4280\\r\\n27558 3883\\r\\n31660 425\\r\\n34175 131\\r\\n36661 1191\\r\\n40660 3028\\r\\n41173 5958\\r\\n58962 3086\\r\\n61792 1523\\r\\n68662 509\\r\\n71650 2939\\r\\n72304 5650\\r\\n72995 4373\\r\\n74250 2598\\r\\n77281 5865\\r\\n77354 3291\\r\\n81770 6168\\r\\n82987 4567\\r\\n'], 'output': ['53806\\r\\n']}, {'input': ['20 1\\r\\n321 15602\\r\\n11667 17859\\r\\n13595 39815\\r\\n17717 21956\\r\\n21312 41656\\r\\n21872 24276\\r\\n25550 45451\\r\\n27531 20784\\r\\n28325 41183\\r\\n35347 39776\\r\\n38985 44688\\r\\n45453 36051\\r\\n45715 39337\\r\\n46002 21013\\r\\n49663 19637\\r\\n51512 45633\\r\\n65925 27746\\r\\n67816 37823\\r\\n74625 28084\\r\\n75032 37814\\r\\n'], 'output': ['11666\\r\\n']}, {'input': ['20 2\\r\\n5397 1587\\r\\n11009 2480\\r\\n11104 3375\\r\\n18701 3816\\r\\n32563 4016\\r\\n33017 5525\\r\\n39313 6380\\r\\n49322 2125\\r\\n49632 2369\\r\\n51344 2066\\r\\n65694 2571\\r\\n66697 5065\\r\\n71087 1246\\r\\n73426 119\\r\\n78129 6196\\r\\n79557 6296\\r\\n82344 5065\\r\\n83284 1284\\r\\n84013 2164\\r\\n84441 2855\\r\\n'], 'output': ['19074\\r\\n']}, {'input': ['20 4\\r\\n2211 5166\\r\\n2806 5247\\r\\n3865 1723\\r\\n6837 3910\\r\\n6934 3859\\r\\n12604 5638\\r\\n14030 5570\\r\\n15044 4163\\r\\n18553 5237\\r\\n26912 4945\\r\\n36680 4774\\r\\n42299 5079\\r\\n53353 4777\\r\\n55823 2826\\r\\n56569 3485\\r\\n59225 2314\\r\\n71061 3345\\r\\n73997 4997\\r\\n77982 4771\\r\\n83217 4877\\r\\n'], 'output': ['17070\\r\\n']}, {'input': ['20 8\\r\\n3132 1359\\r\\n14422 3509\\r\\n15286 3564\\r\\n24853 2344\\r\\n25623 4000\\r\\n26710 379\\r\\n29013 309\\r\\n32143 2433\\r\\n33866 3829\\r\\n34796 1645\\r\\n36838 1\\r\\n41289 4073\\r\\n56086 3490\\r\\n64999 1501\\r\\n75421 355\\r\\n76962 1133\\r\\n77385 4077\\r\\n77576 2407\\r\\n80327 3592\\r\\n84511 3625\\r\\n'], 'output': ['46099\\r\\n']}, {'input': ['10 4\\r\\n1243 17639\\r\\n5233 18442\\r\\n5484 26270\\r\\n9941 8362\\r\\n21090 14371\\r\\n33606 6069\\r\\n38227 854\\r\\n56117 14329\\r\\n64498 24498\\r\\n82453 24552\\r\\n'], 'output': ['33915\\r\\n']}, {'input': ['18 8\\r\\n5336 2343\\r\\n14321 9358\\r\\n14625 6663\\r\\n17258 1573\\r\\n17738 48186\\r\\n20230 48142\\r\\n21467 16168\\r\\n21741 52736\\r\\n21747 34808\\r\\n25300 51376\\r\\n43798 21436\\r\\n44019 4408\\r\\n46827 18787\\r\\n63161 47590\\r\\n73220 25879\\r\\n74089 22169\\r\\n81816 48811\\r\\n81966 32786\\r\\n'], 'output': ['24967\\r\\n']}, {'input': ['15 8\\r\\n3851 20321\\r\\n8441 10283\\r\\n10559 29313\\r\\n16437 36295\\r\\n19412 3858\\r\\n23836 13428\\r\\n26389 7778\\r\\n27509 3588\\r\\n33024 30669\\r\\n41185 18296\\r\\n59076 9203\\r\\n64090 31386\\r\\n68308 30150\\r\\n71372 34652\\r\\n80726 2961\\r\\n'], 'output': ['35806\\r\\n']}, {'input': ['11 4\\r\\n17854 20196\\r\\n26817 691\\r\\n26913 19025\\r\\n29384 2838\\r\\n29967 11353\\r\\n40616 22394\\r\\n63401 12679\\r\\n66454 3978\\r\\n76381 4253\\r\\n79547 15056\\r\\n82908 13658\\r\\n'], 'output': ['31179\\r\\n']}, {'input': ['13 6\\r\\n636 14567\\r\\n2347 7588\\r\\n9619 4893\\r\\n9776 21048\\r\\n10548 7884\\r\\n12254 31417\\r\\n26586 5119\\r\\n35434 15444\\r\\n35549 31732\\r\\n50685 29710\\r\\n51003 30573\\r\\n76087 9393\\r\\n77495 22867\\r\\n'], 'output': ['35400\\r\\n']}, {'input': ['18 12\\r\\n63 6564\\r\\n9488 4800\\r\\n9652 7871\\r\\n11007 5718\\r\\n11560 2960\\r\\n13804 2625\\r\\n32823 7574\\r\\n44250 4454\\r\\n45583 1479\\r\\n51719 3065\\r\\n53776 9090\\r\\n54259 168\\r\\n57852 1096\\r\\n64681 299\\r\\n68160 8332\\r\\n77195 9147\\r\\n77445 3015\\r\\n80970 2471\\r\\n'], 'output': ['60282\\r\\n']}, {'input': ['14 7\\r\\n2760 65016\\r\\n6943 3779\\r\\n7578 65709\\r\\n10317 7040\\r\\n19540 9542\\r\\n29372 25695\\r\\n29950 41333\\r\\n36873 6266\\r\\n61210 12705\\r\\n64444 20540\\r\\n68899 7209\\r\\n71703 30643\\r\\n72543 2033\\r\\n84747 6270\\r\\n'], 'output': ['50488\\r\\n']}, {'input': ['16 6\\r\\n13302 9577\\r\\n15238 14644\\r\\n20601 7223\\r\\n22435 4578\\r\\n25345 15120\\r\\n25473 1482\\r\\n30947 5097\\r\\n34835 389\\r\\n38576 3725\\r\\n39913 1979\\r\\n55795 15345\\r\\n57670 7637\\r\\n64670 12974\\r\\n76749 7947\\r\\n80563 7806\\r\\n85873 8634\\r\\n'], 'output': ['33211\\r\\n']}, {'input': ['37 12\\r\\n1162 220\\r\\n5354 6219\\r\\n8976 10528\\r\\n10209 417\\r\\n10475 5905\\r\\n12008 7980\\r\\n14620 3213\\r\\n17347 2149\\r\\n18901 9955\\r\\n19291 9743\\r\\n19307 6647\\r\\n19833 3601\\r\\n20622 3814\\r\\n24250 4583\\r\\n33487 5249\\r\\n35381 4478\\r\\n36172 3607\\r\\n36906 4050\\r\\n36991 134\\r\\n39735 1198\\r\\n40269 1045\\r\\n40940 8116\\r\\n44945 4907\\r\\n46512 1552\\r\\n47872 8308\\r\\n50939 10658\\r\\n52065 7973\\r\\n54432 6399\\r\\n55725 5807\\r\\n57760 5288\\r\\n57991 9415\\r\\n58254 7556\\r\\n62661 9313\\r\\n69646 403\\r\\n69824 8127\\r\\n79369 3236\\r\\n81641 9257\\r\\n'], 'output': ['23391\\r\\n']}, {'input': ['20 9\\r\\n2472 25765\\r\\n6504 5321\\r\\n14509 22200\\r\\n16491 13334\\r\\n20019 9348\\r\\n20322 23625\\r\\n24480 19515\\r\\n28375 7678\\r\\n30352 12518\\r\\n31101 28232\\r\\n42961 10925\\r\\n45161 25881\\r\\n56222 16749\\r\\n65287 27749\\r\\n70698 1230\\r\\n71382 8729\\r\\n77211 26107\\r\\n79007 9852\\r\\n81966 9260\\r\\n82952 18542\\r\\n'], 'output': ['31136\\r\\n']}, {'input': ['17 10\\r\\n3633 17739\\r\\n8491 5211\\r\\n17083 9184\\r\\n21031 17848\\r\\n22052 1087\\r\\n26293 12921\\r\\n33744 18786\\r\\n33782 1683\\r\\n36759 17455\\r\\n37287 14947\\r\\n42762 8365\\r\\n54434 1847\\r\\n71160 9446\\r\\n74367 17790\\r\\n79590 5487\\r\\n79802 2396\\r\\n82541 14147\\r\\n'], 'output': ['48021\\r\\n']}, {'input': ['12 4\\r\\n1559 5057\\r\\n5126 2742\\r\\n12172 3181\\r\\n13749 7674\\r\\n23756 7410\\r\\n26980 9932\\r\\n31293 9526\\r\\n37129 4191\\r\\n38248 2497\\r\\n66671 7166\\r\\n76261 1031\\r\\n81162 6921\\r\\n'], 'output': ['38894\\r\\n']}, {'input': ['11 5\\r\\n3581 28281\\r\\n14866 4325\\r\\n16459 4203\\r\\n28879 1762\\r\\n31583 20686\\r\\n34272 14808\\r\\n34923 36011\\r\\n59410 7396\\r\\n67771 4720\\r\\n71973 24897\\r\\n72234 14447\\r\\n'], 'output': ['37130\\r\\n']}, {'input': ['15 5\\r\\n4758 9338\\r\\n11736 3975\\r\\n17882 3463\\r\\n20021 2903\\r\\n20948 8218\\r\\n32127 6459\\r\\n35327 10649\\r\\n41549 909\\r\\n43199 8331\\r\\n55019 3189\\r\\n58811 5256\\r\\n71582 9175\\r\\n79602 9346\\r\\n80435 6789\\r\\n80919 9903\\r\\n'], 'output': ['37144\\r\\n']}, {'input': ['10 4\\r\\n1131 4298\\r\\n10247 10853\\r\\n22523 11481\\r\\n23315 3855\\r\\n27261 9757\\r\\n38960 6116\\r\\n44084 6967\\r\\n57643 9089\\r\\n65497 11174\\r\\n74520 7670\\r\\n'], 'output': ['34358\\r\\n']}, {'input': ['15 5\\r\\n4550 9104\\r\\n6784 7411\\r\\n11890 4788\\r\\n13460 9958\\r\\n16591 3330\\r\\n34007 2022\\r\\n45739 12775\\r\\n52171 6007\\r\\n59083 11039\\r\\n67075 3584\\r\\n67862 8515\\r\\n68289 12308\\r\\n68338 11539\\r\\n69031 2367\\r\\n79467 12498\\r\\n'], 'output': ['37892\\r\\n']}, {'input': ['10 4\\r\\n8120 14493\\r\\n11596 26562\\r\\n18304 3218\\r\\n18627 32235\\r\\n22322 43159\\r\\n53957 45181\\r\\n61558 6152\\r\\n64656 32668\\r\\n74792 2683\\r\\n84198 6249\\r\\n'], 'output': ['35727\\r\\n']}, {'input': ['5 3\\r\\n1664 63252\\r\\n8890 5950\\r\\n12998 65717\\r\\n38237 17361\\r\\n60028 37575\\r\\n'], 'output': ['45188\\r\\n']}, {'input': ['15 7\\r\\n4328 28379\\r\\n8879 44692\\r\\n11115 6900\\r\\n11317 12656\\r\\n14576 3748\\r\\n15276 30764\\r\\n33463 39366\\r\\n36165 26316\\r\\n48310 44416\\r\\n63509 44989\\r\\n65364 23716\\r\\n65987 4642\\r\\n80632 22207\\r\\n83594 18645\\r\\n86020 37260\\r\\n'], 'output': ['41746\\r\\n']}, {'input': ['19 9\\r\\n2157 8234\\r\\n6808 3562\\r\\n8445 1062\\r\\n13146 7931\\r\\n18551 1710\\r\\n31169 1270\\r\\n33664 5936\\r\\n38140 7564\\r\\n41193 9263\\r\\n41311 1014\\r\\n42157 4708\\r\\n52300 7634\\r\\n58072 6375\\r\\n65946 881\\r\\n67350 1289\\r\\n67418 1425\\r\\n67647 1589\\r\\n83754 3543\\r\\n84016 7447\\r\\n'], 'output': ['45685\\r\\n']}, {'input': ['16 9\\r\\n1986 5978\\r\\n9365 17961\\r\\n19021 1761\\r\\n19650 9462\\r\\n20795 26151\\r\\n23526 3479\\r\\n24973 13657\\r\\n35962 23030\\r\\n36565 1040\\r\\n38643 19976\\r\\n40790 25086\\r\\n49716 5411\\r\\n53176 4997\\r\\n69117 1660\\r\\n80199 13680\\r\\n83908 4508\\r\\n'], 'output': ['42594\\r\\n']}, {'input': ['20 13\\r\\n95 7441\\r\\n2882 16242\\r\\n5832 16958\\r\\n7865 4615\\r\\n9138 2742\\r\\n16000 6405\\r\\n17119 8849\\r\\n18257 13728\\r\\n24220 4018\\r\\n25645 818\\r\\n31731 8984\\r\\n34677 12249\\r\\n36761 17030\\r\\n41650 2769\\r\\n49586 4735\\r\\n52838 4863\\r\\n56019 26\\r\\n72998 12828\\r\\n75872 3997\\r\\n83799 5768\\r\\n'], 'output': ['54743\\r\\n']}, {'input': ['15 9\\r\\n895 11527\\r\\n964 47378\\r\\n1454 5014\\r\\n3551 51418\\r\\n5634 18659\\r\\n10675 34138\\r\\n11559 9786\\r\\n15164 10573\\r\\n20377 30569\\r\\n30549 6078\\r\\n52745 19983\\r\\n58856 5708\\r\\n62429 34186\\r\\n77318 3150\\r\\n86011 38066\\r\\n'], 'output': ['46277\\r\\n']}, {'input': ['14 5\\r\\n12617 6663\\r\\n12693 2668\\r\\n15867 5800\\r\\n21348 4059\\r\\n25817 7453\\r\\n30987 3443\\r\\n31397 844\\r\\n36437 6866\\r\\n44746 47\\r\\n46034 2584\\r\\n56362 510\\r\\n57653 2581\\r\\n76914 6377\\r\\n79380 695\\r\\n'], 'output': ['37783\\r\\n']}, {'input': ['1 1\\r\\n1 86400\\r\\n'], 'output': ['86400\\r\\n']}, {'input': ['2 2\\r\\n1 86400\\r\\n2 86400\\r\\n'], 'output': ['86400\\r\\n']}, {'input': ['2 1\\r\\n1 86400\\r\\n2 86400\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 0\\r\\n1 86400\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 0\\r\\n1 86400\\r\\n2 86400\\r\\n3 86400\\r\\n4 86400\\r\\n5 86400\\r\\n6 86400\\r\\n7 86400\\r\\n8 86400\\r\\n9 86400\\r\\n10 86400\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 4\\r\\n1 86400\\r\\n2 86400\\r\\n3 86400\\r\\n4 86400\\r\\n5 86400\\r\\n6 86400\\r\\n7 86400\\r\\n8 86400\\r\\n9 86400\\r\\n10 86400\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['10 10\\r\\n1 86400\\r\\n2 86400\\r\\n3 86400\\r\\n4 86400\\r\\n5 86400\\r\\n6 86400\\r\\n7 86400\\r\\n8 86400\\r\\n9 86400\\r\\n10 86400\\r\\n'], 'output': ['86400\\r\\n']}, {'input': ['1 0\\r\\n1 86400\\r\\n'], 'output': ['0\\r\\n']}]","id":721} {"difficulty":2000,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"164_B","execute_outcome":"WRONG_ANSWER","source_code":"{$R+,Q+,I+}\r\n{$apptype console}\r\nUses SysUtils,math;\r\nVar\r\n a,b,p:Array[0..3000000] of Integer;\r\n n,m,i,l,r,f1,f2,ans,t,r1:Integer;\r\nBegin\r\n Read(n,m);\r\n For i:=1 To n Do Read(a[i]);\r\n For i:=1 To m Do Read(b[i]);\r\n For i:=1 To m Do p[b[i]]:=i;\r\n l:=1;\r\n r:=1;\r\n f1:=0;\r\n f2:=0;\r\n t:=0;\r\n ans:=0;\r\n r1:=0;\r\n While True Do Begin\r\n If l>n Then Break;\r\n If r>n Then Begin\r\n If f1=1 Then Break;\r\n r:=1;\r\n f1:=1;\r\n Continue;\r\n End;\r\n If (l>r) and (f1=0) Then Begin\r\n r:=r+1;\r\n t:=0;\r\n f2:=0;\r\n Continue;\r\n End;\r\n If (l=r) and (f1=1) Then Begin\r\n l:=l+1;\r\n Continue;\r\n End;\r\n If f2=0 Then Begin\r\n If p[a[r]]=0 Then Begin\r\n l:=r+1;\r\n r:=r+1;\r\n If f1=1 Then Break;\r\n t:=0;\r\n End\r\n Else Begin\r\n If p[a[r]]p[a[l]] Then Begin\r\n l:=l+1;\r\n \/\/While (l<=n) and (p[a[r]]>p[a[l]]) Do l:=l+1;\r\n If l=r Then t:=0;\r\n \/\/r1:=l;\r\n \/\/f2:=1;\r\n End\r\n Else Begin\r\n f2:=1;\r\n r1:=r-1;\r\n If f1=0 Then ans:=max(ans,r-l+1)\r\n Else ans:=max(ans,r+n-l+1);\r\n t:=p[a[r]];\r\n r:=r+1;\r\n End;\r\n End\r\n Else Begin\r\n If f1=0 Then ans:=max(ans,r-l+1)\r\n Else ans:=max(ans,r+n-l+1);\r\n t:=p[a[r]];\r\n r:=r+1;\r\n End;\r\n End;\r\n End\r\n Else Begin\r\n If p[a[r]]=0 Then Begin\r\n l:=r+1;\r\n r:=r+1;\r\n If f1=1 Then Break;\r\n f2:=0;\r\n t:=0;\r\n End\r\n Else Begin\r\n If p[a[r]]p[a[l]] Then Begin\r\n l:=l+1;\r\n If l>r1 Then Begin\r\n f2:=0;\r\n r1:=0;\r\n End;\r\n If l=r Then t:=0;\r\n End\r\n Else Begin\r\n If f1=0 Then ans:=max(ans,r-l+1)\r\n Else ans:=max(ans,r+n-l+1);\r\n t:=p[a[r]];\r\n r:=r+1;\r\n End;\r\n End;\r\n End;\r\n End;\r\n End;\r\n Write(ans);\r\nEnd.\r\n","description":"Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hieroglyphs. We know that no hieroglyph occurs twice in either the first or the second circle (but in can occur once in each of them).Polycarpus wants to save these pictures on his laptop, but the problem is, laptops do not allow to write hieroglyphs circles. So Polycarp had to break each circle and write down all of its hieroglyphs in a clockwise order in one line. A line obtained from the first circle will be called a, and the line obtained from the second one will be called b.There are quite many ways to break hieroglyphic circles, so Polycarpus chooses the method, that makes the length of the largest substring of string a, which occurs as a subsequence in string b, maximum.Help Polycarpus \u2014 find the maximum possible length of the desired substring (subsequence) if the first and the second circles are broken optimally.The length of string s is the number of characters in it. If we denote the length of string s as |s|, we can write the string as s=s1s2... s|s|.A substring of s is a non-empty string x=s[a... b]=sasa+1... sb (1\u2264a\u2264b\u2264|s|). For example, \"code\" and \"force\" are substrings of \"codeforces\", while \"coders\" is not. A subsequence of s is a non-empty string y=s[p1p2... p|y|]=sp1sp2... sp|y| (1\u2264p1 0 then ans:=1;\r\n if ans = 0 then\r\n begin\r\n writeln(0);\r\n halt;\r\n end;\r\n for i:=1 to n do c[i+n]:=c[i];\r\n j:=0; s:=0;\r\n for i:=1 to n do\r\n begin\r\n while (j < n+n) and (s+c[j+1] < m) do\r\n begin\r\n inc(j);\r\n s:=s+c[j];\r\n end;\r\n if j-i+2 > ans then ans:=j-i+2;\r\n s:=s-c[i];\r\n end;\r\n if ans > n then ans:=n;\r\n if ans > m then ans:=m;\r\n writeln(ans);\r\nend.","testcases":"[{'input': ['5 4\\r\\n1 2 3 4 5\\r\\n1 3 5 6\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 6\\r\\n1 3 5 2\\r\\n1 2 3 4 5 6\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['3 3\\r\\n1 2 3\\r\\n3 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6 3\\r\\n1 2 3 4 5 6\\r\\n3 5 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 5\\r\\n5 6 3 2 1\\r\\n4 3 1 5 6\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 5\\r\\n9 2 5 1 3\\r\\n1 7 2 3 9\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 10\\r\\n9 12 15 2 4 14 1 5 6 13\\r\\n12 11 13 1 4 3 8 2 14 15\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n6 7 8 9 10 1 2 3 4 5\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['9 9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n7 8 9 1 2 4 5 6 3\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1 2\\r\\n1\\r\\n1 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}]","id":722} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"16_C","execute_outcome":"WRONG_ANSWER","source_code":"{$R+ Q+ I+}\r\n{$APPTYPE CONSOLE}\r\nuses\r\n SysUtils;\r\nvar\r\n a,b,x,y,l,r,m : int64;\r\nbegin\r\n read(a,b,x,y);\r\n l := 1;\r\n r := 2000000000;\r\n while l + 1 < r do begin\r\n m := (l + r) div 2;\r\n if (m*x > a) or (m*y > b) then r := m\r\n else l := m;\r\n end;\r\n if (r*x <= a) and (r*y <= b) then begin\r\n write(r*x,' ',r*y);\r\n halt;\r\n end;\r\n if (l*x <= a) and (l*y <= b) then begin\r\n write(l*x,' ',l*y);\r\n halt;\r\n end;\r\n write(0,' ',0);\r\nend.","description":"Reca company makes monitors, the most popular of their models is AB999 with the screen size a\u00d7b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x:y became popular with users. That's why the company wants to reduce monitor AB999 size so that its screen sides ratio becomes x:y, at the same time they want its total area to be maximal of all possible variants. Your task is to find the screen parameters of the reduced size model, or find out that such a reduction can't be performed.","input_specification":"The first line of the input contains 4 integers \u2014 a, b, x and y (1\u2264a,b,x,y\u22642\u00b710^9).\n","output_specification":"If the answer exists, output 2 positive integers \u2014 screen parameters of the reduced size model. Output 0 0 otherwise.\n","notes":null,"sample_inputs":["800 600 4 3\n","1920 1200 16 9\n","1 1 1 2\n"],"sample_outputs":["800 600\n","1920 1080\n","0 0\n"],"human_solution":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils, Math;\r\n\r\nfunction\tGetGCD(x, y: Int64): Int64;\r\nbegin\r\n\tif x mod y = 0 then\r\n\tbegin\r\n\t\tResult := y;\r\n\tend\r\n\telse\r\n\tbegin\r\n\t\tResult := GetGCD(y, x mod y);\r\n\tend;\r\nend;\r\n\r\nvar\r\n\ta, b, x, y, aa, bb, ra, rb: Int64;\r\n\r\nbegin\r\n\tReadln(a, b, x, y);\r\n\taa := GetGCD(x, y);\r\n\tx := x div aa;\r\n\ty := y div aa;\r\n\tra := x * Min(a div x, b div y);\r\n\trb := y * Min(a div x, b div y);\r\n\r\n\tWriteln(ra, ' ', rb);\r\n\r\nend.\r\n","testcases":"[{'input': ['800 600 4 3\\r\\n'], 'output': ['800 600\\r\\n']}, {'input': ['1920 1200 16 9\\r\\n'], 'output': ['1920 1080\\r\\n']}, {'input': ['1 1 1 2\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['1002105126 227379125 179460772 1295256518\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['625166755 843062051 1463070160 1958300154\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['248228385 1458744978 824699604 1589655888\\r\\n'], 'output': ['206174901 397413972\\r\\n']}, {'input': ['186329049 1221011622 90104472 1769702163\\r\\n'], 'output': ['60069648 1179801442\\r\\n']}, {'input': ['511020182 242192314 394753578 198572007\\r\\n'], 'output': ['394753578 198572007\\r\\n']}, {'input': ['134081812 857875240 82707261 667398699\\r\\n'], 'output': ['105411215 850606185\\r\\n']}, {'input': ['721746595 799202881 143676564 380427290\\r\\n'], 'output': ['287353128 760854580\\r\\n']}, {'input': ['912724694 1268739154 440710604 387545692\\r\\n'], 'output': ['881421208 775091384\\r\\n']}, {'input': ['1103702793 1095784840 788679477 432619528\\r\\n'], 'output': ['788679477 432619528\\r\\n']}, {'input': ['548893795 861438648 131329677 177735812\\r\\n'], 'output': ['525318708 710943248\\r\\n']}, {'input': ['652586118 1793536161 127888702 397268645\\r\\n'], 'output': ['511554808 1589074580\\r\\n']}, {'input': ['756278440 578150025 96644319 26752094\\r\\n'], 'output': ['676510233 187264658\\r\\n']}, {'input': ['859970763 1510247537 37524734 97452508\\r\\n'], 'output': ['562871010 1461787620\\r\\n']}, {'input': ['547278097 1977241684 51768282 183174370\\r\\n'], 'output': ['543566961 1923330885\\r\\n']}, {'input': ['62256611 453071697 240966 206678\\r\\n'], 'output': ['62169228 53322924\\r\\n']}, {'input': ['1979767797 878430446 5812753 3794880\\r\\n'], 'output': ['1342745943 876617280\\r\\n']}, {'input': ['1143276347 1875662241 178868040 116042960\\r\\n'], 'output': ['1140283755 739773870\\r\\n']}, {'input': ['435954880 1740366589 19415065 185502270\\r\\n'], 'output': ['182099920 1739883360\\r\\n']}, {'input': ['664035593 983601098 4966148 2852768\\r\\n'], 'output': ['664032908 381448928\\r\\n']}, {'input': ['1461963719 350925487 135888396 83344296\\r\\n'], 'output': ['572153868 350918568\\r\\n']}, {'input': ['754199095 348965411 161206703 67014029\\r\\n'], 'output': ['754119492 313489356\\r\\n']}, {'input': ['166102153 494841162 14166516 76948872\\r\\n'], 'output': ['91096406 494812252\\r\\n']}, {'input': ['1243276346 1975662240 38441120 291740200\\r\\n'], 'output': ['259477560 1969246350\\r\\n']}, {'input': ['535954879 1840366588 26278959 73433046\\r\\n'], 'output': ['535849118 1497358892\\r\\n']}, {'input': ['764035592 1083601097 1192390 7267738\\r\\n'], 'output': ['177777265 1083570463\\r\\n']}, {'input': ['1561963718 450925486 475523188 136236856\\r\\n'], 'output': ['1561914768 447486816\\r\\n']}, {'input': ['854199094 448965410 364102983 125971431\\r\\n'], 'output': ['853687785 295356745\\r\\n']}, {'input': ['266102152 594841161 15854566 13392106\\r\\n'], 'output': ['266043102 224722482\\r\\n']}, {'input': ['1 1 2 1\\r\\n'], 'output': ['0 0\\r\\n']}, {'input': ['2000000000 2000000000 1 1999999999\\r\\n'], 'output': ['1 1999999999\\r\\n']}, {'input': ['2000000000 2000000000 1999999999 1\\r\\n'], 'output': ['1999999999 1\\r\\n']}, {'input': ['2000000000 2000000000 2 1999999999\\r\\n'], 'output': ['2 1999999999\\r\\n']}, {'input': ['1000000000 1000000000 999999999 2\\r\\n'], 'output': ['999999999 2\\r\\n']}, {'input': ['2000000000 2000000000 1999999999 2\\r\\n'], 'output': ['1999999999 2\\r\\n']}, {'input': ['2000000000 2000000000 1999999999 1999999998\\r\\n'], 'output': ['1999999999 1999999998\\r\\n']}, {'input': ['2000000000 2000000000 1999999998 1999999999\\r\\n'], 'output': ['1999999998 1999999999\\r\\n']}]","id":723} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"173_B","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\ntype\r\n node = record\r\n res, y, x : integer;\r\n end;\r\n\r\nvar\r\n n, m, i, j, top, l, r, minn : integer;\r\n a : array[1..1100, 1..1100] of char;\r\n b : array[1..1100, 1..1100] of integer;\r\n q : array[1..1100000] of node;\r\n u : node;\r\n\r\nfunction pop : node;\r\nbegin\r\n inc(l);\r\n result := q[l - 1];\r\nend;\r\n\r\nprocedure push(res, y, x : integer);\r\nbegin\r\n inc(r);\r\n q[r].res := res;\r\n q[r].y := y;\r\n q[r].x := x;\r\n b[y][x] := res;\r\nend;\r\n\r\nbegin\r\n\/\/ reset(input, 'input.txt');\r\n\/\/ rewrite(output, 'output.txt');\r\n\r\n readln(n, m);\r\n for i := 1 to n do begin\r\n for j := 1 to m do begin\r\n read(a[i][j]);\r\n b[i][j] := maxint;\r\n end;\r\n readln;\r\n end;\r\n\r\n l := 1;\r\n for i := 1 to m do\r\n if a[n][i] = '#' then\r\n push(0, n, i);\r\n\r\n while l <= r do begin\r\n u := pop;\r\n for i := u.y - 1 downto 1 do begin\r\n if (a[i][u.x] = '#') and (b[i][u.x] > u.res) then\r\n push(u.res + 1, i, u.x);\r\n if (a[i][u.x] = '#') and (b[i][u.x] <= u.res) then\r\n break;\r\n end;\r\n for i := u.y + 1 to n do begin\r\n if (a[i][u.x] = '#') and (b[i][u.x] > u.res) then\r\n push(u.res + 1, i, u.x);\r\n if (a[i][u.x] = '#') and (b[i][u.x] <= u.res) then\r\n break;\r\n end;\r\n for i := u.x - 1 downto 1 do begin\r\n if (a[u.y][i] = '#') and (b[u.y][i] > u.res) then\r\n push(u.res + 1, u.y, i);\r\n if (a[u.y][i] = '#') and (b[u.y][i] <= u.res) then\r\n break;\r\n end;\r\n for i := u.x + 1 to m do begin\r\n if (a[u.y][i] = '#') and (b[u.y][i] > u.res) then\r\n push(u.res + 1, u.y, i);\r\n if (a[u.y][i] = '#') and (b[u.y][i] <= u.res) then\r\n break;\r\n end;\r\n end;\r\n\r\n minn := maxint;\r\n for i := 1 to m do\r\n if (b[1][i] < minn) and (a[i][j] = '#') then\r\n minn := b[1][i];\r\n\r\n if minn <> maxint then\r\n writeln(minn + 1)\r\n else\r\n writeln(-1); \r\n\r\n readln;readln;\r\nend.\r\n","description":"\"The Chamber of Secrets has been opened again\" \u2014 this news has spread all around Hogwarts and some of the students have been petrified due to seeing the basilisk. Dumbledore got fired and now Harry is trying to enter the Chamber of Secrets. These aren't good news for Lord Voldemort. The problem is, he doesn't want anybody to be able to enter the chamber. The Dark Lord is going to be busy sucking life out of Ginny.The Chamber of Secrets is an n\u00d7m rectangular grid in which some of the cells are columns. A light ray (and a basilisk's gaze) passes through the columns without changing its direction. But with some spell we can make a column magic to reflect the light ray (or the gaze) in all four directions when it receives the ray. This is shown in the figure below. The left light ray passes through a regular column, and the right ray \u2014 through the magic column. The basilisk is located at the right side of the lower right cell of the grid and is looking to the left (in the direction of the lower left cell). According to the legend, anyone who meets a basilisk's gaze directly dies immediately. But if someone meets a basilisk's gaze through a column, this person will get petrified. We know that the door to the Chamber is located on the left side of the upper left corner of the grid and anyone who wants to enter will look in the direction of its movement (in the direction of the upper right cell) from that position. This figure illustrates the first sample test. Given the dimensions of the chamber and the location of regular columns, Lord Voldemort has asked you to find the minimum number of columns that we need to make magic so that anyone who wants to enter the chamber would be petrified or just declare that it's impossible to secure the chamber.","input_specification":"The first line of the input contains two integer numbers n and m (2\u2264n,m\u22641000). Each of the next n lines contains m characters. Each character is either \".\" or \"#\" and represents one cell of the Chamber grid. It's \".\" if the corresponding cell is empty and \"#\" if it's a regular column.\n","output_specification":"Print the minimum number of columns to make magic or -1 if it's impossible to do.\n","notes":"The figure above shows the first sample test. In the first sample we should make both columns magic. The dragon figure represents the basilisk and the binoculars represent the person who will enter the Chamber of secrets. The black star shows the place where the person will be petrified. Yellow lines represent basilisk gaze moving through columns.\n","sample_inputs":["3 3\n.#.\n...\n.#.\n","4 3\n##.\n...\n.#.\n.#.\n"],"sample_outputs":["2\n","2\n"],"human_solution":"var i, j, n, m, l, r: Longint;\r\n xq, yq, dq: array [1..10000000] of Longint;\r\n a: array [1..2000, 1..2000] of Char;\r\n dist: array [1..2000, 1..2000, 1..4] of Longint;\r\n mark: array [1..2000, 1..2000, 1..4] of Boolean;\r\n\r\nfunction able(x, y, d: Longint): Boolean;\r\nBegin\r\n if (x >= 1) and (x <= n) and (y >= 1) and (y <= m) and (mark[x, y, d] = false) then\r\n able := true\r\n else\r\n able := false;\r\nEnd;\r\n\r\nfunction gox(x: Longint): Longint;\r\nBegin\r\n if x = 2 then\r\n gox := -1\r\n else\r\n if x = 4 then\r\n gox := 1\r\n else\r\n gox := 0;\r\nEnd;\r\n\r\nfunction goy(x: Longint): Longint;\r\nBegin\r\n if x = 1 then\r\n goy := -1\r\n else\r\n if x = 3 then\r\n goy := 1\r\n else\r\n goy := 0;\r\nEnd;\r\n\r\nBegin\r\n readln(n, m);\r\n for i := 1 to n do begin\r\n for j := 1 to m do\r\n read(a[i, j]);\r\n readln;\r\n end;\r\n inc(m);\r\n l := 1;\r\n r := 1;\r\n xq[1] := 1;\r\n yq[1] := 1;\r\n dq[1] := 3;\r\n dist[1, 1, 3] := 0;\r\n mark[xq[1], yq[1], dq[1]] := true;\r\n while l <= r do begin\r\n if a[xq[l], yq[l]] = '#' then\r\n for i := 1 to 4 do\r\n if (i <> dq[l]) and (able(xq[l] + gox(i), yq[l] + goy(i), i)) then begin\r\n inc(r);\r\n xq[r] := xq[l] + gox(i);\r\n yq[r] := yq[l] + goy(i);\r\n dq[r] := i;\r\n dist[xq[r], yq[r], dq[r]] := dist[xq[l], yq[l], dq[l]] + 1;\r\n mark[xq[r], yq[r], dq[r]] := true;\r\n end;\r\n\r\n if able(xq[l] + gox(dq[l]), yq[l] + goy(dq[l]), dq[l]) then begin\r\n dist[xq[l] + gox(dq[l]), yq[l] + goy(dq[l]), dq[l]] := dist[xq[l], yq[l], dq[l]];\r\n xq[l] := xq[l] + gox(dq[l]);\r\n yq[l] := yq[l] + goy(dq[l]);\r\n mark[xq[l], yq[l], dq[l]] := true;\r\n end else\r\n inc(l);\r\n end;\r\n if mark[n, m, 3] = false then\r\n write(-1)\r\n else\r\n write(dist[n, m, 3]);\r\nEnd.\r\n","testcases":"[{'input': ['3 3\\r\\n###\\r\\n###\\r\\n###\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n.##..\\r\\n.##..\\r\\n.#.#.\\r\\n..#..\\r\\n..#..\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n.#.#.\\r\\n#..#.\\r\\n.#.##\\r\\n.#.##\\r\\n##.#.\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n.####\\r\\n#.###\\r\\n#####\\r\\n#.###\\r\\n#####\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n.####\\r\\n#.#.#\\r\\n#####\\r\\n#####\\r\\n#####\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n#####\\r\\n#####\\r\\n#####\\r\\n#####\\r\\n#####\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 42\\r\\n.########.#.########.#..#############.##..\\r\\n#####.#############.#####.#.#.#####.####..\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2\\r\\n##\\r\\n.#\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 4\\r\\n.#..\\r\\n..##\\r\\n.#.#\\r\\n..#.\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['3 3\\r\\n..#\\r\\n#.#\\r\\n#..\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 2\\r\\n.#\\r\\n##\\r\\n..\\r\\n#.\\r\\n#.\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4 3\\r\\n.#.\\r\\n#.#\\r\\n##.\\r\\n..#\\r\\n'], 'output': ['6\\r\\n']}]","id":724} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"174_C","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n down, up, a : array[1..100000] of integer;\r\n i, j, n, topup, topdown : integer;\r\n\r\nprocedure pushup(u : integer);\r\nbegin\r\n inc(topup);\r\n up[topup] := u;\r\nend;\r\n\r\nprocedure pushdown(u : integer);\r\nbegin\r\n inc(topdown);\r\n down[topdown] := u;\r\nend;\r\n\r\nbegin\r\n\/\/ reset(input, 'input.txt');\r\n\/\/ rewrite(output, 'output.txt');\r\n\r\n readln(n);\r\n for i := 1 to n + 1 do begin\r\n read(a[i]);\r\n if a[i - 1] < a[i] then\r\n for j := 1 to a[i] - a[i - 1] do\r\n pushup(i);\r\n if a[i - 1] > a[i] then\r\n for j := 1 to a[i - 1] - a[i] do\r\n pushdown(i - 1);\r\n end;\r\n\r\n writeln(topup);\r\n\r\n for i := 1 to topup do\r\n writeln(up[i], ' ', down[i]);\r\n\r\nend.\r\n","description":"Polycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l,r]. In other words, this function does the following: function rangeIncrement(l, r) for i := l .. r do a[i] = a[i] + 1Polycarpus knows the state of the array a after a series of function calls. He wants to determine the minimum number of function calls that lead to such state. In addition, he wants to find what function calls are needed in this case. It is guaranteed that the required number of calls does not exceed 10^5.Before calls of function rangeIncrement(l, r) all array elements equal zero.","input_specification":"The first input line contains a single integer n (1\u2264n\u226410^5) \u2014 the length of the array a[1... n]. \nThe second line contains its integer space-separated elements, a[1],a[2],...,a[n] (0\u2264a[i]\u226410^5) after some series of function calls rangeIncrement(l, r). \nIt is guaranteed that at least one element of the array is positive. It is guaranteed that the answer contains no more than 10^5 calls of function rangeIncrement(l, r).\n","output_specification":"Print on the first line t \u2014 the minimum number of calls of function rangeIncrement(l, r), that lead to the array from the input data. It is guaranteed that this number will turn out not more than 10^5.\nThen print t lines \u2014 the descriptions of function calls, one per line. Each line should contain two integers li,ri (1\u2264li\u2264ri\u2264n) \u2014 the arguments of the i-th call rangeIncrement(l, r). Calls can be applied in any order.\nIf there are multiple solutions, you are allowed to print any of them.\n","notes":"The first sample requires a call for the entire array, and four additional calls:\n one for the segment [2,2] (i.e. the second element of the array), three for the segment [5,5] (i.e. the fifth element of the array). ","sample_inputs":["6\n1 2 1 1 4 1\n","5\n1 0 1 0 1\n"],"sample_outputs":["5\n2 2\n5 5\n5 5\n5 5\n1 6\n","3\n1 1\n3 3\n5 5\n"],"human_solution":"uses math;\r\ntype mass=array[0..100000] of integer;\r\n maxx=array[1..100000,1..2] of integer;\r\nvar d,kol,q,q1,i1,z1,q2,k,uk,p,n,kolv,res,r,l,j,b,c,e,e1,max1:int64;s:string;i,z:integer;\r\n m,m1:mass;ch:char;u:boolean;qq,w,o,g,a:int64;min1,a1,b1,c1:extended;\r\n m2:maxx;\r\nbegin\r\n \/\/ assign(input,'input.txt');\r\n \/\/ assign(output,'output.txt');\r\n readln(n);\r\n for i:=1 to n do\r\n read(m[i]);\r\n a:=0;\r\n b:=0;\r\n for i:=1 to n do\r\n Begin\r\n while (a>0) and (m[i]m[m1[a-1]]\r\n then m[m1[a]]:=m[i]\r\n else dec(a);\r\n end;\r\n if m[i]>m[m1[a]]\r\n then Begin\r\n inc(a);\r\n m1[a]:=i;\r\n end;\r\n end;\r\n for i:=a downto 1 do\r\n Begin\r\n for z:=m[m1[i-1]] to m[m1[i]]-1 do\r\n Begin\r\n inc(b);\r\n m2[b,1]:=m1[i];\r\n m2[b,2]:=n;\r\n end;\r\n end;\r\n writeln(b);\r\n for i:=1 to b do\r\n writeln(m2[i,1],' ',m2[i,2]);\r\nend.\r\n","testcases":"[{'input': ['6\\r\\n1 2 1 1 4 1\\r\\n'], 'output': ['5\\r\\n2 2\\r\\n5 5\\r\\n5 5\\r\\n5 5\\r\\n1 6\\r\\n']}, {'input': ['5\\r\\n1 0 1 0 1\\r\\n'], 'output': ['3\\r\\n1 1\\r\\n3 3\\r\\n5 5\\r\\n']}, {'input': ['1\\r\\n1\\r\\n'], 'output': ['1\\r\\n1 1\\r\\n']}, {'input': ['5\\r\\n1 2 3 4 5\\r\\n'], 'output': ['5\\r\\n5 5\\r\\n4 5\\r\\n3 5\\r\\n2 5\\r\\n1 5\\r\\n']}, {'input': ['12\\r\\n0 1 1 1 3 4 3 3 3 3 2 2\\r\\n'], 'output': ['4\\r\\n6 6\\r\\n5 10\\r\\n5 12\\r\\n2 12\\r\\n']}, {'input': ['2\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['2\\r\\n1 1\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n1 3\\r\\n'], 'output': ['3\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n']}, {'input': ['2\\r\\n2 4\\r\\n'], 'output': ['4\\r\\n2 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n'], 'output': ['1\\r\\n1 3\\r\\n']}, {'input': ['3\\r\\n0 2 1\\r\\n'], 'output': ['2\\r\\n2 2\\r\\n2 3\\r\\n']}, {'input': ['3\\r\\n2 2 1\\r\\n'], 'output': ['2\\r\\n1 2\\r\\n1 3\\r\\n']}, {'input': ['3\\r\\n2 4 2\\r\\n'], 'output': ['4\\r\\n2 2\\r\\n2 2\\r\\n1 3\\r\\n1 3\\r\\n']}, {'input': ['5\\r\\n1 1 0 0 0\\r\\n'], 'output': ['1\\r\\n1 2\\r\\n']}, {'input': ['5\\r\\n0 0 1 1 0\\r\\n'], 'output': ['1\\r\\n3 4\\r\\n']}, {'input': ['5\\r\\n1 0 2 1 0\\r\\n'], 'output': ['3\\r\\n1 1\\r\\n3 3\\r\\n3 4\\r\\n']}, {'input': ['5\\r\\n2 1 2 3 3\\r\\n'], 'output': ['4\\r\\n1 1\\r\\n4 5\\r\\n3 5\\r\\n1 5\\r\\n']}, {'input': ['20\\r\\n4 5 4 4 3 2 2 1 2 2 2 3 3 4 2 2 2 1 1 1\\r\\n'], 'output': ['8\\r\\n2 2\\r\\n1 4\\r\\n1 5\\r\\n1 7\\r\\n14 14\\r\\n12 14\\r\\n9 17\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n1 6 8 9 10 10 11 11 10 10 9 6 6 6 6 4 3 2 1 0\\r\\n'], 'output': ['11\\r\\n7 8\\r\\n5 10\\r\\n4 11\\r\\n3 11\\r\\n3 11\\r\\n2 15\\r\\n2 15\\r\\n2 16\\r\\n2 17\\r\\n2 18\\r\\n1 19\\r\\n']}, {'input': ['20\\r\\n4 6 7 8 8 8 9 9 10 12 12 11 12 12 11 9 8 8 5 2\\r\\n'], 'output': ['13\\r\\n10 11\\r\\n13 14\\r\\n10 15\\r\\n9 15\\r\\n7 16\\r\\n4 18\\r\\n3 18\\r\\n2 18\\r\\n2 19\\r\\n1 19\\r\\n1 19\\r\\n1 20\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n2 2 4 5 5 6 7 6 5 5 7 6 4 3 3 3 3 3 3 1\\r\\n'], 'output': ['9\\r\\n7 7\\r\\n6 8\\r\\n11 11\\r\\n11 12\\r\\n4 12\\r\\n3 13\\r\\n3 19\\r\\n1 19\\r\\n1 20\\r\\n']}, {'input': ['20\\r\\n5 9 11 12 13 13 13 13 13 13 13 13 13 13 12 11 11 8 6 4\\r\\n'], 'output': ['13\\r\\n5 14\\r\\n4 15\\r\\n3 17\\r\\n3 17\\r\\n2 17\\r\\n2 18\\r\\n2 18\\r\\n2 19\\r\\n1 19\\r\\n1 20\\r\\n1 20\\r\\n1 20\\r\\n1 20\\r\\n']}]","id":725} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"195_C","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\nVar k,i,n,j,j1,w:integer;\r\ns3,s2,s:string;\r\nbegin\r\n{ Assign(input,'input.txt');\r\n Assign(output,'output.txt'); }\r\n Readln(n);\r\n k:=0; j:=0;\r\n for i:=1 to n do\r\n begin\r\n Readln(s);\r\n if (Pos('try',s)<>0)\r\n then begin\r\n if k=0\r\n then inc(j)\r\n else inc(j1)\r\n end;\r\n if Pos('throw',s)<>0\r\n then begin\r\n k:=i;\r\n Delete(s,1,Pos('(',s));\r\n while s[1]=' ' do\r\n Delete(s,1,1);\r\n Delete(s,Pos(')',s),Length(s)-Pos(')',s)+1);\r\n while s[Length(s)]=' ' do\r\n Delete(s,Length(s),1);\r\n s2:=s;\r\n end;\r\n if Pos('catch',s)<>0\r\n then begin\r\n if (j1<>0)or(k=0)\r\n then begin\r\n if j1<>0\r\n then dec(j1)\r\n else Dec(j);\r\n end \r\n else begin\r\n Delete(s,1,Pos('(',s));\r\n while s[1]=' ' do\r\n Delete(s,1,1);\r\n w:=Pos(',',s)-1;\r\n while s[w]=' ' do\r\n Dec(w);\r\n s3:=Copy(s,1,w);\r\n if s3=s2\r\n then begin\r\n Delete(s,1,Pos('\"',s));\r\n Writeln(Copy(s,1,pos('\"',s)-1));\r\n Halt;\r\n end;\r\n end;\r\n end;\r\n end;\r\n Writeln('Unhandled Exception');\r\nend.\r\n","description":"Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.The exceptions are processed by try-catch-blocks. There are two operators that work with the blocks: The try operator. It opens a new try-catch-block. The catch(, ) operator. It closes the try-catch-block that was started last and haven't yet been closed. This block can be activated only via exception of type . When we activate this block, the screen displays the . If at the given moment there is no open try-catch-block, then we can't use the catch operator.The exceptions can occur in the program in only one case: when we use the throw operator. The throw() operator creates the exception of the given type.Let's suggest that as a result of using some throw operator the program created an exception of type a. In this case a try-catch-block is activated, such that this block's try operator was described in the program earlier than the used throw operator. Also, this block's catch operator was given an exception type a as a parameter and this block's catch operator is described later that the used throw operator. If there are several such try-catch-blocks, then the system activates the block whose catch operator occurs earlier than others. If no try-catch-block was activated, then the screen displays message \"Unhandled Exception\".To test the system, Vasya wrote a program that contains only try, catch and throw operators, one line contains no more than one operator, the whole program contains exactly one throw operator.Your task is: given a program in VPL, determine, what message will be displayed on the screen.","input_specification":"The first line contains a single integer: n (1\u2264n\u226410^5) the number of lines in the program. Next n lines contain the program in language VPL. Each line contains no more than one operator. It means that input file can contain empty lines and lines, consisting only of spaces.\nThe program contains only operators try, catch and throw. It is guaranteed that the program is correct. It means that each started try-catch-block was closed, the catch operators aren't used unless there is an open try-catch-block. The program has exactly one throw operator. The program may have spaces at the beginning of a line, at the end of a line, before and after a bracket, a comma or a quote mark.\nThe exception type is a nonempty string, that consists only of upper and lower case english letters. The length of the string does not exceed 20 symbols. Message is a nonempty string, that consists only of upper and lower case english letters, digits and spaces. Message is surrounded with quote marks. Quote marks shouldn't be printed. The length of the string does not exceed 20 symbols.\nLength of any line in the input file does not exceed 50 symbols. \n","output_specification":"Print the message the screen will show after the given program is executed.\n","notes":"In the first sample there are 2 try-catch-blocks such that try operator is described earlier than throw operator and catch operator is described later than throw operator: try-catch(BE,\"BE in line 3\") and try-catch(AE,\"AE somewhere\"). Exception type is AE, so the second block will be activated, because operator catch(AE,\"AE somewhere\") has exception type AE as parameter and operator catch(BE,\"BE in line 3\") has exception type BE.\nIn the second sample there are 2 try-catch-blocks such that try operator is described earlier than throw operator and catch operator is described later than throw operator: try-catch(AE,\"AE in line 3\") and try-catch(AE,\"AE somewhere\"). Exception type is AE, so both blocks can be activated, but only the first one will be activated, because operator catch(AE,\"AE in line 3\") is described earlier than catch(AE,\"AE somewhere\")\nIn the third sample there is no blocks that can be activated by an exception of type CE.\n","sample_inputs":["8\ntry\n try\n throw ( AE ) \n catch ( BE, \"BE in line 3\")\n\n try\n catch(AE, \"AE in line 5\") \ncatch(AE,\"AE somewhere\")\n","8\ntry\n try\n throw ( AE ) \n catch ( AE, \"AE in line 3\")\n\n try\n catch(BE, \"BE in line 5\") \ncatch(AE,\"AE somewhere\")\n","8\ntry\n try\n throw ( CE ) \n catch ( BE, \"BE in line 3\")\n\n try\n catch(AE, \"AE in line 5\") \ncatch(AE,\"AE somewhere\")\n"],"sample_outputs":["AE somewhere\n","AE in line 3\n","Unhandled Exception\n"],"human_solution":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils,\r\n Math;\r\n\r\nvar\r\n n, m, i, j, k, l, r, x, free, z, c: integer;\r\n a: array[0..100001]of integer;\r\n s, f, ans: string;\r\n d: char;\r\n ok, bf: boolean;\r\n\r\nprocedure red(sss: string; x: integer);\r\nvar\r\n w, mb: string;\r\nbegin\r\n w := '';\r\n while (sss[x] <> ' ') and (sss[x] <> '(') and (x <= length(sss)) do begin\r\n w := w + sss[x];\r\n inc(x);\r\n end;\r\n if w = 'try' then begin\r\n inc(free);\r\n a[free] := 1;\r\n end;\r\n if w = 'throw' then begin\r\n inc(free);\r\n a[free] := 2;\r\n ok := true;\r\n f := '';\r\n while (sss[x] <> ')') do begin\r\n f := f + sss[x];\r\n inc(x);\r\n end;\r\n while (f[1] = '(') or (f[1] = ' ') do begin\r\n delete(f, 1, 1);\r\n end;\r\n\r\n while f[length(f)] = ' ' do\r\n delete(f, length(f), 1);\r\n end;\r\n\r\n if w = 'catch' then begin\r\n inc(r);\r\n mb := '';\r\n\r\n while (sss[x] <> ',') do begin\r\n mb := mb + sss[x];\r\n inc(x);\r\n end;\r\n\r\n while (mb[1] = '(') or (mb[1] = ' ') do begin\r\n delete(mb, 1, 1);\r\n\r\n end;\r\n while mb[length(mb)] = ' ' do\r\n delete(mb, length(mb), 1);\r\n\r\n z := free;\r\n bf := false;\r\n c := 0;\r\n while (a[z] <> 2) do begin\r\n if a[z] = 1 then inc(c);\r\n dec(z);\r\n end;\r\n if c = 0 then bf := true;\r\n\r\n if (ok) and (mb = f) and (bf) then begin\r\n ans := '';\r\n while (sss[x] <> ')') do begin\r\n ans := ans + sss[x];\r\n inc(x);\r\n end;\r\n while (ans[1] = ',') or (ans[1] = '\"') or (ans[1] = ' ') do\r\n delete(ans, 1, 1);\r\n while (ans[length(ans)] = '\"') or (ans[length(ans)] = ' ') do\r\n delete(ans, length(ans), 1);\r\n\r\n write(ans);\r\n halt(0);\r\n end;\r\n\r\n if a[free] = 1 then\r\n dec(free);\r\n end;\r\nend;\r\n\r\nbegin\r\n {reset(input, 'input.txt');\r\n rewrite(output, 'output.txt'); }\r\n\r\n readln(n);\r\n\r\n l := 0;\r\n r := 0;\r\n free := 0;\r\n while not seekeof do begin\r\n readln(s);\r\n\r\n for j := 1 to length(s) do begin\r\n if s[j] <> ' ' then begin\r\n red(s, j);\r\n break;\r\n end;\r\n end;\r\n end;\r\n\r\n writeln('Unhandled Exception');\r\n\r\nend.\r\n","testcases":"[{'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( AE ) \\r\\n catch ( BE, \"BE in line 3\")\\r\\n\\r\\n try\\r\\n catch(AE, \"AE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['AE somewhere\\r\\n']}, {'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( AE ) \\r\\n catch ( AE, \"AE in line 3\")\\r\\n\\r\\n try\\r\\n catch(BE, \"BE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['AE in line 3\\r\\n']}, {'input': ['8\\r\\ntry\\r\\n try\\r\\n throw ( CE ) \\r\\n catch ( BE, \"BE in line 3\")\\r\\n\\r\\n try\\r\\n catch(AE, \"AE in line 5\") \\r\\ncatch(AE,\"AE somewhere\")\\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow(A)\\r\\ncatch(A, \"A cought\")\\r\\n'], 'output': ['A cought\\r\\n']}, {'input': ['5\\r\\n try \\r\\n try \\r\\n catch ( gnAEZNTt, \"i5 tAC8ktUdeX\") \\r\\n throw( gnAEZNTt ) \\r\\ncatch ( gnAEZNTt, \"g1cN\" ) \\r\\n'], 'output': ['g1cN\\r\\n']}, {'input': ['5\\r\\n try \\r\\n catch(UqWpIpGKiMqFnKox , \"bp9h8dfeNLhk9Wea\" ) \\r\\nthrow ( uaBRmgAAQyWTCzaaQMlZ ) \\r\\n try \\r\\ncatch( UqWpIpGKiMqFnKox,\"0OvVhsVWzDyqwo\" )\\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['5\\r\\n throw ( ouB ) \\r\\n try \\r\\ncatch(ouB, \"bTJZV\" )\\r\\n try \\r\\ncatch( ouB , \"DUniE dDhpiN\") \\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['5\\r\\ntry \\r\\n throw( egdCZzrKRLBcqDl )\\r\\n catch ( egdCZzrKRLBcqDl ,\"o\" )\\r\\n try \\r\\n catch (egdCZzrKRLBcqDl , \"oM62EJIirV D0\" ) \\r\\n'], 'output': ['o\\r\\n']}, {'input': ['10\\r\\n \\r\\n\\r\\n \\r\\n\\r\\nthrow (ProgramException)\\r\\n \\r\\n \\r\\n\\r\\n\\r\\n \\r\\n'], 'output': ['Unhandled Exception\\r\\n']}, {'input': ['21\\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n try \\r\\n throw( qtSMze) \\r\\ncatch(LY,\"x3 j\")\\r\\ncatch(hgSAFgbMGx,\"moByu\")\\r\\ncatch(LmydVQgv,\"hbZl\")\\r\\ncatch(oK,\"B6OZx qy\")\\r\\ncatch(rrtnRQB,\"7VFkQMv\")\\r\\ncatch(CASqQXaz,\"d9oci1Kx\")\\r\\ncatch(CTCzsdD,\"u\")\\r\\ncatch(xqqMxbEs,\"Mdu\")\\r\\ncatch(sOWgTPbRp,\"fVH6\")\\r\\ncatch(qtSMze,\"ZRnNzz\")\\r\\n'], 'output': ['ZRnNzz\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow ( X )\\r\\ncatch ( X, \"try again\")\\r\\n'], 'output': ['try again\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow ( try )\\r\\ncatch ( try, \"try again\")\\r\\n'], 'output': ['try again\\r\\n']}, {'input': ['3\\r\\ntry\\r\\nthrow(tryC)\\r\\ncatch(tryC, \"bad boy\")\\r\\n'], 'output': ['bad boy\\r\\n']}, {'input': ['7\\r\\ntry\\r\\ncatch(A,\"try A\")\\r\\ntry\\r\\n throw(A)\\r\\ncatch(A,\"try B\")\\r\\ntry\\r\\ncatch(A,\"try C\")\\r\\n'], 'output': ['try B\\r\\n']}, {'input': ['3\\r\\ntry\\r\\n throw(try)\\r\\ncatch(try,\"haha\")\\r\\n'], 'output': ['haha\\r\\n']}, {'input': ['3\\r\\ntry\\r\\n throw(try)\\r\\ncatch(try,\"asd\")\\r\\n'], 'output': ['asd\\r\\n']}, {'input': ['11\\r\\ntry\\r\\n try\\r\\n catch (B, \"b\")\\r\\n \\r\\n try\\r\\n throw ( U )\\r\\n catch (U, \"try\")\\r\\n \\r\\n try\\r\\n catch (C, \"c\")\\r\\ncatch (A, \"a\")\\r\\n'], 'output': ['try\\r\\n']}]","id":726} {"difficulty":1600,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"209_A","execute_outcome":"RUNTIME_ERROR","source_code":"program ProjectA;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$A+,B-,D-,E+,F+,G-,I-,L-,N+,R-,Q-,S-,V+,X+}\r\n\r\nuses\r\n SysUtils,\r\n Math;\r\n\r\nconst\r\n inf = 1000000000000000000;\r\n base = 1000000007;\r\n\r\nvar\r\n d: array [1..1000001, 1..2] of integer;\r\n n, i: integer;\r\n\r\nprocedure panic(x: integer);\r\nbegin\r\n write(x);\r\n halt(0);\r\nend;\r\n\r\nprocedure swap(var qx, qy: integer);\r\nvar\r\n qz: integer;\r\nbegin\r\n qz := qx;\r\n qx := qy;\r\n qy := qz;\r\nend;\r\n\r\nbegin\r\n {$IFNDEF ONLINE_JUDGE}\r\n Reset(input, 'input.txt');\r\n Rewrite(output, 'output.txt');\r\n {$ENDIF}\r\n\r\n read(n);\r\n if n = 1 then\r\n panic(1);\r\n d[1, 1] := 1;\r\n d[1, 2] := 0;\r\n for i := 2 to n do\r\n if odd(i) then\r\n begin\r\n d[i, 1] := (d[i - 1, 2] + d[i - 1, 1] + 1) mod base;\r\n d[i, 2] := d[i - 1, 2];\r\n end\r\n else\r\n begin\r\n d[i, 2] := (d[i - 1, 1] + d[i - 1, 2] + 1) mod base;\r\n d[i, 1] := d[i - 1, 1];\r\n end;\r\n\r\n write(d[n, 1] + d[n, 2]);\r\n\r\n\r\nend.\r\n","description":"Polycarpus plays with red and blue marbles. He put n marbles from the left to the right in a row. As it turned out, the marbles form a zebroid.A non-empty sequence of red and blue marbles is a zebroid, if the colors of the marbles in this sequence alternate. For example, sequences (red; blue; red) and (blue) are zebroids and sequence (red; red) is not a zebroid.Now Polycarpus wonders, how many ways there are to pick a zebroid subsequence from this sequence. Help him solve the problem, find the number of ways modulo 1000000007 (10^9+7).","input_specification":"The first line contains a single integer n (1\u2264n\u226410^6) \u2014 the number of marbles in Polycarpus's sequence.\n","output_specification":"Print a single number \u2014 the answer to the problem modulo 1000000007 (10^9+7).\n","notes":"Let's consider the first test sample. Let's assume that Polycarpus initially had sequence (red; blue; red), so there are six ways to pick a zebroid: \n pick the first marble; pick the second marble; pick the third marble; pick the first and second marbles; pick the second and third marbles; pick the first, second and third marbles. It can be proven that if Polycarpus picks (blue; red; blue) as the initial sequence, the number of ways won't change.\n","sample_inputs":["3\n","4\n"],"sample_outputs":["6\n","11\n"],"human_solution":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\nvar i,j,n : integer;\r\nwhite, black: int64;\r\nbegin\r\nreadln(n);\r\nblack := 0;\r\nwhite := 0;\r\nfor i := 1 to n do\r\n begin\r\n if i mod 2 = 1 then black := black + white + 1\r\n else\r\n white := white + black + 1;\r\n if black >= (1000*1000*1000+7) then black := black - (1000*1000*1000+7);\r\n if white >= (1000*1000*1000+7) then white := white - (1000*1000*1000+7);\r\n\r\n end;\r\nblack := black + white;\r\nif black >= (1000*1000*1000+7) then black := black - (1000*1000*1000+7);\r\nwriteln(black);\r\nreadln;\r\nend.\r\n","testcases":"[{'input': ['3\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['19\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['32\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['53\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['87\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['142\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['231\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['375\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['608\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['985\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['1595\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['2582\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['4179\\r\\n']}, {'input': ['17\\r\\n'], 'output': ['6763\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['10944\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['17709\\r\\n']}, {'input': ['20\\r\\n'], 'output': ['28655\\r\\n']}, {'input': ['21\\r\\n'], 'output': ['46366\\r\\n']}, {'input': ['22\\r\\n'], 'output': ['75023\\r\\n']}, {'input': ['30\\r\\n'], 'output': ['3524576\\r\\n']}, {'input': ['40\\r\\n'], 'output': ['433494435\\r\\n']}, {'input': ['35\\r\\n'], 'output': ['39088167\\r\\n']}, {'input': ['747\\r\\n'], 'output': ['864986803\\r\\n']}, {'input': ['811\\r\\n'], 'output': ['121575679\\r\\n']}, {'input': ['523\\r\\n'], 'output': ['810594171\\r\\n']}, {'input': ['939\\r\\n'], 'output': ['834252191\\r\\n']}, {'input': ['7218\\r\\n'], 'output': ['124017976\\r\\n']}, {'input': ['6578\\r\\n'], 'output': ['105202924\\r\\n']}, {'input': ['4994\\r\\n'], 'output': ['909729063\\r\\n']}, {'input': ['3410\\r\\n'], 'output': ['995527079\\r\\n']}, {'input': ['9122\\r\\n'], 'output': ['424682518\\r\\n']}, {'input': ['11500\\r\\n'], 'output': ['123418864\\r\\n']}, {'input': ['37212\\r\\n'], 'output': ['991850249\\r\\n']}, {'input': ['95628\\r\\n'], 'output': ['265542306\\r\\n']}, {'input': ['21341\\r\\n'], 'output': ['913329411\\r\\n']}, {'input': ['63405\\r\\n'], 'output': ['206564501\\r\\n']}, {'input': ['670293\\r\\n'], 'output': ['922731630\\r\\n']}, {'input': ['12357\\r\\n'], 'output': ['808648710\\r\\n']}, {'input': ['838069\\r\\n'], 'output': ['536545985\\r\\n']}, {'input': ['696485\\r\\n'], 'output': ['467961960\\r\\n']}, {'input': ['1000000\\r\\n'], 'output': ['986892583\\r\\n']}, {'input': ['999999\\r\\n'], 'output': ['452491920\\r\\n']}, {'input': ['999998\\r\\n'], 'output': ['534400661\\r\\n']}, {'input': ['999997\\r\\n'], 'output': ['918091264\\r\\n']}, {'input': ['999996\\r\\n'], 'output': ['616309402\\r\\n']}, {'input': ['999000\\r\\n'], 'output': ['47031574\\r\\n']}, {'input': ['100\\r\\n'], 'output': ['252403354\\r\\n']}]","id":727} {"difficulty":1700,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"219_D","execute_outcome":"WRONG_ANSWER","source_code":"Var m:array [1..2,1..400000] of LongInt;\r\nz:array [1..400000] of longint;\r\ndp:array [1..200000] of longint;\r\nused:array [1..200000] of Boolean;\r\nmin,kol,i,n:longint;\r\nprocedure sort(l,r:longint);\r\nVar i,j,k,x,b:longint;\r\nbegin\r\n i:=l; j:=r; k:=(l+r) div 2; x:=m[1,k];\r\n repeat\r\n while m[1,i]x do dec(j);\r\n if i<=j\r\n then begin\r\n b:=m[1,i]; m[1,i]:=m[1,j]; m[1,j]:=b;\r\n b:=m[2,i]; m[2,i]:=m[2,j]; m[2,j]:=b;\r\n b:=z[i]; z[i]:=z[j]; z[j]:=b;\r\n inc(i); Dec(j);\r\n end;\r\n until i>j;\r\n if il\r\n then sort(l,j);\r\nend;\r\nprocedure rec(v:longint);\r\nVar rr,i,l,r,k:longint;\r\nbegin\r\n used[v]:=True;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]>=v\r\n then r:=k\r\n else l:=k;\r\n end;\r\n rr:=r;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]<=v\r\n then l:=k\r\n else r:=k;\r\n end;\r\n if m[1,rr]=v\r\n then begin\r\n for i:=rr to l do\r\n if used[m[2,i]]=False\r\n then begin\r\n dp[1]:=dp[1]+z[i];\r\n rec(m[2,i]);\r\n end;\r\n end;\r\nend;\r\nprocedure probeg(v:longint);\r\nVar rr,i,l,r,k:longint;\r\nbegin\r\n used[v]:=true;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]>=v\r\n then r:=k\r\n else l:=k;\r\n end;\r\n rr:=r;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]<=v\r\n then l:=k\r\n else r:=k;\r\n end;\r\n if m[1,rr]=v\r\n then begin\r\n for i:=rr to l do\r\n if used[m[2,i]]=False\r\n then begin\r\n if z[i]=0\r\n then dp[m[2,i]]:=dp[v]+1\r\n else dp[m[2,i]]:=dp[v]-1;\r\n probeg(m[2,i]);\r\n end;\r\n\r\n end;\r\nend;\r\n\r\nbegin\r\n \/\/ Assign(input,'input.txt');\r\n \/\/ assign(output,'output.txt');\r\n Readln(n);\r\n kol:=0;\r\n for i:=1 to n-1 do\r\n begin\r\n Inc(kol);\r\n read(m[1,kol],m[2,kol]);\r\n inc(kol);\r\n m[1,kol]:=m[2,kol-1];\r\n m[2,kol]:=m[1,kol-1];\r\n z[kol]:=1;\r\n end; \r\n sort(1,kol-1);\r\n rec(1);\r\n FillChar(used,SizeOf(used),false);\r\n probeg(1);\r\n min:=maxint;\r\n for i:=1 to n do\r\n if dp[i]x do dec(j);\r\n if i<=j\r\n then begin\r\n b:=m[1,i]; m[1,i]:=m[1,j]; m[1,j]:=b;\r\n b:=m[2,i]; m[2,i]:=m[2,j]; m[2,j]:=b;\r\n b:=z[i]; z[i]:=z[j]; z[j]:=b;\r\n inc(i); Dec(j);\r\n end;\r\n until i>j;\r\n if il\r\n then sort(l,j);\r\nend;\r\nprocedure rec(v:longint);\r\nVar rr,i,l,r,k:longint;\r\nbegin\r\n used[v]:=True;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]>=v\r\n then r:=k\r\n else l:=k;\r\n end;\r\n rr:=r;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]<=v\r\n then l:=k\r\n else r:=k;\r\n end;\r\n if m[1,rr]=v\r\n then begin\r\n for i:=rr to l do\r\n if used[m[2,i]]=False\r\n then begin\r\n dp[1]:=dp[1]+z[i];\r\n rec(m[2,i]);\r\n end;\r\n end;\r\nend;\r\nprocedure probeg(v:longint);\r\nVar rr,i,l,r,k:longint;\r\nbegin\r\n used[v]:=true;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]>=v\r\n then r:=k\r\n else l:=k;\r\n end;\r\n rr:=r;\r\n l:=1; r:=kol+1;\r\n for i:=1 to 20 do\r\n begin\r\n k:=(l+r) div 2;\r\n if m[1,k]<=v\r\n then l:=k\r\n else r:=k;\r\n end;\r\n if m[1,rr]=v\r\n then begin\r\n for i:=rr to l do\r\n if used[m[2,i]]=False\r\n then begin\r\n if z[i]=0\r\n then dp[m[2,i]]:=dp[v]+1\r\n else dp[m[2,i]]:=dp[v]-1;\r\n probeg(m[2,i]);\r\n end;\r\n\r\n end;\r\nend;\r\n\r\nbegin\r\n \/\/ Assign(input,'input.txt');\r\n\/\/ assign(output,'output.txt');\r\n Readln(n);\r\n kol:=0;\r\n for i:=1 to n-1 do\r\n begin\r\n Inc(kol);\r\n read(m[1,kol],m[2,kol]);\r\n inc(kol);\r\n m[1,kol]:=m[2,kol-1];\r\n m[2,kol]:=m[1,kol-1];\r\n z[kol]:=1;\r\n end;\r\n sort(1,kol);\r\n rec(1);\r\n FillChar(used,SizeOf(used),false);\r\n probeg(1);\r\n min:=maxint;\r\n for i:=1 to n do\r\n if dp[i](n-1)*(n-2) div 2 + 1) then begin\r\n writeln(-1);\r\n Halt(0);\r\n end;\r\n for i:=1 to n do\r\n if i<>v then writeln(v,' ',i);\r\n m:=m-(n-1);\r\n k:=1;\r\n if v=1 then k:=2;\r\n for i:=k+1 to n do\r\n for j:=i+1 to n do\r\n if (i<>v) and (j<>v) then begin\r\n if m=0 then Halt(0);\r\n writeln(i,' ',j);\r\n dec(m);\r\n end;\r\nend.\r\n","description":"Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of servers should have at most one direct connection. Y corporation, a business rival of X corporation, made Bob an offer that he couldn't refuse: Bob was asked to connect the servers in such a way, that when server with index v fails, the transmission of data between some other two servers becomes impossible, i.e. the system stops being connected. Help Bob connect the servers.","input_specification":"The first input line contains 3 space-separated integer numbers n, m, v (3\u2264n\u226410^5,0\u2264m\u226410^5,1\u2264v\u2264n), n \u2014 amount of servers, m \u2014 amount of direct connections, v \u2014 index of the server that fails and leads to the failure of the whole system.\n","output_specification":"If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each \u2014 description of all the direct connections in the system. Each direct connection is described by two numbers \u2014 indexes of two servers, linked by this direct connection. The servers are numbered from 1. If the answer is not unique, output any.\n","notes":null,"sample_inputs":["5 6 3\n","6 100 1\n"],"sample_outputs":["1 2\n2 3\n3 4\n4 5\n1 3\n3 5\n","-1\n"],"human_solution":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar\r\n\tn, m, v, a, b: Int64;\r\n\ti, cnt: Integer;\r\n\r\nbegin\r\n\tReadln(n, m, v);\r\n\ta := (n-1)*(n-2) div 2 + 1;\r\n\tif (ma) then\r\n\tbegin\r\n\t\tWriteln(-1);\r\n\t\tExit;\r\n\tend;\r\n\tcnt := 0;\r\n\tfor i:=1 to n do\r\n\tbegin\r\n\t\tif i=v then continue;\r\n\t\tWriteln(i, ' ', v);\r\n\t\tInc(cnt);\r\n\tend;\r\n\tif n=v then Dec(n);\r\n\ta := 1; b := 1;\r\n\twhile cntv) and (b<>v) then\r\n\t\tbegin\r\n\t\t\tWriteln(a, ' ', b);\r\n\t\t\tInc(cnt);\r\n\t\tend;\r\n\tend;\r\nend.\r\n","testcases":"[{'input': ['5 6 3\\r\\n'], 'output': ['1 3\\r\\n2 3\\r\\n4 3\\r\\n5 3\\r\\n1 2\\r\\n1 4\\r\\n']}, {'input': ['6 100 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 26 1\\r\\n'], 'output': ['2 1\\r\\n3 1\\r\\n4 1\\r\\n5 1\\r\\n6 1\\r\\n7 1\\r\\n8 1\\r\\n9 1\\r\\n10 1\\r\\n2 3\\r\\n2 4\\r\\n2 5\\r\\n2 6\\r\\n2 7\\r\\n2 8\\r\\n2 9\\r\\n3 4\\r\\n3 5\\r\\n3 6\\r\\n3 7\\r\\n3 8\\r\\n3 9\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n4 8\\r\\n']}, {'input': ['100000 99998 100000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100000 99998 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100000 0 100000\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100000 0 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['123 13527 42\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['100 96943 65\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 39377 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['200 34305 75\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['300 44553 1\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['300 44553 300\\r\\n'], 'output': ['-1\\r\\n']}]","id":729} {"difficulty":2200,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"255_E","execute_outcome":"RUNTIME_ERROR","source_code":"{$R+,Q+,I+}\r\n{$apptype console}\r\nUses SysUtils,math;\r\nVar\r\n a:Array[0..100000] of Int64;\r\n g:Array[0..2500000] of Int64;\r\n i,j:Integer;\r\n x:Array[0..2500000,0..10] of Int64;\r\n n,l,r,p,ans:Int64;\r\n s:Real;\r\nBegin\r\n Read(n);\r\n For i:=1 To n Do Read(a[i]);\r\n For i:=1 To 2500000 Do Begin\r\n For j:=max(1,Round(sqrt(sqrt(i)))-3) To max(1,Round(sqrt(sqrt(i)))-3)+6 Do\r\n If j*j*j*j>=i Then Break;\r\n l:=j;\r\n For j:=Round(sqrt(i))+3 DownTo max(1,Round(sqrt(i))-3) Do\r\n If j*j<=i Then Break;\r\n r:=j;\r\n If l>r Then g[i]:=0\r\n Else Begin\r\n For j:=0 To 10 Do\r\n If x[r,j]-x[l-1,j]=0 Then Begin\r\n g[i]:=j;\r\n Break;\r\n End;\r\n End;\r\n For j:=0 To 10 Do\r\n If g[i]=j Then x[i,j]:=x[i-1,j]+1\r\n Else x[i,j]:=x[i-1,j];\r\n End;\r\n For i:=1 To n Do Begin\r\n s:=a[i];\r\n For j:=max(1,Round(sqrt(sqrt(s)))-3) To max(1,Round(sqrt(sqrt(s)))-3)+6 Do\r\n If j*j*j*j>=a[i] Then Break;\r\n l:=j;\r\n For j:=Round(sqrt(s))+3 DownTo max(1,Round(sqrt(s))-3) Do\r\n If j*j<=a[i] Then Break;\r\n r:=j;\r\n If l>r Then p:=0\r\n Else Begin\r\n For j:=0 To 10 Do \r\n If x[r,j]-x[l-1,j]=0 Then Begin\r\n p:=j;\r\n Break;\r\n End;\r\n End;\r\n If a[i]=1 Then p:=0;\r\n If i=1 Then ans:=p\r\n Else ans:=ans xor p;\r\n End;\r\n If ans<>0 Then Write('Furlo')\r\n Else Write('Rublo');\r\nEnd.\r\n \r\n \r\n","description":"Furlo and Rublo play a game. The table has n piles of coins lying on it, the i-th pile has ai coins. Furlo and Rublo move in turns, Furlo moves first. In one move you are allowed to: choose some pile, let's denote the current number of coins in it as x; choose some integer y (0\u2264y m) or (j > length(s)) then break;\r\n if p[s[j]] then inc(l);\r\n if l <= m then\r\n str:=str+ s[j];\r\n if l = m then\r\n add(str);\r\n inc(j);\r\n end;\r\n end;\r\n writeln(x);\r\nend.\r\n","description":"You've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.A substring s[l...r] (1\u2264l\u2264r\u2264|s|) of string s=s1s2...s|s| (where |s| is the length of string s) is string slsl+1...sr.The substring s[l...r] is good, if among the letters sl,sl+1,...,sr there are at most k bad ones (look at the sample's explanation to understand it more clear).Your task is to find the number of distinct good substrings of the given string s. Two substrings s[x...y] and s[p...q] are considered distinct if their content is different, i.e. s[x...y]\u2260s[p...q].","input_specification":"The first line of the input is the non-empty string s, consisting of small English letters, the string's length is at most 1500 characters.\nThe second line of the input is the string of characters \"0\" and \"1\", the length is exactly 26 characters. If the i-th character of this string equals \"1\", then the i-th English letter is good, otherwise it's bad. That is, the first character of this string corresponds to letter \"a\", the second one corresponds to letter \"b\" and so on.\nThe third line of the input consists a single integer k (0\u2264k\u2264|s|) \u2014 the maximum acceptable number of bad characters in a good substring.\n","output_specification":"Print a single integer \u2014 the number of distinct good substrings of string s.\n","notes":"In the first example there are following good substrings: \"a\", \"ab\", \"b\", \"ba\", \"bab\".\nIn the second example there are following good substrings: \"a\", \"aa\", \"ac\", \"b\", \"ba\", \"c\", \"ca\", \"cb\".\n","sample_inputs":["ababab\n01000000000000000000000000\n1\n","acbacbacaa\n00000000000000000000000000\n2\n"],"sample_outputs":["5\n","8\n"],"human_solution":"program vse_podstroki;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nconst\r\n p = 29;\r\n\r\nvar\r\n ans, kol, cur, n, hash: int64;\r\n i, l, r: integer;\r\n q, c: char;\r\n s, k: string;\r\n h, hs, pr: array[1..3250000] of int64;\r\n good: array['a'..'z'] of boolean;\r\n pow : array [1..1500] of int64;\r\n\r\nprocedure qsort(l, r: integer);\r\nvar\r\n i, j, q, w: int64;\r\nbegin\r\n i := l;\r\n j := r;\r\n q := h[l+random(r-l+1)];\r\n repeat\r\n while h[i] < q do\r\n inc(i);\r\n while h[j] > q do\r\n dec(j);\r\n if i <= j then\r\n begin\r\n w := h[i];\r\n h[i] := h[j];\r\n h[j] := w;\r\n inc(i);\r\n dec(j);\r\n end;\r\n until i > j;\r\n if l < j then\r\n qsort(l, j);\r\n if i < r then\r\n qsort(i, r);\r\nend;\r\n\r\n\r\nprocedure predproc;\r\nvar i : integer;\r\nbegin\r\n if not good[s[1]] then pr[1] := 1;\r\n hs[1] := ord(s[1]) - ord('a') + 1;\r\n for i := 2 to length(s) do\r\n begin\r\n hs[i] := hs[i-1] * p + (ord(s[i]) - ord('a') + 1);\r\n if not good[s[i]] then pr[i] := pr[i - 1] + 1 else\r\n pr[i] := pr[i - 1];\r\n end;\r\n\r\nend;\r\n\r\n\r\n\r\nbegin\r\n \/\/reset(input, 'input.txt');\r\n \/\/rewrite(output, 'output.txt');\r\n readln(s);\r\n randomize;\r\n\r\n pow[1] := p;\r\n\r\n for i := 2 to 1500 do\r\n pow[i] := pow[i - 1] * p;\r\n\r\n for q := 'a' to 'z' do\r\n begin\r\n read(c);\r\n if c = '1' then\r\n good[q] := true;\r\n end;\r\n predproc;\r\n read(n);\r\n kol := 1;\r\n for l := 1 to length(s) do\r\n for r := l to length(s) do\r\n begin\r\n\r\n \r\n cur := pr[r] - pr[l - 1];\r\n if cur <= n then\r\n begin\r\n hash := hs[r] - hs[l - 1]*pow[r-l + 1];\r\n h[kol] := hash;\r\n inc(kol);\r\n \/\/writeln(k,' ', hash);\r\n end else break;\r\n end;\r\n dec(kol);\r\n if kol = 1 then\r\n begin\r\n write(1);\r\n exit;\r\n end;\r\n\r\n if kol = 0 then\r\n begin\r\n write(0);\r\n exit;\r\n end;\r\n qsort(1, kol);\r\n\r\n\r\n ans := 1;\r\n\r\n for i := 2 to kol do\r\n if h[i] <> h[i - 1] then\r\n inc(ans);\r\n \/\/writeln(kol);\r\n write(ans );\r\nend.","testcases":"[{'input': ['ababab\\r\\n01000000000000000000000000\\r\\n1\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['acbacbacaa\\r\\n00000000000000000000000000\\r\\n2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['a\\r\\n00000000000000000000000000\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aaaa\\r\\n00000000000000000000000000\\r\\n0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['aaaaaa\\r\\n00000000000000000000000000\\r\\n1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['bbbbbbbbba\\r\\n01000000000000000000000000\\r\\n0\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['bbbbbbbbba\\r\\n10000000000000000000000000\\r\\n0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['kqdwdulmgvugvbl\\r\\n00101010100100100101101110\\r\\n13\\r\\n'], 'output': ['114\\r\\n']}, {'input': ['acehqnrtuwaealwbqufdmizce\\r\\n10000110100000010011101101\\r\\n16\\r\\n'], 'output': ['316\\r\\n']}, {'input': ['yqahbyyoxltryqdmvenemaqnbakglgqolxnaifnqtoclnnqiab\\r\\n11000001000110100111100001\\r\\n41\\r\\n'], 'output': ['1243\\r\\n']}, {'input': ['dykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovfj\\r\\n10001111101011111101101001\\r\\n25\\r\\n'], 'output': ['4420\\r\\n']}, {'input': ['baababbbaa\\r\\n01011100110010100100001111\\r\\n7\\r\\n'], 'output': ['41\\r\\n']}, {'input': ['dykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovfj\\r\\n11111111111111111111111111\\r\\n25\\r\\n'], 'output': ['4967\\r\\n']}, {'input': ['twnwdluhxf\\r\\n00000000000000000000000000\\r\\n1\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['aaaaaaaaaa\\r\\n01011100110010100100001111\\r\\n7\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['eoyirpkwgpvvwzaaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['312\\r\\n']}, {'input': ['fwnpwwuzszuryaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['269\\r\\n']}, {'input': ['xnahfslefuigqaaaaaaaaaaaaa\\r\\n11111111111111111111111111\\r\\n1\\r\\n'], 'output': ['271\\r\\n']}]","id":731} {"difficulty":1900,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"342_C","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\nvar\r\n h, r : integer;\r\nbegin\r\n read(r, h);\r\n if h >= r then begin\r\n if h mod r > r div 2 then\r\n write(trunc(h \/ r * 2 + 2))\r\n else\r\n write(trunc(h \/ r * 2 + 1));\r\n end\r\n else\r\n write(2);\r\nend.","description":"A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rectangle with base r and height h+r from the sides. The figure below shows what the cupboard looks like (the front view is on the left, the side view is on the right). Xenia got lots of balloons for her birthday. The girl hates the mess, so she wants to store the balloons in the cupboard. Luckily, each balloon is a sphere with radius . Help Xenia calculate the maximum number of balloons she can put in her cupboard. You can say that a balloon is in the cupboard if you can't see any part of the balloon on the left or right view. The balloons in the cupboard can touch each other. It is not allowed to squeeze the balloons or deform them in any way. You can assume that the cupboard's walls are negligibly thin.","input_specification":"The single line contains two integers r,h (1\u2264r,h\u226410^7).\n","output_specification":"Print a single integer \u2014 the maximum number of balloons Xenia can put in the cupboard.\n","notes":null,"sample_inputs":["1 1\n","1 2\n","2 1\n"],"sample_outputs":["3\n","5\n","2\n"],"human_solution":"var\r\n Rad,h,k:int64;\r\n\r\nbegin\r\n readln(Rad,h);\r\n k:=h div Rad;\r\n \r\n if (h-k*Rad>=Rad\/2) \r\n then k:=k+1;\r\n \r\n if (sqrt((Rad\/2)*(Rad\/2)+(h+Rad-k*Rad)*(h+Rad-k*Rad))>=Rad) \r\n then writeln(k*2+1) \r\n else writeln(k*2);\r\nend.","testcases":"[{'input': ['1 1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1 2\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2 3\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['4 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 2\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 6\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5 9\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 10\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5 11\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['674098 1358794\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['3983458 7761504\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4841874 9131511\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['667586 5534221\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['1526002 6904227\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['4835362 5823289\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5693778 7001807\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['6552194 8371814\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2377906 4774524\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['4365659 4738707\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['98 1358794\\r\\n'], 'output': ['27731\\r\\n']}, {'input': ['458 7761504\\r\\n'], 'output': ['33894\\r\\n']}, {'input': ['874 9131511\\r\\n'], 'output': ['20897\\r\\n']}, {'input': ['586 5534221\\r\\n'], 'output': ['18889\\r\\n']}, {'input': ['2 6904227\\r\\n'], 'output': ['6904228\\r\\n']}, {'input': ['1 10000000\\r\\n'], 'output': ['20000001\\r\\n']}, {'input': ['2 10000000\\r\\n'], 'output': ['10000001\\r\\n']}, {'input': ['3 10000000\\r\\n'], 'output': ['6666667\\r\\n']}, {'input': ['4 10000000\\r\\n'], 'output': ['5000001\\r\\n']}, {'input': ['3 9999999\\r\\n'], 'output': ['6666667\\r\\n']}, {'input': ['10000000 866254\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10000000 8660255\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['100 50\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100 49\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['100 199\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['8 7\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10000 9999\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1000000 1999999\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['2000000 1999999\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['18 16\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['100 87\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 19\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['10000 38661\\r\\n'], 'output': ['9\\r\\n']}]","id":732} {"difficulty":1600,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"46_C","execute_outcome":"WRONG_ANSWER","source_code":"Uses math;\r\nVar s:string;\r\nrez,j,a,i,n:longint;\r\nm:array [0..1000] of longint;\r\nbegin\r\n\/\/ Assign(Input,'input.txt');\r\n\/\/ Assign(output,'output.txt');\r\n readln(n);\r\n readln(s);\r\n a:=0;\r\n for i:=1 to n do\r\n if s[i]='T'\r\n then inc(a);\r\n for i:=1 to n do\r\n begin\r\n m[i]:=m[i-1];\r\n if s[i]='H'\r\n then inc(m[i]);\r\n end;\r\n rez:=MaxInt;\r\n for i:=1 to n do\r\n begin\r\n if i-a<1\r\n then j:=m[i]+m[n]-m[n-(i-a)]\r\n else j:=m[i]-m[i-a];\r\n rez:=min(rez,j);\r\n end;\r\n writeln(rez);\r\nend.","description":"Today there is going to be an unusual performance at the circus \u2014 hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together. The trainer swaps the animals in pairs not to create a mess. He orders two animals to step out of the circle and swap places. As hamsters feel highly uncomfortable when tigers are nearby as well as tigers get nervous when there's so much potential prey around (consisting not only of hamsters but also of yummier spectators), the trainer wants to spend as little time as possible moving the animals, i.e. he wants to achieve it with the minimal number of swaps. Your task is to help him.","input_specification":"The first line contains number n (2\u2264n\u22641000) which indicates the total number of animals in the arena. The second line contains the description of the animals' positions. The line consists of n symbols \"H\" and \"T\". The \"H\"s correspond to hamsters and the \"T\"s correspond to tigers. It is guaranteed that at least one hamster and one tiger are present on the arena. The animals are given in the order in which they are located circle-wise, in addition, the last animal stands near the first one.\n","output_specification":"Print the single number which is the minimal number of swaps that let the trainer to achieve his goal.\n","notes":"In the first example we shouldn't move anybody because the animals of each species already stand apart from the other species. In the second example you may swap, for example, the tiger in position 2 with the hamster in position 5 and then \u2014 the tiger in position 9 with the hamster in position 7.\n","sample_inputs":["3\nHTH\n","9\nHTHTHTHHT\n"],"sample_outputs":["0\n","2\n"],"human_solution":"var\r\n t,h:array[0..10000]of longint;\r\n s:string;\r\n n,i,j,h1,t1,res:longint;\r\nfunction min(a,b:longint):longint;\r\nbegin\r\n if a<=b then\r\n min:=a\r\n else\r\n min:=b;\r\nend;\r\nbegin\r\n readln(n);\r\n readln(s);\r\n h1:=0;\r\n t1:=0;\r\n for i:=1 to n do\r\n begin\r\n if s[i]='H' then inc(h1);\r\n if s[i]='T' then inc(t1);\r\n end;\r\n s:=s+s;\r\n t[0]:=0;\r\n h[0]:=0;\r\n n:=n+n;\r\n for i:=1 to n do\r\n if s[i]='H' then\r\n h[i]:=h[i-1]+1\r\n else\r\n h[i]:=h[i-1];\r\n for i:=1 to n do\r\n if s[i]='T' then\r\n t[i]:=t[i-1]+1\r\n else\r\n t[i]:=t[i-1];\r\n res:=10000000;\r\n for i:=1 to n-h1+1 do\r\n begin\r\n res:=min(res,h1-(h[i+h1-1]-h[i-1]));\r\n end;\r\n for i:=1 to n-t1+1 do\r\n begin\r\n res:=min(res,t1-(t[i+t1-1]-t[i-1]));\r\n end;\r\n write(res);\r\nend.","testcases":"[{'input': ['3\\r\\nHTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9\\r\\nHTHTHTHHT\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2\\r\\nTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\nHTTH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4\\r\\nHTHT\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7\\r\\nTTTHTTT\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\nHHTHHTHH\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['13\\r\\nHTTTHHHTTTTHH\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['20\\r\\nTTHTHTHHTHTTHHTTTHHH\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['35\\r\\nTTTTTTHTTHTTTTTHTTTTTTTTTTTHTHTTTTT\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['120\\r\\nTTTTTTTHTHTHTTTTTHTHTTTTHTTTTTTTTTTTTTTTTTTTTHTTHTTTTHTTHTTTTTTTTTTTTTTTHTTTTTTHTHTTHTTTTTTHTTTTTTTTTHTTHTTTTHTTTHTTTTTH\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['19\\r\\nHHHHHHHHHHHHHTTTHHH\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['87\\r\\nHTHHTTHHHHTHHHHHTTTHHTHHHHTTTTHHHTTHHTHTHTHHTTHTHHTHTHTTHHHTTTTTHTTHHHHHHTHHTHHTHTTHTHH\\r\\n'], 'output': ['17\\r\\n']}, {'input': ['178\\r\\nTHHHTHTTTHTTHTTHHHHHTTTHTTHHTHTTTHTHTTTTTHHHTHTHHHTHHHTTTTTTTTHHHHTTHHTHHHHTHTTTHHHHHHTHHTHTTHTHTTTTTTTTTHHTTHHTHTTHHTHHHHHTTHHTTHHTTHHHTTHHTTTTHTHHHTHTTHTHTTTHHHHTHHTHHHTHTTTTTT\\r\\n'], 'output': ['40\\r\\n']}]","id":733} {"difficulty":1800,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"46_D","execute_outcome":"WRONG_ANSWER","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$R+}\r\n{$Q+}\r\n{$O-}\r\n\r\nuses\r\n SysUtils;\r\n\r\ntype Tv=record\r\n l, r, w, c: longint;\r\nend;\r\n\r\nvar\r\n\r\n list: ARRAY [0..10000] OF tv;\r\n t, ans: array [0..10000] of longint;\r\n q, o, z, y, s, l, r, n, i, f, u: longint;\r\n\r\n\r\nprocedure inv(x, k, w: longint);\r\nvar p: longint;\r\nbegin\r\n p := list[k].r;\r\n list[k].r := u+1;\r\n list[p].l := u+1;\r\n inc(u);\r\n if p = 0 then q := u;\r\n list[u].w := x;\r\n list[u].l := k;\r\n list[u].r := p;\r\n if k > 0 then\r\n list[u].c := list[list[u].l].c + list[list[u].l].w + l else\r\n list[u].c := list[list[u].l].c + list[list[u].l].w;\r\n ans[w] := list[u].c;\r\n t[w] := u;\r\nend;\r\n\r\nprocedure dl(x: longint);\r\nbegin\r\n x := t[x];\r\n list[list[x].l].r := list[x].r;\r\n list[list[x].r].l := list[x].l;\r\nend;\r\n\r\nfunction serch(x: longint):longint;\r\nvar i: longint;\r\nbegin\r\n i := 0;\r\n if list[i].r = 0 then begin\r\n result := 0;\r\n exit;\r\n end;\r\n while list[i].r<>0 do begin\r\n if list[i].c + l + list[i].w + x + r <=list[list[i].r].c then begin\r\n result := i;\r\n exit;\r\n end;\r\n inc(i);\r\n end;\r\n\r\n result := q;\r\nend;\r\n\r\n\r\n\r\nbegin\r\n {reset(input, 'input.txt');\r\n rewrite(output, 'output.txt');}\r\n read(s, l, r, n);\r\n u := 0;\r\n q := 0;\r\n for i := 1 to n do begin\r\n read(y, f);\r\n if y = 2 then begin\r\n dl(f);\r\n end else begin\r\n inc(o);\r\n z := serch(f);\r\n if z = -1 then ans[o] := -1 else\r\n if list[z].c + f + l > s then begin\r\n ans[o] := -1;\r\n end else\r\n inv(f, z, o);\r\n end;\r\n end;\r\n for i := 1 to o do\r\n writeln(ans[i]);\r\n\r\nend.\r\n","description":"Nowadays it is becoming increasingly difficult to park a car in cities successfully. Let's imagine a segment of a street as long as L meters along which a parking lot is located. Drivers should park their cars strictly parallel to the pavement on the right side of the street (remember that in the country the authors of the tasks come from the driving is right side!). Every driver when parking wants to leave for themselves some extra space to move their car freely, that's why a driver is looking for a place where the distance between his car and the one behind his will be no less than b meters and the distance between his car and the one in front of his will be no less than f meters (if there's no car behind then the car can be parked at the parking lot segment edge; the same is true for the case when there're no cars parked in front of the car). Let's introduce an axis of coordinates along the pavement. Let the parking lot begin at point 0 and end at point L. The drivers drive in the direction of the coordinates' increasing and look for the earliest place (with the smallest possible coordinate) where they can park the car. In case there's no such place, the driver drives on searching for his perfect peaceful haven. Sometimes some cars leave the street and free some space for parking. Considering that there never are two moving cars on a street at a time write a program that can use the data on the drivers, entering the street hoping to park there and the drivers leaving it, to model the process and determine a parking lot space for each car.","input_specification":"The first line contains three integers L, b \u0438 f (10\u2264L\u2264100000,1\u2264b,f\u2264100). The second line contains an integer n (1\u2264n\u2264100) that indicates the number of requests the program has got. Every request is described on a single line and is given by two numbers. The first number represents the request type. If the request type is equal to 1, then in that case the second number indicates the length of a car (in meters) that enters the street looking for a place to park. And if the request type is equal to 2, then the second number identifies the number of such a request (starting with 1) that the car whose arrival to the parking lot was described by a request with this number, leaves the parking lot. It is guaranteed that that car was parked at the moment the request of the 2 type was made. The lengths of cars are integers from 1 to 1000.\n","output_specification":"For every request of the 1 type print number -1 on the single line if the corresponding car couldn't find place to park along the street. Otherwise, print a single number equal to the distance between the back of the car in its parked position and the beginning of the parking lot zone.\n","notes":null,"sample_inputs":["30 1 2\n6\n1 5\n1 4\n1 5\n2 2\n1 5\n1 4\n","30 1 1\n6\n1 5\n1 4\n1 5\n2 2\n1 5\n1 4\n","10 1 1\n1\n1 12\n"],"sample_outputs":["0\n6\n11\n17\n23\n","0\n6\n11\n17\n6\n","-1\n"],"human_solution":"program Problem_D;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nvar g : array[-2000..1000000]of longint;\r\n h, parked : array[0..1000]of longint;\r\n n, b, f, l, i, cmd, car, request : longint;\r\n\r\nprocedure Park(car, request : longint);\r\nvar i, j, balance : longint;\r\nbegin\r\n if (car > l)\r\n then begin\r\n parked[request] := -1;\r\n writeln('-1');\r\n exit;\r\n end;\r\n\r\n balance := 0;\r\n for i := 0 to car + f - 1 do\r\n inc(balance, g[i]);\r\n\r\n i := car + f - 1;\r\n while (balance <> 0) and (i < l + f - 1) do\r\n begin\r\n inc(i);\r\n balance := balance - g[i - car - b - f] + g[i];\r\n end;\r\n\r\n if (balance = 0)\r\n then begin\r\n for j := i - car - f + 1 to i - f do\r\n g[j] := request;\r\n parked[request] := i - car - f + 1;\r\n writeln(parked[request]);\r\n end\r\n else begin\r\n parked[request] := -1;\r\n writeln('-1');\r\n end;\r\nend;\r\n\r\nprocedure Unpark(request : longint);\r\nvar i, car : longint;\r\nbegin\r\n car := h[request];\r\n i := parked[request];\r\n for i := i to i + car do\r\n g[i] := 0;\r\n\r\n parked[request] := -1;\r\nend;\r\n\r\nbegin\r\n assign(input, '');\r\n assign(output, '');\r\n readln(l, b, f);\r\n readln(n);\r\n\r\n fillchar(g, sizeof(g), 0);\r\n for i := 1 to n do\r\n begin\r\n read(cmd);\r\n\r\n if (cmd = 1)\r\n then begin\r\n read(car);\r\n h[i] := car;\r\n Park(car, i);\r\n end\r\n else begin\r\n read(request);\r\n h[i] := -request;\r\n Unpark(request);\r\n end;\r\n end;\r\n close(input);\r\n close(output);\r\nend.\r\n","testcases":"[{'input': ['30 1 2\\r\\n6\\r\\n1 5\\r\\n1 4\\r\\n1 5\\r\\n2 2\\r\\n1 5\\r\\n1 4\\r\\n'], 'output': ['0\\r\\n6\\r\\n11\\r\\n17\\r\\n23\\r\\n']}, {'input': ['30 1 1\\r\\n6\\r\\n1 5\\r\\n1 4\\r\\n1 5\\r\\n2 2\\r\\n1 5\\r\\n1 4\\r\\n'], 'output': ['0\\r\\n6\\r\\n11\\r\\n17\\r\\n6\\r\\n']}, {'input': ['10 1 1\\r\\n1\\r\\n1 12\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['10 1 1\\r\\n1\\r\\n1 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1 1\\r\\n1\\r\\n1 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 1 1\\r\\n2\\r\\n1 3\\r\\n1 6\\r\\n'], 'output': ['0\\r\\n4\\r\\n']}, {'input': ['10 1 1\\r\\n2\\r\\n1 3\\r\\n1 7\\r\\n'], 'output': ['0\\r\\n-1\\r\\n']}, {'input': ['10 1 1\\r\\n5\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n2 2\\r\\n1 4\\r\\n'], 'output': ['0\\r\\n2\\r\\n5\\r\\n-1\\r\\n']}, {'input': ['10 1 1\\r\\n5\\r\\n1 4\\r\\n2 1\\r\\n1 3\\r\\n2 3\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n0\\r\\n0\\r\\n']}, {'input': ['10 1 1\\r\\n5\\r\\n1 2\\r\\n1 3\\r\\n1 1\\r\\n1 4\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n3\\r\\n7\\r\\n-1\\r\\n-1\\r\\n']}, {'input': ['20 1 2\\r\\n10\\r\\n1 3\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n1 4\\r\\n1 2\\r\\n1 2\\r\\n2 7\\r\\n1 2\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n4\\r\\n0\\r\\n5\\r\\n8\\r\\n8\\r\\n11\\r\\n']}, {'input': ['20 2 1\\r\\n10\\r\\n1 5\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n2 4\\r\\n1 3\\r\\n1 1\\r\\n2 5\\r\\n1 5\\r\\n'], 'output': ['0\\r\\n7\\r\\n11\\r\\n14\\r\\n17\\r\\n-1\\r\\n14\\r\\n-1\\r\\n']}, {'input': ['20 2 2\\r\\n10\\r\\n1 2\\r\\n1 3\\r\\n1 3\\r\\n1 5\\r\\n1 5\\r\\n1 1\\r\\n1 2\\r\\n1 5\\r\\n1 5\\r\\n1 5\\r\\n'], 'output': ['0\\r\\n4\\r\\n9\\r\\n14\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n-1\\r\\n']}, {'input': ['30 2 1\\r\\n10\\r\\n1 4\\r\\n2 1\\r\\n1 1\\r\\n1 3\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 5\\r\\n2 4\\r\\n2 7\\r\\n'], 'output': ['0\\r\\n0\\r\\n3\\r\\n8\\r\\n11\\r\\n14\\r\\n18\\r\\n']}, {'input': ['30 1 2\\r\\n10\\r\\n1 1\\r\\n1 1\\r\\n2 1\\r\\n1 5\\r\\n1 2\\r\\n2 4\\r\\n1 6\\r\\n2 5\\r\\n2 2\\r\\n2 7\\r\\n'], 'output': ['0\\r\\n2\\r\\n4\\r\\n10\\r\\n13\\r\\n']}, {'input': ['50 2 3\\r\\n15\\r\\n1 7\\r\\n1 6\\r\\n1 1\\r\\n2 3\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 4\\r\\n1 6\\r\\n1 2\\r\\n1 8\\r\\n1 6\\r\\n2 7\\r\\n1 8\\r\\n2 9\\r\\n'], 'output': ['0\\r\\n9\\r\\n17\\r\\n0\\r\\n3\\r\\n9\\r\\n17\\r\\n21\\r\\n31\\r\\n39\\r\\n']}, {'input': ['50 2 4\\r\\n15\\r\\n1 4\\r\\n1 4\\r\\n2 1\\r\\n2 2\\r\\n1 8\\r\\n1 7\\r\\n2 5\\r\\n1 2\\r\\n1 7\\r\\n2 8\\r\\n1 7\\r\\n2 11\\r\\n1 3\\r\\n2 6\\r\\n2 9\\r\\n'], 'output': ['0\\r\\n6\\r\\n0\\r\\n10\\r\\n0\\r\\n19\\r\\n28\\r\\n0\\r\\n']}, {'input': ['50 3 3\\r\\n20\\r\\n1 4\\r\\n2 1\\r\\n1 1\\r\\n2 3\\r\\n1 1\\r\\n2 5\\r\\n1 7\\r\\n2 7\\r\\n1 4\\r\\n1 1\\r\\n1 10\\r\\n1 5\\r\\n1 2\\r\\n2 9\\r\\n2 11\\r\\n1 1\\r\\n1 9\\r\\n2 13\\r\\n1 8\\r\\n1 1\\r\\n'], 'output': ['0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n7\\r\\n11\\r\\n24\\r\\n32\\r\\n0\\r\\n11\\r\\n32\\r\\n43\\r\\n']}, {'input': ['50 3 2\\r\\n20\\r\\n1 6\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n1 3\\r\\n1 1\\r\\n1 2\\r\\n2 4\\r\\n1 7\\r\\n1 1\\r\\n2 6\\r\\n1 9\\r\\n2 12\\r\\n2 9\\r\\n1 8\\r\\n1 6\\r\\n1 1\\r\\n1 8\\r\\n2 15\\r\\n1 2\\r\\n'], 'output': ['0\\r\\n9\\r\\n9\\r\\n14\\r\\n20\\r\\n24\\r\\n29\\r\\n9\\r\\n39\\r\\n29\\r\\n40\\r\\n20\\r\\n-1\\r\\n29\\r\\n']}, {'input': ['50 3 1\\r\\n30\\r\\n1 9\\r\\n2 1\\r\\n1 6\\r\\n1 5\\r\\n1 8\\r\\n1 1\\r\\n2 6\\r\\n1 7\\r\\n2 3\\r\\n2 8\\r\\n1 7\\r\\n2 4\\r\\n2 5\\r\\n2 11\\r\\n1 2\\r\\n2 15\\r\\n1 6\\r\\n1 3\\r\\n2 17\\r\\n1 9\\r\\n1 3\\r\\n2 18\\r\\n1 3\\r\\n2 23\\r\\n2 21\\r\\n1 8\\r\\n1 2\\r\\n2 27\\r\\n1 8\\r\\n2 29\\r\\n'], 'output': ['0\\r\\n0\\r\\n9\\r\\n17\\r\\n28\\r\\n28\\r\\n0\\r\\n0\\r\\n0\\r\\n9\\r\\n15\\r\\n0\\r\\n6\\r\\n0\\r\\n11\\r\\n27\\r\\n']}]","id":734} {"difficulty":1700,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"53_B","execute_outcome":"WRONG_ANSWER","source_code":"{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils,math;\r\nvar\r\nh,w,l,r,i,x,y : int64;\r\nbegin\r\n readln(h,w);\r\n if (h < w) then\r\n begin\r\n i := h;\r\n h := w;\r\n w := i;\r\n end;\r\n i := 0;\r\n x := -1;\r\n y := 1;\r\n while (1 shl i <= h) do\r\n begin\r\n l := round((1 shl i)*0.8);\r\n r := round((1 shl i)*1.25);\r\n if r > extended((1 shl i)*1.25) then dec(r);\r\n if l < extended((1 shl i)*0.8) then inc(l);\r\n r := min(r , w);\r\n if r < l then begin\r\n inc(i);\r\n continue;\r\n end;\r\n if (x*y < (1 shl i)*r) then\r\n begin\r\n x := 1 shl i;\r\n y := r;\r\n end\r\n else\r\n if (x*y = (1 shl i)*r) and (1 shl i>x) then\r\n begin\r\n x := 1 shl i;\r\n y := r;\r\n end;\r\n inc(i);\r\n end;\r\n i := 0;\r\n while (1 shl i <= w) do\r\n begin\r\n l := round((1 shl i)*0.8);\r\n r := round((1 shl i)*1.25);\r\n if r > extended((1 shl i)*1.25) then dec(r);\r\n if l < extended((1 shl i)*0.8) then inc(l);\r\n r := min(r , h);\r\n if r < l then begin\r\n inc(i);\r\n continue;\r\n end;\r\n if (x*y < (1 shl i)*r) then\r\n begin\r\n x := 1 shl i;\r\n y := r;\r\n end\r\n else\r\n if (x*y = (1 shl i)*r) and (1 shl i>x) then\r\n begin\r\n x := 1 shl i;\r\n y := r;\r\n end;\r\n inc(i);\r\n end;\r\n writeln(max(y,x),' ',min(x,y));\r\nend.","description":"One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the height\/width quotient) can vary from 0.8 to 1.25 inclusively. Besides, at least one side of the cut area should have a size, equal to some power of number 2 (2^x for some integer x). If those rules don't indicate the size of the cut are clearly, then the way with which the cut part possesses the largest area is chosen. Of course, both sides of the cut area should be integer. If there are several answers to this problem, you should choose the answer with the maximal height.","input_specification":"The first line contains a pair of integers h and w (1\u2264h,w\u226410^9) which are the height and width of the uploaded photo in pixels.\n","output_specification":"Print two integers which are the height and width of the cut area.\n","notes":null,"sample_inputs":["2 1\n","2 2\n","5 5\n"],"sample_outputs":["1 1\n","2 2\n","5 4\n"],"human_solution":" const eps=1e-14;\r\n besk=2000000000000000000; label 55,5,4,1,3,2,44,22;\r\n type\r\n mas=array[-20000..1140060+1] of int64;\r\n integer=longint; zap=record p1,p2,p3:int64; end;\r\n zap1=^zap;\r\n var kolrazn,ii,jj,tip,ppos1,oldtt,ps,pos1,pos2,pred,color,buk,cur,init,res,oldpos,i1,j1,mask,stepp,n2,i,j,k,l,step,k1,mesto:longint;\r\n oldss,smin,ss3,ss,ss1,ss2:string;\r\n newaans,aans:zap;\r\n ddist,ott,tttt:extended;\r\n pqqq:zap;\r\n otal,al1,al2,acc, disk,prop,bet,al:extended; fl1,fl2,fl:boolean;\r\n dr3,dr1,dr2,pt,ott1,ott2:zap;\r\n zz,x:array[-1000..2100000] of longint;\r\n sss1,sss2:array[-10..1200000] of char;\r\n v3,v1,v2,pointx,pointy,vel,tt0,radius,ote,ddl,dl1,dl2:extended;\r\n dd,ddpos:array[-2..14,-200..65400] of int64;\r\n posx,posy,zx,zy,z,kol,xxx,yyy,invfact,y,ansx,ansy,ugol,xx,yy:array[-1000..5150000] of int64;\r\n numleft,numright,pol,dx,dy:array[-100..1850000] of int64;\r\n popalx,popaly:array[-10..5000,-1..100] of boolean;\r\n ttt,delta,p8,p6,time,tt1,tt2,sum,maxdob,left,right,koll,newt,osn,oldot,num,oldt,ll,rr,znmax,p,aa,ot,t11,t01,t10,t00,pold,nap,t4,kk,dl,iii,jjj,aaa,bbb,ccc,bb,p0,t,pos,xmax,xmin,ymax,ymin,newpos,newdl,len,pp3,ans1,ans2,modul,t0,t1,t2,dloch,koldel,mmax,stepen,pq,pp1,pp2,period, dolg,ot1,ot2,oldgr,predsum,pmin,tmin,kool,number,imin,qq,n,m,numpos,vx,vy,down,imax,t3,qq1,qq2,q1,q2,ost,w,p3,p4,pmax,pmax2,p1,p2,hh,pos0,pp,mm,maxot,tmax,nn,n1,q:int64; flag1:boolean;\r\n b,c,a,zzz,fact,stan,a2,invx,invy,place,str,b2,z1,sum1,sum0,d0,d1,d:mas; flag2,flag:boolean; pl:longint;\r\n ans,tt,sdvig,start,finish,kolbl,glub,ot3,izb, oldmax,newmax,posmax,zapas,razn,oldll,oldrr,ppp,minx,miny,maxx,maxy,kolplus,kolminus,razr,jmax,gr,grr,ener,dob,cc,ugg,r,ug:int64;\r\n prost,zzan,zann:array[-10..2001001] of boolean;\r\n zanx,zany,zan,zan1,marked:array[-100..1100000] of boolean;\r\n dstoim,dnomer:array[-1..1201,-1..1201] of int64;\r\n ochh,newochh:array[0..1000000] of longint;\r\n first,last,b1,a1,kolnenul,next1,next0,prev1,prev0,newoch,d2,och,path,lx,a3,b3,predok:array[-20000..1500000] of int64;\r\n znach:array[-10..5200000,0..4] of int64;\r\n ddsum,dd1:array[-400..65200,-1..20] of int64;\r\n polesum,sumgor,pole,newpole:array[-100..1300,-100..2300] of int64;\r\n ssans,bufer, stroka:array[-1000..1000000] of char;\r\n cosa,sina,cosb,sinb,rx,ry,px,py,h1,h2,h,l1,l2,otmax,v:int64;\r\n obmen,ch:char;\r\n flagg,fflag,ok,flagg1:boolean;\r\n koled,oldx,oldy,numx,numy,xleft,xright,s,newplace,newstr,next,prev,aold:array[-1000..1200002] of int64;\r\n function srav(i,j:longint):boolean; label 44;\r\n begin\r\n if (a[i]a[j] then begin srav:=false; goto 44; end;\r\n if a[i]=a[j] then if a1[i]=jj then\r\n begin\r\n p1:=fact[ii];\r\n p2:=fact[jj];\r\n p3:=fact[ii-jj];\r\n t2:=degg(p2,modul-2,modul);\r\n t3:=degg(p3,modul-2,modul);\r\n ot:=((p1*t2) mod modul*t3) mod modul;\r\n bincoef:=ot;\r\n end else bincoef:=0;\r\n end;\r\n \r\n function bincoef1(ii,jj:longint):int64;\r\n var t1,t2,t3,p1,p2,p3,ot:int64;\r\n begin\r\n if ii>=jj then\r\n begin\r\n p1:=fact[ii];\r\n p2:=invfact[jj];\r\n p3:=invfact[ii-jj];\r\n ot:=((p1*p2) mod modul*p3) mod modul;\r\n bincoef1:=ot;\r\n end else bincoef1:=0;\r\n end;\r\n }\r\n function per(i:longint):string;\r\n var j:longint; ot:string;\r\n begin\r\n ot:='';\r\n while i>0 do begin j:=i and 1; i:=i shr 1; if j=0 then ot:='0'+ot else ot:='1'+ot; end;\r\n per:=ot;\r\n end;\r\n\r\n\r\n procedure pech;\r\n begin\r\n for i:=1 to p do write(x[i],' '); writeln('ot= ',ot);\r\n end;\r\n\r\n\r\n\r\n begin\r\n\r\n { assign (input,'D:\\Projects\\input.txt');reset(input);\r\n assign (output,'D:\\Projects\\output.txt'); rewrite(output);\r\n }\r\n z[0]:=1;\r\n for i:=1 to 31 do z[i]:=z[i-1]*2;\r\n read(aa,bb);\r\n for i:=0 to 30 do if z[i]<=aa then\r\n begin\r\n p2:=trunc(z[i]*5\/4+eps);\r\n p1:=trunc(z[i]*4\/5-eps)+1;\r\n\r\n { writeln(z[i],' gr= ',p1,' ',p2);\r\n } rr:=min(p2,bb);\r\n if rr>=p1 then\r\n begin pp:=rr*z[i];\r\n ot:=max(ot,pp);\r\n if ot=pp then begin aaa:=z[i]; bbb:=rr; end;\r\n end;\r\n end;\r\n\r\n { writeln(aaa,' ',bbb);\r\n\r\n goto 1;\r\n }\r\n for i:=0 to 30 do if z[i]<=bb then\r\n begin\r\n p2:=trunc(z[i]*5\/4+eps);\r\n p1:=trunc(z[i]*4\/5-eps)+1;\r\n\r\n { writeln(z[i],' gr= ',p1,' ',p2);\r\n } rr:=min(p2,aa);\r\n if rr>=p1 then\r\n begin pp:=rr*z[i];\r\n ot:=max(ot,pp);\r\n if ot=pp then begin bbb:=z[i]; aaa:=rr; end;\r\n end;\r\n end;\r\n\r\n\r\n writeln(aaa,' ',bbb);\r\n\r\n\r\n\r\n\r\n\r\n 1: close (output);\r\n\r\n\r\n end.\r\n","testcases":"[{'input': ['2 1\\r\\n'], 'output': ['1 1\\r\\n']}, {'input': ['2 2\\r\\n'], 'output': ['2 2\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['5 4\\r\\n']}, {'input': ['9 10\\r\\n'], 'output': ['8 10\\r\\n']}, {'input': ['15 13\\r\\n'], 'output': ['10 8\\r\\n']}, {'input': ['47 46\\r\\n'], 'output': ['40 32\\r\\n']}, {'input': ['99 100\\r\\n'], 'output': ['80 64\\r\\n']}, {'input': ['939 887\\r\\n'], 'output': ['640 512\\r\\n']}, {'input': ['4774 4806\\r\\n'], 'output': ['4096 4806\\r\\n']}, {'input': ['39271 49032\\r\\n'], 'output': ['32768 40960\\r\\n']}, {'input': ['483242 484564\\r\\n'], 'output': ['327680 262144\\r\\n']}, {'input': ['4939191 4587461\\r\\n'], 'output': ['4939191 4194304\\r\\n']}, {'input': ['9909199 9945873\\r\\n'], 'output': ['8388608 9945873\\r\\n']}, {'input': ['49829224 49889315\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49728622 49605627\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49934587 49239195\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48298903 49928606\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['49874820 49474021\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['48945079 49798393\\r\\n'], 'output': ['41943040 33554432\\r\\n']}, {'input': ['99692141 99232337\\r\\n'], 'output': ['83886080 67108864\\r\\n']}, {'input': ['998557701 924591072\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['644590722 593296648\\r\\n'], 'output': ['644590722 536870912\\r\\n']}, {'input': ['792322809 775058858\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['971840165 826141527\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['944976601 976175854\\r\\n'], 'output': ['671088640 536870912\\r\\n']}, {'input': ['1000000000 1000000000\\r\\n'], 'output': ['671088640 536870912\\r\\n']}]","id":735} {"difficulty":2500,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"53_E","execute_outcome":"RUNTIME_ERROR","source_code":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$R+,Q+}\r\n\r\nuses\r\n SysUtils, Math;\r\n\r\nvar\r\n ans, edge : int64;\r\n x, n, m, k, i, j, u, v, top : integer;\r\n a : array[1..10, 1..10] of boolean;\r\n d : array[0..1023, 0..511] of int64;\r\n st : array[1..2] of integer;\r\n\r\nbegin\r\n\/\/ reset(input, 'input.txt');\r\n\/\/ rewrite(output, 'output.txt');\r\n\r\n read(n, m, k);\r\n for i := 1 to m do begin\r\n read(u, v);\r\n a[u][v] := true;\r\n a[v][u] := true;\r\n end;\r\n\r\n ans := 0;\r\n for i := 1 to 1 shl n - 1 do begin\r\n j := i;\r\n u := 1;\r\n x := 1;\r\n top := 0;\r\n while x <= j do begin\r\n if x and j <> 0 then begin\r\n inc(top);\r\n if top <= 2 then\r\n st[top] := u;\r\n end;\r\n x := x shl 1;\r\n inc(u);\r\n end;\r\n if top = 1 then begin\r\n j := i and (j - 1);\r\n continue;\r\n end else\r\n if top = 2 then begin\r\n if a[st[1]][st[2]] then\r\n d[i][j] := 1;\r\n if (top = k) and (i = 1 shl n - 1) then\r\n inc(ans, d[i][j]);\r\n\/\/ writeln(i, ' ', j, ' ', d[i][j]);\r\n j := i and (j - 1);\r\n end;\r\n while j <> 0 do begin\r\n top := 0;\r\n x := 1;\r\n while x <= j do begin\r\n if x and j <> 0 then\r\n inc(top);\r\n x := x shl 1;\r\n end;\r\n u := 1;\r\n x := 1;\r\n while (x <= j) do begin\r\n if j and x <> 0 then begin\r\n for v := 1 to n do\r\n if (a[u][v]) and (i and (1 shl (v - 1)) <> 0) and (j and (1 shl (v - 1)) = 0) then\r\n inc(d[i][j], d[i xor (1 shl (u - 1))][j xor (1 shl (u - 1)) or (1 shl (v - 1))] + d[i xor (1 shl (u - 1))][j xor (1 shl (u - 1))]);\r\n end;\r\n x := x shl 1;\r\n inc(u);\r\n end;\r\n d[i][j] := d[i][j] div top;\r\n if (top = k) and (i = 1 shl n - 1) then\r\n inc(ans, d[i][j]);\r\n\/\/ writeln(i, ' ', j, ' ', d[i][j]);\r\n j := i and (j - 1);\r\n end;\r\n end;\r\n\r\n writeln(ans);\r\n\r\nend.\r\n","description":"Life in Bertown has become hard. The city has too many roads and the government spends too much to maintain them. There are n junctions and m two way roads, at which one can get from each junction to any other one. The mayor wants to close some roads so that the number of roads left totaled to n-1 roads and it were still possible to get from each junction to any other one. Besides, the mayor is concerned with the number of dead ends which are the junctions from which only one road goes. There shouldn't be too many or too few junctions. Having discussed the problem, the mayor and his assistants decided that after the roads are closed, the road map should contain exactly k dead ends. Your task is to count the number of different ways of closing the roads at which the following conditions are met: There are exactly n-1 roads left. It is possible to get from each junction to any other one. There are exactly k dead ends on the resulting map. Two ways are considered different if there is a road that is closed in the first way, and is open in the second one.","input_specification":"The first line contains three integers n, m and k (3\u2264n\u226410,n-1\u2264m\u2264n\u00b7(n-1)\/2,2\u2264k\u2264n-1) which represent the number of junctions, roads and dead ends correspondingly. Then follow m lines each containing two different integers v1 and v2 (1\u2264v1,v2\u2264n,v1\u2260v2) which represent the number of junctions connected by another road. There can be no more than one road between every pair of junctions. The junctions are numbered with integers from 1 to n. It is guaranteed that it is possible to get from each junction to any other one along the original roads.\n","output_specification":"Print a single number \u2014 the required number of ways.\n","notes":null,"sample_inputs":["3 3 2\n1 2\n2 3\n1 3\n","4 6 2\n1 2\n2 3\n3 4\n4 1\n1 3\n2 4\n","4 6 3\n1 2\n2 3\n3 4\n4 1\n1 3\n2 4\n"],"sample_outputs":["3\n","12\n","4\n"],"human_solution":"program Project2;\r\n\r\n{$APPTYPE CONSOLE}\r\n{$R+,Q+}\r\n\r\nuses\r\n SysUtils, Math;\r\n\r\nvar\r\n ans, edge : int64;\r\n x, n, m, k, i, j, u, v, top : integer;\r\n a : array[1..10, 1..10] of boolean;\r\n d : array[0..1023, 0..1023] of int64;\r\n st : array[1..2] of integer;\r\n\r\nbegin\r\n\/\/ reset(input, 'input.txt');\r\n\/\/ rewrite(output, 'output.txt');\r\n\r\n read(n, m, k);\r\n for i := 1 to m do begin\r\n read(u, v);\r\n a[u][v] := true;\r\n a[v][u] := true;\r\n end;\r\n\r\n ans := 0;\r\n for i := 1 to 1 shl n - 1 do begin\r\n j := i;\r\n u := 1;\r\n x := 1;\r\n top := 0;\r\n while x <= j do begin\r\n if x and j <> 0 then begin\r\n inc(top);\r\n if top <= 2 then\r\n st[top] := u;\r\n end;\r\n x := x shl 1;\r\n inc(u);\r\n end;\r\n if top = 1 then begin\r\n j := i and (j - 1);\r\n continue;\r\n end else\r\n if top = 2 then begin\r\n if a[st[1]][st[2]] then\r\n d[i][j] := 1;\r\n if (top = k) and (i = 1 shl n - 1) then\r\n inc(ans, d[i][j]);\r\n\/\/ writeln(i, ' ', j, ' ', d[i][j]);\r\n j := i and (j - 1);\r\n end;\r\n while j <> 0 do begin\r\n top := 0;\r\n x := 1;\r\n while x <= j do begin\r\n if x and j <> 0 then\r\n inc(top);\r\n x := x shl 1;\r\n end;\r\n u := 1;\r\n x := 1;\r\n while (x <= j) do begin\r\n if j and x <> 0 then begin\r\n for v := 1 to n do\r\n if (a[u][v]) and (i and (1 shl (v - 1)) <> 0) and (j and (1 shl (v - 1)) = 0) then\r\n inc(d[i][j], d[i xor (1 shl (u - 1))][j xor (1 shl (u - 1)) or (1 shl (v - 1))] + d[i xor (1 shl (u - 1))][j xor (1 shl (u - 1))]);\r\n end;\r\n x := x shl 1;\r\n inc(u);\r\n end;\r\n d[i][j] := d[i][j] div top;\r\n if (top = k) and (i = 1 shl n - 1) then\r\n inc(ans, d[i][j]);\r\n\/\/ writeln(i, ' ', j, ' ', d[i][j]);\r\n j := i and (j - 1);\r\n end;\r\n end;\r\n\r\n writeln(ans);\r\n\r\nend.\r\n","testcases":"[{'input': ['3 3 2\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['4 6 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 1\\r\\n1 3\\r\\n2 4\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['4 6 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 1\\r\\n1 3\\r\\n2 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5 4 3\\r\\n2 1\\r\\n5 3\\r\\n3 2\\r\\n1 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 10 2\\r\\n2 4\\r\\n1 5\\r\\n2 5\\r\\n3 5\\r\\n4 3\\r\\n1 4\\r\\n3 1\\r\\n5 4\\r\\n3 2\\r\\n2 1\\r\\n'], 'output': ['60\\r\\n']}, {'input': ['6 6 2\\r\\n6 3\\r\\n5 2\\r\\n5 1\\r\\n3 5\\r\\n6 2\\r\\n4 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['7 7 5\\r\\n2 1\\r\\n4 2\\r\\n7 1\\r\\n4 5\\r\\n7 6\\r\\n2 6\\r\\n2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 5 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 2\\r\\n4 5\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['9 19 8\\r\\n1 9\\r\\n3 9\\r\\n3 6\\r\\n7 1\\r\\n3 1\\r\\n6 9\\r\\n2 9\\r\\n5 2\\r\\n5 6\\r\\n4 1\\r\\n8 6\\r\\n8 2\\r\\n1 6\\r\\n3 2\\r\\n8 7\\r\\n7 5\\r\\n6 2\\r\\n7 6\\r\\n4 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 10 9\\r\\n6 4\\r\\n2 4\\r\\n4 1\\r\\n8 1\\r\\n1 9\\r\\n7 6\\r\\n6 8\\r\\n5 1\\r\\n10 8\\r\\n2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 44 3\\r\\n3 10\\r\\n1 5\\r\\n10 5\\r\\n7 10\\r\\n4 9\\r\\n2 9\\r\\n2 10\\r\\n8 4\\r\\n10 9\\r\\n10 8\\r\\n5 2\\r\\n9 7\\r\\n5 3\\r\\n10 4\\r\\n5 4\\r\\n2 6\\r\\n1 2\\r\\n1 6\\r\\n1 8\\r\\n4 2\\r\\n5 9\\r\\n10 1\\r\\n7 4\\r\\n3 2\\r\\n6 9\\r\\n3 1\\r\\n6 4\\r\\n8 9\\r\\n3 6\\r\\n3 4\\r\\n1 7\\r\\n2 7\\r\\n6 8\\r\\n3 8\\r\\n1 4\\r\\n6 10\\r\\n5 7\\r\\n7 3\\r\\n6 7\\r\\n5 6\\r\\n2 8\\r\\n8 7\\r\\n3 9\\r\\n1 9\\r\\n'], 'output': ['13547520\\r\\n']}, {'input': ['10 21 6\\r\\n3 8\\r\\n1 10\\r\\n3 4\\r\\n2 9\\r\\n9 8\\r\\n7 9\\r\\n7 10\\r\\n6 5\\r\\n7 6\\r\\n7 3\\r\\n5 7\\r\\n10 4\\r\\n8 6\\r\\n9 5\\r\\n6 10\\r\\n8 7\\r\\n10 8\\r\\n2 8\\r\\n4 7\\r\\n1 9\\r\\n2 5\\r\\n'], 'output': ['3358\\r\\n']}, {'input': ['10 35 9\\r\\n2 3\\r\\n6 8\\r\\n1 5\\r\\n10 9\\r\\n5 3\\r\\n9 3\\r\\n6 9\\r\\n5 6\\r\\n1 7\\r\\n9 7\\r\\n8 3\\r\\n8 10\\r\\n7 5\\r\\n8 2\\r\\n1 9\\r\\n6 7\\r\\n6 2\\r\\n9 5\\r\\n4 2\\r\\n7 3\\r\\n4 10\\r\\n8 5\\r\\n6 4\\r\\n3 10\\r\\n6 3\\r\\n10 5\\r\\n1 10\\r\\n8 1\\r\\n9 8\\r\\n8 7\\r\\n1 3\\r\\n7 2\\r\\n10 7\\r\\n1 6\\r\\n9 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 34 3\\r\\n3 6\\r\\n1 9\\r\\n2 1\\r\\n2 4\\r\\n1 10\\r\\n7 3\\r\\n1 7\\r\\n3 5\\r\\n6 1\\r\\n10 6\\r\\n10 7\\r\\n9 2\\r\\n5 7\\r\\n5 2\\r\\n5 4\\r\\n10 4\\r\\n3 9\\r\\n10 2\\r\\n6 7\\r\\n5 9\\r\\n2 6\\r\\n1 4\\r\\n10 9\\r\\n3 10\\r\\n7 8\\r\\n9 7\\r\\n8 9\\r\\n6 9\\r\\n10 8\\r\\n7 4\\r\\n8 5\\r\\n7 2\\r\\n5 6\\r\\n4 8\\r\\n'], 'output': ['948807\\r\\n']}, {'input': ['10 11 6\\r\\n9 8\\r\\n8 5\\r\\n3 2\\r\\n6 9\\r\\n1 8\\r\\n2 6\\r\\n10 4\\r\\n6 4\\r\\n7 2\\r\\n6 7\\r\\n9 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 25 9\\r\\n10 8\\r\\n9 10\\r\\n6 9\\r\\n8 5\\r\\n1 7\\r\\n4 7\\r\\n5 3\\r\\n8 6\\r\\n9 2\\r\\n10 1\\r\\n7 2\\r\\n7 10\\r\\n3 1\\r\\n9 5\\r\\n4 10\\r\\n7 3\\r\\n5 7\\r\\n2 5\\r\\n6 1\\r\\n4 8\\r\\n2 4\\r\\n8 7\\r\\n8 2\\r\\n2 6\\r\\n5 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 39 4\\r\\n5 7\\r\\n5 9\\r\\n10 1\\r\\n4 8\\r\\n5 8\\r\\n8 1\\r\\n6 8\\r\\n3 7\\r\\n9 7\\r\\n8 3\\r\\n10 2\\r\\n1 9\\r\\n1 3\\r\\n4 9\\r\\n6 9\\r\\n2 7\\r\\n1 7\\r\\n7 4\\r\\n6 5\\r\\n6 7\\r\\n4 5\\r\\n5 2\\r\\n2 1\\r\\n10 5\\r\\n3 10\\r\\n3 5\\r\\n1 4\\r\\n2 3\\r\\n9 3\\r\\n4 2\\r\\n9 2\\r\\n10 6\\r\\n9 10\\r\\n10 4\\r\\n6 4\\r\\n9 8\\r\\n2 6\\r\\n1 5\\r\\n4 3\\r\\n'], 'output': ['9552530\\r\\n']}, {'input': ['10 39 7\\r\\n3 1\\r\\n4 6\\r\\n1 7\\r\\n3 4\\r\\n6 1\\r\\n3 9\\r\\n7 5\\r\\n1 9\\r\\n2 8\\r\\n4 2\\r\\n5 3\\r\\n3 10\\r\\n2 1\\r\\n9 2\\r\\n1 8\\r\\n7 8\\r\\n4 10\\r\\n7 6\\r\\n8 10\\r\\n5 6\\r\\n5 4\\r\\n6 9\\r\\n3 6\\r\\n7 3\\r\\n4 1\\r\\n6 10\\r\\n10 9\\r\\n6 2\\r\\n9 4\\r\\n9 7\\r\\n5 9\\r\\n5 2\\r\\n2 7\\r\\n8 3\\r\\n8 5\\r\\n8 6\\r\\n7 4\\r\\n3 2\\r\\n8 4\\r\\n'], 'output': ['177142\\r\\n']}, {'input': ['10 16 9\\r\\n1 5\\r\\n10 5\\r\\n3 1\\r\\n2 9\\r\\n8 1\\r\\n4 2\\r\\n7 9\\r\\n4 8\\r\\n7 4\\r\\n1 7\\r\\n2 6\\r\\n6 10\\r\\n7 2\\r\\n8 3\\r\\n1 6\\r\\n2 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['10 34 8\\r\\n10 3\\r\\n9 3\\r\\n8 1\\r\\n3 7\\r\\n2 5\\r\\n9 1\\r\\n5 10\\r\\n2 3\\r\\n8 4\\r\\n2 10\\r\\n5 4\\r\\n5 8\\r\\n4 9\\r\\n5 3\\r\\n9 10\\r\\n2 4\\r\\n4 10\\r\\n2 9\\r\\n9 5\\r\\n3 8\\r\\n1 4\\r\\n7 6\\r\\n7 2\\r\\n6 5\\r\\n6 9\\r\\n7 8\\r\\n1 3\\r\\n4 6\\r\\n3 6\\r\\n10 8\\r\\n1 6\\r\\n1 7\\r\\n5 7\\r\\n2 1\\r\\n'], 'output': ['448\\r\\n']}, {'input': ['8 9 4\\r\\n7 3\\r\\n8 6\\r\\n7 2\\r\\n2 8\\r\\n5 2\\r\\n4 1\\r\\n6 7\\r\\n1 8\\r\\n3 5\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10 45 9\\r\\n10 3\\r\\n1 7\\r\\n9 1\\r\\n1 10\\r\\n4 1\\r\\n3 7\\r\\n4 2\\r\\n10 8\\r\\n10 6\\r\\n8 7\\r\\n8 4\\r\\n8 2\\r\\n6 7\\r\\n10 2\\r\\n1 8\\r\\n5 8\\r\\n3 6\\r\\n6 4\\r\\n9 5\\r\\n9 8\\r\\n2 5\\r\\n2 1\\r\\n5 4\\r\\n6 9\\r\\n4 9\\r\\n3 1\\r\\n3 9\\r\\n5 1\\r\\n4 7\\r\\n7 10\\r\\n2 3\\r\\n9 2\\r\\n4 3\\r\\n4 10\\r\\n8 3\\r\\n5 10\\r\\n9 7\\r\\n6 5\\r\\n3 5\\r\\n8 6\\r\\n6 1\\r\\n2 6\\r\\n10 9\\r\\n5 7\\r\\n2 7\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['10 45 8\\r\\n7 2\\r\\n3 7\\r\\n4 8\\r\\n1 8\\r\\n9 6\\r\\n7 6\\r\\n10 7\\r\\n6 3\\r\\n2 8\\r\\n6 2\\r\\n4 10\\r\\n9 2\\r\\n10 3\\r\\n6 1\\r\\n8 9\\r\\n5 2\\r\\n4 5\\r\\n5 1\\r\\n4 1\\r\\n6 10\\r\\n10 9\\r\\n3 5\\r\\n7 5\\r\\n6 5\\r\\n10 8\\r\\n4 2\\r\\n9 5\\r\\n2 3\\r\\n4 6\\r\\n4 9\\r\\n7 9\\r\\n1 10\\r\\n2 10\\r\\n1 2\\r\\n8 6\\r\\n3 8\\r\\n4 3\\r\\n9 1\\r\\n5 10\\r\\n9 3\\r\\n7 4\\r\\n7 1\\r\\n8 7\\r\\n3 1\\r\\n5 8\\r\\n'], 'output': ['11430\\r\\n']}, {'input': ['10 45 7\\r\\n1 10\\r\\n8 6\\r\\n7 6\\r\\n10 9\\r\\n2 6\\r\\n6 4\\r\\n7 1\\r\\n8 7\\r\\n3 8\\r\\n2 3\\r\\n4 10\\r\\n4 9\\r\\n10 7\\r\\n10 5\\r\\n5 2\\r\\n2 4\\r\\n3 1\\r\\n4 3\\r\\n6 9\\r\\n3 7\\r\\n7 4\\r\\n2 8\\r\\n6 1\\r\\n10 3\\r\\n8 10\\r\\n7 5\\r\\n4 8\\r\\n4 5\\r\\n3 5\\r\\n9 2\\r\\n7 2\\r\\n10 2\\r\\n5 8\\r\\n6 10\\r\\n8 1\\r\\n6 5\\r\\n1 4\\r\\n5 9\\r\\n9 7\\r\\n1 2\\r\\n9 3\\r\\n1 5\\r\\n6 3\\r\\n9 1\\r\\n8 9\\r\\n'], 'output': ['695520\\r\\n']}, {'input': ['10 45 6\\r\\n6 2\\r\\n2 10\\r\\n4 8\\r\\n3 5\\r\\n7 10\\r\\n2 9\\r\\n8 3\\r\\n5 9\\r\\n7 9\\r\\n7 6\\r\\n5 10\\r\\n1 3\\r\\n1 6\\r\\n5 4\\r\\n3 4\\r\\n7 8\\r\\n8 6\\r\\n2 4\\r\\n1 4\\r\\n1 8\\r\\n10 3\\r\\n5 6\\r\\n1 9\\r\\n3 2\\r\\n10 9\\r\\n3 7\\r\\n10 1\\r\\n1 5\\r\\n2 7\\r\\n2 5\\r\\n9 4\\r\\n3 6\\r\\n7 4\\r\\n8 5\\r\\n10 6\\r\\n9 6\\r\\n3 9\\r\\n5 7\\r\\n10 4\\r\\n8 10\\r\\n6 4\\r\\n7 1\\r\\n2 8\\r\\n9 8\\r\\n2 1\\r\\n'], 'output': ['8573040\\r\\n']}, {'input': ['10 45 5\\r\\n2 5\\r\\n6 8\\r\\n7 5\\r\\n6 9\\r\\n5 9\\r\\n5 3\\r\\n10 6\\r\\n1 9\\r\\n10 7\\r\\n3 10\\r\\n1 2\\r\\n4 8\\r\\n9 10\\r\\n2 8\\r\\n2 6\\r\\n4 2\\r\\n7 6\\r\\n1 8\\r\\n7 2\\r\\n2 10\\r\\n8 5\\r\\n8 3\\r\\n4 1\\r\\n1 10\\r\\n4 10\\r\\n4 6\\r\\n3 1\\r\\n4 7\\r\\n5 4\\r\\n7 8\\r\\n7 3\\r\\n10 5\\r\\n6 1\\r\\n9 7\\r\\n3 6\\r\\n1 5\\r\\n2 9\\r\\n9 3\\r\\n3 4\\r\\n9 8\\r\\n7 1\\r\\n4 9\\r\\n10 8\\r\\n6 5\\r\\n3 2\\r\\n'], 'output': ['31752000\\r\\n']}, {'input': ['10 45 4\\r\\n8 6\\r\\n10 2\\r\\n9 5\\r\\n1 7\\r\\n8 7\\r\\n7 10\\r\\n2 5\\r\\n5 10\\r\\n10 1\\r\\n1 8\\r\\n4 1\\r\\n10 9\\r\\n6 9\\r\\n3 7\\r\\n10 4\\r\\n5 6\\r\\n1 5\\r\\n4 7\\r\\n7 9\\r\\n10 3\\r\\n4 3\\r\\n6 4\\r\\n2 1\\r\\n5 3\\r\\n10 6\\r\\n1 9\\r\\n8 2\\r\\n3 8\\r\\n6 3\\r\\n8 5\\r\\n3 9\\r\\n4 2\\r\\n7 5\\r\\n2 9\\r\\n4 5\\r\\n2 7\\r\\n2 6\\r\\n6 7\\r\\n8 4\\r\\n8 10\\r\\n3 2\\r\\n4 9\\r\\n9 8\\r\\n6 1\\r\\n3 1\\r\\n'], 'output': ['40219200\\r\\n']}, {'input': ['10 45 3\\r\\n8 5\\r\\n10 7\\r\\n6 8\\r\\n10 8\\r\\n5 4\\r\\n9 2\\r\\n8 3\\r\\n1 8\\r\\n8 7\\r\\n1 6\\r\\n4 7\\r\\n9 1\\r\\n10 6\\r\\n4 8\\r\\n7 1\\r\\n1 2\\r\\n3 6\\r\\n2 6\\r\\n9 10\\r\\n2 8\\r\\n10 5\\r\\n6 9\\r\\n2 7\\r\\n7 5\\r\\n4 6\\r\\n1 3\\r\\n5 2\\r\\n4 3\\r\\n9 7\\r\\n4 9\\r\\n6 5\\r\\n1 10\\r\\n5 1\\r\\n2 3\\r\\n10 3\\r\\n4 10\\r\\n1 4\\r\\n9 5\\r\\n9 8\\r\\n7 6\\r\\n2 4\\r\\n2 10\\r\\n3 5\\r\\n9 3\\r\\n7 3\\r\\n'], 'output': ['16934400\\r\\n']}, {'input': ['10 45 2\\r\\n7 3\\r\\n3 2\\r\\n8 6\\r\\n6 10\\r\\n7 6\\r\\n2 7\\r\\n4 3\\r\\n6 5\\r\\n2 9\\r\\n10 2\\r\\n6 1\\r\\n5 1\\r\\n8 1\\r\\n3 1\\r\\n4 7\\r\\n3 6\\r\\n1 10\\r\\n9 10\\r\\n5 7\\r\\n1 2\\r\\n9 4\\r\\n4 1\\r\\n5 3\\r\\n1 9\\r\\n10 3\\r\\n8 3\\r\\n7 9\\r\\n9 8\\r\\n4 2\\r\\n5 9\\r\\n10 7\\r\\n6 9\\r\\n2 8\\r\\n2 6\\r\\n8 4\\r\\n5 2\\r\\n7 8\\r\\n8 10\\r\\n8 5\\r\\n5 4\\r\\n4 10\\r\\n3 9\\r\\n1 7\\r\\n5 10\\r\\n4 6\\r\\n'], 'output': ['1814400\\r\\n']}, {'input': ['10 44 5\\r\\n8 4\\r\\n3 8\\r\\n1 3\\r\\n2 6\\r\\n7 4\\r\\n7 1\\r\\n4 6\\r\\n7 2\\r\\n3 7\\r\\n4 10\\r\\n3 10\\r\\n10 1\\r\\n2 3\\r\\n5 7\\r\\n5 8\\r\\n8 2\\r\\n9 5\\r\\n3 9\\r\\n5 3\\r\\n8 1\\r\\n4 5\\r\\n2 4\\r\\n1 6\\r\\n10 7\\r\\n9 1\\r\\n6 8\\r\\n8 10\\r\\n10 5\\r\\n9 10\\r\\n9 8\\r\\n1 4\\r\\n6 10\\r\\n8 7\\r\\n3 6\\r\\n4 3\\r\\n9 6\\r\\n7 6\\r\\n9 7\\r\\n1 2\\r\\n2 10\\r\\n1 5\\r\\n2 5\\r\\n4 9\\r\\n2 9\\r\\n'], 'output': ['25401600\\r\\n']}, {'input': ['10 43 9\\r\\n7 1\\r\\n4 5\\r\\n8 3\\r\\n5 1\\r\\n2 5\\r\\n9 2\\r\\n8 4\\r\\n8 2\\r\\n5 8\\r\\n4 2\\r\\n9 8\\r\\n7 10\\r\\n10 2\\r\\n4 7\\r\\n9 5\\r\\n2 3\\r\\n8 6\\r\\n10 5\\r\\n6 4\\r\\n3 5\\r\\n8 1\\r\\n3 1\\r\\n3 7\\r\\n6 9\\r\\n4 10\\r\\n9 7\\r\\n6 3\\r\\n7 5\\r\\n3 4\\r\\n9 10\\r\\n7 2\\r\\n4 1\\r\\n7 8\\r\\n1 10\\r\\n3 9\\r\\n10 6\\r\\n10 3\\r\\n6 7\\r\\n6 1\\r\\n1 2\\r\\n1 9\\r\\n5 6\\r\\n6 2\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['10 42 5\\r\\n1 3\\r\\n10 2\\r\\n1 7\\r\\n5 8\\r\\n6 7\\r\\n3 5\\r\\n3 2\\r\\n10 5\\r\\n8 1\\r\\n3 9\\r\\n6 3\\r\\n8 4\\r\\n6 9\\r\\n1 4\\r\\n9 2\\r\\n8 3\\r\\n6 5\\r\\n2 4\\r\\n7 9\\r\\n4 6\\r\\n8 10\\r\\n1 2\\r\\n3 10\\r\\n7 2\\r\\n5 4\\r\\n1 10\\r\\n6 2\\r\\n2 8\\r\\n4 3\\r\\n6 1\\r\\n4 9\\r\\n2 5\\r\\n10 4\\r\\n10 6\\r\\n8 7\\r\\n9 5\\r\\n9 10\\r\\n5 1\\r\\n10 7\\r\\n8 6\\r\\n7 5\\r\\n8 9\\r\\n'], 'output': ['15986880\\r\\n']}]","id":736} {"difficulty":2000,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"58_D","execute_outcome":"WRONG_ANSWER","source_code":"program Project11;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\n\r\nvar s,s1,s2:string;\r\n i,j,k,n:integer;\r\n d:char;\r\n a:array[1..5000] of string;\r\n b:array[1..5000] of string;\r\n c:array[1..5000] of string;\r\nbegin\r\n { TODO -oUser -cConsole Main : Insert code here }\r\n readln(n);\r\n for i:=1 to (n div 2) do\r\n begin\r\n readln(a[i]);\r\n readln(b[i]);\r\n end;\r\n readln(d);\r\n for i:=1 to (n div 2) do\r\n begin\r\n s1:=a[i]+d+b[i];\r\n s2:=a[i]+d+a[i];\r\n if s1 x do dec(j);\r\n if i <= j then\r\n begin\r\n tmp:=s[i];\r\n s[i]:=s[j];\r\n s[j]:=tmp;\r\n inc(i); dec(j);\r\n end;\r\n until i > j;\r\n if i < r then sort(i,r);\r\n if j > l then sort(l,j);\r\n end;\r\n\r\nbegin\r\n \/\/reset(input,inf);\r\n \/\/rewrite(output,outf);\r\n readln(n);\r\n for i:=1 to n do readln(s[i]);\r\n readln(d);\r\n len:=0;\r\n for i:=1 to n do inc(len,length(s[i]));\r\n len:=2*len div n;\r\n for i:=1 to n do s[i]:=s[i]+d;\r\n sort(1,n);\r\n for i:=1 to n do delete(s[i],length(s[i]),1);\r\n cur:=1;\r\n fillchar(was,sizeof(was),false);\r\n for i:=1 to n div 2 do\r\n begin\r\n while was[cur] do inc(cur);\r\n write(s[cur],d);\r\n was[cur]:=true;\r\n for j:=cur+1 to n do if not was[j] then\r\n if length(s[cur])+length(s[j]) = len then\r\n begin\r\n writeln(s[j]);\r\n was[j]:=true;\r\n break;\r\n end;\r\n end;\r\nend.\r\n\r\n","testcases":"[{'input': ['4\\r\\nb\\r\\naa\\r\\nhg\\r\\nc\\r\\n.\\r\\n'], 'output': ['aa.b\\r\\nc.hg\\r\\n']}, {'input': ['2\\r\\naa\\r\\na\\r\\n!\\r\\n'], 'output': ['a!aa\\r\\n']}, {'input': ['2\\r\\naa\\r\\na\\r\\n|\\r\\n'], 'output': ['aa|a\\r\\n']}, {'input': ['4\\r\\nqhcivbxotj\\r\\nirgxzzxvw\\r\\npxdmcyszvk\\r\\nyyaevcdal\\r\\n~\\r\\n'], 'output': ['irgxzzxvw~pxdmcyszvk\\r\\nqhcivbxotj~yyaevcdal\\r\\n']}, {'input': ['8\\r\\nbad\\r\\nrnnpg\\r\\njvcjsxfob\\r\\nad\\r\\nairnnpg\\r\\nqury\\r\\njvcjsxfo\\r\\nquryai\\r\\n6\\r\\n'], 'output': ['ad6jvcjsxfob\\r\\nairnnpg6qury\\r\\nbad6jvcjsxfo\\r\\nquryai6rnnpg\\r\\n']}, {'input': ['6\\r\\neh\\r\\nehkhdp\\r\\ngque\\r\\nkhdptvgque\\r\\ntvgque\\r\\nehkhdptv\\r\\n}\\r\\n'], 'output': ['ehkhdptv}gque\\r\\nehkhdp}tvgque\\r\\neh}khdptvgque\\r\\n']}, {'input': ['10\\r\\ndoecgzo\\r\\ntjptpqp\\r\\noitegxzwlp\\r\\nmwsrwmeyeg\\r\\nsmapaqanak\\r\\nsmapaqa\\r\\nqghrydm\\r\\nnakqghrydm\\r\\nmedoraus\\r\\nnyvgozjdf\\r\\n|\\r\\n'], 'output': ['doecgzo|mwsrwmeyeg\\r\\nmedoraus|nyvgozjdf\\r\\nnakqghrydm|qghrydm\\r\\noitegxzwlp|smapaqa\\r\\nsmapaqanak|tjptpqp\\r\\n']}, {'input': ['30\\r\\nd\\r\\nahx\\r\\nr\\r\\nyd\\r\\np\\r\\nnhy\\r\\na\\r\\ntqt\\r\\nctp\\r\\ntp\\r\\nho\\r\\nry\\r\\nm\\r\\ng\\r\\ns\\r\\nn\\r\\nct\\r\\nsc\\r\\nqr\\r\\nrry\\r\\ny\\r\\nhxm\\r\\nqrr\\r\\nsct\\r\\ncwu\\r\\nq\\r\\ndk\\r\\nrf\\r\\nhyd\\r\\nnh\\r\\n$\\r\\n'], 'output': ['a$ahx\\r\\nct$dk\\r\\nctp$d\\r\\ncwu$g\\r\\nho$nh\\r\\nhxm$m\\r\\nhyd$n\\r\\nnhy$p\\r\\nq$qrr\\r\\nqr$rf\\r\\nr$rry\\r\\nry$sc\\r\\ns$sct\\r\\ntp$yd\\r\\ntqt$y\\r\\n']}, {'input': ['14\\r\\neskrrgzq\\r\\nxbmynhxfg\\r\\nwwffafny\\r\\nfaxcnrqkkb\\r\\nfaxcnrqk\\r\\nkbwwffafny\\r\\nmnborvqeae\\r\\nranfahuebj\\r\\neskrrgzqk\\r\\nfaxcnrqkk\\r\\ncznaycxe\\r\\nrnkgfgyq\\r\\nkxbmynhxfg\\r\\nbwwffafny\\r\\n}\\r\\n'], 'output': ['bwwffafny}eskrrgzqk\\r\\ncznaycxe}faxcnrqkkb\\r\\neskrrgzq}kbwwffafny\\r\\nfaxcnrqkk}xbmynhxfg\\r\\nfaxcnrqk}kxbmynhxfg\\r\\nmnborvqeae}rnkgfgyq\\r\\nranfahuebj}wwffafny\\r\\n']}, {'input': ['34\\r\\nobseknnnqk\\r\\ncvyvvbcgb\\r\\nxvmhfzfl\\r\\ngrtp\\r\\nhbcbhj\\r\\nknnnqk\\r\\ncyud\\r\\nkuaeui\\r\\naeui\\r\\nlhpdobsekn\\r\\ncxmigej\\r\\ncvyvvbcgbs\\r\\nuwuu\\r\\nnnqk\\r\\npzcftfrrqp\\r\\nnwsyrgqa\\r\\nxvmhfzflku\\r\\nndcis\\r\\nxhaznwqsgk\\r\\ncftfrrqp\\r\\nkakdggegew\\r\\njjzvokhh\\r\\nlhpdobse\\r\\nxjjzvokhh\\r\\nlhpd\\r\\nsuwuu\\r\\ntuatbwof\\r\\nvpsuday\\r\\nndcisx\\r\\nfggxici\\r\\nbfnipz\\r\\nknzjio\\r\\noirksxb\\r\\nbfni\\r\\n~\\r\\n'], 'output': ['aeui~cvyvvbcgbs\\r\\nbfnipz~cftfrrqp\\r\\nbfni~kakdggegew\\r\\ncvyvvbcgb~ndcis\\r\\ncxmigej~fggxici\\r\\ncyud~lhpdobsekn\\r\\ngrtp~obseknnnqk\\r\\nhbcbhj~jjzvokhh\\r\\nknnnqk~lhpdobse\\r\\nknzjio~nwsyrgqa\\r\\nkuaeui~tuatbwof\\r\\nlhpd~pzcftfrrqp\\r\\nndcisx~xvmhfzfl\\r\\nnnqk~xhaznwqsgk\\r\\noirksxb~vpsuday\\r\\nsuwuu~xjjzvokhh\\r\\nuwuu~xvmhfzflku\\r\\n']}, {'input': ['58\\r\\nesgdfmf\\r\\nxfkluadj\\r\\nqhvh\\r\\njwhuyhm\\r\\nmgi\\r\\nysgc\\r\\nvhhenku\\r\\npb\\r\\ntr\\r\\nu\\r\\njyrpjnpd\\r\\nkluadjo\\r\\nopb\\r\\ncopb\\r\\ngcyhceo\\r\\nr\\r\\ndjo\\r\\nxfklu\\r\\neo\\r\\nadjo\\r\\nfkluadjo\\r\\nybe\\r\\nwljwh\\r\\nqhvhh\\r\\nrhgotp\\r\\nyhceo\\r\\nuyhm\\r\\nvdd\\r\\nyhm\\r\\nysgcyhc\\r\\nvddrhg\\r\\nril\\r\\nwljwhu\\r\\nx\\r\\nqh\\r\\nhceo\\r\\ntfcopb\\r\\nmgitfc\\r\\nvddrh\\r\\nmgitfco\\r\\nxf\\r\\nmgitf\\r\\ncyoybe\\r\\notp\\r\\no\\r\\nljwhuyhm\\r\\nysgcy\\r\\nhhenku\\r\\nwl\\r\\ngotp\\r\\nqhv\\r\\nw\\r\\nhenku\\r\\nenku\\r\\nys\\r\\nrilcyo\\r\\nxfklua\\r\\nqhvhhenk\\r\\n|\\r\\n'], 'output': ['adjo|henku\\r\\ncopb|mgitf\\r\\ncyoybe|djo\\r\\nenku|qhvhh\\r\\neo|esgdfmf\\r\\nfkluadjo|o\\r\\ngcyhceo|pb\\r\\ngotp|vddrh\\r\\nhceo|wljwh\\r\\nhhenku|mgi\\r\\njwhuyhm|qh\\r\\njyrpjnpd|r\\r\\nkluadjo|tr\\r\\nljwhuyhm|u\\r\\nmgitfco|wl\\r\\nmgitfc|opb\\r\\notp|rhgotp\\r\\nqhvhhenk|w\\r\\nqhvh|xfklu\\r\\nqhv|rilcyo\\r\\nril|tfcopb\\r\\nuyhm|yhceo\\r\\nvddrhg|vdd\\r\\nvhhenku|xf\\r\\nwljwhu|ybe\\r\\nxfkluadj|x\\r\\nxfklua|yhm\\r\\nysgcyhc|ys\\r\\nysgcy|ysgc\\r\\n']}, {'input': ['76\\r\\nsd\\r\\nwhx\\r\\nk\\r\\nce\\r\\nthm\\r\\nbyfi\\r\\npju\\r\\nbn\\r\\ndz\\r\\non\\r\\nizr\\r\\niswh\\r\\nl\\r\\nwig\\r\\ns\\r\\nju\\r\\nsr\\r\\nie\\r\\nx\\r\\nbth\\r\\nzvi\\r\\nlxth\\r\\ndmzz\\r\\nbnqq\\r\\nan\\r\\ny\\r\\ng\\r\\nvlj\\r\\nc\\r\\nhdu\\r\\nlx\\r\\nwkyd\\r\\ndb\\r\\nrmr\\r\\nrv\\r\\nis\\r\\ngv\\r\\nu\\r\\nbyf\\r\\nm\\r\\nqqb\\r\\nwe\\r\\nb\\r\\ne\\r\\nnioo\\r\\niek\\r\\no\\r\\nymk\\r\\nifpw\\r\\nisw\\r\\nammm\\r\\ncgk\\r\\ncq\\r\\nhhv\\r\\nq\\r\\nat\\r\\nd\\r\\ney\\r\\nn\\r\\nrhq\\r\\ncecg\\r\\nqsh\\r\\nak\\r\\nhx\\r\\nrve\\r\\nlaly\\r\\ni\\r\\nbnsa\\r\\nioou\\r\\nsk\\r\\nkg\\r\\nqshs\\r\\nwzmn\\r\\nupt\\r\\nvwvr\\r\\nyjj\\r\\nN\\r\\n'], 'output': ['akNbth\\r\\nammmNb\\r\\nanNbyf\\r\\natNcgk\\r\\nbnNhdu\\r\\nbnqqNc\\r\\nbnsaNd\\r\\nbyfiNe\\r\\nceNhhv\\r\\ncecgNg\\r\\ncqNiek\\r\\ndbNisw\\r\\ndmzzNi\\r\\ndzNizr\\r\\neyNpju\\r\\ngvNqqb\\r\\nhxNqsh\\r\\nieNrhq\\r\\nifpwNk\\r\\nioouNl\\r\\nisNrmr\\r\\niswhNm\\r\\njuNrve\\r\\nkgNthm\\r\\nlalyNn\\r\\nlxNupt\\r\\nlxthNo\\r\\nniooNq\\r\\nonNvlj\\r\\nqshsNs\\r\\nrvNwhx\\r\\nsdNwig\\r\\nskNyjj\\r\\nsrNymk\\r\\nuNvwvr\\r\\nweNzvi\\r\\nwkydNx\\r\\nwzmnNy\\r\\n']}, {'input': ['10\\r\\npo\\r\\negf\\r\\ne\\r\\ngfuzaqsi\\r\\nsi\\r\\nhpo\\r\\nuldiig\\r\\negfuzaq\\r\\nuldiigh\\r\\nuzaqsi\\r\\n{\\r\\n'], 'output': ['egfuzaq{po\\r\\negf{uldiig\\r\\ne{gfuzaqsi\\r\\nhpo{uzaqsi\\r\\nsi{uldiigh\\r\\n']}, {'input': ['4\\r\\na\\r\\nf\\r\\nz\\r\\nh\\r\\n!\\r\\n'], 'output': ['a!f\\r\\nh!z\\r\\n']}]","id":737} {"difficulty":1700,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"66_D","execute_outcome":"WRONG_ANSWER","source_code":"program Project1;\r\n\r\n{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils,math;\r\n\r\nvar\r\n f:array[0..50] of int64;\r\n n:longint;\r\n i,j:longint;\r\n\r\nbegin\r\n read(n);\r\n f[1]:=6;\r\n f[2]:=10;\r\n f[3]:=15;\r\n f[4]:=12;\r\n if n = 2 then\r\n write(-1)\r\n else\r\n begin\r\n for i:=1 to min(4,n) do\r\n write(f[i],' ');\r\n for i:=5 to n do\r\n begin\r\n f[i]:=f[i-1] + 6;\r\n write(f[i],' ');\r\n end;\r\n end;\r\nend.","description":"Little Petya has a birthday soon. Due this wonderful event, Petya's friends decided to give him sweets. The total number of Petya's friends equals to n.Let us remind you the definition of the greatest common divisor: GCD(a1,...,ak)=d, where d represents such a maximal positive number that each ai (1\u2264i\u2264k) is evenly divisible by d. At that, we assume that all ai's are greater than zero.Knowing that Petya is keen on programming, his friends has agreed beforehand that the 1-st friend gives a1 sweets, the 2-nd one gives a2 sweets, ..., the n-th one gives an sweets. At the same time, for any i and j (1\u2264i,j\u2264n) they want the GCD(ai,aj) not to be equal to 1. However, they also want the following condition to be satisfied: GCD(a1,a2,...,an)=1. One more: all the ai should be distinct.Help the friends to choose the suitable numbers a1,...,an.","input_specification":"The first line contains an integer n (2\u2264n\u226450).\n","output_specification":"If there is no answer, print \"-1\" without quotes. Otherwise print a set of n distinct positive numbers a1,a2,...,an. Each line must contain one number. Each number must consist of not more than 100 digits, and must not contain any leading zeros. If there are several solutions to that problem, print any of them.\nDo not forget, please, that all of the following conditions must be true:\n For every i and j (1\u2264i,j\u2264n): GCD(ai,aj)\u22601 GCD(a1,a2,...,an)=1 For every i and j (1\u2264i,j\u2264n,i\u2260j): ai\u2260aj Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).\n","notes":null,"sample_inputs":["3\n","4\n"],"sample_outputs":["99\n55\n11115\n","385\n360\n792\n8360\n"],"human_solution":"uses Math;\r\ntype chislo=record\r\n z:integer;\r\n m:array [1..1000] of byte;\r\n end;\r\nVar k,n,kol,i:longint;\r\nm:array [1..100] of longint;\r\nc,rez:chislo;\r\nfunction proverka(n:LongInt):boolean;\r\nVar i:longint;\r\nbegin\r\n for i:=2 to n-1 do\r\n if n mod i=0\r\n then begin proverka:=false; exit; end;\r\n proverka:=true;\r\nend;\r\nfunction umn(a,b:chislo):chislo;\r\nVar g,I,j:integer;\r\nres:chislo;\r\nbegin\r\n res.z:=0;\r\n FillChar(res.m,SizeOf(res.m),0);\r\n g:=a.z+b.z;\r\n for i:=1 to b.z do\r\n begin\r\n for j:=1 to a.z do\r\n begin\r\n res.m[j-1+i]:=res.m[j-1+i]+a.m[j]*b.m[i];\r\n if res.m[j+i-1]>9\r\n then begin\r\n res.m[j+i]:=res.m[i+j]+(res.m[j+i-1] div 10);\r\n res.m[j+i-1]:=res.m[j+i-1] mod 10;\r\n end;\r\n end; \r\n end;\r\n for i:=1 to g+1 do\r\n if res.m[i]>9\r\n then begin\r\n res.m[i+1]:=res.m[i+1]+(res.m[i] div 10);\r\n res.m[i]:=res.m[i] mod 10;\r\n end;\r\n i:=g+1;\r\n repeat\r\n dec(i);\r\n until (res.m[i]<>0)or(i=0);\r\n res.z:=i;\r\n umn:=res;\r\nend;\r\nprocedure Del(a:chislo;n:longint);\r\nVar i,z,e:longint;\r\nkk:array [1..1000] of Byte;\r\nbegin\r\n e:=0;\r\n for i:=a.z downto 1 do\r\n begin\r\n inc(e);\r\n kk[e]:=(a.m[i+2]*100+a.m[i+1]*10+a.m[i]) div n;\r\n z:=(a.m[i+2]*100+a.m[i+1]*10+a.m[i]) mod n;\r\n a.m[i+1]:=z div 10;\r\n a.m[i]:=z mod 10;\r\n end;\r\n i:=1;\r\n while kk[i]=0 do\r\n inc(i);\r\n for i:=i to e do\r\n write(kk[i]);\r\n writeln;\r\nend;\r\nbegin\r\n\/\/ Assign(input,'input.txt');\r\n\/\/ assign(Output,'output.txt');\r\n readln(n);\r\n if n=2\r\n then begin writeln(-1); halt(0); end;\r\n kol:=0;\r\n rez.z:=1;\r\n rez.m[1]:=1;\r\n for i:=2 to 1000 do\r\n begin\r\n if proverka(i)\r\n then begin\r\n inc(kol);\r\n m[kol]:=i;\r\n k:=i;\r\n c.z:=0;\r\n while k<>0 do\r\n begin\r\n Inc(c.z);\r\n c.m[c.z]:=k mod 10;\r\n k:=k div 10;\r\n end;\r\n rez:=umn(rez,c);\r\n if kol=n\r\n then break;\r\n end;\r\n end;\r\n for i:=1 to n do\r\n Del(rez,m[i]);\r\nend.","testcases":"[{'input': ['3\\r\\n'], 'output': ['15\\r\\n10\\r\\n6\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['105\\r\\n70\\r\\n42\\r\\n30\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['1155\\r\\n770\\r\\n462\\r\\n330\\r\\n210\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['15015\\r\\n10010\\r\\n6006\\r\\n4290\\r\\n2730\\r\\n2310\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['255255\\r\\n170170\\r\\n102102\\r\\n72930\\r\\n46410\\r\\n39270\\r\\n30030\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['4849845\\r\\n3233230\\r\\n1939938\\r\\n1385670\\r\\n881790\\r\\n746130\\r\\n570570\\r\\n510510\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['111546435\\r\\n74364290\\r\\n44618574\\r\\n31870410\\r\\n20281170\\r\\n17160990\\r\\n13123110\\r\\n11741730\\r\\n9699690\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['3234846615\\r\\n2156564410\\r\\n1293938646\\r\\n924241890\\r\\n588153930\\r\\n497668710\\r\\n380570190\\r\\n340510170\\r\\n281291010\\r\\n223092870\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['100280245065\\r\\n66853496710\\r\\n40112098026\\r\\n28651498590\\r\\n18232771830\\r\\n15427730010\\r\\n11797675890\\r\\n10555815270\\r\\n8720021310\\r\\n6915878970\\r\\n6469693230\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['3710369067405\\r\\n2473579378270\\r\\n1484147626962\\r\\n1060105447830\\r\\n674612557710\\r\\n570826010370\\r\\n436514007930\\r\\n390565164990\\r\\n322640788470\\r\\n255887521890\\r\\n239378649510\\r\\n200560490130\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['-1\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['152125131763605\\r\\n101416754509070\\r\\n60850052705442\\r\\n43464323361030\\r\\n27659114866110\\r\\n23403866425170\\r\\n17897074325130\\r\\n16013171764590\\r\\n13228272327270\\r\\n10491388397490\\r\\n9814524629910\\r\\n8222980095330\\r\\n7420738134810\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['6541380665835015\\r\\n4360920443890010\\r\\n2616552266334006\\r\\n1868965904524290\\r\\n1189341939242730\\r\\n1006366256282310\\r\\n769574195980590\\r\\n688566385877370\\r\\n568815710072610\\r\\n451129701092070\\r\\n422024559086130\\r\\n353588144099190\\r\\n319091739796830\\r\\n304250263527210\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['307444891294245705\\r\\n204963260862830470\\r\\n122977956517698282\\r\\n87841397512641630\\r\\n55899071144408310\\r\\n47299214045268570\\r\\n36169987211087730\\r\\n32362620136236390\\r\\n26734338373412670\\r\\n21203095951327290\\r\\n19835154277048110\\r\\n16618642772661930\\r\\n14997311770451010\\r\\n14299762385778870\\r\\n13082761331670030\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['16294579238595022365\\r\\n10863052825730014910\\r\\n6517831695438008946\\r\\n4655594068170006390\\r\\n2962650770653640430\\r\\n2506858344399234210\\r\\n1917009322187649690\\r\\n1715218867220528670\\r\\n1416919933790871510\\r\\n1123764085420346370\\r\\n1051263176683549830\\r\\n880788066951082290\\r\\n794857523833903530\\r\\n757887406446280110\\r\\n693386350578511590\\r\\n614889782588491410\\r\\n']}, {'input': ['17\\r\\n'], 'output': ['961380175077106319535\\r\\n640920116718070879690\\r\\n384552070030842527814\\r\\n274680050022030377010\\r\\n174796395468564785370\\r\\n147904642319554818390\\r\\n113103550009071331710\\r\\n101197913166011191530\\r\\n83598276093661419090\\r\\n66302081039800435830\\r\\n62024527424329439970\\r\\n51966495950113855110\\r\\n46896593906200308270\\r\\n44715356980330526490\\r\\n40909794684132183810\\r\\n36278497172720993190\\r\\n32589158477190044730\\r\\n']}, {'input': ['18\\r\\n'], 'output': ['58644190679703485491635\\r\\n39096127119802323661090\\r\\n23457676271881394196654\\r\\n16755483051343852997610\\r\\n10662580123582451907570\\r\\n9022183181492843921790\\r\\n6899316550553351234310\\r\\n6173072703126682683330\\r\\n5099494841713346564490\\r\\n4044426943427826585630\\r\\n3783496172884095838170\\r\\n3169956252956945161710\\r\\n2860692228278218804470\\r\\n2727636775800162115890\\r\\n2495497475732063212410\\r\\n2212988327535980584590\\r\\n1987938667108592728530\\r\\n1922760350154212639070\\r\\n']}, {'input': ['19\\r\\n'], 'output': ['3929160775540133527939545\\r\\n2619440517026755685293030\\r\\n1571664310216053411175818\\r\\n1122617364440038150839870\\r\\n714392868280024277807190\\r\\n604486273160020542759930\\r\\n462254208887074532698770\\r\\n413595871109487739783110\\r\\n341666154394794219820830\\r\\n270976605209664381237210\\r\\n253494243583234421157390\\r\\n212387068948115325834570\\r\\n191666379294640659899490\\r\\n182751663978610861764630\\r\\n167198330874048235231470\\r\\n148270217944910699167530\\r\\n133191890696275712811510\\r\\n128824943460332246817690\\r\\n117288381359406970983270\\r\\n']}]","id":738} {"difficulty":2400,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"758_F","execute_outcome":"RUNTIME_ERROR","source_code":"program ps; {$Q+ $R+}\r\n\r\nvar i, j, n, x, y, m, l, r: longint; k: int64;\r\n\r\nfunction nod(a, b: longint): longint;\r\nbegin\r\n if b = 0 then nod := a else nod := nod(b, a mod b);\r\nend;\r\n\r\nfunction sqrtn(n, r: longint): int64;\r\nvar i, j: longint; b: boolean; k: int64;\r\nbegin\r\n i := 1; b := true;\r\n while b do\r\n begin\r\n inc(i);\r\n k := 1;\r\n for j := 1 to n do\r\n if k <= r then\r\n k := k * i;\r\n b := k <= r;\r\n end;\r\n sqrtn := i - 1;\r\nend;\r\n\r\nfunction st(x, n: longint): int64;\r\nvar i, j: longint;\r\nbegin\r\n j := 1;\r\n for i := 1 to n do\r\n j := j * x;\r\n st := j;\r\nend;\r\n\r\nbegin\r\n {assign(input, 'input.txt'); reset(input);\r\n assign(output, 'output.txt'); rewrite(output);}\r\n read(n, l, r);\r\n if n < 3 then\r\n begin\r\n if n = 1 then write(r - l + 1)\r\n else write((r - l + 1)*(r - l));\r\n halt(0);\r\n end;\r\n m := sqrtn(n - 1, r);\r\n k := 0;\r\n for y := 1 to m do\r\n for x := y + 1 to m do\r\n if nod(x, y) = 1 then\r\n if (r div st(x, n - 1)) - ((l - 1) div st(y, n - 1)) >= 0 then\r\n k := k + (r div st(x, n - 1)) - ((l - 1) div st(y, n - 1));\r\n write(k*2);\r\nend.\r\n","description":"For given n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l and not greater than r. In other words, for each progression the following must hold: l\u2264ai\u2264r and ai\u2260aj , where a1,a2,...,an is the geometrical progression, 1\u2264i,j\u2264n and i\u2260j.Geometrical progression is a sequence of numbers a1,a2,...,an where each term after first is found by multiplying the previous one by a fixed non-zero number d called the common ratio. Note that in our task d may be non-integer. For example in progression 4,6,9, common ratio is .Two progressions a1,a2,...,an and b1,b2,...,bn are considered different, if there is such i (1\u2264i\u2264n) that ai\u2260bi.","input_specification":"The first and the only line cotains three integers n, l and r (1\u2264n\u226410^7,1\u2264l\u2264r\u226410^7).\n","output_specification":"Print the integer K\u00a0\u2014 is the answer to the problem.\n","notes":"These are possible progressions for the first test of examples: \n 1; 2; 3; 4; 5; 6; 7; 8; 9; 10. These are possible progressions for the second test of examples: \n 6,7; 6,8; 6,9; 7,6; 7,8; 7,9; 8,6; 8,7; 8,9; 9,6; 9,7; 9,8. These are possible progressions for the third test of examples: \n 1,2,4; 1,3,9; 2,4,8; 4,2,1; 4,6,9; 8,4,2; 9,3,1; 9,6,4. These are possible progressions for the fourth test of examples: \n 4,6,9; 9,6,4. ","sample_inputs":["1 1 10\n","2 6 9\n","3 1 10\n","3 3 10\n"],"sample_outputs":["10","12","8","2"],"human_solution":"\r\n const nn=6000000; nnn=2000000;eps=0.00000001; besk1=200000008;\r\n label 1,2;\r\n type { real=double;} {string=ansistring;}\r\n mas=array [-10000..nn] of int64; point=record x,y,z:real;end;\r\n zap=record p1,p2,p3 :int64;end; zap1=^zap;\r\n mass=array[0..nn] of longint;mass1=^mass;\r\n var right,left,t1,t2,kol,pp,t,aa,bb,cc,p1,p2,kolx,kolo,l,ot,nm,n,s1,s2,m,s,imax,smin,cen,dl,i1,p,prost,besk:int64;\r\n k,step, ii,i,j:longint;\r\n sss:array[-10..10000] of char;\r\n sssnew:array[-10..1000] of char;\r\n zan2,zan1:array[0..1000,0..1000] of boolean;\r\n x,a,b:array[-10..2000000] of int64;\r\n masstep,dda,ddb:array[-10..12000,-1..120] of int64;\r\n ss1,ss2:string;\r\n ss:string;ch:char;\r\n maxpr:array[0..nn] of string;\r\n st2:array[0..nnn] of string;\r\n vol,h0,h1,v0,v1,s0,t0:extended;\r\n zv:point;\r\n xx,yy,y:array[-1..10000000] of int64;\r\n yot:double;\r\n flag,flag1:boolean;\r\n function al(x,y:real):real; var t0,t1,p,s0,s1:real;\r\n begin\r\n if (x>0)and(y>=0) then p:=arctan(y\/x);\r\n if x<0 then p:=pi+arctan(y\/x);\r\n if(x>0)and(y<0) then p:=2*pi+arctan(y\/x);\r\n if x=0 then if (y>=0) then p:=pi\/2 else p:=3*pi\/2;\r\n al:=p\/pi*180;\r\n end;\r\n function min(x,y:int64):int64;begin min:=x;if yx then max:=y; end;\r\n\r\n function nod(x,y:int64):int64; var z:int64;\r\nbegin repeat z:=x mod y;x:=y;y:=z; until z=0 ; nod:=x;end;\r\n\r\n function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;\r\n tt:zap; tt1:zap1;\r\nbegin\r\n if a0 do\r\n begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;\r\n a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;\r\n\r\n\r\n end;\r\n d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;\r\n evkl:=tt1;\r\nend;\r\n\r\n\r\n\r\n\r\nfunction degg(a,k:int64):int64; var p:int64;\r\nbegin\r\n if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a else\r\n begin p:=degg(a,k div 2); degg:=p*p end;\r\n\r\nend;\r\n\r\n\r\n\r\nbegin\r\n { assign (input,'input.txt');reset(input);\r\n assign (output,'output.txt'); rewrite(output);\r\n }\r\n\r\n readln(n,aa,bb);\r\n if n=1 then\r\n begin\r\n writeln(bb-aa+1);\r\n goto 1;\r\n\r\n end;\r\n\r\n if n=2 then\r\n begin\r\n t:=bb-aa;\r\n writeln(t*(t+1));\r\n goto 1;\r\n\r\n end;\r\n\r\n\r\n\r\n for step:=1 to 30 do\r\n begin\r\n\r\n for i:=1 to 3200 do\r\n begin\r\n masstep[i,step]:= degg(i,step);\r\n if masstep[i,step]>bb then begin x[step]:=i;break; end;\r\n\r\n end;\r\n\r\n\r\n end;\r\n\r\n { for i:=2 to 30 do\r\n begin\r\n for j:=1 to x[i] do write(masstep[i,j],' '); writeln;\r\n\r\n end;\r\n }\r\n for i:=1 to 3200 do for j:=i+1 to 3200 do\r\n if (masstep[i,n-1]>=1)and(masstep[i,n-1]<=bb)\r\n and(masstep[j,n-1]>=1)and(masstep[j,n-1]<=bb)\r\n then\r\n begin\r\n inc(pp); xx[pp]:=i; yy[pp]:=j;\r\n end;\r\n {\r\n writeln(pp);\r\n for i:=1 to pp do writeln(xx[i],' ',yy[i]);\r\n\r\n writeln('----------');\r\n\r\n for i:=1 to pp do writeln(masstep[xx[i],n-1],' ',masstep[yy[i],n-1]);\r\n\r\n writeln('----------');\r\n }\r\n for i:=1 to pp do\r\n begin\r\n p1:=masstep[xx[i],n-1];\r\n p2:=masstep[yy[i],n-1];\r\n right:=bb div p2;\r\n { writeln('p1= ',p1,' p2= ',p2);\r\n } left:=max((aa+p1-1) div p1,1);\r\n kol:=right-left+1;\r\n if kol<0 then kol:=0;\r\n { for j:=left to right do\r\n begin\r\n zan1[p1*j,p2*j]:=true;\r\n writeln(p1*j,' ',p2*j,' ot= ',ot);\r\n inc(ot);\r\n end;\r\n writeln(p1,' -- ',p2,' left= ',left,' right= ',right,' kol= ',kol);\r\n writeln;\r\n } if nod(p1,p2)=1 then ot:=ot+kol;\r\n\r\n\r\n end;\r\n\r\n writeln(ot*2);\r\n goto 1;\r\n ot:=0;\r\n if n=3 then\r\n begin\r\n for i:=aa to bb do\r\n for j:=i+1 to bb do\r\n for k:=j+1 to bb do if i*k=j*j\r\n then\r\n begin\r\n writeln(i,' ',j,' ',k);\r\n inc(ot);\r\n zan2[i,k]:=true;\r\n end;\r\n\r\n writeln(ot);\r\n\r\n end;\r\n\r\n\r\n for i:=0 to 1000 do for j:=0 to 1000 do\r\n if zan1[i,j]<>zan2[i,j] then writeln('bad ',i,' ',j);\r\n\r\n for i:=0 to 1000 do for j:=0 to 1000 do if zan1[i,j] then\r\n writeln('zan ', i,' ',j);\r\n\r\n for i:=1 to 40 do\r\n begin for j:=1 to 40 do if zan1[i,j] then write('+') else write('-'); writeln; end;\r\n writeln('*************************');\r\n\r\n\r\n for i:=1 to 40 do\r\n begin for j:=1 to 40 do if zan2[i,j] then write('+') else write('-'); writeln; end;\r\n writeln('************************');\r\n\r\n\r\n\r\n 1: close(output);\r\nend.\r\n\r\n\r\n\r\n","testcases":"[{'input': ['1 1 10\\r\\n'], 'output': ['10']}, {'input': ['2 6 9\\r\\n'], 'output': ['12']}, {'input': ['3 1 10\\r\\n'], 'output': ['8']}, {'input': ['3 3 10\\r\\n'], 'output': ['2']}, {'input': ['1 25 845\\r\\n'], 'output': ['821']}, {'input': ['2 25 845\\r\\n'], 'output': ['673220']}, {'input': ['3 25 845\\r\\n'], 'output': ['2150']}, {'input': ['4 25 845\\r\\n'], 'output': ['324']}, {'input': ['5 25 845\\r\\n'], 'output': ['84']}, {'input': ['6 25 845\\r\\n'], 'output': ['10']}, {'input': ['7 25 845\\r\\n'], 'output': ['2']}, {'input': ['8 25 845\\r\\n'], 'output': ['0']}, {'input': ['1 1 10000000\\r\\n'], 'output': ['10000000']}, {'input': ['2 1 10000000\\r\\n'], 'output': ['99999990000000']}, {'input': ['3 1 10000000\\r\\n'], 'output': ['89371160']}, {'input': ['4 1 10000000\\r\\n'], 'output': ['7299492']}, {'input': ['5 1 10000000\\r\\n'], 'output': ['2209708']}, {'input': ['6 1 10000000\\r\\n'], 'output': ['875204']}, {'input': ['7 1 10000000\\r\\n'], 'output': ['384900']}, {'input': ['8 1 10000000\\r\\n'], 'output': ['178350']}, {'input': ['9 1 10000000\\r\\n'], 'output': ['85060']}, {'input': ['10 1 10000000\\r\\n'], 'output': ['41286']}, {'input': ['11 1 10000000\\r\\n'], 'output': ['20250']}, {'input': ['12 1 10000000\\r\\n'], 'output': ['9996']}, {'input': ['13 1 10000000\\r\\n'], 'output': ['4954']}, {'input': ['14 1 10000000\\r\\n'], 'output': ['2464']}, {'input': ['15 1 10000000\\r\\n'], 'output': ['1228']}, {'input': ['16 1 10000000\\r\\n'], 'output': ['610']}, {'input': ['17 1 10000000\\r\\n'], 'output': ['304']}, {'input': ['18 1 10000000\\r\\n'], 'output': ['152']}, {'input': ['19 1 10000000\\r\\n'], 'output': ['76']}, {'input': ['20 1 10000000\\r\\n'], 'output': ['38']}, {'input': ['21 1 10000000\\r\\n'], 'output': ['18']}, {'input': ['22 1 10000000\\r\\n'], 'output': ['8']}, {'input': ['23 1 10000000\\r\\n'], 'output': ['4']}, {'input': ['24 1 10000000\\r\\n'], 'output': ['2']}, {'input': ['25 1 10000000\\r\\n'], 'output': ['0']}, {'input': ['123456 1 10000000\\r\\n'], 'output': ['0']}, {'input': ['10000000 1 10000000\\r\\n'], 'output': ['0']}, {'input': ['1 10000000 10000000\\r\\n'], 'output': ['1']}, {'input': ['2 10000000 10000000\\r\\n'], 'output': ['0']}, {'input': ['10000000 10000000 10000000\\r\\n'], 'output': ['0']}, {'input': ['1 5000000 10000000\\r\\n'], 'output': ['5000001']}, {'input': ['2 5000000 10000000\\r\\n'], 'output': ['25000005000000']}, {'input': ['3 5000000 10000000\\r\\n'], 'output': ['7065044']}, {'input': ['4 5000000 10000000\\r\\n'], 'output': ['117250']}, {'input': ['5 5000000 10000000\\r\\n'], 'output': ['4674']}, {'input': ['6 5000000 10000000\\r\\n'], 'output': ['194']}, {'input': ['7 5000000 10000000\\r\\n'], 'output': ['8']}, {'input': ['8 5000000 10000000\\r\\n'], 'output': ['0']}, {'input': ['1000 5000000 10000000\\r\\n'], 'output': ['0']}, {'input': ['1 100 1000000\\r\\n'], 'output': ['999901']}, {'input': ['2 100 1000000\\r\\n'], 'output': ['999801009900']}, {'input': ['3 100 1000000\\r\\n'], 'output': ['7474368']}, {'input': ['4 100 1000000\\r\\n'], 'output': ['715006']}, {'input': ['5 100 1000000\\r\\n'], 'output': ['217914']}, {'input': ['6 100 1000000\\r\\n'], 'output': ['86100']}, {'input': ['7 100 1000000\\r\\n'], 'output': ['37648']}, {'input': ['8 100 1000000\\r\\n'], 'output': ['17266']}, {'input': ['9 100 1000000\\r\\n'], 'output': ['8066']}, {'input': ['10 100 1000000\\r\\n'], 'output': ['3814']}, {'input': ['11 100 1000000\\r\\n'], 'output': ['1786']}, {'input': ['12 100 1000000\\r\\n'], 'output': ['788']}, {'input': ['13 100 1000000\\r\\n'], 'output': ['292']}, {'input': ['14 100 1000000\\r\\n'], 'output': ['46']}, {'input': ['15 100 1000000\\r\\n'], 'output': ['0']}, {'input': ['16 100 1000000\\r\\n'], 'output': ['0']}, {'input': ['17 100 1000000\\r\\n'], 'output': ['0']}, {'input': ['1 1 1\\r\\n'], 'output': ['1']}, {'input': ['10000000 1 1\\r\\n'], 'output': ['0']}, {'input': ['1 123 456789\\r\\n'], 'output': ['456667']}, {'input': ['2 123 456789\\r\\n'], 'output': ['208544292222']}, {'input': ['3 123 456789\\r\\n'], 'output': ['3172916']}, {'input': ['4 123 456789\\r\\n'], 'output': ['321710']}, {'input': ['5 123 456789\\r\\n'], 'output': ['98144']}, {'input': ['6 123 456789\\r\\n'], 'output': ['38632']}, {'input': ['7 123 456789\\r\\n'], 'output': ['16734']}, {'input': ['8 123 456789\\r\\n'], 'output': ['7566']}, {'input': ['9 123 456789\\r\\n'], 'output': ['3480']}, {'input': ['10 123 456789\\r\\n'], 'output': ['1588']}, {'input': ['11 123 456789\\r\\n'], 'output': ['662']}, {'input': ['12 123 456789\\r\\n'], 'output': ['206']}, {'input': ['13 123 456789\\r\\n'], 'output': ['0']}, {'input': ['1 1 5000000\\r\\n'], 'output': ['5000000']}, {'input': ['2 1 5000000\\r\\n'], 'output': ['24999995000000']}, {'input': ['3 1 5000000\\r\\n'], 'output': ['42582108']}, {'input': ['4 1 5000000\\r\\n'], 'output': ['3640680']}, {'input': ['5 1 5000000\\r\\n'], 'output': ['1104328']}, {'input': ['6 1 5000000\\r\\n'], 'output': ['437484']}, {'input': ['7 1 5000000\\r\\n'], 'output': ['192426']}, {'input': ['8 1 5000000\\r\\n'], 'output': ['89168']}, {'input': ['9 1 5000000\\r\\n'], 'output': ['42518']}, {'input': ['10 1 5000000\\r\\n'], 'output': ['20638']}, {'input': ['11 1 5000000\\r\\n'], 'output': ['10116']}, {'input': ['12 1 5000000\\r\\n'], 'output': ['4998']}, {'input': ['13 1 5000000\\r\\n'], 'output': ['2476']}, {'input': ['14 1 5000000\\r\\n'], 'output': ['1232']}, {'input': ['15 1 5000000\\r\\n'], 'output': ['614']}, {'input': ['16 1 5000000\\r\\n'], 'output': ['304']}, {'input': ['17 1 5000000\\r\\n'], 'output': ['152']}, {'input': ['18 1 5000000\\r\\n'], 'output': ['76']}, {'input': ['19 1 5000000\\r\\n'], 'output': ['38']}, {'input': ['20 1 5000000\\r\\n'], 'output': ['18']}, {'input': ['21 1 5000000\\r\\n'], 'output': ['8']}, {'input': ['22 1 5000000\\r\\n'], 'output': ['4']}, {'input': ['23 1 5000000\\r\\n'], 'output': ['2']}, {'input': ['24 1 5000000\\r\\n'], 'output': ['0']}, {'input': ['25 1 5000000\\r\\n'], 'output': ['0']}, {'input': ['2 1 1\\r\\n'], 'output': ['0']}]","id":739} {"difficulty":2300,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"78_E","execute_outcome":"WRONG_ANSWER","source_code":"{$R+,Q+,I+}\r\n{$apptype console}\r\nUses SysUtils;\r\nConst\r\n cifr=['0'..'9'];\r\nVar\r\n a,b:Array[0..30,0..30] of Char;\r\n used,h:Array[0..30,0..30] of Boolean;\r\n s:Array[0..1000,0..1000] of Boolean;\r\n used1:Array[0..1000] of Boolean;\r\n d,d1:Array[0..30,0..30] of Integer;\r\n q1,q2,mt:Array[0..1000] of Integer;\r\n i,j,i1,j1,i2,j2,n,t,l,r,x1,y1,x2,x3,ans:Integer;\r\nFunction Kuhn(v:Integer):Boolean;\r\nVar i:Integer;\r\nBegin\r\n If used1[v] Then Begin\r\n Kuhn:=false;\r\n Exit;\r\n End;\r\n used1[v]:=true;\r\n For i:=1 To 900 Do\r\n If (s[v,i]) and ((mt[i]=-1) or (Kuhn(mt[i]))) Then Begin\r\n mt[i]:=v;\r\n Kuhn:=true;\r\n Exit;\r\n End;\r\n Kuhn:=false;\r\nEnd;\r\nBegin\r\n ReadLn(n,t);\r\n For i:=1 To n Do Begin\r\n For j:=1 To n Do Read(a[i,j]);\r\n ReadLn;\r\n End;\r\n ReadLn;\r\n For i:=1 To n Do Begin\r\n For j:=1 To n Do Read(b[i,j]);\r\n ReadLn;\r\n End;\r\n x1:=0;\r\n y1:=0;\r\n For i:=1 To n Do\r\n For j:=1 To n Do\r\n If a[i,j]='Z' Then Begin\r\n x1:=i;\r\n y1:=j;\r\n Break;\r\n End;\r\n For i:=1 To n Do\r\n For j:=1 To n Do d[i,j]:=3000;\r\n q1[1]:=x1;\r\n q2[1]:=y1;\r\n used[x1,y1]:=true;\r\n d[x1,y1]:=0;\r\n l:=0;\r\n r:=1;\r\n While l0) and (q1[l]+i1<=n) and (q2[l]+j1>0) and (q2[l]+j1<=n) and (a[q1[l]+i1,q2[l]+j1] in cifr) and (not(used[q1[l]+i1,q2[l]+j1])) Then Begin\r\n r:=r+1;\r\n q1[r]:=q1[l]+i1;\r\n q2[r]:=q2[l]+j1;\r\n used[q1[r],q2[r]]:=true;\r\n d[q1[r],q2[r]]:=d[q1[l],q2[l]]+1;\r\n End;\r\n End;\r\n End;\r\n For i:=1 To n Do\r\n For j:=1 To n Do\r\n If (a[i,j] in cifr) and (a[i,j]<>'0') Then Begin\r\n For i1:=1 To n Do\r\n For j1:=1 To n Do used[i1,j1]:=false;\r\n For i1:=1 To n Do\r\n For j1:=1 To n Do h[i1,j1]:=false;\r\n q1[1]:=i;\r\n q2[1]:=j;\r\n used[i,j]:=true;\r\n h[i,j]:=true;\r\n d1[i,j]:=0;\r\n l:=0;\r\n r:=1;\r\n While l0) and (q1[l]+i1<=n) and (q2[l]+j1>0) and (q2[l]+j1<=n) and (a[q1[l]+i1,q2[l]+j1] in cifr) and (not(used[q1[l]+i1,q2[l]+j1])) and (d1[q1[l],q2[l]]=d[q1[l]+i1,q2[l]+j1] Then Continue;\r\n If d1[q1[l],q2[l]]+1=d[q1[l]+i1,q2[l]+j1] Then Begin\r\n h[q1[l]+i1,q2[l]+j1]:=true;\r\n Continue;\r\n End;\r\n r:=r+1;\r\n q1[r]:=q1[l]+i1;\r\n q2[r]:=q2[l]+j1;\r\n used[q1[r],q2[r]]:=true;\r\n h[q1[r],q2[r]]:=true;\r\n d1[q1[r],q2[r]]:=d1[q1[l],q2[l]]+1;\r\n End;\r\n End;\r\n End;\r\n x2:=10*((i-1)*n+j-1)+1;\r\n For i1:=1 To n Do\r\n For j1:=1 To n Do\r\n If (h[i1,j1]) and (b[i1,j1]<>'0') Then Begin\r\n x3:=10*((i1-1)*n+j1-1)+1;\r\n For i2:=x2 To x2+strtoint(a[i,j])-1 Do\r\n For j2:=x3 To x3+strtoint(b[i1,j1])-1 Do s[i2,j2]:=true;\r\n End;\r\n End;\r\n For i:=1 To 900 Do mt[i]:=-1;\r\n ans:=0;\r\n For i:=1 To 900 Do Begin\r\n For j:=1 To 900 Do used1[j]:=false;\r\n If Kuhn(i) Then ans:=ans+1;\r\n End;\r\n Write(ans);\r\nEnd.\r\n\r\n\r\n\r\n\r\n\r\n","description":"They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.The station is represented by a square n\u00d7n divided into 1\u00d71 blocks. Each block is either a reactor or a laboratory. There can be several reactors and exactly one of them will explode soon. The reactors can be considered impassable blocks, but one can move through laboratories. Between any two laboratories, which are in adjacent blocks, there is a corridor. Blocks are considered adjacent if they have a common edge.In each laboratory there is some number of scientists and some number of rescue capsules. Once the scientist climbs into a capsule, he is considered to be saved. Each capsule has room for not more than one scientist.The reactor, which is about to explode, is damaged and a toxic coolant trickles from it into the neighboring blocks. The block, which contains the reactor, is considered infected. Every minute the coolant spreads over the laboratories through corridors. If at some moment one of the blocks is infected, then the next minute all the neighboring laboratories also become infected. Once a lab is infected, all the scientists there that are not in rescue capsules die. The coolant does not spread through reactor blocks.There are exactly t minutes to the explosion. Any scientist in a minute can move down the corridor to the next lab, if it is not infected. On any corridor an unlimited number of scientists can simultaneously move in both directions. It is believed that the scientists inside a lab moves without consuming time. Moreover, any scientist could get into the rescue capsule instantly. It is also believed that any scientist at any given moment always has the time to perform their actions (move from the given laboratory into the next one, or climb into the rescue capsule) before the laboratory will be infected.Find the maximum number of scientists who will be able to escape.","input_specification":"The first line contains two integers n and t (2\u2264n\u226410, 1\u2264t\u226460). Each of the next n lines contains n characters. These lines describe the scientists' locations. Then exactly one empty line follows. Each of the next n more lines contains n characters. These lines describe the rescue capsules' locations.\nIn the description of the scientists' and the rescue capsules' locations the character \"Y\" stands for a properly functioning reactor, \"Z\" stands for the malfunctioning reactor. The reactors' positions in both descriptions coincide. There is exactly one malfunctioning reactor on the station. The digits \"0\" - \"9\" stand for the laboratories. In the description of the scientists' locations those numbers stand for the number of scientists in the corresponding laboratories. In the rescue capsules' descriptions they stand for the number of such capsules in each laboratory.\n","output_specification":"Print a single number \u2014 the maximum number of scientists who will manage to save themselves.\n","notes":"In the second sample the events could take place as follows: \n \n","sample_inputs":["3 3\n1YZ\n1YY\n100\n\n0YZ\n0YY\n003\n","4 4\nY110\n1Y1Z\n1Y0Y\n0100\n\nY001\n0Y0Z\n0Y0Y\n0005\n"],"sample_outputs":["2","3"],"human_solution":"{$O-}\r\nUses Math, SysUtils;\r\ntype\r\n\tint = longint;\r\n\tbool = boolean;\r\nconst\r\n inf = maxint;\r\n ux : array [1..4] of int = (1, 0, -1, 0);\r\n uy : array [1..4] of int = (0, -1, 0, 1);\r\nvar\r\n\tmn, res, x, y, len, i, j, ii, jj, k, tt, t, n : int;\r\n\tcan : array [0..61,0..11,0..11,0..11,0..11] of bool;\r\n\td, a, b : array [0..11,0..11] of int;\r\n\tqx, qy, s, q : array [0..301] of int;\r\n\tf, p, u, v, next, w : array [0..50001] of int;\r\n used : array [0..301] of bool;\r\n\twas : array [0..11,0..11] of bool;\r\n\r\nprocedure scanf;\r\nvar\r\n\tc : char;\r\nbegin\r\n\treadln(n, t);\r\n\tfor i := 1 to n do begin\r\n\tfor j := 1 to n do begin\r\n\t\tread(c);\r\n\t\ta[i][j] := ord(c)-ord('0');\r\n\t\tif (c = 'Y') then a[i][j] := -1 else\r\n\t\tif (c = 'Z') then begin\r\n\t\t\ta[i][j] := -1; \r\n\t\t\tqx[1] := i;\r\n\t\t\tqy[1] := j;\r\n\t\tend;\r\n\tend;\r\n\t\treadln;\r\n\tend;\r\n readln;\r\n\tfor i := 1 to n do begin\r\n\tfor j := 1 to n do begin\r\n\t\tread(c);\r\n\t\tb[i][j] := ord(c)-ord('0');\r\n\t\tif (c in['Y','Z']) then b[i][j] := -1;\r\n\tend;\r\n\t\treadln;\r\n\tend;\r\nend;\r\nprocedure bfs;\r\nbegin\r\n\twas[qx[1]][qy[1]] := true;\r\n for i := 1 to n do\r\n for j := 1 to n do\r\n d[i][j] := inf;\r\n d[qx[1]][qy[1]] := 0;\r\n\ti := 1; j := 1;\r\n\twhile (i <= j) do begin\r\n\t\tfor k := 1 to 4 do begin\r\n\t\t\tx := qx[i] + ux[k];\r\n\t\t\ty := qy[i] + uy[k];\r\n\t\t\tif (not was[x][y]) and (a[x][y] <> -1) and (1 <= x) and (x <= n) and (1 <= y) and (y <= n) then begin\r\n\t\t\t\tinc(j);\r\n\t\t\t\tqx[j] := x;\r\n\t\t\t\tqy[j] := y;\r\n\t\t\t\twas[x][y] := true;\r\n\t\t\t\td[x][y] := d[qx[i]][qy[i]] + 1;\r\n\t\t\tend;\r\n\t\tend;\r\n\t\tinc(i);\r\n\tend;\r\nend;\r\nprocedure precalc;\r\nbegin\r\n\tfor i := 1 to n do\r\n\tfor j := 1 to n do\r\n if (a[i][j] <> -1) then\r\n \t\tcan[0][i][j][i][j] := true;\r\n\tfor tt := 1 to t do\r\n\tfor i := 1 to n do\r\n\tfor j := 1 to n do begin\r\n\t\tif (a[i][j] = -1) then continue;\r\n\t\tfor ii := 1 to n do\r\n\t\tfor jj := 1 to n do begin\r\n if (tt > d[ii][jj]) or (a[ii][jj] = -1) then continue;\r\n\t\tfor k := 1 to 4 do begin\r\n\t\t\tx := ii + ux[k];\r\n\t\t\ty := jj + uy[k];\r\n\t\t\tif (tt-1 < d[x][y]) and (1 <= x) and (x <= n) and (1 <= y) and (y <= n) and (can[tt-1][i][j][x][y]) then begin\r\n\t\t\t\tcan[tt][i][j][ii][jj] := true;\r\n\t\t\t\tbreak;\r\n\t\t\tend;\r\n\t\tend;\r\n end;\r\n\tend;\r\nend;\r\nprocedure add(x, y, z : int);\r\nbegin\r\n\tinc(len);\r\n\tv[len] := y;\r\n\tnext[len] := s[x];\r\n\tw[len] := z;\r\n\ts[x] := len;\r\nend;\r\nprocedure findpath(x, y : int);\r\nvar\r\n rev : int;\r\nbegin\r\n\twhile (x <> 0) do begin\r\n\t\tmn := min(mn, w[x]-f[x]);\r\n\t\tx := p[x];\r\n\tend;\r\n\twhile (y <> 0) do begin\r\n\t\tif (y and 1 = 1) then rev := y + 1\r\n\t\telse rev := y - 1;\r\n\t\tf[y] := f[y] + mn;\r\n\t\tf[rev] := f[rev] - mn;\r\n\t\ty := p[y];\r\n\tend;\r\nend;\r\nprocedure bfsflow;\r\nvar\r\n pos : int;\r\nbegin\r\n\ti := 1; j := 1;\r\n\tfillchar(used, sizeof(used), false);\r\n\tq[1] := 0; used[0] := true;\r\n\twhile (i <= j) do begin\r\n\t\tpos := s[q[i]];\r\n\t\twhile (pos <> 0) do begin\r\n\t\t\tif (not used[v[pos]]) and (w[pos]-f[pos] > 0) then begin\r\n\t\t\t\tinc(j);\r\n\t\t\t\tq[j] := v[pos];\r\n\t\t\t\tused[q[j]] := true;\r\n\t\t\t\tu[j] := pos;\r\n\t\t\t\tp[pos] := u[i];\r\n\t\t\t\tif (q[j] = 2*n*n+1) then begin\r\n\t\t\t\t\tfindpath(pos, pos);\r\n\t\t\t\t\texit;\r\n\t\t\t\tend;\r\n\t\t\tend;\r\n\t\t\tpos := next[pos];\r\n\t\tend;\r\n\t\tinc(i);\r\n\tend;\r\nend;\r\nprocedure flow;\r\nbegin\r\n\tfor i := 1 to n do\r\n\tfor j := 1 to n do begin\r\n if (a[i][j] > 0) then begin\r\n\t \tadd(0, (i-1)*n+j, a[i][j]);\r\n \t\tadd((i-1)*n+j, 0, 0);\r\n end;\r\n if (b[i][j] > 0) then begin\r\n\t\t add(n*n+(i-1)*n+j, 2*n*n+1, b[i][j]);\r\n\t \tadd(2*n*n+1, n*n+i*(n-1)+j, 0);\r\n \tend;\r\n end;\r\n\tfor i := 1 to n do\r\n\tfor j := 1 to n do\r\n\tfor ii := 1 to n do\r\n\tfor jj := 1 to n do\r\n\tfor tt := 0 to t do\r\n\t\tif (can[tt][i][j][ii][jj]) and (b[ii][jj] > 0) and (a[i][j] > 0) then begin\r\n\t\t\tadd((i-1)*n+j, n*n+(ii-1)*n+jj, inf);\r\n\t\t\tadd(n*n+(ii-1)*n+jj, (i-1)*n+j, 0);\r\n break;\r\n\t\tend;\r\n\tres := 0;\r\n\twhile (true) do begin\r\n\t\tmn := inf;\r\n\t\tbfsflow;\r\n\t\tif (mn = inf) then begin\r\n\t\t\twrite(res);\r\n\t\t\thalt;\r\n\t\tend;\r\n\t\tres := res + mn;\r\n\tend;\r\nend;\r\nbegin\r\n\/\/\treset(input, 'a.in'); rewrite(output, 'a.out');\r\n\tscanf;\r\n\tbfs;\r\n\tprecalc;\r\n\tflow;\r\nend.","testcases":"[{'input': ['3 3\\r\\n1YZ\\r\\n1YY\\r\\n100\\r\\n\\r\\n0YZ\\r\\n0YY\\r\\n003\\r\\n'], 'output': ['2']}, {'input': ['4 4\\r\\nY110\\r\\n1Y1Z\\r\\n1Y0Y\\r\\n0100\\r\\n\\r\\nY001\\r\\n0Y0Z\\r\\n0Y0Y\\r\\n0005\\r\\n'], 'output': ['3']}, {'input': ['3 10\\r\\n111\\r\\nYZY\\r\\n111\\r\\n\\r\\n000\\r\\nYZY\\r\\n009\\r\\n'], 'output': ['2']}, {'input': ['2 1\\r\\nZ2\\r\\n20\\r\\n\\r\\nZ1\\r\\n12\\r\\n'], 'output': ['4']}, {'input': ['3 4\\r\\nZY2\\r\\n0Y3\\r\\n0Y4\\r\\n\\r\\nZY0\\r\\n9Y0\\r\\n9Y0\\r\\n'], 'output': ['0']}, {'input': ['3 8\\r\\n001\\r\\n0Z0\\r\\n102\\r\\n\\r\\n000\\r\\n0Z0\\r\\n000\\r\\n'], 'output': ['0']}, {'input': ['6 7\\r\\n20Y00Y\\r\\nY0Y0Z1\\r\\n1020Y0\\r\\n04Y5Y0\\r\\nYYY00Y\\r\\n4Y0070\\r\\n\\r\\n60Y13Y\\r\\nY0Y2Z1\\r\\n0000Y8\\r\\n10Y0Y5\\r\\nYYY00Y\\r\\n3Y1000\\r\\n'], 'output': ['12']}, {'input': ['5 13\\r\\nZ110Y\\r\\nY00Y0\\r\\n00Y00\\r\\n0Y000\\r\\n000Y0\\r\\n\\r\\nZ000Y\\r\\nY00Y0\\r\\n00Y00\\r\\n0Y000\\r\\n000Y2\\r\\n'], 'output': ['1']}, {'input': ['2 1\\r\\nZY\\r\\nY1\\r\\n\\r\\nZY\\r\\nY9\\r\\n'], 'output': ['1']}, {'input': ['2 5\\r\\n01\\r\\n0Z\\r\\n\\r\\n00\\r\\n1Z\\r\\n'], 'output': ['0']}, {'input': ['2 15\\r\\nZ9\\r\\n99\\r\\n\\r\\nZ9\\r\\n99\\r\\n'], 'output': ['27']}, {'input': ['10 60\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n99999999Z9\\r\\n9999999999\\r\\n9999999999\\r\\n\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n99999999Z9\\r\\n9999999999\\r\\n9999999999\\r\\n'], 'output': ['891']}, {'input': ['10 60\\r\\nZ999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n9999999990\\r\\n0000000000\\r\\n\\r\\nZ000000000\\r\\n0000000000\\r\\n8888888888\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n'], 'output': ['710']}, {'input': ['10 60\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n111111111Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n000000000Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n'], 'output': ['81']}, {'input': ['10 60\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n999999999Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n000000000Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n'], 'output': ['81']}, {'input': ['10 60\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n999999999Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n000000000Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n'], 'output': ['351']}, {'input': ['10 60\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n999999999Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n\\r\\n0000000000\\r\\n0000000000\\r\\n0000000000\\r\\n000000000Y\\r\\nYYYYYYYYYZ\\r\\n999999999Y\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n9999999999\\r\\n'], 'output': ['441']}, {'input': ['10 60\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n99999Y9999\\r\\n9999YZY999\\r\\n\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n00000Y9999\\r\\n0000YZY999\\r\\n'], 'output': ['351']}, {'input': ['10 60\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n9999Y99999\\r\\n999YZY9999\\r\\n\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n0000Y99999\\r\\n000YZY9999\\r\\n'], 'output': ['441']}, {'input': ['10 60\\r\\n000Y000000\\r\\n0Y0Y0YYYY0\\r\\nY00Y0Y0000\\r\\n00Y00Y0YYY\\r\\n0Y00Y00Y00\\r\\n000Y00Y000\\r\\nYYY00Y00Y0\\r\\n0000Y00Y00\\r\\n0YYY00Y00Y\\r\\n00000YZ009\\r\\n\\r\\n000Y000000\\r\\n9Y0Y0YYYY0\\r\\nY00Y0Y0000\\r\\n00Y00Y0YYY\\r\\n0Y00Y00Y00\\r\\n000Y00Y000\\r\\nYYY00Y00Y0\\r\\n0000Y00Y00\\r\\n0YYY00Y00Y\\r\\n00000YZ000\\r\\n'], 'output': ['0']}, {'input': ['10 60\\r\\n000Y000000\\r\\nYY0Y0YYYY0\\r\\nY00Y0Y0000\\r\\n00Y00Y0YYY\\r\\n0Y00Y00Y00\\r\\n000Y00Y000\\r\\nYYY00Y00Y0\\r\\n0000Y00Y00\\r\\n0YYY00Y00Y\\r\\n00000YZ009\\r\\n\\r\\n900Y000000\\r\\nYY0Y0YYYY0\\r\\nY00Y0Y0000\\r\\n00Y00Y0YYY\\r\\n0Y00Y00Y00\\r\\n000Y00Y000\\r\\nYYY00Y00Y0\\r\\n0000Y00Y00\\r\\n0YYY00Y00Y\\r\\n00000YZ000\\r\\n'], 'output': ['9']}, {'input': ['2 1\\r\\n1Z\\r\\n53\\r\\n\\r\\n8Z\\r\\n65\\r\\n'], 'output': ['9']}, {'input': ['2 2\\r\\nZ2\\r\\n8Y\\r\\n\\r\\nZ3\\r\\n1Y\\r\\n'], 'output': ['3']}, {'input': ['2 10\\r\\nYY\\r\\nZY\\r\\n\\r\\nYY\\r\\nZY\\r\\n'], 'output': ['0']}, {'input': ['2 60\\r\\n4Z\\r\\n21\\r\\n\\r\\n5Z\\r\\n72\\r\\n'], 'output': ['7']}, {'input': ['3 1\\r\\n4Z1\\r\\n908\\r\\n146\\r\\n\\r\\n3Z2\\r\\n180\\r\\n811\\r\\n'], 'output': ['24']}, {'input': ['3 2\\r\\n953\\r\\n87Y\\r\\nZ69\\r\\n\\r\\n921\\r\\n87Y\\r\\nZ18\\r\\n'], 'output': ['36']}, {'input': ['3 5\\r\\nYYY\\r\\n0Z2\\r\\n7YY\\r\\n\\r\\nYYY\\r\\n8Z2\\r\\n6YY\\r\\n'], 'output': ['9']}, {'input': ['4 1\\r\\n9726\\r\\n0Z05\\r\\n3648\\r\\nY3Y4\\r\\n\\r\\n3539\\r\\n6Z25\\r\\n9289\\r\\nY5Y2\\r\\n'], 'output': ['57']}, {'input': ['4 2\\r\\nZ7Y5\\r\\nY6Y7\\r\\n7413\\r\\n1678\\r\\n\\r\\nZ5Y9\\r\\nY0Y3\\r\\n7673\\r\\n5456\\r\\n'], 'output': ['60']}, {'input': ['4 3\\r\\nZ6Y7\\r\\nY8Y1\\r\\n076Y\\r\\n7Y11\\r\\n\\r\\nZ8Y7\\r\\nY2Y4\\r\\n913Y\\r\\n0Y07\\r\\n'], 'output': ['38']}, {'input': ['4 5\\r\\nY672\\r\\n0ZY6\\r\\n8486\\r\\n5YY5\\r\\n\\r\\nY847\\r\\n6ZY7\\r\\n1791\\r\\n0YY3\\r\\n'], 'output': ['53']}, {'input': ['4 13\\r\\n561Y\\r\\n511Y\\r\\nY9ZY\\r\\n34Y2\\r\\n\\r\\n668Y\\r\\n555Y\\r\\nY4ZY\\r\\n51Y9\\r\\n'], 'output': ['37']}, {'input': ['4 23\\r\\nY616\\r\\nYY5Z\\r\\n2Y06\\r\\n2YY9\\r\\n\\r\\nY050\\r\\nYY5Z\\r\\n8Y16\\r\\n7YY7\\r\\n'], 'output': ['28']}, {'input': ['4 47\\r\\nYY2Y\\r\\n5199\\r\\n4ZY0\\r\\nY88Y\\r\\n\\r\\nYY9Y\\r\\n6110\\r\\n5ZY0\\r\\nY85Y\\r\\n'], 'output': ['34']}, {'input': ['4 60\\r\\n956Y\\r\\nY250\\r\\n5YYY\\r\\n5YYZ\\r\\n\\r\\n593Y\\r\\nY311\\r\\n5YYY\\r\\n1YYZ\\r\\n'], 'output': ['28']}, {'input': ['5 1\\r\\n0YZ52\\r\\n3Y481\\r\\n66Y68\\r\\nY1665\\r\\n35923\\r\\n\\r\\n9YZ89\\r\\n2Y876\\r\\n08Y19\\r\\nY1891\\r\\n24689\\r\\n'], 'output': ['88']}, {'input': ['5 2\\r\\n7Z7Y4\\r\\n31Y46\\r\\n70YY0\\r\\n36391\\r\\nYYY19\\r\\n\\r\\n2Z5Y4\\r\\n84Y90\\r\\n25YY1\\r\\n19239\\r\\nYYY55\\r\\n'], 'output': ['69']}, {'input': ['5 5\\r\\n947YY\\r\\n7Y9Y9\\r\\nY1YY0\\r\\nZY983\\r\\n18YY0\\r\\n\\r\\n181YY\\r\\n6Y9Y9\\r\\nY7YY2\\r\\nZY639\\r\\n20YY9\\r\\n'], 'output': ['57']}, {'input': ['5 25\\r\\nY2518\\r\\n4850Y\\r\\n43381\\r\\n75ZYY\\r\\n1381Y\\r\\n\\r\\nY8050\\r\\n2735Y\\r\\n10270\\r\\n77ZYY\\r\\n4888Y\\r\\n'], 'output': ['76']}, {'input': ['5 60\\r\\n7YZ92\\r\\n9YY4Y\\r\\nYY371\\r\\n85Y2Y\\r\\nYYYY9\\r\\n\\r\\n3YZ06\\r\\n0YY3Y\\r\\nYY905\\r\\n99Y2Y\\r\\nYYYY9\\r\\n'], 'output': ['50']}, {'input': ['6 1\\r\\n925391\\r\\n584Z56\\r\\n925934\\r\\n127259\\r\\n460771\\r\\nYY4352\\r\\n\\r\\n270817\\r\\n714Z66\\r\\n395925\\r\\n385913\\r\\n909530\\r\\nYY4513\\r\\n'], 'output': ['150']}, {'input': ['6 5\\r\\nYY35Y6\\r\\n525928\\r\\n93Z3Y3\\r\\nYY6134\\r\\n5YY413\\r\\nY81Y74\\r\\n\\r\\nYY15Y1\\r\\n061299\\r\\n22Z0Y2\\r\\nYY3258\\r\\n7YY616\\r\\nY42Y46\\r\\n'], 'output': ['92']}, {'input': ['6 11\\r\\nYYYY09\\r\\n8YYY42\\r\\n777883\\r\\n083YYY\\r\\n6577Y1\\r\\n05YZ7Y\\r\\n\\r\\nYYYY95\\r\\n9YYY78\\r\\n070367\\r\\n756YYY\\r\\n8067Y4\\r\\n54YZ1Y\\r\\n'], 'output': ['106']}, {'input': ['6 60\\r\\n494855\\r\\nYY10ZY\\r\\n0Y0478\\r\\n39Y100\\r\\n065742\\r\\n93493Y\\r\\n\\r\\n872743\\r\\nYY80ZY\\r\\n0Y6855\\r\\n75Y142\\r\\n126232\\r\\n69511Y\\r\\n'], 'output': ['120']}, {'input': ['7 1\\r\\nY9Y827Y\\r\\nY7YYYY0\\r\\nYY4496Y\\r\\n50YY456\\r\\n1Y312Z2\\r\\n5Y72Y3Y\\r\\n712YYY7\\r\\n\\r\\nY8Y930Y\\r\\nY5YYYY0\\r\\nYY4261Y\\r\\n77YY329\\r\\n1Y507Z0\\r\\n6Y44Y1Y\\r\\n570YYY2\\r\\n'], 'output': ['95']}, {'input': ['7 5\\r\\nYY557YY\\r\\nYY33YY7\\r\\n17YYY5Y\\r\\nZ963Y89\\r\\n08YYYY6\\r\\nY1Y75YY\\r\\nYY9Y1Y9\\r\\n\\r\\nYY121YY\\r\\nYY37YY2\\r\\n41YYY7Y\\r\\nZ432Y90\\r\\n48YYYY4\\r\\nY3Y63YY\\r\\nYY6Y4Y0\\r\\n'], 'output': ['84']}, {'input': ['7 10\\r\\nYYY3YYY\\r\\nYYYYYY2\\r\\nYYYY1YY\\r\\nY7YYYY0\\r\\nYYY259Y\\r\\nYYYYYYY\\r\\nYZYYYYY\\r\\n\\r\\nYYY8YYY\\r\\nYYYYYY2\\r\\nYYYY7YY\\r\\nY6YYYY1\\r\\nYYY919Y\\r\\nYYYYYYY\\r\\nYZYYYYY\\r\\n'], 'output': ['28']}, {'input': ['7 34\\r\\n559087Y\\r\\n0249738\\r\\n14YY871\\r\\n2Y62782\\r\\nYY28Y13\\r\\n8235YZ9\\r\\n783Y53Y\\r\\n\\r\\n458480Y\\r\\n5038138\\r\\n58YY350\\r\\n9Y81702\\r\\nYY75Y62\\r\\n0301YZ3\\r\\n450Y69Y\\r\\n'], 'output': ['149']}, {'input': ['7 59\\r\\n6YYYY10\\r\\n04Y1054\\r\\nZYYY2YY\\r\\n2Y2YYY2\\r\\n8YY94YY\\r\\n9YYYYYY\\r\\nYY7YYYY\\r\\n\\r\\n6YYYY57\\r\\n99Y4692\\r\\nZYYY4YY\\r\\n3Y6YYY1\\r\\n7YY94YY\\r\\n3YYYYYY\\r\\nYY5YYYY\\r\\n'], 'output': ['57']}, {'input': ['8 2\\r\\n3412431Y\\r\\nY9Y63Y35\\r\\n3Y35Y7Y4\\r\\n0Y388427\\r\\n51326171\\r\\n27284723\\r\\n21Y23ZYY\\r\\nY545469Y\\r\\n\\r\\n1008881Y\\r\\nY8Y05Y71\\r\\n2Y22Y8Y9\\r\\n9Y929523\\r\\n21797125\\r\\n17753725\\r\\n73Y83ZYY\\r\\nY527971Y\\r\\n'], 'output': ['196']}, {'input': ['8 8\\r\\n33632080\\r\\n6Y9Y3994\\r\\n9983Y01Y\\r\\n58389138\\r\\n440Y06Y7\\r\\n55Y92034\\r\\n99Y4Y047\\r\\nY449923Z\\r\\n\\r\\n94553397\\r\\n0Y5Y9727\\r\\n0552Y96Y\\r\\n65739693\\r\\n104Y22Y3\\r\\n41Y63837\\r\\n39Y8Y412\\r\\nY609012Z\\r\\n'], 'output': ['239']}, {'input': ['8 17\\r\\n8Y6750Y4\\r\\nY5Z7YYYY\\r\\n23Y38Y7Y\\r\\n81057544\\r\\n4997Y95Y\\r\\n2YY89509\\r\\n6417YYYY\\r\\nY69241Y1\\r\\n\\r\\n8Y9490Y6\\r\\nY2Z8YYYY\\r\\n23Y19Y0Y\\r\\n90970295\\r\\n3910Y39Y\\r\\n6YY82183\\r\\n3446YYYY\\r\\nY85919Y8\\r\\n'], 'output': ['201']}, {'input': ['8 38\\r\\nYYYYY9YY\\r\\nYYY32YYY\\r\\n3YY77Y7Y\\r\\n2Y4YY89Y\\r\\nYYYYYYZY\\r\\n9YYY0YYY\\r\\n0Y30YY56\\r\\n142Y0Y8Y\\r\\n\\r\\nYYYYY6YY\\r\\nYYY30YYY\\r\\n7YY28Y4Y\\r\\n1Y3YY21Y\\r\\nYYYYYYZY\\r\\n2YYY7YYY\\r\\n6Y16YY74\\r\\n613Y8Y0Y\\r\\n'], 'output': ['64']}, {'input': ['8 60\\r\\nYYYYYYYY\\r\\nYYYYY5YZ\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\n2YYYYY7Y\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\n\\r\\nYYYYYYYY\\r\\nYYYYY8YZ\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\n1YYYYY2Y\\r\\nYYYYYYYY\\r\\nYYYYYYYY\\r\\n'], 'output': ['8']}, {'input': ['9 1\\r\\n634986988\\r\\n579937389\\r\\n211959999\\r\\n156427383\\r\\n247682412\\r\\n5594026Z4\\r\\n660120777\\r\\n530725825\\r\\n568606117\\r\\n\\r\\n356611452\\r\\n176654482\\r\\n323322910\\r\\n699615222\\r\\n282963554\\r\\n2442346Z5\\r\\n998463089\\r\\n723923655\\r\\n514611010\\r\\n'], 'output': ['328']}, {'input': ['9 2\\r\\n4707YY2Z3\\r\\nYY78Y2855\\r\\n8Y8Y894YY\\r\\n6Y1445329\\r\\n388Y631Y3\\r\\n85332907Y\\r\\nYY309Y330\\r\\nYY4Y48713\\r\\n390800Y72\\r\\n\\r\\n1089YY9Z1\\r\\nYY36Y0383\\r\\n4Y9Y744YY\\r\\n5Y9929558\\r\\n180Y969Y5\\r\\n83505838Y\\r\\nYY188Y395\\r\\nYY2Y90862\\r\\n645519Y55\\r\\n'], 'output': ['272']}, {'input': ['9 7\\r\\nY8YY41362\\r\\nY03941301\\r\\nYYYY31YY5\\r\\nY8YY338YY\\r\\n48Y7Y5Y9Y\\r\\nYY46YY26Y\\r\\n64615159Z\\r\\n36Y2Y815Y\\r\\n1Y1YY1632\\r\\n\\r\\nY1YY00943\\r\\nY69269785\\r\\nYYYY37YY4\\r\\nY6YY907YY\\r\\n19Y8Y6Y8Y\\r\\nYY97YY10Y\\r\\n99207179Z\\r\\n81Y1Y536Y\\r\\n2Y4YY8646\\r\\n'], 'output': ['199']}, {'input': ['9 28\\r\\nY10Y2YY34\\r\\nYYY10YY3Y\\r\\n46Y3YY0YY\\r\\n6Y8YY32YY\\r\\nY664915YY\\r\\n34YY8Y55Y\\r\\n41YYZYYY8\\r\\nY8YYYY40Y\\r\\n0Y5YY7891\\r\\n\\r\\nY59Y8YY81\\r\\nYYY39YY0Y\\r\\n27Y5YY8YY\\r\\n5Y8YY43YY\\r\\nY432528YY\\r\\n78YY3Y02Y\\r\\n35YYZYYY5\\r\\nY6YYYY96Y\\r\\n6Y8YY5152\\r\\n'], 'output': ['149']}, {'input': ['9 57\\r\\nY2Y23YYZ1\\r\\n1Y4YY01YY\\r\\nY844YYY82\\r\\n0YY76YYY5\\r\\nYYYY887Y9\\r\\nY5YY203Y4\\r\\nY49657116\\r\\n8555Y6Y50\\r\\nY929Y583Y\\r\\n\\r\\nY2Y10YYZ5\\r\\n3Y4YY60YY\\r\\nY531YYY53\\r\\n7YY41YYY5\\r\\nYYYY158Y3\\r\\nY4YY203Y2\\r\\nY01191321\\r\\n4525Y7Y94\\r\\nY815Y303Y\\r\\n'], 'output': ['139']}, {'input': ['10 1\\r\\nY94YY240Y1\\r\\n90Y8235Y41\\r\\n4789763702\\r\\n138Y833262\\r\\nYY65953YY3\\r\\nY9Y1Y72468\\r\\n3Y906Y0630\\r\\nZY26549536\\r\\n77Y1597748\\r\\n8295Y315Y6\\r\\n\\r\\nY60YY720Y7\\r\\n66Y7086Y76\\r\\n6686312433\\r\\n810Y789383\\r\\nYY93349YY0\\r\\nY7Y5Y47616\\r\\n6Y472Y8127\\r\\nZY24602173\\r\\n19Y8072703\\r\\n2418Y832Y4\\r\\n'], 'output': ['331']}, {'input': ['10 1\\r\\nYYY9Y71YYY\\r\\nY0YYY97YYY\\r\\nYYYZ4868YY\\r\\nY6YYY55Y5Y\\r\\n1Y2Y061YYY\\r\\nYY8YYY86YY\\r\\nYY72YYYYYY\\r\\nY52Y6YYYYY\\r\\nY077YYYYYY\\r\\n49Y817Y9YY\\r\\n\\r\\nYYY1Y78YYY\\r\\nY4YYY13YYY\\r\\nYYYZ2518YY\\r\\nY4YYY52Y5Y\\r\\n8Y7Y354YYY\\r\\nYY6YYY34YY\\r\\nYY87YYYYYY\\r\\nY76Y8YYYYY\\r\\nY224YYYYYY\\r\\n50Y628Y4YY\\r\\n'], 'output': ['143']}, {'input': ['10 1\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYY6YYYYYYY\\r\\nYYYZYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\n\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYY4YYYYYYY\\r\\nYYYZYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\nYYYYYYYYYY\\r\\n'], 'output': ['4']}, {'input': ['10 2\\r\\n8Y80312575\\r\\n7Y1Y6666YY\\r\\n22Y13861Y1\\r\\nY375855376\\r\\nY1636Y3254\\r\\n056Y9YY6YY\\r\\nY5Y2YYYYY0\\r\\n007781Y728\\r\\n5ZY6Y96YY6\\r\\n20Y91YY129\\r\\n\\r\\n2Y00998651\\r\\n7Y1Y4348YY\\r\\n14Y25601Y3\\r\\nY712641694\\r\\nY2721Y3876\\r\\n428Y8YY9YY\\r\\nY9Y6YYYYY7\\r\\n237896Y916\\r\\n2ZY4Y83YY9\\r\\n76Y88YY082\\r\\n'], 'output': ['302']}, {'input': ['10 20\\r\\n3382300377\\r\\n0704551998\\r\\n6905124500\\r\\n7591098967\\r\\n6975429270\\r\\n13Z2020045\\r\\n3334243650\\r\\n1402696672\\r\\n8743582106\\r\\n8273846236\\r\\n\\r\\n5963319405\\r\\n7167843755\\r\\n4590648062\\r\\n4064613666\\r\\n8315120764\\r\\n19Z8830522\\r\\n1907884902\\r\\n9862721024\\r\\n0473219912\\r\\n2691074956\\r\\n'], 'output': ['414']}, {'input': ['10 19\\r\\n5YY5848183\\r\\n18Y7Z53Y94\\r\\n4250YYY874\\r\\n97YY32Y883\\r\\n1743165Y38\\r\\n5Y783YYY24\\r\\n0Y81YYY684\\r\\n79Y6004066\\r\\nYYY4Y68Y30\\r\\n9671YY00YY\\r\\n\\r\\n6YY2859310\\r\\n61Y1Z30Y77\\r\\n6075YYY567\\r\\n81YY34Y863\\r\\n6448697Y10\\r\\n2Y600YYY24\\r\\n8Y03YYY525\\r\\n13Y1007783\\r\\nYYY3Y23Y80\\r\\n4579YY87YY\\r\\n'], 'output': ['296']}, {'input': ['10 35\\r\\nYY484Y80YY\\r\\nYY0Y112Y8Y\\r\\nY51450YYY8\\r\\n662Y00Y735\\r\\n1YY1YY3Y23\\r\\n79377Y75Y5\\r\\n40YY465YYY\\r\\nYYY10Y994Y\\r\\nYY7Y64Y7Y3\\r\\nYY5Y5Y42Z3\\r\\n\\r\\nYY688Y22YY\\r\\nYY6Y233Y4Y\\r\\nY13301YYY4\\r\\n468Y59Y758\\r\\n8YY8YY4Y81\\r\\n99588Y53Y8\\r\\n52YY747YYY\\r\\nYYY01Y477Y\\r\\nYY0Y22Y0Y3\\r\\nYY1Y7Y10Z9\\r\\n'], 'output': ['218']}, {'input': ['10 50\\r\\nY6Y3810436\\r\\nY9Y39YY21Z\\r\\n881Y977446\\r\\n39Y379YY51\\r\\n62Y9Y75429\\r\\nY843779213\\r\\n9288762Y73\\r\\nY3Y1Y608YY\\r\\nY23626YYY6\\r\\n4487Y4Y2YY\\r\\n\\r\\nY8Y4767475\\r\\nY5Y29YY63Z\\r\\n812Y598957\\r\\n17Y966YY59\\r\\n14Y4Y09918\\r\\nY552606351\\r\\n6804285Y46\\r\\nY2Y5Y217YY\\r\\nY11107YYY3\\r\\n7955Y2Y2YY\\r\\n'], 'output': ['342']}, {'input': ['10 59\\r\\n9Y6YY7Y1Y6\\r\\n22Y1YY51Y8\\r\\n24221YY5Y6\\r\\n4631948627\\r\\n560132737Y\\r\\n6250YY843Y\\r\\n1Y44448091\\r\\n6022Y51001\\r\\n3YY55096Y1\\r\\n329177Y2Z6\\r\\n\\r\\n2Y0YY2Y1Y1\\r\\n35Y0YY61Y1\\r\\n03763YY4Y8\\r\\n4020000198\\r\\n471537568Y\\r\\n5583YY230Y\\r\\n0Y97522772\\r\\n2296Y37943\\r\\n1YY90435Y0\\r\\n351196Y9Z5\\r\\n'], 'output': ['289']}, {'input': ['10 60\\r\\n0406099563\\r\\n1623614663\\r\\nY035577875\\r\\n45997Z09Y9\\r\\n8749154486\\r\\n9021800174\\r\\n0132528980\\r\\n011Y653810\\r\\n6697173925\\r\\n11252Y3135\\r\\n\\r\\n5037510501\\r\\n0442291826\\r\\nY338876577\\r\\n15857Z22Y2\\r\\n8981837042\\r\\n5135756064\\r\\n8012384904\\r\\n336Y827810\\r\\n8607923093\\r\\n87032Y3753\\r\\n'], 'output': ['405']}, {'input': ['3 3\\r\\nY00\\r\\n50Z\\r\\n050\\r\\n\\r\\nY80\\r\\n08Z\\r\\n000\\r\\n'], 'output': ['8']}]","id":740} {"difficulty":1700,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"84_C","execute_outcome":"WRONG_ANSWER","source_code":"{$R+,Q+,I+}\r\n{$apptype console}\r\nUses SysUtils;\r\nVar\r\n p1,c1,r1,p2,c2,r2:Array[-30000..30000] of Integer;\r\n n,i,j,a,b,m,kol:Integer;\r\n otv:Array[1..10000] of Integer;\r\nBegin\r\n Read(n);\r\n For i:=1 To n Do Begin\r\n Read(a,b);\r\n For j:=a-b To a+b Do Begin\r\n If p1[j]=0 Then Begin\r\n p1[j]:=i;\r\n c1[j]:=a;\r\n r1[j]:=b;\r\n End\r\n Else Begin\r\n p2[j]:=i;\r\n c2[j]:=a;\r\n r2[j]:=b;\r\n End;\r\n End;\r\n End;\r\n Read(m);\r\n For i:=1 To m Do Begin\r\n Read(a,b);\r\n If p1[a]<>0 Then Begin\r\n If ((a-c1[a])*(a-c1[a])+b*b<=r1[a]*r1[a]) and (otv[p1[a]]=0) Then otv[p1[a]]:=i;\r\n If (p2[a]<>0) and (b=0) and ((a-c2[a])*(a-c2[a])+b*b<=r2[a]*r2[a]) and (otv[p2[a]]=0) Then otv[p2[a]]:=i;\r\n End;\r\n End;\r\n kol:=0;\r\n For i:=1 To n Do\r\n If otv[i]=0 Then kol:=kol+1;\r\n WriteLn(kol);\r\n For i:=1 To n Do\r\n If otv[i]<>0 Then Write(otv[i],' ')\r\n Else Write(-1,' ');\r\nEnd.\r\n\r\n\r\n\r\n","description":"Perhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to enroll in a biathlon section.Of course, biathlon as any sport, proved very difficult in practice. It takes much time and effort. Workouts, workouts, and workouts, \u2014 that's what awaited Valera on his way to great achievements in biathlon.As for the workouts, you all probably know that every professional biathlete should ski fast and shoot precisely at the shooting range. Only in this case you can hope to be successful, because running and shooting are the two main components of biathlon. Valera has been diligent in his ski trainings, which is why he runs really fast, however, his shooting accuracy is nothing to write home about.On a biathlon base where Valera is preparing for the competition, there is a huge rifle range with n targets. Each target have shape of a circle, and the center of each circle is located on the Ox axis. At the last training session Valera made the total of m shots. To make monitoring of his own results easier for him, one rather well-known programmer (of course it is you) was commissioned to write a program that would reveal how many and which targets Valera hit. More specifically, for each target the program must print the number of the first successful shot (in the target), or \"-1\" if this was not hit. The target is considered hit if the shot is inside the circle or on its boundary. Valera is counting on you and perhaps, thanks to you he will one day win international competitions.","input_specification":"The first line of the input file contains the integer n (1\u2264n\u226410^4), which is the number of targets. The next n lines contain descriptions of the targets. Each target is a circle whose center is located on the Ox axis. Each circle is given by its coordinate of the center x (-2\u00b710^4\u2264x\u22642\u00b710^4) and its radius r (1\u2264r\u22641000). It is guaranteed that no two targets coincide, intersect or are nested into each other, but they can touch each other.\nThe next line contains integer m (1\u2264m\u22642\u00b710^5), which is the number of shots. Next m lines contain descriptions of the shots, which are points on the plane, given by their coordinates x and y (-2\u00b710^4\u2264x,y\u22642\u00b710^4).\nAll the numbers in the input are integers. \nTargets and shots are numbered starting from one in the order of the input.\n","output_specification":"Print on the first line a single number, the number of targets hit by Valera. Print on the second line for each of the targets the number of its first hit or \"-1\" (without quotes) if this number does not exist. Separate numbers with spaces.\n","notes":null,"sample_inputs":["3\n2 1\n5 2\n10 1\n5\n0 1\n1 3\n3 0\n4 0\n4 0\n","3\n3 2\n7 1\n11 2\n4\n2 1\n6 0\n6 4\n11 2\n"],"sample_outputs":["2\n3 3 -1 \n","3\n1 2 4 \n"],"human_solution":"{$APPTYPE CONSOLE}\r\n\r\nuses\r\n SysUtils;\r\nvar x,r,b,ans:array[1..300011] of integer;\r\nm,n,res,q,w,l,u,mid:int64;\r\ni:integer;\r\nprocedure qsort(l,t:integer);\r\nvar i,j,e,z:integer;\r\nbegin\r\n i:=l;\r\n j:=t;\r\n e:=x[(l+t) div 2];\r\n while i<=j do\r\n begin\r\n while x[i]e do dec(j);\r\n if i<=j then\r\n begin\r\n z:=x[i];\r\n x[i]:=x[j];\r\n x[j]:=z;\r\n z:=r[i];\r\n r[i]:=r[j];\r\n r[j]:=z;\r\n z:=b[i];\r\n b[i]:=b[j];\r\n b[j]:=z;\r\n inc(I);dec(J);\r\n end;\r\n end;\r\nif iq) or (x[l]+r[l]1 then begin\r\n dec(l);\r\n if (ans[b[l]] = -1) and (sqr(q-x[l])+SQR(w)<=sqr(r[l])) then\r\n begin\r\n inc(res);\r\n ans[b[l]] :=i;\r\n end;\r\n inc(l);\r\n end;\r\n if l length(sw[i]) then\r\n if Copy(sw[j],length(sw[j])-length(sw[i])+1,length(sw[i])) = sw[i] then\r\n begin\r\n word[j]:=True;\r\n dd:=True;\r\n end;\r\n end;\r\n for i:=1 to n do\r\n for q:=1 to 4 do\r\n begin\r\n st:='';\r\n t:=i;\r\n while t > 1 do\r\n begin\r\n st:=pc[t]+st;\r\n t:=pv[t];\r\n end;\r\n st:=st+let[q];\r\n max:=0; km:=1;\r\n for ii:=2 to n do\r\n begin\r\n ss:=''; t:=ii;\r\n while t > 1 do\r\n begin\r\n ss:=pc[t]+ss;\r\n t:=pv[t];\r\n end;\r\n if length(ss) > length(st) then continue;\r\n if Copy(st,length(st)-length(ss)+1,length(ss)) = ss then\r\n if length(ss) > max then\r\n begin\r\n max:=length(ss);\r\n km:=ii;\r\n end;\r\n end;\r\n fn[i,q]:=km;\r\n end;\r\n fillchar(f,sizeof(f),0);\r\n f[0,1,0]:=1;\r\n for i:=0 to nn-1 do\r\n for j:=1 to n do\r\n for k:=0 to de[j] do\r\n if f[i,j,k] > 0 then\r\n for q:=1 to 4 do\r\n begin\r\n ii:=i+1;\r\n jj:=fn[j,q];\r\n kk:=k+1;\r\n if word[jj] and (de[jj] >= k+1) then kk:=0;\r\n inc(f[ii,jj,kk],f[i,j,k]);\r\n if f[ii,jj,kk] >= md then dec(f[ii,jj,kk],md);\r\n end;\r\n ans:=0;\r\n for i:=1 to n do ans:=(ans+f[nn,i,0]) mod md;\r\n writeln(ans);\r\n close(input);\r\n close(output);\r\nend.","description":"\"Multidimensional spaces are completely out of style these days, unlike genetics problems\" \u2014 thought physicist Woll and changed his subject of study to bioinformatics. Analysing results of sequencing he faced the following problem concerning DNA sequences. We will further think of a DNA sequence as an arbitrary string of uppercase letters \"A\", \"C\", \"G\" and \"T\" (of course, this is a simplified interpretation).Let w be a long DNA sequence and s1,s2,...,sm \u2014 collection of short DNA sequences. Let us say that the collection filters w iff w can be covered with the sequences from the collection. Certainly, substrings corresponding to the different positions of the string may intersect or even cover each other. More formally: denote by |w| the length of w, let symbols of w be numbered from 1 to |w|. Then for each position i in w there exist pair of indices l,r (1\u2264l\u2264i\u2264r\u2264|w|) such that the substring w[l\u00a0...\u00a0r] equals one of the elements s1,s2,...,sm of the collection.Woll wants to calculate the number of DNA sequences of a given length filtered by a given collection, but he doesn't know how to deal with it. Help him! Your task is to find the number of different DNA sequences of length n filtered by the collection {si}.Answer may appear very large, so output it modulo 1000000009.","input_specification":"First line contains two integer numbers n and m (1\u2264n\u22641000,1\u2264m\u226410) \u2014 the length of the string and the number of sequences in the collection correspondently. \nNext m lines contain the collection sequences si, one per line. Each si is a nonempty string of length not greater than 10. All the strings consist of uppercase letters \"A\", \"C\", \"G\", \"T\". The collection may contain identical strings.\n","output_specification":"Output should contain a single integer \u2014 the number of strings filtered by the collection modulo 1000000009 (10^9+9).\n","notes":"In the first sample, a string has to be filtered by \"A\". Clearly, there is only one such string: \"AA\".\nIn the second sample, there exist exactly two different strings satisfying the condition (see the pictures below).\n \n \n","sample_inputs":["2 1\nA\n","6 2\nCAT\nTACT\n"],"sample_outputs":["1\n","2\n"],"human_solution":"{$R+,S+,Q+,I+,O-}\r\n{R-,S-,Q-,I-,O+}\r\nconst md = round(1e9+9);\r\n let: string = 'ACGT';\r\nvar\r\n ans,ii,jj,kk,max,km,nn,m,n,i,j,t,q,k: longint;\r\n dd: boolean;\r\n sw,s: array [0..110] of string;\r\n ss,st: string;\r\n a: array [0..110,'A'..'Z'] of longint;\r\n fn: array [0..110,0..110] of longint;\r\n maxw,pv,de,len: array [0..110] of longint;\r\n pc: array [0..110] of char;\r\n f: array [0..1010,0..110,0..11] of longint;\r\nbegin\r\n\/\/ assign(input,'in'); reset(input);\r\n\/\/ assign(output,'out'); rewrite(output);\r\n readln(nn,m);\r\n fillchar(a,sizeof(a),0);\r\n fillchar(maxw,sizeof(maxw),0);\r\n n:=1;\r\n de[1]:=0;\r\n for i:=1 to m do\r\n begin\r\n readln(s[i]);\r\n len[i]:=length(s[i]);\r\n t:=1;\r\n for j:=1 to len[i] do\r\n begin\r\n if a[t,s[i,j]] = 0 then\r\n begin\r\n inc(n);\r\n pv[n]:=t;\r\n pc[n]:=s[i,j];\r\n de[n]:=de[t]+1;\r\n a[t,s[i,j]]:=n;\r\n end;\r\n t:=a[t,s[i,j]];\r\n end;\r\n maxw[t]:=len[i];\r\n end;\r\n sw[1]:='';\r\n for i:=2 to n do sw[i]:=sw[pv[i]]+pc[i];\r\n dd:=True;\r\n while dd do\r\n begin\r\n dd:=False;\r\n for i:=1 to n do\r\n if maxw[i] > 0 then\r\n for j:=1 to n do\r\n if length(sw[j]) > length(sw[i]) then\r\n if Copy(sw[j],length(sw[j])-length(sw[i])+1,length(sw[i])) = sw[i] then\r\n if maxw[i] > maxw[j] then\r\n begin\r\n maxw[j]:=maxw[i];\r\n dd:=True;\r\n end;\r\n end;\r\n for i:=1 to n do\r\n for q:=1 to 4 do\r\n begin\r\n st:='';\r\n t:=i;\r\n while t > 1 do\r\n begin\r\n st:=pc[t]+st;\r\n t:=pv[t];\r\n end;\r\n st:=st+let[q];\r\n max:=0; km:=1;\r\n for ii:=2 to n do\r\n begin\r\n ss:=''; t:=ii;\r\n while t > 1 do\r\n begin\r\n ss:=pc[t]+ss;\r\n t:=pv[t];\r\n end;\r\n if length(ss) > length(st) then continue;\r\n if Copy(st,length(st)-length(ss)+1,length(ss)) = ss then\r\n if length(ss) > max then\r\n begin\r\n max:=length(ss);\r\n km:=ii;\r\n end;\r\n end;\r\n fn[i,q]:=km;\r\n end;\r\n fillchar(f,sizeof(f),0);\r\n f[0,1,0]:=1;\r\n for i:=0 to nn-1 do\r\n for j:=1 to n do\r\n for k:=0 to de[j] do\r\n if f[i,j,k] > 0 then\r\n for q:=1 to 4 do\r\n begin\r\n ii:=i+1;\r\n jj:=fn[j,q];\r\n kk:=k+1;\r\n if maxw[jj] >= k+1 then kk:=0;\r\n inc(f[ii,jj,kk],f[i,j,k]);\r\n if f[ii,jj,kk] >= md then dec(f[ii,jj,kk],md);\r\n end;\r\n ans:=0;\r\n for i:=1 to n do ans:=(ans+f[nn,i,0]) mod md;\r\n writeln(ans);\r\n close(input);\r\n close(output);\r\nend.","testcases":"[{'input': ['2 1\\r\\nA\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6 2\\r\\nCAT\\r\\nTACT\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['8 2\\r\\nAGCT\\r\\nAGC\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['12 1\\r\\nACC\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['13 1\\r\\nACC\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 1\\r\\nACA\\r\\n'], 'output': ['49\\r\\n']}, {'input': ['5 6\\r\\nCGTTGAA\\r\\nATTATGAACC\\r\\nTTA\\r\\nTCAG\\r\\nCCGAGG\\r\\nT\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['5 4\\r\\nA\\r\\nC\\r\\nG\\r\\nT\\r\\n'], 'output': ['1024\\r\\n']}, {'input': ['4 5\\r\\nCTA\\r\\nA\\r\\nCA\\r\\nACAG\\r\\nACC\\r\\n'], 'output': ['11\\r\\n']}, {'input': ['4 5\\r\\nCTA\\r\\nA\\r\\nCA\\r\\nACC\\r\\nTCT\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['4 4\\r\\nTCT\\r\\nCTA\\r\\nA\\r\\nCA\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['1000 3\\r\\nAT\\r\\nTTT\\r\\nGTA\\r\\n'], 'output': ['354668080\\r\\n']}, {'input': ['13 3\\r\\nTCA\\r\\nAGTC\\r\\nGTT\\r\\n'], 'output': ['94\\r\\n']}, {'input': ['1000 10\\r\\nATTTTTTTTT\\r\\nAGGGGGGGGG\\r\\nACCCCCCCCC\\r\\nTGGGGGGGGG\\r\\nTAAAAAAAAA\\r\\nTCCCCCCCCC\\r\\nGCCCCCCCCC\\r\\nGTTTTTTTTT\\r\\nCAAAAAAAAA\\r\\nCGGGGGGGGG\\r\\n'], 'output': ['824781477\\r\\n']}, {'input': ['10 10\\r\\nAGA\\r\\nAT\\r\\nTAG\\r\\nGAG\\r\\nAT\\r\\nCAT\\r\\nTAT\\r\\nTACT\\r\\nGAT\\r\\nCAT\\r\\n'], 'output': ['1087\\r\\n']}, {'input': ['10 10\\r\\nAT\\r\\nTACT\\r\\nTAT\\r\\nTAT\\r\\nGAG\\r\\nAT\\r\\nGAT\\r\\nCAT\\r\\nTAG\\r\\nCAT\\r\\n'], 'output': ['661\\r\\n']}, {'input': ['10 10\\r\\nTAG\\r\\nACT\\r\\nCAT\\r\\nACT\\r\\nGAT\\r\\nGAG\\r\\nACT\\r\\nAGA\\r\\nAT\\r\\nGAG\\r\\n'], 'output': ['894\\r\\n']}, {'input': ['10 10\\r\\nAT\\r\\nTA\\r\\nTAT\\r\\nCAT\\r\\nGAT\\r\\nCAT\\r\\nTAG\\r\\nTAG\\r\\nTACT\\r\\nAT\\r\\n'], 'output': ['1074\\r\\n']}, {'input': ['10 10\\r\\nAT\\r\\nCAT\\r\\nTAT\\r\\nGAG\\r\\nAT\\r\\nTAT\\r\\nGAGA\\r\\nTACT\\r\\nAT\\r\\nGAT\\r\\n'], 'output': ['282\\r\\n']}, {'input': ['10 10\\r\\nACT\\r\\nAT\\r\\nTACT\\r\\nGAGA\\r\\nCAT\\r\\nAGA\\r\\nGAT\\r\\nTA\\r\\nAT\\r\\nTA\\r\\n'], 'output': ['1860\\r\\n']}, {'input': ['100 10\\r\\nTAT\\r\\nAGA\\r\\nAGA\\r\\nTAT\\r\\nCAT\\r\\nTAG\\r\\nAT\\r\\nCAT\\r\\nTACT\\r\\nTA\\r\\n'], 'output': ['219832230\\r\\n']}, {'input': ['100 10\\r\\nTACT\\r\\nTAT\\r\\nCAT\\r\\nTA\\r\\nTACT\\r\\nGAGA\\r\\nGAGA\\r\\nAGA\\r\\nTAT\\r\\nTAT\\r\\n'], 'output': ['821129594\\r\\n']}, {'input': ['100 10\\r\\nTACT\\r\\nACT\\r\\nTAT\\r\\nAGA\\r\\nTA\\r\\nTACT\\r\\nGAGA\\r\\nAT\\r\\nTAG\\r\\nGAG\\r\\n'], 'output': ['951249461\\r\\n']}, {'input': ['100 10\\r\\nGAGA\\r\\nACT\\r\\nTAG\\r\\nGAT\\r\\nTACT\\r\\nGAGA\\r\\nTAT\\r\\nTAT\\r\\nTAT\\r\\nACT\\r\\n'], 'output': ['918741384\\r\\n']}, {'input': ['100 10\\r\\nAGA\\r\\nTACT\\r\\nAGA\\r\\nGAG\\r\\nTAT\\r\\nCAT\\r\\nGAT\\r\\nTAT\\r\\nCAT\\r\\nCAT\\r\\n'], 'output': ['510782351\\r\\n']}, {'input': ['1000 10\\r\\nACT\\r\\nTAT\\r\\nTAG\\r\\nCAT\\r\\nGAGA\\r\\nAT\\r\\nGAGA\\r\\nTAG\\r\\nTA\\r\\nGAG\\r\\n'], 'output': ['496495637\\r\\n']}, {'input': ['1000 10\\r\\nTAG\\r\\nCAT\\r\\nAGA\\r\\nTACT\\r\\nCAT\\r\\nACT\\r\\nGAG\\r\\nGAT\\r\\nACT\\r\\nTAT\\r\\n'], 'output': ['431753919\\r\\n']}, {'input': ['1000 10\\r\\nGAGA\\r\\nGAGA\\r\\nGAGA\\r\\nTA\\r\\nGAG\\r\\nGAGA\\r\\nAGA\\r\\nTA\\r\\nTAT\\r\\nTAT\\r\\n'], 'output': ['249066354\\r\\n']}, {'input': ['1000 10\\r\\nTAT\\r\\nTAT\\r\\nCAT\\r\\nAT\\r\\nTA\\r\\nGAGA\\r\\nTACT\\r\\nAT\\r\\nTAT\\r\\nGAT\\r\\n'], 'output': ['676775\\r\\n']}, {'input': ['1000 10\\r\\nTA\\r\\nTAG\\r\\nTA\\r\\nACT\\r\\nTAT\\r\\nCAT\\r\\nTACT\\r\\nGAGA\\r\\nTA\\r\\nACT\\r\\n'], 'output': ['326183001\\r\\n']}, {'input': ['10 5\\r\\nAGT\\r\\nGTT\\r\\nA\\r\\nCCCC\\r\\nA\\r\\n'], 'output': ['234\\r\\n']}, {'input': ['6 5\\r\\nGGG\\r\\nAA\\r\\nA\\r\\nAGCT\\r\\nAGC\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['6 7\\r\\nCGTTGAA\\r\\nATTATGAACC\\r\\nTTA\\r\\nTCAG\\r\\nCCGAGG\\r\\nT\\r\\nT\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['9 8\\r\\nTACTACGCA\\r\\nA\\r\\nACAAT\\r\\nGCCCGA\\r\\nTA\\r\\nCATG\\r\\nTTAAC\\r\\nCTGG\\r\\n'], 'output': ['220\\r\\n']}, {'input': ['6 8\\r\\nCTAAATTCT\\r\\nCACACA\\r\\nGACCC\\r\\nG\\r\\nCGTCT\\r\\nTG\\r\\nGCAA\\r\\nAGT\\r\\n'], 'output': ['38\\r\\n']}, {'input': ['5 5\\r\\nATTATGAACC\\r\\nTTA\\r\\nTCAG\\r\\nCCGAGG\\r\\nT\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1000 5\\r\\nACGTAC\\r\\nTACTAG\\r\\nAGACGT\\r\\nCGTAGA\\r\\nGTAGAT\\r\\n'], 'output': ['168020674\\r\\n']}, {'input': ['312 7\\r\\nCCA\\r\\nCACTGATTTT\\r\\nTAGATGAAT\\r\\nG\\r\\nGATAAAC\\r\\nCCAACCG\\r\\nCCCCAGTGG\\r\\n'], 'output': ['673272460\\r\\n']}, {'input': ['356 6\\r\\nGG\\r\\nCG\\r\\nACAAT\\r\\nAAG\\r\\nGGCTCAC\\r\\nC\\r\\n'], 'output': ['109620326\\r\\n']}, {'input': ['524 1\\r\\nCCAGCCTG\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['86 9\\r\\nGTTG\\r\\nCCAGC\\r\\nGTACTGAG\\r\\nGACCCACGCA\\r\\nTGCGGTGCT\\r\\nA\\r\\nA\\r\\nGTGG\\r\\nCCTATAC\\r\\n'], 'output': ['139639918\\r\\n']}, {'input': ['408 8\\r\\nAAAGGTGGCT\\r\\nG\\r\\nG\\r\\nGGAG\\r\\nCATACT\\r\\nCAACACCCGG\\r\\nCCT\\r\\nATTACT\\r\\n'], 'output': ['471214946\\r\\n']}, {'input': ['859 9\\r\\nCAAGAAG\\r\\nGCCGAGTA\\r\\nAAACTTTGGG\\r\\nTC\\r\\nAACGGAG\\r\\nC\\r\\nAT\\r\\nCGAATT\\r\\nGGTA\\r\\n'], 'output': ['376160458\\r\\n']}, {'input': ['787 3\\r\\nGGGGATTTG\\r\\nAGAT\\r\\nCGGTAC\\r\\n'], 'output': ['646775261\\r\\n']}, {'input': ['596 2\\r\\nGCC\\r\\nCTC\\r\\n'], 'output': ['141314270\\r\\n']}, {'input': ['889 8\\r\\nGGGGATCT\\r\\nCACTGTT\\r\\nTGCCA\\r\\nGCGCTTCAT\\r\\nTCGCAAGATT\\r\\nTCG\\r\\nGTAGCATTTG\\r\\nTAGGCACAC\\r\\n'], 'output': ['330530182\\r\\n']}, {'input': ['388 4\\r\\nCGCCA\\r\\nCTAATCA\\r\\nCAGTTTGC\\r\\nCTAATG\\r\\n'], 'output': ['128236388\\r\\n']}, {'input': ['898 5\\r\\nAAAGT\\r\\nCTCAAGT\\r\\nGTCGGAGAGT\\r\\nAT\\r\\nCGGAGGGCAT\\r\\n'], 'output': ['293748514\\r\\n']}, {'input': ['881 5\\r\\nGTAC\\r\\nTACAAT\\r\\nAATGTGCTC\\r\\nGCAAT\\r\\nCT\\r\\n'], 'output': ['876433412\\r\\n']}, {'input': ['135 10\\r\\nCTTATGAAA\\r\\nTATGA\\r\\nAGCTC\\r\\nG\\r\\nTTTTCT\\r\\nAC\\r\\nTTTGTGA\\r\\nC\\r\\nTCATAGCTT\\r\\nC\\r\\n'], 'output': ['380808214\\r\\n']}, {'input': ['985 10\\r\\nAACACCCCCC\\r\\nACCAAACAAA\\r\\nACCCAAAAAC\\r\\nCAACACCACA\\r\\nAAAAACACAA\\r\\nCACCAACCAC\\r\\nAAAAAAAAAC\\r\\nCCCCAAAACC\\r\\nCACCCACCCA\\r\\nCAACACAACC\\r\\n'], 'output': ['95876385\\r\\n']}, {'input': ['952 10\\r\\nCCACAAACCC\\r\\nCAAAACCACA\\r\\nACAACAACCC\\r\\nAAAAAACCAC\\r\\nCACAACACAC\\r\\nCCCCACACCC\\r\\nCACCAACAAC\\r\\nACACCAAACA\\r\\nACCACCAACC\\r\\nCCCACCACCC\\r\\n'], 'output': ['581293618\\r\\n']}, {'input': ['910 10\\r\\nACACAAAACA\\r\\nAACACACCAC\\r\\nCCCCAACCAA\\r\\nAACACCAACA\\r\\nCCCCCACCAA\\r\\nAAACACCCAC\\r\\nACCCAACAAC\\r\\nCCCCACAAAC\\r\\nACCCCAAAAA\\r\\nACAAACACCC\\r\\n'], 'output': ['124152999\\r\\n']}, {'input': ['953 10\\r\\nACCCCACACA\\r\\nCAAAAAAAAA\\r\\nAAACACCAAA\\r\\nCAAACACAAC\\r\\nAAAACCCAAC\\r\\nCCCACAACCC\\r\\nCAACCAACCC\\r\\nCACAAACCAC\\r\\nCCACAAAACA\\r\\nACACCAAAAA\\r\\n'], 'output': ['359848089\\r\\n']}, {'input': ['820 10\\r\\nACCCCCAACA\\r\\nAACACACCAC\\r\\nCACAAACCAA\\r\\nCCAACACACC\\r\\nACAAAAAACC\\r\\nCAAACCAACC\\r\\nCACCAAACCA\\r\\nAACACAACCC\\r\\nACCAACACCA\\r\\nAACCCCCCCA\\r\\n'], 'output': ['625282992\\r\\n']}, {'input': ['801 10\\r\\nCCCCCCACCA\\r\\nACACAACAAA\\r\\nCCCCCCCAAA\\r\\nCCAAACCCCC\\r\\nCACAAACAAA\\r\\nCAAAAACCCC\\r\\nCCAACACCAA\\r\\nACAAACCAAA\\r\\nCAAACCACCA\\r\\nCAACCACAAC\\r\\n'], 'output': ['156320838\\r\\n']}, {'input': ['983 10\\r\\nCACAAAACAC\\r\\nCAAACACAAA\\r\\nCACCCAACAA\\r\\nACACCAACAC\\r\\nAACAACCCAC\\r\\nAACCACCACC\\r\\nACACACCAAA\\r\\nACAAAAACAA\\r\\nACACACCCAA\\r\\nCCACCCAACA\\r\\n'], 'output': ['4558945\\r\\n']}, {'input': ['969 10\\r\\nCACAACCAAC\\r\\nCCACCACCCA\\r\\nAAAACCCCCA\\r\\nCCCAAACCCA\\r\\nCCACAACCCA\\r\\nCCACCACAAC\\r\\nCACACCCACC\\r\\nCCACCCCCCC\\r\\nCAACAACCAA\\r\\nCACACCAACC\\r\\n'], 'output': ['611933333\\r\\n']}, {'input': ['843 10\\r\\nAACCCCCCCC\\r\\nCCAAAAAACC\\r\\nACACACCCCC\\r\\nCCACCAACCC\\r\\nCCAACCACCC\\r\\nCAAACCCAAA\\r\\nCAACACACCA\\r\\nCAACCCCACA\\r\\nAAACCCAACC\\r\\nCCACCCAACA\\r\\n'], 'output': ['812395062\\r\\n']}, {'input': ['905 10\\r\\nCCAAACCCAA\\r\\nACACACAAAA\\r\\nCCACCAACCC\\r\\nCAACACACAC\\r\\nCCACCAAAAA\\r\\nACACCACAAC\\r\\nCACAAAAAAC\\r\\nAACACCCCCA\\r\\nCAACCACCAA\\r\\nCCCAAAAACA\\r\\n'], 'output': ['544200998\\r\\n']}, {'input': ['1000 10\\r\\nACCCC\\r\\nACACC\\r\\nACCC\\r\\nAACC\\r\\nACCA\\r\\nAAAAC\\r\\nACCA\\r\\nCACC\\r\\nAAAA\\r\\nCACCA\\r\\n'], 'output': ['924594454\\r\\n']}, {'input': ['1000 10\\r\\nCCCCA\\r\\nCACAA\\r\\nACCC\\r\\nCCCAA\\r\\nCAAC\\r\\nCCCAA\\r\\nAAACC\\r\\nCCCC\\r\\nACAAA\\r\\nCCCCC\\r\\n'], 'output': ['43313937\\r\\n']}, {'input': ['1000 10\\r\\nCACA\\r\\nACCC\\r\\nCCAA\\r\\nACCCA\\r\\nACCCC\\r\\nACCC\\r\\nCCCC\\r\\nCCCA\\r\\nCCAC\\r\\nACAAA\\r\\n'], 'output': ['60965086\\r\\n']}, {'input': ['1000 10\\r\\nCACAA\\r\\nAAAAC\\r\\nACAAC\\r\\nACAA\\r\\nAAACA\\r\\nCACC\\r\\nCCCCA\\r\\nCACCC\\r\\nCCAA\\r\\nCAAA\\r\\n'], 'output': ['230123998\\r\\n']}, {'input': ['1000 10\\r\\nCAAA\\r\\nACCCA\\r\\nACACA\\r\\nACAC\\r\\nCAAA\\r\\nCAAA\\r\\nAAAA\\r\\nCCAAC\\r\\nAAAAA\\r\\nCCCA\\r\\n'], 'output': ['703792925\\r\\n']}, {'input': ['1000 10\\r\\nACAC\\r\\nCCCAA\\r\\nAACAA\\r\\nCCCA\\r\\nACACA\\r\\nACCA\\r\\nCAAC\\r\\nAACC\\r\\nCCCC\\r\\nACAC\\r\\n'], 'output': ['175815825\\r\\n']}, {'input': ['1000 10\\r\\nCAAAC\\r\\nAACC\\r\\nCAACA\\r\\nCCAAA\\r\\nACAC\\r\\nACAAA\\r\\nCCCAC\\r\\nACCC\\r\\nACCAC\\r\\nAACC\\r\\n'], 'output': ['879274869\\r\\n']}, {'input': ['1000 10\\r\\nACAC\\r\\nACAA\\r\\nACCAA\\r\\nACCC\\r\\nAAAA\\r\\nACCCC\\r\\nAAAC\\r\\nCCCAC\\r\\nCACA\\r\\nAAAA\\r\\n'], 'output': ['702626026\\r\\n']}, {'input': ['1000 10\\r\\nTTTT\\r\\nGTTGT\\r\\nGTGT\\r\\nGGGGT\\r\\nGGTG\\r\\nTGTG\\r\\nTTTGT\\r\\nTTTTG\\r\\nGTGTG\\r\\nGTTTT\\r\\n'], 'output': ['703149174\\r\\n']}, {'input': ['1000 10\\r\\nTGTG\\r\\nTGTGG\\r\\nGTTTG\\r\\nGTGG\\r\\nGTTGG\\r\\nTTGG\\r\\nGTGTT\\r\\nGGGT\\r\\nGTTG\\r\\nTGTG\\r\\n'], 'output': ['675696965\\r\\n']}, {'input': ['1000 5\\r\\nGTTT\\r\\nTGTGG\\r\\nTGTT\\r\\nGGGG\\r\\nTGTGG\\r\\n'], 'output': ['976604240\\r\\n']}, {'input': ['1000 8\\r\\nTTGG\\r\\nGTTT\\r\\nGGGG\\r\\nGTTTT\\r\\nGTGGT\\r\\nTGTG\\r\\nGGTG\\r\\nGGTGG\\r\\n'], 'output': ['284150940\\r\\n']}, {'input': ['1000 3\\r\\nTTGTT\\r\\nTGTG\\r\\nGGTG\\r\\n'], 'output': ['401641816\\r\\n']}, {'input': ['1000 6\\r\\nTTGT\\r\\nTGGTT\\r\\nGGTT\\r\\nGGTGG\\r\\nTGTT\\r\\nGGGG\\r\\n'], 'output': ['904765495\\r\\n']}, {'input': ['1000 5\\r\\nTGTG\\r\\nTTTGG\\r\\nTGGG\\r\\nTTGGG\\r\\nGGGT\\r\\n'], 'output': ['829495151\\r\\n']}, {'input': ['1000 10\\r\\nTTATTGACCG\\r\\nACCACTAGCG\\r\\nGACCGGGTCC\\r\\nGTTCACAGAG\\r\\nCAAACCACCT\\r\\nTGCCCGCAAC\\r\\nAGAACCGGGG\\r\\nACCCCGGTGT\\r\\nAGACTTGCAT\\r\\nGAGAGCCCAC\\r\\n'], 'output': ['303961596\\r\\n']}, {'input': ['1000 10\\r\\nGATTCCACAA\\r\\nTCGCAATGTT\\r\\nTGATGTCCAA\\r\\nTCGCTTCTTG\\r\\nCAGAGACGGA\\r\\nGGTGCCCTGG\\r\\nCCAGTCCTTA\\r\\nTTCCTTATCT\\r\\nTCACGCACAT\\r\\nACGACATCTA\\r\\n'], 'output': ['759680724\\r\\n']}, {'input': ['1000 10\\r\\nTATGTTATGT\\r\\nGTTACATTAA\\r\\nTCATTGCTAC\\r\\nGCCTCTGACA\\r\\nGATATATCCA\\r\\nTTGGGCTTTA\\r\\nCTGTCTAGGA\\r\\nTCAGCAGTTC\\r\\nCAGCTTTAAA\\r\\nTCTCATATGG\\r\\n'], 'output': ['247515990\\r\\n']}, {'input': ['1000 10\\r\\nCACAAGTCCG\\r\\nTCAAATTGTT\\r\\nATTAAGTACT\\r\\nCTAAGGCGCC\\r\\nAGAAGGGTTG\\r\\nATGGTCCGAA\\r\\nTTCGCGCGAT\\r\\nGGGCGCGCCA\\r\\nAAAACGAGAT\\r\\nTGAATTCGAC\\r\\n'], 'output': ['23954923\\r\\n']}, {'input': ['1000 10\\r\\nAGTACTTTTA\\r\\nTAATTGTGAC\\r\\nCCAAGGCATA\\r\\nCGCGACTACC\\r\\nCCGCTGCTTT\\r\\nGCCCAACGAC\\r\\nGGCGTAGTGG\\r\\nGGCCGTCGAC\\r\\nTCCACGATGT\\r\\nTAATTTTCAT\\r\\n'], 'output': ['591782113\\r\\n']}, {'input': ['1000 10\\r\\nCAGTAGTGGA\\r\\nTATCGACTAC\\r\\nCCACTGCGCT\\r\\nCCTGCGCTCC\\r\\nTCGTCTATGG\\r\\nAGTTAAAGCT\\r\\nTACGACCTAT\\r\\nGTAGGTTTAC\\r\\nCTAAGGATTT\\r\\nCTCTACAATA\\r\\n'], 'output': ['819181392\\r\\n']}, {'input': ['1000 10\\r\\nCCCAGGAGGC\\r\\nTGCGAACTGG\\r\\nAGACATACGG\\r\\nATCTCTTTTG\\r\\nGCGGAGTCCT\\r\\nCTTGTGCCGC\\r\\nCGTCATCTTC\\r\\nTATGCACAAA\\r\\nTACATGGCTA\\r\\nATATCCAAGG\\r\\n'], 'output': ['681627776\\r\\n']}, {'input': ['1000 10\\r\\nATCCAGTTCG\\r\\nGCCGACTTAG\\r\\nATTGAAGATT\\r\\nGTAAAATCCC\\r\\nTTTACCGGTA\\r\\nGGATCCTTAG\\r\\nCCGAGGAAGC\\r\\nAAATACAACT\\r\\nAGGAGGCCTA\\r\\nCGTTCCGCCA\\r\\n'], 'output': ['71903271\\r\\n']}, {'input': ['1000 10\\r\\nCGCGAGGCGC\\r\\nGAACCTACTC\\r\\nGGAAGGCCTC\\r\\nCGAGTCTTTT\\r\\nCTAGCAGATT\\r\\nTCAATTGGCC\\r\\nGGGTAGGTTA\\r\\nAGGTGCCGCG\\r\\nCGAATAATTG\\r\\nTAACTCATGC\\r\\n'], 'output': ['57916175\\r\\n']}, {'input': ['1000 10\\r\\nCCACGTCTTG\\r\\nTGTCGTGAAC\\r\\nCCGGGTACAA\\r\\nACCCGGGGAA\\r\\nTTCTGTTACT\\r\\nCTTGAACGAA\\r\\nACGTCTACTA\\r\\nAATGAGATGC\\r\\nCGCAGACCGC\\r\\nCTCGGTACTT\\r\\n'], 'output': ['700310600\\r\\n']}, {'input': ['724 5\\r\\nGTCTTT\\r\\nTGGTGTC\\r\\nCTGCGGG\\r\\nTGGGGTC\\r\\nGGGG\\r\\n'], 'output': ['88397587\\r\\n']}, {'input': ['675 10\\r\\nCTTCGCT\\r\\nCTCG\\r\\nTGGGTC\\r\\nCCGTTT\\r\\nTCCG\\r\\nGCG\\r\\nCCCGCT\\r\\nCCGTT\\r\\nTTTGCG\\r\\nTCGC\\r\\n'], 'output': ['221693941\\r\\n']}, {'input': ['891 2\\r\\nCGTCTG\\r\\nCGGCCG\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['574 3\\r\\nGCTGG\\r\\nTCGGTGC\\r\\nGTG\\r\\n'], 'output': ['917296112\\r\\n']}, {'input': ['856 8\\r\\nGGG\\r\\nCTG\\r\\nGCTCCTT\\r\\nGCTCCTG\\r\\nCGTTCC\\r\\nGTGTT\\r\\nCTG\\r\\nCGGT\\r\\n'], 'output': ['266655823\\r\\n']}, {'input': ['749 4\\r\\nCGGGTGC\\r\\nGTTTG\\r\\nGTGTTGT\\r\\nGCTC\\r\\n'], 'output': ['146534805\\r\\n']}, {'input': ['763 9\\r\\nCGTTT\\r\\nGGTC\\r\\nGTTTCGG\\r\\nCGCCC\\r\\nCGGCCGT\\r\\nCCTCTG\\r\\nTCC\\r\\nTTCTC\\r\\nCCGTGC\\r\\n'], 'output': ['38493212\\r\\n']}, {'input': ['995 10\\r\\nGGGCC\\r\\nTTCCT\\r\\nCGGTGT\\r\\nGGCCC\\r\\nTTGTGG\\r\\nTTCG\\r\\nTTTCGGG\\r\\nTGC\\r\\nTTTC\\r\\nTTT\\r\\n'], 'output': ['458545678\\r\\n']}, {'input': ['707 2\\r\\nGGTTGGC\\r\\nTCTTTTG\\r\\n'], 'output': ['536680786\\r\\n']}, {'input': ['867 4\\r\\nTCGTT\\r\\nCTG\\r\\nCCG\\r\\nGCGT\\r\\n'], 'output': ['611141739\\r\\n']}]","id":742} {"difficulty":2500,"lang":"Delphi","lang_cluster":"Delphi","src_uid":"89_D","execute_outcome":"WRONG_ANSWER","source_code":"{ uses crt;}\r\n const nn=500; eps=0.000000000001; besk=1e+10;\r\n label 1,2;\r\n type {longint=int64;} real=double;\r\n mas=array [0..nn] of longint; point=record x,y,z:real;end;\r\n trip=record mx,my,m:real;end; trip1=^trip;\r\n coor=record i,j :longint;end; coor1=^coor;\r\n mass=array[0..nn] of longint;mass1=^mass;\r\n var ii,mmin,mn,l1,l2,jj,n,k,p,imin,m,s,r,g,b,i1,j1,h,iimax,p1:longint;\r\n s1,s2:longint;\r\n v0,v1,s0,t0,t1,t2:real; mina:array[0..nn] of point;\r\n minr :array[0..nn] of real; minaship:array[0..nn,0..10] of point;\r\n zv:point; ppp,vb,aa,bb,vzv:point; ot,t,rzv:real;\r\n cc:char; kol:mas;\r\n a:array[0..nn,0..nn] of char;\r\n\r\n i,j:longint;\r\n voz,ub:boolean;\r\n ss:string;\r\n flag,flag1:boolean; gvx,gvy,rr:real; sss:array[0..3] of real;\r\n function al(x,y:real):real; var t0,t1,p,s0,s1:real;\r\n begin\r\n if (x>0)and(y>=0) then p:=arctan(y\/x);\r\n if x<0 then p:=pi+arctan(y\/x);\r\n if(x>0)and(y<0) then p:=2*pi+arctan(y\/x);\r\n if x=0 then if (y>=0) then p:=pi\/2 else p:=3*pi\/2;\r\n al:=p\/pi*180;\r\n end;\r\n function min(x,y:real):real;begin min:=x;if yx then max:=y; end;\r\n\r\n function nod(x,y:longint):longint; var z:longint;\r\nbegin repeat z:=x mod y;x:=y;y:=z; until z=0 ; nod:=x;end;\r\n\r\n function tper(a,b,vb:point;rad:real):real; label 23;\r\n var i,j,k:longint; sinn,l1,l2,ch,zn,coss,t,t1,r1:real; c:point;\r\n\r\n begin\r\n c.x:=a.x-b.x; c.y:=a.y-b.y;c.z:=a.z-b.z;\r\n ch:=c.x*vb.x+ c.y*vb.y+c.z*vb.z;\r\n l1:=sqrt(c.x*c.x+c.y*c.y+c.z*c.z);l2:=sqrt(vb.x*vb.x+vb.y*vb.y+vb.z*vb.z);\r\n zn:=l1*l2;\r\n coss:=ch\/zn; if coss<=0 then begin tper:=besk; goto 23; end;\r\n {writeln(coss:0:5);} sinn:=sqrt(1-coss*coss);\r\n r1:=l1*sinn; if r1>rad then begin tper:=besk; goto 23; end;\r\n t1:=(l1*coss-sqrt(rad*rad-r1*r1))\/l2;\r\n tper:=t1;\r\n\r\n\r\n\r\n\r\n\r\n23:\r\n end;\r\n\r\n\r\n begin { clrscr;\r\n assign(input,'input.txt'); reset (input); }\r\n { assign(output,'output.txt'); rewrite (output); }\r\n readln(zv.x,zv.y,zv.z,vzv.x,vzv.y,vzv.z,rzv);\r\n read(n);\r\n for i:=1 to n do\r\n begin\r\n read(mina[i].x,mina[i].y,mina[i].z,minr[i],kol[i]);\r\n for j:=1 to kol[i] do read (minaship[i,j].x,minaship[i,j].y,minaship[i,j].z);\r\n\r\n end;\r\n { aa.x:=5;aa.y:=4;bb.x:=-3;bb.y:=4;vb.x:=8;vb.y:=-6;\r\n t:=tper(aa,bb,vb,5);\r\n writeln('tt= ',t:0:7); } ot:=besk;\r\n for i:=1 to n do\r\n begin\r\n ot:=min(ot,tper(mina[i],zv,vzv,minr[i]+rzv+eps));\r\n { writeln(i,' ',ot); }\r\n for j:=1 to kol[i] do\r\n begin\r\n ppp.x:=mina[i].x+minaship[i,j].x;\r\n ppp.z:=mina[i].z+minaship[i,j].z;\r\n ppp.y:=mina[i].y+minaship[i,j].y;\r\n { writeln(i,' ',j,' ',tper(ppp,zv,vzv,rzv+eps)) ;\r\n } ot:=min(ot,tper(ppp,zv,vzv,rzv+eps));\r\n end;\r\n\r\n end;\r\n\r\n if ot0, 0ri for any 1\u2264i\u2264n. For any mines i\u2260j the following inequality if fulfilled: . Initially the Death Star and the mines do not have common points.\n","output_specification":"If the rebels will succeed in stopping the Death Star using space mines, print the time from the moment the Death Star was noticed to the blast.\nIf the Death Star will not touch a mine, print \"-1\" (without quotes).\nFor the answer the absolute or relative error of 10^-6 is acceptable.\n","notes":null,"sample_inputs":["0 0 0 1 0 0 5\n2\n10 8 0 2 2\n0 -3 0\n2 2 0\n20 0 0 4 3\n2 4 0\n-4 3 0\n1 -5 0\n","8 8 4 4 4 2 6\n1\n-2 -2 -1 3 0\n","30 30 2 1 2 1 20\n3\n0 0 40 5 1\n1 4 4\n-10 -40 -5 7 0\n100 200 95 8 1\n-10 0 0\n"],"sample_outputs":["10.0000000000","-1","74.6757620881"],"human_solution":"{$apptype console}\r\n{$R+,S+,I+,Q+}\r\nconst\r\n inf = 'input.txt';\r\n outf = 'output.txt';\r\nvar\r\n i,j,n,m:longint;\r\n ax,ay,az,vx,vy,vz,rz,ox,oy,oz,rm,px,py,pz,a,b,c,d,t,ans:extended;\r\n \r\n procedure check(x,y,z,r:extended);\r\n begin\r\n x:=ax-x;\r\n y:=ay-y;\r\n z:=az-z;\r\n c:=x*x+y*y+z*z-r*r;\r\n a:=vx*vx+vy*vy+vz*vz;\r\n b:=2*vx*x+2*vy*y+2*vz*z;\r\n d:=b*b-4*a*c;\r\n if d < 0 then exit;\r\n t:=(-b+sqrt(d))\/(2*a);\r\n if t > 0 then\r\n if t < ans then ans:=t;\r\n t:=(-b-sqrt(d))\/(2*a);\r\n if t > 0 then\r\n if t < ans then ans:=t;\r\n end;\r\n\r\nbegin\r\n \/\/reset(input,inf);\r\n \/\/rewrite(output,outf);\r\n read(ax,ay,az,vx,vy,vz,rz,n);\r\n ans:=1e18;\r\n for i:=1 to n do\r\n begin\r\n read(ox,oy,oz,rm,m);\r\n check(ox,oy,oz,rm+rz);\r\n for j:=1 to m do\r\n begin\r\n read(px,py,pz);\r\n px:=ox+px;\r\n py:=oy+py;\r\n pz:=oz+pz;\r\n check(px,py,pz,rz);\r\n end;\r\n end;\r\n if ans >= 1e18 then writeln(-1) else writeln(ans:0:10);\r\nend.\r\n","testcases":"[{'input': ['0 0 0 1 0 0 5\\r\\n2\\r\\n10 8 0 2 2\\r\\n0 -3 0\\r\\n2 2 0\\r\\n20 0 0 4 3\\r\\n2 4 0\\r\\n-4 3 0\\r\\n1 -5 0\\r\\n'], 'output': ['10.0000000000']}, {'input': ['8 8 4 4 4 2 6\\r\\n1\\r\\n-2 -2 -1 3 0\\r\\n'], 'output': ['-1']}, {'input': ['30 30 2 1 2 1 20\\r\\n3\\r\\n0 0 40 5 1\\r\\n1 4 4\\r\\n-10 -40 -5 7 0\\r\\n100 200 95 8 1\\r\\n-10 0 0\\r\\n'], 'output': ['74.6757620881']}, {'input': ['100 99 30 -1 -5 -3 100\\r\\n1\\r\\n100 -90 -50 5 4\\r\\n0 6 0\\r\\n7 0 0\\r\\n6 1 1\\r\\n0 -6 -1\\r\\n'], 'output': ['17.6693584143']}, {'input': ['0 0 0 5 5 5 20\\r\\n1\\r\\n-20 0 -30 10 2\\r\\n0 11 2\\r\\n-5 -8 -6\\r\\n'], 'output': ['-1']}, {'input': ['-4 5 8 6 1 5 10\\r\\n5\\r\\n10 -3 -3 3 1\\r\\n0 -4 -2\\r\\n5 9 -8 1 1\\r\\n-1 0 -1\\r\\n-9 8 -6 1 2\\r\\n-1 0 1\\r\\n0 -1 1\\r\\n0 4 -7 3 2\\r\\n2 -1 -3\\r\\n4 -2 0\\r\\n0 -9 -9 3 1\\r\\n0 -3 -1\\r\\n'], 'output': ['-1']}, {'input': ['-47 -7 -43 5 -8 -10 13\\r\\n13\\r\\n-10 -40 -34 5 3\\r\\n6 -2 3\\r\\n-4 -1 -4\\r\\n-6 -1 2\\r\\n-36 45 33 10 2\\r\\n-4 -6 8\\r\\n0 -14 -5\\r\\n14 -15 6 1 3\\r\\n-1 -1 0\\r\\n1 0 -1\\r\\n0 -1 1\\r\\n9 -32 6 6 2\\r\\n-1 6 -1\\r\\n-4 -2 -5\\r\\n45 -31 2 11 2\\r\\n0 14 8\\r\\n-12 -11 0\\r\\n-5 35 -3 7 2\\r\\n-9 1 1\\r\\n-3 -9 1\\r\\n-17 -13 -6 2 1\\r\\n2 0 1\\r\\n-45 -41 16 10 1\\r\\n10 -6 -4\\r\\n-46 30 4 4 3\\r\\n0 5 -1\\r\\n1 4 0\\r\\n0 -5 3\\r\\n23 10 -31 9 1\\r\\n-10 -3 -2\\r\\n26 10 0 9 2\\r\\n9 -3 2\\r\\n-1 4 -10\\r\\n-45 12 23 1 1\\r\\n-1 1 0\\r\\n22 -1 45 5 3\\r\\n6 0 4\\r\\n0 1 -5\\r\\n-4 -1 -3\\r\\n'], 'output': ['-1']}, {'input': ['-10000 0 0 1 0 0 2\\r\\n1\\r\\n10000 3 0 1 0\\r\\n'], 'output': ['20000.0000000000']}, {'input': ['-10000 0 0 1 0 0 3\\r\\n1\\r\\n10000 6 0 2 1\\r\\n-3 0 0\\r\\n'], 'output': ['-1']}, {'input': ['-10000 0 0 10 1 0 100\\r\\n1\\r\\n9995 2110 0 10 0\\r\\n'], 'output': ['2000.2694337364']}, {'input': ['-10000 0 0 10 1 0 100\\r\\n1\\r\\n9994 2110 0 10 0\\r\\n'], 'output': ['-1']}]","id":743} {"difficulty":1100,"lang":"Java 7","lang_cluster":"Java","src_uid":"54c748dd983b6a0ea1af1153d08f1c01","execute_outcome":"COMPILATION_ERROR","source_code":"import java.awt.Image;\nimport java.awt.Point;\nimport java.awt.image.BufferedImage;\nimport java.io.BufferedReader;\nimport java.io.ByteArrayOutputStream;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.Reader;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.Method;\nimport java.math.BigInteger;\nimport java.text.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.StringTokenizer;\nimport java.util.zip.GZIPInputStream;\n\nimport javax.imageio.ImageIO;\n\npublic class Main {\n\tpublic static void main(String args[]) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\t\t\n\t\tString[] cpt = s.nextLine().split(\" \");\n\t\tint n = Integer.parseInt(cpt[0]);\n\t\t\n\t\tString dom = s.nextLine();\n\t\tint total = 0;\n\t\t\n\t\tchar wait = '0';\n\t\tint interval = 0;\n\t\tfor (char c : dom.toCharArray()) {\n\t\t\tif (c == '.') {\n\t\t\t\tinterval++;\n\t\t\t} else if (wait == '0' && c == 'R') {\n\t\t\t\ttotal += interval;\n\t\t\t\twait = 'L';\n\t\t\t\tinterval = 0;\n\t\t\t} else if (c == 'R') {\n\t\t\t\tif (wait == '0') {\n\t\t\t\t\ttotal += interval;\n\t\t\t\t}\n\t\t\t\tinterval = 0;\n\t\t\t\twait = 'L';\n\t\t\t} else if (c == 'L') {\n\t\t\t\tif (wait != '0') {\n\t\t\t\t\ttotal += interval % 2;\n\t\t\t\t\twait = 'R';\n\t\t\t\t}\n\t\t\t\tinterval = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (wait != 'L') {\n\t\t\ttotal += interval;\n\t\t}\n\t\t\n\t\tSystem.out.println(total);\n\t}\n}","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"],"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":744} {"difficulty":2700,"lang":"PyPy 3-64","lang_cluster":"Python","src_uid":"249_D","execute_outcome":"WRONG_ANSWER","source_code":"print(\"_RANDOM_GUESS_1689449076.264809\")# 1689449076.2648332","description":"In the evenings Donkey would join Shrek to look at the stars. They would sit on a log, sipping tea and they would watch the starry sky. The sky hung above the roof, right behind the chimney. Shrek's stars were to the right of the chimney and the Donkey's stars were to the left. Most days the Donkey would just count the stars, so he knew that they are exactly n. This time he wanted a challenge. He imagined a coordinate system: he put the origin of the coordinates at the intersection of the roof and the chimney, directed the OX axis to the left along the roof and the OY axis \u2014 up along the chimney (see figure). The Donkey imagined two rays emanating from he origin of axes at angles \u03b11 and \u03b12 to the OX axis. Now he chooses any star that lies strictly between these rays. After that he imagines more rays that emanate from this star at the same angles \u03b11 and \u03b12 to the OX axis and chooses another star that lies strictly between the new rays. He repeats the operation as long as there still are stars he can choose between the rays that emanate from a star. As a result, the Donkey gets a chain of stars. He can consecutively get to each star if he acts by the given rules.Your task is to find the maximum number of stars m that the Donkey's chain can contain.Note that the chain must necessarily start in the point of the origin of the axes, that isn't taken into consideration while counting the number m of stars in the chain.","input_specification":"The first line contains an integer n (1\u2264n\u226410^5) \u2014 the number of stars. The second line contains simple fractions representing relationships \"a\/b c\/d\", such that and (0\u2264a,b,c,d\u226410^5; ; ; ). The given numbers a, b, c, d are integers.\nNext n lines contain pairs of integers xi, yi (1\u2264xi,yi\u226410^5)\u2014 the stars' coordinates.\nIt is guaranteed that all stars have distinct coordinates.\n","output_specification":"In a single line print number m \u2014 the answer to the problem.\n","notes":"In the sample the longest chain the Donkey can build consists of four stars. Note that the Donkey can't choose the stars that lie on the rays he imagines.\n \n","sample_inputs":["15\n1\/3 2\/1\n3 1\n6 2\n4 2\n2 5\n4 5\n6 6\n3 4\n1 6\n2 1\n7 4\n9 3\n5 3\n1 3\n15 5\n12 4\n"],"sample_outputs":["4\n"],"human_solution":"import sys\r\nreadline=sys.stdin.readline\r\nimport bisect\r\n\r\ndef LIS(lst,weakly=False,inf=float('inf'),restoration=False):\r\n f=bisect.bisect_right if weakly else bisect.bisect_left\r\n N=len(lst)\r\n update=[None]*N\r\n dp=[inf]*N\r\n for k,x in enumerate(lst):\r\n i=f(dp,x)\r\n dp[i]=x\r\n update[k]=(i,dp[i])\r\n len_lis=bisect.bisect_left(dp,inf)\r\n if restoration:\r\n lis=[None]*len_lis\r\n len_lis-=1\r\n for i,x in update[::-1]:\r\n if i==len_lis:\r\n lis[len_lis]=x\r\n len_lis-=1\r\n return lis\r\n else:\r\n return len_lis\r\n\r\nN=int(readline())\r\nab,cd=readline().split()\r\na,b=map(int,ab.split(\"\/\"))\r\nc,d=map(int,cd.split(\"\/\"))\r\npoints=[]\r\nfor _ in range(N):\r\n x,y=map(int,readline().split())\r\n x,y=b*y-a*x,c*x-d*y\r\n if x>=0 and y>=0:\r\n points.append((x,y))\r\npoints.sort(key=lambda tpl:(tpl[0],-tpl[1]))\r\ninf=1<<35\r\nans=LIS([y for x,y in points],inf=inf)\r\nprint(ans)","testcases":"[{'input': ['15\\r\\n1\/3 2\/1\\r\\n3 1\\r\\n6 2\\r\\n4 2\\r\\n2 5\\r\\n4 5\\r\\n6 6\\r\\n3 4\\r\\n1 6\\r\\n2 1\\r\\n7 4\\r\\n9 3\\r\\n5 3\\r\\n1 3\\r\\n15 5\\r\\n12 4\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['15\\r\\n2\/1 2\/0\\r\\n3 1\\r\\n6 2\\r\\n9 3\\r\\n12 4\\r\\n15 5\\r\\n2 1\\r\\n4 2\\r\\n5 3\\r\\n7 4\\r\\n1 3\\r\\n3 4\\r\\n2 5\\r\\n4 5\\r\\n1 6\\r\\n6 6\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['15\\r\\n2\/1 2\/0\\r\\n3 1\\r\\n6 2\\r\\n9 3\\r\\n12 4\\r\\n15 5\\r\\n2 1\\r\\n4 2\\r\\n5 3\\r\\n7 4\\r\\n1 3\\r\\n3 4\\r\\n2 6\\r\\n4 5\\r\\n1 6\\r\\n6 6\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['15\\r\\n1\/4 2\/1\\r\\n3 1\\r\\n6 2\\r\\n9 3\\r\\n12 4\\r\\n15 5\\r\\n2 1\\r\\n4 2\\r\\n5 3\\r\\n7 4\\r\\n1 3\\r\\n3 4\\r\\n2 5\\r\\n4 5\\r\\n1 6\\r\\n6 6\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['5\\r\\n3\/24 24\/3\\r\\n31394 23366\\r\\n27990 71363\\r\\n33642 36903\\r\\n79731 10588\\r\\n10907 5058\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n84697 26074\\r\\n16334 31084\\r\\n38824 37740\\r\\n1288 50582\\r\\n87807 48721\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n5148 38615\\r\\n84759 63111\\r\\n16345 23100\\r\\n49727 20597\\r\\n43590 46573\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n49797 95131\\r\\n5075 96918\\r\\n91898 7865\\r\\n91852 41070\\r\\n12076 45049\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n43008 52460\\r\\n68903 46619\\r\\n16613 30280\\r\\n66639 17904\\r\\n83797 83401\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n66980 84763\\r\\n69224 39\\r\\n62888 61748\\r\\n53474 234\\r\\n77487 94808\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n35429 29897\\r\\n89928 67711\\r\\n29047 22691\\r\\n84838 6917\\r\\n32683 99009\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n3\/18 18\/17\\r\\n62344 72564\\r\\n31069 2824\\r\\n74485 34763\\r\\n61186 78544\\r\\n75470 51019\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n27\/18 27\/17\\r\\n27746 42830\\r\\n22071 47985\\r\\n44242 62799\\r\\n16038 48367\\r\\n85158 21622\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['5\\r\\n27\/18 27\/17\\r\\n91659 76441\\r\\n96317 38081\\r\\n99805 94867\\r\\n79758 84753\\r\\n96445 53616\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n27\/18 27\/17\\r\\n85006 4046\\r\\n10811 30171\\r\\n97316 32923\\r\\n73899 71559\\r\\n76723 17949\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n0\/17 74\/0\\r\\n24922 93126\\r\\n75686 80827\\r\\n33683 91759\\r\\n10584 66980\\r\\n58159 52129\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5\\r\\n0\/17 74\/0\\r\\n69711 29703\\r\\n91677 56040\\r\\n26051 78244\\r\\n20816 40897\\r\\n70770 35908\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n0\/17 74\/0\\r\\n68877 18122\\r\\n96115 84747\\r\\n71027 43746\\r\\n31622 3444\\r\\n93281 34803\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['5\\r\\n3\/24 24\/3\\r\\n31394 23366\\r\\n27990 71363\\r\\n33642 36903\\r\\n79731 10588\\r\\n10907 5058\\r\\n'], 'output': ['3\\r\\n']}]","id":745} {"difficulty":1800,"lang":"Ruby","lang_cluster":"Ruby","src_uid":"77b5f83cdadf4b0743618a46b646a849","execute_outcome":"WRONG_ANSWER","source_code":"num = gets.chomp\n\nnum_of_four = 0\nnum_of_seven = 0\nans_num = \"\"\nlen = num.length\n\ndef get_bigger len\n ans_num = \"4\"\n append_times = len \/ 2\n append_times.times { ans_num << \"4\" }\n append_times.times { ans_num << \"7\" }\n ans_num << \"7\"\nend\n\ndef get_rest(ans_num, len, num_of_four, num_of_seven)\n rest_four = len \/ 2 - num_of_four\n rest_seven = len \/ 2 - num_of_seven\n rest_four.times { ans_num << \"4\" }\n rest_seven.times { ans_num << \"7\" }\n return ans_num\nend\n\nif num[0] > \"7\" || len % 2 == 1\n ans_num = ans_num << (get_bigger len)\n\nelse\n index = len\n for i in 0...len\n if num[i] == \"4\" #many 4\n num_of_four = num_of_four + 1\n if num_of_four > len \/ 2\n num_of_four = num_of_four - 1\n index = i\n break\n end\n\n elsif num[i] == \"7\" #many 7\n num_of_seven = num_of_seven + 1\n if num_of_seven > len \/ 2\n num_of_seven = num_of_seven - 1\n index = i\n break\n end\n\n else\n index = i\n break\n end\n end\n \n if index == len\n ans_num = num\n elsif num[index] <= \"4\"\n ans_num = ans_num << num[0...index]\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n\n elsif num[index] < \"7\"\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n else\n index = index - 1\n while index >= 0\n break if num[index] == \"4\"\n num_of_seven = num_of_seven - 1\n end\n if index == -1\n ans_num = get_bigger len\n else\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_four = num_of_four - 1\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n end\n end\nend\n\nputs ans_num\n","description":"Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Lucky number is super lucky if it's decimal representation contains equal amount of digits 4 and 7. For example, numbers 47, 7744, 474477 are super lucky and 4, 744, 467 are not.One day Petya came across a positive integer n. Help him to find the least super lucky number which is not less than n.","input_specification":"The only line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910100000). This number doesn't have leading zeroes.","output_specification":"Output the least super lucky number that is more than or equal to n.","notes":null,"sample_inputs":["4500","47"],"sample_outputs":["4747","47"],"human_solution":"num = gets.chomp\n\nnum_of_four = 0\nnum_of_seven = 0\nans_num = \"\"\nlen = num.length\n\ndef get_bigger len\n ans_num = \"4\"\n append_times = len \/ 2\n append_times.times { ans_num << \"4\" }\n append_times.times { ans_num << \"7\" }\n ans_num << \"7\"\nend\n\ndef get_rest(ans_num, len, num_of_four, num_of_seven)\n rest_four = len \/ 2 - num_of_four\n rest_seven = len \/ 2 - num_of_seven\n rest_four.times { ans_num << \"4\" }\n rest_seven.times { ans_num << \"7\" }\n return ans_num\nend\n\ndef operation_with_seven(index, num, num_of_four, num_of_seven, len)\n ans_num = \"\"\n index = index - 1\n while index >= 0\n if num[index] == \"4\"\n num_of_four = num_of_four - 1\n break if len \/ 2 - num_of_seven > 0\n else\n num_of_seven = num_of_seven - 1\n end\n index = index - 1\n end\n if index == -1\n ans_num = get_bigger len\n else\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n end\n return ans_num\nend\n\nif num[0] > \"7\" || len % 2 == 1\n ans_num = ans_num << (get_bigger len)\n\nelse\n index = len\n for i in 0...len\n if num[i] == \"4\" #many 4\n num_of_four = num_of_four + 1\n if num_of_four > len \/ 2\n num_of_four = num_of_four - 1\n index = i\n break\n end\n\n elsif num[i] == \"7\" #many 7\n num_of_seven = num_of_seven + 1\n if num_of_seven > len \/ 2\n num_of_seven = num_of_seven - 1\n index = i\n break\n end\n\n else\n index = i\n break\n end\n end\n \n if index == len\n ans_num = num\n elsif num[index] <= \"4\"\n ans_num = ans_num << num[0...index]\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n\n elsif num[index] < \"7\"\n if len \/ 2 - num_of_seven > 0\n ans_num = ans_num << num[0...index]\n ans_num << \"7\"\n num_of_seven = num_of_seven + 1\n ans_num = get_rest ans_num, len, num_of_four, num_of_seven\n else\n ans_num = operation_with_seven index, num, num_of_four, num_of_seven, len\n end\n else\n ans_num = operation_with_seven index, num, num_of_four, num_of_seven, len\n end\nend\n\nputs ans_num","testcases":"[{'input': '4500\\r\\n', 'output': ['4747']}, {'input': '47\\r\\n', 'output': ['47']}, {'input': '1\\r\\n', 'output': ['47']}, {'input': '12\\r\\n', 'output': ['47']}, {'input': '4587\\r\\n', 'output': ['4747']}, {'input': '100\\r\\n', 'output': ['4477']}, {'input': '1007\\r\\n', 'output': ['4477']}, {'input': '99999999\\r\\n', 'output': ['4444477777']}, {'input': '491020945\\r\\n', 'output': ['4444477777']}, {'input': '1000000000\\r\\n', 'output': ['4444477777']}, {'input': '777777\\r\\n', 'output': ['44447777']}, {'input': '474\\r\\n', 'output': ['4477']}, {'input': '85469\\r\\n', 'output': ['444777']}, {'input': '7474747\\r\\n', 'output': ['44447777']}, {'input': '2145226\\r\\n', 'output': ['44447777']}, {'input': '5556585\\r\\n', 'output': ['44447777']}, {'input': '87584777\\r\\n', 'output': ['4444477777']}, {'input': '77777777\\r\\n', 'output': ['4444477777']}, {'input': '999999999\\r\\n', 'output': ['4444477777']}, {'input': '74477744\\r\\n', 'output': ['74477744']}, {'input': '444444444\\r\\n', 'output': ['4444477777']}, {'input': '467549754\\r\\n', 'output': ['4444477777']}, {'input': '147474747\\r\\n', 'output': ['4444477777']}, {'input': '555\\r\\n', 'output': ['4477']}, {'input': '100000\\r\\n', 'output': ['444777']}, {'input': '74777443\\r\\n', 'output': ['74777444']}, {'input': '4700007\\r\\n', 'output': ['44447777']}, {'input': '70070077\\r\\n', 'output': ['74444777']}, {'input': '123\\r\\n', 'output': ['4477']}, {'input': '7474\\r\\n', 'output': ['7474']}, {'input': '3696\\r\\n', 'output': ['4477']}, {'input': '888999577\\r\\n', 'output': ['4444477777']}, {'input': '10\\r\\n', 'output': ['47']}, {'input': '7\\r\\n', 'output': ['47']}, {'input': '50\\r\\n', 'output': ['74']}, {'input': '70\\r\\n', 'output': ['74']}, {'input': '74700\\r\\n', 'output': ['444777']}, {'input': '1024\\r\\n', 'output': ['4477']}, {'input': '73\\r\\n', 'output': ['74']}, {'input': '74710000\\r\\n', 'output': ['74744477']}, {'input': '444000000\\r\\n', 'output': ['4444477777']}, {'input': '4\\r\\n', 'output': ['47']}, {'input': '9\\r\\n', 'output': ['47']}, {'input': '99\\r\\n', 'output': ['4477']}, {'input': '48\\r\\n', 'output': ['74']}, {'input': '47474749\\r\\n', 'output': ['47474774']}, {'input': '47474774\\r\\n', 'output': ['47474774']}, {'input': '4777\\r\\n', 'output': ['7447']}, {'input': '7748\\r\\n', 'output': ['444777']}, {'input': '7773\\r\\n', 'output': ['444777']}, {'input': '19\\r\\n', 'output': ['47']}, {'input': '447777\\r\\n', 'output': ['474477']}, {'input': '49102094540227023300\\r\\n', 'output': ['74444444444777777777']}, {'input': '5594108733309806863211189515406929423407691887690557101598403485\\r\\n', 'output': ['7444444444444444444444444444444447777777777777777777777777777777']}, {'input': '7004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\\r\\n', 'output': ['7444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777']}, {'input': '795193728547733389463100378996233822835539327235483308682350676991954960294227364128385843182064933115\\r\\n', 'output': ['44444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777']}, {'input': '301382122197829808656613399420562764951572481833611230329075722481445978197842266439897625476362443656208649761035811772798756428618345007502378773513842734025400853676294262578640304874925665385620969733222114618795094220591624183177469045899618693581145...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777...']}, {'input': '61136338618684683458627308377793588546921041456473994251912971721612136383004772112243903436104509483190819343988300672009142812305068378720235800534191119843225949741796417107434937387267716981006150\\r\\n', 'output': ['74444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '526555890263119757633581621127083649847999764998329920328269766380711569281960840938078129331361539566687989563999315450947936329766384488609919296219937144991099500640739013558146241313903998769582963313684489892860656024874983638946463602603155256425277...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '359656337541570495535596692229036259138254295823773970608128157371326871668822859017267990233481525685137411515967174122395178508313541575185680538495137474161755451361511571745220633267878230944078217117373968887816250287108233790111105819421028764137532...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '572644857441140132421942747255807096805833305988086651340125855451991940035910944789722427227294827027423470359892571133559384095618773815550517606000346420892372228681350021976702338348174987065145549051119174000209319265682197997993522951757272212868453...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '599043573683856104439027643553996864930172922718193050579593140227265178809688641609079296226771746172586906362910466768194741605144777924396663290857511643060746702001318791356965828356639557730036143569264957358282516093427951005380589561898704535396465...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '247259917508033213329978700283436668925247349911687193751028546114460357462478790255716737901707817670038312409017368066801666150751218179935380115953926567959905844497912181784285489131602039421150091916944721889647073139381764961167817095360280389484951...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '839620233495334132140284749179933728711264780360341030526632441846802069795764116073504594438594457833637801964773168792432938493451846064048747603976565118198470436524623419276851413981369466457677912349027626603111552645792829970978344696298865655093856...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '680596233458569705465788423601042606237639114567090011249598812263852966370382067929765546670849148288633237610391397762455232677946335852511925659516087753908296796929375220974649508429653365375822834301794663206129356594668028542246627939025276788153158...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '251195069320073844235711294718028207393569940221659141396708541865689557466668672109186992674326781218861247057053201231685981997834330221004024396276028929267033460032996060897703746809689125932584345383640925182401678896271015230499718586573789843987788...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '761398305203150236975810733176741477690360342026700695511540431700019398059040240867278292976897516645258464666995990149873433263594134554632116631317180648687891414039623144815436037002580704356809617411407023961980506764832917585434636502804912905328498...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774744777447\\r\\n', 'output': ['47447774444477747744744477747744477774777774747474477744474447744447747777744777444474777477447777747477474774477444777777744774777474477744444474744777774744447747477747474447444444447444774747444444']}, {'input': '474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...', 'output': ['474444777444774744744474474747447777744777477747747747747774447747777474774774777744474774447774444447774744447744777774474774747744747744474777444747747747744747444744747447477744477777774744474774447747777474777744474477444744774477447444774444444744747...']}, {'input': '474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...', 'output': ['474747444474774474747447474477744774774774774777777447447774774747747447474474447777747774474747777747744474477477477474477747474744474474444477777747444444777747777444747474444444474474477777477744747474477777477447777777447777477774774474477774447444774...']}, {'input': '474777447477447774447777477444444747747747447474\\r\\n', 'output': ['474777447477447774447777477444444747747747447474']}, {'input': '461001134113023432513011122343276211132220003240540222441103160000437733232012500416111120731670263033701324623732441101023212322443134346315261012722222743233150523000143442220341502606460146270134003634627333143211007443113522314276144143340341430143230...', 'output': ['474444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777...']}, {'input': '414040460104241705103467732322410111321456730102020342430447445322177312253032133644400342076533221343224404112502131222170054211644126072412470310430200141260034460144143540431202361331322041450253407233440277130463330457165225132033131042410126100430407...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '727232045443164232004017336043067463233151253714716613434254723160000202600033757135233430131262002216223006210031640423201430416112231443425112013542002206442316216776311521427140132300426022306005202343334263322252201723173422722342103312344415331042666...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '760050172623445531303514402404000453124043133314471023027427761214614333104305332076164340144631326474433457030103502004715470012152121033505020102443110207300251363403253465111002515041024441041734352700440201030057344766451306606446421552040607420521422...', 'output': ['774444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '720436431603034224320442372001212510164126522343011034262272200353230224346331046602377325243216215330412012427335500104321345532642412347545001411531332021334123306344234016051314420246202102414203133224252614423643403321763474626264064113646266130410002...', 'output': ['744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '426342607733614324413262740153004344321256222204510610145710022363007103202274030024040036131051033604742752314041224033411122373061741300054114163017140071446041107041741712206725450474064445140032402223102027224117312572027504124513573253231023762244202...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '441426001203051411643330002074010670721702321221243423230413241430525145273160403026542614300404436511601050126044121140333023404113141304404071336127011413306725435344236142100431033013230372450632043170073742425215642477306747410130704114202673234310654...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '35881905331681060827588553219538774024143083787975\\r\\n', 'output': ['44444444444444444444444447777777777777777777777777']}, {'input': '221020945402270233\\r\\n', 'output': ['444444444777777777']}, {'input': '241925018843248944336317949908388280315030601139576419352009710\\r\\n', 'output': ['4444444444444444444444444444444477777777777777777777777777777777']}, {'input': '4747474749\\r\\n', 'output': ['4747474774']}, {'input': '4747474774\\r\\n', 'output': ['4747474774']}, {'input': '3013821221978298086566133994205627649515724818336112303290757224814459781978422664398976254763624436562086497610358117727987564286183450075023787735138427340254008536762942625786403048749256653856209697332221146187950942205916241831774690458996186935811456404646236811789323768094876439465157084437560869871534201872523316846066992005560637882936334830809562078292624820844581233002526363149920224836479222262916962782197253590084513766536500009545403848192852426840541772058312141715889523051768312545350261070...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...']}, {'input': '300315701225398103949172355218103087569515283105400017868730132769291700939035921405014640214190659140126383204458315111136164707153628616177467538307534664174018683245377348638677858006052356516328838399769950207054982712314494543889750490268253870160095357456864075250350735474301206523459172092665900965024129501630212966373988276932458849720393142004789869863743947961634907491797090041095838600303393556660079821519800685499052949978754418782241756597476926001413610822\\r\\n', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '5265558902631197576335816211270836498479997649983299203282697663807115692819608409380781293313615395666879895639993154509479363297663844886099192962199371449910995006407390135581462413139039987695829633136844898928606560248749836389464636026031552564252776327042072298610617772243834598332162690748633207236969041724992007258192157728677438052313486235695862788037296077269680985036263600247647374629140798940789379173021966313171953036235465755249249349065588163665746988251674366396383356070298502792947466713...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777...']}, {'input': '3596563375415704955355966922290362591382542958237739706081281573713268716688228590172679902334815256851374115159671741223951785083135415751856805384951374741617554513615115717452206332678782309440782171173739688878162502871082337901111058194210287641375328321235138624970843264230764727843223826146695894944571949545534783868546502523064898132419756343994188739630388305452374652571869884004139669269195491829709213403240366852784169546315949980917580948827513268536333560882563219185621140487441192415658128617...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444477777777777777777777777777777777...']}, {'input': '5726448574411401324219427472558070968058333059880866513401258554519919400359109447897224272272948270274234703598925711335593840956187738155505176060003464208923722286813500219767023383481749870651455490511191740002093192656821979979935229517572722128684530242954677937234591639406543933921393584264553545070143510487963371156151075456239168079565282696851129149944325844339105076033547064540551247638951814277551769210366429591454283731387498854711853954565721620718568555448566595137725509109332252115921107203...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '5990435736838561044390276435539968649301729227181930505795931402272651788096886416090792962267717461725869063629104667681947416051447779243966632908575116430607467020013187913569658283566395577300361435692649573582825160934279510053805895618987045353964652438415121521068998564380519093332511770138915257948823516733390947075234854837912395897801204371957935278919199141471017746475157107091718499034401345614491523186724536626759825908841655120909548134640392154155024958848688514381127156723306686142535904807...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2472599175080332133299787002834366689252473499116871937510285461144603574624787902557167379017078176700383124090173680668016661507512181799353801159539265679599058444979121817842854891316020394211500919169447218896470731393817649611678170953602803894849517883798001665873931988068465608543987110990620640454899877545013197911975636074148285314482378625396130600088011743729453908525253667227663343466686616610128874683718113351607968872115913521074131076370144031597411535573153579775091402069013643224352002479...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '8396202334953341321402847491799337287112647803603410305266324418468020697957641160735045944385944578336378019647731687924329384934518460640487476039765651181984704365246234192768514139813694664576779123490276266031115526457928299709783446962988656550938563101917862878595537323788552972891863126714533416299412474952579427903233129500323585762201601802564293323199559674719189685477525001035239872876588633701351714662714644096537402039123293674231599097097956316608817023792841428845669676574868899825758178518...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '6805962334585697054657884236010426062376391145670900112495988122638529663703820679297655466708491482886332376103913977624552326779463358525119256595160877539082967969293752209746495084296533653758228343017946632061293565946680285422466279390252767881531582735704699071143669422644336968482382677106022399295637510889604714980327995172374864896407671392923337387454990017068101183306428486980166073734527006537387203654449441786013360168869241661513482001715603896843364061058570081267383864631499192030880596537...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '2511950693200738442357112947180282073935699402216591413967085418656895574666686721091869926743267812188612470570532012316859819978343302210040243962760289292670334600329960608977037468096891259325843453836409251824016788962710152304997185865737898439877887665625262554006537881302950580590900934811683942391523983645058003891082579895256399594935068519494662565495158772269671887381021945464668681033132607900056573893415318336141793708024175405900967030037580867660423018691831554218206650833841038096395350137...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7613983052031502369758107331767414776903603420267006955115404317000193980590402408672782929768975166452584646669959901498734332635941345546321166313171806486878914140396231448154360370025807043568096174114070239619805067648329175854346365028049129053284984982094781973576835614806790810052616175491607897251065650265496025729051267373813224944263285375404887693716580635399939451526346010073722573695141235877186593577711475661141697689325152326767250660976204600043646233903382400942251821223989309887136900392...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...', 'output': ['4744447774447747447444744747474477777447774777477477477477744477477774747747747777444747744477744444477747444477447777744747747477447477444747774447477477477447474447447474474777444777777747444747744477477774747777444744774447447744774474447744444447447474777774747747444777777447774477474774477744744447777777474444447474477444474444444744777477744447774474444474774777744774444774744747747447447477477444444444444744447747777444774774447477447477474447444474474444474774474477744474777444444774447777747774477...']}, {'input': '4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...', 'output': ['4747474444747744747474474744777447747747747747777774474477747747477474474744744477777477744747477777477444744774774774744777474747444744744444777777474444447777477774447474744444444744744777774777447474744777774774477777774477774777747744744777744474447747744477744774474777477774744474777447474444744444744777777747447777774447474774444777747747477747444444747777444474747744744774477744474744474447777747744477444774744744747744777777774447774444747777777444777744444774744477477777477744474777744777474747477...']}, {'input': '4610011341130234325130111223432762111322200032405402224411031600004377332320125004161111207316702630337013246237324411010232123224431343463152610127222227432331505230001434422203415026064601462701340036346273331432110074431135223142761441433403414301432300263254301342131314327333745711213130421310313153504022700431534463141461236322033420140324202221402036761452134031253152442133141307046425107520\\r\\n', 'output': ['4744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777']}, {'input': '4140404601042417051034677323224101113214567301020203424304474453221773122530321336444003420765332213432244041125021312221700542116441260724124703104302001412600344601441435404312023613313220414502534072334402771304633304571652251320331310424101261004304075374341521421213431444010345255301410427664006112171147304147414021032230112024371431030230211332144647141336330201232340274043176313363306203143143420202461614040333610320140211530650627220442443122474573314472441637432355242111427372260743512211432352324...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7272320454431642320040173360430674632331512537147166134342547231600002026000337571352334301312620022162230062100316404232014304161122314434251120135420022064423162167763115214271401323004260223060052023433342633222522017231734227223421033123444153310426667264302040331032026321520406511056740224275234001143006323052333100544512431030133206341373241120141060440704012522372022053074013122120274015714341024302030004110272242301204335417411205430677420405031104224343443240223045046313235710010210003114400336475...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7600501726234455313035144024040004531240431333144710230274277612146143331043053320761643401446313264744334570301035020047154700121521210335050201024431102073002513634032534651110025150410244410417343527004402010300573447664513066064464215520406074205214222343114043142412273020421377253243110620014436121404500771137511233760012006402033231502312100073241421352114435005014246543751701710202010230321640610322330631312626422141150613214347310443346043015202321371147023021620400403263046403221244613123231203343...', 'output': ['7744444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '7204364316030342243204423720012125101641265223430110342622722003532302243463310466023773252432162153304120124273355001043213455326424123475450014115313320213341233063442340160513144202462021024142031332242526144236434033217634746262640641136462661304100020044130530077371134061073024742255331246024125370622716322573071422227565311144002201243263420524414022474133745113604130724342326413154222423705403222607041123443073072420032111321133031032304144221530342320240122207474336312334520713332404562603314106212...', 'output': ['7444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4263426077336143244132627401530043443212562222045106101457100223630071032022740300240400361310510336047427523140412240334111223730617413000541141630171400714460411070417417122067254504740644451400324022231020272241173125720275041245135732532310237622442021065674523445122245743317651014334372303244764351060045303423334400540434301336711037334036440040171461247051614213340233532460744331716563503417401244460317076543432605147203215122030412404612732361200631033373176171433253451540047013520215046204003724412...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '4414260012030514116433300020740106707217023212212434232304132414305251452731604030265426143004044365116010501260441211403330234041131413044040713361270114133067254353442361421004310330132303724506320431700737424252156424773067474101307041142026732343106545212113601021220631163242300103556005021044402433002261262331206453254012030562324716247141475702031003434671133441345640611313467121053644271311043217043007103133201241115601351331010302104120237725041014351211121613224266301712106122174311623455402201175...', 'output': ['4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}]","id":746}